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

7 Commits

Author SHA1 Message Date
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
0e41d27032 fix(physics): a repaired vehicle is back on the rails, the state of the criteria of derailment cleared
resetconsist (Stop and repair consist of the debug panel and of the vehicle window) cleared the damage flags, but kept
Derailed, the stretches of the criteria, the distance gathered for them and the report of the monitor. A vehicle once
derailed by the criteria and repaired then slid on with their friction after a derailment of the legacy kind, instead
of stopping dead, and the friction of the ballast kept holding it whenever it stood.

TMoverParameters::rerail() puts a vehicle back on the rails: dtrain_out off, Derailed none, the criteria from scratch,
the monitor free to report the track again, a rail vehicle back on the axis of the track. repair_damage() does what
resetconsist did to the damage (the flags, the engine damage, the wheel flats, the alarm chain) and rerails it;
resetconsist and the road vehicles coming back from the pool of a road point use it. SetDamage taking dtrain_out off
rerails the vehicle as well. A vehicle put on a track anew (consistteleport) starts the stretches of the criteria
over, they were gathered on the track it left.
2026-11-16 07:44:31 +01:00
jerrrrycho
0074197c1d feat(physics): physics.trackcheck logs the tracks of a scenery the criteria of derailment find suspicious
With physics.trackcheck yes (no by default) every rail track is checked once the scenery loaded, and the suspicious
ones are logged, a line for each (trackcheck:), with a summary of the count of each kind: a speed limit over the speed
a reference vehicle overturns or climbs the rail at in the curve (an EU07 and a 4-axle coach from the defaults of
derailment.h, no .fiz needed; a track without a limit of its own gets 125 km/h and is counted apart), cant held on a
straight track, cant over 160 mm, a curve under 40 m with a limit over 40 km/h, and unevenness out of the plausible
range. The damage flags are only counted by their value: the sceneries set them for the jolts. The radius is the
tightest of the design geometry of the path, so curves given by their control points only count as well.

The check is a plain function of the data of the tracks with a log sink (world/TrackCheck.h, in eu07_core), tested on
its own; derailment::climbing_speed() gives the speed the flange climbs at, none where it doesn't.
2026-11-15 20:11:11 +01:00
jerrrrycho
c83c987e3f feat(physics): physics.derailment monitor tells what the criteria would do, the legacy draw decides
With monitor the run goes as with old: the legacy draw derails a vehicle too fast in a curve, with the legacy effects.
The criteria of derailment.h are evaluated as with new, and where they would derail a vehicle the log gets one line
(derailment monitor:) with the data of the entry of a real derailment: the vehicle, the track, the speed, the radius,
the cant, the lateral acceleration, D, Y/Q, the mass, the centre of gravity, the forces of the couplings, the damage
flags and the cross level. Once for a vehicle on a track, so one run of a scenery shows what new would do without
changing its course.

The entry of a derailment by the criteria names the track as well; derailment::report() writes both. The names of the
models in eu07.ini go through derailment_model_of() and name_of(), read and written back alike.
2026-11-15 20:11:10 +01:00
jerrrrycho
6111773f53 test(physics): count the steps of the derailment tests in integers, read the distances checked
SonarCloud: a float loop counter (S2193) and the optional read after REQUIRE taken for a garbage value (S836).
2026-11-15 18:57:04 +01:00
jerrrrycho
f1dd033f24 feat(physics): the damage flags of a track make the ride rougher, a derailed vehicle once stopped stays put
Found running line 107 with every train driven by the AI:

- a 401Ka wagon of a freight train overturned into a 282 m curve with a
  cant of 179 mm at 28 km/h: line 107 has damage 31 on every track, which
  scaled the whole lateral acceleration by 2.1, the cant too. The sceneries
  set the flags for the jolts of a worn track (thousands of tracks with 2,
  31, 4 or 16), so they now scale only the sway of the body and the short
  waves of the uneven track, and no longer take load off the wheels; the
  cross level of the uneven track still does
- the overturned wagon crept and stopped in turn in every step (the friction
  of the ballast against the pull of its train), which kept the physics of
  the whole train awake: the run went at half the speed after it. The
  friction now holds a stopped derailed vehicle until the forces on it are
  larger
- a vehicle without a mass got Y/Q 1e9 (no wheel load), now none
- the log of a derailment tells the mass, the centre of gravity, the forces
  of the couplings, the damage flags and the cross level as well
2026-11-15 11:40:56 +01:00
jerrrrycho
a257d5d803 feat(physics): a vehicle too fast in a curve overturns or climbs the rail by the criteria, and slides on
physics.derailment in eu07.ini: new (the default) checks the criteria of
McZapkie/derailment.h in every full step over the distance travelled since the
last one, so the decision doesn't depend on the frame rate; old keeps the
per-step draw of the lateral acceleration against the gauge to the height of
the vehicle; off, no derailment from the speed.

- the cant of the track (dHrail) is taken off the lateral acceleration, the
  centre of gravity comes from the new optional CoGH key of the Dimensions of
  the .fiz (from the height of the body otherwise), raised by the load
- the forces of the couplings at both ends push the vehicle out of the curve,
  or pull it into it
- the uneven track under the outer axles (its lateral curvature and cross
  level, new fields of TTrackShape set by TDynamicObject) and the damage flags
  of the track add to it
- off the rails by the criteria the vehicle opens its main switch, keeps its
  speed and slides with the friction of the ballast (0.3 upright, 0.5 on its
  side) instead of stopping dead; its torn brake hoses vent the brake pipe, the
  train brakes in emergency. TMoverParameters::Derailed tells overturned from
  derailed upright, the log says which with the numbers. Other derailments
  keep the legacy effects
2026-11-15 10:28:24 +01:00