mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-03 00:45:29 +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:
@@ -41,12 +41,12 @@ std::vector<invariant> const &invariants() {
|
||||
static std::vector<invariant> const rules{
|
||||
{"every value a number",
|
||||
[](auto const &M, double, auto const *) {
|
||||
std::initializer_list<double> const values{M.V(), M.AccS(), M.Ft(), M.Fb, M.Im, M.Itot, M.EngineVoltage,
|
||||
std::initializer_list<double> const values{M.V(), M.AccS(), M.Ft(), M.Fb(), M.Im, M.Itot, M.EngineVoltage,
|
||||
M.enrot, M.brakePipe.Pressure(), M.brakes.cylinderPressure, M.brakes.independentCylinderPressure, M.mainPipe.Pressure(), M.air.MainReservoirPressure(), M.lowVoltage.BatteryVoltage()};
|
||||
return std::ranges::all_of(values, [](double const Value) { return std::isfinite(Value); });
|
||||
},
|
||||
[](auto const &M) {
|
||||
return values({{"V", M.V()}, {"AccS", M.AccS()}, {"Ft", M.Ft()}, {"Fb", M.Fb}, {"Im", M.Im}, {"Itot", M.Itot}, {"EngineVoltage", M.EngineVoltage},
|
||||
return values({{"V", M.V()}, {"AccS", M.AccS()}, {"Ft", M.Ft()}, {"Fb", M.Fb()}, {"Im", M.Im}, {"Itot", M.Itot}, {"EngineVoltage", M.EngineVoltage},
|
||||
{"enrot", M.enrot}, {"PipePress", M.brakePipe.Pressure()}, {"BrakePress", M.brakes.cylinderPressure}, {"LocBrakePress", M.brakes.independentCylinderPressure},
|
||||
{"ScndPipePress", M.mainPipe.Pressure()}, {"Compressor", M.air.MainReservoirPressure()}, {"BatteryVoltage", M.lowVoltage.BatteryVoltage()}});
|
||||
}},
|
||||
@@ -115,8 +115,8 @@ std::vector<invariant> const &invariants() {
|
||||
},
|
||||
[](auto const &M) { return values({{"V", M.V()}, {"AccS", M.AccS()}}); }},
|
||||
{"hand brake applied, the wheels braked on the move",
|
||||
[](auto const &M, double, auto const *) { return false == M.brakes.config.hasHandBrake || M.brakes.HandBrakePosition() == 0 || std::abs(M.V()) < 0.5 || std::abs(M.Fb) > 0.0; },
|
||||
[](auto const &M) { return values({{"ManualBrakePos", M.brakes.HandBrakePosition()}, {"V", M.V()}, {"Fb", M.Fb}}); }},
|
||||
[](auto const &M, double, auto const *) { return false == M.brakes.config.hasHandBrake || M.brakes.HandBrakePosition() == 0 || std::abs(M.V()) < 0.5 || std::abs(M.Fb()) > 0.0; },
|
||||
[](auto const &M) { return values({{"ManualBrakePos", M.brakes.HandBrakePosition()}, {"V", M.V()}, {"Fb", M.Fb()}}); }},
|
||||
};
|
||||
return rules;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user