Next Article in Journal
Adaptation of Inductive Power Transfer to Small Household Appliances That Can Operate on Induction Heating Cooktops: Wireless Electric Kettle
Next Article in Special Issue
Site Selection of Solar Power Plants Using Hybrid MCDM Models: A Case Study in Indonesia
Previous Article in Journal
Mitigating Market Power and Promoting Competition in Electricity Markets through a Preventive Approach: The Role of Forward Contracts
Previous Article in Special Issue
Algorithm for Energy Resource Selection Using Priority Degree-Based Aggregation Operators with Generalized Orthopair Fuzzy Information and Aczel–Alsina Aggregation Operators
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:

Battery Energy Management System Using Edge-Driven Fuzzy Logic

Division of Building Technology and Design, Department of Civil and Architectural Engineering, KTH Royal Institute of Technology, 11428 Stockholm, Sweden
Institute of Energy System Technology, Offenburg University of Applied Sciences, 77652 Offenburg, Germany
Uponor AB, Hackstavägen 1, 72132 Västerås, Sweden
Author to whom correspondence should be addressed.
Energies 2023, 16(8), 3539;
Submission received: 1 April 2023 / Revised: 14 April 2023 / Accepted: 18 April 2023 / Published: 19 April 2023
(This article belongs to the Special Issue Fuzzy Decision Support Systems for Efficient Energy Management)


Building energy management systems (BEMSs), dedicated to sustainable buildings, may have additional duties, such as hosting efficient energy management systems (EMSs) algorithms. This duty can become crucial when operating renewable energy sources (RES) and eventual electric energy storage systems (ESSs). Sophisticated EMS approaches that aim to manage RES and ESSs in real time may need high computing capabilities that BEMSs typically cannot provide. This article addresses and validates a fuzzy logic-based EMS for the optimal management of photovoltaic (PV) systems with lead-acid ESSs using an edge computing technology. The proposed method is tested on a real smart grid prototype in comparison with a classical rule-based EMS for different weather conditions. The goal is to investigate the efficacy of islanding the building local network as a control command, along with ESS power control. The results show the implementation feasibility and performance of the fuzzy algorithm in the optimal management of ESSs in both operation modes: grid-connected and islanded modes.

1. Introduction

Energy consumption in the global building sector has dramatically increased due to population growth and rapid urbanization. The global growth rate of electricity in buildings is about 2.5% per year, while the current global electricity use in the building sector is around 30% of the total final energy consumption and over 55% of the global electricity demand [1]. Accordingly, a significant rise in sustainable buildings has been noticed. Solar photovoltaics (PV) are among the most widely used renewable energy sources in buildings due to their zero operating noise and very low and ease-in maintenance [2,3]. However, PV systems heavily rely on energy storage systems (ESSs) to overcome their irregular power production nature. The most commonly adopted ESSs are electro-chemical batteries, due to their impact on the overall building energy management system (EMS) performance [4].
The need for energy flexibility in sustainable buildings is highly needed to reach an optimal power share between different distributed energy systems (DERs) in different operation conditions [5]. PV systems typically generate power according to the Maximum Power Point Tracking (MPPT) algorithm, which is usually implemented on all commercial PV inverters. Except for the curtailment function, PV inverters are commonly not controllable, and their operation point depends solely on weather conditions. In contrast to PV, ESSs can add high flexibility to the building local network. This may serve to provide a load peak shaving function [6] or primary frequency regulation function [7] or both [8]. ESSs can be integrated into the DC bus along with the PV system; in this case, the exchanged ESS power depends solely on the DC voltage regulation. However, AC-linked architecture has recently been preferred by many manufacturers due to some advantages, such as the ability to control the ESS independently from the PV system and to participate in grid frequency regulation [9]. In a residential building, the power demand side is mainly linked to the AC side of the energy hybrid system, with which the grid utility is also associated. A typical scenario is that the algebraic difference between PV generation and power demand is to be covered by a power combination of the ESS and the grid utility. In island mode, the ESS works as an energy buffer, trying to recover the PV surplus power, or as a secondary power source in higher peak demands; in this case, ESS is no longer controllable and can only be disconnected as a protection action in case of overcharging or over-discharging scenarios.
When it comes to EMS implementation, BEMS low-level controllers, such as programmable logic controllers (PLC), can host basic algorithms based on IF-THEN statements. Those algorithms operate the energy system based on predefined conditions. Such methods may not be able to drive the hybrid energy system optimally, as the control setpoints are selected manually. Recently, novel BEMS architectures have been aiming to push building owners or facility managers away from manually determining the different operational setpoints and give this mission to a higher supervisory layer, either using edge computing [10] or cloud computing technologies [11].
Fuzzy logic (FL) is a computing technique that can deal with information arising from computational perception and cognition, that is, information that is uncertain, imprecise, vague, partially true, or without sharp boundaries [12]. In energy management, the power of FL is its ability to act as an online decision-making tool that covers an infinity of operation conditions, e.g., whether the battery should be charged or discharged at a certain condition and at what rate. In this regard, fuzzy set theory offers a good resolution as a mathematical approach designed to model the vagueness and imprecision of a human cognitive process. In the case of energy systems, various FL-based approaches have been proposed and validated [13]. An intelligent multi-objective EMS for a microgrid is proposed and simulated in [14], in which FL is responsible for battery operation scheduling. The proposed method accomplished 1.35% and 5.76% cost savings and 2.96% and 6.1% of lower emissions compared to the heuristic flowchart and the conventional opportunity charging approaches, respectively. A similar approach is suggested and validated in [15] for the management of stand-alone wind turbines, which are PV/hydrogen/ESS hybrid systems. A total cost savings of 13% was achieved over a control state-based EMS in simulation. It has been noted in previous works that all FL-based EMS approaches take actions on the controllable energy generators/buffers in real time, either in stand-alone or grid-connected modes separately. Up to now, no FL approach has been designed to deal with both operation modes simultaneously. It has also been noticed that the most common way to validate FL approaches, as an EMS, was in the digital simulation stage only [16,17]. The authors of [18] validated a similar method for the energy management of a PV/Diesel generator/ESS hybrid ship based on experimental data issued from a BEMS; however, no real implementation was carried out. Moreover, to date, integration into an existing BEMS has not yet been investigated or validated.
This article addresses and validates a systematic approach to implementing a fuzzy EMS into a BEMS using edge computing technology. Along with the ESS charging and discharging control, the proposed FL-based energy manager uses the connectivity to the main grid utility as an additional control action. Therefore, the implemented fuzzy rules are designed with regard to the system constraints associated with both operation modes: grid-connected and island modes. The proposed method is hosted on an edge device, which is a Windows Personal Computer (PC), with which the communication with the BEMS low-level controller was established using a serial communication protocol. The remainder of this paper is organized into three main sections: Section 2 describes the proposed FL algorithm for PV/ESS management. In Section 3, the experimental validation setup is clarified, while Section 4 provides some results and discussions.

