Re #779: Implement 1.5 way LSD with separate locking for coast

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6057 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: d8496bd7120632a4c912379975097faeaacd2e15
Former-commit-id: dc0e54b235393773da2639510c439eb0ed747959
This commit is contained in:
kakukri 2015-07-30 13:49:03 +00:00
parent 3e28141da7
commit eeb3725822
3 changed files with 37 additions and 1 deletions

View file

@ -739,6 +739,7 @@ typedef struct CarElt
#define PRM_MIN_TQ_BIAS "min torque bias"
#define PRM_MAX_TQ_BIAS "max torque bias"
#define PRM_MAX_SLIP_BIAS "max slip bias"
#define PRM_COAST_MAX_SLIP_BIAS "coast max slip bias"
#define PRM_LOCKING_TQ "locking input torque"
#define PRM_VISCOSITY_FACTOR "viscosity factor"
@ -749,6 +750,8 @@ typedef struct CarElt
#define VAL_DIFF_LIMITED_SLIP "LIMITED SLIP"
#define VAL_DIFF_LOCKING "LOCKING"
#define VAL_DIFF_VISCOUS_COUPLER "VISCOUS COUPLER"
#define VAL_DIFF_15WAY_LSD "1.5 WAY LSD"
#define VAL_DIFF_ELECTRONIC_LSD "ELECTRONIC LSD"
#define VAL_TRANS_RWD "RWD"
#define VAL_TRANS_FWD "FWD"

View file

@ -45,10 +45,18 @@ SimDifferentialConfig(void *hdle, const char *section, tDifferential *differenti
differential->type = DIFF_SPOOL;
} else if (strcmp(type, VAL_DIFF_FREE) == 0) {
differential->type = DIFF_FREE;
} else if (strcmp(type, VAL_DIFF_15WAY_LSD) == 0) {
differential->type = DIFF_15WAY_LSD;
} else if (strcmp(type, VAL_DIFF_ELECTRONIC_LSD) == 0) {
differential->type = DIFF_ELECTRONIC_LSD;
} else {
differential->type = DIFF_NONE;
}
if ( (differential->type == DIFF_15WAY_LSD) || (differential->type == DIFF_ELECTRONIC_LSD) ) {
differential->dCoastSlipMax = GfParmGetNum(hdle, section, PRM_COAST_MAX_SLIP_BIAS, (char*)NULL, differential->dSlipMax);
} else {differential->dCoastSlipMax = differential->dSlipMax;}
if (differential->efficiency > 1.0f) {differential->efficiency = 1.0f;}
if (differential->efficiency < 0.0f) {differential->efficiency = 0.0f;}
@ -210,6 +218,28 @@ SimDifferentialUpdate(tCar *car, tDifferential *differential, int first)
}
break;
case DIFF_ELECTRONIC_LSD: ;
case DIFF_15WAY_LSD:
//Similar to DIFF_LIMITED_SLIP,
//but has different dSlipMax for power (acceleration)
//and coast (deceleration), instead working as a free
//differential in coast direction.
//Electronic LSD has the same working, but its parameters
//can be changed during driving.
{
float spiderTq = inTq1 - inTq0;
float propTq = DrTq/differential->lockInputTq;
float rate = 0.0f;
rate = 1.0f - exp(-propTq*propTq);
float pressure = tanh(rate*(spinVel1-spinVel0));
float bias = (DrTq >= 0 ? differential->dSlipMax : differential->dCoastSlipMax) * 0.5f* pressure;
float open = 1.0f;// - rate;
DrTq0 = DrTq*(0.5f+bias) + spiderTq*open;
DrTq1 = DrTq*(0.5f-bias) - spiderTq*open;
}
break;
case DIFF_VISCOUS_COUPLER:
if (spinVel0 >= spinVel1) {
DrTq0 = DrTq * differential->dTqMin;

View file

@ -37,6 +37,8 @@ typedef struct
#define DIFF_FREE 2
#define DIFF_LIMITED_SLIP 3
#define DIFF_VISCOUS_COUPLER 4
#define DIFF_15WAY_LSD 5
#define DIFF_ELECTRONIC_LSD 6
tdble ratio;
tdble I;
tdble efficiency;
@ -44,6 +46,7 @@ typedef struct
tdble dTqMin;
tdble dTqMax;
tdble dSlipMax;
tdble dCoastSlipMax;
tdble lockInputTq;
tdble viscosity;
tdble viscomax;