18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 00:45:29 +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:
2026-11-29 09:37:01 +01:00
parent dfb43c4f05
commit 22ebc41d70
53 changed files with 789 additions and 654 deletions
+2 -2
View File
@@ -295,9 +295,9 @@ WyslijNamiary([[maybe_unused]] TDynamicObject const *Vehicle)
r.iPar[20] = Vehicle->physics->ScndCtrlActualPos; // Pozycja bocznikowania
r.iPar[21] = Vehicle->physics->ScndCtrlActualPos; // Pozycja bocznikowania
r.iPar[22] = Vehicle->physics->ResistorsFlag * 1
+ Vehicle->physics->converter.running * 2
+ Vehicle->physics->converter.IsRunning() * 2
+ Vehicle->physics->air.compressor.running * 4
+ Vehicle->physics->lineBreaker.closed * 8
+ Vehicle->physics->lineBreaker.IsClosed() * 8
#ifdef EU07_USEOLDDOORCODE
+ Vehicle->physics->DoorLeftOpened * 16
+ Vehicle->physics->DoorRightOpened * 32