18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-21 01:34:59 +01:00

Merge pull request #272 from MaSzyna-EU07/feat/mains-before-pantographs

Line breaker before the pantographs (`Cntrl.PantRequiresMain`)
This commit is contained in:
maj00r
2026-11-11 22:41:28 +01:00
committed by GitHub
6 changed files with 447 additions and 27 deletions

View File

@@ -3195,6 +3195,20 @@ void TController::SetDriverPsyche() {
}
}
// closes the line breaker, or starts the engine, the relays reset first
void TController::close_line_breaker()
{
cue_action( driver_hint::mastercontrollersetzerospeed );
// consist-wide ground relay reset
cue_action( driver_hint::maincircuitgroundreset );
cue_action( driver_hint::tractionnmotoroverloadreset );
if( mvOccupied->EngineType == TEngineType::DieselEngine ) {
// specjalnie dla SN61 żeby nie zgasł
cue_action( driver_hint::mastercontrollersetidle );
}
cue_action( driver_hint::linebreakerclose );
}
bool TController::PrepareEngine()
{ // odpalanie silnika
// HACK: don't immediately activate inert vehicle in case the simulation is about to replace us with human driver
@@ -3219,6 +3233,13 @@ bool TController::PrepareEngine()
}
}
if( mvControlling->PantographsRequireMains
&& IsAnyLineBreakerOpen ) {
// the pantographs rise only through the closed line breaker, which closes without their voltage
PrepareDirection();
close_line_breaker();
}
if( mvPantographUnit->EnginePowerSource.SourceType == TPowerSource::CurrentCollector
&& mvPantographUnit->EnginePowerSource.CollectorParameters.CollectorsNo > 0 ) {
// if our pantograph unit isn't a pantograph-devoid fallback
@@ -3273,15 +3294,7 @@ bool TController::PrepareEngine()
}
if( IsAnyLineBreakerOpen ) {
// activate main circuit or engine
cue_action( driver_hint::mastercontrollersetzerospeed );
// consist-wide ground relay reset
cue_action( driver_hint::maincircuitgroundreset );
cue_action( driver_hint::tractionnmotoroverloadreset );
if( mvOccupied->EngineType == TEngineType::DieselEngine ) {
// specjalnie dla SN61 żeby nie zgasł
cue_action( driver_hint::mastercontrollersetidle );
}
cue_action( driver_hint::linebreakerclose );
close_line_breaker();
}
else {
// main circuit or engine is on, set up vehicle devices and controls

View File

@@ -676,6 +676,7 @@ public:
bool CheckVehicles( TOrders user = Wait_for_orders );
private:
bool PrepareEngine();
void close_line_breaker();
bool ReleaseEngine();
void Doors( bool const Open, int const Side = 0 );
// returns true if any vehicle in the consist has an open door