  We study the optimal control of storage which is used for both arbitrage and
buffering against unexpected events, with particular applications to the
control of energy systems in a stochastic and typically time-heterogeneous
environment. Our philosophy is that of viewing the problem as being formally
one of stochastic dynamic programming, but of using coupling arguments to
provide good estimates of the costs of failing to provide necessary levels of
buffering. The problem of control then reduces to that of the solution,
dynamically in time, of a deterministic optimisation problem which must be
periodically re-solved. We show that the optimal control then proceeds locally
in time, in the sense that the optimal decision at each time $t$ depends only
on a knowledge of the future costs and stochastic evolution of the system for a
time horizon which typically extends only a little way beyond $t$. The approach
is thus both computationally tractable and suitable for the management of
systems over indefinitely extended periods of time. We develop also the
associated strong Lagrangian theory (which may be used to assist in the optimal
dimensioning of storage), and we provide characterisations of optimal control
policies. We give examples based on Great Britain electricity price data.
