18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 14:07:06 +01:00
Commit Graph

16 Commits

Author SHA1 Message Date
Hirek f65411a668 refactor(physics): the motion of the vehicle is private to it
The speed along the couplers, the location, the offsets from the track axis,
the accelerations, the distance counter and the distance moved since the last
check, the flat of the wheels and the truck hunting, the distance of the
derailment check, whether the vehicle is inside a consist and in the coupler
model, the analog demand of the integrated controller and the flow of the pipe
stabiliser are private to physics::Vehicle. TDynamicObject places and moves the
vehicle, the scenery puts road vehicles on their way and the contacts push them
through the operations (SetV(), SetLoc(), SetOffsetTrackH(), ...), and the
jolts of the track are ShakeVertically() and ShakeHorizontally(), the same
additions as before.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 12:43:38 +01:00
Hirek 0b5459ef7b refactor(physics): the positions of the brake handles are private to the brakes
The positions of the driver's brake valve (stepped, continuous, and of the
FV4a with its cap), of the independent brake and of its EP counterpart in
units with induction motors, and of the hand brake are private to
physics::Braking: read through HandlePosition(), IndependentPosition(), ...
and moved through SetHandlePosition(), SetIndependentPosition(), ..., by the
vehicle's own stepping as by the cab, the AI and the consist braking. The
gauges of the cab bind to them read-only.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 12:38:26 +01:00
Hirek 84f1aa2515 refactor(physics): the controllers and the switches of the cab are private to the vehicle
The positions of the master and the secondary controller, of the analog
controller and of the lights selector, the occupied cab, the horns, the radio
and its fuse, the radio-stop, the wipers' switch, the dimmer, the mirrors'
button, the end-of-train signalling and the forced resistor fans: fourteen
fields the cab, the AI, the scenery and the tests wrote straight into
physics::Vehicle are private now. The rest of the simulator reads them through
queries named as the fields were (MainCtrlPos(), Radio(), ...) and changes them
through operations (SetMainCtrlPos(), SetRadio(), ...), so every place that
moves a controller past its own stepping (IncMainCtrl()) is named and can be
found; the compiler keeps anything else out. Inside the vehicle they keep
their meaning under camelCase names. The queries return const references, as
the gauges of the cab bind to them.

The .fiz keys are untouched.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 12:26:21 +01:00
Hirek bc2af26dd5 refactor(physics): the compressed air supply and the pipes keep their state to themselves
The compressor, the main reservoir and the pipes along the train
(physics/components/airsupply.h) become classes, as the parts of the main
circuit: the definition in `config`, the state behind queries and operations.

The step of the compressor (the programmer of a unit, its supply and its start
delay, the governor and its lock, the venting over the top pressure) moves into
AirCompressor::Update(), with what it needs from the vehicle as plain values
(CompressorInputs); the vehicle follows the step up as before (the switching
delay, the counter of the debug panel, the sound of the relay). The leaks and
the pressure of the main reservoir move into AirSupply, and the reservoir is
filled and drawn through it.

The fault of the compressor the scenery can set no longer adds 100000001 to its
pressures from TDynamicObject::Damage(): AirCompressor::SetFault() does the same
arithmetic, so a fault behaves exactly as it did.

No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
2026-11-29 10:14:37 +01:00
Hirek 89258eb72c refactor(physics): the low voltage, the train heating and the electrodynamic brake as components
The rest of the electrics of physics::Vehicle beside the traction motors
becomes components, with English names:

  lowVoltage (LowVoltageSupply,   Battery batteryOn, BatteryVoltage,
  physics/components/lowvoltage.h) NominalBatteryVoltage, BatteryStart,
                                  Power110vIsAvailable / Power24vIsAvailable /
                                  Power24vVoltage power110vAvailable /
                                  power24vAvailable / power24vVoltage, the
                                  battery button of the cab: batteryButtonFired,
                                  batteryButtonImpulse, batteryButtonHeld,
                                  batteryButtonHoldTime
  trainHeating (TrainHeating)     Heating on, HeatingAllow allow,
                                  HeatingSwitchImpulse switchImpulse,
                                  HeatingPower power, EngineHeatingRPM engineRpm
  brakes.electrodynamic           the DynamicBrake* fields: type, ammeters,
  (ElectrodynamicBrake,           controllerPositions, controllerPosition,
  physics/components/braking.h)   resistance(1, 2), on, emuWorking;
                                  SplitEDPneumaticBrake splitFromPneumatic;
                                  the fans of the braking resistor (BRVentilators,
                                  BRVto, BRVtimer, Imaxrpc): resistorFansRunning,
                                  resistorFansSustain, resistorFansTimer,
                                  resistorPassiveMaxCurrent

The diesel-electric dynamic brake (DEDynamicBrake) and the currents of the
traction circuit (Im, Itot, EngineVoltage ...) stay for the traction stage.

No string literal changed (checked over all the changed files).

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-29 03:15:56 +01:00
Hirek 16568d5695 refactor(physics): the brake valves, cylinders, pressures and positions in physics::Braking
The rest of the braking of physics::Vehicle moves into brakes, with English
names (physics/components/braking.h):

  the valves      Hamulec distributor, Handle driverValve,
                  LocHandle independentValve
  the definition  BrakeSystem kind, BrakeSubsystem subsystem, BrakeValve /
                  BrakeValveSize / BrakeValveParams distributorType / Size /
                  Parameters, BrakeHandle / BrakeLocHandle driverValveType /
                  independentValveType, the Handle_* driverValveSettings,
                  LocalBrake localKind, MaxBrakePress maxCylinderPressure,
                  LoadFlag loadSetting, P2FTrans pressureToForce, NBpA
                  blocksPerAxle, High/Low/DeltaPipePress pipeHigh/LowPressure
                  / pipePressureRange, CntrlPipePress controlReservoirPressure,
                  Spg pipeSection, RapidMult / RapidVel rapidRatio / rapidSpeed,
                  BrakeDelay delays, BrakeCtrlPosNo handlePositions, ...
  cylinders       BrakeCylNo / Radius / Dist / Mult / Spring, BrakeSlckAdj,
                  BrakeRigEff: count, radius, stroke, leverRatio, springForce,
                  slackAdjusterForce, riggingEfficiency
  emergencyValve  EmergencyValveOn / Off / Open / Area / Flow
  pipeLock        LockPipeOn / Off, HandleUnlock, LockPipe, UnlockPipe
  the state       BrakePress cylinderPressure, LocBrakePress
                  independentCylinderPressure, EqvtPipePress
                  equivalentPipePressure, Volume reservoirAir, dpBrake / dpPipe /
                  dpMainValve / dpLocalValve brakeFlow / pipeFlow /
                  driverValveFlow / independentValveFlow, BrakeCtrlPos(R, 2)
                  handlePosition(Real), handleCapPosition, fBrakeCtrlPos
                  handlePositionSmooth, LocalBrakePosA(EIM) independentPosition
                  (Eim), BrakeStatus status, AlarmChainFlag alarmChain,
                  BrakeDelayFlag / BrakeDelays delaySetting / availableDelays,
                  BrakeOpModeFlag / BrakeOpModes operatingMode /
                  availableOperatingModes, UnitBrakeForce unitForce, ...

Renamed in the files of the vehicle itself, and elsewhere only where reached
through -> or .: the driver keeps its own BrakeSystem, the editor its Handle,
the radio its Volume, and the brake valve classes (brakes.*, oerlikonest.*)
their fields of the same names. The C arrays (MaxBrakePress, BrakeCylMult,
the universal buttons) are std::arrays of the same values; the bits of status,
delaySetting and operatingMode stay ints for now.

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-29 01:48:33 +01:00
Hirek 309926bb05 refactor(physics): the air supply and the pipes along the train as components
The air of physics::Vehicle becomes components of their own, with the fields
named in English (physics/components/airsupply.h):

  air (AirSupply)            the compressor and the main reservoir:
    compressor (AirCompressor) MinCompressor, MaxCompressor and those of each
                             cab, CabDependentCompressor, CompressorSpeed,
                             CompressorPower, CompressorStartDelay,
                             CompressorTankValve, CompressorStart, the
                             CompressorList programmer and its switch, and
                             the state: CompressorFlag running,
                             CompressorAllow(Local) allow(Local),
                             CompressorGovernorLock, CompressorPowerTime
    VeselVolume              mainReservoirVolume
    Compressor               mainReservoirPressure
    CompressedVolume         compressedVolume
    AirLeakRate              leakRate
  brakePipe, mainPipe        the two pipes along the train, of one type,
  (TrainPipe)                TrainPipe: reservoir, pressure, couplersPending
                             (Pipe, PipePress, PipeCouplersPending and Pipe2,
                             ScndPipePress, ScndPipeCouplersPending before)

CompressorPower, a number 0 to 5, is the enum CompressorSupply (mainCircuit,
converterManual, converter, engine, frontUnitConverter, rearUnitConverter),
read from the same words of the .fiz. The CompressorList table is a
std::array of the same ints.

The exchange of air through the hoses (pneumatics.cpp) takes the pipe as one
TrainPipe of the vehicle instead of three member pointers.

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-29 01:18:26 +01:00
Hirek 2753994bf6 refactor(physics): the blending, the holding brake and the spring brake in physics::Braking
The first part of the braking of physics::Vehicle becomes a component of its
own, brakes (physics/components/braking.h), with the fields named in English:

  blending (BrakeBlending)    the MED_* of the Blending section and their
                              timers: maxSpeed, minSpeed, referenceSpeed,
                              maxDeceleration, epCorrection(Time, Timer),
                              loadCorrection, minEdDemand, edForceFactor,
                              edFirstDelay, edNextDelay, edDelayTimer
  emuDynamic (EmuDynamicBrake) the DCEMUED_*: checkedCoupler, epMaxSpeed,
                              epMinCurrent, epDelay
  holding (HoldingBrake)      StopBrakeDecc, StopBrakeReleaseDelay, the timer:
                              deceleration, releaseDelay, releaseTimer
  spring (SpringBrake)        the nested spring_brake (SBP is pressure,
                              ShuttOff shutOff, MultiTractionCoupler
                              controlCouplings ...) and the
                              ReleaseParkingBySpringBrake*,
                              SpringBrakeCutsOffDrive,
                              SpringBrakeDriveEmergencyVel of the vehicle

Each field says in its comment the key of the .fiz it comes from; the keys,
the golden channel names and the texts are as they were. The struct is
Braking, not BrakeSystem, the name of the kind of the train brake the vehicle
already has.

Kept as it was, to look at: the spring brake reads valveOffArea from the key
ValveOnArea and valveOnArea from ValveOffArea.

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-29 00:28:52 +01:00
Hirek d0387753f8 refactor(physics): TMoverParameters becomes physics::Vehicle, the mover is gone
The physics of a vehicle loses the name it had from the Pascal of 2001. Done by
tools/rename/mover_to_physics.py, committed with it:

  physics/mover.h                  physics/vehicle.h
  TMoverParameters                 physics::Vehicle (in namespace physics)
  TDynamicObject::MoverParameters  physics
  mvOccupied, mvControlled         occupied, controlled (TTrain, TController)
  mvSecond, mvThird                secondUnit, thirdUnit
  mvPantographUnit                 pantographUnit
  mover, Mover, movers             physics, Physics, vehicles (locals, params)
  m_mover, othermover, currentMover, from_movers, renderMoverEventSounds
                                   m_physics, otherPhysics, currentPhysics,
                                   from_vehicles, renderPhysicsEventSounds

The code and the comments are renamed, the string literals are not: no text
the game shows, logs or looks up has changed (none had the names). The movers
of the editor, the tracks a slide moves, keep their name.

By hand: two member functions of TDynamicObject (gather_off_track_terrain,
begin_off_track) had a local mover aliasing their own MoverParameters, which
the rename made physics { *physics }; the alias is gone, they use physics->.
No other function has a renamed local meeting a renamed member (checked over
all the functions of the code before the rename).

For the branches made before it: run the script on the branch (python
tools/rename/mover_to_physics.py, from the root of the repository) before
merging it with this one, and the names don't conflict. It can be run again;
the second time it changes nothing.

The class is the same as it was; breaking it into its parts (braking,
electrics, controls, load) and making its data private are the next stages.

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-28 23:56:46 +01:00
Hirek 04f76951f5 refactor(physics): the diesel engine, the torque converter and the retarder are components of their own
TMoverParameters held some 80 fields of the diesel engine and its hydraulic
transmission among its other 600, named dizel_*, hydro_TC_* and hydro_R_*.
They are now three structures of physics/components/dieselengine.h, with
English names:

- DieselEngine diesel: the definition (maxMoment, maxRevolutions,
  minRevolutions, the governor, the clutch, the fuel consumption, the tables)
  and the state (fill, clutchState, clutchPressure, torque, power, the start
  up, the fuel consumed) and its heat (EngineHeat, heat_data before)
- TorqueConverter torqueConverter: present, the ratios, the lockup, the
  fill rates, the table, and its state (fill, lockedUp, torqueRatio, the
  revolutions in and out)
- Retarder retarder: present, its placement, torque, power, fill rates,
  clutch, and its state

The .fiz keywords, the keys of the dictionaries of the Python screens and the
names of the golden channels (dizel_fill...) are unchanged; only the C++
names changed. The functions of the engine (dizel_Update, dizel_Momentum...)
stay members of TMoverParameters for now.

No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
2026-11-28 15:23:36 +01:00
Hirek 54d3a1040a refactor(physics): EnumSet<E> for the sets of flags; the damage of a vehicle is VehicleDamage and DamageSet
- utilities/enumset.h: EnumSet<E>, a set of the values of an enum class whose
  values are bits, with the operations CouplingSet had (HasAll, HasAny,
  Empty, Set, Clear, Without, |, &, ^, ==, FromBits, Bits). CouplingSet is
  EnumSet<Coupling> now; an enum is a kind of the sets by IsEnumSetKind<E>,
  which gives it its operator |.
- the damage of a vehicle (DamageFlag) is a DamageSet of VehicleDamage
  instead of the int and the dtrain_* constants. A bit means one thing for a
  locomotive and another for a wagon; both names are there (thinWheel and
  loadShift, ventilator and loadDamage, engine and loadDestroyed).
- the SetDamage command of the scenery adds or takes away the damage by its
  number as SetFlag() did (setOrClear()); "WRECKED" is still the set of the
  number 255; the bearing divisor of the resistance stays the number 4.
- the damage of the tracks and of the catenary (dtrack_*, the traction's
  DamageFlag) are other flags and stay as they were.

No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
2026-11-28 01:22:57 +01:00
Hirek 2098614f8c refactor(physics): the couplings are Coupling and CouplingSet, not the bits of an int
What a coupling between two vehicles joins (the coupler, the brake hose, the
control cable, the high voltage...) was an int of bits, tested as
(flag & 36) == 36, (x & coupling::control) != 0, TestFlag(), SetFlag(x, -y),
compared with 0 and 3, with the same values twice (coupling:: and ctrain_).

- enum class Coupling (coupler, brakeHose, control, highVoltage, gangway,
  mainHose, heating, permanent, power24v, power110v, power3x400v), the values
  the scenery files and the definitions have always used; ctrain_* is gone
- CouplingSet, a set of them: HasAll(), HasAny(), Empty(), Set(), Clear()
  (as SetFlag() and ClearFlag() worked), Without(), |, &, ^, ==, and a test
  of any kind in a condition
- TCoupling's CouplingFlag, AllowedFlag, AutomaticCouplingFlag, PowerFlag and
  PowerCoupling, TCommand's couplings (was Coupling), the coupling parameters
  of the commands, Attach(), CompatibleCoupling(), Next(), Prev(),
  FirstFind(), is_connected(), the AI's iCoupler are CouplingSet
- the numbers are read into a set where they come in: the .fiz (BuffCoupl,
  negative AllowedFlag still meaning permanent), the scenery trainsets, the
  AI's Connect command, InvCtrCplFlag; and written as numbers where they go
  out: the scenery loader, the black box, the debug panels, DettachStatus()
- (CouplingFlag & 36) == 36 reads HasAll(Coupling::control | Coupling::mainHose)

No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
2026-11-27 23:20:53 +01:00
Hirek 5a537e69f2 refactor(physics): McZapkie/ becomes physics/, its files get English names
The folder of the vehicle physics was named after the author of its first
version (2001). Its name now says what it holds, and so do its files:

  McZapkie/MOVER.h, Mover.cpp       -> physics/mover.h, mover.cpp
  McZapkie/hamulce.h, hamulce.cpp   -> physics/brakes.h, brakes.cpp
  McZapkie/Oerlikon_ESt.h, .cpp     -> physics/oerlikonest.h, .cpp
  friction, collision, couplerphysics, derailment: same names in physics/

Every include names the folder ("physics/mover.h"); the McZapkie include
directory is gone from CMakeLists.txt. The comments and documents that
named the old paths name the new ones. The credits to McZapkie stay.

Renames only: git sees every file as renamed (98-100%). 1142/1142 tests,
golden traces exact against staging 62f7a29b.
2026-11-27 17:11:46 +01:00
jerrrrycho d755c7708f fix: the SM42's CA off in the shunt mode only with AwareOffInShuntMode, an alarm on kept
Review of #275. The shunt mode suspends the vigilance device (CA) only on the
vehicles whose .fiz sets the new Security key AwareOffInShuntMode=Yes (default
No), instead of on every diesel-electric with ShuntMode=1 (SP42, SU42 and the
401Z generator car had it too). Suspended, the CA counts no time towards a new
alarm, but an alarm already on stays, goes on to the emergency braking and
needs the usual acknowledgement, instead of going out with the shunt mode.
2026-11-08 18:19:59 +01:00
jerrrrycho 329dc4e42e feat: SM42 vigilance device switched off in the shunt mode (eu07/maszyna#457)
The shunt mode of the diesel-electrics (ShuntMode=1: SM42, SP42, SU42) now
suspends their vigilance device (CA): no alerter while running, no alarm for the
button held too long, and an alarm already on goes out. The cab signalling (SHP)
stays as it was. Back in the line mode the CA works as before.
2026-11-07 20:13:46 +01:00
jerrrrycho 466cbbbfa1 Test/core unit coverage (#235)
* test: real vehicles and golden traces in the unit tests

The game's own vehicles (dynamic/ of the release used for the tests) as
JSON of what the game's vehicle loader reads of their .fiz files, includes
expanded: test_fiz.cpp converts them on demand and checks the loader reads
the same sections, values and rows as of the game's file (fiz.h). Chosen
to cover every engine type, brake valve, brake handle, local brake,
coupler type, door type and brake delay set the game data uses.

Golden traces (golden.h) characterise the simulation, compared within a
relative tolerance or exactly, re-recorded with
EU07_UNIT_TESTS_UPDATE_GOLDEN=1:
- the parameters of every real vehicle as loaded,
- the brakes of every real vehicle through charge, service steps,
  release, overcharge and emergency, on every brake delay setting,
- every position of every driver's and local brake handle,
- every powered vehicle started up the way the AI does it, driven to
  full power and braked to a stop (drive.h),
- the real electric units and a locomotive with wagons driven whole, as
  trains of coupled vehicles stepped the way the game steps them
  (consist.h),
- scenarios of the controls (scenario.h): doors, reversing and cab
  change, slip and sand, emergency stops, releasers, the ep and the
  electrodynamic brake, heating, loading, a collision, and frames of
  several physics iterations.

* test: commands passed between vehicles

Every command RunCommand knows run on every real vehicle and recorded,
commands travelling through a train with a vehicle facing backwards, a
coupling without the control cable, and loading and unloading by commands.

* test: every switch of the cab, sent to the next vehicle

Each switch sending its state to the train, each way and to each range,
with the controllers and direction among them, on every real vehicle
driving another of its kind, recorded for both.

* test: the switches of the cab worked on a pair under the catenary

The same switches with two seconds for the vehicles to act on each, so
the pantographs rise, the main switch closes and the auxiliaries start.

* test: gauges of trains in multiple and the damage descriptions

The ammeters and the brake force the AI expects, recorded on the electric
units and locomotives in multiple driven, the damage described on the
driver's panel and ammeters showing the current of controlled vehicles.

* test: give load commands their place, as the game does

The loading test set its commands with SetInternalCommand, which leaves
TCommand::Location as it is: uninitialised in a fresh vehicle, so the
distance check of Load= and UnLoad= read garbage and the test failed
now and then. The game gives them through PutCommand with the place of
the platform, and so do the tests now.

* test: brake valves and handles no vehicle of the game data has

Fitted to a wagon and to an EU07: the valve variants and handles the
loader knows that no real vehicle uses, the CV1 ones and the test handle
among them, and a name the loader doesn't know.

* test: braking from speed with the automatic ED brake, and a draisine

Trains with the EP09, the E6ACT and the EW58 braked by ep, light and full
service applications from speed, and the draisine pumped from rest and
rolling. Only the E6ACT brings its electrodynamic brake in here.

* test: the EP09's electrodynamic brake in service braking held to a stop

start_up() took a vehicle for ready once its line breaker was closed and
its reservoir full, which a train made already moving is at once: the
EP09's manually started converter was never switched on, so there was
no 110 V and no electrodynamic brake. It now waits for the converter.

The EP09 with wagons is braked from 120 km/h by light, medium, high and
full service applications held to a stop: the motors brake, the air of
its cylinders is let out and given back as the train slows down. The
flag of the electrodynamic brake stays on at a standstill below 2.1 bar.

C strings given to CAPTURE are shown as text.

* test: the converter switched on before a train is ready, the EW58's ep-staged electrodynamic brake

start_up() called a train ready as soon as its line breaker closed and the air was there, so the converter
of a unit having it in another car than the cab (the EW58's middle car) was never switched on, and its
electrodynamic brake, gated by the 110 V, never came in. The converter and the compressor now always get
switched on first. The EW58 brakes electrically by the stages of the ep brake, not by the pipe alone.

* test: the ET42 and the 214M railbus among the real vehicles

The ET42's halves (its own series motor branch: the motors in series at the high current setting) and the
214MA, a diesel railbus with the hydraulic torque converter, the retarder and the controller of an induction
motor drive, converted from the game data and recorded in every sweep of the real vehicles.

* test: the wagons' hand brakes released with the train's brakes; the 754, SM31 and SU46

release_brakes() released the hand brake of the driver's vehicle only, so every wagon set up braked kept its
hand brake on and got dragged along. It now releases the hand and spring brakes of the whole train, as
TController::AutoRewident() does when the AI takes it over, and the traces of the trains with wagons are
recorded anew.

The 754, the SM31 and the SU46 join the real vehicles for the kinds of the diesel-electrics' field shunting
relays the others lack (RelayType 0, 1 and 46).

* test: traction on a lost and too high catenary voltage, the ET42, the diesel-electrics' shunting relays

The line breaker opened by the voltage relays of a series motor locomotive and by the limits of an induction
motor one. The ET42 at the high current setting, which keeps its halves' motors in series, and its switched
electrodynamic brake, whose current trips the overload relay from the top speed of the low setting. The field
shunting of the diesel-electrics through each kind of their relays, at full power and notched back.

* test: the EW58's electrodynamic brake stages, the EU47's speed control and braking at the voltage's limit

The stages of the EW58's motor brake set by the positions of its ep handle, the first one alone over
100 km/h. The EU47's second controller holding, raising and lowering the speed set, its local brake setting
the flag of the electrodynamic brake without the motors braking, and its brake feeding back less current into
a catenary over the drive's MaxV.

* test: diesel engines too cold and too hot to start, the 214M railbus's controller and retarder

The heat of the diesel engines: at -10 degrees the ones with the lowest water temperature set don't start
until the heater warms them, at 88 degrees the ones with a second water circuit don't start while it cools,
and the SM42 run hot at full power is kept under its highest temperature by its fans and shutters. The 214M
railbus's controller from the air brake through the retarder and neutral to power, its torque converter's
lock-up and its gearbox.

The controller helpers of the traction tests (full power, waiting for the line contactors, and notching back)
move to test::scenario.

* test: couplers coupled, uncoupled, broken and colliding; loads assigned, loaded and unloaded

Coupling by hand touching or apart and of the same kind or not, with the sounds of what changes; uncoupling a
screw coupler pressed together, stretched, with the hoses alone or broken; the automatic couplers of electric
units coupling on contact, without the control cable between two kinds; a coupler broken with its brake
hose; collisions over 15 km/h derailing. The pantographs set up by the pantstate load, a load of one kind at
a time up to the capacity, and the steps of loading and unloading.

* test: the battery drained and charged, the pantographs' tank and pressure switch, the 214M's speed control

The EU07's battery drained without the converter by the lights and the small compressor until it opens the
line breaker and nothing starts, charged by the converter, and switched off. The pantographs on their own
leaking tank until the pressure switch opens the line breaker, and the small compressor pumping it up and
priming the switch. The 214M railbus's speed control set by its buttons, steps and power limit, braking down
with the retarder, and standing by.

* test: the MHZ handles' buttons, the valves at speed, every brake material, the NESt3's relays

The overload and the high pressure buttons of the MHZ handles. The KE and the LSt at speed in the R and P
settings, under the anti-slip request and the releaser button. Every material of the brake shoes and disks
the loader takes, braking a wagon from speed, the ones no game vehicle has among them. The CV1_R and the
Oerlikon valve's relays set by its name (-ED, AL2 without ESt3) fitted to a wagon.

* test: the loader's lists and lines: the 218M, SA134 and 22WEc, a compressor list, Pmax by speed, skipped lines

The 218M (V2NList), the SA134 (HTCList) and the Elf 22WEc (ffBrakeList) join the real vehicles for the lists
the others lack. Definitions made by the tests for what no game file has: a compressor list, whose table of
whole numbers reads a factor of 0.9 as 0; the compressor's limits apart for the rear cab; the highest power
of an induction motor drive by the speed, extrapolated past the table; and the lines the loader skips or
trims (comments, a hash anywhere, leading spaces, carriage returns).

* test: what the cab and the AI call on a vehicle: gauges of the train, the split ED brake, spring brake, cut-off

The engine rotation of up to three vehicles in multiple and the lamps of the overload relay and the starting
resistors read through the control cable; the engine's idle speed and the ET42's second controller shown in
its dynamic brake; the controller of the electrodynamic brake apart from the local brake, which no game
vehicle has yet; the spring brake shut off and released, the ep brake's fuse and the handle stepped by the AI;
damaged motors cut off; the cab activated by itself; a road vehicle moved across a road, for which the tests'
track gets a width; and the lamps and the buzzer of the security system left unattended.

* test: the EP05 and its camshaft among the real vehicles, the headlights' colour and brightness

The EP05, whose camshaft closes the line breaker and the line contactors by the camshaft's own position,
converted from the game data and recorded in every sweep of the real vehicles. The Headlights section, which
only the 214M's own file has, in a definition made by the test.

* test: what the unit tests reach of the simulation core, what's dead or left, and what they found

COVERAGE.md: the blocks of Mover.cpp, hamulce.cpp, Oerlikon_ESt.cpp and friction.cpp the tests run, the code
nothing in the game runs, the code only data no game vehicle has would run, what's reachable and left, and
the behaviour the tests found that may deserve a look.

* test: check invariants of the physics on every step of every golden trace

Rules any vehicle keeps whatever a test does (no NaN, cylinders and pipes
within their limits, no current with the line breaker or contactors open,
no force without power, distance as the speed runs, no acceleration over
5 g), checked on every step, with no comparison to a recorded file. The
traces where a test or a game vehicle breaks one are excused with the
reason; the vehicles' cases are in the findings of COVERAGE.md.

* test: key figures of every golden trace, per part of the run

Duration, speeds, distance, time to stop, the brake pipe's lowest
pressure and time to recover, the peaks of the cylinders, the motor
current and the tractive force, for each part between two events, in
data/golden/<name>.figures. Compared within 0.5% or the last decimal, so
they hold on any compiler, and an intended change of behaviour shows in
a few readable lines. Traces sampled by hand keep none.

* test: keep the golden samples out of the repository, recorded on the code before a change

The samples of the golden traces are 29 MB and only mean something against
the code before the change they check, so they're recorded locally before it
(EU07_UNIT_TESTS_UPDATE_GOLDEN=1) and compared after it, and ignored by git.
The key figures and the invariants stay, and are what the CI checks.

Without samples recorded a trace compares only its key figures, but with
EU07_UNIT_TESTS_GOLDEN_EXACT=1, the check of a change which shouldn't alter
anything, it fails, so the check can't pass by having nothing to compare.

* fix: draw the noise of the control pipe pressure in one order on every compiler

The order of the two Random(10) calls in 'Random(10) - Random(10)' is
unspecified: GCC draws them the other way round than MSVC Release, which
mirrored the control pipe pressure around 5 bar and failed 32 unit tests
on the Linux CI. The draws are sequenced in the order of MSVC Release,
which the golden traces were recorded with.

* test: count the start-up rounds with an integer, not a double (SonarCloud S2193)

* test: behaviour in CHECKs, the key figures out of the repository

The key figures of the golden traces are recorded with their samples on the code
before a change, and compared after it, instead of being kept: a trace without
them checks the invariants and its test's CHECKs, which is what the CI runs.

The scenarios of the controls state what they show in CHECKs, and the runs of
every real vehicle what holds for each of them. Writing them showed scenarios
which didn't do what they were named for: the cab change stopped in the engine
room, the slip runs put the controller to full power at once and never got the
line contactors closed, and the train stopped by the alarm chain never got its
pipe charged again. They do it now; the rest went to the findings.

* test: the SonarCloud findings in the unit tests

std::format for the texts put together, emplace_back, const references, string_view parameters, std::array and std::vector for the C arrays, the ranges algorithms, names no longer shadowing the coupler ends, comments in the empty loops; start_up(), trace::check() and the converter of the definitions split up. BrakeForceR() is const, which it always was in effect, so the gauges test needs no const_cast. The golden traces compare bit for bit.
2026-11-07 12:37:12 +01:00