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

9 Commits

Author SHA1 Message Date
jerrrrycho 7578f2c3a0 feat(physics): buffer stops at the free ends of the tracks
A free end of a rail track marked bufferstop1 / bufferstop2 <kind> in the
scenery is a buffer stop (physics/bufferstop.h): rigid, buffered, hydraulic
or friction. With physics.collisions new a vehicle running into it meets the
stages of the stop in series: the buffers of both, the absorber or the brake
elements of a sliding stop, then the frame, whose hit goes through
collision::hit() and whose ride-up goes through collision::override_of(),
the stop an immovable body. It is held, the frame deforms, it rides up
(Enfield 2021), demolishes the stop (Kirkby 2021) or overruns a sliding one.
The log tells each hit once, and the memory cells __simulation.bufferstop
and <track>:bufferstop and their events tell the scenery.

physics.bufferstops marked (the default) takes the marked ends only, auto
also the ends with a model of a stop within 3 m, off none. Every other free
end keeps the derailment off the end of the track, and so does every end
with physics.collisions old; monitor logs what the stop would have done.
2026-12-02 12:33:36 +01:00
jerrrrycho 1c170ecc31 fix(physics): a pair crushed already isn't one put down inside each other
In the game the distance to the neighbour lags the movement by the steps
of a frame. At 100 km/h and more a pair that crushed in one step looked
pressed past its stop by more than a step takes in the next one, was
taken for one put down inside each other by the scenery and stopped
crushing: on td.scn the EP09 of Szczekociny stopped at 0.37 m, and with
the energy left the coaches behind it climbed one another. Only a pair
whose ends never crushed can be one the scenery put down.
2026-12-02 10:14:10 +01:00
jerrrrycho 39f6566a5a feat(physics): calibrate the crush and the override against Szczekociny 2012
The head-on collision of Szczekociny re-created on td.scn derailed all 13
vehicles, tore all 11 couplings and crushed the locomotives by 0.37 m each.
In reality 7 of 13 derailed, the cabs and the machine room were destroyed
over several metres, and TLK coaches 3 to 7 and IR coaches 2 to 4 stayed
coupled on the rails.

- An end without a crash zone crushes for up to 4 m. The force packing down
  grows to at most twice the plateau (6 MN locomotive, 4 MN wagon or coach)
  and the crush goes on at it. Crash zones keep their 1.2 m. New optional
  key BuffCoupl FcrushMax (kN).
- The override no longer derails both alike vehicles at 0.6 m of crush of
  both ends. Past the buffer beams (0.35 m) the lighter one climbs (1.3
  times), or the higher one (40 mm, EN 15227). Without either, both leave
  the rails only once one end is crushed past its structure (its densify).
  A vehicle off the rails sits 0.15 m lower, unless it got off them
  climbing. An anticlimber works for its own end until its zone is spent.
- An end crushed back to its running gear (the outer axle) tears the body
  off its bogie and derails the vehicle.
- physics.derailment new: a vehicle that climbed is carried along the line
  while the pair still closes in faster than 0.5 m/s, so the ends crush on
  instead of meeting as rigid bodies off the track. A body off the track
  is shorter by the crush of its ends.

The couplings tore in every crushed interface because every interface
crushed (draw_gear_crush 0.15 m), not through a fault of their own. With
the cascade stopped the couplings behind the wreck hold.
2026-12-02 09:46:43 +01:00
jerrrrycho 8ffb74a3b0 test, docs: the buckle case folds less with the coupling pulling hook to hook (GH#579)
eu07_td_off_track_buckle_fast checked that the overturned train comes to
rest folded by 8 deg at least. With the pull of the couplings no longer
across between the buffer faces, they hold the bodies more in line: with
the fixed seed the bends are 1 to 4 deg (3 to 8 before), with the seeds
1 to 6 the largest bend is 7 to 73 deg (21 to 78 before); the same with a
local build of staging and with the CI one. The check takes 3 deg, the
description gives the numbers.

behaviour-changes.md: the coupling off the track pulls hook to hook.
2026-12-01 19:51:07 +01:00
Hirek 1ae8fdc62a Merge pull request #560 from MaSzyna-EU07/fix/derailment-ground-556
fix(derailment): no fall through the ground off the track, and more friction on it (#556)
2026-12-01 10:07:17 +00:00
jerrrrycho 23f30109db docs: the number of the pull request in the behaviour changes 2026-11-30 03:03:27 +01:00
jerrrrycho 597d72fdf9 test, docs: the derailment cases and the behaviour changes with the new friction on the ground (GH#556) 2026-11-30 03:02:47 +01:00
jerrrrycho d6dba363e3 feat(derailment): a derailment is told to the scenery, the black box and the test mode
Every way a vehicle leaves the rails records what derailed it and its speed in the mover
(DerailedBy, DerailVelocity), by any physics.derailment model and the collisions. After all
vehicles moved, TDynamicObject::new_derailment() notices each derailment once, and
state_manager::report_derailment() tells:

- the log: "derailment: <vehicle> derailed (<cause>) on track <track> at <speed> km/h";
- a scenery that asked for it: its memory cell __simulation.derailment gets
  "<vehicle> <cause> <track>", the speed and the code of the cause, then its events
  __simulation.derailment and <vehicle>:derailed run with the vehicle as activator. Nothing
  is made at the start, so a scenery without them runs as before (no draw of the random
  numbers for a new node);
- the black box: a derailment record with the new phase 2, for any model, and every
  derailment record gets the finer cause and the track at its end;
- the test mode: test.fail_on_derailment yes (default no) ends the run of a tested train
  that derailed with the new result derailment, exit code 15; otherwise the verdict line
  ends with " [derailed: ...]".

run.py knows exit code 15 and shows the derailment of the train under test in the summary.
New cases eu07_td_buckle_derails_ends_test and eu07_td_off_track_end_scenery_told; the other
83 end as before and their physics logs are byte-identical to staging.
2026-11-29 05:29:37 +01:00
jerrrrycho b0339badb2 docs: behaviour changes accepted in review (#438)
* docs: behaviour changes accepted in review, for release notes and triage

* docs: the physics log entries after the revert of #408

#443 reverted #408 on staging and brought master's #385. physicslog yes
logs road vehicles again, the closing waits for every log, and the
2 s thread, the illegal characters, physicslog.trains and blackbox come
from #385. The test.* keys show in the settings dump of log.txt, not in
an editor save.
2026-11-26 22:26:29 +01:00