mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 16:36:53 +01:00
refactor(physics): the line breaker, the line contactors, the relays and the converter as components
The main circuit of physics::Vehicle becomes components, with English names
(physics/components/maincircuit.h):
lineBreaker (LineBreaker) Mains closed, MainsInitTime(Countdown)
initTime / initCountdown, MainsStart start,
JointEngineStart jointStart,
PantographsRequireMains pantographsRequireIt,
LineBreakerClosesOnlyAtNoPowerPos
closesOnlyAtNoPower,
EmergencyBrakeMainOffPressure emergencyOffPressure
lineContactors (LineContactors) StLinFlag closed, StLinSwitchOff forcedOpen,
StLinSwitchType switchType,
LineContactorsInterlock interlock,
LastRelayTime lastSwitchTime
protection (ProtectionRelays) NoVoltRelay noVoltage, OvervoltageRelay
overvoltage, GroundRelay(Start) ground(Start),
ControlPressureSwitch pressureSwitch,
HasControlPressureSwitch hasPressureSwitch,
PressureSwitchBrakeCylinder
pressureSwitchWatchesCylinders
converter (PowerConverter) the Converter* fields: start, startDelay(Timer),
allow(Local), running, overloadRelayStart,
overloadRelayOffWithLineBreaker; ConvOvldFlag
overloaded, ConvSwitchType switchType
The long comments of the fields went with them into the header. Where the
loading of the .fiz has using enum start_t, the member is this->converter:
the enumerator start_t::converter would hide it there.
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:
@@ -909,15 +909,15 @@ void physics::Vehicle::LoadFIZ_CntrlStarts(std::string const &line)
|
||||
{"Battery", battery}, {"Converter", converter}, {"Direction", direction}};
|
||||
|
||||
// main circuit
|
||||
extract_value(MainsInitTime, "MainInitTime", line, "");
|
||||
extract_value(lineBreaker.initTime, "MainInitTime", line, "");
|
||||
{
|
||||
auto lookup = starts.find(extract_value("MainStart", line));
|
||||
MainsStart = lookup != starts.end() ? lookup->second : manual;
|
||||
lineBreaker.start = lookup != starts.end() ? lookup->second : manual;
|
||||
}
|
||||
extract_value(PantographsRequireMains, "PantRequiresMain", line, "");
|
||||
extract_value(lineBreaker.pantographsRequireIt, "PantRequiresMain", line, "");
|
||||
// the brake pipe pressure of an emergency brake application, which opens the line breaker under power
|
||||
extract_value(EmergencyBrakeMainOffPressure, "EmergencyBrakeMainOff", line, "");
|
||||
EmergencyBrakeMainOffPressure = std::max(0.0, EmergencyBrakeMainOffPressure);
|
||||
extract_value(lineBreaker.emergencyOffPressure, "EmergencyBrakeMainOff", line, "");
|
||||
lineBreaker.emergencyOffPressure = std::max(0.0, lineBreaker.emergencyOffPressure);
|
||||
// battery
|
||||
{
|
||||
auto lookup = starts.find(extract_value("BatteryStart", line));
|
||||
@@ -926,10 +926,10 @@ void physics::Vehicle::LoadFIZ_CntrlStarts(std::string const &line)
|
||||
// converter
|
||||
{
|
||||
auto lookup = starts.find(extract_value("ConverterStart", line));
|
||||
ConverterStart = lookup != starts.end() ? lookup->second : manual;
|
||||
this->converter.start = lookup != starts.end() ? lookup->second : manual;
|
||||
}
|
||||
extract_value(ConverterStartDelay, "ConverterStartDelay", line, "");
|
||||
extract_value(ConverterOverloadRelayOffWhenMainIsOff, "ConverterOverloadWhenMainIsOff", line, TrainType == train_type::emu ? "yes" : "no");
|
||||
extract_value(this->converter.startDelay, "ConverterStartDelay", line, "");
|
||||
extract_value(this->converter.overloadRelayOffWithLineBreaker, "ConverterOverloadWhenMainIsOff", line, TrainType == train_type::emu ? "yes" : "no");
|
||||
// compressor
|
||||
{
|
||||
auto lookup = starts.find(extract_value("CompressorStart", line));
|
||||
@@ -995,7 +995,7 @@ void physics::Vehicle::LoadFIZ_CntrlStarts(std::string const &line)
|
||||
std::map<std::string, line_contactors_interlock, std::less<>> const interlocks{{"Converter", line_contactors_interlock::converter},
|
||||
{"MotorBlowers", line_contactors_interlock::motor_blowers}};
|
||||
auto lookup = interlocks.find(extract_value("LineContactorsInterlock", line));
|
||||
LineContactorsInterlock = lookup != interlocks.end() ? lookup->second : line_contactors_interlock::none;
|
||||
lineContactors.interlock = lookup != interlocks.end() ? lookup->second : line_contactors_interlock::none;
|
||||
}
|
||||
extract_value(LouvresOpenPressure, "LouvresOpenPressure", line, "");
|
||||
// compartment lights
|
||||
@@ -1007,14 +1007,14 @@ void physics::Vehicle::LoadFIZ_CntrlStarts(std::string const &line)
|
||||
{
|
||||
auto lookup = starts.find(extract_value("GroundRelayStart", line));
|
||||
auto const defaultstart{TrainType == train_type::emu ? automatic : manual};
|
||||
GroundRelayStart = lookup != starts.end() ? lookup->second : defaultstart;
|
||||
protection.groundStart = lookup != starts.end() ? lookup->second : defaultstart;
|
||||
}
|
||||
// converter overload relay
|
||||
{
|
||||
auto lookup = starts.find(extract_value("ConverterOverloadRelayStart", line));
|
||||
// the relay of a multiple unit activates when the converter is switched off
|
||||
auto const defaultstart{TrainType == train_type::emu ? converter : manual};
|
||||
ConverterOverloadRelayStart = lookup != starts.end() ? lookup->second : defaultstart;
|
||||
this->converter.overloadRelayStart = lookup != starts.end() ? lookup->second : defaultstart;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1183,7 +1183,7 @@ void physics::Vehicle::LoadFIZ_Engine(std::string const &Input)
|
||||
{
|
||||
|
||||
EngineType = LoadFIZ_EngineDecode(extract_value("EngineType", Input));
|
||||
extract_value(JointEngineStart, "JointEngineStart", Input, "");
|
||||
extract_value(lineBreaker.jointStart, "JointEngineStart", Input, "");
|
||||
|
||||
if (std::string transmission = extract_value("Trans", Input); false == transmission.empty())
|
||||
{
|
||||
@@ -1262,9 +1262,9 @@ void physics::Vehicle::LoadFIZ_Engine(std::string const &Input)
|
||||
extract_value(MotorBlowers[VehicleEnd::front].min_start_velocity, "MotorBlowersStartVelocity", Input, "");
|
||||
MotorBlowers[VehicleEnd::rear] = MotorBlowers[VehicleEnd::front];
|
||||
// pressure switch
|
||||
extract_value(HasControlPressureSwitch, "PressureSwitch", Input, TrainType != train_type::emu ? "yes" : "no");
|
||||
extract_value(protection.hasPressureSwitch, "PressureSwitch", Input, TrainType != train_type::emu ? "yes" : "no");
|
||||
// its brake cylinder half; the brake pipe one stays
|
||||
extract_value(PressureSwitchBrakeCylinder, "PressureSwitchBrakeCylinder", Input, "");
|
||||
extract_value(protection.pressureSwitchWatchesCylinders, "PressureSwitchBrakeCylinder", Input, "");
|
||||
}
|
||||
|
||||
// Engine: of a diesel engine, its revolutions, gears, hydraulic transmission and retarder
|
||||
@@ -1469,13 +1469,13 @@ void physics::Vehicle::LoadFIZ_Switches(std::string const &Input)
|
||||
{
|
||||
|
||||
extract_value(pantographCircuit.switchType, "Pantograph", Input, "");
|
||||
extract_value(ConvSwitchType, "Converter", Input, "");
|
||||
extract_value(StLinSwitchType, "MotorConnectors", Input, "");
|
||||
extract_value(converter.switchType, "Converter", Input, "");
|
||||
extract_value(lineContactors.switchType, "MotorConnectors", Input, "");
|
||||
HeatingSwitchImpulse = 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);
|
||||
ConvSwitchType = ToLower(ConvSwitchType);
|
||||
StLinSwitchType = ToLower(StLinSwitchType);
|
||||
converter.switchType = ToLower(converter.switchType);
|
||||
lineContactors.switchType = ToLower(lineContactors.switchType);
|
||||
// universal reset buttons assignments
|
||||
extract_value(UniversalResetButtonFlag[0], "RelayResetButton1", Input, "");
|
||||
extract_value(UniversalResetButtonFlag[1], "RelayResetButton2", Input, "");
|
||||
|
||||
Reference in New Issue
Block a user