diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 14f848c8d..d4f575287 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -2623,6 +2623,12 @@ class TMoverParameters } // whether the devices the line contactors are interlocked with (LineContactorsInterlock) let them close bool LineContactorsInterlockReleased() const; + // whether the line contactors wait for the converter of the vehicle, switched off with its local switch (converterlocal_sw). + // the AI driver doesn't leave it so: the converters of the other vehicles running, it would wait for the contactors forever + bool LineContactorsHeldByLocalConverterSwitch() const + { + return LineContactorsInterlock == line_contactors_interlock::converter && false == ConverterAllowLocal; + } // whether the vehicle has a driver's cab: it has the driver's brake valve (BrakeHandle in the Cntrl. section of the // .fiz), which the wagons and most cars of the units without a cab don't (a few copy the Cntrl. section of the cab // car, as the EN57 s car does). it's the vehicle type's, unlike the cab the scenario puts a driver in diff --git a/application/driverhints.cpp b/application/driverhints.cpp index ae39ede7a..0c6f02cc8 100644 --- a/application/driverhints.cpp +++ b/application/driverhints.cpp @@ -326,6 +326,14 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) case driver_hint::converteron: { if( AIControllFlag ) { mvOccupied->ConverterSwitch( true ); + // the local switch of the converter too, where the line contactors wait for the vehicle's own converter + // (LineContactorsInterlock): left off by the human driver, that vehicle would never take power + pVehicle->for_each( + coupling::control, + []( TDynamicObject * Vehicle ) { + auto *vehicle { Vehicle->MoverParameters }; + if( vehicle->LineContactorsHeldByLocalConverterSwitch() ) { + vehicle->ConverterAllowLocal = true; } } ); } remove_hint( driver_hint::converteroff ); hint( diff --git a/tests/unit/test_line_contactors_interlock.cpp b/tests/unit/test_line_contactors_interlock.cpp index 131c912ea..a025d4a69 100644 --- a/tests/unit/test_line_contactors_interlock.cpp +++ b/tests/unit/test_line_contactors_interlock.cpp @@ -241,6 +241,21 @@ TEST_CASE("line contactors interlock: a blower starting with the speed, switched CHECK(std::abs(mover.Im) > 0.5); } +TEST_CASE("line contactors interlock: held by the local converter switch only where they wait for that converter") { + // what the AI driver looks at to switch the converter of a section back on (TController, the converteron hint) + auto interlocked{ready("Converter")}; + CHECK_FALSE(interlocked->LineContactorsHeldByLocalConverterSwitch()); + interlocked->ConverterAllowLocal = false; + CHECK(interlocked->LineContactorsHeldByLocalConverterSwitch()); + + for (auto const *other : {"", "MotorBlowers"}) { + CAPTURE(other); + auto locomotive{ready(other)}; + locomotive->ConverterAllowLocal = false; + CHECK_FALSE(locomotive->LineContactorsHeldByLocalConverterSwitch()); + } +} + 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); diff --git a/vehicle/Driver.cpp b/vehicle/Driver.cpp index 03c471904..bbfd822d1 100644 --- a/vehicle/Driver.cpp +++ b/vehicle/Driver.cpp @@ -6587,11 +6587,14 @@ TController::determine_consist_state() { IsAnyConverterPresent = false; IsAnyConverterEnabled = false; IsAnyConverterExplicitlyEnabled = false; + // whether the line contactors of a vehicle wait for its own converter (LineContactorsInterlock), off with its local switch + auto islocalconverterswitchoff { false }; pVehicle->for_each( coupling::control, - [this]( TDynamicObject * Vehicle ) { + [this, &islocalconverterswitchoff]( TDynamicObject * Vehicle ) { auto const *vehicle { Vehicle->MoverParameters }; + islocalconverterswitchoff |= vehicle->LineContactorsHeldByLocalConverterSwitch(); IsAnyConverterOverloadRelayOpen |= vehicle->ConvOvldFlag; IsAnyMotorOverloadRelayOpen |= vehicle->FuseFlag; IsAnyGroundRelayOpen |= !vehicle->GroundRelay; @@ -6662,7 +6665,9 @@ TController::determine_consist_state() { false == IsAnyConverterOverloadRelayOpen && false == IsAnyLineBreakerOpen && ( false == IsAnyConverterPresent || true == IsAnyConverterEnabled ) - && ( false == IsAnyCompressorPresent || true == IsAnyCompressorEnabled ); + && ( false == IsAnyCompressorPresent || true == IsAnyCompressorEnabled ) + // the ai goes back to preparing the engine and switches that converter on, the human driver may run with it off + && ( false == AIControllFlag || false == islocalconverterswitchoff ); } void