Dynamic optimal power flow (DOPF) models are needed to optimize the operation of a power system with energy storage systems (ESSs) over an extended planning horizon. The optimal storage level at the end of each planning horizon depends on the possible realization of uncertainties in future planning horizons. However, most DOPF models simply require that the storage levels at the end and at the beginning of the planning horizon should be equal. In this paper we consider an AC DOPF model for a distribution system with ESS that explicitly takes into account the expected future value of stored energy. We illustrate the evaluation of the future value function for a system with a wind power plant and demonstrate the use of this value function in the operation of the ESS. The results show that such an operational strategy can be effective compared to not considering the value of stored energy.