From d90edb698033c66ccc93e1c447c53269dbeaa9e9 Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sat, 7 Nov 2026 14:06:58 +0100 Subject: [PATCH] fix(cab): on the SU45 and SU46 the open line contactors lamp lights with the contactors opened by the pressure switch (eu07/maszyna#263) On the electric locomotives the lamp of the open line contactors tells the start can be made, so it goes out with the start cut off by the pressure switch. The diesel-electric SU45 and SU46 (the only diesel-electrics with the lamp) use it just to show the contactors are open, but it went out the same way: with too low a pressure in the main pipe the contactors were open and the lamp out. Once the pressure came back with the master controller past the first position, the contactors stayed open, as they should, and the lamp lit up on a power position, which looked like the lamp working the other way round. On the diesel-electrics TMoverParameters::LineContactorsLampLit() now follows the contactors alone; the electric locomotives and the other main circuit lamps are unchanged. Tests: tests/unit/test_line_contactors.cpp, on a locomotive made after the SU46. --- McZapkie/MOVER.h | 8 +++- tests/unit/data/diesel_electric.json | 46 ++++++++++++++++++ tests/unit/test_line_contactors.cpp | 71 ++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 tests/unit/data/diesel_electric.json diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 199c65a0c..a34d537f4 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -2461,9 +2461,15 @@ class TMoverParameters { return false == ControlPressureSwitch && (HasControlPressureSwitch || BrakePress < 1.0); } - // whether the lamp of the open line contactors is lit, telling the start can be made + // whether the lamp of the open line contactors is lit. on the electric locomotives it tells the start can be made, so + // it goes out with the start cut off; on the diesel-electric ones (the SU45 and SU46 family) it just tells the + // contactors are open, whatever opened them: the master controller at 0, or the pressure switch (eu07/maszyna#263) bool LineContactorsLampLit() const { + if (EngineType == TEngineType::DieselElectric) + { + return false == StLinFlag; + } return false == StLinFlag && MainCircuitLampsEnabled(); } // whether the pumps a joint oil and fuel pump switch works, those not started automatically, are all switched on diff --git a/tests/unit/data/diesel_electric.json b/tests/unit/data/diesel_electric.json new file mode 100644 index 000000000..bef605880 --- /dev/null +++ b/tests/unit/data/diesel_electric.json @@ -0,0 +1,46 @@ +{ + "_comment": "Diesel-electric locomotive made after the SU46 (303D): the line contactors close on the first power position of the master controller, the pressure switch (on by default) opens them with too low a pressure in the main pipe or the brakes applied.", + "Param": { "Category": "train", "M": 105000, "Mred": 15000, "Vmax": 120, "PWR": 1400, "SandCap": 400 }, + "Dimensions": { "L": 18.99, "H": 4.292, "W": 2.904, "Cx": 0.3 }, + "Wheels": { "D": 1.1, "AIM": 4000, "Tw": 1.435, "Axle": "Co'Co'", "Ad": 1.75, "Bd": 10.3, "Rmin": 100 }, + "Brake": { + "BrakeValve": "LSt", "NBpA": 4, "MBF": 85.0, "MaxBP": 4.4, "LocMaxBP": 4.4, "MaxASBP": 1.3, "RM": 0.71, "BCN": 12, "BCR": 0.114, + "BCD": 0.06, "BCM": 5.84, "HiPP": 5, "LoPP": 3.5, "Vv": 0.9, "MinCP": 7, "MaxCP": 8.5, "CompressorSpeed": 0.05, "BCS": 1, "BSA": 2, + "BM": "P10-Bgu", "CompressorPower": "Converter", "BVV": 200, "BRE": 0.8 + }, + "BuffCoupl": { "CType": "Screw", "kB": 9200, "DmaxB": 0.15, "FmaxB": 740, "kC": 4800, "DmaxC": 0.15, "FmaxC": 780, "beta": 0.58, "AllowedFlag": 103 }, + "Cntrl": { + "BrakeHandle": "FV4a", "LocBrakeHandle": "FD1", "BrakeSystem": "Pneumatic", "BDelay1": 15, "BDelay2": 6, "BDelay3": 36, "BDelay4": 32, + "ASB": "Manual", "LocalBrake": "PneumaticBrake", "MCPN": 15, "SCPN": 4, "AutoRelay": "Yes", "IniCDelay": 0.5, "SCDelay": 0.1, + "BrakeDelays": "GPR", "ConverterStart": "Automatic", "ConverterStartDelay": 10 + }, + "Light": { "Light": "Generator", "LGeneratorEngine": "ElectricSeriesMotor", "LMaxVoltage": 110, "LMaxCurrent": 100 }, + "Engine": { + "AIM": 1.6, "EngineType": "DumbDE", "Trans": "18:62", "Ftmax": 317000, "Flat": 0, "Vhyp": 15.0, "Vadd": 3.8, "Cr": 1.0, "RelayType": 46, + "OilMinPressure": 0.055, "OilMaxPressure": 0.6, "WaterMinTemperature": 40, "WaterMaxTemperature": 92, "WaterCoolingTemperature": 76, + "HeatKW": 0.068599, "HeatKV": 0.3, "HeatKFE": 1, "HeatKFS": 87.76269, "HeatKFO": 26.72716, "HeatKFO2": 57.72 + }, + "Circuit": { "CircuitRes": 0.01, "ImaxLo": 3300, "IminLo": 2500 }, + "_power": "rows: engine speed [rpm], power [kW], generator voltage limit, current limit, one per master controller position", + "WWList": { + "Size": 15, + "rows": [ + [696, 0, 0, 0], + [696, 0, 0, 0], + [696, 80, 350, 1000], + [696, 80, 350, 1000], + [763, 214, 455, 1400], + [830, 321, 500, 1600], + [897, 428, 545, 1800], + [964, 535, 590, 2000], + [1031, 642, 635, 2200], + [1098, 748, 680, 2400], + [1165, 855, 725, 2600], + [1232, 962, 770, 2800], + [1299, 1069, 815, 3000], + [1366, 1176, 865, 3200], + [1433, 1283, 910, 3400], + [1500, 1390, 960, 3600] + ] + } +} diff --git a/tests/unit/test_line_contactors.cpp b/tests/unit/test_line_contactors.cpp index 79c419edf..fd7e24f08 100644 --- a/tests/unit/test_line_contactors.cpp +++ b/tests/unit/test_line_contactors.cpp @@ -57,3 +57,74 @@ TEST_CASE("line contactors: the ground relay and overload lamps follow the same vehicle->MotorConnectorsCheck(); CHECK_FALSE(vehicle->MainCircuitLampsEnabled()); } + +// on the diesel-electric SU45 and SU46 (eu07/maszyna#263) the lamp tells just the line contactors are open: lit with the +// master controller at 0 and with the start cut off by too low a pressure in the main pipe, out on the power positions + +namespace { + +// the diesel-electric locomotive with its engine running and the brakes released, the master controller at 0 +test::vehicle diesel_electric() { + test::vehicle vehicle{test::definition::load("diesel_electric")}; + vehicle->CabOccupied = 1; + vehicle->CabActivisation(); + vehicle->BatterySwitch(true); + vehicle->OilPumpSwitch(true); + vehicle->FuelPumpSwitch(true); + vehicle.run(20.0); // the oil pressure builds up + vehicle.hold_brake_pipe(5.0); // bar + vehicle->MainSwitch(true); + vehicle.run(30.0); + vehicle->DirectionForward(); + vehicle.run(60.0); // the brakes release + return vehicle; +} + +} // namespace + +TEST_CASE("line contactors: on a diesel-electric the lamp is lit at 0 and goes out on a power position") { + auto vehicle{diesel_electric()}; + REQUIRE(vehicle->EngineType == TEngineType::DieselElectric); + REQUIRE(vehicle->Mains); + REQUIRE_FALSE(vehicle->ControlPressureSwitch); + CHECK_FALSE(vehicle->StLinFlag); + CHECK(vehicle->LineContactorsLampLit()); + + vehicle->IncMainCtrl(1); + vehicle.run(3.0); + CHECK(vehicle->StLinFlag); + CHECK_FALSE(vehicle->LineContactorsLampLit()); + + vehicle->DecMainCtrl(1); + vehicle.run(3.0); + CHECK_FALSE(vehicle->StLinFlag); + CHECK(vehicle->LineContactorsLampLit()); +} + +TEST_CASE("line contactors: on a diesel-electric the lamp lights with the contactors opened by too low a main pipe pressure") { + auto vehicle{diesel_electric()}; + vehicle->IncMainCtrl(1); + vehicle.run(1.0); + vehicle->IncMainCtrl(1); + vehicle.run(2.0); + REQUIRE(vehicle->StLinFlag); + + vehicle.hold_brake_pipe(2.5); // bar, below the 3.6 bar of the pressure switch + vehicle.run(10.0); + REQUIRE(vehicle->ControlPressureSwitch); + CHECK_FALSE(vehicle->StLinFlag); + CHECK(vehicle->LineContactorsLampLit()); // it went out here + CHECK_FALSE(vehicle->MainCircuitLampsEnabled()); // the ground relay and overload lamps still go out with the start cut off + + // the pressure back, the contactors stay open on the second position and the lamp stays lit, as it should; + // they close again only on the first one + vehicle.hold_brake_pipe(5.0); + vehicle.run(60.0); + REQUIRE_FALSE(vehicle->ControlPressureSwitch); + CHECK_FALSE(vehicle->StLinFlag); + CHECK(vehicle->LineContactorsLampLit()); + vehicle->DecMainCtrl(1); + vehicle.run(3.0); + CHECK(vehicle->StLinFlag); + CHECK_FALSE(vehicle->LineContactorsLampLit()); +}