17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 20:29:04 +01:00

feat(editor): a warning of the sudden change of the cant deficiency right behind a switch, as ST-T1-A6 sees it (9.11): a track laid on from the end of the diverging track of a switch, or into it, is checked by switch_curve::check_exit from the end of the curve of the switch, a straight frog's length before its end, to the first sudden change of the curvature of the track laid. Two of them nearer than the intermediate element of table 9.16 (6 m in track connections up to 60 km/h) are taken together, else each one alone, against table 9.15 (130 mm up to 60 km/h), at the speed of the laying or of the diverging track of the switch, the lower one. The view tells of it by the cursor while the track is extended or laid, the status once it's laid; a transition out of the frog straight makes no sudden change. Selftest: from a Rz S42-190-1:7,5 with a frog straight of 1.66 m a curve the other way of R 200 m warned of 194 mm together, the same way none; from a Rz 60E1-190-1:9 with 6.09 m a curve the other way of R 200 m none, of R 120 m warned of 157 mm

This commit is contained in:
maj00r
2026-10-29 22:16:19 +01:00
parent b0918628b4
commit 2eda26b94c
7 changed files with 180 additions and 0 deletions

View File

@@ -254,6 +254,68 @@ slip_report check_slip(std::vector<std::vector<track_point>> const &Tracks, std:
return report;
}
exit_report check_exit(double const Curvature, double const Straight, std::vector<std::array<double, 3>> const &Line, double const Speed, double const Gauge)
{
exit_report report;
// table 9.15 and table 9.16, track connections
report.allowed = Speed <= 60.0 ? 130.0 : Speed <= 100.0 ? 100.0 : Speed <= 160.0 ? 80.0 : 60.0;
report.element = Speed <= 60.0 ? 6.0 : Speed <= 100.0 ? 0.15 * Speed : 0.25 * Speed;
// mm of the cant deficiency the change of the curvature makes at once: 11.8 V^2 / R at the standard gauge
auto const sudden = [&](double const Before, double const After) { return Gauge * Speed * Speed / (9.81 * 3.6 * 3.6) * std::abs(After - Before); };
// 1/m, a change of the curvature as large at once is a sudden one
constexpr double kSudden{1e-4};
struct change
{
double along; // from the end of the switch
double before;
double after;
};
std::vector<change> changes;
auto curvature{Curvature};
if (Straight > 0.0 && std::abs(Curvature) > kSudden)
{
changes.push_back({-Straight, Curvature, 0.0});
curvature = 0.0;
}
double along{0.0};
for (auto const &[length, start, end] : Line)
{
if (std::abs(start - curvature) > kSudden)
changes.push_back({along, curvature, start});
curvature = end;
along += length;
}
// the curve of the switch going on into the line: nothing of the switch to judge
if (changes.empty() || changes.front().along > 1e-6)
return report;
auto const &first{changes.front()};
auto const alone = [&](change const &Change) {
auto const value{sudden(Change.before, Change.after)};
report.change = std::max(report.change, value);
if (value > report.allowed)
report.warnings.emplace_back(format(STR_C("Behind the switch the curvature changes at once by a sudden change of the cant deficiency of %.0f mm, over the %.0f mm allowed at %.0f km/h (table 9.15)"), value, report.allowed, Speed));
};
if (changes.size() > 1)
{
auto const &next{changes[1]};
report.apart = next.along - first.along;
if (report.apart < report.element)
{
// taken together, from before the first one to after the next one (9.11 pkt 8b, 9)
report.change = sudden(first.before, next.after);
if (report.change > report.allowed)
report.warnings.emplace_back(format(STR_C("The curve behind the switch begins %.1f m after the end of its curve, closer than the %.1f m which take the sudden changes of the cant deficiency apart: together %.0f mm, over the %.0f mm allowed at %.0f km/h (tables 9.15, 9.16)"),
report.apart, report.element, report.change, report.allowed, Speed));
return report;
}
alone(next);
}
// the end of the curve of the switch at its end, not within it over a straight frog: that one is the switch's own
if (first.along > -1e-6)
alone(first);
return report;
}
double snapped_start(std::vector<double> const &Ramps, double const Pressed, double const Length, int const Direction, double const Reach, std::string *What)
{
auto const d{Direction < 0 ? -1.0 : 1.0};

View File

@@ -9,6 +9,7 @@ http://mozilla.org/MPL/2.0/.
#pragma once
#include <array>
#include <string>
#include <vector>
@@ -76,6 +77,21 @@ struct slip_report
// From and To the stations of the ends of the first track through the slip along it
slip_report check_slip(std::vector<std::vector<track_point>> const &Tracks, std::vector<std::vector<track_point>> const &Curves, std::vector<track_point> const &Line, double const From, double const To);
// a line laid on from the end of the diverging track of a switch, as ST-T1-A6 sees the sudden changes of the cant deficiency right behind
// the switch (9.11): Curvature the switch ends with (1/m, positive to the left as the line runs on), Straight metres before its end
// over a straight frog, then the pieces of the line, each its length and its curvature at its start and at its end. The first two
// sudden changes nearer than the intermediate element of table 9.16 taken together, else each one alone, against table 9.15 for track
// connections at the Speed (km/h); Gauge between the axes of the rails, mm
struct exit_report
{
double apart{-1.0}; // m, from the end of the curve of the switch to the next sudden change, -1 none
double change{0.0}; // mm, the largest sudden change of the cant deficiency judged
double allowed{0.0}; // mm, table 9.15
double element{0.0}; // m, the intermediate element of table 9.16
std::vector<std::string> warnings;
};
exit_report check_exit(double const Curvature, double const Straight, std::vector<std::array<double, 3>> const &Line, double const Speed, double const Gauge = 1500.0);
// the start of a switch Length long, going Direction along the line, drawn to where its start or its end meets an end of a cant ramp,
// or to where it keeps the 6 m off it, when the station pressed is within Reach of that; What receives which of them, empty for none
double snapped_start(std::vector<double> const &Ramps, double const Pressed, double const Length, int const Direction, double const Reach, std::string *What = nullptr);