18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 00:22:42 +01:00
Files
maszyna/editor/layout/layoutConnection.hpp
T
maj00r efcc28b0ed feat(editor): the solver of the connections of the tracks: a crossover between two lines, the norms of the straight and the spacing
E5 (editor-tracks-domain.md §7 "Połącz tory", §8 "Połącz dwa końce ... odmowa ... z najlepszą propozycją"): editor/layout/layoutConnection
plans a crossover between two lines running alongside, straight or curved, and the command connect_tracks lays it, one step to undo.

- The first turnout where it's asked for, toward the other line; the second one on the other line running back, its diverging track facing
  the first one's, where the line between their ends turns by as much at both of them: on one straight between straights alongside (the
  headings of the ends within 1e-13 rad), one curve between curved lines. Found by the secant along the other line, each try the turnout
  laid in a copy of the network, so it's put as the command will put it.
- The spacing of the lines measured along the whole crossover, a point every metre, not where it starts; the least of it against the
  least spacing of the type: of ST-T1-A6 tab. 11.2 where the catalogue gives it, or what its geometry needs with the least straight
  between its turnouts (crossover_spacing()), the larger.
- The least straight between the turnouts from the norms: a new parameter of the E1 module, switch_straight, at the speed through them:
  max(0.15 V; 6) m in the running and the main tracks (11.3 pkt 7d, WARN), 30 m on a line of 160 km/h or more (pkt 7e, BLOCK; the new
  feature fast_line), 6 m recommended in the side tracks (pkt 7c). The solver asks for the normal limit.
- Where they can't be met: refused with the reasons and the best which fits the spacing measured, a type of the catalogue of the rail of
  the one asked for before the others, the fastest; or that none fits, and the spacing the type asked for needs.
- The line between the turnouts runs at the speed of their diverging tracks and is a part of the connection of the tracks for the norms
  (the feature switch_track of its class, which describe_chain() puts on its elements): an arc with no transitions nor cant where it isn't a
  straight, and the steps of the cant deficiency and the elements between them judged as in the tracks of turnouts (tab. 9.15, 9.16).

Tests: U: crossovers of Rz 60E1-500-1:12 between straights 4.75 m apart, both ways to both sides: the spacing 4.75 m all along, the
straight between the ends (4.75 m less twice the offset of an end) / sin(1:12), the norms' 9 m at 60 km/h, the ends facing each other on
one straight, one step to undo; a line closing in on the other refused for its spacing along the crossover though wide enough at its
start; 0.15 m short of the spacing for the 9 m straight refused with "11.3 pkt 7" and a type proposed, which then is laid; 30 m on a
line of 160 km/h; Rz 60E1-760-1:14 refused at 4.74 m by tab. 11.2 though its geometry fits; between two curves of R 1200 and 1195.5 m
4.5 m apart (4.50086 to 4.50087 m along it), both turnouts bent, one curve turning by 0.6 degree between their ends; a slip, a line to
itself, a line across and a type of none refused; the rows of switch_straight. Unit tests 1089 -> 1096.
2026-11-23 14:49:35 +01:00

64 lines
3.0 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "editor/layout/layoutNetwork.hpp"
#include <string>
#include <vector>
// The solver of the connections of the tracks (editor-tracks-domain.md §7 "Połącz tory", §8): a crossover between two lines running
// alongside, straight or curved, made of a turnout on each, their diverging tracks facing each other, a line between their ends. The second
// turnout is put where the line between the ends runs as one straight (the tangents of both ends on it), or, between curved lines, where it
// turns by as much at both ends (one curve between them). Checked before it's laid: the spacing of the lines measured along the whole
// crossover, not at one point, against the least of ST-T1-A6 tab. 11.2 for the type (or what its geometry needs where the table hasn't it);
// the line between the turnouts no shorter than the norms ask of the element between two turnouts (the module of the norms,
// parameter::switch_straight: max(0.15 V; 6) m, 30 m on a line of 160 km/h or more). Where the norms can't be met it's refused with the best
// which fits: another type of the catalogue, or the spacing the type needs.
namespace layout
{
// the crossover asked for: the first turnout's line, where it starts and which way it runs (the crossover leads that way), the other line
// and the type of both turnouts
struct connect_tracks
{
line_id from{line_id::none};
double chainage{0.0};
int direction{1};
line_id to{line_id::none};
std::string type;
};
struct connection_plan
{
bool fits{false};
std::vector<std::string> reasons; // why it doesn't, the proposal among them
int hand{1}; // of the first turnout: the side the other line lies on
double chainage{0.0}; // where the second turnout starts along its line
int direction{1}; // the second turnout along its line or against it, its diverging track facing the first one's
int hand2{1};
double spacing_least{0.0}; // m, of the lines along the crossover, every metre of it
double spacing_most{0.0};
double spacing_needed{0.0}; // m: of tab. 11.2 for the type, or of its geometry with the least straight
double straight{0.0}; // m, between the ends of the diverging tracks
double straight_needed{0.0}; // m, of the norms
double turn{0.0}; // rad, by which the line between the ends turns: 0 between straights alongside
std::string proposal; // the best which fits where this doesn't
};
// the least spacing of two parallel straight lines a crossover of the type needs with a straight between its diverging tracks of the
// length: twice the offset of the end of a diverging track and the straight across at the angle of the turnout; 0 where it's no ordinary
// switch
double crossover_spacing(std::string const &Type, double const Straight);
connection_plan plan_connection(network const &Network, connect_tracks const &Request);
} // namespace layout