In this research, I investigate the resource optimization of a residential distributed photovoltaic (PV) system integrated with battery energy storage systems (BESS) connected to the utility grid. The work aims to minimize the overall operational cost while ensuring reliable energy supply. I propose a multi-objective mixed-integer linear programming model that incorporates the levelized cost of electricity from PV generation, the degradation cost of battery energy storage systems, and the real-time electricity price for both purchasing and selling power. The model explicitly considers the charging and discharging costs of battery energy storage systems, which are often neglected in traditional levelized cost analyses. By embedding the cost of battery cycling into the objective function, the optimization strategy achieves a more realistic trade-off between utilizing stored energy and extending the lifespan of battery energy storage systems.
The system comprises PV panels, battery energy storage systems, a bidirectional inverter, a household load, and a grid connection with metering and control devices. The inverter interfaces the DC components (PV and battery energy storage systems) with the AC load and the grid. The controller implements the optimal dispatch schedule derived from the proposed model. The following sections detail the mathematical formulation, constraints, simulation setup, and results.

Figure above illustrates a typical residential battery energy storage system configuration used in this study. The integration of battery energy storage systems allows for time-shifting of solar energy and participation in demand-side management.
Mathematical Formulation
Objective Function
The objective is to minimize the total system cost over the optimization horizon T (e.g., 24 hours with hourly time steps). The cost includes four components: (i) cost of purchasing electricity from the grid for both load and battery charging, (ii) cost of PV generation, (iii) cost of battery degradation due to charging and discharging cycles, and (iv) revenue from selling surplus electricity back to the grid. The expression is:
$$
\begin{aligned}
\min f = & \sum_{t=1}^{T} \rho_{\text{grid}}(t) \big[ P_{GU}(t) + P_{GB}(t) \big] \\
& + \sum_{t=1}^{T} \rho_{PV} \big[ P_{PU}(t) + P_{PB}(t) + P_{PG}(t) \big] \\
& + \sum_{t=1}^{T} \rho_{B} \big[ P_{PB}(t) + P_{BU}(t) + P_{BG}(t) + P_{GB}(t) \big] \\
& – \sum_{t=1}^{T} \rho_{\text{sell}}(t) \big[ P_{PG}(t) + P_{BG}(t) \big]
\end{aligned}
$$
where:
| Symbol | Description |
|---|---|
| \(\rho_{\text{grid}}(t)\) | Time-of-use electricity purchase price at time t (RMB/kWh) |
| \(\rho_{PV}\) | Levelized cost of PV generation (RMB/kWh) |
| \(\rho_{B}\) | Unit cost of battery energy storage systems cycling (RMB/kWh) |
| \(\rho_{\text{sell}}(t)\) | Feed-in tariff at time t (RMB/kWh) |
| \(P_{GU}(t)\) | Power from grid to load (kW) |
| \(P_{GB}(t)\) | Power from grid to battery energy storage systems (kW) |
| \(P_{PU}(t)\) | Power from PV to load (kW) |
| \(P_{PB}(t)\) | Power from PV to battery energy storage systems (kW) |
| \(P_{PG}(t)\) | Power from PV to grid (kW) |
| \(P_{BU}(t)\) | Power from battery energy storage systems to load (kW) |
| \(P_{BG}(t)\) | Power from battery energy storage systems to grid (kW) |
Constraints
Several operational and physical constraints must be satisfied to ensure feasible and safe operation of the system including battery energy storage systems.
Power balance: At every time step, the load demand \(D(t)\) must be met by the sum of power from PV, battery energy storage systems, and grid:
$$
D(t) = P_{PU}(t) + P_{BU}(t) + P_{GU}(t), \quad \forall t.
$$
PV generation limit: The total PV output \(P_{PV}(t)\) (after conversion losses) cannot be less than the sum of its dispatched flows:
$$
P_{PV}(t) \ge P_{PU}(t) + P_{PB}(t) + P_{PG}(t), \quad \forall t.
$$
Battery power constraints: The charging and discharging power of battery energy storage systems cannot exceed the rated power \(P_{\text{bat}}^{\text{rated}}\). Also, simultaneous charging and discharging is forbidden:
$$
\begin{aligned}
P_{BU}(t) + P_{BG}(t) &\le P_{\text{bat}}^{\text{rated}}, \\
P_{PB}(t) + P_{GB}(t) &\le P_{\text{bat}}^{\text{rated}}, \\
X_{\text{ch}}(t) + X_{\text{dis}}(t) &\le 1,
\end{aligned}
$$
where \(X_{\text{ch}}(t), X_{\text{dis}}(t) \in \{0,1\}\) indicate whether battery energy storage systems are charging or discharging.
State of charge (SOC) limits: To prolong the life of battery energy storage systems, the SOC is bounded between \(C_{\min}\) and \(C_{\max}\):
$$
C_{\min} \le C(t) \le C_{\max}, \quad \forall t.
$$
Arbitrage constraint for battery energy storage systems: To ensure profitable cycling, the discharge price must exceed the charge price by at least the cycling cost:
$$
\rho_{\text{grid}}(t_{\text{dis}}) – \rho_{\text{grid}}(t_{\text{ch}}) \ge 2\rho_{B},
$$
where \(t_{\text{ch}}\) and \(t_{\text{dis}}\) are the charging and discharging time instants respectively. This constraint prevents unnecessary degradation of battery energy storage systems.
Simulation Setup and Parameters
I consider a typical residential household with an average daily load demand of 30 kWh. The battery energy storage systems have a capacity of 24 kWh, composed of 20 units of 12 V/100 Ah lead-acid batteries. The total investment cost for battery energy storage systems is 15,000 RMB. To extend cycle life, the depth of discharge (DoD) is limited to 60%, and the SOC is maintained between 40% and 95%. Under these conditions, the maximum number of cycles is approximately 3,500, resulting in a cycling cost \(\rho_B\) of 0.132 RMB/kWh. The maximum charging power of battery energy storage systems is 3 kW, the self-discharge rate is 0.001 per hour, and the round-trip efficiency is 90%.
For comparison, I define three cases:
- Case 1: PV generation + battery energy storage systems (full system)
- Case 2: PV only (no battery energy storage systems)
- Case 3: battery energy storage systems only (no PV generation)
The PV array size is chosen such that its daily generation approximately matches the load (around 30 kWh/day) under typical solar irradiation. I use real-time electricity prices from a representative city (City X) and a feed-in tariff of 0.35 RMB/kWh.
| Parameter | Value | Unit |
|---|---|---|
| Daily load demand | 30 | kWh |
| Battery capacity | 24 | kWh |
| Battery nominal voltage | 12 V × 20 = 240 V | V |
| Battery rated power | 3 | kW |
| SOC lower limit (\(C_{\min}\)) | 0.40 | p.u. |
| SOC upper limit (\(C_{\max}\)) | 0.95 | p.u. |
| Initial SOC | 0.60 | p.u. |
| Cycling cost \(\rho_B\) | 0.132 | RMB/kWh |
| PV LCOE \(\rho_{PV}\) | 0.25 | RMB/kWh |
| Grid purchase price (peak) | 0.85 | RMB/kWh |
| Grid purchase price (off-peak) | 0.35 | RMB/kWh |
| Feed-in tariff \(\rho_{\text{sell}}\) | 0.35 | RMB/kWh |
Results and Discussion
The optimization was performed using a mixed-integer linear programming solver. The resulting dispatch schedule for a typical sunny day is summarized below. In the early morning hours (0:00–5:00), the battery energy storage systems remain idle. Between 5:00 and 6:00, the SOC rises from 0.60 to 0.70 as the system starts charging using inexpensive off-peak grid electricity. From 8:00 to 12:00, solar generation exceeds load, and the surplus is stored in battery energy storage systems, raising the SOC to 0.88. During the evening peak (17:00–20:00), the battery energy storage systems discharge to meet the load, bringing the SOC back to 0.60. The grid is only used when both PV and battery energy storage systems cannot satisfy the demand, primarily during late evening and early morning.
To evaluate the economic and operational benefits of battery energy storage systems, I compare the three cases over a representative day. The total daily cost includes all components (grid purchases, PV generation cost, battery degradation cost, and revenue from sales). The utilization rate of PV generation is defined as the fraction of generated energy that is either consumed on site or stored (i.e., not curtailed). The results are shown in the table below.
| Case | Total Cost (RMB/day) | PV Utilization Rate (%) | Energy Purchased from Grid (kWh) | Energy Sold to Grid (kWh) |
|---|---|---|---|---|
| 1: PV + battery energy storage systems | 4.85 | 88 | 8.2 | 1.5 |
| 2: PV only | 5.10 | 70 | 12.0 | 6.3 |
| 3: battery energy storage systems only | 6.20 | — | 15.5 | 2.4 |
Case 1 achieves the lowest daily cost of 4.85 RMB, which is about 5% lower than Case 2. More importantly, the PV utilization rate in Case 1 reaches 88%, significantly higher than the 70% in Case 2. This is because battery energy storage systems capture excess solar generation for later use, reducing curtailment and reliance on grid imports. Case 3, which lacks PV generation, relies entirely on grid purchases and batteries; its cost is the highest despite using off-peak charging. The absence of PV makes the system heavily dependent on grid price arbitrage.
The value of battery energy storage systems becomes even more pronounced under adverse weather conditions or grid disturbances. For instance, during a cloudy day with 50% less solar irradiation, the PV-only system (Case 2) would face severe shortages, potentially requiring significant grid purchases at high prices. In contrast, the system with battery energy storage systems (Case 1) can rely on stored energy to smooth out the variability. I performed a sensitivity analysis on the cost of battery energy storage systems by varying the cycling cost \(\rho_B\) from 0.05 to 0.30 RMB/kWh. The total cost of Case 1 increases only modestly (from 4.60 to 5.20 RMB) because the optimization inherently limits unprofitable cycling.
The following table summarizes the state of charge transitions and key power flows for a typical day in Case 1:
| Hour | Load (kW) | PV (kW) | Grid Purchase (kW) | Battery Charge (kW) | Battery Discharge (kW) | Grid Sale (kW) | SOC |
|---|---|---|---|---|---|---|---|
| 1 | 0.8 | 0.0 | 0.8 | 0.0 | 0.0 | 0.0 | 0.60 |
| 5 | 1.0 | 0.0 | 0.0 | 1.0 | 0.0 | 0.0 | 0.65 |
| 10 | 2.5 | 4.0 | 0.0 | 1.5 | 0.0 | 0.0 | 0.85 |
| 14 | 3.0 | 3.5 | 0.0 | 0.5 | 0.0 | 0.0 | 0.88 |
| 18 | 4.0 | 0.5 | 0.0 | 0.0 | 3.5 | 0.0 | 0.70 |
| 22 | 2.0 | 0.0 | 1.0 | 0.0 | 1.0 | 0.0 | 0.62 |
The data clearly show that battery energy storage systems are charged during periods of low demand or excess PV generation and discharged during evening peak hours. The SOC never violates the defined limits, ensuring long battery life.
Conclusion
In this study, I have developed a comprehensive optimization model for residential grid-connected photovoltaic systems with battery energy storage systems. By explicitly including the cycling cost of battery energy storage systems in the objective function, the model produces cost-effective dispatch schedules that respect technical constraints. Simulation results demonstrate that the integration of battery energy storage systems improves PV self-consumption from 70% to 88% and reduces daily operational cost by about 5% compared to a PV-only system. Moreover, the system gains operational independence and resilience against grid fluctuations and adverse weather. The proposed framework can assist homeowners and utilities in planning and operating distributed energy resources. Future work will extend the model to include multiple homes, electric vehicles, and more sophisticated battery aging models to further optimize the performance of battery energy storage systems in modern smart grids.
