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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
- 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.
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.
[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).
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.
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.
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.
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).
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.
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.
The air the brake hoses carry between the vehicles was taken explicitly inside each vehicle's step, at the
physics step of 0.01 s. Through the hose between two 14 m freight wagons (Spg 0.792, 11.5 l of pipe) one
step moved 11.8 l per bar, 2.06 times the 5.7 l that evens out the two pipes: the pipes overshot each other
in turns and settled into a pattern in which every distributor saw the pipe up to 0.28 bar off the pressure
left in it after the step. ESt3 valves charged at 5.0 bar saw 4.79 and lapped at the first stage, and the AI
of a standing freight train never got its brakes released (the report of eu07/maszyna#368).
The exchange now comes after every vehicle has stepped (vehicle_table::update_brake_pipes(), once per
physics iteration), for the vehicles which stepped their pipe, in as many sub-steps as keep the air a hose
carries in one below what evens out the pipes on its ends (3 for 14 m freight wagons, 2 for passenger
cars), each going through the vehicles in the order they step. The distributors see the pressure the pipe
holds, and an application reaches the end of the train as with a step of 0.001 s.
- no newproxy: LuaJIT runs a __gc without the hook, at any allocation and
in lua_close, so a looping finalizer hung the worker. a table's __gc
isn't run, ffi isn't opened: the screens have no finalizer of their own
- render and init of the script's table are read inside the protected,
counted call, as is the state table of a refresh: an __index that fails
or loops switches the screen off instead of ending the program, and one
that gives render works
- string.find, match, gmatch and gsub are refused when the steps they may
take at worst (script_screens::lua_pattern_cost) are over 1e8, about a
tenth of a second of LuaJIT's backtracking
- a screen holds at most 128 MB, its heap and the pixels of its images,
fonts and sprites: the hook checks it with a full collection, the api
reserves pixels before making them, and string.format, table.concat and
string.gsub refuse a result over it from the lengths of their arguments.
where LuaJIT takes an allocator of the game's (2.1 GC64) the heap gets
one that refuses past twice the limit, which also stops a single large
concatenation; LuaJIT 2.0 on x64 takes none
- xpcall is made in Lua on top of pcall, so a coroutine yields across it
- the limits go into limit_libraries(), apart from opening the libraries
- the scenery API (eu07.events) hands out a full userdata of its own locked
metatable for each kind of object (event, track, isolated, vehicle,
memcell), checked with luaL_checkudata: a handle of another kind, a light
userdata or any other value is a Lua error, not an object taken for
another. nil stays "no object". one object has one handle while the
script holds it, so handles compare and key tables as before. event
handlers get their handles built inside lua_cpcall, and nil for no
activator
- memcell_values keeps its text as a std::string: the text of a number was
read from a stack slot popped before use
- newproxy is gone from the sandboxed libraries
- a config block of a scenery no longer changes what only eu07.ini sets
(lua.fulllibraries, execonexit, extcam.cmd/rec, screenshotsdir,
network.server/client, zmq.address, motiontelemetry, uart, feedbackmode,
feedbackport, python/luascreens/wasm.enabled): kept before its keys are
read, put back before FinalizeConfig(), each attempt logged
- open_file_library() iterates luaL_Reg instead of a std::pair GCC 13
deduces as a pair of an array and a function