Energy is the source of power to promote social progress and economic development. Facing the increasingly serious energy shortage and environmental pollution problems, renewable energy represented by solar energy has been widely used. To adapt to the random, intermittent, and distributed characteristics of renewable energy, PEDF(photovoltaics, energy storage, direct current and flexibility) building energy systems which can accept solar energy efficiently and reliably is highly favored. In this paper, we use MATLAB/Simulink to build a simulation model of a PEDF building energy systems with three distributed power sources (utility grid, photovoltaic, and battery) and external variable power loads and elaborate the control methods of the utility grid, photovoltaic and battery. First, we simulate the power load variation of each module in a day in a residential community to demonstrate the stability of the PEDF building energy systems. And the fault characteristics of the optical storage and direct flexibility system are simulated and analyzed.