MTCT
Design Automation and Optimization for ETCS Railway Networks
Loading...
Searching...
No Matches
cda_rail::Train Class Reference

Properties and characteristics of a train. More...

#include <Train.hpp>

Public Member Functions

 Train (std::string name, double length, double max_speed, double acceleration, double deceleration, bool tim=true)
 Constructs a train with specified dynamic properties.
std::string const & get_name () const
 Accesses the train's name.
double get_length () const
 Retrieves the train's length.
double get_max_speed () const
 Accesses the train's maximum speed.
double get_acceleration () const
 Retrieves the train's acceleration.
double get_deceleration () const
 Retrieves the train's maximum deceleration.
bool has_tim () const
 Returns whether the train has train integrity monitoring.
void set_length (double const length)
 Sets the length of the train.
void set_max_speed (double const maxSpeed)
 Sets the maximum speed of the train.
void set_acceleration (double const acceleration)
 Sets the maximum acceleration of the train.
void set_deceleration (double const deceleration)
 Sets the maximum deceleration of the train.
void set_tim_value (bool const tim)
 Sets the train integrity monitoring flag to a specific value.
void set_tim ()
 Enables train integrity monitoring.
void set_no_tim ()
 Disables train integrity monitoring.

Friends

class TrainList

Detailed Description

Properties and characteristics of a train.

Stores the name, length, maximum speed, and acceleration/deceleration capabilities, as well as train integrity monitoring status.

Invariant
m_length >= 0 (non-negative).
m_max_speed >= MIN_NON_ZERO (strictly positive).
m_acceleration >= MIN_NON_ZERO (strictly positive).
m_deceleration >= MIN_NON_ZERO (strictly positive).

Constructor & Destructor Documentation

◆ Train()

cda_rail::Train::Train ( std::string name,
double length,
double max_speed,
double acceleration,
double deceleration,
bool tim = true )

Constructs a train with specified dynamic properties.

Precondition
length >= 0.
max_speed >= MIN_NON_ZERO.
acceleration >= MIN_NON_ZERO.
deceleration >= MIN_NON_ZERO.
Parameters
nameName identifier for the train.
lengthLength of the train in meters.
max_speedMaximum speed of the train in m/s.
accelerationMaximum acceleration capability in m/s².
decelerationMaximum deceleration capability in m/s².
timTrain integrity monitoring flag (default: true).
Exceptions
cda_rail::exceptions::InvalidInputExceptionIf any numeric precondition is violated.

Member Function Documentation

◆ get_acceleration()

double cda_rail::Train::get_acceleration ( ) const
inlinenodiscard

Retrieves the train's acceleration.

Returns
The train's acceleration in m/s².

◆ get_deceleration()

double cda_rail::Train::get_deceleration ( ) const
inlinenodiscard

Retrieves the train's maximum deceleration.

Returns
Maximum deceleration in m/s² (guaranteed >= MIN_NON_ZERO).

◆ get_length()

double cda_rail::Train::get_length ( ) const
inlinenodiscard

Retrieves the train's length.

Returns
Train length in meters (guaranteed >= 0).

◆ get_max_speed()

double cda_rail::Train::get_max_speed ( ) const
inlinenodiscard

Accesses the train's maximum speed.

Returns
Maximum speed in m/s (guaranteed >= MIN_NON_ZERO).

◆ get_name()

std::string const & cda_rail::Train::get_name ( ) const
inlinenodiscard

Accesses the train's name.

Returns
A const reference to the train's name.

◆ has_tim()

bool cda_rail::Train::has_tim ( ) const
inlinenodiscard

Returns whether the train has train integrity monitoring.

Returns
true if train has TIM enabled, false otherwise.

◆ set_acceleration()

void cda_rail::Train::set_acceleration ( double const acceleration)
inline

Sets the maximum acceleration of the train.

Precondition
acceleration >= MIN_NON_ZERO.
Parameters
accelerationNew maximum acceleration in m/s².
Exceptions
cda_rail::exceptions::InvalidInputExceptionIf acceleration is less than MIN_NON_ZERO.

◆ set_deceleration()

void cda_rail::Train::set_deceleration ( double const deceleration)
inline

Sets the maximum deceleration of the train.

Precondition
deceleration >= MIN_NON_ZERO.
Parameters
decelerationNew maximum deceleration in m/s².
Exceptions
cda_rail::exceptions::InvalidInputExceptionIf deceleration is less than MIN_NON_ZERO.

◆ set_length()

void cda_rail::Train::set_length ( double const length)
inline

Sets the length of the train.

Precondition
length >= 0.
Parameters
lengthNew length in meters.
Exceptions
cda_rail::exceptions::InvalidInputExceptionIf length is negative.

◆ set_max_speed()

void cda_rail::Train::set_max_speed ( double const maxSpeed)
inline

Sets the maximum speed of the train.

Parameters
maxSpeedNew maximum speed in m/s. Must be at least MIN_NON_ZERO.
Exceptions
cda_rail::exceptions::InvalidInputExceptionIf maxSpeed is less than MIN_NON_ZERO.

◆ set_no_tim()

void cda_rail::Train::set_no_tim ( )
inline

Disables train integrity monitoring.

◆ set_tim()

void cda_rail::Train::set_tim ( )
inline

Enables train integrity monitoring.

◆ set_tim_value()

void cda_rail::Train::set_tim_value ( bool const tim)
inline

Sets the train integrity monitoring flag to a specific value.

Parameters
timtrue to enable TIM, false to disable.

◆ TrainList

friend class TrainList
friend

The documentation for this class was generated from the following files: