18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 20:05:23 +01:00

refactor(physics): the low voltage, the train heating and the electrodynamic brake as components

The rest of the electrics of physics::Vehicle beside the traction motors
becomes components, with English names:

  lowVoltage (LowVoltageSupply,   Battery batteryOn, BatteryVoltage,
  physics/components/lowvoltage.h) NominalBatteryVoltage, BatteryStart,
                                  Power110vIsAvailable / Power24vIsAvailable /
                                  Power24vVoltage power110vAvailable /
                                  power24vAvailable / power24vVoltage, the
                                  battery button of the cab: batteryButtonFired,
                                  batteryButtonImpulse, batteryButtonHeld,
                                  batteryButtonHoldTime
  trainHeating (TrainHeating)     Heating on, HeatingAllow allow,
                                  HeatingSwitchImpulse switchImpulse,
                                  HeatingPower power, EngineHeatingRPM engineRpm
  brakes.electrodynamic           the DynamicBrake* fields: type, ammeters,
  (ElectrodynamicBrake,           controllerPositions, controllerPosition,
  physics/components/braking.h)   resistance(1, 2), on, emuWorking;
                                  SplitEDPneumaticBrake splitFromPneumatic;
                                  the fans of the braking resistor (BRVentilators,
                                  BRVto, BRVtimer, Imaxrpc): resistorFansRunning,
                                  resistorFansSustain, resistorFansTimer,
                                  resistorPassiveMaxCurrent

The diesel-electric dynamic brake (DEDynamicBrake) and the currents of the
traction circuit (Im, Itot, EngineVoltage ...) stay for the traction stage.

