diff --git a/src/interfaces/car.h b/src/interfaces/car.h index 2337ca7fe..edb869c0e 100644 --- a/src/interfaces/car.h +++ b/src/interfaces/car.h @@ -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" diff --git a/src/modules/simu/simuv4/differential.cpp b/src/modules/simu/simuv4/differential.cpp index fe88430e1..69b6898fc 100644 --- a/src/modules/simu/simuv4/differential.cpp +++ b/src/modules/simu/simuv4/differential.cpp @@ -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; diff --git a/src/modules/simu/simuv4/differential.h b/src/modules/simu/simuv4/differential.h index 1884568b6..7aa98d219 100644 --- a/src/modules/simu/simuv4/differential.h +++ b/src/modules/simu/simuv4/differential.h @@ -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;