2. Materials and Methods

The proposed EMS is based on continuously performing control actions each cycle time after taking new measurement data. PV power supply data are collected, via Modbus protocol, from the PV inverter; batteries’ status data (SOC, voltage and current) and voltage/power data from DC and AC sides are collected with a similar protocol from the ESS inverter/charger, while power consumption data are collected from the energy meter. Collected data are stored in a local database after being processed by a PLC. Starting from this point, Sugeno fuzzy rules are responsible for finding out, in real time, the optimal values for the decision variables, which are the ESS current setpoint to be sent to the ESS inverter/charger and the connection/disconnection command to be sent to the main grid relay. A simplified diagram of the hybrid energy system, showing the role of the proposed EMS, is presented in Figure 1 (PLC and many other data processing auxiliaries are not displayed here for simplification).

2.1. Power Balance Equation

The power flow equation is formulated as below:
P L = η P V P P V + η B V B I B + α P g
where PL is the electric load power; P P V is the supplied PV power; V B and I B are the batteries bank voltage and current, respectively; P g is the exchanged grid power; α is the grid relay ( α ϵ [ 0,1 ] ); and η P V and η b are the efficiency of PV and the batteries bank system, respectively, including the power converters’ efficiencies.

2.2. Battery State of Charge Equation

ESS SOC is a key parameter that should be supervised continuously, and it is determined with the equation formulated below:
S O C ( t ) = S O C ( t 0 ) 100 . 1 C I B . d t
where SOC(t) is the actual battery SOC at time t in (%); SOC(t0) is the initial SOC at time t0 in (%); C is the battery nominal capacity in (Ah); and IB is the battery charge/discharge current in (A), which is obtained using Equation (3).
I B = P B V B
where PB is the algebraic value of the batteries’ power. To reduce the algorithm complexity, V B is chosen as constant all the time (48 V).

2.3. Fuzzy Logic Control Structure

As mentioned previously, the suggested FL energy manager uses real-time status data from the building local network to optimally adjust the power flow. In this article, three data inputs are required to build up optimal EMS decision variables:
  • Algebraic difference between PV power supply and building power demand (ΔP).
  • ESS SOC.
  • Dynamic electricity price (EP).
