18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 19:57:06 +01:00

refactor(physics): six more of what the rest only reads are private, under names of their own

The mass of the empty vehicle, the braking force, the outcome of a derailment,
the departure signal, the traction mode of a dual-mode vehicle and the moment
of the motors are private to physics::Vehicle like the 53 before them, read
through Mass(), Fb(), Derailed(), DepartureSignal(), TractionMode() and Mm().
Inside the class they are emptyMass, brakingForce, derailOutcome,
departureSignalOn, tractionModeSetting and motorMoment, as the plain camelCase
names were taken by locals there.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
2026-11-29 13:23:53 +01:00
parent 5879c228dc
commit ef8a1fdbfd
41 changed files with 167 additions and 160 deletions
+10 -10
View File
@@ -445,13 +445,13 @@ bool physics::Vehicle::MotorBlowersSwitchOff(bool State, VehicleEnd const Side,
// the traction selector of a dual-mode vehicle: moves only with the line breaker open, and only where a genset is
bool physics::Vehicle::TractionModeSwitch(traction_mode const Mode, range_t const Notify)
{
auto const initialstate{TractionMode};
auto const initialstate{tractionModeSetting};
// refused with the line breaker closed, and then not passed on either, so the train stays on one source
auto const accepted{false == lineBreaker.IsClosed()};
if (Genset.fitted() && accepted)
{
TractionMode = Mode;
tractionModeSetting = Mode;
}
if (Notify != range_t::local && accepted)
@@ -459,7 +459,7 @@ bool physics::Vehicle::TractionModeSwitch(traction_mode const Mode, range_t cons
SendCtrlToNext(VehicleCommand::tractionMode, Mode == traction_mode::genset ? 1 : 0, CabActive, Notify == range_t::unit ? Coupling::control | Coupling::permanent : Coupling::control);
}
return TractionMode != initialstate;
return tractionModeSetting != initialstate;
}
// *************************************************************************************************
@@ -706,7 +706,7 @@ void physics::Vehicle::SeriesMotorTractionForce(double dt)
// yB: szereg dwoch sekcji w ET42
if (trainType == train_type::et42 && Imax == imaxHi)
EngineVoltage = EngineVoltage / 2.0;
Mm = Momentum(Current(enrot, EngineVoltage)); // oblicza tez prad p/slinik
motorMoment = Momentum(Current(enrot, EngineVoltage)); // oblicza tez prad p/slinik
if (trainType == train_type::et42)
{
@@ -721,7 +721,7 @@ void physics::Vehicle::SeriesMotorTractionForce(double dt)
}
if (trainType == train_type::et22 && delayCtrlFlag) // szarpanie przy zmianie układu w byku
Mm = Mm * RList[MainCtrlActualPos].Bn / (RList[MainCtrlActualPos].Bn + 1); // zrobione w momencie, żeby nie dawac elektryki w przeliczaniu sił
motorMoment = motorMoment * RList[MainCtrlActualPos].Bn / (RList[MainCtrlActualPos].Bn + 1); // zrobione w momencie, żeby nie dawac elektryki w przeliczaniu sił
if (abs(Im) > Imax)
Vhyp += dt; //*(abs(Im) / Imax - 0.9) * 10; // zwieksz czas oddzialywania na PN
@@ -736,7 +736,7 @@ void physics::Vehicle::SeriesMotorTractionForce(double dt)
Itot = Im;
else
Itot = Im * RList[MainCtrlActualPos].Bn; // prad silnika * ilosc galezi
Mw = Mm * Transmision.Ratio * Transmision.Efficiency;
Mw = motorMoment * Transmision.Ratio * Transmision.Efficiency;
Fw = Mw * 2.0 / wheelDiameter;
ft = Fw * nPoweredAxles; // sila trakcyjna
}
@@ -789,7 +789,7 @@ void physics::Vehicle::SeriesMotorDynamicBrake(double dt)
Vadd = std::min(std::max(Vadd, TUHEX_MinIw), TUHEX_MaxIw);
}
if (Vadd > 0)
Mm = MomentumF(Im, Vadd, 0);
motorMoment = MomentumF(Im, Vadd, 0);
}
// the shunt field relays of a diesel-electric, each kind its own conditions on the current, the speed or the
@@ -1306,8 +1306,8 @@ void physics::Vehicle::InductionMotorDrive(double dt)
// power inverters
UpdateInverterFrequency();
Mm = inductionMotor.state.torque * DirAbsolute;
Mw = Mm * Transmision.Ratio * Transmision.Efficiency;
motorMoment = inductionMotor.state.torque * DirAbsolute;
Mw = motorMoment * Transmision.Ratio * Transmision.Efficiency;
Fw = Mw * 2.0 / wheelDiameter;
ft = Fw * nPoweredAxles * inductionMotor.inverterRatio;
inductionMotor.state.force = DirAbsolute * ft / 1000;
@@ -1375,7 +1375,7 @@ void physics::Vehicle::InductionMotorOff()
inv.IsActive = false;
}
Im = 0.0;
Mm = 0.0;
motorMoment = 0.0;
Mw = 0.0;
Fw = 0.0;
ft = 0.0;