Re #924: Add SimWingReConfig and SimBrakeSystemReConfig
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6221 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: b08dc52df579f21d23243d100f9fab6727100bc3 Former-commit-id: f49a1d5a623bf690244704baa68b561b034cce3c
This commit is contained in:
parent
8f7c3a5eb0
commit
da0064ed57
3 changed files with 62 additions and 22 deletions
|
@ -237,9 +237,13 @@ SimWingConfig(tCar *car, int index)
|
|||
void *hdle = car->params;
|
||||
tWing *wing = &(car->wing[index]);
|
||||
tdble area;
|
||||
tCarSetupItem *setupAngle = &(car->carElt->setup.wingAngle[index]);
|
||||
|
||||
area = GfParmGetNum(hdle, WingSect[index], PRM_WINGAREA, (char*)NULL, 0);
|
||||
wing->angle = GfParmGetNum(hdle, WingSect[index], PRM_WINGANGLE, (char*)NULL, 0);
|
||||
setupAngle->desired_value = setupAngle->min = setupAngle->max = 0.0;
|
||||
GfParmGetNumWithLimits(hdle, WingSect[index], PRM_WINGANGLE, (char*)NULL, &(setupAngle->desired_value), &(setupAngle->min), &(setupAngle->max));
|
||||
setupAngle->changed = TRUE;
|
||||
setupAngle->stepsize = DEG2RAD(0.1);
|
||||
wing->staticPos.x = GfParmGetNum(hdle, WingSect[index], PRM_XPOS, (char*)NULL, 0);
|
||||
wing->staticPos.z = GfParmGetNum(hdle, WingSect[index], PRM_ZPOS, (char*)NULL, 0);
|
||||
wing->staticPos.y = 0.0;
|
||||
|
@ -328,28 +332,10 @@ SimWingConfig(tCar *car, int index)
|
|||
if (wing->WingType == 0)
|
||||
{
|
||||
wing->Kz = 4.0f * wing->Kx;
|
||||
if (index == 1)
|
||||
{
|
||||
car->aero.Cd = car->aero.CdBody - wing->Kx*sin(wing->angle);
|
||||
//fprintf(stderr,"Kz: %g Kx: %g\n",wing->Kz,wing->Kx);
|
||||
//fprintf(stderr,"car->aero.Cd: %g angle: %g\n",car->aero.Cd,wing->angle*180/PI);
|
||||
}
|
||||
}
|
||||
else if (wing->WingType == 1)
|
||||
{
|
||||
wing->Kz = CliftFromAoA(wing) * wing->Kx;
|
||||
//fprintf(stderr,"Kz: %g Kx: %g\n",wing->Kz,wing->Kx);
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
car->aero.Cd = (tdble)(car->aero.CdBody - wing->Kx*sin(wing->angle - wing->AoAatZRad));
|
||||
//fprintf(stderr,"car->aero.Cd: %g wing->Kx: %g angle: %g wing->AoAatZero: %g\n",car->aero.Cd,wing->Kx,wing->angle*180/PI,wing->AoAatZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
car->aero.Cd -= (tdble)(wing->Kx*sin(wing->angle - wing->AoAatZRad));
|
||||
//fprintf(stderr,"car->aero.Cd: %g wing->Kx: %g wing->angle: %g wing->AoAatZero: %g\n",car->aero.Cd,wing->Kx,wing->angle*180/PI,wing->AoAatZero);
|
||||
}
|
||||
wing->Kz = CliftFromAoA(wing) * wing->Kx;
|
||||
}
|
||||
else if (wing->WingType == 2)
|
||||
{
|
||||
|
@ -363,8 +349,30 @@ SimWingConfig(tCar *car, int index)
|
|||
wing->Kx3 = 1.0f;
|
||||
wing->Kx4 = 0.9f;
|
||||
}
|
||||
SimWingReConfig(car, index);
|
||||
}
|
||||
|
||||
void
|
||||
SimWingReConfig(tCar *car, int index)
|
||||
{
|
||||
tWing *wing = &(car->wing[index]);
|
||||
tCarSetupItem *angle = &(car->carElt->setup.wingAngle[index]);
|
||||
|
||||
if (angle->changed) {
|
||||
wing->angle = MIN(angle->max,MAX(angle->min,angle->desired_value));
|
||||
angle->value = wing->angle;
|
||||
|
||||
if (wing->WingType == 0) {
|
||||
if (index==1) {
|
||||
car->aero.Cd = car->aero.CdBody - wing->Kx*sin(wing->angle);
|
||||
}
|
||||
} else if (wing->WingType == 1) {
|
||||
tWing *otherwing = &(car->wing[1-index]);
|
||||
car->aero.Cd = (tdble)(car->aero.CdBody - wing->Kx*sin(wing->angle - wing->AoAatZRad) - otherwing->Kx*sin(otherwing->angle - otherwing->AoAatZRad));
|
||||
}
|
||||
angle->changed = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SimWingUpdate(tCar *car, int index, tSituation* s)
|
||||
|
|
|
@ -88,11 +88,41 @@ void
|
|||
SimBrakeSystemConfig(tCar *car)
|
||||
{
|
||||
void *hdle = car->params;
|
||||
tCarSetupItem *setupBrkRep = &(car->carElt->setup.brakeRepartition);
|
||||
tCarSetupItem *setupBrkPress = &(car->carElt->setup.brakePressure);
|
||||
|
||||
setupBrkRep->desired_value = setupBrkRep->min = setupBrkRep->max = 0.5;
|
||||
GfParmGetNumWithLimits(hdle, SECT_BRKSYST, PRM_BRKREP, (char*)NULL, &(setupBrkRep->desired_value), &(setupBrkRep->min), &(setupBrkRep->max));
|
||||
setupBrkRep->changed = TRUE;
|
||||
setupBrkRep->stepsize = 0.5;
|
||||
|
||||
setupBrkPress->desired_value = setupBrkPress->min = setupBrkPress->max = 1000000;
|
||||
GfParmGetNumWithLimits(hdle, SECT_BRKSYST, PRM_BRKPRESS, (char*)NULL, &(setupBrkPress->desired_value), &(setupBrkPress->min), &(setupBrkPress->max));
|
||||
setupBrkPress->changed = TRUE;
|
||||
setupBrkPress->stepsize = 1000;
|
||||
|
||||
car->brkSyst.rep = GfParmGetNum(hdle, SECT_BRKSYST, PRM_BRKREP, (char*)NULL, 0.5);
|
||||
car->brkSyst.coeff = GfParmGetNum(hdle, SECT_BRKSYST, PRM_BRKPRESS, (char*)NULL, 1000000);
|
||||
car->brkSyst.ebrake_pressure = GfParmGetNum(hdle, SECT_BRKSYST, PRM_EBRKPRESS, (char*)NULL, 0.0);
|
||||
|
||||
SimBrakeSystemReConfig(car);
|
||||
}
|
||||
|
||||
void
|
||||
SimBrakeSystemReConfig(tCar *car)
|
||||
{
|
||||
tCarSetupItem *setupBrkRep = &(car->carElt->setup.brakeRepartition);
|
||||
tCarSetupItem *setupBrkPress = &(car->carElt->setup.brakePressure);
|
||||
|
||||
if (setupBrkRep->changed) {
|
||||
car->brkSyst.rep = MIN(setupBrkRep->max, MAX(setupBrkRep->min, setupBrkRep->desired_value));
|
||||
setupBrkRep->value = car->brkSyst.rep;
|
||||
setupBrkRep->changed = FALSE;
|
||||
}
|
||||
|
||||
if (setupBrkPress->changed) {
|
||||
car->brkSyst.coeff = MIN(setupBrkPress->max, MAX(setupBrkPress->min, setupBrkPress->desired_value));
|
||||
setupBrkPress->value = car->brkSyst.coeff;
|
||||
setupBrkPress->changed = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -70,11 +70,13 @@ extern void SimSteerUpdate(tCar *car);
|
|||
extern void SimBrakeConfig(void *hdle, const char *section, tBrake *brake);
|
||||
extern void SimBrakeUpdate(tCar *car, tWheel *wheel, tBrake *brake);
|
||||
extern void SimBrakeSystemConfig(tCar *car);
|
||||
extern void SimBrakeSystemReConfig(tCar *car);
|
||||
extern void SimBrakeSystemUpdate(tCar *car);
|
||||
|
||||
extern void SimAeroConfig(tCar *car);
|
||||
extern void SimAeroUpdate(tCar *car, tSituation *s);
|
||||
extern void SimWingConfig(tCar *car, int index);
|
||||
extern void SimWingReConfig(tCar *car, int index);
|
||||
extern void SimWingUpdate(tCar *car, int index, tSituation *s);
|
||||
|
||||
extern void SimCarUpdateWheelPos(tCar *car);
|
||||
|
|
Loading…
Reference in a new issue