2.2.1. Objective Functions
The energy management task under consideration seeks to jointly reduce the operational cost and environmental impact of the NMG by optimally allocating the demand among the available energy resources. Accordingly, the problem is formulated as a multi-objective optimization model comprising two conflicting objective functions, defined as follows:
The first objective function,
, quantifies the total operating cost incurred by the NMG over the entire daily simulation horizon. This cost component accounts for energy production from dispatchable units as well as power exchanges with the main grid, and it reflects the economic performance of the NMG under the considered operating conditions:
where
N is the number of MGs in the NMG,
T is the total number of discrete time instants in the optimization horizon,
and
are, respectively, the purchased and sold powers from/to the electricity grid in kW by the
nth MG at time instant
t.
and
represent the buying and selling price of electricity from/to the grid in
$/kWh at time instant t, respectively.
and
represent the state of buying and selling power from/to the electricity grid, respectively, and their values are either 0 or 1.
is the part of the load or demand not supplied at each time instant t.
M is a big number that is considered a penalty factor. This second term reflects the priority assigned to demand satisfaction during abnormal operating conditions, where ensuring load supply becomes the dominant objective.
is the operational cost of the
nth dispatchable unit (DG in this study) in
$, which is modeled as a quadratic function as follows [
41]:
where (3),
is the output power of the
nth DG in kW at time instant
t. The values of
and
are set to 0, 0.055, and 0, respectively, according to the available data from Table 25 of reference [
62].
The second objective is to minimize the total emission of the NMG, which is calculated using the following equation [
41]:
where
denotes the emission factor (kg/kWh) associated with electricity generated by the
nth DG at time
t, while
represents the emission coefficient corresponding to each kWh of power imported from the electricity grid.
It should be mentioned that when the power is exported from an MG to the main grid, the associated grid emission term is set to zero, as no emissions are attributed to exported energy. Furthermore, PV units and BESSs are assumed to operate without direct emissions.
2.2.2. Constraints
The energy management problem of the NMG is constrained by a set of technical and operational limitations, including generation capacity bounds of dispatchable units, limits on power exchange with the main grid, battery charging and discharging rate restrictions, state-of-charge constraints, and nodal power balance requirements.
DG constraints
The constraint related to the power limits of DGs is as follows, in which
and
are the minimum and the maximum allowable power of the DG unit in the
nth MG. It is worth mentioning that it is assumed that all DG units in an MG are assumed to be of the same type and therefore are subjected to the same constraints.
Power exchange constraints
Considering the thermal capacity of the power lines, there is a limit to the exchangeable power between MGs in the NMG (
) and between each MG and the main electricity grid as represented in Equations (6)–(10).
where
and
are the minimum and the maximum power that the
nth MG can purchase from the electricity grid.
and
denote the minimum and the maximum power that the
nth MG can sell to the electricity grid.
and
represent the state of buying and selling power from/to the electricity grid, respectively, and their values are either 0 or 1.
and
define the state of flowing power between the
nth and the
mth MG, and their values are either 0 or 1.
Constraints (6) and (7) define the admissible range of power that the nth MG can purchase from or sell to the main electricity grid. These bounds reflect the thermal capacity of the point of common coupling (PCC), contractual agreements with the utility, and protection limits of power electronic interfaces. Enforcing both minimum and maximum limits prevents unrealistically small or excessively large power exchanges that would violate technical constraints or market participation rules. Constraint (8) limits the power transferred between the nth and the mth MGs based on the thermal rating of the interconnecting lines and converters. This constraint ensures that power sharing within the NMG remains within safe operating limits, preventing line overloads and maintaining system reliability.
Constraints (9) and (10) are introduced to ensure physical consistency and operational realism in the power exchange modeling. Constraint (9) enforces that the nth MG cannot simultaneously buy power from and sell power to the main electricity grid at the same time step . Since and are binary decision variables; this constraint guarantees a mutually exclusive operation, either importing power, exporting power, or remaining idle. This reflects the physical and market-based reality of grid-connected MGs and prevents infeasible or economically irrational solutions, such as simultaneous buying and selling driven by price differences within the same time interval.
Similarly, constraint (10) ensures that power flow between the nth and the mth MGs is unidirectional at each time step. That is, power can flow either from the nth MG to the mth MG or from to , but not in both directions simultaneously. This constraint avoids physically meaningless bidirectional flows within a single time interval and eliminates artificial circulation of power that could otherwise be exploited by the optimization algorithm without delivering any practical benefit.
Together, these constraints ensure that all power exchange decisions generated by the optimization are physically feasible, operationally safe, and consistent with real-world grid interconnection and MG-to-MG power transfer capabilities.
Battery constraints
The battery constraints are related to the charging and discharging power limits, and the state of charge (SOC) of the battery as follows:
where
is the battery capacity,
is battery C-Rate that limits the battery’s charging and discharging rates.
and
represent the state of charging and discharging of batteries, respectively, and their values are either 0 or 1.
and
are the stored energy levels of the
nth battery at hour
t and
t − 1, respectively,
and
are the minimum and the maximum allowable stored energy levels in the battery, respectively, and
and
are, respectively, the
nth battery charging and discharging efficiencies.
Constraints (11) and (12) represent charging and discharging power limits. These constraints limit the maximum charging and discharging power of the battery based on its rated capacity and C-rate. They represent the electrochemical and thermal limitations of battery cells and power electronic converters, preventing unrealistically fast charging or discharging that could degrade the battery or violate safety limits.
Constraint (13) represents the mutual exclusivity of charging and discharging. This constraint ensures that the battery cannot charge and discharge simultaneously at the same time step. Since and are binary variables, the battery can operate in only one mode—charging, discharging, or idle—reflecting its physical operating behavior and preventing non-physical energy circulation.
Constraint (14) restricts the battery SOC within safe operating limits. The lower bound prevents deep discharge, which accelerates battery aging and may damage cells, while the upper bound avoids overcharging, ensuring safety and prolonging battery lifetime.
The SOC evolution Equation (15) enforces energy conservation within the battery by linking the SOC at consecutive time steps. Charging and discharging efficiencies are explicitly included to account for conversion losses, ensuring that the stored energy evolution accurately reflects real battery behavior.
Together, these constraints guarantee that the battery operation remains safe, realistic, and consistent with physical and electrochemical characteristics, while allowing the optimization to exploit storage flexibility for cost and emission reduction.
Power balance constraint:
According to this constraint, the total supplying power must satisfy the total power demand of each MG in the NMG system at each time instant, as expressed in the following.
The power balance constraint ensures that, at each time instant , the total power supplied to the nth MG equals the total power consumed within that MG. This constraint represents the fundamental law of energy conservation and is essential for guaranteeing the physically feasible operation of the NMG.
On the left-hand side, the equation accounts for all power sources supplying the MG, including dispatchable DG units, non-dispatchable PV generation, battery discharging, power purchased from the main grid, and power received from neighboring MGs. On the right-hand side, all power sinks are represented, including local load demand, battery charging, power sold to the main grid, and power shared with other MGs. The term allows for load curtailment when necessary; however, under normal operating conditions, its value is driven to zero due to the high penalty imposed in the objective function.
This constraint guarantees that every unit of generated, imported, or discharged energy is properly allocated to consumption, storage, export, or sharing, thereby preventing non-physical solutions such as power creation or loss within the optimization. Consequently, the power balance constraint forms the core of the energy management model and ensures realistic, reliable, and operationally consistent scheduling of all resources in the NMG.
where
and
are the charging and discharging power of the battery in the
nth MG in kW,
is the estimated available power of PV units of the
nth MG in kW, and
is the load of each MG in kW at time instant
t.
shows the total sent power from the
nth to other MGs in the NMG, while
represents the total flowing power from other MGs in the NMG to the
nth MG.
represents the flowing power from the nth MG to the mth MG in NMG in kW while denotes the flowing power from the mth MG to the nth MG in NMG in kW at time instant t. and define the state of flowing power between the nth and the mth MG, and their values are either 0 or 1.