The following subsections show the modeling carried out to estimate the recharges in the MG and the generations coming from WTs and PVSs, the BESS wear model is detailed, and later the algorithm developed to optimize energy management in the MG is presented.
3.1. EVFCS Usage Modeling
Forecasting and analyzing the demand for EV charging on highways faces significant challenges, as it relies on several external and unpredictable factors, such as mobility patterns, seasonality, weather, and human behavior. To address these uncertainties, several models have been developed, including approaches based on statistical data, which learn from historical usage patterns, traffic surveys, and vehicle flow counts, among other data.
In [
22], a methodology is presented that models typical vehicle usage profiles in Brazil, categorized according to the types of trips undertaken, enabling the estimation of charging demand. In turn, study [
23] builds upon these typical usage profiles for regular users and complements the analysis by including occasional users, modeled through simulations based on the Monte Carlo method. However, both approaches are focused on charging in residential contexts and parking lots, and do not consider the specificities of charging behavior on highways, which requires a different analysis due to its unique characteristics and greater variability.
In the context of highways, two possible alternatives can be highlighted. The first is intended for initial EVFCS operations, for which a consolidated history of recharging data is not yet available. The second leverages observed patterns in recharging behavior, such as energy consumption, recharge duration, and connection time. Therefore, at first, the methodology developed in [
24] should be used, since there is no history of recharges. The daily capacity behavior of the establishment, the typical variations in flow on the highway, the market share of EVs, and the distribution of the battery capacities of the EVs sold serve as a basis for estimating recharging events and then the EVFCS usage pattern [
24].
As a second option, when the user’s behavior is already known, the EVFCS demand curve can be obtained from the statistics of their recharge history. This is a more attractive option and it will be used in this work. The algorithm developed follows the following step-by-step list, which is also illustrated in
Figure 2:
Load and Clear Data: Organize historical data.
Filter Relevant Data: Eliminate database errors, erroneous data, and outliers.
Analyze Trends: Identify historical patterns.
Generate Usage Profile: Create probabilistic models.
Simulate Scenarios: Generate daily recharge distributions based on historical patterns.
Preview Results: Show the simulated and average curves.
Export Data: Save results for integration with other systems.
Figure 3 shows a daily recharge profile obtained by following the process described above. This profile was generated from historical recharge data, which were organized, filtered, and analyzed to identify patterns of behavior. Subsequently, probabilistic modeling was used to create representative distributions of the characteristics of the recharges, such as their duration, energy consumed, and start times. Based on these distributions, daily scenarios were simulated that reflect the typical use of an EVFCS. Finally, the results were viewed and exported for integration into the EMS algorithm.
3.2. Wind Generation Modeling
The use of wind kinetics for the generation of electricity depends on factors such as the wind speed; turbine sweep area; characteristics of the installation site, such as soil roughness and altitude; and the construction characteristics of the WT [
25,
26,
27].
There are different types of models used for wind generation forecasting. The main ones used include physical, statistical, and hybrid models. Physical models are based on the principles of fluid mechanics and the technical characteristics of the turbines, such as the power curve and the geometry of the blades, and are fed meteorological data, such as wind speed and direction, obtained from numerical forecasts or local measurements [
28,
29].
Statistical models, on the other hand, use methods such as linear regression and time series to identify historical patterns, offering quick solutions but with limitations in scenarios of high variability. Hybrid models combine physical and statistical approaches, using machine learning techniques to capture the complex relationships between the variables involved [
28,
29]. The choice of model depends on accuracy requirements, time horizon, and data availability, with physical models standing out for their robustness when fed with detailed weather forecasts.
Deterministically, it is possible to calculate the mechanical power available in a wind turbine using Equation (
1):
where
is the mechanical power of the turbine (W, kW, or MW),
is the air density (kg/m
3),
is the power coefficient of the turbine or Betz limit,
A is the rotor area (m
2), and
is the velocity of the wind approaching the turbine (m/s). The air density is approximately 1.225 kg/m
3 under standard temperature and pressure conditions (1 atm, 15.56 °C, at sea level). References [
25,
30] highlight that it is possible to estimate the air density based on the altitude of a location, when necessary. The higher the altitude, the more rarefied the air becomes, leading to a lower density [
25,
30].
Consequently, the electrical power generated by a WT is given by Equation (
2):
where
is the electrical power delivered (W, kW, or MW) and
is the total efficiency of the wind turbine system, including components such as the generator, gearbox, mechanical losses, and electrical losses [
25].
It is also possible to calculate the power generated by the wind turbine through the turbine power curve provided by the manufacturer from tests. This curve relates the output power generated to the wind speed incident on the turbine blades.
Figure 4 shows a power curve that is a function of wind speed for a 30 kVA WT.
Wind power generation is only possible above a minimum wind speed (cut-in speed) and varies with the wind speed and turbine characteristics until reaching the cut-out speed, at which point the turbine must be shut down. The wind speed at the turbine blades must be adjusted, as API data typically provide wind speeds measured at 10 m above the ground. The Hellman Law is widely used in engineering and meteorology to extrapolate wind speeds from a reference height
to a height
z, considering the properties of the terrain and the logarithmic wind profile. This law provides a practical way of estimating wind speeds at different heights based on terrain roughness [
27,
31]. The basic formula of the Hellman Law is expressed in Equation (
3).
In Equation (
3),
represents the wind speed at height
z (in m/s), while
is the wind speed at the reference height
(in m/s). The variable
z denotes the height at which the wind speed is to be extrapolated (in meters), and
is the reference height, where the wind speed is already known (in meters). The exponent
depends on the roughness of the terrain and is an empirical parameter that varies with the type of terrain and atmospheric conditions.
The value of typically varies depending on the roughness of the terrain. For example, for water surfaces or very flat terrains, . In rural areas or regions with low vegetation, . In suburban areas or regions with medium-sized constructions, . Finally, for urban areas or regions with tall buildings, . The Hellman Law is a practical tool for estimating wind speeds at various heights. However, its accuracy depends on the assumption of a constant wind profile and the consistency of terrain roughness. Abrupt changes in terrain or atmospheric instability can reduce the precision of this method.
Via a weather API, wind speed forecasts are obtained for the next day. Data interpolation manipulations are performed every 5 min, and the wind speed is corrected, via Hellman’s Law, to the height of the wind turbine. Thus, it is possible to calculate the generation of power, as shown in the diagram in
Figure 5.
3.3. PV Generation Modeling
Photovoltaic generation forecasting methods are widely used to optimize the use of solar energy and are divided into three main approaches: those based on physical models, statistical methods, and artificial intelligence techniques. Physical models use meteorological information, such as solar radiation and ambient temperature, and the characteristics of photovoltaic systems to estimate energy generation based on physical principles. Statistical methods, on the other hand, apply time series and mathematical models, such as linear regression and ARIMA, to identify historical patterns and make short-term predictions [
32,
33,
34].
On the other hand, artificial intelligence techniques such as Artificial Neural Networks (ANNs), machine learning, and hybrid algorithms offer more accurate forecasts by learning from large volumes of historical and weather data. The combination of physical models of the panels with weather forecast data has significant advantages, such as greater accuracy when incorporating real-time weather conditions or day-ahead forecasts and adaptability to local variations, allowing you to optimize energy generation and plan more efficiently and reliably [
32,
33,
34].
The calculation of photovoltaic generation is based on the nominal power of the module, the rate of the reduction in the efficiency of the photovoltaic module due to degradation, solar irradiation at the installation site, and the temperature of the module, as shown in Equation (
4) [
33,
35].
where
is the output power of the photovoltaic module (kW) at hour
h,
is the nominal power of the photovoltaic module under standard test conditions (kW);
is the efficiency reduction factor of the photovoltaic module due to degradation (%);
is the total irradiance on the surface of the Earth (W/m
2) at hour
h;
is the irradiance under standard test conditions, assumed to be 1000 W/m
2;
is the power temperature coefficient (%/°C);
is the photovoltaic panel temperature (°C) at hour
h; and
is the photovoltaic panel’s temperature under standard test conditions, assumed to be 25 °C [
33]. All parameters under standard test conditions (STCs) correspond to those tested by manufacturers in laboratory conditions.
The modeling of the cell temperature in the photovoltaic panel is directly related to the ambient temperature and solar irradiance. Equation (
5) presents this approach, where
is the ambient temperature measured at hour
h,
is the hourly irradiance, and NOCT is the nominal operating cell temperature of the photovoltaic panel [
36,
37].
Finally, the output power per photovoltaic panel was estimated using Equation (
4); the total power generated is proportional to the power of each panel and the number of panels installed,
, as shown in Equation (
6). It is worth mentioning that the photovoltaic generation model considers panels with the same generation capacity, positioned similarly, and under similar conditions, accounting for shading and surface states.
This mathematical approach aligns with the methodology employed by Homer software, version 3.14.2, to calculate a plant’s photovoltaic generation.
can be inserted into the software as a text file with hourly data, generated from Typical Meteorological Year (TMY) data for the location. In the absence of such data, Homer uses the Graham algorithm to generate synthetic irradiance series [
38]. This algorithm produces hourly irradiance values based on the latitude and monthly average irradiance values. Therefore, it allows for energy estimates over long periods.
However, in the short term, the data obtained via a weather API for the next day ensures better accuracy and precision in estimating the photovoltaic generation profile. The sequence of steps followed is shown in
Figure 6. Since the data come in every hour, some manipulations and interpolations are required to obtain a daily profile with 5 min discretization, which will be the resolution used in the optimization algorithm.
3.4. BESS Degradation Cost Model
A BESS is costly, especially considering their limited lifespan, as batteries can only endure a finite number of charge–discharge cycles before reaching their End-of-Life (EoL), typically defined as a 20–30% reduction in their State of Health (SoH) [
39]. The degradation of Li-ion batteries occurs as a function of variables such as temperature, the calendar effect, the intensity of discharges, and applied currents, among other factors, according to [
40,
41,
42,
43]. Among the available technologies, lithium-ion batteries (LIBs) and lead-acid batteries are predominant in modern BESS applications.
Various models are used in the literature to predict and mitigate battery degradation. Empirical and semi-empirical models are widely used due to their simplicity and ability to provide quick estimates based on experimental data. These models correlate the number of charge–discharge cycles with the depth of the discharge and temperature. This work uses the modeling presented by [
9], which updates the empirical battery wear model proposed by [
44] by considering the battery’s wear as a function of the intensity of the discharge. So, the total cycles of a battery are reduced when it is subjected to a high
DoD.
In the literature, some functions have been proposed that relate the Achievable Cycle Count (ACC) to the
DoD. Since life cycle data are often presented at discrete
DoD levels, interpolation is useful. To achieve this, a generic function
can be defined in various formats to fit different wear curves. In [
44], the reciprocal function
is proposed, where
and
are curve-fitting coefficients, but it has limitations in its universality. Alternative formats, such as the exponential
and logarithmic
, also fit specific cases well but fail to generalize. To address this, a combined reciprocal and exponential model was proposed by [
9] for broader applicability, as shown in Equation (
7).
where
,
, and
are coefficients that can be obtained by methods such as least squares fitting and
d is the
DoD of the BESS. Considering the cost, capacity, and ACC vs.
DoD curve of the BESS, and performing the necessary mathematical manipulations, ref. [
9] derived a Normalized Wear Density Function,
, expressed in terms of the monetary cost per unit of energy transferred (typically BRL/kWh), as shown in Equation (
8). This formula allows you to calculate the density of wear as the
DoD varies.
where
is a modulating factor to account for temperature fluctuation, calculated as
, where
is the temperature of the battery in Celsius. The
is the BESS price (BRL),
M represents the BESS capacity (kWh), and
is the current
DoD of the BESS.
The average value of the wear density function is useful for assessing the cost–benefit of different battery models, as it considers not only price and capacity but also durability. The average value of Equation (
8) is calculated using Equation (
9):
Since
has nonlinear variation behavior as a function of the SoC, it is necessary to use a piecewise linearization algorithm to insert this variable into linear optimization problems [
45].
3.5. Proposed Optimization Algorithm
Our main objectives are an optimized power distribution between the grid and BESS, taking into account the utilization of locally produced renewable energy, and the reduction of operating costs. Therefore, the controllable power rate defines when the BESS charges or discharges energy. These are the decision variables for the optimization problem. This formulation was chosen for its maturity, the availability of such tools, and its fast and robust convergence to the global optimum.
A formal description of this optimization requires the definition of the following parameters and variables, as summarized in
Table 1.
The MG energy management problem involves the optimization of static storage discharge/charge events to meet the charging demands of EVs while reducing operating costs. In this sense, charging is preferred when it is cost-effective, and discharging is preferred when energy costs are high, given the variation in hourly electricity prices. The dispatch scheduling problem is approached using time windows, so that the total available period
for discharging/charging during the day is uniformly distributed over a sample interval
within
intervals, as in Equation (
10).
Note that the problem only comprises the unidirectional charging of EVs and bidirectional discharging/charging of the BESS. Thus, the EMS should preferentially dispatch power from the BESS during periods of peak tariff, while prioritizing dispatch from the grid when the tariff is cheaper. It is important to emphasize that the energy coming from the PVS and WT is constantly used by the MG in the form of a constraint. It is more efficient to use the generated energy for charging EVs directly, without losses from its conversion to the BESS. When there is no charging of EVs, the energy is injected into the grid by the net metering system or it is stored in the BESS.
The objective function (OF) consists of scheduling the discharging/charging of the BESS to minimize the costs of buying, selling, and storing energy, according to Equation (
11). The optimal dispatch of power between local renewable sources, the BESS, and the grid is determined at each time instant
j to achieve the objective and ensure correct MG operation. When energy is sold to the grid, the cost considered is the loss in the value of the kilowatt-hour due to the net metering discount.
The constraints of the optimization problem comprise (a) energy balance, (b) the SoC of the BESS, and (c) BESS power. An energy balance constraint is set to ensure that the load on the MG is equivalent to the energy consumed, as shown in Equation (
12).
The loads are the total power required to charge the connected EVs () and the power required to charge the BESS (). Also, there is power injected into the grid (). As the energy sources, we have photovoltaic generation (), wind generation (), and the BESS’s discharging power (). There is also the amount of energy purchased from the grid () available as a source.
Full participation of photovoltaic and wind generation in the form of an energy balance constraint is assumed. In this way, the conversion of energy to the battery is prevented by using it in the same instant of its generation through EV connections, bypassing possible efficiency losses. In the case of highway fast charging stations, the demand of the EVs is not controllable, so, like local renewable generation, it cannot be visualized in the objective function, but it is present in this energy balance constraint.
Note that power available from the photovoltaic (
) and wind (
) systems is the estimated at each time instant
j. As already described, daily wind and photovoltaic generation profiles are obtained from physical models fed with wind and irradiance data obtained via weather forecast APIs [
20].
The maximum power requested and supplied to the grid (
) is constrained as a tool to prevent the overload of the distribution transformer at any time instant
j. This restriction can be fixed or variable in time to limit energy purchases in periods of higher tariffs, depending on the tariff structure present. In this case, a fixed value is considered, since the ToU adopted for this case study bills only for the amount of energy used and not the power. Furthermore, a binary power exchange logic is formulated to prohibit the scenario of energy purchase and its injection at the same instant in time
j, according to Equations (
13) and (
14).
where
is a binary auxiliary parameter used to indicate whether energy should be purchased or injected into the grid, according to Equation (
15).
The BESS can be charged, discharged, or remain inactive at each time step. Thus, BESS scheduling is decomposed into two variables, one for charging (
) and one for discharging (
), for
. Both discharging/charging powers are controllable and constrained by their upper limits, i.e.,
and
, respectively, according to Equations (
16) and (
17). The power exchange logic is implemented to make it impossible to charge and discharge simultaneously, and takes the form of Equation (
18).
where
is a binary auxiliary parameter used to indicate when the BESS is charged or discharged, according to Equation (
18).
At the beginning of each day, the initial BESS SoC
is computed according to Equation (
19).
As a guarantee that there will always be an amount of power remaining in the BESS, to maintain the system’s operation offline and provide emergency recharges, in the problem the initial SoC, , is set to at least 50%. Likewise, at the end of the simulation day, the final SoC is required to be at least equal to 50%, i.e., .
According to Equation (
20), the BESS SoC at the beginning of the day should always be equal to or greater than the initial
. Thus, 288 is the total
j periods in a day, and
is the total days in the chosen period (7 in a week, 30 in a month, and 365 in a year). Obviously, for simulations of only one day, this restriction can be disregarded or the value of
can be set to 1.
The current SoC (
) at any time instant
j, denoted by Equation (
21), can be obtained by considering the following:
The SoC at the previous time step ();
The increase in the SoC as a result of charging;
The SoC’s decrease due to discharging.
where
is the discharge/charge efficiency;
is the battery’s capacity, in kWh; and
is the time sample, in hours. The SoC is restricted at its extreme limits to prevent overcharging and deep discharging by use of Equation (
22).
As the BESS serves as a power source in the MG, it must contain a minimum amount of energy to provide power to EVs. To guarantee this minimum requirement for the next day, the BESS’s SoC must satisfy a minimum threshold at the last time step of the current day’s scheduling, which is determined according to Equation (
23).
Another restriction that can be used refers to the maximum number of charge and discharge cycles that the BESS can complete during the period considered. In this way, it is possible to reduce the loss of the capacity of the BESS due to the wear of the system caused by excess cycles, as calculated in Equations (
24) and (
25).
where
is the maximum total number of charging cycles.
where
is the maximum total number of discharge cycles. These parameters can be useful when considering periods longer than 1 day of simulation. Thus, the operation of the BESS can be limited to a maximum number of charge and discharge cycles, defined by the owner of the MG.
To ensure efficient operation and preserve the life of the BESS, restrictions have been imposed that prevent abrupt changes between its loading and discharging states. These restrictions ensure that the BESS goes through a transition state, called idling, in which it performs neither loading nor unloading, before switching between these two modes of operation.
The first constraint prevents the BESS from switching directly from its discharging mode to its charging mode. In this case, if the system was discharging in the previous period (
), it cannot enter charging mode in the current period (
), and it is ensured that the charging state is zero (
). The constraint can be mathematically expressed as in Equation (
26).
Similarly, the second constraint prevents the BESS from switching directly from its charging mode to its discharging mode. Thus, if the system was charging in the previous period (
), it cannot enter discharging mode in the current period (
), and it is ensured that the discharging state is zero (
). This relationship is mathematically represented in Equation (
27).
These restrictions ensure that the BESS operates in a stable manner, avoiding behavior that could cause premature wear and damage to the system. In addition, this approach promotes a more controlled transition between operating modes, contributing to the reliability and efficiency of the system.
In addition to technical and operational constraints, other constraints may also be included in the model. Some restrictions defined by the authors are presented below to better personalize this study.
Restriction 1: This restriction ensures that the BESS will be charged only when there are no recharges in progress in the system. The inequality in Equation (
28) limits a surplus of DERs being used to charge the BESS, ensuring that this process occurs only in the absence of other recharges. This restriction prevents excessive energy being demanded from the grid at any one time.
Restriction 2: This restriction imposes a limit on the charge of the energy storage battery (BESS), ensuring that it does not exceed the instantaneous sum of the power generated by the wind and photovoltaic systems at the instant
j. This condition is necessary to ensure that BESS charging only uses the energy available from the DERs, avoiding the use of external sources or the violation of the physical limits of the system, as Equation (
29) denotes.
Restriction 3: This restriction states that the discharge power of the BESS may not exceed the maximum charging power requested by electric vehicles at the instant
j. This limitation ensures that the BESS discharges only the energy necessary to meet instantaneous demand, avoiding overloading or wasting energy, while keeping the system compliant with operational requirements, as shown in Equation (
30).
Restriction 4: This restriction limits the maximum power that can be injected into the electricity grid, ensuring that this power does not exceed the sum of the distributed generation from wind and photovoltaic sources at the instant
j. This formulation allows for dynamically controlling the power injected into the grid, ensuring that the injection is limited or allowed according to the availability of distributed generation, as shown in Equation (
31).
Restriction 5: This restriction ensures that at least 80% of the energy generated by DERs (wind and photovoltaic) is consumed locally, limiting the injection of energy into the electricity grid to a maximum of 20% of the total generated, as shown in Equation (
32).
This restriction promotes the efficient use of locally generated energy, reducing dependence on the power grid and minimizing losses related to the transmission and distribution of energy. In addition, it is aligned with sustainable practices and incentives about the self-consumption of renewable energy.