With this control framework, the power flow in the network, the energy storage constraints, and the energy cost hare considered by taking an infinity of possible operation scenarios, which is the fundamental advantage of using the fuzzy logic approach in this study.
The structure of fuzzy logic signal processing stages is summarized in Figure 2. The purpose of fuzzification is to encode to precision input values into fuzzy linguistic values. The measurement values are always crisp in general. Therefore, they have to be translated to proper terms of the corresponding linguistic variables, and this process is called fuzzification or coding input. Fuzzy inference is a method that interprets the values in the input variables and, based on some set of rules, assigns values to the output. In fuzzy logic, the truth of any statement becomes a matter of a degree between 0 and 1. Defuzzification is the process of obtaining a single number from the output of the aggregated fuzzy set. It is used to transfer fuzzy inference results into a crisp output. In other words, defuzzification is realized by a decision-making algorithm that selects the best crisp value based on a fuzzy set.
Different triangle and trapezoidal membership functions are chosen to interpret the input variables. Based on the fuzzy rules, the controller can adjust the power flow in the building’s local network using two parameters: the ESS current, which is controlled by the inverter/charging, and the external grid relay. Figure 3 shows a simplified structure of the proposed fuzzy controller, while Figure 4 displays the number and types of fuzzy membership functions of the input/output variables.
The fuzzy rules are designed for the following purposes:
  • Decreasing the cost of energy imported from the grid utility taking into consideration the hourly electricity price.
  • Maximizing the PV power share.
  • Charging the batteries from the grid when the electricity price is low and from the excess PV power when it is high; the latter option is feasible by opening the external relay.
  • Inject more power to the public grid when the electricity price is high.
  • Keep SOC between the two upper and lower allowable limits.
  • Maximize the use of PV power for load supply, especially when the power price is high.
  • Operate the microgrid independently of the electrical grid as much as the system constraints allow.
In this context, 45 rules are created to manage and monitor the power flow in the building hybrid system, including 18 rules for ESS charging mode, 18 rules for grid feeding mode, and 9 rules for island mode, as listed in Appendix A (Table A1). Maximizing self-consumption is targeted because the energy selling prices are always lower than the purchasing ones; therefore, it is valuable to benefit from the local renewable energies rather than selling them to the grid utility owner. For this purpose, the microgrid islanding mode is mainly targeted. Physically, this is possible thanks to an electric relay called “grid external relay,” which is already integrated in the ESS inverter/charger. This relay can connect the whole building’s local network to the grid utility as well as disconnect it.
Indeed, islanding the building microgrid can lead to serious damages to the building’s electric equipment in some situations, e.g., if a significant amount of extra PV power is locally supplied, this can lead to batteries overcharging in low power demand. Similarly, higher power demands cause an over-discharging scenario in the case of low PV supply. Luckily, power converter manufacturers for PV and battery systems are now taking these situations into consideration, i.e., the ESS inverter/charger is equipped with a frequency/voltage control mechanism that regulates the power fed to the local network according to the evolution of frequency and voltage at the connection point.
To show the FL energy manager response for different operation situations, Figure 5 displays the fuzzy surfaces generated based on the created rules and the variables membership functions. It is worth mentioning that the proposed FL energy manager cannot deliver exact Boolean values for the output R, which corresponds to the external grid relay command. Therefore, a rounding function is added at the corresponding output to fix this issue. The different command actions, which should be sent from the edge controller to the ESS inverter/charger using the FL algorithm, are displayed within the flowchart Figure A1 in Appendix B.

2.4. Constraints

The ESS operation limits are highly crucial when designing the fuzzy rules; in this context, two important parameters are to be considered when performing the control: the maximum operational power of the inverter/charger and the upper/lower limits of SOC, which are formulated in (4) and (5), respectively.
P max η B P B P max
S O C min S O C ( t ) 100 . P B Δ t V B C S O C max
where P max s the maximum allowed power supported by the ESS inverter/charger; SOCmin and SOCmax are the predefined minimum and maximum limits of ESS SOC, respectively; and ∆T is the cycling control time.
Note that, in island mode, the fuzzy controller is no longer able to control ESS current; in this case, the ESS operational point depends solely on the power balance in the local microgrid between PV generation and power demands. However, in island mode, the ESS current should be kept supervised during the cycling control time ∆T to satisfy the constraints in (4) and (5).

2.5. Baseline Method (Rule-Based EMS)

Rule-based EMS is a simple method that offers a real-time evaluation of the energy system’s performance using pre-defined conditions (rules). In this study, a rule-based ESS management system based on real-time evaluation of SOC is developed. It defines the operation mode of the hybrid system according to the SOC level. The island mode is active only if the ESS constraints, formulated in (4) and (5), are satisfied. The flowchart of the proposed rule-based EMS is shown in Figure 6.
Rule-based EMS is an efficient approach when it comes to cost-effective implementation. The rules are designed to focus mainly on ESS SOC variation. Operating ESS between predefined upper and lower limits offers various advantages. The lower limit protects ESS from deep undercharging scenarios, which increases the batteries’ life, and it also offers an energy backup in case any unexpected energy needs occur. The upper limit is to protect the batteries from overcharging issues, such as corrosion on the positive plates and excessive temperatures; the upper limit also ensures the energy recovery capacity of any sudden extra PV supply, particularly in island mode. The control commands used to ensure the targeted performance are the same as those used in the previous FL approach (external grid relay and ESS current). Rule-based methods can be performed online without requiring much computing time, which makes them suitable for real-time EMS.

