  In this paper we present a mathematical model of the train dynamics in a
linear metro line system with demand-dependent run and dwell times. On every
segment of the line, we consider two main constraints. The first constraint is
on the travel time, which is the sum of run and dwell time. The second one is
on the safe separation time, modeling the signaling system, so that only one
train can occupy a segment at a time. The dwell and the run times are modeled
dynamically, with two control laws. The one on the dwell time makes sure that
all the passengers can debark from and embark into the train. The one on the
run time ensures train time-headway regularity in the case where perturbations
do not exceed a run time margin.
  We use a Max-plus algebra approach which allows to derive analytic formulas
for the train time-headway and frequency depending on the number of trains and
on the passenger demand. The analytic formulas, illustrated by 3D figures,
permit to understand the phases of the train dynamics of a linear metro line
being operated as a transport on demand system.
