mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 10:46:45 +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:
@@ -47,14 +47,14 @@ TEST_CASE("compressor: without a start delay the compressor starts with its powe
|
||||
run_compressor(vehicle, 1.0);
|
||||
REQUIRE_FALSE(vehicle->air.compressor.running); // no power, no compressor
|
||||
|
||||
vehicle->Mains = true;
|
||||
vehicle->lineBreaker.closed = true;
|
||||
run_compressor(vehicle, step);
|
||||
CHECK(vehicle->air.compressor.running);
|
||||
}
|
||||
|
||||
TEST_CASE("compressor: the compressor starts the delay after getting its power") {
|
||||
auto vehicle{compressor_vehicle(5.0)};
|
||||
vehicle->Mains = true;
|
||||
vehicle->lineBreaker.closed = true;
|
||||
|
||||
run_compressor(vehicle, 4.9);
|
||||
CHECK_FALSE(vehicle->air.compressor.running);
|
||||
@@ -68,15 +68,15 @@ TEST_CASE("compressor: the compressor starts the delay after getting its power")
|
||||
|
||||
TEST_CASE("compressor: the delay starts over once the power is gone") {
|
||||
auto vehicle{compressor_vehicle(5.0)};
|
||||
vehicle->Mains = true;
|
||||
vehicle->lineBreaker.closed = true;
|
||||
run_compressor(vehicle, 10.0);
|
||||
REQUIRE(vehicle->air.compressor.running);
|
||||
|
||||
vehicle->Mains = false; // the engine stopped
|
||||
vehicle->lineBreaker.closed = false; // the engine stopped
|
||||
run_compressor(vehicle, 1.0);
|
||||
CHECK_FALSE(vehicle->air.compressor.running);
|
||||
|
||||
vehicle->Mains = true; // and started again
|
||||
vehicle->lineBreaker.closed = true; // and started again
|
||||
run_compressor(vehicle, 4.9);
|
||||
CHECK_FALSE(vehicle->air.compressor.running);
|
||||
run_compressor(vehicle, 0.2);
|
||||
@@ -85,7 +85,7 @@ TEST_CASE("compressor: the delay starts over once the power is gone") {
|
||||
|
||||
TEST_CASE("compressor: a compressor fed from the low voltage waits from the low voltage coming on") {
|
||||
auto vehicle{compressor_vehicle(5.0, "")}; // the default supply: the converter, the 110 V
|
||||
vehicle->Mains = true; // which alone doesn't feed it
|
||||
vehicle->lineBreaker.closed = true; // which alone doesn't feed it
|
||||
run_compressor(vehicle, 10.0);
|
||||
REQUIRE_FALSE(vehicle->air.compressor.running);
|
||||
|
||||
@@ -98,7 +98,7 @@ TEST_CASE("compressor: a compressor fed from the low voltage waits from the low
|
||||
|
||||
TEST_CASE("compressor: the pressure switch stops the compressor above the cut-out pressure") {
|
||||
auto vehicle{compressor_vehicle(0.0)};
|
||||
vehicle->Mains = true;
|
||||
vehicle->lineBreaker.closed = true;
|
||||
vehicle->air.compressedVolume = 8.5; // over MaxCP, in the reservoir of 1 m3
|
||||
run_compressor(vehicle, step);
|
||||
CHECK(vehicle->air.compressor.governorLock);
|
||||
@@ -107,7 +107,7 @@ TEST_CASE("compressor: the pressure switch stops the compressor above the cut-ou
|
||||
|
||||
TEST_CASE("compressor: without a pressure switch the air over the cut-out pressure is vented") {
|
||||
auto vehicle{compressor_vehicle(0.0, "Main", 8.0)}; // MinCP the same as MaxCP: no pressure switch
|
||||
vehicle->Mains = true;
|
||||
vehicle->lineBreaker.closed = true;
|
||||
vehicle->air.compressedVolume = 8.5;
|
||||
run_compressor(vehicle, step);
|
||||
REQUIRE(vehicle->air.compressor.running); // nothing stops it
|
||||
@@ -116,13 +116,13 @@ TEST_CASE("compressor: without a pressure switch the air over the cut-out pressu
|
||||
|
||||
TEST_CASE("compressor: an engine stopped before the delay passed counts the whole delay again") {
|
||||
auto vehicle{compressor_vehicle(30.0)};
|
||||
vehicle->Mains = true; // engine started
|
||||
vehicle->lineBreaker.closed = true; // engine started
|
||||
run_compressor(vehicle, 20.0);
|
||||
REQUIRE_FALSE(vehicle->air.compressor.running);
|
||||
|
||||
vehicle->Mains = false; // engine stopped, 10 s short of the delay
|
||||
vehicle->lineBreaker.closed = false; // engine stopped, 10 s short of the delay
|
||||
run_compressor(vehicle, 1.0);
|
||||
vehicle->Mains = true;
|
||||
vehicle->lineBreaker.closed = true;
|
||||
run_compressor(vehicle, 15.0); // 36 s since the first start, but only 15 s since this one
|
||||
CHECK_FALSE(vehicle->air.compressor.running);
|
||||
|
||||
@@ -134,7 +134,7 @@ TEST_CASE("compressor: the start delay holds back a compressor switched on by ha
|
||||
auto vehicle{compressor_vehicle(30.0)};
|
||||
vehicle->air.compressor.start = start_t::manual;
|
||||
vehicle->air.compressor.allow = true; // switch in the cabinet on before the engine start
|
||||
vehicle->Mains = true;
|
||||
vehicle->lineBreaker.closed = true;
|
||||
|
||||
run_compressor(vehicle, 29.9);
|
||||
CHECK_FALSE(vehicle->air.compressor.running);
|
||||
@@ -175,12 +175,12 @@ definition generator_vehicle(double const ConverterDelay, double const Compresso
|
||||
TEST_CASE("compressor: fed from the converter it waits for the converter start delay") {
|
||||
vehicle loco{generator_vehicle(30.0, 0.0)};
|
||||
REQUIRE(loco->air.compressor.supply == physics::CompressorSupply::converter);
|
||||
REQUIRE(loco->ConverterStartDelay == doctest::Approx(30.0));
|
||||
REQUIRE(loco->converter.startDelay == doctest::Approx(30.0));
|
||||
|
||||
loco.run(1.0); // engine off
|
||||
CHECK_FALSE(loco->Power110vIsAvailable);
|
||||
|
||||
loco->Mains = true; // engine started
|
||||
loco->lineBreaker.closed = true; // engine started
|
||||
loco.run(25.0);
|
||||
CHECK_FALSE(loco->Power110vIsAvailable);
|
||||
CHECK_FALSE(loco->air.compressor.running);
|
||||
@@ -195,7 +195,7 @@ TEST_CASE("compressor: fed from the converter the start delay counts from the co
|
||||
REQUIRE(loco->air.compressor.startDelay == doctest::Approx(10.0));
|
||||
|
||||
loco.run(1.0); // engine off
|
||||
loco->Mains = true; // engine started
|
||||
loco->lineBreaker.closed = true; // engine started
|
||||
loco.run(25.0);
|
||||
REQUIRE(loco->Power110vIsAvailable); // the converter is up
|
||||
CHECK_FALSE(loco->air.compressor.running); // but the compressor waits for its own delay as well
|
||||
|
||||
Reference in New Issue
Block a user