The package can be installed by entering
using Pkg; Pkg.add(url="https://github.com/vtfanta/OptimalTrainControl.jl")
to the Julia REPL.
Consider the problem of finding the time-optimal speed profile on a flat track of length Train
and a Track
which will form the basis of our problem.
Each Train
has upper and lower limit of its traction capabilites (specified as a Julia function of speed) and coefficients of a quadratic representing the speed-dependent train's mechanical and aerodynamical resistance.
train = Train(
v -> 3/v,
v -> -3/v,
(6.75e-3, 0., 5e-5)
)
The only required argument for a Track
is its length, however one can also specify its altitude and points of changing track grade.
track = Track(
length = 3e3,
altitude = 100.,
x_gradient = [0.0, 1e3, 1.7e3],
gradient = [2e-3, 0., 1e-3]
)
We are now ready to construct a time-optimal train control problem and solve it!
prob = TOTCProblem(train, track)
sol = solve(prob)
plot(sol)
plot!(twinx(), track)
The colours are showing the control mode which is currently engaged (green for maximum traction, red for maximum braking).
In contrast to the previous example, energy-efficient train control (EETC) problems minimize the criterion
where
Let's construct a
track = Track(
length = 5e3
)
and a train (the fourth argument is
train = Train(
v -> 1/v,
v -> -1/v,
(1e-2, 0., 1.5e-5),
0.6
)
Suppose, we want to arrive at our destination after
T = 800.
prob = EETCProblem(T, train, track)
sol = solve(prob)
plot(sol)
The colours specify the currently engaged control mode (green for maximum traction, blue for cruising, gray for coasting and red for maximum braking).
One can also inspect the optimal control signal throughout the trip:
plot(sol.control, 0, track.length)