mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 06:12:41 +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:
@@ -39,7 +39,7 @@ void prepare(consist &Train) {
|
||||
}
|
||||
|
||||
bool running(physics::Vehicle const &Vehicle) {
|
||||
return Vehicle.Mains && Vehicle.enrot > 0.5 * Vehicle.diesel.minRevolutions;
|
||||
return Vehicle.lineBreaker.closed && Vehicle.enrot > 0.5 * Vehicle.diesel.minRevolutions;
|
||||
}
|
||||
|
||||
// the time step of the train in the loops below
|
||||
@@ -65,8 +65,8 @@ TEST_CASE("engine start: the joint start is the default, and JointEngineStart=No
|
||||
consist train;
|
||||
auto const &joint{train.add(sn61(), 1).physics()};
|
||||
auto const &separate{train.add(sn61(false)).physics()};
|
||||
CHECK(joint.JointEngineStart);
|
||||
CHECK_FALSE(separate.JointEngineStart);
|
||||
CHECK(joint.lineBreaker.jointStart);
|
||||
CHECK_FALSE(separate.lineBreaker.jointStart);
|
||||
CHECK(joint.MainSwitchRange() == range_t::consist);
|
||||
CHECK(separate.MainSwitchRange() == range_t::local);
|
||||
}
|
||||
@@ -120,16 +120,16 @@ TEST_CASE("engine start: by default the cab's switch starts and stops the engine
|
||||
auto &first{train.add(sn61(), 1).physics()};
|
||||
auto const &second{train.add(sn61()).physics()};
|
||||
prepare(train);
|
||||
REQUIRE_FALSE(first.Mains);
|
||||
REQUIRE_FALSE(second.Mains);
|
||||
REQUIRE_FALSE(first.lineBreaker.closed);
|
||||
REQUIRE_FALSE(second.lineBreaker.closed);
|
||||
first.MainSwitch(true, first.MainSwitchRange());
|
||||
train.run(15.0);
|
||||
CHECK(running(first));
|
||||
CHECK(running(second));
|
||||
first.MainSwitch(false, first.MainSwitchRange());
|
||||
train.run(5.0);
|
||||
CHECK_FALSE(first.Mains);
|
||||
CHECK_FALSE(second.Mains);
|
||||
CHECK_FALSE(first.lineBreaker.closed);
|
||||
CHECK_FALSE(second.lineBreaker.closed);
|
||||
}
|
||||
|
||||
TEST_CASE("engine start: with JointEngineStart=No each engine has its own switch") {
|
||||
@@ -142,8 +142,8 @@ TEST_CASE("engine start: with JointEngineStart=No each engine has its own switch
|
||||
first.MainSwitch(true, first.MainSwitchRange());
|
||||
train.run(15.0);
|
||||
REQUIRE(running(first));
|
||||
CHECK_FALSE(second.Mains);
|
||||
CHECK_FALSE(third.Mains);
|
||||
CHECK_FALSE(second.lineBreaker.closed);
|
||||
CHECK_FALSE(third.lineBreaker.closed);
|
||||
|
||||
// the second one's switch, mainb_*, starts the second engine
|
||||
engine_start::remote_switch switchb;
|
||||
@@ -155,7 +155,7 @@ TEST_CASE("engine start: with JointEngineStart=No each engine has its own switch
|
||||
hold(train, switchb, engineb, 2.0); // past the SN61's delay of 1.5 s
|
||||
train.run(15.0);
|
||||
CHECK(running(second));
|
||||
CHECK_FALSE(third.Mains);
|
||||
CHECK_FALSE(third.lineBreaker.closed);
|
||||
// and the third one's, mainc_*, the third
|
||||
hold(train, switchc, enginec, 2.0);
|
||||
train.run(15.0);
|
||||
@@ -164,12 +164,12 @@ TEST_CASE("engine start: with JointEngineStart=No each engine has its own switch
|
||||
// the switches open their own vehicles' circuits only
|
||||
CHECK(engine_start::remote_switch::open(second));
|
||||
train.run(5.0);
|
||||
CHECK_FALSE(second.Mains);
|
||||
CHECK_FALSE(second.lineBreaker.closed);
|
||||
CHECK(running(first));
|
||||
CHECK(running(third));
|
||||
first.MainSwitch(false, first.MainSwitchRange());
|
||||
train.run(5.0);
|
||||
CHECK_FALSE(first.Mains);
|
||||
CHECK_FALSE(first.lineBreaker.closed);
|
||||
CHECK(running(third));
|
||||
CHECK_FALSE(engine_start::remote_switch::open(second)); // already stopped
|
||||
}
|
||||
@@ -184,7 +184,7 @@ TEST_CASE("engine start: the switch of another vehicle is held for the vehicle's
|
||||
// without the battery the switch does nothing, however long it's held
|
||||
hold(train, switchb, &second, 5.0);
|
||||
train.run(5.0);
|
||||
CHECK_FALSE(second.Mains);
|
||||
CHECK_FALSE(second.lineBreaker.closed);
|
||||
CHECK_FALSE(second.diesel.startupRequested);
|
||||
|
||||
prepare(train);
|
||||
@@ -245,7 +245,7 @@ TEST_CASE("engine start: an engine stopping on its own stops the others only whe
|
||||
// the first one's fuel cut off, its engine stops
|
||||
first.FuelPump.is_disabled = true;
|
||||
train.run(15.0);
|
||||
CHECK_FALSE(first.Mains);
|
||||
CHECK_FALSE(first.lineBreaker.closed);
|
||||
CHECK(first.enrot == 0.0);
|
||||
// started on their own, the others keep running
|
||||
CHECK(running(second) == (false == joint));
|
||||
@@ -275,7 +275,7 @@ TEST_CASE("engine start: an engine stopped from its own switch doesn't stop the
|
||||
// mainb_off
|
||||
CHECK(engine_start::remote_switch::open(second));
|
||||
train.run(30.0);
|
||||
CHECK_FALSE(second.Mains);
|
||||
CHECK_FALSE(second.lineBreaker.closed);
|
||||
CHECK(second.enrot == 0.0);
|
||||
CHECK(running(first));
|
||||
CHECK(running(third));
|
||||
@@ -287,12 +287,12 @@ TEST_CASE("engine start: the stopped engine of the cab's vehicle doesn't stop th
|
||||
auto &first{train.add(sn61(), 1).physics()};
|
||||
auto &second{train.add(sn61(false)).physics()};
|
||||
prepare(train);
|
||||
REQUIRE_FALSE(first.Mains);
|
||||
REQUIRE_FALSE(first.lineBreaker.closed);
|
||||
// mainb_on
|
||||
engine_start::remote_switch switchb;
|
||||
hold(train, switchb, engine_start::engine(first, first, 2), 2.0);
|
||||
train.run(15.0);
|
||||
CHECK(running(second));
|
||||
CHECK_FALSE(first.Mains);
|
||||
CHECK_FALSE(first.lineBreaker.closed);
|
||||
CHECK(first.enrot == 0.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user