No string literal changed (checked over all the changed files).

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
This commit is contained in:
2026-11-29 03:15:56 +01:00
parent 1bea280010
commit 89258eb72c
62 changed files with 501 additions and 462 deletions
+22 -22
View File
@@ -62,7 +62,7 @@ void physics::Vehicle::LoadFIZ_Param(std::string const &line)
extract_value(Vmax, "Vmax", line, "0");
extract_value(Power, "PWR", line, "0");
extract_value(SandCapacity, "SandCap", line, "0");
extract_value(HeatingPower, "HeatingP", line, "0");
extract_value(trainHeating.power, "HeatingP", line, "0");
extract_value(LightPower, "LightP", line, "0");
{
@@ -814,20 +814,20 @@ void physics::Vehicle::LoadFIZ_CntrlControllers(std::string const &line)
{
std::map<std::string, int, std::less<>> dynamicbrakes{{"Passive", dbrake_passive}, {"Switch", dbrake_switch}, {"Reversal", dbrake_reversal}, {"Automatic", dbrake_automatic}};
auto lookup = dynamicbrakes.find(extract_value("DynamicBrake", line));
DynamicBrakeType = lookup != dynamicbrakes.end() ? lookup->second : dbrake_none;
extract_value(DynamicBrakeAmpmeters, "DBAM", line, "");
brakes.electrodynamic.type = lookup != dynamicbrakes.end() ? lookup->second : dbrake_none;
extract_value(brakes.electrodynamic.ammeters, "DBAM", line, "");
}
// split ED/pneumatic brake control: when true the local brake operates only on the
// pneumatic locomotive cylinder while electrodynamic braking is commanded by a
// separate "dynamicbrakectrl" lever (or the negative range of jointctrl).
extract_value(SplitEDPneumaticBrake, "SplitEDPneumaticBrake", line, "");
extract_value(brakes.electrodynamic.splitFromPneumatic, "SplitEDPneumaticBrake", line, "");
// number of stepped positions for the dedicated ED brake controller (default 10)
DynamicBrakeCtrlPosNo = 10;
extract_value(DynamicBrakeCtrlPosNo, "DBPN", line, "");
if (DynamicBrakeCtrlPosNo < 1)
brakes.electrodynamic.controllerPositions = 10;
extract_value(brakes.electrodynamic.controllerPositions, "DBPN", line, "");
if (brakes.electrodynamic.controllerPositions < 1)
{
DynamicBrakeCtrlPosNo = 10;
brakes.electrodynamic.controllerPositions = 10;
}
extract_value(MainCtrlPosNo, "MCPN", line, "");
@@ -896,9 +896,9 @@ void physics::Vehicle::LoadFIZ_CntrlControllers(std::string const &line)
extract_value(isDoubleClickForMeasureNeeded, "DCMB", line, "");
extract_value(DistanceCounterDoublePressPeriod, "DCDPP", line, "");
extract_value(isBatteryButtonImpulse, "IBTB", line, "");
extract_value(shouldHoldBatteryButton, "SBBBH", line, "");
extract_value(BatteryButtonHoldTime, "BBHT", line, "");
extract_value(lowVoltage.batteryButtonImpulse, "IBTB", line, "");
extract_value(lowVoltage.batteryButtonHeld, "SBBBH", line, "");
extract_value(lowVoltage.batteryButtonHoldTime, "BBHT", line, "");
}
// Cntrl.: how the devices start (MainStart, BatteryStart, ...) and their relays
@@ -921,7 +921,7 @@ void physics::Vehicle::LoadFIZ_CntrlStarts(std::string const &line)
// battery
{
auto lookup = starts.find(extract_value("BatteryStart", line));
BatteryStart = lookup != starts.end() ? lookup->second : manual;
lowVoltage.batteryStart = lookup != starts.end() ? lookup->second : manual;
}
// converter
{
@@ -1076,8 +1076,8 @@ void physics::Vehicle::LoadFIZ_Light(std::string const &line)
LoadFIZ_PowerParamsDecode(AlterLightPowerSource, "AlterL", line);
extract_value(NominalVoltage, "Volt", line, "");
extract_value(BatteryVoltage, "LMaxVoltage", line, "");
NominalBatteryVoltage = static_cast<float>(BatteryVoltage);
extract_value(lowVoltage.batteryVoltage, "LMaxVoltage", line, "");
lowVoltage.nominalBatteryVoltage = static_cast<float>(lowVoltage.batteryVoltage);
}
void physics::Vehicle::LoadFIZ_Clima(std::string const &line)
@@ -1368,7 +1368,7 @@ void physics::Vehicle::LoadFIZ_EngineDieselElectric(std::string const &Input)
ImaxHi = 2;
ImaxLo = 1;
}
extract_value(EngineHeatingRPM, "HeatingRPM", Input, "");
extract_value(trainHeating.engineRpm, "HeatingRPM", Input, "");
extract_value(diesel.shaftInertia, "AIM", Input, "1.25");
extract_value(diesel.revolutionsDecreaseRate, "RPMDecRate", Input, "");
LoadFIZ_DieselElectricDynamicBrake(Input);
@@ -1410,8 +1410,8 @@ void physics::Vehicle::LoadFIZ_EngineInductionMotor(std::string const &Input)
extract_value(inductionMotor.logForce, "eimclf", Input, "");
extract_value(inductionMotor.inverterCount, "InvNo", Input, "");
extract_value(inductionMotor.inverterControlCouplings, "InvCtrCplFlag", Input, "");
extract_value(Imaxrpc, "Imaxrpc", Input, "");
extract_value(BRVto, "BRVto", Input, "");
extract_value(brakes.electrodynamic.resistorPassiveMaxCurrent, "Imaxrpc", Input, "");
extract_value(brakes.electrodynamic.resistorFansSustain, "BRVto", Input, "");
extract_value(Flat, "Flat", Input, "");
if (inductionMotor.traction.maxPower > 0 && Power > 0 && inductionMotor.inverterCount == 0)
@@ -1471,7 +1471,7 @@ void physics::Vehicle::LoadFIZ_Switches(std::string const &Input)
extract_value(pantographCircuit.switchType, "Pantograph", Input, "");
extract_value(converter.switchType, "Converter", Input, "");
extract_value(lineContactors.switchType, "MotorConnectors", Input, "");
HeatingSwitchImpulse = ToLower(extract_value("TrainHeating", Input)) == "impulse";
trainHeating.switchImpulse = ToLower(extract_value("TrainHeating", Input)) == "impulse";
// because people can't make up their minds whether it's "impulse" or "Impulse"...
pantographCircuit.switchType = ToLower(pantographCircuit.switchType);
converter.switchType = ToLower(converter.switchType);
@@ -1565,9 +1565,9 @@ void physics::Vehicle::LoadFIZ_RList(std::string const &Input)
}
extract_value(RVentMinI, "RVentMinI", Input, "");
extract_value(RVentSpeed, "RVentSpeed", Input, "");
extract_value(DynamicBrakeRes, "DynBrakeRes", Input, "");
extract_value(DynamicBrakeRes1, "DynBrakeRes1", Input, "");
extract_value(DynamicBrakeRes2, "DynBrakeRes2", Input, "");
extract_value(brakes.electrodynamic.resistance, "DynBrakeRes", Input, "");
extract_value(brakes.electrodynamic.resistance1, "DynBrakeRes1", Input, "");
extract_value(brakes.electrodynamic.resistance2, "DynBrakeRes2", Input, "");
}
// the dynamic brake of a diesel-electric vehicle, from its Engine section: none without EDBrake
@@ -1595,7 +1595,7 @@ void physics::Vehicle::LoadFIZ_DieselElectricDynamicBrake(std::string const &Inp
if (brake.source == lever)
{
// the lever of its own, which the commands of the dynamic brake controller move
SplitEDPneumaticBrake = true;
brakes.electrodynamic.splitFromPneumatic = true;
}
}