diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h
index 199c65a0c..c7d9cdbec 100644
--- a/McZapkie/MOVER.h
+++ b/McZapkie/MOVER.h
@@ -279,6 +279,16 @@ enum class operation_t
/// Disable button release transition.
disable_off,
};
+/// What else the line contactors of a vehicle need before they can close (LineContactorsInterlock in the Cntrl. section).
+enum class line_contactors_interlock
+{
+ /// Nothing more, the legacy behaviour.
+ none,
+ /// The converter of the vehicle itself running, where it drives the traction motor fans (ET42).
+ converter,
+ /// The traction motor blowers of the vehicle running.
+ motor_blowers
+};
/// Auto-start method for ancillary devices (mutually exclusive).
enum class start_t
{
@@ -2152,6 +2162,7 @@ class TMoverParameters
start_t GroundRelayStart{start_t::manual}; // relay activation method
bool StLinFlag = false; /*!o styczniki liniowe*/
bool StLinSwitchOff{false}; // state of the button forcing motor connectors open
+ line_contactors_interlock LineContactorsInterlock{line_contactors_interlock::none}; // what else the line contactors need to close
bool ResistorsFlag = false; /*!o jazda rezystorowa*/
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
double PantographVoltage{0.0}; // voltage supplied to pantographs
@@ -2466,6 +2477,8 @@ class TMoverParameters
{
return false == StLinFlag && MainCircuitLampsEnabled();
}
+ // whether the devices the line contactors are interlocked with (LineContactorsInterlock) let them close
+ bool LineContactorsInterlockReleased() const;
// whether the pumps a joint oil and fuel pump switch works, those not started automatically, are all switched on
bool OilFuelPumpsEnabled() const
{
diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp
index 330e8eb8f..f5f88a681 100644
--- a/McZapkie/Mover.cpp
+++ b/McZapkie/Mover.cpp
@@ -7148,7 +7148,21 @@ bool TMoverParameters::MotorConnectorsCheck()
auto const connectorsoff{false == Mains || true == FuseFlag || true == StLinSwitchOff || DirActive == 0};
- return false == connectorsoff;
+ return false == connectorsoff && LineContactorsInterlockReleased();
+}
+
+bool TMoverParameters::LineContactorsInterlockReleased() const
+{
+ switch (LineContactorsInterlock)
+ {
+ case line_contactors_interlock::converter:
+ // the converter of this very vehicle, not the 110 V of the trainset: a section with its fans off doesn't start
+ return ConverterFlag;
+ case line_contactors_interlock::motor_blowers:
+ return std::ranges::all_of(MotorBlowers, [](auto const &Blower) { return Blower.is_active; });
+ default:
+ return true;
+ }
}
bool TMoverParameters::OperatePantographsValve(operation_t const State, range_t const Notify)
@@ -11001,6 +11015,13 @@ void TMoverParameters::LoadFIZ_Cntrl(std::string const &line)
MotorBlowers[end::rear].start_type = lookup != starts.end() ? lookup->second : start_t::manual;
MotorBlowers[end::front].start_type = MotorBlowers[end::rear].start_type;
}
+ // what else the line contactors need to close
+ {
+ std::map> 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;
+ }
// compartment lights
{
auto lookup = starts.find(extract_value("CompartmentLightsStart", line));
diff --git a/tests/unit/test_line_contactors_interlock.cpp b/tests/unit/test_line_contactors_interlock.cpp
new file mode 100644
index 000000000..a34bcac7d
--- /dev/null
+++ b/tests/unit/test_line_contactors_interlock.cpp
@@ -0,0 +1,110 @@
+#include "stdafx.h"
+#include "doctest.h"
+#include "consist.h"
+#include "drive.h"
+#include "vehicle.h"
+
+// the line contactors interlocked with the fans of the traction motors (eu07/maszyna#460): on the ET42 the fans of a
+// section run off its own converter, and with them switched off the line contactors of that section don't close.
+
+using test::definition;
+using test::vehicle;
+
+namespace {
+
+// a vehicle whose line contactors could close, but for the interlock
+vehicle ready(std::string_view const Interlock) {
+ auto loaded{definition::load("wagon")};
+ if (false == Interlock.empty()) {
+ loaded.set("Cntrl", "LineContactorsInterlock", std::string{Interlock});
+ }
+ vehicle locomotive{loaded};
+ locomotive->Mains = true;
+ locomotive->DirActive = 1;
+ locomotive->PipePress = 5.0;
+ locomotive->BrakePress = 0.0;
+ return locomotive;
+}
+
+test::track const line{0.15, 0.0, test::catenary_3kv};
+
+} // namespace
+
+TEST_CASE("line contactors interlock: read from the Cntrl. section, none by default") {
+ CHECK(ready("")->LineContactorsInterlock == line_contactors_interlock::none);
+ CHECK(ready("Converter")->LineContactorsInterlock == line_contactors_interlock::converter);
+ CHECK(ready("MotorBlowers")->LineContactorsInterlock == line_contactors_interlock::motor_blowers);
+ CHECK(ready("Something")->LineContactorsInterlock == line_contactors_interlock::none);
+}
+
+TEST_CASE("line contactors interlock: without one the converter and the blowers don't matter, as before") {
+ auto locomotive{ready("")};
+ locomotive->ConverterFlag = false;
+ for (auto &blower : locomotive->MotorBlowers) {
+ blower.is_active = false;
+ }
+ CHECK(locomotive->MotorConnectorsCheck());
+}
+
+TEST_CASE("line contactors interlock: on the converter, they close only with the vehicle's own converter running") {
+ auto locomotive{ready("Converter")};
+ locomotive->ConverterFlag = false;
+ locomotive->Power110vIsAvailable = true; // the 110 V from the other section doesn't run this one's fans
+ CHECK_FALSE(locomotive->MotorConnectorsCheck());
+ locomotive->ConverterFlag = true;
+ CHECK(locomotive->MotorConnectorsCheck());
+ locomotive->Mains = false; // the other conditions still hold
+ CHECK_FALSE(locomotive->MotorConnectorsCheck());
+}
+
+TEST_CASE("line contactors interlock: on the motor blowers, they close only with all of them running") {
+ auto locomotive{ready("MotorBlowers")};
+ locomotive->MotorBlowers[end::front].is_active = true;
+ locomotive->MotorBlowers[end::rear].is_active = false;
+ CHECK_FALSE(locomotive->MotorConnectorsCheck());
+ locomotive->MotorBlowers[end::rear].is_active = true;
+ CHECK(locomotive->MotorConnectorsCheck());
+}
+
+TEST_CASE("line contactors interlock: the ET42 section with its fans switched off doesn't start") {
+ test::consist et42;
+ et42.add(definition::fiz("et42_v2/112e-a").set("Cntrl", "LineContactorsInterlock", "Converter"), 1);
+ et42.add(definition::fiz("et42_v2/112e-b").set("Cntrl", "LineContactorsInterlock", "Converter"));
+ auto driven{test::driving(et42)};
+ REQUIRE(test::start_up(driven, line));
+ auto &front{et42[0].mover()};
+ auto &rear{et42[1].mover()};
+ REQUIRE(front.ConverterFlag);
+ REQUIRE(rear.ConverterFlag);
+
+ // the fans of the rear section switched off with its own switch, the 110 V of the front one still reaches it
+ rear.ConverterAllowLocal = false;
+ test::drive(driven, line, 2.0);
+ REQUIRE_FALSE(rear.ConverterFlag);
+ CHECK(rear.Power110vIsAvailable);
+
+ test::release_brakes(driven.cab);
+ for (int i = 0; i < 3 && driven.cab.DirActive <= 0; ++i) {
+ driven.cab.DirectionForward();
+ }
+ test::drive(driven, line, 20.0);
+ driven.controlling.IncMainCtrl(1);
+ // as the AI does, it waits at the first position for the contactors (their delay, the pressure switch)
+ for (int i = 0; i < 90 && false == front.StLinFlag; ++i) {
+ test::drive(driven, line, 1.0);
+ }
+ CHECK(front.StLinFlag);
+ CHECK_FALSE(rear.StLinFlag);
+
+ // the fans back on, the section starts too
+ rear.ConverterAllowLocal = true;
+ test::drive(driven, line, 10.0);
+ REQUIRE(rear.ConverterFlag);
+ CHECK(rear.StLinFlag);
+
+ // and the fans switched off on the way open its line contactors again
+ rear.ConverterAllowLocal = false;
+ test::drive(driven, line, 2.0);
+ CHECK_FALSE(rear.StLinFlag);
+ CHECK(front.StLinFlag);
+}
diff --git a/vehicle/Train.cpp b/vehicle/Train.cpp
index 201b8972f..2926d74fc 100644
--- a/vehicle/Train.cpp
+++ b/vehicle/Train.cpp
@@ -8975,6 +8975,7 @@ bool TTrain::Update(double const Deltatime)
btLampkaPrzetw.Turn(mvOccupied->Power110vIsAvailable);
btLampkaPrzetwOff.Turn(!mvOccupied->Power110vIsAvailable);
+ btLampkaPrzetwAOff.Turn(!mvControlled->ConverterFlag);
btLampkaNadmPrzetw.Turn(Dynamic()->Mechanik ? Dynamic()->Mechanik->IsAnyConverterOverloadRelayOpen : mvControlled->ConvOvldFlag);
btLampkaOpory.Turn(mvControlled->StLinFlag && mvControlled->ResistorsFlagCheck());
@@ -9147,6 +9148,7 @@ bool TTrain::Update(double const Deltatime)
btLampkaNapNastHam.Turn(false);
btLampkaPrzetw.Turn(false);
btLampkaPrzetwOff.Turn(false);
+ btLampkaPrzetwAOff.Turn(false);
btLampkaNadmPrzetw.Turn(false);
btLampkaSprezarka.Turn(false);
btLampkaSprezarkaOff.Turn(false);
@@ -11131,6 +11133,7 @@ void TTrain::clear_cab_controls()
btLampkaPrzetw.Clear();
btLampkaPrzetwB.Clear();
btLampkaPrzetwBOff.Clear();
+ btLampkaPrzetwAOff.Clear();
btLampkaPrzekRozn.Clear();
btLampkaPrzekRoznPom.Clear();
btLampkaUkrotnienie.Clear();
@@ -11546,6 +11549,7 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
{"i-conv_ovld:", btLampkaNadmPrzetw},
{"i-converter:", btLampkaPrzetw},
{"i-converteroff:", btLampkaPrzetwOff},
+ {"i-converteraoff:", btLampkaPrzetwAOff},
{"i-converterb:", btLampkaPrzetwB},
{"i-converterboff:", btLampkaPrzetwBOff},
{"i-diff_relay:", btLampkaPrzekRozn},
diff --git a/vehicle/Train.h b/vehicle/Train.h
index 009b349b4..df5dcfb76 100644
--- a/vehicle/Train.h
+++ b/vehicle/Train.h
@@ -709,6 +709,7 @@ public: // reszta może by?publiczna
TButton btLampkaNadmPrzetw;
TButton btLampkaPrzetw;
TButton btLampkaPrzetwOff;
+ TButton btLampkaPrzetwAOff; // the converter of this very unit off, where the trainset shares its 110 V (ET42 section fans)
TButton btLampkaPrzekRozn; // TODO: implement
TButton btLampkaPrzekRoznPom; // TODO: implement
TButton btLampkaNadmSil;