This paper proposes a three-state energy model, which contains three states, i.e., generator, power load and closed states. Besides, this paper proposes an expandable deep learning for the real-time economic generation dispatch and control of three-state energies based future smart grids. Although three-state energies will interconnected into or disconnected from future smart grids with varying topology, the numbers of inputs and outputs of the proposed expandable deep learning can be expanded dynamically with the varying topology of future smart grids. Since expandable deep learning based real-time economic generation dispatch and controller can simultaneously provide multiple generation commands for future smart grids with varying topology, the framework of conventional generation dispatch and control can be replaced by the real-time economic generation dispatch and control framework. Compared with 216 combined conventional generation dispatch and control algorithms under a 118-bus power system with 54 three-state energies and a 13659-bus power system with a total of 4092 three-state energies in varying topology, the expandable deep learning obtains the highest control performance. Simulation results verify the effectiveness and feasibility of the proposed expandable deep learning for the real-time economic generation dispatch and control of three-state energies based future smart grids with varying number of three-state energies and varying topology.