added differential changes to simuv2 from simuv3, including the new "Locking" diff and changes to Limited Slip diffs.
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@204 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 397f80d1ac40ecd0182d792679e71feac269c2cd Former-commit-id: fdf48ac21e0fe34a928f7d84a48ab5a58792cd62
This commit is contained in:
parent
1cff825276
commit
48f6f3cc49
3 changed files with 41 additions and 3 deletions
|
@ -548,6 +548,7 @@ typedef struct CarElt
|
||||||
#define VAL_DIFF_SPOOL "SPOOL"
|
#define VAL_DIFF_SPOOL "SPOOL"
|
||||||
#define VAL_DIFF_FREE "FREE"
|
#define VAL_DIFF_FREE "FREE"
|
||||||
#define VAL_DIFF_LIMITED_SLIP "LIMITED SLIP"
|
#define VAL_DIFF_LIMITED_SLIP "LIMITED SLIP"
|
||||||
|
#define VAL_DIFF_LOCKING "LOCKING"
|
||||||
#define VAL_DIFF_VISCOUS_COUPLER "VISCOUS COUPLER"
|
#define VAL_DIFF_VISCOUS_COUPLER "VISCOUS COUPLER"
|
||||||
|
|
||||||
#define VAL_TRANS_RWD "RWD"
|
#define VAL_TRANS_RWD "RWD"
|
||||||
|
|
|
@ -43,6 +43,8 @@ SimDifferentialConfig(void *hdle, char *section, tDifferential *differential)
|
||||||
differential->type = DIFF_VISCOUS_COUPLER;
|
differential->type = DIFF_VISCOUS_COUPLER;
|
||||||
} else if (strcmp(type, VAL_DIFF_SPOOL) == 0) {
|
} else if (strcmp(type, VAL_DIFF_SPOOL) == 0) {
|
||||||
differential->type = DIFF_SPOOL;
|
differential->type = DIFF_SPOOL;
|
||||||
|
} else if (strcmp(type, VAL_DIFF_LOCKING) == 0) {
|
||||||
|
differential->type = DIFF_LOCKING;
|
||||||
} else if (strcmp(type, VAL_DIFF_FREE) == 0) {
|
} else if (strcmp(type, VAL_DIFF_FREE) == 0) {
|
||||||
differential->type = DIFF_FREE;
|
differential->type = DIFF_FREE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -176,6 +178,36 @@ SimDifferentialUpdate(tCar *car, tDifferential *differential, int first)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case DIFF_LOCKING:
|
||||||
|
// Locking differential - used to be LIMITED_SLIP
|
||||||
|
|
||||||
|
if (DrTq > differential->lockInputTq) {
|
||||||
|
updateSpool(car, differential, first);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
spdRatioMax = differential->dSlipMax - DrTq * differential->dSlipMax / differential->lockInputTq;
|
||||||
|
if (spdRatio > spdRatioMax) {
|
||||||
|
deltaSpd = (spdRatio - spdRatioMax) * fabs(spinVel0 + spinVel1) / 2.0;
|
||||||
|
if (spinVel0 > spinVel1) {
|
||||||
|
spinVel0 -= deltaSpd;
|
||||||
|
spinVel1 += deltaSpd;
|
||||||
|
} else {
|
||||||
|
spinVel0 += deltaSpd;
|
||||||
|
spinVel1 -= deltaSpd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spinVel0 > spinVel1) {
|
||||||
|
DrTq1 = DrTq * (0.5 + differential->bias);
|
||||||
|
DrTq0 = DrTq * (0.5 - differential->bias);
|
||||||
|
} else {
|
||||||
|
DrTq1 = DrTq * (0.5 - differential->bias);
|
||||||
|
DrTq0 = DrTq * (0.5 + differential->bias);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case DIFF_LIMITED_SLIP:
|
case DIFF_LIMITED_SLIP:
|
||||||
// Limited slip differential with:
|
// Limited slip differential with:
|
||||||
// - Gradual frictive locking
|
// - Gradual frictive locking
|
||||||
|
@ -201,9 +233,13 @@ SimDifferentialUpdate(tCar *car, tDifferential *differential, int first)
|
||||||
|
|
||||||
float pressure = tanh(rate*(spinVel1-spinVel0));
|
float pressure = tanh(rate*(spinVel1-spinVel0));
|
||||||
float bias = differential->dSlipMax * 0.5f* pressure;
|
float bias = differential->dSlipMax * 0.5f* pressure;
|
||||||
float open = 1.0f;// - rate;
|
float open = 1.0f - fabs(pressure);
|
||||||
DrTq0 = DrTq*(0.5f+bias) + spiderTq*open;
|
DrTq0 = DrTq*(0.5f+bias) + spiderTq;
|
||||||
DrTq1 = DrTq*(0.5f-bias) - spiderTq*open;
|
DrTq1 = DrTq*(0.5f-bias) - spiderTq;
|
||||||
|
DrTq0 = open*(DrTq*(0.5f) + spiderTq)
|
||||||
|
+ (1 - open)*(DrTq*(0.5f + bias));
|
||||||
|
DrTq1 = open*(DrTq*(0.5f) - spiderTq)
|
||||||
|
+ (1 - open)*(DrTq*(0.5f - bias));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ typedef struct
|
||||||
#define DIFF_FREE 2
|
#define DIFF_FREE 2
|
||||||
#define DIFF_LIMITED_SLIP 3
|
#define DIFF_LIMITED_SLIP 3
|
||||||
#define DIFF_VISCOUS_COUPLER 4
|
#define DIFF_VISCOUS_COUPLER 4
|
||||||
|
#define DIFF_LOCKING 5
|
||||||
tdble ratio;
|
tdble ratio;
|
||||||
tdble I;
|
tdble I;
|
||||||
tdble efficiency;
|
tdble efficiency;
|
||||||
|
|
Loading…
Reference in a new issue