18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-04 23:45:17 +01:00

feat(physics): flank collisions at switches, short of the fouling point

Two vehicles on the rails beside each other at a switch, up to its
fouling point, now meet by their bodies (physics.collisions new, the
default; physics.collisions.flank no turns it off). Before, they passed
through each other there, or, on the switch itself, the vehicle on the
other way was taken for the one ahead and gave a phantom end-on hit.

The neighbour search follows the ways of a switch: the way of the
searcher's own axle, on the next switch the way joined to the track it
comes from. A vehicle on the other way is skipped unless the two are in
line end to end, their facing ends less than 2.2 m apart across so that
a pair of buffers meets (flank::EndsMeet()).

The flank contacts: the fouling zones of all rail switches are made
once (the tracks along each way up to the fouling point, 3.50 m between
the axes as found by fouling::find(), and 30 m past it); only a moving
vehicle with an axle in a zone is checked against the vehicles on the
other way of that switch. The footprints collide as for the vehicles
off the track; the side of a body crushes at 250 kN, past 0.5 m and at
an end at 2 MN, never more than stops the closing within the step. The
force slows both along their rails and loads their wheels across: a
vehicle with its end in the contact climbs at Nadal's limit held over
the 2 m window of EN 14363, a body hit along its side only at three
times the limit at once. It leaves the rails with the new derailment
cause flank_collision (14). Pairs in line end to end stay with the
collision of the ends.

Tests: tests/unit/test_flank_contact.cpp (the neighbours on a 1:9
switch, the crush forces, Skierniewice 2023, a graze at 5 km/h, steps
of 0.01 to 0.05 s); scenario cases eu07_td_switch_flank_foul,
_foul_buffers and _clear on td.scn. The coach of eu07_td_crew_refused
stood 0.6 m into the way of track 1 and is moved clear of the fouling
point.
This commit is contained in:
jerrrrycho
2026-12-02 11:03:00 +01:00
parent 304ce934cc
commit da69df97b8
23 changed files with 1366 additions and 9 deletions
+27
View File
@@ -928,6 +928,33 @@ bool physics::Vehicle::leaves_track() const
false == OffTrack.active();
}
void physics::Vehicle::DerailFlank(int const Side, double const Acceleration, std::string const &Why)
{
if (false == DamageFlag.Set(VehicleDamage::derailed))
{
return;
}
// upright, the flange climbed the rail the push across took it over; physics.derailment new: off the track to that side
derailOutcome = derailment::outcome::off_rails;
derailCause = derail_motion::cause::pulled_off;
derailAcceleration = Acceleration;
derailSide = Side;
noteDerailment(derailment::reason::flank_collision);
eventFlag = true;
MainSwitch(false, range_t::local);
if (Vel < 5.0)
{
// HACK: prevent permanent axle spin in static vehicle after a collision
nrotValue = 0.0;
slippingWheels = false;
}
// the brake hoses tear: the brake pipe vents and the rest of the train brakes in emergency
tear_brake_hoses(*this);
derailment_monitor.reset();
pushed_off_monitor.reset();
ErrorLog(std::format("Bad driving: {} derailed in a flank collision, {}", Name, Why));
}
void physics::Vehicle::pull_off(int const Side, double const Acceleration, std::string const &Why)
{
if (Global.derailment != global_settings::derailment_model::physical || false == DamageFlag.Set(VehicleDamage::derailed))