mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-02 00:22:42 +01:00
refactor(physics): the parts of the main circuit keep their state to themselves
The line breaker, the line contactors, the protective relays and the converter
(physics/components/maincircuit.h) become classes: what the .fiz defines is in
their public `config`, their state is private, read through queries
(IsClosed(), UndervoltageHolds(), IsRunning()) and changed through operations
(Close(), ResetGround(), Switch()). The logic that concerns only them moves in:
the initialisation of the main circuit, the ground relay, the pressure switch,
the resets of the relays, and the whole step of the converter, which gets what
it needs from the vehicle as plain values (ConverterSupply).
The vehicle still decides when they act (the interlocks, the controller
positions, the voltages); the parts don't take a physics::Vehicle.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
This commit is contained in:
@@ -181,7 +181,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
auto const &device { occupied->OilPump };
|
||||
return device.start_type != start_t::manual || device.is_enabled == true || device.is_active == true || occupied->lineBreaker.closed; } );
|
||||
return device.start_type != start_t::manual || device.is_enabled == true || device.is_active == true || occupied->lineBreaker.IsClosed(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::oilpumpoff: {
|
||||
@@ -334,7 +334,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
[]( TDynamicObject * Vehicle ) {
|
||||
auto *vehicle { Vehicle->physics };
|
||||
if( vehicle->LineContactorsHeldByLocalConverterSwitch() ) {
|
||||
vehicle->converter.allowLocal = true; } } );
|
||||
vehicle->converter.SetLocalSwitch(true); } } );
|
||||
}
|
||||
remove_hint( driver_hint::converteroff );
|
||||
hint(
|
||||
@@ -362,7 +362,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return occupied->converter.overloadRelayStart != start_t::manual || occupied->converter.overloaded == false; } );
|
||||
return occupied->converter.config.overloadRelayStart != start_t::manual || occupied->converter.IsOverloaded() == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::maincircuitgroundreset: {
|
||||
@@ -372,7 +372,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
return occupied->protection.groundStart != start_t::manual || occupied->protection.ground == true; } );
|
||||
return occupied->protection.config.groundStart != start_t::manual || occupied->protection.GroundHolds() == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::tractionnmotoroverloadreset: {
|
||||
@@ -406,7 +406,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const /*Parameter*/) {
|
||||
// TBD, TODO: replace with consist-wide flag set true if any line breaker is closed?
|
||||
return mvControlling->lineBreaker.closed == false; } );
|
||||
return mvControlling->lineBreaker.IsClosed() == false; } );
|
||||
break;
|
||||
}
|
||||
// compressor
|
||||
|
||||
Reference in New Issue
Block a user