3. Validation System Description

In this section, more details about the experimental setup and the implementation steps are given. The tests were carried out on the smart grid prototype of the Institute of Energy Systems Technologies (INES) at Offenburg University. This prototype makes it possible to demonstrate control and management policies using real industrial hardware, which makes the results replicable in any other application.

3.1. System Components

The experimental setup consists of three single-phase STUDER XTM 4000-48 Xtender inverter/charger devices in parallel to form a three-phase converter. This latter will control the exchange of power between 4.5 KW lead-acid batteries and the local building microgrid. The inverter/charger can also connect the whole hybrid system to the grid utility, or it can disconnect it to operate it as an island microgrid, as explained previously. The 6.3 KWp PV system is connected to the AC bus of the local network via three Sunny Boy 2500 HF inverters; these inverters are controlled to supply the maximum available power. The different system parameters are listed in Table 1.
ESS SOC data feedback is essential for the EMS algorithm; data are measured permanently via a battery status processor (BSP) device that offers real-time measurements of all battery parameters (SOC, voltage, current, and temperature). PV and load powers are other required signals that are collected via transmitters and treated by means of BECKHOFF CX2040 PLC. To simulate a residential building’s power demand, three CHROMA 63,803 programmable loads are connected to the local network to form a three-phase load system. Those loads are controlled, remotely, to follow a real residential building power demand profile. All data are stored in real time in a local database. PLC communicates also with Labview software, version 14.0.0, which serves as a Human–Machine Interface (HMI) system, via Open Platform Communications United Architecture (OPC UA) to provide real-time data visualization and a user–system interaction tool.
The system was initially designed so the ESS current setpoint is to be generated continuously by PLC using a classical IF-THEN EMS algorithm (rule-based). Since our target is to apply a FL-based EMS, as explained earlier, a Windows PC, serving as an edge device, is responsible on generating the ESS current setpoint using a MATLAB code as a high-level programming language. At each cycle time, the system status data are queried from the database using MATLAB and Structured Query Language (SQL). Here, the FL algorithm can take over and map the system input data to the optimal outputs. In this case, PLC is bypassed when performing the control, and the edge device directly controls the ESS inverter/charger using a specific communication protocol called “Xtender Serial Protocol”. For this purpose, Xcom-232i is needed as a communication module. The corresponding control parameter to be written (ESS current) is defined in the Remote Control Center RCC-02, which has a direct control action on the inverter/charger. The complete experimental system is represented in Figure 7. This process is being repeated continuously each control cycle time until the algorithm-stopping criteria are reached. Regarding the system dynamics, the chosen cycling time for the experiments is fixed at 10 min.

3.2. PC—Xtender Communication Protocol

The Xtender Serial Protocol is the communication path between Xcom-232i and the edge device (PC), which acts as a master, and the ESS power converter, which acts as a slave device. This protocol is highly similar to the industrial Modbus RTU; it consists of exchanging data frames composed of a header of 14 bytes, followed by a variable number of data bytes and 2 bytes of checksum. To facilitate the implementation of the protocol, a command line tool is used to communicate directly with the RCC-02, via Xcom-232i. As an example, to force the batteries to be charged with 12 A, the following command line statement can be built using the Windows command prompt:
  • >scom.exe --port=COM3 --verbose=3 write_property src_addr=1 dst_addr=101
  • object_type=2 object_id=1138 property_id=5 format=FLOAT value=12.0
Where write_property is the “Write” function; dst_addr = 101 is the device destination address, in this case, 101 for Xtender inverter/charger; object_id = 1138 is the “charging current” parameter ID; and value = 12.0 is the charging current value in Ampere.
To not overstate the content of this article, more information on the structure of the command lines, and on Xtender Serial Protocol in general, can be found in the documentation section of the manufacturer’s website. Combining the command line tool with a high-level programming language, like MATLAB, facilitates the conception of advanced EMS algorithms by simply calling predefined functions, such as “evalfis” for the Sugeno fuzzy inference system.
One advantage of the fuzzy EMS is that it can be considered as an online control procedure, i.e., the system status data evaluation and control actions are performed in real time. Therefore, no significant calculation time is needed. This makes it a very suitable approach when the computational efficacy is targeted. However, the time delay related to the data acquisition through industrial communication protocols, like the one explained earlier, may not be negligible!

