18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 19:44:58 +01:00

feat: interlock the line contactors with the section fans, own-converter lamp (eu07/maszyna#460)

On the ET42 the fans of each section run off that section's converter: the
section fan switch of the cab is bound to converterlocal_sw. The line
contactors of a section with its fans switched off must not close.

- New optional Cntrl. key LineContactorsInterlock=Converter|MotorBlowers.
  MotorConnectorsCheck() then also needs the vehicle's own converter
  (ConverterFlag, not the trainset's shared 110 V), or all its motor
  blowers, running. It is checked per vehicle, so only that section stays
  off, and switching the fans off on the way opens its contactors. Without
  the key nothing changes.
- New optional lamp i-converteraoff:, lit while the converter of the
  vehicle with the cab is off. i-converteroff: follows the shared 110 V, so
  with one ET42 section's fans off it stayed dark. i-converterboff: already
  covers the other section.

SVN data, to change once this is released (old data works as before):
- dynamic/pkp/et42_v2/112e-a.fiz, 112e-b.fiz: LineContactorsInterlock=Converter
  in the Cntrl. line.
- dynamic/pkp/et42_v2/112e-a.mmd.inc, 112e-b.mmd.inc:
  i-converter: nadm_przetw -> i-converteraoff: nadm_przetw,
  i-converterb: nadm_przetw_b -> i-converterboff: nadm_przetw_b,
  i-compressor: sprezarka -> i-compressoroff: sprezarka,
  i-compressorb: sprezarka_b -> i-compressorboff: sprezarka_b
  (the compressor "off" lamps already light with the compressor switched off
  or stopped by its pressure governor).

(eu07/maszyna#460)
This commit is contained in:
jerrrrycho
2026-11-07 20:36:25 +01:00
parent 939e42b611
commit f34f912b38
5 changed files with 150 additions and 1 deletions

View File

@@ -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);
}