|
MTCT
Design Automation and Optimization for ETCS Railway Networks
|
Namespaces | |
| namespace | exceptions |
| namespace | instances |
| namespace | simulator |
| namespace | solver |
| namespace | vss |
Classes | |
| struct | Vertex |
| Represents a vertex (node) in the railway network graph. More... | |
| struct | Edge |
| Represents a directed edge in the railway network graph. More... | |
| class | Network |
| Directed multigraph representing a railway network. More... | |
| struct | ConflictPair |
| One overlap interval between two routes. More... | |
| class | Route |
| Ordered list of network edges that a train follows. More... | |
| class | RouteMap |
| Collection of named train routes built on top of a railway network. More... | |
| struct | Station |
| Represents a station as a named set of network tracks (edge indices). More... | |
| class | StationList |
| Container and persistence API for named stations. More... | |
| class | ScheduledStop |
| Scheduling information for a stop within a timetable. More... | |
| class | Schedule |
| Specific schedule object with fixed entry/exit constraints. More... | |
| class | Timetable |
| The trains of an instance together with what they are to do. More... | |
| class | Train |
| Properties and characteristics of a train. More... | |
| class | TrainList |
| Container for trains with name-based indexing. More... | |
| class | FixedSizeVector |
| A heap-allocated, fixed-size array whose capacity cannot change after construction. More... | |
| class | MultiArray |
| A dynamically-shaped N-dimensional array stored in row-major order. More... | |
Typedefs | |
| using | index_vector = std::vector<size_t> |
| using | index_set = std::unordered_set<size_t> |
Enumerations | |
| enum class | VertexType : std::uint8_t { NoBorder = 0 , VSS = 1 , TTD = 2 , NoBorderVSS = 3 } |
| Which kind of block border a vertex is. More... | |
| enum class | SolutionStatus : std::uint8_t { Optimal = 0 , Feasible = 1 , Infeasible = 2 , Timeout = 3 , Unknown = 4 } |
| What a solver was able to say about the instance it was given. More... | |
| enum class | OptimalityStrategy : std::uint8_t { Optimal = 0 , TradeOff = 1 , Feasible = 2 } |
| How hard a solver tries to prove optimality. More... | |
| enum class | VelocityRefinementStrategy : std::uint8_t { None = 0 , MinOneStep = 1 } |
| How the discrete velocities of a vertex are chosen. More... | |
| enum class | MATimingStrategy : std::uint8_t { ExtremeProfiles = 0 } |
| Strategy selector for MA timing from train rear. More... | |
Functions | |
| constexpr std::string | solution_status_to_string (SolutionStatus const status) |
The name of status, as it is reported, exported and imported. | |
| double | braking_distance (double v, double d) |
| Helpers for 1D train motion under constant-acceleration bounds. | |
| double | max_braking_pos_after_dt_linear_movement (double v_0, double v_max, double a, double d, double dt) |
Computes the maximal forward shift of the braking point after dt. | |
| double | min_travel_time (double v_1, double v_2, double v_m, double a, double d, double s) |
Returns the minimal time to traverse an edge of length s. | |
| double | min_travel_time_flexible_exit_speed (double v_1, double v_m, double a, double s) |
| Returns the minimal travel time when starting with v_1 and no constraint on exit velocity (besides staying below maximal speed). | |
| double | min_travel_time_from_start (double v_1, double v_2, double v_m, double a, double d, double s, double x) |
Returns minimal time to reach position x from the edge start. | |
| double | min_travel_time_to_end (double v_1, double v_2, double v_m, double a, double d, double s, double x) |
Returns minimal remaining time from position x to edge end. | |
| double | max_travel_time (double v_1, double v_2, double v_m, double a, double d, double s, bool stopping_allowed) |
| Returns maximal traversal time for an edge. | |
| double | max_travel_time_no_stopping (double v_1, double v_2, double v_m, double a, double d, double s) |
| Returns maximal traversal time without allowing a full stop. | |
| double | max_travel_time_stopping_allowed (double v_1, double v_2, double a, double d, double s) |
| Returns maximal traversal time when stopping is allowed. | |
| double | max_travel_time_from_start (double v_1, double v_2, double v_m, double a, double d, double s, double x, bool stopping_allowed) |
Returns maximal time to reach position x from edge start. | |
| double | max_travel_time_from_start_no_stopping (double v_1, double v_2, double v_m, double a, double d, double s, double x) |
Returns maximal time to reach x without allowing a full stop. | |
| double | max_travel_time_from_start_stopping_allowed (double v_1, double v_2, double a, double d, double s, double x) |
Returns maximal time to reach x when stopping is allowed. | |
| double | max_travel_time_to_end (double v_1, double v_2, double v_m, double a, double d, double s, double x, bool stopping_allowed) |
Returns maximal remaining time from x to edge end. | |
| double | max_travel_time_to_end_no_stopping (double v_1, double v_2, double v_m, double a, double d, double s, double x) |
Returns maximal remaining time from x to end without stopping. | |
| double | max_travel_time_to_end_stopping_allowed (double v_1, double v_2, double a, double d, double s, double x) |
Returns maximal remaining time from x to end when stopping is allowed. | |
| double | max_travel_time_inverse (double v_0, double t, double dt, double d, double s) |
| Let v_0/s_0 vel/pos at t_0, v_1/s_1 at t_1 and v_2/s_2 at t_2. Find maximal v_1, such that: | |
| double | max_travel_time_to_stop_at_end_after_one_time_step (double v_0, double dt, double d, double s) |
| Assuming v_0/s_0 at t_0, v_1/s_1 at t_0+dt and v_2/s_2 at t_2: | |
| double | minimal_line_speed (double v_1, double v_2, double v_min, double a, double d, double s) |
| Returns the minimum line speed reached on the maximal-time profile. | |
| double | maximal_line_speed (double v_1, double v_2, double v_max, double a, double d, double s) |
| Returns the maximum line speed reached on the minimal-time profile. | |
| double | get_line_speed (double v_1, double v_2, double v_min, double v_max, double a, double d, double s, double t, bool allow_too_short_time=false) |
Finds a line speed that yields traversal time t. | |
| double | time_on_edge (double v_1, double v_2, double v_line, double a, double d, double s) |
| Computes traversal time for a fixed line speed profile. | |
| double | pos_on_edge_at_time (double v_1, double v_2, double v_line, double a, double d, double s, double t) |
Returns position on the edge at time t for a fixed line speed profile. | |
| double | vel_on_edge_at_time (double v_1, double v_2, double v_line, double a, double d, double s, double t) |
Returns velocity on the edge at time t for a fixed line speed profile. | |
| double | min_time_to_push_ma_forward (double v_0, double a, double d, double s) |
Minimal time to move the moving-authority point forward by s. | |
| double | min_time_to_push_ma_backward (double v_0, double a, double d, double s) |
Minimal time to move the moving-authority point backward by s. | |
| double | min_time_to_push_ma_fully_backward (double v_0, double a, double d) |
| Minimal time to move MA fully backward to the initial train front. | |
| double | min_time_from_front_to_ma_point (double v_1, double v_2, double v_m, double a, double d, double s, double obd) |
| Minimal time from train front to a target MA point. | |
| double | max_time_from_front_to_ma_point (double v_1, double v_2, double v_m, double a, double d, double s, double obd, bool stopping_allowed) |
| Maximal time from train front to a target MA point. | |
| double | max_time_from_front_to_ma_point_no_stopping (double v_1, double v_2, double v_m, double a, double d, double s, double obd) |
| Maximal time from train front to MA point without full stop. | |
| double | max_time_from_front_to_ma_point_stopping_allowed (double v_1, double v_2, double a, double d, double s, double obd) |
| Maximal time from train front to MA point when stopping is allowed. | |
| double | min_time_from_rear_to_ma_point (double v_1, double v_2, double v_min, double v_max, double a, double d, double s, double obd, MATimingStrategy strategy=MATimingStrategy::ExtremeProfiles) |
| Minimal time from train rear to MA point under a strategy. | |
| double | max_time_from_rear_to_ma_point (double v_1, double v_2, double v_min, double v_max, double a, double d, double s, double obd, MATimingStrategy strategy=MATimingStrategy::ExtremeProfiles) |
| Maximal time from train rear to MA point under a strategy. | |
| double | min_time_profile_from_rear_to_ma_point (double v_1, double v_2, double v_m, double a, double d, double s, double obd) |
| Rear-to-MA time under a single minimum-time speed profile. | |
| double | max_time_profile_from_rear_to_ma_point (double v_1, double v_2, double v_m, double a, double d, double s, double obd) |
| Rear-to-MA time under a single maximum-time no-stopping profile. | |
| void | check_consistency_of_eom_input (double &v_1, double &v_2, double &a, double &d, double &s, double &x) |
| Normalizes and validates common EOM inputs in place. | |
| bool | possible_by_eom (double v_1, double v_2, double a, double d, double s) |
| Checks whether speed transition is feasible by equations of motion. | |
| std::pair< double, double > | get_min_travel_time_acceleration_change_points (double v_1, double v_2, double v_m, double a, double d, double s) |
| Returns profile change-point distances for minimum-time motion. | |
| std::pair< double, double > | get_max_travel_time_acceleration_change_points (double v_1, double v_2, double v_m, double a, double d, double s) |
| Returns profile change-point distances for maximum-time motion. | |
| double | time_to_travel_distance_with_constant_acceleration (double v_0, double a, double s) |
Computes the time to travel s at constant acceleration. | |
| template<typename T> | |
| bool | operator== (const FixedSizeVector< T > &lhs, const std::vector< T > &rhs) |
| Equality comparison between a FixedSizeVector and a std::vector. | |
| template<typename T> | |
| bool | operator== (const std::vector< T > &lhs, const FixedSizeVector< T > &rhs) |
| Equality comparison between a std::vector and a FixedSizeVector. | |
| template<typename T> | |
| void | swap (FixedSizeVector< T > &lhs, FixedSizeVector< T > &rhs) noexcept |
| ADL-reachable swap for FixedSizeVector. | |
| template<std::floating_point T> | |
| bool | approx_equal (T const a, T const b, T const factor=10) |
| Determines if two floating-point values are approximately equal using a machine-epsilon-scaled tolerance. | |
| void | round_small_numbers_to_zero_inplace (double &val, double const tol=EPS) |
| Sets a value to zero if its absolute magnitude is less than a tolerance threshold. | |
| double | round_to_given_tolerance (double const value, double const tolerance) |
| Rounds a value to the nearest multiple of a given tolerance. | |
| std::vector< cda_rail::index_vector > | subsets_of_size_k_indices (size_t n, size_t k) |
Generates all subsets of size k of the index set {0, 1, ..., n - 1}. | |
| std::vector< std::pair< size_t, size_t > > | subsets_of_size_2_indices (size_t n) |
| Generates all unordered index pairs from {0, 1, ..., n - 1}. | |
| void | initialize_plog (bool debug_input, bool overwrite_severity=false) |
| Initializes the global plog console logger and adjusts its severity. | |
| bool | is_directory_and_create (const std::filesystem::path &p) |
| Ensures that a filesystem path exists as a directory. | |
| double | relu (double val) |
| Returns the positive part of a scalar. | |
| template<typename Clock, typename Duration1, typename Duration2> | |
| double | get_time_difference_in_seconds (std::chrono::time_point< Clock, Duration1 > const &start, std::chrono::time_point< Clock, Duration2 > const &end) |
| double | get_last_time_step_before (double t, double dt, bool t_inclusive) |
| return last time step before t | |
| double | get_first_time_step_after (double t, double dt, bool t_inclusive) |
| return first time step after t | |
| size_t | get_last_time_index_before (double t, double dt, bool t_inclusive) |
| return the index of the last time step before t | |
| size_t | get_first_time_index_after (double t, double dt, bool t_inclusive) |
| return the index of the first time step after t | |
| std::string | concatenate_string_views (std::initializer_list< std::string_view > parts) |
| Concatenates multiple string views into a single string. | |
| bool | case_insensitive_str_equal (std::string_view a, std::string_view b) |
| Compares two strings for equality, ignoring case. | |
| void | to_bool_optional_inplace (std::string_view s_view, std::optional< bool > &b) |
| Parses a textual boolean value into an optional in place. | |
| std::string | sanitize (std::string s) |
| Replaces every non-alphanumeric character by a hyphen. | |
Variables | |
| constexpr double | INF = std::numeric_limits<double>::max() / 3 |
| constexpr double | EPS = 1000 * std::numeric_limits<double>::epsilon() |
| constexpr double | GRB_EPS = 1e-4 |
| constexpr double | V_MIN = 0.3 |
| constexpr double | STOP_TOLERANCE = 10 |
| constexpr double | ABS_PWL_ERROR = 10 |
| constexpr double | LINE_SPEED_ACCURACY = 0.1 |
| constexpr double | LINE_SPEED_TIME_ACCURACY = 0.1 |
| constexpr double | MIN_NON_ZERO = 0.1 |
| constexpr double | MIN_OCCUPIED_LENGTH = 1 |
| using cda_rail::index_set = std::unordered_set<size_t> |
| using cda_rail::index_vector = std::vector<size_t> |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Which kind of block border a vertex is.
| Enumerator | |
|---|---|
| NoBorder | |
| VSS | |
| TTD | |
| NoBorderVSS | |
|
nodiscard |
Determines if two floating-point values are approximately equal using a machine-epsilon-scaled tolerance.
| T | Floating-point type of the compared values. |
| a | First value. |
| b | Second value. |
| factor | Scaling factor applied to std::numeric_limits<T>::epsilon(). |
| cda_rail::exceptions::InvalidInputException | If the factor is negative. |
| double cda_rail::braking_distance | ( | double | v, |
| double | d ) |
Helpers for 1D train motion under constant-acceleration bounds.
All functions in this header use a simplified longitudinal motion model: acceleration is piecewise constant and limited to +a (accelerating), 0 (coasting), or -d (braking). This yields quadratic kinematic relations in position, speed, and time.
Typical use case: edge length and boundary speeds are known (v_1, v_2, s), while the intermediate speed profile is not. This API provides physically consistent profile choices, especially:
Terminology used below:
Computes braking distance for constant deceleration.
Uses the kinematic relation bd = v^2 / (2 * d) where v is the current speed and d is the available deceleration.
| v | Velocity in m/s. |
| d | Deceleration in m/s^2. |
| cda_rail::exceptions::InvalidInputException | If v is negative or d is not strictly positive. |
|
inline |
Compares two strings for equality, ignoring case.
| a | First string to compare. |
| b | Second string to compare. |
| void cda_rail::check_consistency_of_eom_input | ( | double & | v_1, |
| double & | v_2, | ||
| double & | a, | ||
| double & | d, | ||
| double & | s, | ||
| double & | x ) |
Normalizes and validates common EOM inputs in place.
Small values near zero are rounded to zero (using project tolerance), then consistency checks are applied.
| v_1 | Entry speed in m/s (updated in place). |
| v_2 | Exit speed in m/s (updated in place). |
| a | Acceleration in m/s^2 (updated in place). |
| d | Deceleration in m/s^2 (updated in place). |
| s | Total edge length in metres (updated in place). |
| x | Position on edge in metres (updated in place). |
| cda_rail::exceptions::ConsistencyException | If any value is negative after rounding, if a <= 0 or d <= 0, if x > s, or if the entry and exit speeds are not feasible over s. |
|
nodiscard |
Concatenates multiple string views into a single string.
| parts | String fragments to concatenate in the given order. |
parts appended in order. The length of the returned string equals the sum of the fragment lengths.
|
nodiscard |
return the index of the first time step after t
Time itself is continuous, only the discretized models index the time steps. This is the index k belonging to get_first_time_step_after(t, dt, t_inclusive), i.e., the returned index multiplied by dt gives back the time.
| t | Time t |
| dt | Timestep |
| t_inclusive | Can t itself be returned? |
| cda_rail::exceptions::InvalidInputException | If t is negative or dt is non-positive. |
|
nodiscard |
return first time step after t
| t | Time t |
| dt | Timestep |
| t_inclusive | Can t itself be returned? |
|
nodiscard |
return the index of the last time step before t
Time itself is continuous, only the discretized models index the time steps. This is the index k belonging to get_last_time_step_before(t, dt, t_inclusive), i.e., the returned index multiplied by dt gives back the time.
A time within EPS of a time step is treated as lying on it, hence there is no index for a non-inclusive t within EPS of 0.
| t | Time t |
| dt | Timestep |
| t_inclusive | Can t itself be returned? |
| cda_rail::exceptions::InvalidInputException | If t is negative, dt is non-positive, or no non-negative index exists. |
|
nodiscard |
return last time step before t
A time within EPS of a time step is treated as lying on it.
| t | Time t |
| dt | Timestep |
| t_inclusive | Can t itself be returned? |
| double cda_rail::get_line_speed | ( | double | v_1, |
| double | v_2, | ||
| double | v_min, | ||
| double | v_max, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | t, | ||
| bool | allow_too_short_time = false ) |
Finds a line speed that yields traversal time t.
The function searches line speed in [minimal_line_speed,
maximal_line_speed] via bisection. If t exceeds the maximal feasible no-stop travel time, returns 0 as a sentinel for "no feasible line speed".
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_min | Lower bound for candidate line speed in m/s. |
| v_max | Upper bound for candidate line speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| t | Desired traversal time in seconds. |
| allow_too_short_time | If true, a t that is shorter than the fastest possible traversal time is not rejected but answered with maximal_line_speed. This is only intended for times stemming from a solution that was obtained up to an absolute MIP gap and may hence be marginally faster than physically possible. By default such a t is treated as an error. |
t. | cda_rail::exceptions::ConsistencyException | If intermediate EOM checks fail for the provided parameters, or if t is shorter than the fastest possible travel time and allow_too_short_time is false. |
|
nodiscard |
Returns profile change-point distances for maximum-time motion.
Returned pair {s_1, s_2} marks transition points between decelerate / cruise / accelerate phases (or the corresponding mirrored behavior when speeds are below v_m). If no cruise phase exists, s_1 == s_2.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s (v_m >= 0). |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| cda_rail::exceptions::ConsistencyException | If EOM consistency fails or v_m is negative. |
|
nodiscard |
Returns profile change-point distances for minimum-time motion.
Returned pair {s_1, s_2} marks transition points between accelerate / cruise / decelerate phases. If no cruise phase exists, s_1 == s_2.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Upper speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| cda_rail::exceptions::ConsistencyException | If EOM consistency fails or v_m violates preconditions. |
|
inlinenodiscard |
| void cda_rail::initialize_plog | ( | bool | debug_input, |
| bool | overwrite_severity = false ) |
Initializes the global plog console logger and adjusts its severity.
| debug_input | If true, configures debug logging; otherwise configures info logging when an update is applied. |
| overwrite_severity | If true, updates the maximum severity even when a logger already exists. After the call, a global plog logger instance exists. |
|
nodiscard |
Ensures that a filesystem path exists as a directory.
| p | Path to the directory. |
p is empty, already denotes a directory, or the directory was created successfully; otherwise false. If the function returns true and p is non-empty, p denotes an existing directory. | double cda_rail::max_braking_pos_after_dt_linear_movement | ( | double | v_0, |
| double | v_max, | ||
| double | a, | ||
| double | d, | ||
| double | dt ) |
Computes the maximal forward shift of the braking point after dt.
The train is assumed to accelerate linearly for dt seconds, capped at v_max, and then brake immediately with deceleration d.
Returned value =
dt, plus| v_0 | Initial speed in m/s. |
| v_max | Speed cap in m/s. |
| a | Acceleration in m/s^2. |
| d | Deceleration in m/s^2. |
| dt | Time horizon in seconds. |
dt. | cda_rail::exceptions::InvalidInputException | If any precondition is violated. |
| double cda_rail::max_time_from_front_to_ma_point | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | obd, | ||
| bool | stopping_allowed ) |
Maximal time from train front to a target MA point.
Dispatches to stopping or non-stopping variant based on stopping_allowed.
Uses the same MA-point encoding via obd as min_time_from_front_to_ma_point(...).
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s if stopping is not allowed. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| obd | Overlap braking distance in metres (obd >= 0). |
| stopping_allowed | If true, a full stop may occur before reaching the MA point. |
| cda_rail::exceptions::InvalidInputException | If obd is negative. |
| cda_rail::exceptions::ConsistencyException | If EOM consistency fails. |
| double cda_rail::max_time_from_front_to_ma_point_no_stopping | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | obd ) |
Maximal time from train front to MA point without full stop.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| obd | Overlap braking distance in metres (obd >= 0). |
| cda_rail::exceptions::InvalidInputException | If obd is negative. |
| cda_rail::exceptions::ConsistencyException | If EOM consistency fails. |
| double cda_rail::max_time_from_front_to_ma_point_stopping_allowed | ( | double | v_1, |
| double | v_2, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | obd ) |
Maximal time from train front to MA point when stopping is allowed.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| obd | Overlap braking distance in metres (obd >= 0). |
| cda_rail::exceptions::InvalidInputException | If obd is negative. |
| cda_rail::exceptions::ConsistencyException | If EOM consistency fails. |
| double cda_rail::max_time_from_rear_to_ma_point | ( | double | v_1, |
| double | v_2, | ||
| double | v_min, | ||
| double | v_max, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | obd, | ||
| cda_rail::MATimingStrategy | strategy = MATimingStrategy::ExtremeProfiles ) |
Maximal time from train rear to MA point under a strategy.
For ExtremeProfiles, both extreme speed envelopes (using v_min and v_max) are evaluated and the larger resulting time is returned.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_min | Lower bound used for the extreme-profile evaluation in m/s. |
| v_max | Upper bound used for the extreme-profile evaluation in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| obd | Overlap braking distance in metres (obd >= 0). |
| strategy | Strategy to combine profile times. |
| cda_rail::exceptions::InvalidInputException | If strategy is not supported. |
| cda_rail::exceptions::InvalidInputException | If delegated MA helper input checks fail. |
| cda_rail::exceptions::ConsistencyException | If delegated EOM checks fail. |
| double cda_rail::max_time_profile_from_rear_to_ma_point | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | obd ) |
Rear-to-MA time under a single maximum-time no-stopping profile.
Computed as: max_travel_time_no_stopping(...) - max_time_from_front_to_ma_point_no_stopping(...).
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| obd | Overlap braking distance in metres (obd >= 0). |
| cda_rail::exceptions::InvalidInputException | If obd is negative. |
| cda_rail::exceptions::ConsistencyException | If delegated EOM checks fail. |
| double cda_rail::max_travel_time | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| bool | stopping_allowed ) |
Returns maximal traversal time for an edge.
Dispatches to the stopping or non-stopping variant based on stopping_allowed.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s if stopping is not allowed. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| stopping_allowed | If true, full stop may occur on the edge. |
| cda_rail::exceptions::ConsistencyException | If inputs are infeasible. |
| double cda_rail::max_travel_time_from_start | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | x, | ||
| bool | stopping_allowed ) |
Returns maximal time to reach position x from edge start.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s if stopping is not allowed. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| x | Distance from start in metres. |
| stopping_allowed | If true, full stop may occur. |
x; may be infinity. | cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::max_travel_time_from_start_no_stopping | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | x ) |
Returns maximal time to reach x without allowing a full stop.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| x | Distance from start in metres. |
x. v_1 to v_2 over s is physically feasible. | cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::max_travel_time_from_start_stopping_allowed | ( | double | v_1, |
| double | v_2, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | x ) |
Returns maximal time to reach x when stopping is allowed.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| x | Distance from start in metres. |
x. | cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::max_travel_time_inverse | ( | double | v_0, |
| double | t, | ||
| double | dt, | ||
| double | d, | ||
| double | s ) |
Let v_0/s_0 vel/pos at t_0, v_1/s_1 at t_1 and v_2/s_2 at t_2. Find maximal v_1, such that:
| v_0 | Initial velocity in m/s. |
| t | Target time in s. |
| dt | Time step in s. |
| d | Maximum deceleration in m/s^2. |
| s | Desired travel distance in metres. |
| cda_rail::exceptions::InvalidInputException | If an input is non-positive. v_0 may be 0. |
| double cda_rail::max_travel_time_no_stopping | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s ) |
Returns maximal traversal time without allowing a full stop.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::max_travel_time_stopping_allowed | ( | double | v_1, |
| double | v_2, | ||
| double | a, | ||
| double | d, | ||
| double | s ) |
Returns maximal traversal time when stopping is allowed.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::max_travel_time_to_end | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | x, | ||
| bool | stopping_allowed ) |
Returns maximal remaining time from x to edge end.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s if stopping is not allowed. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| x | Distance from start in metres. |
| stopping_allowed | If true, full stop may occur. |
| cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::max_travel_time_to_end_no_stopping | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | x ) |
Returns maximal remaining time from x to end without stopping.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Lower speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| x | Distance from start in metres. |
| cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::max_travel_time_to_end_stopping_allowed | ( | double | v_1, |
| double | v_2, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | x ) |
Returns maximal remaining time from x to end when stopping is allowed.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| x | Distance from start in metres. |
| cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::max_travel_time_to_stop_at_end_after_one_time_step | ( | double | v_0, |
| double | dt, | ||
| double | d, | ||
| double | s ) |
Assuming v_0/s_0 at t_0, v_1/s_1 at t_0+dt and v_2/s_2 at t_2:
| v_0 | Initial velocity in m/s. |
| dt | Time step in s. |
| d | Maximal deceleration in m/s^2. |
| s | Distance until stop position. |
| double cda_rail::maximal_line_speed | ( | double | v_1, |
| double | v_2, | ||
| double | v_max, | ||
| double | a, | ||
| double | d, | ||
| double | s ) |
Returns the maximum line speed reached on the minimal-time profile.
If the edge is too short to reach v_max, the returned value is the actual turning speed reached by the profile.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_max | Desired upper line speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| cda_rail::exceptions::ConsistencyException | If inputs are invalid. |
| double cda_rail::min_time_from_front_to_ma_point | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | obd ) |
Minimal time from train front to a target MA point.
This function uses the same MA convention as the tests and implementation: the target MA point is encoded by overlap braking distance obd. Intuitively, obd measures how much of the final braking-distance reference remains after accounting for the MA point location.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Upper speed bound for the minimum-time profile in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| obd | Overlap braking distance in metres (obd >= 0). |
| cda_rail::exceptions::InvalidInputException | If obd is negative. |
| cda_rail::exceptions::ConsistencyException | If the requested MA point is inconsistent with the speed profile or edge geometry. |
| double cda_rail::min_time_from_rear_to_ma_point | ( | double | v_1, |
| double | v_2, | ||
| double | v_min, | ||
| double | v_max, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | obd, | ||
| cda_rail::MATimingStrategy | strategy = MATimingStrategy::ExtremeProfiles ) |
Minimal time from train rear to MA point under a strategy.
For ExtremeProfiles, both extreme speed envelopes (using v_min and v_max) are evaluated and the smaller resulting time is returned.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_min | Lower bound used for the extreme-profile evaluation in m/s. |
| v_max | Upper bound used for the extreme-profile evaluation in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| obd | Overlap braking distance in metres (obd >= 0). |
| strategy | Strategy to combine profile times. |
| cda_rail::exceptions::InvalidInputException | If strategy is not supported. |
| cda_rail::exceptions::InvalidInputException | If delegated MA helper input checks fail. |
| cda_rail::exceptions::ConsistencyException | If delegated EOM checks fail. |
| double cda_rail::min_time_profile_from_rear_to_ma_point | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | obd ) |
Rear-to-MA time under a single minimum-time speed profile.
Computed as: min_travel_time(...) - min_time_from_front_to_ma_point(...).
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Upper speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| obd | Overlap braking distance in metres (obd >= 0). |
| cda_rail::exceptions::InvalidInputException | If obd is negative. |
| cda_rail::exceptions::ConsistencyException | If delegated EOM checks fail. |
| double cda_rail::min_time_to_push_ma_backward | ( | double | v_0, |
| double | a, | ||
| double | d, | ||
| double | s ) |
Minimal time to move the moving-authority point backward by s.
"Backward" means reducing MA overlap by s relative to the current state.
| v_0 | Initial speed in m/s. |
| a | Acceleration in m/s^2 (may be zero). |
| d | Deceleration in m/s^2. |
| s | Desired MA backward shift in metres. |
| cda_rail::exceptions::InvalidInputException | If inputs violate the preconditions. |
| double cda_rail::min_time_to_push_ma_forward | ( | double | v_0, |
| double | a, | ||
| double | d, | ||
| double | s ) |
Minimal time to move the moving-authority point forward by s.
"Forward" refers to increasing MA distance from the train's initial MA, accounting for both train displacement and the changed braking distance.
| v_0 | Initial speed in m/s. |
| a | Acceleration in m/s^2 (may be zero). |
| d | Deceleration in m/s^2. |
| s | Required MA forward shift in metres. |
| cda_rail::exceptions::InvalidInputException | If inputs violate the preconditions. |
| double cda_rail::min_time_to_push_ma_fully_backward | ( | double | v_0, |
| double | a, | ||
| double | d ) |
Minimal time to move MA fully backward to the initial train front.
Equivalent to min_time_to_push_ma_backward(v_0, a, d, v_0^2/(2*d)).
| v_0 | Initial speed in m/s. |
| a | Acceleration in m/s^2 (may be zero). |
| d | Deceleration in m/s^2. |
| cda_rail::exceptions::InvalidInputException | If inputs violate the preconditions. |
| double cda_rail::min_travel_time | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s ) |
Returns the minimal time to traverse an edge of length s.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Upper speed bound (line speed) in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| cda_rail::exceptions::ConsistencyException | If the speed profile or input range is not feasible under equations of motion. |
| double cda_rail::min_travel_time_flexible_exit_speed | ( | double | v_1, |
| double | v_m, | ||
| double | a, | ||
| double | s ) |
Returns the minimal travel time when starting with v_1 and no constraint on exit velocity (besides staying below maximal speed).
| v_1 | Entry speed in m/s. |
| v_m | Maximal speed in m/s, |
| a | Acceleration in m/s^2. |
| s | Distance in m. |
| double cda_rail::min_travel_time_from_start | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | x ) |
Returns minimal time to reach position x from the edge start.
The profile is the time-optimal one under acceleration bound a, deceleration bound d, and speed cap v_m.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Upper speed bound (line speed) in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| x | Distance from start in metres (0 at start, s at end). |
x. v_1 to v_2 over s is physically feasible. | cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::min_travel_time_to_end | ( | double | v_1, |
| double | v_2, | ||
| double | v_m, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | x ) |
Returns minimal remaining time from position x to edge end.
Equivalent to reversing direction and swapping acceleration/deceleration.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_m | Upper speed bound (line speed) in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| x | Distance from start in metres. |
x to the edge end. | cda_rail::exceptions::ConsistencyException | If inputs are inconsistent or infeasible. |
| double cda_rail::minimal_line_speed | ( | double | v_1, |
| double | v_2, | ||
| double | v_min, | ||
| double | a, | ||
| double | d, | ||
| double | s ) |
Returns the minimum line speed reached on the maximal-time profile.
If the edge is too short to reach v_min, the returned value is the actual turning speed reached by the profile.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_min | Desired lower line speed bound in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| cda_rail::exceptions::ConsistencyException | If inputs are invalid. |
| bool cda_rail::operator== | ( | const FixedSizeVector< T > & | lhs, |
| const std::vector< T > & | rhs ) |
Equality comparison between a FixedSizeVector and a std::vector.
| T | Element type. |
| lhs | Left-hand FixedSizeVector. |
| rhs | Right-hand std::vector. |
| bool cda_rail::operator== | ( | const std::vector< T > & | lhs, |
| const FixedSizeVector< T > & | rhs ) |
Equality comparison between a std::vector and a FixedSizeVector.
| T | Element type. |
| lhs | Left-hand std::vector. |
| rhs | Right-hand FixedSizeVector. |
| double cda_rail::pos_on_edge_at_time | ( | double | v_1, |
| double | v_2, | ||
| double | v_line, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | t ) |
Returns position on the edge at time t for a fixed line speed profile.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_line | Intermediate line speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| t | Time in seconds from edge entry. |
| cda_rail::exceptions::InvalidInputException | If t is inconsistent with the total profile duration or input domain checks fail. |
| cda_rail::exceptions::ConsistencyException | If profile realization fails in time_on_edge(...). |
| bool cda_rail::possible_by_eom | ( | double | v_1, |
| double | v_2, | ||
| double | a, | ||
| double | d, | ||
| double | s ) |
Checks whether speed transition is feasible by equations of motion.
For acceleration (v_2 >= v_1), checks against acceleration bound a. For deceleration (v_2 < v_1), checks against deceleration bound d.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Distance in metres. |
|
nodiscard |
Returns the positive part of a scalar.
| val | Input value. |
|
inline |
Sets a value to zero if its absolute magnitude is less than a tolerance threshold.
If the absolute value of val is less than tol, val is set to zero; otherwise, val remains unchanged.
| val | Reference to the value to normalize. |
| tol | Absolute tolerance threshold. |
| cda_rail::exceptions::InvalidInputException | If tol is negative. |
|
inlinenodiscard |
Rounds a value to the nearest multiple of a given tolerance.
| value | Value to round. |
| tolerance | Positive rounding step. |
tolerance, up to floating-point round-off. | cda_rail::exceptions::InvalidInputException | If tolerance is not strictly positive. |
| std::string cda_rail::sanitize | ( | std::string | s | ) |
Replaces every non-alphanumeric character by a hyphen.
Used for names that are built from user-provided names, e.g., the variable names of an exported model.
| s | String to sanitize. |
s.
|
nodiscardconstexpr |
The name of status, as it is reported, exported and imported.
|
nodiscard |
Generates all unordered index pairs from {0, 1, ..., n - 1}.
| n | Size of the underlying index set. |
| std::invalid_argument | If n < 2. |
|
nodiscard |
Generates all subsets of size k of the index set {0, 1, ..., n - 1}.
| n | Size of the underlying index set. |
| k | Required subset size. |
| std::invalid_argument | If k > n. Returns an empty vector if k == 0. |
|
noexcept |
ADL-reachable swap for FixedSizeVector.
| T | Element type. |
| lhs | First vector. |
| rhs | Second vector. |
| double cda_rail::time_on_edge | ( | double | v_1, |
| double | v_2, | ||
| double | v_line, | ||
| double | a, | ||
| double | d, | ||
| double | s ) |
Computes traversal time for a fixed line speed profile.
Profile structure:
v_1 to v_line,v_line,v_line to v_2.| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_line | Intermediate line speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| cda_rail::exceptions::InvalidInputException | If input domain checks fail. |
| cda_rail::exceptions::ConsistencyException | If the profile cannot be realized over distance s. |
|
nodiscard |
Computes the time to travel s at constant acceleration.
Solves s = v_0 * t + a * t^2 / 2 for t, where a may be negative, and falls back to s / v_0 if it is (numerically) zero.
| v_0 | Initial speed in m/s. |
| a | Constant acceleration in m/s^2. |
| s | Distance in metres. |
| void cda_rail::to_bool_optional_inplace | ( | std::string_view | s_view, |
| std::optional< bool > & | b ) |
Parses a textual boolean value into an optional in place.
Recognized true/false spellings are interpreted case-insensitively. Empty input clears the optional.
| s_view | Input string view to parse. |
| b | Optional boolean updated in place. |
| double cda_rail::vel_on_edge_at_time | ( | double | v_1, |
| double | v_2, | ||
| double | v_line, | ||
| double | a, | ||
| double | d, | ||
| double | s, | ||
| double | t ) |
Returns velocity on the edge at time t for a fixed line speed profile.
| v_1 | Entry speed in m/s. |
| v_2 | Exit speed in m/s. |
| v_line | Intermediate line speed in m/s. |
| a | Maximum acceleration in m/s^2. |
| d | Maximum deceleration in m/s^2. |
| s | Edge length in metres. |
| t | Time in seconds from edge entry. |
| cda_rail::exceptions::InvalidInputException | If t is inconsistent with the total profile duration or input domain checks fail. |
| cda_rail::exceptions::ConsistencyException | If profile realization fails in time_on_edge(...). |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |