SimuV5: Added "fuel mass mult" parameter. This multiplies the weight of fuel, with a value of 1.0 being 1 kg per liter.

Also roll back a change to tire pressure that caused strange behavior with very small cars, like karts.

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

Former-commit-id: 0cf90392430b237ee451169ed8e86c8f924b992e
Former-commit-id: 99fc40c6f0dcbb44c1ba4390dc32ef62b95d8146
This commit is contained in:
harunasan 2024-11-29 16:06:02 +00:00
parent b2e5728af9
commit b30507306f
3 changed files with 18 additions and 42 deletions

View file

@ -165,8 +165,9 @@ SimCarConfig(tCar *car)
{
car->fuel = car->tank;
}
car->fuel_prev = car->fuel;
car->fuelMass = GfParmGetNum(hdle, SECT_CAR, PRM_FUELMASS, (char*)NULL, 1.0);
setupFuel->desired_value = setupFuel->min = setupFuel->max = 80.0;
GfParmGetNumWithLimits(hdle, SECT_CAR, PRM_FUEL, (char*)NULL, &(setupFuel->desired_value), &(setupFuel->min), &(setupFuel->max));
@ -619,7 +620,7 @@ SimCarUpdateForces(tCar *car)
car->preDynGC = car->DynGCg;
/* total mass */
m = car->mass + car->fuel;
m = car->mass + (car->fuel * car->fuelMass);
minv = (tdble) (1.0 / m);
w = -m * G;
@ -950,7 +951,7 @@ SimTelemetryOut(tCar *car)
else if (car->ctrl->telemetryMode == 2)
{
// Mass from total and mass from wheels
float MassTotal = car->mass + car->fuel;
float MassTotal = car->mass + (car->fuel * car->fuelMass);
float mass = car->wheel[FRNT_RGT].weight0 + car->wheel[FRNT_LFT].weight0 + car->wheel[REAR_RGT].weight0 + car->wheel[REAR_LFT].weight0;
float massfactor = (mass + car->fuel*G) / mass;
float MassTotal2 = massfactor/G * (car->wheel[0].weight0 + car->wheel[1].weight0 + car->wheel[2].weight0 + car->wheel[3].weight0);

View file

@ -61,6 +61,7 @@ typedef struct
/* dynamic */
tdble fuel; /* current fuel load */
tdble fuelMass; /* current fuel mass */
tdble fuel_consumption; /* average fuel consumption */
tdble fuel_prev; /* average fuel consumption */
tdble fuel_time; /* average fuel consumption */

View file

@ -203,7 +203,7 @@ void SimWheelConfig(tCar *car, int index)
wheel->pressure = MIN(setupPressure->max, MAX(setupPressure->min, setupPressure->desired_value));
wheel->currentPressure = wheel->pressure; //MIN(setupPressure->max, MAX(setupPressure->min, setupPressure->desired_value));
if (car->features & FEAT_COMPOUNDS && car->options->tyre_temperature)
if (car->features & FEAT_COMPOUNDS && car->options->compounds)
{
wheel->tireSet = MIN(setupCompound->max, MAX(setupCompound->min, setupCompound->desired_value));
wheel->mu = wheel->muC[wheel->tireSet];
@ -326,7 +326,9 @@ void SimWheelConfig(tCar *car, int index)
// but only if temperature feature is enabled.
if (car->features & FEAT_TIRETEMPDEG)
{
wheel->mfB = ((Ca*0.50) + (wheel->currentPressure * 0.0001)) / wheel->mfC;
//wheel->mfB = ((Ca*0.50) + (wheel->currentPressure * 0.0001)) / wheel->mfC;
wheel->mfB = Ca / wheel->mfC;
}
else
{
@ -967,8 +969,8 @@ void SimWheelUpdateTire(tCar *car, int index)
tdble normalForce = wheel->forces.z;
tdble slip = wheel->tireSlip;
tdble lateralForce = fabs(wheel->forces.y);
tdble longForce = fabs(wheel->forces.x);
tdble lateralForce = (wheel->forces.y);
tdble longForce = (wheel->forces.x);
tdble absForce2 = fabs(normalForce * 0.5);
//tdble slipRatio = wheel->spinVel * wheel->radius;
tdble latMod = 0;
@ -1002,20 +1004,15 @@ void SimWheelUpdateTire(tCar *car, int index)
{
slip = 1;
}
else if (slip <= -1)
{
slip = -1;
}
else
{
slip = slip;
}
if (normalForce >= wheel->opLoad * 2)
{
normalForce = wheel->opLoad * 2;
}
else
{
normalForce = normalForce;
}
// Calculate factor for energy which is turned into heat, according papers this seems to be pretty constant
// for a specific construction and constant slip (empiric value with model validation, called hysteresis).
// A value of 0.1 is available in papers, so for 10% slip I head for 0.1, where 0.05 come from rolling and
@ -1026,27 +1023,6 @@ void SimWheelUpdateTire(tCar *car, int index)
// Calculate energy input for the tire
tdble energyGain = normalForce * wheelSpeed * SimDeltaTime * hysteresis;
// Normalize lateral and longitudinal forces if they peak too far past the operating threshold.
// This is done to (slightly) even out tire heating so huge differences in tire pressure are not necessary
// for cars with a lot of weight on one axle or the other.
if (lateralForce >= wheel->opLoad * 2)
{
lateralForce = wheel->opLoad * 2;
}
else
{
lateralForce = lateralForce;
}
if (longForce >= wheel->opLoad * 2)
{
longForce = wheel->opLoad * 2;
}
else
{
longForce = longForce;
}
// Modifiers for energy input from lateral and longitudinal forces.
latMod = ((lateralForce * absForce2) * wheel->latHeatFactor) * SimDeltaTime * 0.0004;
longMod = ((longForce * absForce2) * wheel->longHeatFactor) * SimDeltaTime * 0.0004;
@ -1100,8 +1076,8 @@ void SimWheelUpdateTire(tCar *car, int index)
// This is because some series/car types use tire warmers, which would make the initial
// tire temperature much closer to optimal.
// According to tire data from a leading GT tire manufacturer, tire pressure goes up by ~0.7 PSI for every 10 F (~5.56 C).
// wheel->currentPressure = ((wheel->Ttire + ((Tair - 273.15) * 1.50)) * wheel->pressure) / Tair;
wheel->currentPressure = wheel->Ttire / Tair * wheel->pressure;
//wheel->currentPressure = ((wheel->Ttire + ((Tair - 273.15) * 1.50)) * wheel->pressure) / Tair;
wheel->currentPressure = wheel->Ttire / wheel->Tinit * wheel->pressure;
// Wear
double deltaWear = (wheel->currentPressure - SimAirPressure) * slip * wheelSpeed * SimDeltaTime * (energyMod + normalForce)
@ -1112,9 +1088,7 @@ void SimWheelUpdateTire(tCar *car, int index)
wheel->currentWear = 1.0f;
// Graining
// Note that we use the TRACK temp and not the initial tire temp
// if the initial tire temp is higher (tire warmers, for example)
tdble grainTemperature = (wheel->Topt - Tair) * 3.0f / 4.0f + Tair;
tdble grainTemperature = (wheel->Topt - wheel->Ttire) * 3.0f / 4.0f + wheel->Ttire;
tdble deltaGraining = (grainTemperature - wheel->Ttire) * deltaWear;
if (deltaGraining > 0.0f)
{