*3.1. Objective Function*

In this paper, the most economical price is used as the objective function in the independent wind, solar, and hydrogen storage microgrid.

Objective function 1 includes: In the hydrogen-containing composite energy storage system, investment and recovery costs are considered to achieve the best economic benefits. In this paper, the objective function of minimizing the integrated operating cost of the system can be expressed as:

*C*<sup>T</sup> is the system's total operation cost, composed of each piece of equipment's investment and operation cost. Each piece of equipment is comprised of wind turbines, photovoltaics, batteries, and hydrogen storage, and their installation cost, replacement cost, in addition to operation and maintenance cost together constitute the operating cost of the investment [24].

$$\mathbf{C}\_{\mathrm{T}} = \min \{ \mathbf{C}\_{IN} + \mathbf{C}\_{RE} + \mathbf{C}\_{OM} \} \tag{10}$$

where: *C*<sup>T</sup> is the total operating cost of the system; *CIN* is the installed cost of the equipment; *CRE* is the replacement cost of the equipment; and *COM* is the operation and maintenance cost of the equipment.

*CIN* represents the installed cost for the equipment, which can be expressed as

$$\mathbb{C}\_{IN} = QP\_{IN} \frac{r(1+r)^m}{(1+r)^m - 1} \tag{11}$$

where: *CIN* is the installed cost of the equipment; *Q* is the rated capacity of the equipment; *PIN* is the unit installed cost of the equipment; *r* is the discount rate of equipment; and *m* is the service life of the equipment.

*CRE* as replacement cost for devices, which can be expressed as

$$\mathbb{C}\_{RE} = QP\_{RE} \frac{r(1+r)^m}{\left(1+r\right)^m - 1} \tag{12}$$

where: *CRE* is the replacement cost of the equipment; *Q* is the rated capacity of the equipment; *PRE* is the unit replacement cost of equipment; *r* is the discount rate of equipment; and *m* is the service life of the equipment.

*COM* is the operation and maintenance cost for equipment, which can be expressed as

$$\mathcal{L}\_{OM} = \lambda QP \tag{13}$$

where: *COM* is the operation and maintenance cost of the equipment; *Q* is the rated capacity of the equipment; *P* is the unit cost of equipment; and *λ* is the ratio of the operation and maintenance cost of each equipment to the total cost of each equipment.

Objective function 2 can restrain the power fluctuation and build an optimal configuration model of a microgrid, including the wind–hydrogen storage as well as the energy storage system formed by the battery, which can be expressed as follows:

$$E\_A = E\_{\rm PV} + E\_{\rm W} + E\_{\rm Li} \tag{14}$$

where: *E*<sup>A</sup> is the sum capacity for energy storage of wind and solar batteries. Because the battery has the function of charging and discharging, *E*<sup>A</sup> has a maximum and minimum value.

$$
\min E\_A \le E\_A \le \max E\_A \tag{15}
$$

Hydrogen storage system discharge:

$$E\_A + E\_{\rm H\_2} = E\_\mathbf{L} \tag{16}$$

Charging (hydrogen storage) of hydrogen energy storage system:

$$E\_A = E\_{\rm H\_2} + E\_\mathbf{L} \tag{17}$$

where: *E*H2 is the energy storage capacity of the hydrogen energy storage system; and *E*<sup>L</sup> is the total capacity of the load.

Objective function 3 for the wind–solar hydrogen storage-independent microgrid, due to many external influences, after increasing the energy storage system, cannot completely guarantee the reliability of the system power supply [25]. The critical index of load shortage can refer to the power fluctuation problem. When the load is short of electricity, the system is more stable and reliable, and vice versa. Figure 3 shows the load power shortage operation flow in the wind–solar hydrogen storage microgrid system. *Elps* shows a power shortage of the load, which can be expressed as

$$\,\_{L}f\_{L} = \sum\_{k=1}^{n} E\_{lps}(k) / \sum\_{k=1}^{n} E\_{L}(k) \tag{18}$$

