  We propose and investigate a queueing model of a battery swapping and
charging station (BSCS) for electric vehicles (EVs). A new approach to the
analysis of the queueing model is developed, which combines the representation
of the model as a stochastic dynamic system with the use of the methods and
results of tropical algebra, which deals with the theory and applications of
algebraic systems with idempotent operations. We describe the dynamics of the
queueing model by a system of recurrence equations that involve random
variables (RVs) to represent the interarrival time of incoming EVs. A
performance measure for the model is defined as the mean operation cycle time
of the station. Furthermore, the system of equations is represented in terms of
the tropical algebra in vector form as an implicit linear state dynamic
equation. The performance measure takes on the meaning of the mean growth rate
of the state vector (the Lyapunov exponent) of the dynamic system. By applying
a solution technique of vector equations in tropical algebra, the implicit
equation is transformed into an explicit one with a state transition matrix
with random entries. The evaluation of the Lyapunov exponent reduces to finding
the limit of the expected value of norms of tropical matrix products. This
limit is then obtained using results from the tropical spectral theory of
deterministic and random matrices. With this approach, we derive a new exact
formula for the mean cycle time of the BSCS, which is given in terms of the
expected value of the RVs involved. We present the results of the Monte Carlo
simulation of the BSCS's operation, which show a good agreement with the exact
solution. The application of the obtained solution to evaluate the performance
of one BSCS and to find the optimal distribution of battery packs between
stations in a network of BSCSs is discussed.
