Reference
OptimalTrainControl.EETCProblemOptimalTrainControl.ModeOptimalTrainControl.OTCSolutionOptimalTrainControl.TOTCProblemOptimalTrainControl.TrackOptimalTrainControl.TrainBase.lengthOptimalTrainControl._odefunOptimalTrainControl.altitudeOptimalTrainControl.gOptimalTrainControl.gradientOptimalTrainControl.isvalidpositionOptimalTrainControl.load_ttobench_trackOptimalTrainControl.rOptimalTrainControl.segmentize!OptimalTrainControl.solveOptimalTrainControl.solveOptimalTrainControl.speedlimit
OptimalTrainControl.EETCProblem — Typeprob = EETCProblem(T, train, track, initial_speed = 1.)Formulate an energy-efficient train control problem.
Arguments
T::Real: total time of the trip.train::Train: train specification for the problem.track::Track: track specification for the problem.initial_speed::Real = 1.: starting speed; $1$ m/s is regarded as a stop.
OptimalTrainControl.Mode — TypeAn Enum useful for specifying the five possible control modes:
MaxP: Maximum power; usually takes place at the start.HoldP: Cruising; holding constant speed with positive input.HoldR: Regenerative braking; holding constant speed with negative input, can only take place on steep downhill segments.Coast: Coasting; neither applying power or braking.MaxB: Maximum braking; usually takes place at the end.
OptimalTrainControl.OTCSolution — Typesol1::OTCSolution = solve(p1::TOTCProblem)
sol2::OTCSolution = solve(p2::EETCProblem)Is returned as a result of solving a TOTCProblem or a EETCProblem.
Fields
odesol::SciMLBase.ODESolution: solution of the differential equation coming from DifferentialEquations.jl package. The states are[time, speed]and are accessed with e.g.sol1.u. The distances along the track are accessed via e.g.sol1.t. The interpolation functionality should behave as expected although this is not guaranteed since the problem has multiple phases.x_phases::Vector{Real}: sequence of positions at which control modes (seeMode) changes.phases::Vector{Mode}: sequence of control modes (seeMode).control::ConcreteControlFunction: optimal control callable as a function of distance along the track, u(x).η::Vector{Real}: trajectory of the adjoint variable determining the current control mode (seeMode).
See also TOTCProblem, EETCProblem, Mode.
OptimalTrainControl.TOTCProblem — Typeprob = TOTCProblem(train::Train, track::Track, current_phase::Mode = MaxP, initial_speed::Real = 1.)Formulate a time-optimal train control problem to be solved.
Arguments
train::Train: vehicle specification for the problem.track::Track: track specification for the problemcurrent_phase::Mode = MaxP: (mainly for internal purposes) starting control mode.initial_speed::Real = 1.: starting speed; $1 \mathrm{m/s}$ is regarded as a stop.
OptimalTrainControl.Track — Typetrack = Track(length; <keyword arguments>)Defines a track to be used in TOTCProblem or EETCProblem construction
Arguments
altitude::Real: altitude of the start of thetrack.x_gradient::Vector{Real}: vector of positions at which the gradient changes.gradient::Vector{Real}: vector of grade values in rise/run, positive means uphill.x_speedlimit::Vector{Real}: vector of positions at which the speed limit changes.speedlimit::Vector{Real}: vector of speed limit values in $\mathrm{m/s}$.
Examples
# Flat track
flat_track = Track(1e3) # 1 km long# Hilly track
hilly_track = Track(
3e3;
altitude = 100.,
x_gradient = [0.0, 1e3, 1.7e3],
gradient = [2e-3, 0., 1e-3]
)See also TOTCProblem, EETCProblem.
OptimalTrainControl.Train — Typetrain = Train(U̅, U̲, r, ρ = 0.)Defines a train to be used in TOTCProblem or EETCProblem construction
Arguments
U̅::Function: maximum traction specific force (per unit mass, i.e. acceleration) as a function of speed.U̲::Function: minimum traction specific force (braking, per unit mass, i.e. acceleration) as a function of speed.r::Tuple: triplet of coefficients defining resistance of thetrainas a quadratic function of the speedresistance(v) = r[1] + r[2]v + r[3]v^2.ρ::Real = 0.: regeneration coefficient $ρ ∈ [0,1]$ specifying proportion of braking speed recovered (0 means no regeneration, 1 means all braking energy regenerated).
Example
train = Train(
U̅ = v -> 1/v,
U̲ = v -> -1/v,
r = (1e-2, 0., 1.5e-5),
ρ = 0.3
)See also TOTCProblem, EETCProblem.
Base.length — Methodlength(track::Track)Return length of track in metres.
OptimalTrainControl._odefun — MethodOut-of-place version of the right-hand side of the ODE system for the EETC problem.
Params are in a EETCSimParams struct.
OptimalTrainControl.altitude — Methodaltitude(track::Track, position::Real)Return altitude (in metres) at position on track.
OptimalTrainControl.g — Methodg(track::Track, position::Real)Return gravitational acceleration component at position regarding the gradient of track.
OptimalTrainControl.gradient — Methodgradient(track::Track, position::Real)Return gradient (in rise over run) at position on track. For example, a gradient of a segment which rises 10 metres over 100 metres of distance has gradient of 0.1.
OptimalTrainControl.isvalidposition — Methodisvalidposition(track::Track, position::Real)Check if position is not out of bounds of the track.
OptimalTrainControl.load_ttobench_track — Methodload_ttobench_track(filename; which_stops = (1, 2))Load a track from a file in the TTOBench format.
Arguments
filename::AbstractString: path to the file containing the track.which_stops::Tuple{Int, Int} = (1, 2): tuple of indices of the stops to consider (only journey between two stops is currently possible).
OptimalTrainControl.r — Methodr(train::Train, speed:Real)Return resistance specific force of train at given speed.
The resistance specific force (per unit mass, i.e. acceleration) is positive and calculated as train.r[1] + train.r[2] * v + train.r[3] * v^2.
OptimalTrainControl.segmentize! — Methodsegmentize!(track::Track)Modify track.x_segments such that its elements mark starts of track parts on which both gradient and speed limit are constant.
OptimalTrainControl.solve — Methodsolve(problem::TOTCProblem)Compute OTCSolution of the time-optimal train control problem.
See also TOTCProblem, OTCSolution.
OptimalTrainControl.solve — Methodsolve(problem::EETCProblem)Compute OTCSolution of an energy-efficient train control problem on a flat track.
See also EETCProblem, OTCSolution.
OptimalTrainControl.speedlimit — Methodspeedlimit(track::Track, position::Real)Return speedlimit (in metres per second) at position on track.