18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-27 21:45:16 +01:00
Commit Graph

3746 Commits

Author SHA1 Message Date
maj00r
92b9e73197 Merge pull request #419 from MaSzyna-EU07/feat/pullee-mode
feat(physics): pullee mode, a vehicle prepared for being hauled dead in a train (#64)
2026-11-19 23:08:04 +01:00
maj00r
6418cd0507 Merge pull request #421 from MaSzyna-EU07/feat/pressure-switch-brake-cylinder
feat(mover): pressure switch without its brake cylinder half, line breaker opened by an emergency application (EP05)
2026-11-19 23:07:49 +01:00
maj00r
e9172c81e1 Merge pull request #424 from MaSzyna-EU07/feat/holding-brake-release-delay
feat(med): the holding brake lets go only after a set time of power demand (Elf, GE#556)
2026-11-19 23:07:34 +01:00
maj00r
d598f088bd Merge pull request #356 from MaSzyna-EU07/fix/script-screen-sandbox-limits
fix(scripting): close the small holes in the script screen sandbox (Lua and WebAssembly)
2026-11-19 23:05:46 +01:00
jerrrrycho
7a4a9532d1 test: cover the release delay of the Elf's holding brake
Without SBDReleaseDelay the holding brake lets go at the first demand, as
before. With SBDReleaseDelay=1.0 it lets go about 1 s after the handle, both
with the controller held at power and flicked there once and back to
holding the power; it holds again at no demand, a demand dropped before the
delay starts the count again, and two coupled Elfs do the same as one. A
start with the holding brake shared out as the MED does at standstill
shows the train held at the 1% of the first step until the release.
build-feat-holding-brake-release-delay
2026-11-19 19:30:44 +01:00
jerrrrycho
24266d6e5c feat(med): let the holding brake go only after a set time of power demand
A new Cntrl key, SBDReleaseDelay (seconds, default 0), makes the holding
brake of a unit with the MED (SBD) wait until power has been demanded for
that long before it lets go. Without the key the brake lets go at the first
demand, as before. The count starts again whenever the demand drops to zero.

The Elf data would get SBDReleaseDelay=1.0 (its IniCDelay) in the files
with SBD; that data change is for the SVN later, nothing needs it now.
2026-11-19 19:06:45 +01:00
jerrrrycho
e04d6af93e test: the pressure switch keys on the EP05
The EP05 takes current with 3.8 bar in its brake cylinders once the brake cylinder half of the pressure
switch is off, and loses it when the brake pipe goes down. An emergency application with the master
controller on a power position opens the line breaker and drops the pantographs; with the controller at
zero, or on a service application, it doesn't. The driver's start-up gets the locomotive going again.
Without the keys all of it is as before.
build-feat-pressure-switch-brake-cylinder
2026-11-19 17:44:03 +01:00
jerrrrycho
c2a48d7450 feat(mover): pressure switch without the brake cylinders, line breaker opened by an emergency application
Two optional .fiz keys, for the EP05 (git.eu07.pl eu07/maszyna#48). Without them nothing changes.

Engine: PressureSwitchBrakeCylinder=No leaves the pressure switch with the brake pipe alone (below 3.6 bar),
so the vehicle takes current whatever the pressure in its brake cylinders. PressureSwitch=Yes/No means what
it meant.

Cntrl. EmergencyBrakeMainOff=<bar> is the brake pipe pressure taken for an emergency brake application.
Below it, with the master controller on a power position, the line breaker opens and doesn't close again.
Where the pantographs stay up only through the closed line breaker (PantRequiresMain) they drop with it.

Data, not in this repository: dynamic/pkp/ep05_v2/ep05.fiz and ep05v1.fiz are to get
PressureSwitchBrakeCylinder=No in the Engine: line and EmergencyBrakeMainOff=2.5 in the Cntrl. line.
Until then the EP05 behaves as before.
2026-11-19 17:44:03 +01:00
jerrrrycho
ff638fb5b2 Merge remote-tracking branch 'origin/staging' into fix/script-screen-sandbox-limits
scripting/luaprogram.cpp: the libraries are opened by lua_sandbox::open_safe_libraries() of staging (#358), which removes newproxy and string.dump as this branch did; the limits of this branch (limit_libraries) are applied after it.
build-fix-script-screen-sandbox-limits
2026-11-19 04:54:36 +01:00
jerrrrycho
ecaa6872b9 test: scenario cases of an EU07 hauling a dead Vectron prepared for hauling
eu07_td_hauls_dead_vectron: the timetable run on td.scn with a Vectron behind the EU07, hook and
brake hose only, nobody in it, parameter H (MaSzyna-EU07/maszyna#64). eu07_td_hauls_dead_vectron_cold:
the same from a cold start (trainset velocity 0, fragment td_cold_timetable.scn, the driver woken
with Obey_train). Both reach Przystanek and stop there.

Without the H neither train moves: the Vectron vents the brake pipe (run before the feature, on the
code of staging: the pipe empty in 2 s, the Vectron's cylinders at 3.7 bar for the whole 300 s; cold,
the pipe below 1 bar and a standstill).

Refs MaSzyna-EU07/maszyna#64
build-feat-pullee-mode
2026-11-19 01:58:56 +01:00
jerrrrycho
79616ba5a4 feat(scenery): the parameter H after the coupling of a vehicle prepares it for hauling
A vehicle of a trainset spawns in the pullee mode (MaSzyna-EU07/maszyna#64) with the parameter H
among the ones written after its coupling, on its own or with the others:

    node -1 0 EU160-001 dynamic pkp/vectron_v1 1293-107 wariant_7w 0 nobody 3.H 0 enddynamic
    ... 3.BG.H ...

The parameters are told by their first letter (B brakes, W wheels, T temperatures, L load); H was
free, and one a build doesn't know is skipped, so a scenery with it loads in the releases too, where
the vehicle is as before. The letters after the H are left for later.

The mode is entered once the vehicle has its starting state, so a standing one lets go of its hand
brake and its spring brake switch. A vehicle with the H has nobody driving it, whatever its crew
entry says (its cab can't be activated); a driver left out is written to the log.

Refs MaSzyna-EU07/maszyna#64
2026-11-19 01:58:56 +01:00
jerrrrycho
3633c254fc feat(physics): pullee mode, a vehicle prepared for being hauled dead in a train
A dead locomotive or unit in somebody else's train (hook and brake hose, coupling 3) brakes the
train today (MaSzyna-EU07/maszyna#64):

- one with the emergency brake of an inactive cab (InactiveCabFlag bit 1: of the test vehicles the
  Vectron, Dragon, Elf, Impuls and EN57AKL) vents the brake pipe for as long as it is in the train,
  since its cab is never activated. Behind an EU07 the pipe is empty in two seconds and stays so,
- the spring brake applies once the feed pipe of the vehicle, which is its own main reservoir, falls
  below MinFP: at once without air, and within 20 minutes of a cold start as the reservoir leaks down
  (EU47: 0.077 bar a minute, from 4.4 bar).

TMoverParameters::PulleeMode, set with PulleeModeSwitch(), is the vehicle prepared for hauling.
In the mode it:

- vents the brake pipe for nothing of its own (inactive cab, vigilance and cab signalling,
  radio-stop, the spring brake of SpringBrakeDriveEmergencyVel); the alarm chain, which a train
  parting sets, still does,
- gets no force from its spring brake, whatever air its cylinder has,
- has its driver's valve cut out and its local brake released, whatever the handles show. The
  distributor stays on the brake pipe: it brakes and releases with the train,
- keeps its battery off and takes no cab: BatterySwitch(true) and CabActivisation() are refused,
  and the BatterySwitch and CabActivisation commands of a train's driver pass through it.

Entering the mode lets go of the hand brake and of the spring brake switch and switches the battery
off; a vehicle with an active cab can't enter it. Leaving it gives the controls back and the spring
brake as its cylinder has it.

Nothing sets the mode yet, and a vehicle not in it does what it did.

Refs MaSzyna-EU07/maszyna#64
2026-11-19 01:58:42 +01:00
jerrrrycho
f6e9075a73 fix(scripting): a %b counts the way it walks along the subject
A %bxy at the end of a pattern (or before what always matches) was costed
as one pass over the subject, but matchbalance walks to the end of the
subject from every opening character nothing closes: ("("):rep(1e6):find("%b()")
was let through and ran for hours in C, past the instruction hook.

A %b now multiplies wherever it stands. With the subject at hand it counts
the longest way from an opening character to its closing one, or, when it is
tried once from each position, the ways from all of them over the positions:
a long text of short balanced pairs stays cheap, one that doesn't balance is
refused.
2026-11-18 19:29:25 +01:00
maj00r
dd73386126 Merge pull request #358 from MaSzyna-EU07/fix/scenery-lua-sandbox
fix(scripting): sandbox the scenery Lua scripts like the Lua screens
2026-11-18 01:23:51 +01:00
maj00r
23494ed200 Merge pull request #339 from MaSzyna-EU07/fix/ai-connect-releases-hand-brake
AI: release the hand brake when the first order is Connect
2026-11-18 01:20:53 +01:00
maj00r
edf7935a1a Merge pull request #377 from MaSzyna-EU07/feat/derailment-overspeed-criteria
feat(physics): derailment from overspeed by physical criteria (overturning, flange climbing)
2026-11-18 01:20:39 +01:00
maj00r
555bf7bafc Merge pull request #359 from MaSzyna-EU07/feat/drivingaid-ed-braking
feat(ui): driving aid shows the ED braking and leaves out a local brake the cab has no control of
2026-11-18 01:20:12 +01:00
maj00r
f2b95c7841 Merge pull request #402 from MaSzyna-EU07/feat/camera-orbit-and-shunting-views
feat: orbit, shunting, coupling and trackside views of the train (GE#551)
2026-11-18 01:19:58 +01:00
maj00r
056d7dab1c Merge pull request #394 from MaSzyna-EU07/feat/diesel-electric-dynamic-brake
feat: dynamic brake of the diesel-electric vehicles, opt-in per .fiz (#82)
2026-11-18 01:19:45 +01:00
maj00r
68245f4fae Merge pull request #397 from MaSzyna-EU07/feat/doors-animation-per-door
feat: own kind of animation for a door wing in the .mmd (#70, point 1)
2026-11-18 01:19:30 +01:00
maj00r
dd919cc179 Merge pull request #398 from MaSzyna-EU07/feat/timetable-ai-flags
feat: timetable flags for the AI driver: central doors, doorstep, conductor, brake test (#95)
2026-11-18 01:19:16 +01:00
maj00r
0fdb4c78c8 Merge pull request #387 from MaSzyna-EU07/fix/brake-pipe-coupler-substep
fix(brakes): exchange the brake pipe air between vehicles after all of them stepped, in sub-steps
2026-11-18 01:19:01 +01:00
jerrrrycho
f90005e649 fix(physics): a legacy derailment makes no crash inside its own train
With physics.collisions new and the legacy derailment (the default
physics.derailment monitor), a vehicle derailed the old way manufactured
collisions with the vehicles coupled to it:

- Derail() cuts its speed by 35 % in one step; the coupled vehicles kept
  theirs and ran into it at a third of the speed of the train
  (moczniki_eu06_eu07, tomaszewo_raj49843). The vehicles coupled to it
  now get the same change of velocity.
- crush_hit() took it as an immovable wall and its motion ignored every
  force (decelerating at g, then stuck by resistances x1e20), so the
  train behind it stopped against it at once and crushed by the energy
  of the whole train (l053-sluzba-2-night: 0.3 m on both ends at 8 km/h).
  It is now a wall only to vehicles not coupled to it; it keeps the
  legacy deceleration of g as a friction of its weight, and the forces
  of its train act on it, so the train pushes it on and it holds the
  train back. Alone it stops as before.
- Vehicles of the pile-up found inside each other kept what their
  springs took in pressed past the stop as buffer energy, which let a
  later small closing velocity crush them; a pair parting at the start of
  the step and knocked back in during it was crushed with the springs
  added to its closing velocity (l053_calkowo-sluzba-tlk-1,
  linia61_osobowy3: crush at -7.1 km/h). The contact found inside each
  other takes in nothing until the buffers part, and a pair parting at
  the start of the step is left to the legacy collision.

The monitor test of a locomotive into a wagon at 60 km/h now counts one
hit: the second one was the locomotive resting on the legacy wall,
parting at the start of the step, at 0.3 km/h.
build-feat-derailment-overspeed-criteria
2026-11-17 17:36:15 +01:00
jerrrrycho
0bd805fb19 docs: scenario README, a Connect first order releases the hand brake now build-fix-ai-connect-releases-hand-brake 2026-11-17 13:01:32 +01:00
jerrrrycho
e41e6de29b Merge remote-tracking branch 'origin/staging' into feat/drivingaid-ed-braking
# Conflicts:
#	tests/unit/data/fiz/README.md
build-feat-drivingaid-ed-braking
2026-11-17 10:50:47 +01:00
jerrrrycho
4994349039 Merge remote-tracking branch 'origin/staging' into fix/ai-connect-releases-hand-brake
# Conflicts:
#	tests/scenarios/README.md
2026-11-17 10:50:43 +01:00
jerrrrycho
aa2200418a fix(doors): an animdoor entry without its } leaves the rest of the .mmd to be read
read_spec() took every token up to the end of the file into the block when the closing brace was
missing, so endmodels, sounds:, the lights and the rest were lost. The block now ends at the first
token that is neither a key nor the value right after one (or at endmodels), and that token is
put back for the caller.
build-feat-doors-animation-per-door
2026-11-17 10:06:41 +01:00
jerrrrycho
68c704e513 fix(config): a scenery switches a script runtime off as before, only switching it on is refused
keep() put python.enabled, luascreens.enabled, wasm.enabled and lua.fulllibraries back in either
direction, so a scenery with config python.enabled no endconfig, which the release honoured, was
overridden and got an error in the log. They are put back now only when the scenery turned them
on; switched off they stay so, silently.
build-fix-scenery-lua-sandbox
2026-11-17 10:00:49 +01:00
jerrrrycho
edc961486f fix(physics): the diesel-electric dynamic brake lets the vehicle come to rest without a fade
With EDBrakeV0 = EDBrakeV1 = 0 the whole force acted down to the stop and turned round each time
the speed crossed zero; in FTrain it never let the stop of ComputeMovement() catch it, so the
speed swung round zero. Near the stop the force is now no more than what stops the vehicle within
the step.
build-feat-diesel-electric-dynamic-brake
2026-11-17 09:52:07 +01:00
jerrrrycho
0645096e13 feat(physics): ship with physics.derailment monitor as the default
144 tracks in 12 of the bundled scenarios have a speed limit above the overturning speed of the
reference vehicles, so the criteria as the default would change how they play. Until those limits
are corrected in the pctga data, the default (and a name not known) is monitor: the legacy draw
decides, and the log tells where new would derail a vehicle. new stays opt-in.
2026-11-17 09:33:02 +01:00
jerrrrycho
ebe0a42be7 fix(camera): the trackside view sets the train's way again when the vehicle picked changes
pick() kept m_lastposition of the vehicle before, so the next motion_of() took the step between
the two vehicles for a move: the direction could point back along the train, the ends swapped and
the railfan went to a spot 80+ m behind the tail. Now a change of the vehicle sets m_moved to
false, and the way is set again from the way the user drives.
build-feat-camera-orbit-and-shunting-views
2026-11-17 09:17:19 +01:00
jerrrrycho
178f5b63fe fix(scripting): gsub with a metatable'd table, the trim idiom, the memory doc
- replacement_length() popped nothing after lua_getmetatable() pushed a metatable, so gsub got it
  as its 4th argument ("bad argument #4 to 'gsub'"); it is popped now.
- lua_pattern_cost(): a repetition followed by what always matches (as the first %s* of
  "^%s*(.-)%s*$") is tried once and doesn't multiply; a repetition of a character or a %class
  right before the final '$' counts the longest run of it in the subject, not the subject. The
  trim of a 10 KB line of words is allowed, a long run of spaces is still refused (it takes the
  square of the run). The doc names a trim that is linear on any string.
- the doc says every concatenation within one hook interval is made whole before the memory check.
2026-11-17 09:10:08 +01:00
jerrrrycho
66b8a67361 fix(timetable): read the table from its start, bound the station index both ways
read_timetable() went on from the StationCount it was given and checked only the upper bound, so
TimeTable[StationCount] and TimeTable[StationCount - 1] could index out of the table (Sonar cpp:S3519).
It now resets the count and the table first, and checks both bounds before the next station.
build-feat-timetable-ai-flags
2026-11-17 08:54:50 +01:00
maj00r
bad94c96b5 Merge pull request #391 from MaSzyna-EU07/feat/split-cruise-control-and-shunting
feat: the cruise control apart from the field shunting (#69)
2026-11-17 03:13:43 +01:00
maj00r
2a22e4df1e Merge pull request #388 from MaSzyna-EU07/fix/feed-pipe-coupler-substep
fix(brakes): exchange the main reservoir pipe air between vehicles after all of them stepped, in sub-steps
build-fix-brake-pipe-coupler-substep
2026-11-17 03:13:17 +01:00
maj00r
a7b28cc1b8 Merge pull request #401 from MaSzyna-EU07/feat/universal-smooth-drag
feat: drag universal cab controls to any position with the mouse, opt-in per .mmd entry (#62)
2026-11-17 03:10:08 +01:00
maj00r
e1380e9b99 Merge pull request #365 from MaSzyna-EU07/refactor/sonar-localtime-goto
refactor: reentrant localtime and no goto in the cross switch lookup (Sonar S1912, S1909)
2026-11-17 03:06:03 +01:00
maj00r
2ba7bddfa3 Merge pull request #379 from MaSzyna-EU07/feat/collision-crush-override
feat(physics): collisions crush the vehicle ends, override and push vehicles off the track
2026-11-17 03:05:56 +01:00
maj00r
332abc74df Merge pull request #337 from MaSzyna-EU07/test/scenario-cases-ge-reports
Scenario cases for the mission reports eu07/maszyna#421, #506, #524, #525
2026-11-17 03:05:35 +01:00
maj00r
bb6d0520f6 Merge pull request #378 from MaSzyna-EU07/feat/track-buckling
feat(track): welded track buckles in the heat, drawn, followed by the axles and fed to the derailment criteria
2026-11-17 03:05:22 +01:00
jerrrrycho
795883335d feat: orbit, shunting, coupling and trackside views of the train (eu07/maszyna#551)
[Shift]+[F4] goes on after the four views it had (front of the train, its rear,
a bogie, drive-by) to four views that go with one vehicle of the train:

- orbit: around the middle of the vehicle. Left/right arrows (and the mouse)
  turn the camera around it, up/down arrows bring it closer and further
  (from outside the body to 250 m), PgUp/PgDn (and the mouse) raise and
  lower it; it never goes below 0.5 m above the rails. It turns with the
  vehicle.
- shunting: straight down from above the vehicle, the way the user drives up
  the screen, going with it. Arrows move it along and across the train,
  PgUp/PgDn up and down (from above the roof to 300 m).
- coupling: low beside a coupler, looking at it. At an end of the train with
  another vehicle (not coupled) closer than 150 m, it starts at that end and
  steps back from the track as the gap grows, looking between the two
  couplers. Left/right arrows pick the side of the track, up/down the
  distance, PgUp/PgDn the height.
- trackside: a railfan beside the line ahead of the train, looking at the
  vehicle picked as the train comes and goes by. Once its tail is 40 m past
  (or the train is 1 km away) the railfan walks to a new spot ahead, 15 s of
  the train's run away (80-500 m, along the curve of the line), on the other
  side of the track.

[ and ] pick the vehicle the view goes with (the coupling, in the coupling
view), towards the front and the rear of the train; the view starts with the
vehicle the user drives. [ and ] are bound to nothing by default nor in the
shipped eu07_input-keyboard.ini; [Ctrl]+[ / ] stay the debug train moves.

The camera follows from pure functions in vehicle/cameraviews.cpp (eu07_core),
tested in tests/unit/test_camera_views.cpp; application/consistviews.cpp hands
them the vehicles of the train and keeps what the user set. The four older
views and their order don't change. "consistviews no" in eu07.ini keeps the
cycle of [Shift]+[F4] to the four older views. The black box writes the new
views as 4-7 (blackbox_doc.md).
2026-11-17 02:30:55 +01:00
jerrrrycho
81bae7cdd4 feat: drag universal cab controls to any position with the mouse (#62)
A universal control (window, door, sun blind) whose definition in the .mmd
has the new optional key drag: can be dragged with the left mouse button to
any position between its ends, and stays where it is let go:

  universal1: { okno_p mov -0.71 0 0.3 drag: left soundinc: ... }

The value is the direction the mouse moves to open the control: up, down,
left or right (yes = up, no = off). The drag works like the sliders of the
controllers: the cursor is hidden, its move over 0.6 of the window height
takes the control from one end to the other. A click without dragging
toggles the control as before, and so do the keys: to the end farther from
where it is. Push controls aren't dragged. Without the key every universal
works as it did; none of the cab definitions has it yet.

New commands genericset0..29 set universal N to the position in param1
(0-1); the mouse sends them, and they can be bound to a gamepad axis.
The rules (the key's values, the move of the cursor along the direction,
the ends, click or drag, the keys) are in vehicle/universaldrag.h, with
unit tests.
build-feat-universal-smooth-drag
2026-11-17 01:42:49 +01:00
jerrrrycho
a3df3a07c8 test: count the shunting seconds in a function of its own, not a lambda holding the vehicle build-feat-split-cruise-control-and-shunting 2026-11-17 00:48:28 +01:00
jerrrrycho
aa84e41f09 feat: timetable service flags for the AI driver (eu07/maszyna#95)
A timetable can now tell the AI how the train is served, for trams,
underground trains and the like. The whole train gets them from a new
row of the first box of the header:

  [ Flagi AI | drzwi_centralne=tak,stopien=nie,kierownik=nie,proba_hamulca=nie ]

and a station changes them from there on with entries of its station
ware (the second line of the station, next to R2, ph, @):

  [       |     | po,kierownik=nie                 1  12.54  |        ]

- drzwi_centralne=tak: the driver opens all the doors from the cab,
  those of mixed control too (otherwise left to the passengers)
- stopien=tak/nie: the doorsteps switched on/off before the doors open
  (the AI didn't touch them before; new driver hints for it)
- kierownik=nie: no conductor, so no departure signal (direct or by
  radio) and no first door kept open for him before the departure
- proba_hamulca=nie: no running brake test

A flag left out keeps today's behaviour, so a timetable without flags
drives as before. Old builds skip the header row and keep the station
entries as station ware text (none starts with R or holds @, po, pt).

The reader moves out of TTrainParameters::LoadTTfile into
world/timetablereader.cpp (eu07_core) unchanged, so the tests can run it;
the flags come out of the station ware there. It now ends at the end of
the file with an error where the old one spun forever (a truncated file,
a missing number), and stops at 100 stations instead of writing past
the table.

Every .txt of the game's sceneries and of the SVN data reads the same
as with the old reader (compared field by field against a verbatim copy
of it); EU07_UNIT_TESTS_TIMETABLES=<scenery folder> reads them in the
unit tests and EU07_UNIT_TESTS_TIMETABLES_DUMP writes what was read.
2026-11-17 00:17:22 +01:00
jerrrrycho
8d2d9badb5 feat: own kind of animation for a door wing in the .mmd (eu07/maszyna#70)
A vehicle can now have door wings of different kinds on one side, e.g.
111Ainw (Bdhinu) with folding doors at one end and wider ones at the other.
A new optional entry in the models section of the .mmd:

  animdoor: <wing number> { type: <Shift|Rotate|Fold|Plug> range: <m or deg> rangeout: <m> }

gives one wing (door1, door2... of animdoorprefix) its own kind of
animation and range; the keys left out keep the values of the .fiz. The
wing still follows the door of its side: it is as far along its own range
as the door is along DoorMaxShift. The entry may come before or after
animdoorprefix; a faulty one is logged and the wing keeps the .fiz kind.

Wings without an entry get the same update functions as before, so the
existing vehicles, .mmd and .fiz files are unchanged. The door state, the
physics, AI, cab controls, sounds and exports are not touched.

The parsing and the wing position live in vehicle/doorwings.h, tested in
test_door_wings.cpp.
2026-11-16 23:36:26 +01:00
jerrrrycho
88383c0903 feat: dynamic brake of the diesel-electric vehicles (#82)
The drive of a diesel-electric vehicle is computed from the power of its
generator, not from a circuit, so neither the EP09's resistor brake
(Current()) nor the inverter model of the induction motors has anything to
work on, and a negative setting of the integrated controller did nothing:
the BR285's TRAXX controller has its braking range (EB+, EB, EB-) and brakes
nothing.

A vehicle opts in with keys of its Engine section, read only for the
diesel-electric ones; without EDBrake nothing changes:

- EDBrake=Controller: the negative range of the integrated controller
  (EIMCtrlType > 0) sets the effort, which goes to the vehicles in multiple
  with the EIMIC command; EDBrake=Lever: a lever of its own, the one of
  SplitEDPneumaticBrake (DBPN steps, the dynamicbrakecontroller commands),
  working with the master controller at zero.
- EDBrakeFmax [kN], EDBrakePmax [kW]: the force at the wheels, limited by
  the power of the resistors at speed; EDBrakeV0, EDBrakeV1 [km/h]: no force
  below V0, the whole above V1. An inverter's brake fades only at the stop,
  a resistor brake of direct current motors grows with the speed from 0.
- EDBrakeRate [1/s]: how fast the effort follows (0.5).
- EDBrakeBlending=Yes: the locomotive's train brake lets off by the share of
  the force (Hamulec->SetED, LSt and EStED valves).

The brake works while the engine runs, with the direction set, the
overload relay closed, the wheels rolling and no power asked for. Its force
takes the place of the drive's in TractionForce(), the ammeter shows the
motors' current, DynamicBrakeFlag lights the dynamic brake lamp.

The traces of all 615 test cases recorded before the change compare bit for
bit after it (EU07_UNIT_TESTS_GOLDEN_EXACT=1).
2026-11-16 22:45:06 +01:00
jerrrrycho
611dc365eb test: Sonar on the cruise control test: no empty statements, the lambda's captures named 2026-11-16 22:37:04 +01:00
jerrrrycho
dda38b6c0d feat: the cruise control apart from the field shunting (eu07/maszyna#69)
The secondary controller (ScndCtrl) is the switch of the cruise control
(SpeedCtrl) on the vehicles which have one: its first position switches
it on (IncScndCtrl), zero off (DecScndCtrl), and the speed buttons and
steps work only off its zero position. On the 6Dg, the ST45 and the
BR285, diesel-electrics with SpeedCtrl=Yes, the same controller shunts
the field of the traction motors by itself (AutoRelay), refuses the
driver's moves, and nothing could switch the cruise control on.

Now the cruise control has a switch of its own wherever the secondary
controller shunts the field (ElectricSeriesMotor, DieselElectric) or
there's none:

- IsSpeedCtrlSeparate(): which vehicles; IsSpeedCtrlEngaged(): on or
  off, SpeedCtrlUnit.IsActive for those, ScndCtrlPos > 0 for the rest;
- SpeedCtrlSwitch(): the driver's switch, on at the speed of the moment
  or off; on the others IncScndCtrl(1) / DecScndCtrl(2), as before;
- the buttons, the steps and the power limit go by IsSpeedCtrlEngaged(),
  the automatic turning off (SpeedCtrlATOF) by SpeedCtrlSwitch(false);
- the cab's tempomat_sw / tempomatoff_sw toggle it, and follow its state
  rather than the secondary controller's; the AI's SpeedCntrl() uses it.

The .fiz and .mmd formats are unchanged, with no new keys: the
SpeedControl section and the cab's scndctrl and tempomat_sw entries
stay as they are and now work side by side. Nothing changes for the
vehicles with only one of the two: the whole unit test suite matches
golden traces recorded before the change bit for bit.

Tests (test_speed_control.cpp): the field shunting of the EU07, SM42 and
SU45 and the cruise control of the Impuls and EU47 as before, the 6Dg's
and ST45's shunting as before, the 6Dg's and ST45's cruise control on
its own switch holding and changing the speed with the shunting going
on by itself, the 214M railbus switched by the secondary controller
through SpeedCtrlSwitch(). The 6Dg's definition joins
tests/unit/data/fiz as on test/6dg-power-steps-real-data.
2026-11-16 21:38:18 +01:00
jerrrrycho
c8f52c8b03 test: Sonar on the main reservoir pipe test: an integer step counter, const references, one declaration a line build-fix-feed-pipe-coupler-substep 2026-11-16 20:22:53 +01:00
jerrrrycho
8a185ee980 fix: exchange the main reservoir pipe air between vehicles after all of them stepped, in sub-steps
The main reservoir hoses (ctrain_scndpneumatic) exchanged the air explicitly inside each vehicle's step at the
physics step of 0.01 s, as the brake hoses did before eu07/maszyna#387. One step through the hose (0.38 of
area, whatever the vehicles) moves about 1.5 times the air which evens out the pipes on its ends (EN57 cars
8.3 l per bar against 5.5 l, SM40 8.6 against 5.7, passenger cars 9.3 against 6.3), and the vehicles with a
main reservoir of their own feed the pipe from it in the same step. Where a vehicle has both, and hoses on both
ends, the pipe can't settle: with all the main reservoirs held at 7.0 bar, the middle cars of a three unit EN57
kept jumping 0.8 bar to and fro between the steps for good (6.6/7.4), three SM40s in multiple traction the
same, a two unit Impuls 1.7 bar. Freely evening out, the reservoirs of a three unit EN57 took 13.9 s at 0.01 s
against 7.6 s at 0.001 s. A locomotive with passenger cars, whose pipe only it feeds, was stable already.

The main reservoir pipe now goes through the brake pipe's mechanism: UpdateScndPipePressure() leaves the hose
exchange to UpdatePipeCouplers() (GetScndDVc(), ScndPipeCouplersSubsteps(), 2 sub-steps for these vehicles),
which vehicle_table::update_brake_pipes() calls after every vehicle stepped. The two pipes share the code and
take their sub-steps apart, so the brake pipe's exchange is as it was. With it the EN57 pipes stand at 7.000,
and its reservoirs even out in 7.0 s against 7.5 s at 0.001 s.
2026-11-16 18:03:03 +01:00