mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-01 05:42:44 +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:
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user