4. Results and Discussion

In this section, the performance of the proposed FL algorithm within the framework of edge computing is evaluated. As a baseline method, a simple rule-based EMS is developed and validated. For both EMS methods, the test is to be completed in 8 h, starting at 10:00 a.m. on two clear-sky days. The maximum allowed power for the inverter/charger is fixed to 4 KW, while the upper and lower ESS SOC limits are fixed at 90% and 50%, respectively.

4.1. Rule-Based EMS Test

Based on the testing day specifications, the control commands are defined as shown in Figure 8. The system operates accordingly in island and grid-connected modes. Although the ESS current setpoint, defined by the fuzzy management, is constant during the control cycling time (10 min), we see rapid current fluctuations in Figure 8a. This is due to the fact that the inverter/charger is designed to participate in the local grid voltage and frequency regulation by continuously adjusting the power fed to the grid. Nevertheless, those fluctuations are negligible compared to the constant setpoint defined by the energy manager.
As it was a sunny day, the amount of supplied PV power was relatively significant compared to the power demand (see Figure 9; therefore, the energy manager aims to keep SOC below the upper limit by connecting a hybrid system to the grid to feed extra power. When SOC is turned back inside the tolerated zone, the energy manager operates the system in island mode again, as this is the preferred operation mode. During the test, ESS SOC crossed the upper limit several times, as shown in Figure 10; this is due to the fact that the energy manager is totally offline during the cycling time (10 min). The control actions, in this case, are being updated only after the end of each cycle. To protect the batteries from overcharging scenarios, the energy manager feeds extra power to the grid with different AC currents, as shown in Figure 11. Despite the fact that, initially, one back deeding current was fixed in rule-based EMS (~6 A), the ESS inverter/charger bypassed the sent current setpoint for frequency/voltage regulation considerations, as they are prioritized over any EMS commands.

4.2. Fuzzy-Based EMS Test

In contrast to rule-based EMS, fuzzy EMS integrates the dynamic electricity price as an additional input. During the test, the electricity price information was fetched online 24 h ahead thanks to an online service ( via the Application Programming Interface (API) (see Figure 12). Control commands generated during the test are displayed in Figure 13. The current fluctuations are due to the frequency/voltage regulation mechanism explained previously. Figure 13b shows that the grid-connected operation mode was mostly applied due to the fact that it was a partially cloudy day. In this operation condition, the supplied PV power is mostly less than the power demand (see Figure 14), which requires the connection of the grid as a secondary energy source. The grid-connected mode was also applied for SOC regulation and electricity price variation, which is going to be explained subsequently.

4.2.1. Partially Cloudy Day Test

The test outcomes presented in this section were obtained during a partially cloudy day, which is reflected in the supplied PV power level. After the test was completed, the graphs below were created based on the data fetched from the automation system database.
Despite the fact that the system constraints, formulated in (4) and (5), were respected during the 8 h test, the FL energy manager kept the hybrid system connected to the grid continuously when the electricity is not high. The reason for this is that the developed fuzzy rules aim to operate ESS with SOC values around 75% (see Figure 15). Moreover, since it was a partially cloudy day, the supplied PV power was lower than the power demand, which explains the currents imported from the grid (see Figure 16). Islanding the building microgrid in this situation may lead to excess ESS discharge scenarios. However, short islanding times are applied, mainly when the electricity price is high. In this situation, the power demand is satisfied by a combination of PV/ESS. In contrast to rule-based EMS, as validated previously, SOC control in fuzzy EMS is relatively smoother due to the infinity of situations considered during the fuzzification process.
In addition to the smooth control of SOC, the energy cost savings in fuzzy EMS are further targeted by the integration of the dynamic price of electricity. The fuzzy rules aim to increase self-consumption by profiting locally from the PV power produced. Since the electricity selling price to the grid utility is, generally speaking, much lower than the buying price, it is valuable to consume the PV power locally if the system constraints allow. Unlike the fuzzy EMS, the integration of supplementary rules into the rule-based EMS related to economic objectives makes it difficult to take into account all operational situations. This problem is naturally solved by the limitless number of possible use-cases covered by fuzzy membership functions.

4.2.2. Sunny Day Test

In this test scenario, the day was mostly sunny, which is reflected in the supplied PV power. Therefore, PV power was generally higher than power demand with minor fluctuations (see Figure 17). This explains why SOC levels were varying around the upper limit (90%) during the first six hours, and why the fuzzy manager kept connecting the hybrid system to the grid for SOC regulation purposes (see Figure 18). However, SOC regulation in this case is relatively smoother compared to the case with the rule-based approach with similar weather conditions (see Figure 19). A significant drop in PV power supply was registered during the last two hours, which explains why the SOC was decreasing.
The drop in PV supply, during the last two hours, can also lead to ESS inverter/charger maximum power violation; therefore, the fuzzy energy manager connected the hybrid system to the grid as a preventive action to have additional support, which is reflected to the imported current shown in Figure 20 (the dashed red circle).

5. Conclusions

This article addresses and validates an advanced edge-driven EMS approach. The technical feasibility of the implementation into an existing BEMS is mainly highlighted. For this, the fuzzy EMS algorithm was validated on two different climatic conditions. Thanks to the fuzzy data processing structure, an infinity of operation situations were considered during the control process. The efficacy of islanding the building microgrid as a control command was also demonstrated. The main features of the edge-driven fuzzy energy manager are as follows:
  • An infinity of operation conditions can be considered during the evaluation of the system status data before performing control.
  • Smooth control of ESS SOC.
  • The ability to add various data inputs with less complexity compared to rule-based EMS approaches.
  • Thanks to the edge communication interface, EMS commands can be sent via a low-level controller (PLC), which needs some additional software configurations, or directly to power converters without the need for any BEMS modifications. This last option is recommended only during the commissioning or test phase.
  • Thanks to the high hardware resources of the edge device, a high-level programming language, combined with industrial communication protocols, makes it possible to implement advanced EMS algorithms in BEMS.
In future work, the edge-driven EMS is to be cascaded on top of an eventual Supervisory Control and Data Acquisition (SCADA) system. Within this architecture, edge-driven EMS will act as a management system that monitors an entire energy network including different DERs. The communication in this situation should be performed through the low-level control for more consistency and to take advantage of the security policies that have already been implemented.

Author Contributions

Conceptualization, M.H.; methodology, M.H.; software, M.H.; validation, M.H.; formal analysis, E.B. and Q.W.; investigation, E.B. and Q.W.; resources, E.B.; data curation, M.H.; writing—original draft preparation, M.H.; writing—review and editing, E.B. and Q.W.; visualization, M.H., E.B. and Q.W.; supervision, E.B.; funding acquisition, E.B. and Q.W. All authors have read and agreed to the published version of the manuscript.


This research was funded by Algerian Ministry of Higher Education and Scientific Research in the framework of national exceptional program. This research is also partially funded by EU H2020 program under Grant Agreement No. 101036656.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

Table A1. Proposed fuzzy rules.
Table A1. Proposed fuzzy rules.
Where EP-L, EP-M, and EL-H are the low, medium, and high values of the electricity price, respectively; SOC-L, SOC-M, and SOC-H are the low, medium, and high values of the batteries’ SOC, respectively; dP++, dP+, dP0, dP−, and dP−− are the ordered values from a high positive power difference (PPV-PL) value to a high negative one, respectively. In Table A1, orange cells correspond to the grid feeding mode (ESS discharging) and blue ones correspond to ESS charging modes, while green ones correspond to island mode. Each cell is divided into two parts: the right one relates to the external relay status (R0: relay is opened; R1: relay is closed), while the left part is related to the ESS power reference, in which the values are ordered from the high negative value to high positive one according to the quantities P−−, P−, P0−, P+, and P++.

Appendix B

Figure A1. Flowchart of the fuzzy algorithm implementation.
Figure A1. Flowchart of the fuzzy algorithm implementation.
Energies 16 03539 g0a1


  1. International Energy Agency. Energy Technology Perspectives 2012: Pathways to a Clean Energy System; International Energy Agency: Paris, France, 2012. [Google Scholar]
  2. Saadon, S.; Gaillard, L.; Giroux-Julien, S.; Menezo, C. Simulation study of a naturally-ventilated building integrated photovoltaic/thermal (BIPV/T) envelope. Renew. Energy 2016, 87, 517–531. [Google Scholar] [CrossRef]
  3. Wang, W.L.; Liu, Y.S.; Wu, X.F.; Xu, Y.; Yu, W.Y.; Zhao, C.J.; Zhong, Y.B. Environmental assessments and economic performance of BAPV and BIPV systems in Shanghai. Energy Build. 2016, 130, 98–106. [Google Scholar] [CrossRef]
  4. Qureshi, W.A.; Nair, N.-K.C.; Farid, M.M. Impact of energy storage in buildings on electricity demand side management. Energy Convers. Manag. 2011, 52, 2110–2120. [Google Scholar] [CrossRef]
  5. Li, R.; Satchwell, A.J.; Finn, D.; Christensen, T.H.; Kummert, M.; Le Dréau, J.; Lopes, R.A.; Madsen, H.; Salom, J.; Henze, G.; et al. Ten questions concerning energy flexibility in buildings. Build. Environ. 2022, 223, 109461. [Google Scholar] [CrossRef]
  6. Habib, M.; Ladjici, A.A.; Bollin, E.; Schmidt, M. One-day ahead predictive management ofbuilding hybrid power system improvingenergy cost and batteries lifetime. IET Renew. Power Gener. 2019, 13, 482–490. [Google Scholar] [CrossRef]
  7. Habib, M.; Ladjici, A.A.; Khoucha, F. Frequency Control in Off-Grid Hybrid Diesel/PV/Battery Power System. In Proceedings of the International Conference on Electrical Engineering, Algiers, Algeria, 13–15 December 2015. [Google Scholar]
  8. Habib, M.; Ladjici, A.A.; Harrag, A. Microgrid management using hybrid inverter fuzzy-based control. Neural Comput. Applications 2020, 32, 9093–9111. [Google Scholar] [CrossRef]
  9. Long, B.; Jeong, T.W.; Lee, J.D.; Jung, Y.C.; Chong, K.T. Energy Management of a Hybrid AC–DC Micro-Grid Based on a Battery Testing System. Energies 2015, 8, 1181–1194. [Google Scholar] [CrossRef]
  10. Ferrández-Pastor, F.-J.; Mora, H.; Jimeno-Morenilla, A.; Volckaert, B. Deployment of IoT Edge and Fog Computing Technologies to Develop Smart Building Services. Sustainability 2018, 10, 3832. [Google Scholar] [CrossRef]
  11. Hashmi, S.A.; Ali, C.F.; Zafar, S. Internet of things and cloud computing-based energymanagement system for demand side managementin smart grid. Int. J. Energy Res. 2021, 45, 1007–1022. [Google Scholar] [CrossRef]
  12. Singh, H.; Gupta, M.M.; Meitzler, T.; Hou, Z.-G.; Garg, K.K.; Solo, A.M.G.; Zadeh, L.A. Real-Life Applications of Fuzzy Logic. Adv. Fuzzy Syst. 2013, 2013, 581879. [Google Scholar] [CrossRef]
  13. Suganthi, L.; Iniyan, S.; Samuel, A. Applications of fuzzy logic in renewable energy systems—A review. Renew. Sustain. Energy Rev. 2015, 48, 585–607. [Google Scholar] [CrossRef]
  14. Chaouachi, A.; Kamel, R.M.; Andoulsi, R.; Nagasaka, K. Multiobjective Intelligent Energy Management for a Microgrid. IEEE Trans. Ind. Electron. 2013, 60, 1688–1699. [Google Scholar] [CrossRef]
  15. Garcıa, P.; Torreglosa, J.P.; Fernandez, L.M.; Jurado, F. Optimal energy management system for stand-alone wind turbine/photovoltaic/hydrogen/battery hybrid system with supervisory control based on fuzzy logic. Int. J. Hydrogen Energy 2013, 38, 14146–14158. [Google Scholar] [CrossRef]
  16. Abadlia, I.; Bahi, T.; Bouzeria, H. Energy management strategy based on fuzzy logic for compound RES/ESS used in stand-alone application. Int. J. Hydrogen Energy 2016, 41, 16705–16717. [Google Scholar] [CrossRef]
  17. Al-Sakkaf, S.; Kassas, M.; Khalid, M.; Abido, M.A. An Energy Management System for Residential Autonomous DC Microgrid Using Optimized Fuzzy Logic Controller Considering Economic Dispatch. Energies 2019, 12, 1457. [Google Scholar] [CrossRef]
  18. Yuan, Y.; Zhang, T.; Shen, B.; Yan, X.; Long, T. AFuzzyLogic Energy Management Strategy for a Photovoltaic/Diesel/Battery Hybrid Ship Based on Experimental Database. Energies 2018, 11, 2211. [Google Scholar] [CrossRef]
Figure 1. Power topology of AC-coupled ESS with the role of the energy manager.
Figure 1. Power topology of AC-coupled ESS with the role of the energy manager.
Energies 16 03539 g001
Figure 2. Fuzzy logic data processing steps.
Figure 2. Fuzzy logic data processing steps.
Energies 16 03539 g002
Figure 3. Figure 3. Proposed fuzzy energy manager.
Figure 3. Figure 3. Proposed fuzzy energy manager.
Energies 16 03539 g003
Figure 4. Membership functions of fuzzy controller inputs: (a) power difference Pout between PV supply and load (W), (b) ESS SOC level (%), and (c) electricity price EP (€/MWh).
Figure 4. Membership functions of fuzzy controller inputs: (a) power difference Pout between PV supply and load (W), (b) ESS SOC level (%), and (c) electricity price EP (€/MWh).
Energies 16 03539 g004aEnergies 16 03539 g004b
Figure 5. Fuzzy surfaces between inputs and outputs: (a) ESS current (Ib) as function of power difference (Pout) and SOC; (b) grid external relay (R) as a function of power difference (Pout) and SOC; (c) ESS current (Ib) as a function of SOC and electricity price (EP); and (d) grid external relay (R) as a function of SOC and electricity price (EP).
Figure 5. Fuzzy surfaces between inputs and outputs: (a) ESS current (Ib) as function of power difference (Pout) and SOC; (b) grid external relay (R) as a function of power difference (Pout) and SOC; (c) ESS current (Ib) as a function of SOC and electricity price (EP); and (d) grid external relay (R) as a function of SOC and electricity price (EP).
Energies 16 03539 g005
Figure 6. Rule-based EMS flowchart.
Figure 6. Rule-based EMS flowchart.
Energies 16 03539 g006
Figure 7. Experimental setup.
Figure 7. Experimental setup.
Energies 16 03539 g007
Figure 8. Rule-based EMS: (a) ESS DC current and (b) grid relay.
Figure 8. Rule-based EMS: (a) ESS DC current and (b) grid relay.
Energies 16 03539 g008
Figure 9. Rule-based EMS: power management of the hybrid system.
Figure 9. Rule-based EMS: power management of the hybrid system.
Energies 16 03539 g009
Figure 10. Rule-based EMS: ESS SOC.
Figure 10. Rule-based EMS: ESS SOC.
Energies 16 03539 g010
Figure 11. Rule-based EMS: grid RMS current.
Figure 11. Rule-based EMS: grid RMS current.
Energies 16 03539 g011
Figure 12. Electricity price hourly profile during the test period.
Figure 12. Electricity price hourly profile during the test period.
Energies 16 03539 g012
Figure 13. Fuzzy-based EMS in cloudy day: (a) ESS DC current and (b) grid relay.
Figure 13. Fuzzy-based EMS in cloudy day: (a) ESS DC current and (b) grid relay.
Energies 16 03539 g013
Figure 14. Fuzzy-based EMS in cloudy day: power management of the hybrid system.
Figure 14. Fuzzy-based EMS in cloudy day: power management of the hybrid system.
Energies 16 03539 g014
Figure 15. Fuzzy-based EMS in cloudy day: ESS SOC.
Figure 15. Fuzzy-based EMS in cloudy day: ESS SOC.
Energies 16 03539 g015
Figure 16. Fuzzy-based EMS in cloudy day: grid RMS current.
Figure 16. Fuzzy-based EMS in cloudy day: grid RMS current.
Energies 16 03539 g016
Figure 17. Fuzzy-based EMS in sunny day: power management of the hybrid system.
Figure 17. Fuzzy-based EMS in sunny day: power management of the hybrid system.
Energies 16 03539 g017
Figure 18. Fuzzy-based EMS in sunny day: grid relay.
Figure 18. Fuzzy-based EMS in sunny day: grid relay.
Energies 16 03539 g018
Figure 19. Fuzzy-based EMS in sunny day: ESS SOC.
Figure 19. Fuzzy-based EMS in sunny day: ESS SOC.
Energies 16 03539 g019
Figure 20. Fuzzy-based EMS in sunny day: grid RMS current.
Figure 20. Fuzzy-based EMS in sunny day: grid RMS current.
Energies 16 03539 g020
Table 1. Hybrid System Parameters.
Table 1. Hybrid System Parameters.
PV systemPV modulePower at MPP240 Wp
Voltage at MPP30.0 V
Current at MPP8.1 A
Open-circuit voltage37.4 V
Short-circuit current8.6 A
Temperature coefficient−0.46%/K
Module modelBosch solar module c-Si M 60
PV power plantNumber of modules27
Inclination9 × 35°
18 × 30°
Alignment180° south
Power6.3 KWp
Batteries’ systemBattery cellVoltage4 V
Nominal capacity546 Ah
Battery modelRolls Battery 4CS17P
Batteries’ bankNumber of cells in series12
Number of cells in parallel1
Power4.5 KW
Programmable load-Nominal power3.6 KW
Load modeConstant power
Control modeRemote
ModelChroma 63,803
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Habib, M.; Bollin, E.; Wang, Q. Battery Energy Management System Using Edge-Driven Fuzzy Logic. Energies 2023, 16, 3539.

AMA Style

Habib M, Bollin E, Wang Q. Battery Energy Management System Using Edge-Driven Fuzzy Logic. Energies. 2023; 16(8):3539.

Chicago/Turabian Style

Habib, Mustapha, Elmar Bollin, and Qian Wang. 2023. "Battery Energy Management System Using Edge-Driven Fuzzy Logic" Energies 16, no. 8: 3539.

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop