18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 15:26:53 +01:00

feat(editor): the norms checked on the tracks laid, read only: a Norms tab of the track analysis and its report

The second half of E1: what the tracks of a scenery are against a profile of the norms, listed. Nothing of the tracks is changed.

- editor/editorNormsReport: a line of paths sampled a metre apart, two samples at each joint, into what the norms read a line
  from: the plan, the curvature signed by the turn, the cant on the base of 1500 mm (as the simulator takes the rolls) signed by
  the side it leans to as the line runs, the grade, the speed of each path (a switch's for its diverging track alone too), and
  what the path is a part of (a switch, its diverging track, a curved switch, a movable frog, a crossing). The line described,
  checked, and each finding set back on its path with a point of it; its message, "cant ramp 3.00 mm/m, PLK allows at most 2.50 mm/m
  (tab. 9.12)", "break of the grade with no vertical curve, PLK asks for a radius of at least 2500 m (tab. 10.2)", through STR_C;
  the text of the report: the class, the elements, the cant, the grade line and the findings of each line.
- The Norms tab of the track window, under More beside Speed and Joints, no key; its window is ###trackanalysis, as theirs. The
  line through the selected path (run_route, as the speed check walks it) or the whole scenery: the lines through the plain tracks,
  then each path of a switch none of them ran along, checked with the line it lies in and its own findings kept, a place two lines
  run through listed once. The profile (PLK by default) and the class of the line folded under a line saying it: the line speed for
  the tracks with none of their own (on by default: the speed of each track), the slow trains (tab. 8.1 by default), the traffic,
  main track or siding, the load, at a platform. The results in the table of the speed check and the joints, the worst first,
  coloured by the tier, the values above the recommended ones on a tick; a click on a row shows the place, the hard limits and the
  warnings are marked in the view. The icon is drawn into its own cell of editor_icons.png only (the generator has it): the sheet
  drawn again with this Pillow differs in other cells.
- Self-test: normsreport <file> [scope] [plk|tsi|en|ch] [km/h] writes the report to the file; expect findings <tier> <least> <most>;
  the case e1_norms_report checks the curves k0..k3 of the fixture at 60 km/h against PLK and the whole scenery against the TSI.
- Golden: data/norms/line.scn, a line of 14 tracks written by make_line.py there (curves with and without transitions, cant on and
  off a curve and along a straight, reverse curves 10 m apart, short straights, a grade with breaks), and its report against the
  four profiles in data/norms/line_report.txt; EU07_UNIT_TESTS_UPDATE_GOLDEN=1 writes it anew. A test lays a canted corner with the
  alignment of the editor and finds the samples leaning into it, both turns and run both ways, I = Deq - D.

alignment::limits stays as the laying tools use it. Where its values differ from PLK P0:
- unbalanced 0.6 m/s2 is I 92 mm on the 1500 mm base; P0 110 mm (P1 130) on the running lines, 80 on the sidings;
- ramp_factor 10, a ramp of 1:(10 V), 1 mm/m at 100 km/h and 2.5 mm/m at 40 km/h, has no counterpart: P0 1.6 mm/m at any speed;
- jerk 0.3 m/s3 is dI/dt 46 mm/s; P0 55 mm/s;
- vertical_factor 0.4 V^2 and vertical_min 2000 m; P0 max(0.77 V^2, 5000 m) (P1 max(0.35 V^2, 5000), P2 max(0.25 V^2, 2000));
- arc_min 20 m and arc_min_factor 0.4 V; P0 max(0.35 V, 30 m) up to 120 km/h, 0.40 V up to 200 km/h, also for the straights, where
  tangent_min_time is 0;
- the same: cant_max 150 mm (P0 = P1 = P2 on ballast), cant_rate 35 mm/s (P0 of tab. 9.13), the base of 1500 mm.
This commit is contained in:
maj00r
2026-11-23 10:28:27 +01:00
parent db5a171ccd
commit 38f90387c4
21 changed files with 1424 additions and 12 deletions
+28 -4
View File
@@ -478,9 +478,9 @@ void editor_mode::restore_track_snapshot(EditorSnapshot const &Snapshot, std::ve
profile_restore();
}
std::array<editor_mode::track_mode, 15> const &editor_mode::track_modes()
std::array<editor_mode::track_mode, 16> const &editor_mode::track_modes()
{
static std::array<track_mode, 15> const modes{{
static std::array<track_mode, 16> const modes{{
{"Select", "Esc", track_tab::path, "LMB on a path selects it: its points, control vectors and parameters", editor_icons::icon::select, 0},
{"Lay track", "L", track_tab::lay, "Lays new track through the clicked points, on the ground or from a free end of a track", editor_icons::icon::lay_track, 0},
{"Plan", "G", track_tab::straights, "The plan of the line laid: LMB on a straight drags its ends or the middle, on a curve its vertex and radius. C works too", editor_icons::icon::curve, 0},
@@ -496,6 +496,7 @@ std::array<editor_mode::track_mode, 15> const &editor_mode::track_modes()
{"Profile", "P", track_tab::profile, "Vertical profile (grade line) along the line", editor_icons::icon::profile, 2},
{"Speed", "V", track_tab::speed, "Speed limits of the paths against the speed their geometry allows", editor_icons::icon::speed, 2},
{"Joints", "J", track_tab::joints, "Ends of the paths which almost meet, steps, kinks, jumps of the cant and of the grade at the joints", editor_icons::icon::joints, 2},
{"Norms", nullptr, track_tab::norms, "The geometry of the tracks against the norms of a profile (PLK, TSI, EN 13803, AB-EBV): what is beyond them, read only", editor_icons::icon::norms, 2},
// the infrastructure tool (track_tab::infra) is left out: no button nor key
}};
return modes;
@@ -641,6 +642,7 @@ std::string editor_mode::track_mode_name() const
case track_tab::profile: return STR_C("Vertical profile");
case track_tab::speed: return STR_C("Speed check");
case track_tab::joints: return STR_C("Joints");
case track_tab::norms: return STR_C("Norms");
case track_tab::lineside: return STR_C("Posts along the track");
case track_tab::infra: return STR_C("Infrastructure");
case track_tab::parallel: return STR_C("Parallel track");
@@ -654,6 +656,23 @@ std::string editor_mode::track_mode_name() const
}
}
namespace
{
// the title of the window a check of the track tab lists what it finds in
char const *track_analysis_title(editor_track_tab const Tab)
{
switch (Tab)
{
case editor_track_tab::speed: return STR_C("Speed check");
case editor_track_tab::joints: return STR_C("Joints");
case editor_track_tab::norms: return STR_C("Norms");
default: return STR_C("Infrastructure");
}
}
} // namespace
void editor_mode::render_track_inspector()
{
auto const &io{ImGui::GetIO()};
@@ -661,6 +680,7 @@ void editor_mode::render_track_inspector()
m_speed.set_open(m_track_window_open && m_track_tab == track_tab::speed);
m_infra.open = m_track_window_open && m_track_tab == track_tab::infra;
m_joints.set_open(m_track_window_open && m_track_tab == track_tab::joints);
m_norms.set_open(m_track_window_open && m_track_tab == track_tab::norms);
m_srk.set_open(m_track_window_open && srk_tab(), m_track_tab == track_tab::station_signals ? srk_tool::part::signals : m_track_tab == track_tab::line_block ? srk_tool::part::lines : srk_tool::part::station);
m_km.set_open(m_track_window_open && m_track_tab == track_tab::kilometrage);
if (false == m_track_window_open || m_track_tab != track_tab::lineside)
@@ -685,9 +705,9 @@ void editor_mode::render_track_inspector()
// the tools of the mode are drawn in the tool options window and the selected path in the inspector, see
// render_track_tool_options() and render_track_selection(); the checks list what they find in a window of their own
if (m_track_tab == track_tab::speed || m_track_tab == track_tab::joints || m_track_tab == track_tab::infra)
if (m_track_tab == track_tab::speed || m_track_tab == track_tab::joints || m_track_tab == track_tab::norms || m_track_tab == track_tab::infra)
{
auto const *title{m_track_tab == track_tab::speed ? STR_C("Speed check") : m_track_tab == track_tab::joints ? STR_C("Joints") : STR_C("Infrastructure")};
auto const *title{track_analysis_title(m_track_tab)};
ImGui::SetNextWindowSize(ImVec2(600.0f, std::min(320.0f, io.DisplaySize.y - 80.0f)), ImGuiCond_FirstUseEver);
if (ImGui::Begin((std::string{title} + "###trackanalysis").c_str(), nullptr, ImGuiWindowFlags_NoCollapse))
{
@@ -695,6 +715,7 @@ void editor_mode::render_track_inspector()
{
case track_tab::speed: m_speed.render_options(); break;
case track_tab::joints: m_joints.render_options(); break;
case track_tab::norms: m_norms.render_options(); break;
default: render_infra_body(); break;
}
}
@@ -741,6 +762,7 @@ void editor_mode::render_track_tool_options()
case track_tab::profile: render_profile_body(); break;
case track_tab::speed:
case track_tab::joints:
case track_tab::norms:
case track_tab::infra:
ImGui::TextDisabled("%s", STR_C("What the check finds is listed in its window"));
break;
@@ -2034,6 +2056,8 @@ std::vector<editor_mode::key_hint> editor_mode::track_key_hints(bool const All)
hints = {{"LMB on a track", "a point of the km there"}, {"Mouse over a track", "its km by the cursor"}};
else if (m_track_window_open && m_track_tab == track_tab::joints)
hints = {{"LMB on a row", "show the place"}, {"Fix", "joins the ends, aligns them"}};
else if (m_track_window_open && m_track_tab == track_tab::norms)
hints = {{"LMB on a row", "show the place"}};
else if (m_track_window_open && m_track_tab == track_tab::infra)
hints = {{"LMB", "select a path"}};
else if (m_track_tab == track_tab::straights && m_straights.tool == 1)