When power generation from wind and solar meets the load requirements, when Δ*E* > 0, power shortage *Elps* = 0, and the Δ*E* is judged, and different charging combination devices are selected. When Δ*E* is greater than or equal to the max range between the battery and hydrogen storage capacity, the maximum value of the battery and hydrogen storage is used for charging; When Δ*E* is greater than the maximum range of the battery capacity, the maximum value of the battery is used to charge, and the remaining electricity is used to charge the hydrogen storage. When Δ*E* exceeds the upper range of the hydrogen storage capacity, the maximum amount in hydrogen storage is used for charging. When Δ*E* becomes less than the maximum range of capacity of hydrogen storage, hydrogen storage is used for charging.

**Figure 3.** Operation flow chart of load power shortage.

When the amount of wind–solar power generation satisfies the load requirement, that is, Δ*E* < 0, the wind–solar power generation is insufficient, so it is necessary to discharge the stored power to supplement the shortage of the system, judge Δ*E*, and choose different discharge combination distribution methods. When −Δ*E* is greater than or equal to the maximum range of the storage battery and hydrogen storage capacity, the maximum value of storage battery and hydrogen storage capacity is used for discharge. When −Δ*E* is greater than the maximum range of the battery capacity, the maximum value of the battery is employed for discharge, and the balance of the power is used to discharge on hydrogen energy storage. When −Δ*E* is greater than the maximum range of the hydrogen storage capacity, the maximum value of hydrogen storage is used for discharge. When −Δ*E* is less than the maximum range of hydrogen storage capacity, hydrogen storage is used for discharge.

#### *3.2. Constraints*

(1) Capacity constraints of hydrogen storage equipment:

$$V\_{\min} \le V \le V\_{\max} \tag{19}$$

where: *V*min and *V*max are the minimum and maximum capacities of the hydrogen storage tank.

(2) Capacity constraints of hydrogen storage equipment:

$$SOC \in [0, 1] \tag{20}$$

where: *SOC* is the operating state of charge in the energy storage system.

(3) Power load constraint:

$$P\_{\rm L} = P\_{\rm W} + P\_{\rm PV} + P\_{\rm H\_2} + P\_{\rm L.i} \tag{21}$$

where: *PL* is the power load of the system, kW.

(4) Energy waste rate constraint:

Excess power is generated in the system when the power generated in the system is greater than the load demand in the system and the maximum energy stored in the system, resulting in wasted energy. This is because the capacity allocation is unreasonable, and the power generation unit is configured with excessive output. When the system energy waste rate is less, the system capacity allocation is more reasonable, which can significantly reduce the waste of resources.

$$f\_{\mathcal{L}} < f\_{\text{set}} \tag{22}$$

where: *fset* is the control range of the energy waste efficiency of the system for a setting of 0.5.

To solve the multi-objective function problem, fuzzy mathematics is used in this paper. In most cases, the objective functions may affect each other, so it is not easy to achieve simultaneous optimization. The sub-objective optimization and multi-objective are solved by fuzzy mathematics. Under the condition of satisfying all constraints, each objective function is fuzzified, and the objective function is solved based on fuzzy statistics by taking the maximum value according to the affiliation function, and the optimal solution is obtained.

In this paper, the membership function of the distributed function of half Γ decline is

$$u\_k(t) = \begin{cases} 1, & F\_k(t) \le F\_{k\text{min}}(t) \\ \exp(\frac{F\_{k\text{min}}(t) - F\_k(t)}{F\_{k\text{min}}(t)}), & F\_k(t) > F\_{k\text{min}}(t) \end{cases} \tag{23}$$

where: *Fkmin(t)* is the minimum value of the single objective function *Fk(t)* under the constraint conditions.

Under the principle of maximum affiliation, the fuzzy multi-objective optimization problem is converted into a nonlinear but targeted optimization issue, and the multiobjective function solving model becomes

$$\max u(t) = \begin{cases} u(t) \le u\_1(t) \\ u(t) \le u\_2(t) \\ u(t) \le u\_3(t) \end{cases} \tag{24}$$

where: *u*(*t*), *u*1(*t*), *u*2(*t*), and *u*3(*t*) are, respectively, the satisfaction of fuzzy optimization, the satisfaction of system total operation cost, the satisfaction of power fluctuation, and the satisfaction of load power shortage.
