default minimalmodbus instrument parameters are MODBUS standard (19200 8N1):
#instrument.serial.port # this is the serial port name
#instrument.serial.baudrate = 19200 # Baud
#instrument.serial.bytesize = 8
#instrument.serial.parity = serial.PARITY_NONE
#instrument.serial.stopbits = 1
#instrument.serial.timeout = 0.05 # seconds
#instrument.mode = minimalmodbus.MODE_RTU # rtu or ascii mode
instrument = minimalmodbus.Instrument('/dev/ttyUSB0', 3) # port name, slave address (in decimal)
instrument.serial.baudrate = 9600
instrument.debug = 0
return instrument
```
The device registers held values of different lengths and precisions, using singed or unsigned number representations. In order to ensure an extensible and robust application, we defined a list with registers that could be read and a list of registers that could be written. We present an example to showcase the properties of each register:

```
readOnlyRegisters = (
```
*{*

*'registerAddress': 1, 'numberOfRegisters': 2, 'name': 'Frequency',*

```
'unit': 'Hz',
  'multiplier': 0.1,
  'isSigned': False,
}
. . . .
}
writeOnlyRegisters = (
{
  'registerAddress': 5,
  'numberOfRegisters': 1,
  'name': 'Average period',
  'options': None,
  'min': 1,
  'max': 60,
}
. . . .
}
```
configurations, which could cause damage.

**4. Discussion**

For each property, it was necessary to use a fractional multiplier, due to unsigned integer representation. For example, 0.1 was used for frequency, thus from the tenths number representation, and the frequency was brought to the unitary level. *Sustainability* **2019**, *11*, x FOR PEER REVIEW 15 of 20 For each property, it was necessary to use a fractional multiplier, due to unsigned integer representation. For example, 0.1 was used for frequency, thus from the tenths number representation,

Figure 7 shows the general appearance of the application, accessed with a web browser (the captures were made from two different operating systems, Windows 10 and Raspbian, just to show the compatibility of the realized application). The data were read on the first page, and for the configuration, a more secure connection procedure was needed to avoid unauthorized configurations, which could cause damage. and the frequency was brought to the unitary level. Figure 7 shows the general appearance of the application, accessed with a web browser (the captures were made from two different operating systems, Windows 10 and Raspbian, just to show the compatibility of the realized application). The data were read on the first page, and for the configuration, a more secure connection procedure was needed to avoid unauthorized

**Figure 7.** Appearance of the main user interface (left under Windows OS, right under Raspbian OS). jumper); see Figure 9. In this way, a higher sensitivity could be obtained from the current transformer **Figure 7.** Appearance of the main user interface (left under Windows OS, right under Raspbian OS).

voltage waveform was captured (Figure 8), where the X axis is the time representation (10ms/div) and the Y axis the amplitude representation (1V/div). The complexity of this measuring system was to achieve the best solution for accurate measurement. For example, choosing the best ratio of the current transformer and the best value of the secondary circuit of the current transformer resistor was necessary to achieve the best linearity and sensitivity of measurement system. Both the reduction of the current and the modification of its phase were observed after the important variation of the current from the moment of commutation, aspects that were expected to happen. The representation scale was 1V vertically and 10 ms horizontally, per division. For the measurement, a current transformer was used, with the higher frequency band, in order not to attenuate the transient regime. For current transformers, it is mandatory to use a secondary circuit with a resistor, to prevent a faulty state in the case of open circuit. Additionally, the resistor helped convert current into voltage in order to be easily readable by the oscilloscope. The oscilloscope probes used were equipped with a 1:10 divider, in order to attenuate the measured signal. The current transformers used were manufactured by Talema India and were of the type AC1010-AC1020. For the secondary, it was provided with five turns and a load resistance of two steps, 1.8 kohms and 270 ohms (the selection was made using a

## **4. Discussion**

In order to observe the influence on the network at the connection of the capacitor battery, the voltage waveform was captured (Figure 8), where the X axis is the time representation (10 ms/div) and the Y axis the amplitude representation (1 V/div). The complexity of this measuring system was to achieve the best solution for accurate measurement. For example, choosing the best ratio of the current transformer and the best value of the secondary circuit of the current transformer resistor was necessary to achieve the best linearity and sensitivity of measurement system. Both the reduction of the current and the modification of its phase were observed after the important variation of the current from the moment of commutation, aspects that were expected to happen. The representation scale was 1 V vertically and 10 ms horizontally, per division. For the measurement, a current transformer was used, with the higher frequency band, in order not to attenuate the transient regime. For current transformers, it is mandatory to use a secondary circuit with a resistor, to prevent a faulty state in the case of open circuit. Additionally, the resistor helped convert current into voltage in order to be easily readable by the oscilloscope. The oscilloscope probes used were equipped with a 1:10 divider, in order to attenuate the measured signal. The current transformers used were manufactured by Talema India and were of the type AC1010-AC1020. For the secondary, it was provided with five turns and a load resistance of two steps, 1.8 kohms and 270 ohms (the selection was made using a jumper); see Figure 9. In this way, a higher sensitivity could be obtained from the current transformer (1.8 kohms) or better linearity (270 ohms). The observed power factor improved from 0.64 to 0.8, using a capacity of 9.6 µF and an electric motor running without load. Regarding the resistors in Figure 9, for the current transformer, it was mandatory to have a resistor in secondary circuit, because when we had an open circuit, it could be a faulty state. Additionally, this resistor converted the current into voltage to be easily readable by the oscilloscope. *Sustainability* **2019**, *11*, x FOR PEER REVIEW 16 of 20 (1.8 kohms) or better linearity (270 ohms). The observed power factor improved from 0.64 to 0.8, using a capacity of 9.6μF and an electric motor running without load. Regarding the resistors in Figure 9, for the current transformer, it was mandatory to have a resistor in secondary circuit, because when we had an open circuit, it could be a faulty state. Additionally, this resistor converted the current into voltage to be easily readable by the oscilloscope.

**Figure 8.** The appearance of the current before and after the switching moment. **Figure 8.**The appearance of the current before and after the switching moment.

**Figure 9.** Current transformers used to visualize the waveform of the current at the time of switching.

three-phase asynchronous motor was used.

During the testing of the equipment, the aim was to highlight the moment when a step connection of the capacitor batteries took place. The most convenient to use, which also provided galvanic isolation, was a broadband frequency current claw device, from DC to over one hundred kHz. The wider the frequency band, the better the transient regime was obtained. As a load, a 2.2kW

**Figure 8.** The appearance of the current before and after the switching moment.

(1.8 kohms) or better linearity (270 ohms). The observed power factor improved from 0.64 to 0.8, using a capacity of 9.6μF and an electric motor running without load. Regarding the resistors in Figure 9, for the current transformer, it was mandatory to have a resistor in secondary circuit, because when we had an open circuit, it could be a faulty state. Additionally, this resistor converted the

current into voltage to be easily readable by the oscilloscope.

**Figure 9.** Current transformers used to visualize the waveform of the current at the time of switching. **Figure 9.** Current transformers used to visualize the waveform of the current at the time of switching.

During the testing of the equipment, the aim was to highlight the moment when a step connection of the capacitor batteries took place. The most convenient to use, which also provided galvanic isolation, was a broadband frequency current claw device, from DC to over one hundred kHz. The wider the frequency band, the better the transient regime was obtained. As a load, a 2.2kW three-phase asynchronous motor was used. During the testing of the equipment, the aim was to highlight the moment when a step connection of the capacitor batteries took place. The most convenient to use, which also provided galvanic isolation, was a broadband frequency current claw device, from DC to over one hundred kHz. The wider the frequency band, the better the transient regime was obtained. As a load, a 2.2 kW three-phase asynchronous motor was used.

The capacitors were specially designed for the correction of the power factor and contained resistors for their discharging so that at the next switching, they were not loaded with a significant voltage. This was why the equipment did not perform frequent switching, allowing no less than one minute between two switches, so that there was enough time for the capacitors to be discharged.

The interpretation of the switching moment was qualitative, highlighting the moment when it took place, and its effect on the amplitude and phase of the current. Using the PF correction device and a custom built telemetry module, we were able to adjust the configuration of the PF device remotely, as well as read and record on a server the electric current parameters. While the PF improvement was not better than other existing methods, this implementation outlined the ability to use telemetry to identify potential issues and improve the PF correction efficiency.

This power factor correction device can be a component in the emerging field of smart grids because of the remote control and measurement capabilities. It can be easily integrated in the smart grid environment using secure communication capabilities.

PF correction is very important from an economic point of view as well. In Romania, the pricing of reactive electricity to consumers, with differentiation in the case of domestic consumers, is made according to the average power factor, reported at a neutral PF, currently equal to 0.92. For a PF between 0.65 and 0.92, the pricing is done according to the energy price. If the PF is less than 0.65, the payment is calculated at three times the price of the reactive energy [35].

The estimated cost of the entire device, considering only component costs without the manufacturing process, was around 700 Euro. On the market, the price is around 165 Euro/kVA. Additionally, the cost increases when installing the power factor correction equipment (cables, settings, etc.). The comparison is valid only for the same principle of design; the cost increases considerably when another principle is used (e.g., synchronous electric drive).

For a test load of 10 kw, a benefit of 20–30% of energy efficiency was estimated. The estimation was made over five days, but to be more accurate, a longer period of time is required, e.g., several months. Due to seasons, an accurate estimation of the energy efficiency must be made over one year.

#### **5. Conclusions**

The importance of controlling and maintaining the power factor is undeniable, due to the effects that a small power factor can have on the network. There is not only an unjustified consumption, but also the possibility of the occurrence of damage, when the content of harmonics is important.

The paper presents not only a general view on the power factor and its influence on the functioning of the network, but also the dimensioning and practical realization of a proposed equipment that improves the power factor of a consumer, by connecting capacitors to the power line.

A new PFC circuit based on telemetry and remote configuration was designed and tested. The main advantage of the achieved equipment was that it could be configured and programmed remotely through an Internet connection, allowing for easy fine tuning of the algorithm's configuration parameters to achieve potentially better operation based on the time feedback loop and artificial intelligence. This is an interesting idea that will be further explored in future work. Other advantages were related to the fact that the application was designed to ensure portability and flexibility in the operation of the equipment at various load levels depending on the targeted implementation.

The configuration possibilities of the Ducati Energia R5 device are multiple, starting with both single-phase and three-phase operation and continuing with setting parameters for the capacitors used and reaching limits for triggering alarms.

The obtained results confirmed the presented theory perfectly and showed the correctness of the equipment design. The energy losses measured on the test equipment were reduced by 20% over a short test period of five days. Accurate statistical data would require longer period tests (e.g., one year). Loss of equipment efficiency is a consequence of an improper power factor. When a plant operates with a low power factor, the amount of useful energy available inside the plant at distribution transformers is considerably reduced due to the amount of reactive energy that the transformers must carry. Less current means less losses in the distribution system of the plant, because the losses are proportional to the square of the current (I2R).

The recorded data regarding the transient regime clearly showed that the current variations could be important. In this situation, the capacities used were of a small value (µF), so the results were proportional. The influence on the obtained data was also due to the current probe. The higher the frequency band, the more spectacular the transition (by amplitude and duration).

Another interesting idea for future work can be the scheme of the measuring system for data acquisition. Simplifying the design, it consisted of conditional circuits (current transformer) and an oscilloscope. The complexity of the measuring system was focused to achieve the most accurate measurement; for example, to choose the best ratio of current transformer and the best value of secondary circuit of the current transformer resistor, which is necessary to reach the best linearity and sensitivity of the measurement system.

**Author Contributions:** Conceptualization, C.D.O. and C.M.C.; methodology, C.M.C.; software, C.M.C.; validation, C.M.C., C.D.O., and A.F.; formal analysis, C.D.O.; investigation, C.D.O.; resources, C.M.C.; data curation, A.F.; writing, original draft preparation, C.D.O.; writing, review and editing, A.F. and C.M.C.; visualization, C.M.C.; supervision, A.F.; project administration, A.F.; funding acquisition, A.F. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Acknowledgments:** The authors thank SIV Electro S.R.L. (Valeriu Vacaru and Adrian Stroescu) for kind support in carrying out the experiments.

**Conflicts of Interest:** The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; nor in the decision to publish the results.

## **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

**Ahmed Al Amerl 1,2,\* , Ismail Oukkacha <sup>1</sup> , Mamadou Baïlo Camara 1,\* and Brayima Dakyo <sup>1</sup>**


**Abstract:** In this paper, an effective control strategy is proposed to manage energy distribution from fuel cells and batteries for hybrid electric boat applications. The main objectives of this real-time control are to obtain fast current tracking for the batteries' system, the DC bus voltage stability by using a fuel cell, and energy load distribution for a hybrid electric boat under varying demand conditions. The proposed control strategy is based on a combination of frequency approach and current/voltage control of interleaved boost converters to reduce the hydrogen consumption by the fuel cell and improve the quality of energy transfer. The frequency approach was dedicated to managing the DC power-sharing between the load, the fuel cell, and the batteries' storage system by extracting the power references. The closed loop control system utilized to control the energy is based on the DC/DC converters. The performance evaluation of the proposed control strategy has been tested through a real-time experimental test bench based on a dSPACE board (DS1104).

**Keywords:** interleaved boost converter; DC/DC converter; hybrid electric boat; energy storage system (ESS); RST control

#### **1. Introduction**

Calculating the total number of boats in the world is an inexact science, but it is stated by some reports in 2017 that there are estimated to be more than 30 million recreational boats on the planet, not including cruise ships [1]. The Electric Boat and Ship Market was valued at USD 5 billion in 2020 and expected to reach USD 10 billion by 2026 registering a compound annual growth rate (CAGR) of above 11% during the forecast period (2021–2026). It is recorded that the CO<sup>2</sup> emissions from boats form about 3–5% of the world's CO<sup>2</sup> emissions, which equates to about one billion tons [2].

The necessity of reducing pollutant emissions together with environmental issues requires special actions from boat manufacturers and researchers to propose alternative clean energy such as fuel cells (FCs) [3]. Thanks to the success of hydrogen fuel cells in heavy-duty vehicles, FCs (nowadays) are being integrated into different marine vessels. Fuel cells are playing the main role in reducing the greenhouse gas (GHG) emissions of marine industries on the ports and water. For marine vessels, fuel cells are the only viable, true zero-emission option. Just like batteries, fuel cells produce electricity with high efficiency through an electro-chemical process. The difference is, with a fuel cell, energy is stored separately in the form of hydrogen fuel. As long as fuel is available, the fuel cell power systems will produce electricity as a generator. The only emissions from a fuel cell are water vapor and heat.

Nearly more than 10 years ago, there was plenty of effort on hydrogen FCs to be the carbon-free future for transportation applications, such as recreational boating. Both hydrogen FCs and batteries can produce clean energy without any CO<sup>2</sup> emissions. Although batteries are less costly than *FC*, hydrogen cells do not need to recharge or run down as long as there is a stable source of hydrogen [4]. However, due to the slowness

**Citation:** Al Amerl, A.; Oukkacha, I.; Camara, M.B.; Dakyo, B. Real-Time Control Strategy of Fuel Cell and Battery System for Electric Hybrid Boat Application. *Sustainability* **2021**, *13*, 8693. https://doi.org/10.3390/ su13168693

Academic Editor: Thanikanti Sudhakar Babu

Received: 26 June 2021 Accepted: 31 July 2021 Published: 4 August 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

of *FC* at starting and operation, the utilization of batteries as auxiliary sources with *FC* is, in fact, crucial to guarantee a smooth driving speed of the electric boats. In addition, the hybrid plane can integrate storage devices, such as a pack of batteries, to allow a significant reduction in hydrogen consumed by *FC* [5]. Batteries are a zero-emission power solution for smaller vessels that operate with short duty cycles. However, the lower power density and greater weight limit the use of batteries in many applications.

The hybrid energy system of *FC* and ESS is widely used in transportation applications such as Hybrid Electrical Vehicles (HEV) [6]. Most of the studies in [7–10] has been simulated under a different type of platform such as Simulink, SimPowerSystem, HOMER, etc. In the HEV application, *FC*, lithium-ion battery and ultracapacitors system was used to power the electric vehicle based on a fuzzy logic system [7]. The control of voltage and current through the DC/DC converters is based on the frequency energy management and sliding mode control.

Another nonlinear control system has been simulated to manage the power through the boost and boost-buck converters [8]. This control system has been designed to adapt the nonlinear characteristics of power electronic elements and the time-variant system. The closed loop control system has been designed to meet the requirements of system stability based on the sources (*FC* and SC). Various ESS has been combined with *FC* to ensure energy supply in the HEV, based on different topologies that respect the design of advanced charge systems [9]. A Simulink simulation has been used to carry out a mathematical model for hybrid systems consisting of *FC*/battery source for boat applications. The batteries are directly connected to the DC microgrid without any control, while the *FC* is controlled through DC/DC converters based on operation state scenarios [10]. However, most of these studies [5–10] have been modeled based on many assumptions and approximations to represent the physical operation of the system and still need to actualize.

Some other researchers have been invested in the hardware in the loop and experiments to test the control strategies applied to HEV. The supercapacitor (SC) bank has been used at a transient state of operation, in addition to the *FC* [11]. The Lyapunov nonlinear control method has been applied to the simulation system based on HEV to estimate the converter control parameters. The New European Driving Cycle (NEDC) has been used to evaluate the proposed energy management method through simulation tests compared to the experimental one [12]. The DC network has linked between multi-source *FC*, lithium batteries and ultracapacitors through DC/DC converters and an asynchronous machine through a DC/AC inverter. In [13], the authors proposed a closed loop control system to manage the distributed power between the multi-source system and load that represent the Hybrid Electric Boat (HEB). The main goal of the control system is to share the load profile between sets of two variable speed diesel generators and an auxiliary source (ESS) that is connected through the bidirectional DC/DC converter.

In 2019, the CO<sup>2</sup> emissions are increasing to reach 1.5 billion tons because of the significant growth in demand on all fossil fuels. To avoid these emissions, many countries, such as China, Europe and the United States, are using renewable energies in the power sector. In this context, the multi-source system consisting of wind and PV with battery has been experimentally tested to minimize the generation of a diesel system [14]. The MPPT has been used to control the PV and wind while the main goal of the battery was the compensation of intermittent power fluctuations in the system. In [15], the authors proposed a hybrid system to respect the environmental concerns and respond to the energy demand. A DC/DC converter is used to integrate PV to the DC grid in case of failure in the production of wind energy delivered through a three-phase bidirectional AC/DC converter. A survey of challenges that faced the integration of renewable energy sources has been presented in [16].

Compared to other types of stored energy, both *FC* and ESS technologies have low environmental effects. The system based on *FC* has better ability to work for more operating time than batteries. On the other hand, batteries require fewer spare components and have a low price. The results of real-time monitoring on transport applications such as boats can gain a wide view of the challenges and advantages of using *FC* and ESS energy technologies. For this reason, *FC* energy and lithium-ion battery storage systems will be searched in this paper. the main source to provide the majority of the load whereas the Electrical Storage System (ESS) supplies the complement of the request power during the peak load and FC start up. The proposed control strategy has adopted the combination between the frequency

Compared to other types of stored energy, both FC and ESS technologies have low environmental effects. The system based on FC has better ability to work for more operating time than batteries. On the other hand, batteries require fewer spare components and have a low price. The results of real-time monitoring on transport applications such as boats can gain a wide view of the challenges and advantages of using FC and ESS energy technologies. For this reason, FC energy and lithium-ion battery storage systems will

A hybrid electric system consisting of FC and a pack of batteries has been proposed in this paper. An efficient control strategy to manage the flow of energy between the two sources and boat power demand (load) has been presented. The system has been constructed based on the continuity of hydrogen into the fuel cell, which is considered to be

*Sustainability* **2021**, *13*, x FOR PEER REVIEW 3 of 19

be searched in this paper.

A hybrid electric system consisting of *FC* and a pack of batteries has been proposed in this paper. An efficient control strategy to manage the flow of energy between the two sources and boat power demand (load) has been presented. The system has been constructed based on the continuity of hydrogen into the fuel cell, which is considered to be the main source to provide the majority of the load whereas the Electrical Storage System (ESS) supplies the complement of the request power during the peak load and *FC* start up. The proposed control strategy has adopted the combination between the frequency approach and RST control system. The frequency approach has been modified to control the time constant in real-time implementation based on the health state of ESS. The main goals of this real-time control strategy are to maintain the reliability of the hybrid system and to secure the two sources from unsecured operation conditions, in addition to minimizing the hydrogen consumption. approach and RST control system. The frequency approach has been modified to control the time constant in real-time implementation based on the health state of ESS. The main goals of this real-time control strategy are to maintain the reliability of the hybrid system and to secure the two sources from unsecured operation conditions, in addition to minimizing the hydrogen consumption. The organization of this paper includes the configuration of the proposed hybrid system in Section 2. In Section 3, the control strategies of FC and pack of a battery system based on DC/DC converters have been detailed. Section 4 is devoted to the energy management system based on frequency approach to share the load power by controlling the DC bus voltage and the bidirectional current of the battery system. Section 5 gives a presentation of the experimental results on a reduced scale system, and finally, the conclusion remarks are described in the Section 6.

The organization of this paper includes the configuration of the proposed hybrid system in Section 2. In Section 3, the control strategies of *FC* and pack of a battery system based on DC/DC converters have been detailed. Section 4 is devoted to the energy management system based on frequency approach to share the load power by controlling the DC bus voltage and the bidirectional current of the battery system. Section 5 gives a presentation of the experimental results on a reduced scale system, and finally, the conclusion remarks are described in the Section 6. **2. Structure of Hybrid Electric Boat System**  The studied HEB system presented in Figure 1 consists of two types of resources (FC combined with the lithium batteries) and the load represented by electric boat power demand. The DC grid is connected to the FC through an interleaved boost converter and a pack of batteries (power source) through a buck-boost DC/DC converter. The variable load has been linked to the DC/AC inverter as shown in the HEB system configuration.

#### **2. Structure of Hybrid Electric Boat System** In this paper, a pack of battery storage energy is utilized to overcome the disad-

The studied HEB system presented in Figure 1 consists of two types of resources (*FC* combined with the lithium batteries) and the load represented by electric boat power demand. The DC grid is connected to the *FC* through an interleaved boost converter and a pack of batteries (power source) through a buck-boost DC/DC converter. The variable load has been linked to the DC/AC inverter as shown in the HEB system configuration. vantages of the slow operation of the FC (especially at startup). The main contribution of the FC source is to control and maintain the continuity of DC bus voltage with or without output current of ESS. In addition, the DC energy supplied from the FC of the proposed system is based on interleave boost converters because of their advantages such as higher efficiency, reduced ripple currents, and substantially reducing losses.

**Figure 1. Figure 1.**  Hybrid Electric Boats system configuration. Hybrid Electric Boats system configuration.

In this paper, a pack of battery storage energy is utilized to overcome the disadvantages of the slow operation of the *FC* (especially at startup). The main contribution of the *FC* source is to control and maintain the continuity of DC bus voltage with or without output current of ESS. In addition, the DC energy supplied from the *FC* of the proposed system is based on interleave boost converters because of their advantages such as higher efficiency, reduced ripple currents, and substantially reducing losses.

The batteries can contribute to providing appropriate and smooth DC power generation for boat and reduce the amount of energy required from the *FC* source. The DC/DC and DC/AC converters are used for current control to improve the quality of energy transfer, to reduce the hydrogen consumption by the *FC*, using ESS in real-time conditions. Batteries ESS capacity was determined to be able to store the energy from *FC* source at charging time and return it at discharge time to meet the fast shortages in demand.

The load profile of HEB is proposed to represent boat freight transport with rated 60 kW from Le Havre to Paris in France. 60kW from Le Havre to Paris in France.

The load profile of HEB is proposed to represent boat freight transport with rated

The batteries can contribute to providing appropriate and smooth DC power generation for boat and reduce the amount of energy required from the FC source. The DC/DC and DC/AC converters are used for current control to improve the quality of energy transfer, to reduce the hydrogen consumption by the FC, using ESS in real-time conditions. Batteries ESS capacity was determined to be able to store the energy from FC source at charging time and return it at discharge time to meet the fast shortages in demand.

#### **3. Simulation of Power Control Strategy 3. Simulation of Power Control Strategy**  *3.1. Control Strategy for Bus Link Voltage*

*Sustainability* **2021**, *13*, x FOR PEER REVIEW 4 of 19

#### *3.1. Control Strategy for Bus Link Voltage*

The DC energy produced by *FC* has been controlled through the interleaved boost converter that is connected to the DC bus link. The main objective of this control strategy is to stabilize and maintain the DC bus voltage during the load variation and to keep the *FC* as the primary source in this system. The boost interleaved converter protects the *FC* source from any revert energy during regeneration status by ESS. The topology of the three-phase interleaved boost converter shown in Figure 2 consists of three parallel switches controlled by Pulse Width Modulation (PWM) signals with three freewheeling diodes for each phase with three same inductances and three diodes in series. The DC energy produced by FC has been controlled through the interleaved boost converter that is connected to the DC bus link. The main objective of this control strategy is to stabilize and maintain the DC bus voltage during the load variation and to keep the FC as the primary source in this system. The boost interleaved converter protects the FC source from any revert energy during regeneration status by ESS. The topology of the three-phase interleaved boost converter shown in Figure 2 consists of three parallel switches controlled by Pulse Width Modulation (PWM) signals with three freewheeling diodes for each phase with three same inductances and three diodes in series.

**Figure 2.** Interleaved boost converter. **Figure 2.** Interleaved boost converter.

The three switches are used to improve the output waveform and increase the delivery power of the converter. During the design of interleaved converter, the size of the converter filter is considered to reduce the ripple of the output current of the three paths. In order to take advantage of the three IGBT switches on the control design, the three PWM signals are phase shifted by 120° as shown in Figure 3. The ratio of the input current ripple to the current ripple is often used as a comparison criterion between different interleaved boost converter topologies [17]. The three switches are used to improve the output waveform and increase the delivery power of the converter. During the design of interleaved converter, the size of the converter filter is considered to reduce the ripple of the output current of the three paths. In order to take advantage of the three IGBT switches on the control design, the three PWM signals are phase shifted by 120◦ as shown in Figure 3. The ratio of the input current ripple to the current ripple is often used as a comparison criterion between different interleaved boost converter topologies [17]. *Sustainability* **2021**, *13*, x FOR PEER REVIEW 5 of 19

The model of a three-phase interleaved boost converter can be represented by the

= ி <sup>−</sup> (1 −∝ଵ) · ௨௦

= ி <sup>−</sup> (1 −∝ଶ) · ௨௦

(1)

(2)

= ி <sup>−</sup> (1 −∝ଷ) · ௨௦

where ி is the fuel cell voltage (measured in V); ∝ is the duty ratio of PWM signal; L is the inductance (measured in mH); ௨௦ is the DC Bus link voltage in (measured in V); ଵ is the current of conductance (measured in A); is the change of time in second.

The proposed control of voltage control is based on the RST polynomial method that requires tracking the reference voltage. The synthesis of this method can define the overshoot and the rise time of the measurement but has to take into account the delays as well as the nature of the disturbances and the set points [18,19]. The RST polynomial controller offers better respond and robustness toward the parametric variations in comparison with

In order to achieve minimal static error with disturbance rejection, the RST polyno-

ி(ିଵ) = ி(ିଵ) = ி + ଵி · ିଵ

where is the sampling period, ி represent the bandwidth for controlling the volt-

In HEB, the voltage bus should be kept constant, which is considered in this control to be the voltage reference. In addition, the FC is the main principle that controls the DC bus voltage through the linked interleaved boost converter. Indeed, the current of the FC source is not controlled and will be imposed by the evolution of the system. That means, the FC current is deduced from Kirchhoff's current law and equal to the load current after

் 

் 

mials used for DC bus voltage control are presented by the following equations:

ி =2· ( 1 − ିఠಷ·்) ·

ଵி = ( ିఠಷ·் − 1) ·

subtracting the contributions from the pack of batteries, it can be calculated by:

் = ி + ௧

⎧ி(ିଵ) =1−ିଵ

**Figure 3.** Three PWM signals and current for interleaved converter. **Figure 3.** Three PWM signals and current for interleaved converter.

ଵ

⎩ ⎪ ⎨

⎩ ⎪ ⎪ ⎪ ⎨

age, ் is the total capacitance in the bus.

⎪ ⎪ ⎪ ଶ · ଶ

ଷ · ଷ

following three equations:

a PI controller [20].

The model of a three-phase interleaved boost converter can be represented by the following three equations:

$$\begin{cases} L\_1 \cdot \frac{dI\_{L1}}{dt} = V\_{FC} - (1 - \infty\_1) \cdot V\_{Bus} \\\ L\_2 \cdot \frac{dI\_{L2}}{dt} = V\_{FC} - (1 - \infty\_2) \cdot V\_{Bus} \\\ L\_3 \cdot \frac{dI\_{L3}}{dt} = V\_{FC} - (1 - \infty\_3) \cdot V\_{Bus} \end{cases} \tag{1}$$

where *VFC* is the fuel cell voltage (measured in V); ∝ is the duty ratio of PWM signal; L is the inductance (measured in mH); *VBus* is the DC Bus link voltage in (measured in V); *iL*<sup>1</sup> is the current of conductance (measured in A); *dt* is the change of time in second.

The proposed control of voltage control is based on the RST polynomial method that requires tracking the reference voltage. The synthesis of this method can define the overshoot and the rise time of the measurement but has to take into account the delays as well as the nature of the disturbances and the set points [18,19]. The RST polynomial controller offers better respond and robustness toward the parametric variations in comparison with a PI controller [20].

In order to achieve minimal static error with disturbance rejection, the RST polynomials used for DC bus voltage control are presented by the following equations:

$$\begin{cases} \begin{aligned} \mathbf{S\_{FC}} \left( \mathbf{z^{-1}} \right) &= \mathbf{1} - \mathbf{z^{-1}} \\ \begin{aligned} T\_{\rm FC} \left( \mathbf{z^{-1}} \right) &= R\_{\rm FC} \left( \mathbf{z^{-1}} \right) = t\_{0\rm FC} + t\_{1\rm FC} \cdot \mathbf{z^{-1}} \\ t\_{0\rm FC} &= 2 \cdot \left( \mathbf{1} - e^{-\omega\_{\rm FC} \cdot \mathbf{T\_{f}}} \right) \cdot \frac{\mathbf{C\_{T}}}{T\_{\rm c}} \\ t\_{1\rm FC} &= \left( e^{-\omega\_{\rm FC} \cdot T\_{\rm c}} - 1 \right) \cdot \frac{\mathbf{C\_{T}}}{T\_{\rm c}} \\ \mathbf{C\_{T}} &= \mathbf{C\_{Fc}} + \mathbf{C\_{Bat}} \end{aligned} \end{cases} \tag{2}$$

where *T<sup>e</sup>* is the sampling period, *ωFC* represent the bandwidth for controlling the voltage, *C<sup>T</sup>* is the total capacitance in the bus.

In HEB, the voltage bus should be kept constant, which is considered in this control to be the voltage reference. In addition, the *FC* is the main principle that controls the DC bus voltage through the linked interleaved boost converter. Indeed, the current of the *FC* source is not controlled and will be imposed by the evolution of the system. That means, the *FC* current is deduced from Kirchhoff's current law and equal to the load current after subtracting the contributions from the pack of batteries, it can be calculated by:

$$I\_{\rm FC} = \frac{V\_{\rm Bus}}{V\_{\rm FC}} \cdot I\_{\rm FC\\_Bus} \tag{3}$$

The main construction of RST voltage control with Anti-windup that used in the different controller to minimize performance degradation has shown in Figure 4.

#### *3.2. Control Strategy of the Current System*

In this section, the main principle of the control strategy is based on sharing of the load's current between *FC* and a pack of batteries. Therefore, the HEB load profile and the *FC* limited generation have been studied to select the size and number of batteries required [21]. The main factors have been considered to determine the rated power output of batteries were the maximum difference of the output power of *FC* and HEB load, the maximum value of stored power, and the searched over the duration of *SoC*.

ி <sup>=</sup>௨௦ ி

ferent controller to minimize performance degradation has shown in Figure 4.

The main construction of RST voltage control with Anti-windup that used in the dif-

· ி\_௨௦ (3)

**Figure 4.** RST polynomial controller with Anti-windup. **Figure 4.** RST polynomial controller with Anti-windup.

The term (

sented as in Figure 5.

ொ ொି௧

*3.2. Control Strategy of the Current System*  In this section, the main principle of the control strategy is based on sharing of the load's current between FC and a pack of batteries. Therefore, the HEB load profile and the FC limited generation have been studied to select the size and number of batteries required [21]. The main factors have been considered to determine the rated power output of batteries were the maximum difference of the output power of FC and HEB load, the maximum value of stored power, and the searched over the duration of SoC. The ESS power control sub-system includes the pack of batteries interfaced with a buck/boost converter to control the current between the DC bus and batteries. Lithiumion batteries have been considered in this study because of their high energy density and efficiency in comparison to the other battery types such as NiMH, NiCd, or lead-acid. The battery output voltage is considered to be nonlinear functional because of the battery's state of charge (*SoC*) and the nonlinear current. The battery's voltage *VBat* is calculated by using the following equation [22].

$$V\_{\rm Bat} = V\_{op} - R\_{\rm Bat} \* i\_{\rm Bat} - K\_b \frac{\mathcal{Q}}{Q - i\_l} .dot\_l + A\_b e^{-B.i\_l} - K\_b \frac{\mathcal{Q}}{Q - i\_l} . i^\* \tag{4}$$

efficiency in comparison to the other battery types such as NiMH, NiCd, or lead-acid. The battery output voltage is considered to be nonlinear functional because of the battery's state of charge (SoC) and the nonlinear current. The battery's voltage ௧ is calculated by using the following equation [22]. where *Vop* is the voltage of open circuit, *iBat* is the current of open circuit, *RBat* is the total internal resistance of batteries, *Q* is the total capacity of batteries, *K<sup>b</sup>* is polarization constant, *i* ∗ is filtered current of batteries, *B* is exponential capacity, *i<sup>t</sup>* is actual charge batteries current, *A<sup>b</sup>* is exponential voltage.

௧ = − ௧ ∗ ௧ − ொ ொି௧ . + ି.௧ − ொ ொି௧ . <sup>∗</sup> (4) where is the voltage of open circuit, ௧ is the current of open circuit, ௧ is the total internal resistance of batteries, is the total capacity of batteries, is polarization constant, <sup>∗</sup> is filtered current of batteries, is exponential capacity, ௧ is actual charge The term (*K<sup>b</sup> Q <sup>Q</sup>*−*it* .*it*) is called the polarization voltage that affect the *SoC*, which reflects the performance of the battery. The *SoC* of batteries plays the main role in stabilizing the bus voltage of DC link and buffering the power fluctuations. The battery voltage during the charging state increases after the pack of batteries is fully charged and referred to the polarization resistance (*Polres*) that can be found by:

$$\text{Pol}\_{\text{res}} = \text{K} \frac{\text{Q}}{\text{it} - 0.1 \text{Q}} \tag{5}$$

flects the performance of the battery. The SoC of batteries plays the main role in stabilizing the bus voltage of DC link and buffering the power fluctuations. The battery voltage dur-According to the above parameters, the model of the Li-ion battery can be represented as in Figure 5.

ing the charging state increases after the pack of batteries is fully charged and referred to the polarization resistance (௦) that can be found by: ௦ = − 0.1 (5) According to the above parameters, the model of the Li-ion battery can be repre-In this HEB system, the load profile of the boat is only at the positive part, which means there will be only one direction of current pass from the DC link to the boat's load through the DC/AC converter and has no reverted current. In *FC* source with a high voltage gain needs controller connected to an interleaved DC/DC boost converter to ensure their optimal operation and maintain the voltage of the DC link constant.

*Sustainability* **2021**, *13*, x FOR PEER REVIEW 7 of 19

**Figure 5.** Model of Li-ion battery [23]. **Figure 5.** Model of Li-ion battery [23]. age gain needs controller connected to an interleaved DC/DC boost converter to ensure their optimal operation and maintain the voltage of the DC link constant.

batteries.

glected:

batteries.

In this HEB system, the load profile of the boat is only at the positive part, which means there will be only one direction of current pass from the DC link to the boat's load through the DC/AC converter and has no reverted current. In FC source with a high voltage gain needs controller connected to an interleaved DC/DC boost converter to ensure ESS units are connected to the DC bus via bidirectional DC/DC converters as shown in Figure 6. The reference current for the pack of batteries is obtained from the implemented frequency management approach and from the power balance linked to the converter as expressed in the following equation, where the losses in the converter are neglected: ESS units are connected to the DC bus via bidirectional DC/DC converters as shown in Figure 6. The reference current for the pack of batteries is obtained from the implemented frequency management approach and from the power balance linked to the converter as expressed in the following equation, where the losses in the converter are ne-

$$I\_{Bat} = \frac{V\_{Bus}}{V\_{Bat}} I\_{Busbat} \tag{6}$$

mented frequency management approach and from the power balance linked to the converter as expressed in the following equation, where the losses in the converter are neglected: ௧ <sup>=</sup> ಳೠೞ ௨௦௧ (6) In buck-boost converter, the battery current is controlled by changing the value of the duty cycle rate (∝) in both cases buck and boost. Normally, the duty cycle changed from 0 to 1 but increases the response time and protects the IGBT devices; it is recommended to limit these values according to the maximum and minimum voltage of the batteries. In buck-boost converter, the battery current is controlled by changing the value of the duty cycle rate (∝) in both cases buck and boost. Normally, the duty cycle changed from 0 to 1 but increases the response time and protects the IGBT devices; it is recommended to limit these values according to the maximum and minimum voltage of the

$$\infty\_{Back\\_Rate} = \frac{V\_{Bat} + V\_{control\\_loop\\_output}}{V\_{Bus}} \tag{7}$$

$$\infty\_{Boot\\_Balt} = 1 - \frac{V\_{Batt} - V\_{control\\_loop\\_output}}{V\_{Bus}} \tag{8}$$

(7)

(8)

**Figure 6.** Battery current control system-based boost-buck converter. **Figure 6.** Battery current control system-based boost-buck converter.

At the load side, the same control technique has been used to control the current in the DC link side, according to the changes on the load profile through the frequency approach to manage the energy from sources as shown in Figure 7.

**Figure 6.** Battery current control system-based boost-buck converter.

proach to manage the energy from sources as shown in Figure 7.

**Figure 7.** Control system and boat's load profile. **Figure 7.** Control system and boat's load profile.

#### **4. Frequency Approach for Control Strategy 4. Frequency Approach for Control Strategy**

The control of power is unidirectional for the fuel cell and load, while for the pack of the batteries is bidirectional. The distribution of power into the DC grid is controlled by using the frequency approach, which considers the power balance, state of charge (SoC) for batteries, and the limited power of FC and batteries. All these constraints can be described by the following equations: The control of power is unidirectional for the fuel cell and load, while for the pack of the batteries is bidirectional. The distribution of power into the DC grid is controlled by using the frequency approach, which considers the power balance, state of charge (*SoC*) for batteries, and the limited power of *FC* and batteries. All these constraints can be described by the following equations:

At the load side, the same control technique has been used to control the current in the DC link side, according to the changes on the load profile through the frequency ap-

Power balance: Power balance:

$$P\_{\rm FC}(t) \pm P\_{\rm Bat}(t) = P\_{\rm Load}(t) \tag{9}$$

SoC: *SoC*:

$$\text{So} \mathsf{C}\_{\min}(t) \le \text{ So} \mathsf{C}(t) \le \text{ So} \mathsf{C}\_{\max}(t) \tag{10}$$

FC power limits: *FC* power limits:

$$P\_{\text{FC } min}(t) \le P\_{\text{FC}}(t) \le P\_{\text{FC } max}(t) \tag{11}$$

ி () ≤ ி() ≤ ி ௫() (11) Pack of batteries power limits:

$$P\_{\text{Bat } min}(t) \le \ P\_{\text{Bat}}(t) \le \ P\_{\text{Bat } max}(t) \tag{12}$$

௧ () ≤ ௧() ≤ ௧ ௫() (12) This control strategy is based on three main control systems to determine the switch state of the converters and on-times as shown in Figure 8. It has been proposed to control these dynamic interactions by taking into account the frequency content of the fluctuations. If the DC bus voltage is controlled to a constant value, the disturbances will be trans-This control strategy is based on three main control systems to determine the switch state of the converters and on-times as shown in Figure 8. It has been proposed to control these dynamic interactions by taking into account the frequency content of the fluctuations. If the DC bus voltage is controlled to a constant value, the disturbances will be transferred to the currents.

ferred to the currents. The current reference of batteries is extracted from the load demand using the lowpass filter (LPF) based on DC bus voltage controller as shown in Figure 9. Due to profile variances for boats' demand in terms of start and operation status, the batteries current reference (*IBat*\_*re f*) will use to control the state (buck/boost) of DC/DC converter at the side of the pack of batteries. The current control system is based on the changes of converter operation mode. The converter mode is operated as the follow principle: If sign *IBat*\_*re f* > 0, the converter operates in boost mode and pack of battery supply energy to DC-bus. Otherwise, the converter operates in buck mode and batteries store energy.

*Sustainability* **2021**, *13*, x FOR PEER REVIEW 9 of 19

**Figure 8.** The proposed control strategy. **Figure 8.** The proposed control strategy. 0, the converter operates in boost mode and pack of battery supply energy to DC-bus. Otherwise, the converter operates in buck mode and batteries store energy.

**Figure 9.** Batteries current reference extraction method. **Figure 9.** Batteries current reference extraction method.

The approach of low-pass filter (LPF) has been determined by identifying the functions as described in Figure 10. This method has been developed to control the time constants of the filter during the real-time operations, according to the healthy state of batteries such as SoC, capacitance and resistance. The currents of load are broken down into low frequency components to estimate the reference of battery power and high frequency ones, where the component of the high frequency is utilized to estimate the FC current. The approach of low-pass filter (LPF) has been determined by identifying the functions as described in Figure 10. This method has been developed to control the time constants of the filter during the real-time operations, according to the healthy state of batteries such as *SoC*, capacitance and resistance. The currents of load are broken down into low frequency components to estimate the reference of battery power and high frequency ones, where the component of the high frequency is utilized to estimate the *FC* current. *Sustainability* **2021**, *13*, x FOR PEER REVIEW 10 of 19

**Figure 10.** Control of LPF time constants in real-time. **Figure 10.** Control of LPF time constants in real-time.

The parameters of the functions that define the control of LPF time constant can be expressed as follows: The parameters of the functions that define the control of LPF time constant can be expressed as follows:

2∗∗

To demonstrate the feasibility of the HEB, the simulations of the energy management strategy are done using Matlab/Simulink software. The rated power for the simulated system is considered as 60 kW, and all other parameters for the rest of the system are detailed in Table 1. These parameters are obtained from the data sheet of the battery [24], from

The adopted energy management splits the load energy demand into several components according to the number and nature of the onboard energy sources. In this HEB case, the system contains two energy sources: fuel cells and a pack of batteries. The fuel cells stack has lower dynamic performance compared to the battery pack. Therefore, the Fc contribution will cover the low frequency component extracted from the load current demand, furthermore the Fc stack is considered to be the system's main source, and the

**Description Symbol Parameters**  Voltage of battery cell VBatmin~VBatmax 2.8 V~3.8 V Parallel resistances R1, R2 0.033, 0.375 Ω Parallel capacitances C1, C2 92, 499 F Battery power density PBat 310 W/Kg Battery energy density EBat 102 Wh/Kg Initial value of battery SoC SoC(t0) 97% Number of batteries in series Ns\_Bat 59 Number of batteries in parallel NP\_Bat 1 Electric wiring resistance for battery Rbwi 4.5 m Ω

> CFc = CBat = CBus LBat

> > λ3; λ<sup>4</sup>

Parameters for battery's current control t0Bat; t1Bat 85.84; 55.13 Parameters for DC-link voltage control t0Fc; t1Fc 3.27; 3.23

Parametric coefficients λ1; λ<sup>2</sup>

3.3 mF 12 mH

−0.984; 0.00312 7.22 × 10−5; −1.061 × 10−<sup>4</sup>

$$\begin{cases} \begin{array}{l} \text{Function1}(\mathbf{x}, \tau\_{\text{Bat}}) = \frac{\mathbf{x}, T\_{s} \ (1+z) \\ \hline T\_{s} + 2\tau\_{\text{Bat}}z \end{array} \\\begin{array}{l} \text{Function2}(\mathbf{x}, \tau\_{\text{Bat}}) = \frac{\tau\_{\text{Bat}}(2\mathbf{x} - T\_{s})}{(T\_{s} + 2\mathbf{x})z} \\\ \tau\_{\text{Bat}} \approx \frac{\rho\_{e\text{Bat}}}{2 \ast \tau \ast \rho\_{p\text{Bat}}} = \frac{Energy\_{\text{Bat}}}{2 \ast \tau \ast \text{Power}\_{\text{Bat}}} \end{array} \end{cases} \tag{13}$$

( + 2)

<sup>=</sup> 2 ∗ ∗

⎩

previous work [25] and the setting for the control system.

**5. Simulation Results for Frequency Approach** 

DC-bus voltage is controlled through it.

Capacitance of DC-link IBat smoothing inductances

**Table 1.** HEB system parameter.

#### **5. Simulation Results for Frequency Approach**

To demonstrate the feasibility of the HEB, the simulations of the energy management strategy are done using Matlab/Simulink software. The rated power for the simulated system is considered as 60 kW, and all other parameters for the rest of the system are detailed in Table 1. These parameters are obtained from the data sheet of the battery [24], from previous work [25] and the setting for the control system.



The adopted energy management splits the load energy demand into several components according to the number and nature of the onboard energy sources. In this HEB case, the system contains two energy sources: fuel cells and a pack of batteries. The fuel cells stack has lower dynamic performance compared to the battery pack. Therefore, the *Fc* contribution will cover the low frequency component extracted from the load current demand, furthermore the *Fc* stack is considered to be the system's main source, and the DC-bus voltage is controlled through it.

On the other hand, the high frequency component is ensured by the battery pack because it benefits from higher dynamic characteristics than the *Fc*, and it is considered to be an auxiliary energy source. The load current separation is performed using a low pass filter.

In this simulation, the DC-bus voltage is set to a constant point as shown in Figure 11, so that the current flows through the bus link to share the load demand with the multisource system (fuel cells stack and battery pack) according to the proposed modified frequency separation approach. The implemented voltage control strategy maintains the DC-bus voltage around the constant reference value. For this simulation, the *VBus* reference value is fixed to 374 V. According to the simulation result, the voltage control is satisfied since the measure is very close to the set point with minor fluctuations due to the load current variations.

PWM frequency Low pass filter time constant

PWM frequency

*Sustainability* **2021**, *13*, x FOR PEER REVIEW 11 of 19

Low pass filter time constant fdτBat

filter.

filter.

current variations.

current

**Figure 11.** DC-bus voltage control result. **Figure 11.** DC-bus voltage control result. **Figure 11.** DC-bus voltage control result.

Figure 12 shows the profile of HEB for the total duration (4572.5 s) with a high peak of 95A and minimum current of 2A. Figure 12 shows the profile of HEB for the total duration (4572.5 s) with a high peak of 95 A and minimum current of 2 A. Figure 12 shows the profile of for the total duration (4572.5 s) with a high peak of 95A and minimum current of 2A.

fd τBat

O2 and H2 Pressures PO2; PH2 0.209 atm; 1.476 atm

Thickness of polymer membrane L 25 × 10−4 cm Fc active area Ar 67 cm2 Maximum density of current Jmax 0.672 A/cm2

Fc active area Ar 67 cm2Maximum density of current Jmax A/cm2

O2 and H2 Pressures PO2; PH2 0.209 atm; 1.476 atm Thickness of membrane L 25 × 10−4 cm

On the other hand, the high frequency component is ensured by the battery pack because it benefits from higher dynamic characteristics than the Fc, and it is considered to be an auxiliary energy source. The load current separation is performed using a low pass

On the other hand, the high frequency component is ensured by the pack because it benefits from higher dynamic characteristics than the Fc, and it considered to be an auxiliary energy source. The load current separation is performed using a low pass

In this simulation, the DC-bus voltage is set to a constant point as shown in Figure 11, so that the current flows through the bus link to share the load demand with the multisource system (fuel cells stack and battery pack) according to the proposed modified frequency separation approach. The implemented voltage control strategy maintains the DCbus voltage around the constant reference value. For this simulation, the VBus reference value is fixed to 374V. According to the simulation result, the voltage control is satisfied since the measure is very close to the set point with minor fluctuations due to the load

11, so that the flows through the bus link to share the demand with the source system (fuel cells stack and battery pack) to the proposed modified frequency separation approach. The implemented voltage control strategy maintains the DCbus voltage around the constant reference value. For this simulation, the VBus reference value is fixed to 374V. According to the simulation result, the voltage control is satisfied since the is very close to the set point with minor fluctuations due to the load

In this simulation, the DC-bus voltage is set to a constant as in Figure

2 kHz 189 s

2 kHz 189 s

**Figure 12.** HEB load current profile. **Figure 12. Figure 12.**  HEB load current profile. HEB load current profile.

Figure 13 shows the *Fc* stack current contribution, which represents the low frequency component of the load power requirement. Compared to the batteries and the load ones, *IFc* frequency variation is moderate. The *Fc* stack terminal voltage is illustrated in Figure 14. Regarding the voltage response, and beside the first voltage drop due to *Fc* voltage activation, *VFC* does not fluctuate significantly compared to *Vbat*; this means that the *FC* stack is not requested during transient load states.

The battery pack current and voltage are presented, respectively, in Figures 15 and 16. The battery pack ensures the high frequency of the load power requirement. It can be noted from the above figures that when there is a considerable load demand, it will cause a fast-discharging current from the battery. On the other hand, during large load power drops, the battery voltage increases due to the recovered current. Finally, when the load demand is stable with no high frequency solicitations, the battery voltage is stable.

the FC stack is not requested during transient load states.

the FC stack is not requested during transient load states.

*Sustainability* **2021**, *13*, x FOR PEER REVIEW 12 of 19

Figure 13 shows the Fc stack current contribution, which represents the low frequency component of the load power requirement. Compared to the batteries and the load ones, IFc frequency variation is moderate. The Fc stack terminal voltage is illustrated in Figure 14. Regarding the voltage response, and beside the first voltage drop due to Fc voltage activation, ி does not fluctuate significantly compared to ௧; this means that

Figure 13 shows the Fc stack current contribution, which represents the low frequency component of the load power requirement. Compared to the batteries and the load ones, IFc frequency variation is moderate. The Fc stack terminal voltage is illustrated in Figure 14. Regarding the voltage response, and beside the first voltage drop due to Fc voltage activation, ி does not fluctuate significantly compared to ௧; this means that

**Figure 13.** Fuel cells stack current contribution. **Figure 13.** Fuel cells stack current contribution. **Figure 13.** Fuel cells stack current contribution.

**Figure 14.** Fuel cells stack voltage. **Figure 14.** Fuel cells stack voltage. **Figure 14.** Fuel cells stack voltage.

**Figure 15.** Current contribution of the batteries pack. **Figure 15.** Current contribution of the batteries pack.

**Figure 16.** Voltage of pack of the batteries.

**6. Experimental Verification of the Control Strategies** 

in the DC bus link through the unidirectional buck converter (4).

According to the available equipment in the laboratory, the tests are done on a reduced scale of 71. The experimental test bench as shown in Figure 17. The system consists of two PC systems (1 and 2) that are used to control and measure the test bench. The fuel cell (8) is connected through the interleaved boost converter (3) to the DC bus supplied by a pack of batteries with a total of 500 Ah (6) through DC/DC buck-boost converter (5). The pack of batteries consists of five batteries type LiFePO4 in the series each has 12 V/100 Ah. The load profile (7) has been implemented in programmable DC load (4) which is linked

**Figure 15.** Current contribution of the batteries pack.

**Figure 16.** Voltage of pack of the batteries. **Figure 16.** Voltage of pack of the batteries.

#### **6. Experimental Verification of the Control Strategies**

**6. Experimental Verification of the Control Strategies**  According to the available equipment in the laboratory, the tests are done on a reduced scale of 71. The experimental test bench as shown in Figure 17. The system consists of two PC systems (1 and 2) that are used to control and measure the test bench. The fuel cell (8) is connected through the interleaved boost converter (3) to the DC bus supplied by a pack of batteries with a total of 500 Ah (6) through DC/DC buck-boost converter (5). The pack of batteries consists of five batteries type LiFePO4 in the series each has 12 V/100 Ah. The load profile (7) has been implemented in programmable DC load (4) which is linked According to the available equipment in the laboratory, the tests are done on a reduced scale of 71. The experimental test bench as shown in Figure 17. The system consists of two PC systems (1 and 2) that are used to control and measure the test bench. The fuel cell (8) is connected through the interleaved boost converter (3) to the DC bus supplied by a pack of batteries with a total of 500 Ah (6) through DC/DC buck-boost converter (5). The pack of batteries consists of five batteries type LiFePO4 in the series each has 12 V/100 Ah. The load profile (7) has been implemented in programmable DC load (4) which is linked in the DC bus link through the unidirectional buck converter (4). *Sustainability* **2021**, *13*, x FOR PEER REVIEW 14 of 19

**Figure 17.** Test bench for HEB system. **Figure 17.** Test bench for HEB system.

**Table 2.** Parameters of HEB System.

FC and batteries, respectively.

The voltage reference of the DC bus was fixed to 105 V due to limited voltage of the batteries, while the FC voltage source was 70 V. The output current of the FC system is covered by the high frequency components for the frequency approach based on load reference current. The parameters of HEB system used in the test bench are presented in Table 2. The voltage reference of the DC bus was fixed to 105 V due to limited voltage of the batteries, while the *FC* voltage source was 70 V. The output current of the *FC* system is covered by the high frequency components for the frequency approach based on load reference current. The parameters of HEB system used in the test bench are presented in Table 2.

> Nominal voltage of Li-ion battery 12 V Capacity of Li-ion battery 100 Ah Initial state of battery charge 75% Nominal discharge current 17.39 A Internal resistance of battery 0.00465 ohms Number of cells in series 5 DC-bus capacitors 400 uF

Current smoothing inductances 1 mH

Sampling period 1 ms Switching frequency 10 kHz

The power management between the FC and pack of batteries sources of the HEB has been developed based on the performance of individual energy sources and the suitable controllers for each of them have been adopted. The main principle of the energy management system has been done in Figure 18. The pack of batteries and FC source must share the power with variable load in order to maintain the power balance in the HEB system. The control strategies are based on extracting voltage and current references for

During the startup and rapid demand, the power output of the FC source cannot follow the power load required. The deficit of power in these conditions will fluctuate the frequency on the HEB that leads to the current reference for a pack of batteries to discharge batteries depending on the magnitude of deficit current. The batteries cells absorb the additional power as storage energy. If the production power exceeds the maximum capacity

**Parameters Values**  FC nominal voltage 70 V Max current FC output 40 A Max. voltage FC output 400 V Max. current for IGBT DC/DC 300 A


**Table 2.** Parameters of HEB System.

The power management between the *FC* and pack of batteries sources of the HEB has been developed based on the performance of individual energy sources and the suitable controllers for each of them have been adopted. The main principle of the energy management system has been done in Figure 18. The pack of batteries and *FC* source must share the power with variable load in order to maintain the power balance in the HEB system. The control strategies are based on extracting voltage and current references for *FC* and batteries, respectively. *Sustainability* **2021**, *13*, x FOR PEER REVIEW 15 of 19 of storage batteries, the control system of interleaved boost converter needs to decrease the FC output power to maintain the stability of the DC bus link voltage.

**Figure 18.** Management scheme for load sharing. **Figure 18.** Management scheme for load sharing.

In Figure 19, the experimental test shows that the proposed control of DC bus voltage has been maintained around the set point as a reference, with some acceptable error in measurements. The PC1 is used to implement and control the real-time simulation through the Dspace (DS1104 controller) by changing the ratio of duty of IGBT by controlling for PWM for the interleaved boost converter. The measurement of voltage bus has been used to track the reference value required. During the startup and rapid demand, the power output of the *FC* source cannot follow the power load required. The deficit of power in these conditions will fluctuate the frequency on the HEB that leads to the current reference for a pack of batteries to discharge batteries depending on the magnitude of deficit current. The batteries cells absorb the additional power as storage energy. If the production power exceeds the maximum capacity of storage batteries, the control system of interleaved boost converter needs to decrease the *FC* output power to maintain the stability of the DC bus link voltage.

In Figure 19, the experimental test shows that the proposed control of DC bus voltage has been maintained around the set point as a reference, with some acceptable error in measurements. The PC1 is used to implement and control the real-time simulation through the Dspace (DS1104 controller) by changing the ratio of duty of IGBT by controlling for PWM for the interleaved boost converter. The measurement of voltage bus has been used to track the reference value required.

The FC voltage results are presented in Figure 20, which is close to the limit voltage requested (70 V). The interleaved boost converter has been controlled to determine the direction and amplitude of current between the DC bus and the fuel cell source as shown

**Figure 19.** Result of DC bus voltage control.

in Figure 21.

been used to track the reference value required.

**Figure 18.** Management scheme for load sharing.

**Figure 19.** Result of DC bus voltage control. **Figure 19.** Result of DC bus voltage control.

The FC voltage results are presented in Figure 20, which is close to the limit voltage requested (70 V). The interleaved boost converter has been controlled to determine the direction and amplitude of current between the DC bus and the fuel cell source as shown in Figure 21. The *FC* voltage results are presented in Figure 20, which is close to the limit voltage requested (70 V). The interleaved boost converter has been controlled to determine the direction and amplitude of current between the DC bus and the fuel cell source as shown in Figure 21. *Sustainability* **2021**, *13*, x FOR PEER REVIEW 16 of 19 *Sustainability* **2021**, *13*, x FOR PEER REVIEW 16 of 19

of storage batteries, the control system of interleaved boost converter needs to decrease

In Figure 19, the experimental test shows that the proposed control of DC bus voltage has been maintained around the set point as a reference, with some acceptable error in measurements. The PC1 is used to implement and control the real-time simulation through the Dspace (DS1104 controller) by changing the ratio of duty of IGBT by controlling for PWM for the interleaved boost converter. The measurement of voltage bus has

the FC output power to maintain the stability of the DC bus link voltage.

**Figure 20.** Measured voltage of the FC. **Figure 20.** Measured voltage of the *FC*. **Figure 20.** Measured voltage of the FC.

**Figure 21.** Measured current of FC. **Figure 21.** Measured current of FC. **Figure 21.** Measured current of *FC*.

**Figure 22.** Load current control result.

**Figure 22.** Load current control result.

The profile has been rescaled according to the laboratory equipment after adding some noise to have dynamic performance. The variation of demand has been controlled in real-time implementation to track the profile of boat's load, as presented in Figure 22. The maximum and minimum current of load demand is 8 and 0.7 A, respectively. It shows that the fluctuations of current from the load have been controlled by the PC2 through The profile has been rescaled according to the laboratory equipment after adding some noise to have dynamic performance. The variation of demand has been controlled in real-time implementation to track the profile of boat's load, as presented in Figure 22. The maximum and minimum current of load demand is 8 and 0.7 A, respectively. It shows that the fluctuations of current from the load have been controlled by the PC2 through The profile has been rescaled according to the laboratory equipment after adding some noise to have dynamic performance. The variation of demand has been controlled in real-time implementation to track the profile of boat's load, as presented in Figure 22. The maximum and minimum current of load demand is 8 and 0.7 A, respectively. It shows that the fluctuations of current from the load have been controlled by the PC2 through another

load profile and the production required for the real-time implementation.

load profile and the production required for the real-time implementation.

Dspace (DS1104 controller) to obtain the best correction between the simulated load profile and the production required for the real-time implementation. that the fluctuations of current from the load have been controlled by the PC2 through another Dspace (DS1104 controller) to obtain the best correction between the simulated load profile and the production required for the real-time implementation.

The profile has been rescaled according to the laboratory equipment after adding some noise to have dynamic performance. The variation of demand has been controlled in real-time implementation to track the profile of boat's load, as presented in Figure 22. The maximum and minimum current of load demand is 8 and 0.7 A, respectively. It shows

*Sustainability* **2021**, *13*, x FOR PEER REVIEW 16 of 19

**Figure 20.** Measured voltage of the FC.

**Figure 21.** Measured current of FC.

**Figure 22. Figure 22.**  Load current control result. Load current control result.

The control strategy of the batteries' current is based on the RST method to track the current reference extracting from the proposed modified frequency approach. The constant time of frequency approach has been calculated by the simulation part at 189 s taking into account the healthy state of the pack of batteries. The result of battery voltage control with the state of charge management during HEB operation is illustrated in Figure 23. The battery controller keeps the voltage limitation less than maximum value and more than minimum value to avoid the batteries' deterioration. The unpredictable battery voltage depends on the components of high frequency for load current. The control strategy of the batteries' current is based on the RST method to track the current reference extracting from the proposed modified frequency approach. The constant time of frequency approach has been calculated by the simulation part at 189 s taking into account the healthy state of the pack of batteries. The result of battery voltage control with the state of charge management during HEB operation is illustrated in Figure 23. The battery controller keeps the voltage limitation less than maximum value and more than minimum value to avoid the batteries' deterioration. The unpredictable battery voltage depends on the components of high frequency for load current.

**Figure 23.** Batteries voltage. **Figure 23.** Batteries voltage.

When ௧\_ is in the charging status (negative areas), the exceeding production of energy is stored in the batteries. Otherwise, in the discharge status (positive areas), the storage energy is used to ensure the compensation of this energy. The real-time simulation in PC2 sends the PWM for IGBTs into the converter to control the buck-boost converter. The state of the converter as buck or boost is determined according to the sign of current reference extracting from the modified frequency approach. The ratio of a duty cycle is controlled by the RST method to track the reference current required and its direction is shown in Figure 24. The amplitude of batteries current is fluctuating between positive and negative parts to determine the buck and boost state, respectively. When *Ibat*\_*re f* is in the charging status (negative areas), the exceeding production of energy is stored in the batteries. Otherwise, in the discharge status (positive areas), the storage energy is used to ensure the compensation of this energy. The real-time simulation in PC2 sends the PWM for IGBTs into the converter to control the buck-boost converter. The state of the converter as buck or boost is determined according to the sign of current reference extracting from the modified frequency approach. The ratio of a duty cycle is controlled by the RST method to track the reference current required and its direction is shown in Figure 24. The amplitude of batteries current is fluctuating between positive and negative parts to determine the buck and boost state, respectively.

**Figure 24.** Measured current on the batteries compared to its references.

negative parts to determine the buck and boost state, respectively.

**Figure 24. Figure 24.**  Measured current on the batteries compared to its references. Measured current on the batteries compared to its references.

#### **7. Conclusions**

**Figure 23.** Batteries voltage.

This paper presents the study of an HEB based on *FC* source and storage batteries. To achieve an efficient energy production of the proposed system, the energy management was based on maximizing the share of the pack of batteries and minimizing the contribution of the *FC* source. Since the energy produced by *FC* is slow at the startup and has rapid load changes, the producing energy is supplied by the ESS. A set of the batteries was connected to the DC-bus link through DC/DC buck-boost converter in order to compensate for the fluctuations of high frequency current from *FC* sources. The time constant of the frequency approach has been selected for an efficient management system based on the health state of the batteries and load profile. The simulations evaluated the performances of the proposed modified frequency approach to demonstrate its ability to respect the *SoC* conditions of batteries. The performances of the proposed DC grid concept are validated through the experimental tests, using dSPACE real-time platform (CP1104) to demonstrate the feasibility of the HEB. The results from the experimental tests in reduced scale are satisfactory and show the efficiency of the proposed control strategy.

The control strategy of the batteries' current is based on the RST method to track the current reference extracting from the proposed modified frequency approach. The constant time of frequency approach has been calculated by the simulation part at 189 s taking into account the healthy state of the pack of batteries. The result of battery voltage control with the state of charge management during HEB operation is illustrated in Figure 23. The battery controller keeps the voltage limitation less than maximum value and more than minimum value to avoid the batteries' deterioration. The unpredictable battery voltage

When ௧\_ is in the charging status (negative areas), the exceeding production of energy is stored in the batteries. Otherwise, in the discharge status (positive areas), the storage energy is used to ensure the compensation of this energy. The real-time simulation in PC2 sends the PWM for IGBTs into the converter to control the buck-boost converter. The state of the converter as buck or boost is determined according to the sign of current reference extracting from the modified frequency approach. The ratio of a duty cycle is controlled by the RST method to track the reference current required and its direction is shown in Figure 24. The amplitude of batteries current is fluctuating between positive and

depends on the components of high frequency for load current.

**Author Contributions:** Conceptualization, A.A.A., M.B.C.; methodology, A.A.A., M.B.C.; software, A.A.A., M.B.C. and I.O.; validation, A.A.A., M.B.C. and I.O.; formal analysis, A.A.A., M.B.C.; investigation, A.A.A., M.B.C.; data curation, A.A.A., M.B.C.; writing—original draft preparation, A.A.A., I.O.; writing—review and editing, A.A.A., M.B.C. and I.O.; visualization, A.A.A., M.B.C.; supervision, M.B.C., B.D.; project administration, M.B.C., B.D.; funding acquisition, M.B.C., B.D. All authors have read and agreed to the published version of the manuscript.

**Funding:** The council of Normandy Region (France) has funded this article.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** The data presented in this study are available on request from the corresponding authors.

**Acknowledgments:** This work was supported by the University of Le Havre Normandy and is funded by the Normandy region in France. The project handles energy concerning CO<sup>2</sup> emissions and adopting technologies of low pollution such as Hydrogen Energy, Fuel Cell, and batteries.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Nomenclature**


#### **References**


## *Article*

## **E**ffi**cient Operation of the Hybrid Power System Using an Optimal Fueling Strategy and Control of the Fuel Cell Power Based on the Required Power Tracking Algorithm**

## **Nicu Bizon 1,2,3,\* , Phatiphat Thounthong 4,5 and Damien Guilbert <sup>5</sup>**


Received: 10 October 2020; Accepted: 18 November 2020; Published: 20 November 2020

**Abstract:** In this paper, four fuel economy strategies using power tracking control of the fuel cell boost converter and fuel cell optimization through the control of the fueling regulators were analyzed. The performance and safe operation in conditions of load disturbances and variations of renewable energy were considered. A benchmark strategy was used as a well-known strategy, which was based on the static feed-forward control of the fueling regulators. One of the four strategies is new and was based on switching the optimization reference to air and fuel regulators based on a threshold of the required power from the fuel cell system. The advantages of using the power tracking control and the optimization based on two variables instead of one are highlighted in sizing the battery capacity and its lifetime, and obtaining fuel economy respectively. The percentages of fuel economy for the analyzed strategies compared to the reference strategy are between 2.83% and 4.36%, and between 7.69% and 12.94%, in the case of a dynamic load cycle with an average of 5 kW and 2.5 kW, respectively.

**Keywords:** hybrid power system; nano-grid; fuel cell; fuel economy; power tracking; optimization

## **1. Introduction**

A hybrid power system (HPS) includes renewable energy sources, power generators, DC and AC loads, and energy and power storage devices that ensure the balance of power flows in conditions of stability and safe operation of the entire system [1]. One or more HPSs are usually integrated into a nano-grid or a mini-grid [2]. Depending on the size (kW), capability, and complexity of a grid, they are classified into mini-grids, micro-grids, nano-grids, and pico-grids [3]. For example, a nano-grid can produce or consume energy in interaction with other mini-, micro- or nano-grids [4]. Thus, the HPS based on fuel cell (FC) systems as backup energy source proposed in this study can emulate the operation of a nano-grid by including the power demand on the AC bus (from AC load and power exchanged with the grid in grid-connected mode) in the power profile of the DC load.

Due to the growing global energy demand in recent years [5], the reduction of fossil fuel resources [6] and the increase in greenhouse gas emissions have been contributing to climate change and global warming [7]. Hence, sustainable energy development policies have been imposed [8]. The increasing use of renewable energy sources (RES) in the last decade has clearly shown that they are a sustainable option for providing the energy needed for decades to come [9].

However, it is worth mentioning that each RES has a variable profile (even intermittent), so regardless of how the combination of RESs available in a certain location (where in addition to solar energy, there can be energy generated by wind, rivers, tides, biomass and so on) the balance of power flows must be compensated to ensure the stability of HPS [10]. Given that FC technology has matured and costs have been declining year by year, the FC system is frequently used as an auxiliary power source (instead of a diesel generator) to reduce the battery capacity. However, since fuel cells feature slow dynamics, they cannot be employed to respond to dynamic solicitations from the loads connected to the DC bus. Therefore, the use of a hybrid energy storage system (ESS) such as the combination batteries/ultracapacitors is required to compensate the dynamic operations [11].

If FC HPS is not connected to the grid (being included in a nano-grid), it is recommended that the excess renewable energy be stored in hydrogen tanks using an electrolyzer [12]. If FC HPS is connected to the grid, this surplus energy can be sold on the energy market when the price is the best.

This results in a hybridization of the grids by including complementary technologies for energy generation and storage [13], with the aim of attenuating the variability of RES power by integrating complementary technologies and efficient control of power converters [14]. Thus, the objectives of this paper are as follows:


Secondary objectives are focused on:


The novelty of this study compared to other similar studies (including those published by the authors) is given by the following elements presented and validated in this study:


So, besides the introduction, the paper is structured into a further four sections as follows. Section 2 presents the HPS model, detailing in subsections the PTC, GES control, and fueling strategies analyzed in this paper. Section 3 presents the results obtained in stationary and dynamic regimes of HPS. Finally, Section 4 comparatively analyzes the results and Section 5 concludes the paper.

#### **2. Modeling of the Hybrid Power System**

The structure of the hybrid power system (HPS) is shown at the top of Figure 1, which presents the HPS diagram and details the following subsystem: the energy management unit that contains the PTC, the optimal fueling strategy, the real-time optimization algorithm, and the semi-active ESS topology. The renewable power level on the DC bus is controlled by the *kRES* parameter (see the HPS diagram at the top of Figure 1). The FC power will be generated based on the PTC to compensate the power flow balance on the DC bus and operate the battery in charge-sustained mode.

The inverter system and AC load have been equated at the DC bus level with a DC load. DC load is modeled by a controlled current source, resulting in a dynamic power (*Pload*) required from the power sources connected to the DC bus (see for example, Figure 2). Non-polluting energy sources such as photovoltaic panel arrays [15] and wind turbine farms [16] may provide renewable energy, but the available renewable power profile is variable (depending on weather, season, etc.) [17], and the DC bus power balance must be dynamically compensated by the ESS [18]. Consequently, it will result in a variable profile for ESS power due to the changed power with DC bus, with frequent charge-discharge cycles, which reduce the battery life [19]. Furthermore, battery pack capacity must be oversized to provide the DC power needed under a variable power profile from RES, such as that shown in Figure 3a or Figure 4a (*PRES1* and *PRES2* for *kRES* = 1 and *kRES* = 2). RES is also modeled by a controlled current source to easily change the RES power profile.

The battery/ultracapacitors hybrid ESS (see bottom of the Figure 1) uses a semi-active topology (with the battery connected directly to the DC bus and the ultracapacitors stack connected to the DC bus via a bidirectional DC-DC power converter), which is the most widely used in the literature because it ensures a trade-off between cost, performance, and flexibility in control.

The ESS power is shown in Figures 3b and 4b for *kRES* = 1 and *kRES* = 2, respectively. In the first case, the battery is discharged and the state-of-charge (SOC) will decrease. In the second case, the battery operates in charge-discharge cycles, but in average value (AV) it seems to operate in charge-sustained mode (so, the final SOC will be approximately equal with the initial SOC of 80%). However, it is observed that there are charge and discharge cycles that must be taken into account in the design of the battery capacity. Note that *Pload(AV)* = 5 kW, *PRES1(AV)* 2.5 kW, and *PRES2(AV)* 5 kW, so *PESS1(AV)* 2.5 kW, and *PESS2(AV)* 0.

Battery pack operation in charge-sustained mode with SOC variations within the admissible limits due to a reduced level of the ESS power exchanged with DC bus has the following advantages: no battery capacity oversizing and SOC monitoring is required.

Therefore, it is necessary to use a backup energy source to operate the battery pack in charge-sustained mode (*PESS(AV)* 0) with a reduced level of the ESS power exchanged with DC bus [20]. If a clean solution is desired, then the fuel cell (FC) system can be used [21].

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 4 of 28

**Figure 1. Figure 1.** Hybrid power system (HPS). Hybrid power system (HPS).

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 5 of 28

(**b**) (**b**) **Figure 3.** The first power profile for the renewable energy source (RES), *PRES1* for *kRES* = 1 (**a**) and energy **Figure 3.** The first power profile for the renewable energy source (RES), *PRES1* for *kRES* = 1 (**a**) and energy storage system (ESS), *PESS1* for *kRES* = 1 (**b**).

**Figure 3.** The first power profile for the renewable energy source (RES), *PRES1* for *kRES* = 1 (**a**) and energy

storage system (ESS), *PESS1* for *kRES* = 1 (**b**).

storage system (ESS), *PESS1* for *kRES* = 1 (**b**).

where

**Figure 4.** The second power profile for the RES, *PRES2* for *kRES* = 2 (**a**) and ESS, *PESS2* for *kRES* = 2 (**b**). **Figure 4.** The second power profile for the RES, *PRES2* for *kRES* = 2 (**a**) and ESS, *PESS2* for *kRES* = 2 (**b**).

In this study, a proton-exchange membrane fuel cell (PEMFC) and an electrolyzer was used. The electrolyzer must be supplied with excess power (*PRES* − *Pload*) > 0, when the FC system does not have to generate power (being switched off or operating in standby mode) [22]. If *PRES < Pload* and *PESS(AV)* 0, then the FC system must generate the power requested to compensate for the DC power flow balance (*PDCreq* = *Pload* − *PRES* > 0). Power *PDCreq* is generated via a DC-DC boost converter (with efficiency *ηBoost*). Thus, FC net power must be *PFCnet* = *PDCreq*/*ηBoost* under the PTC that generates the switching (SW) command. In this study, a proton-exchange membrane fuel cell (PEMFC) and an electrolyzer was used. The electrolyzer must be supplied with excess power (*PRES* − *Pload*) > 0, when the FC system does not have to generate power (being switched off or operating in standby mode) [22]. If *PRES* < *Pload* and *PESS(AV)* 0, then the FC system must generate the power requested to compensate for the DC power flow balance (*PDCreq* = *Pload* − *PRES* > 0). Power *PDCreq* is generated via a DC-DC boost converter (with efficiency η*Boost*). Thus, FC net power must be *PFCnet* = *PDCreq*/η*Boost* under the PTC that generates the switching (SW) command.

The oxygen and hydrogen flow rates (*AirFr* and *FuelFr*) of the PEMFC system is controlled with air and fuel regulators having as references *ref Air* ( ) *I* and *ref Fuel* ( ) *I* [23]: 60000 273 *R N I* The oxygen and hydrogen flow rates (*AirFr* and *FuelFr*) of the PEMFC system is controlled with air and fuel regulators having as references *Ire f*(*Air*) and *Ire f*(*Fuel*) [23]:

$$AirFr = \frac{60000 \cdot \text{R} \cdot (273 + \theta) \cdot \text{N}\_{\text{C}} \cdot I\_{ref(Air)}}{4 \text{F} \cdot (101325 \cdot P\_{f(O2)}) \cdot (\text{U}\_{f(O2)}/100) \cdot (y\_{O2}/100)}\tag{1}$$
 
$$60000 \cdot \text{R} \cdot (273 + \theta) \cdot \text{N}\_{\text{C}} \cdot I\_{ref} = 1$$

(2)

$$\text{FuelFr} = \frac{60000 \cdot R \cdot (273 + \theta) \cdot N\_{\text{C}} \cdot I\_{\text{ref}(\text{Fuel})}}{2 \text{F} \cdot (101325 \cdot P\_{f(\text{H2})}) \cdot (\text{I}\_{f(\text{H2})}/100) \cdot (\text{x}\_{\text{H2}}/100)} \tag{2}$$

where *NC*, θ, *Uf*(*H*2) , *Uf*(*O*2) , *Pf*(*H*2) , *Pf*(*O*2) , *xH*2, *yO*<sup>2</sup> are default parameters explained in [24].

For a given FC net power under PTC reference (*Ire f*(*PTC*) ), the fuel consumption can be minimized by using an optimal fueling strategy to set in real-time the references *Ire f*(*Air*) and *Ire f*(*Fuel*) [25].

The aforementioned references (*Ire f*(*PTC*) , *Ire f*(*Air*) and *Ire f*(*Fuel*) ) are outputs of the energy management unit that contains the PTC, the optimal fueling strategy, and the real-time optimization algorithm. The design of the energy management unit will be detailed in the next sections.

#### *2.1. Control of the Fuel Cell Power Based on the Required Power Tracking Algorithm*

The PTC has been designed based on the DC power flow balance as follows:

$$\mathcal{C}\_{\rm DC} \mu\_{\rm DC} d\mu\_{\rm DC} / dt \, = \, p\_{\rm DC} + \, p\_{\rm RES} + \, p\_{\rm ESS} - \, p\_{\rm load} \tag{3}$$

where *pDC* = η*boostpFCnet* is the power generated by the FC system via DC-DC boost converter, *pFCnet* is FC net power, *pRES* is RES power, *pESS* is ESS power and *pLoad* is load power.

DC voltage *uDC* is regulated to *VDCref* = 200 V by controlling the power exchanged by a 50 F ultracapacitors (UC) stack with DC bus via a bidirectional DC-DC converter and filtered by a 0.01 F capacitor (*CDC*). Therefore, a semi-active ESS topology was designed [20,21] and implemented here using a 100 Ah lithium-ion battery pack and a 50 F UC stack (see bottom of Figure 1).

If

$$p\_{\rm DC} = \eta\_{\rm Boost} p\_{\rm FCnet} = p\_{\rm DCreq} = p\_{\rm Laad} - p\_{\rm RES} \tag{4}$$

then

$$\mathcal{C}\_{\rm DC} u\_{\rm DC} d\mu\_{\rm DC}/dt \, = p\_{\rmESS} \tag{5}$$

So, on average value (AV):

$$P\_{ESS(AV)} = 0\tag{6}$$

However, due to implementation of the optimal fueling strategy, the FC net power may differ a bit to the value resulting from (4), being approximate to that value:

$$p\_{\rm FCnet} \cong \frac{p\_{\rm Load} - p\_{\rm RES}}{\eta\_{\rm Boost}} \Rightarrow I\_{\rm FC} \cong \frac{p\_{\rm Load} - p\_{\rm RES}}{V\_{\rm FC} \eta\_{\rm Boost}} \tag{7}$$

So, the FC current reference (*Ire f*(*PTC*) ) obtained from the PTC will be given by (8):

$$I\_{ref(PTC)} = \frac{p\_{Load} - p\_{RES}}{V\_{FCnet} \eta\_{Boost}} = \frac{p\_{DCreq}}{V\_{FCnet} \eta\_{Boost}} \tag{8}$$

The optimal fueling strategy is selected using the strategy-setting block (see the energy management unit presented in the middle of Figure 1). Note that for all strategies, the boost controller has FC current (*IFC*) as one input and the second input (*Iref(Boost)*) is set to PTC reference (*Ire f*(*PTC*) ). Thus, using, for example, a boost controller with 0.1 A hysteresis, the FC current will track the PTC reference.

The battery pack and ultracapacitors stack will compensate for the energy and power imbalances in DC power flow balance (3) due to the implementation of the optimization strategy and slow power response of the FC system (using 100 ms time constant and 100 A/s slope limiters in the fueling regulators).

The references *Ire f*(*Air*) and *Ire f*(*Fuel*) were specifically established for each fueling strategy analyzed in this study (see the strategy-setting block presented in the middle of Figure 1), as will be presented in the next section.

#### *2.2. Fueling Strategies*

In order to compare the performance of the fueling strategies analyzed in this study, a well-known control strategy, applied in many commercial applications and known in the literature as the static feed-forward (sFF) control [26], will be used as a reference.

In sFF strategy, the fueling regulators are both controlled by FC current, so the references *Ire f*(*Air*) and *Ire f*(*Fuel*) are set as follows:

$$I\_{ref(Full)} = I\_{\text{FC}} \cdot I\_{ref(Air)} = I\_{\text{FC}} \tag{9}$$

Optimizing the operation of the FC system referred in this study to the minimization of total fuel consumption (*Fuel<sup>T</sup>* = R *FuelFr*(*t*)*dt*) using an optimization function given by (10):

$$f(\mathbf{x}, \text{AirFr}, \text{FuelFr}, \mathbf{P}\_{\text{load}}, \mathbf{P}\_{\text{RES}}) = \mathbf{0.5} \cdot \mathbf{P}\_{\text{FCDet}} + k\_{\text{fuel}} \cdot \mathbf{Fuel}\_{\text{eff}} \tag{10}$$

where *x* is the vector of FC state variables [26], *Fuele*ff *PFCnet*/*FuelFr* is the fuel consumption efficiency and *kfuel* = 25 (Lpm/W) to minimize the fuel consumption. This value of the *kfuel* parameter has been obtained by sensitivity analysis performed in the range 0–50 (Lpm/W) for the optimization function given by (10) [23,25].

The global extremum seeking (GES) [27] was selected as the search algorithm of the maximum for function *f* in conditions of load disturbances and variations of renewable energy. The search variables were *v*<sup>1</sup> = *AirFr* and *v*<sup>2</sup> = *FuelFr* and the GES model (which is shown in the bottom of Figure 1) will be detailed in the next section.

For the fueling strategies analyzed in this study, the references *Ire f*(*GES*1) and *Ire f*(*GES*2) generated by GES controllers were specifically established to the references *Ire f*(*Air*) and *Ire f*(*Fuel*) as follows.

For the strategy using optimization through GES-based control of the fuel regulator (labelled below as Fuel-1GES strategy), the settings were:

$$I\_{ref(Fuel)} = I\_{FC} + I\_{ref(GES1)} \cdot I\_{ref(Air)} = I\_{FC} \tag{11}$$

For the strategy using optimization through GES-based control of the air regulator (labelled below as Air-1GES strategy), the settings were:

$$I\_{ref(Air)} = I\_{\rm FC} + I\_{ref(GES2)} \; I\_{ref(Fuel)} = I\_{\rm FC} \tag{12}$$

For the strategy using optimization through GES-based control of both air and fuel regulators (labelled below as Air/Fuel-2GES strategy), the settings were:

$$I\_{\rm ref(Fuel)} = I\_{\rm FC} + I\_{\rm ref(GES1)} \; I\_{\rm ref(Air)} = I\_{\rm FC} + I\_{\rm ref(GES2)} \tag{13}$$

A new strategy was proposed using optimization through GES-based control switched to the fuel and air (labelled below as Air/Fuel-2GES SW strategy). A power threshold to maximize the fuel economy was used, so the settings are given by (14):

$$I\_{\rm ref(Fuel)} = \begin{cases} \begin{array}{c} \text{I}\_{\rm FC} \text{ if } P\_{\rm DCrq} \le P\_{\rm ref} \\ \text{I}\_{\rm FC} + \text{I}\_{\rm ref(GES)} \text{ if } P\_{\rm DCrq} > P\_{\rm ref} \end{array} , I\_{\rm ref(A\bar{\rm r})} = \begin{cases} \begin{array}{c} \text{I}\_{\rm FC} + \text{I}\_{\rm ref(GES)} \text{ if } P\_{\rm DCrq} \le P\_{\rm ref} \\ \begin{array}{c} \text{I}\_{\rm FC} \text{ if } P\_{\rm DCrq} > P\_{\rm ref} \end{array} \end{cases} \end{cases} \tag{14}$$

Air/Fuel-2GES SW strategy uses the best fuel saving strategy between Fuel-1GES and Air-1GES strategies on power ranges defined by the threshold *Pref* (see Figure 5). Therefore, an increase in fuel economy is expected (see the results section), but two GES controllers are used instead of one as used in Fuel-1GES strategy or Air-1GES SW strategy.

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 10 of 28

**Figure 5.** Diagram of the proposed strategies. **Figure 5.** Diagram of the proposed strategies.

*2.4. Oxygen Excess Ratio* The oxygen excess ratio (*OER*) was evaluated using (16) [33]: 3 2 *c I c I c I c OER* The additional use of an optimization controller will increase the complexity of the strategy somewhat, even if the optimization controller based on the GES scheme is not difficult to implement [28,29] (see next section).

#### 3 2 1 0 *2.3. GES-Based Optimization Controller*

.

where: <sup>0</sup> *c* 402.6 , 5 <sup>1</sup> *c A* 8.476 10 [1/ ] , 2 <sup>2</sup> *c A* 0.81252 [1/ ] , 3 <sup>3</sup> *d A* 0.02673[1/ ] , <sup>0</sup> *d* 0.997 , and <sup>1</sup> *d* 61.38 The GES-based optimization controller is presented at the bottom of Figure 1. Signals are processed based on the operational relationships (15) [30]:

1 0 *FC FC FC FC*

*d I d*

$$y = f(v\_1, v\_2), \\ y\_N = k\_{Ny} \cdot y \tag{15a}$$

(16)

$$\stackrel{\bullet}{y}\_f = -\omega\_\text{h} \cdot y\_f + \omega\_\text{h} \cdot y\_{\text{N}\_\text{V}} \cdot y\_{\text{HPF}} = y\_\text{N} - y\_{f'} \stackrel{\bullet}{y}\_{\text{BPF}} = -\omega\_\text{l} \cdot y\_{\text{BPF}} + \omega\_\text{l} \cdot y\_{\text{HPF}} \tag{15b}$$

$$
\omega\_{\rm h} = b\_{\rm h} \omega\_{\rm \nu} \text{ } \omega\_{\rm l} = b\_{\rm l} \omega\_{\rm \nu} \text{ } s\_{\rm d} = \sin(\omega t) \text{ } \omega = 2\pi f\_{\rm d} \tag{15c}
$$

$$y\_{\rm DM} = y\_{\rm BPF} \cdot s\_d \stackrel{\bullet}{y}\_{\rm Gradient} = y\_{\rm DM} p\_1 = k\_1 \cdot y\_{\rm Gradient} \tag{15d}$$

$$y\_M = \left| \frac{1}{T\_d} \cdot \int y\_{\rm BPF} dt \right| \cdot p\_2 = k\_2 \cdot y\_M \cdot s\_d \tag{15e}$$

$$I\_{nf(\text{GES})} = k\_{\text{Np}} \cdot (p\_1 + p\_2) \tag{15f}$$

The step in signals processing and used parameter are follows [30]:


The values of the normalization gains *kNy* and *kNp* were chosen in correlation with the range of the FC power, respectively the search range for the references *Ire f*(*GES*1) and *Ire f*(*GES*2) generated by GES controllers [30], which established the references *Ire f*(*Air*) and *Ire f*(*Fuel*) as mentioned above. It is worth mentioning the 99.9% tracking accuracy and very low power ripple obtained in stationary regimes [31]. The efficient and safe operation of the FC system using the strategies mentioned above were evaluated in stationary and dynamic regimes, considering the fuel economy and the oxygen excess ratio as an indicator of performance and health respectively [32].

The initial simulation conditions are as follows: the initial battery SOC of 80%, the initial voltage on the ultracapacitors stack and DC capacitor of 100 V (*VUC* (0) = 100 V) and 200 V (*VC\_DC* (0) = 200 V), and initial FC current of 0 A (*IFC* (0) = 0 A) in order to highlight the initial transitory regime. Different values were considered for the initial values mentioned above. A value of the FC current close to the FC current reference (*Ire f*(*PTC*) ) given by (8) reduced the initial transitory regime.

#### *2.4. Oxygen Excess Ratio*

The oxygen excess ratio (*OER*) was evaluated using (16) [33]:

$$OER = \frac{c\_3 \cdot I\_{\text{FC}}^3 + c\_2 \cdot I\_{\text{FC}}^2 + c\_1 \cdot I\_{\text{FC}} + c\_0}{d\_1 \cdot I\_{\text{FC}} + d\_0} \tag{16}$$

where: *<sup>c</sup>*<sup>0</sup> = 402.6, *<sup>c</sup>*<sup>1</sup> = 8.476 · <sup>10</sup>−<sup>5</sup> [1/*A*], *c*<sup>2</sup> = −0.81252 [1/*A* 2 ], *d*<sup>3</sup> = 0.02673 [1/*A* 3 ], *d*<sup>0</sup> = 0.997, and *d*<sup>1</sup> = 61.38.

The obtained results in stationary and dynamic regimes will be presented in the next sections.

#### **3. Results**

#### *3.1. Performance of Strategies Fuel-1GES, Air-1GES and Air*/*Fuel-2GES SW*

The performance of strategies Fuel-1GES, Air-1GES, and Air/Fuel-2GES SW were analyzed for different levels of load by total fuel consumption during 20 s (see Table 1). The *Pref* threshold for best fuel economy should be chosen around 3 kW (see Figure 6). The values in the last column are summarized for *Pref* = 3.2 kW.

**3. Results**


**Table 1.** Fuel consumption of strategies Fuel-1GES, Air-1GES, and Air/Fuel-2GES. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 11 of 28

**Figure 6.** Fuel consumption of strategies Fuel-1GES (global extremum seeking), Air-1GES and Air/Fuel-2GES. **Figure 6.** Fuel consumption of strategies Fuel-1GES (global extremum seeking), Air-1GES and Air/Fuel-2GES.

**Table 1.** Fuel consumption of strategies Fuel-1GES, Air-1GES, and Air/Fuel-2GES. Thus, an increase in fuel economy is expected during dynamic load cycles with levels in the range of zero power to maximum power.

**Pload FuelT(Air-1GES) FuelT(Fuel-1GES) FuelT(Air/Fuel-2GES)** (kW) (L) (L) (L) The performance of the strategies mentioned above were evaluated using the load cycle shown in Figure 2. The expected increase in fuel economy will be highlighted in the next section.

#### 2 1.22 −0.09 −0.09 3 −0.25 −0.24 −0.24 *3.2. Fuel Consumption for FC HPS (with kRES* = *0)*

evaluated by using (18):

range of zero power to maximum power.

4 −0.71 −0.25 −0.71 5 −1.03 −0.46 −1.03 6 −2.08 −1.58 −2.08 Fuel consumption during the load cycle of 20 s shown in Figure 2 is reported in the first row of Table 2 for strategies sFF, Fuel-1GES, Air-1GES, Air/Fuel-2GES SW, and Air/Fuel-2GES. The fuel economy compared to sFF strategy is presented in the second row of Table 2 using (17).

$$
\Delta\text{Fuel}\_{T(strustey)} = \text{Fuel}\_{T(s\text{FF})} - \text{Fuel}\_{T(strustey)}\tag{17}
$$

*FuelT sFF* ( )

(18)

,

The performance of the strategies mentioned above were evaluated using the load cycle shown in Figure 2. The expected increase in fuel economy will be highlighted in the next section. **Table 2.** Fuel consumption, fuel economy, and percentages of fuel economy compared to *FuelT*(*sFF*) (*kRES* = 0) during the load cycle shown in Figure 2.


( )

*T sFF*

The last row of Table 2 presents the percentages of fuel economy compared to

( )

*T strategy*

*Fuel*

*FuelT strategy* ( )

strategy.

%*FuelT strategy* ( )

**Strategy**

The last row of Table 2 presents the percentages of fuel economy compared to *FuelT*(*sFF*) , evaluated by using (18): **Parameter (Unit) 2GES SW 2GES** *FuelT strategy* ( ) (liters) 286.5 278.4 279.4 275.2 274

**sFF Fuel-1GES Air-1GES Air/Fuel-**

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 12 of 28

**Table 2.** Fuel consumption, fuel economy, and percentages of fuel economy compared to

$$\%Fuel\_{T(strustgy)} = 100 \cdot \left(\frac{Fuel\_{T(sFF)} - Fuel\_{T(strustgy)}}{Fuel\_{T(sFF)}}\right) \tag{18}$$

*FuelT sFF* ( )

**Air/Fuel-**

As was expected, the fuel economy increased for all strategies compared to sFF strategy and for Air/Fuel-2GES SW strategy compared to the strategies Fuel-1GES and Air-1GES. As was expected, the fuel economy increased for all strategies compared to sFF strategy and for

To highlight other aspects of the analyzed strategies (such as battery operation in charge-sustained mode or values of other performance indicators) and then discuss them comparatively in the discussion section, the behavior of the FC RES HPS using *kRES* = 0 and strategies sFF, Fuel-1GES, Air-1GES, and Air/Fuel-2GES is presented in Figures 7–10 respectively. The graphs show the load power profile (*Pload*), oxygen excess ratio (OER), ESS power (*PESS*), airflow rate (*AirFr*), fuel flow rate (*FuelFr*), total fuel consumption (*FuelT*), fuel efficiency (*Fuele*ff), and electrical energy efficiency of FC system (η*sys PFCnet*/*PFC*). Air/Fuel-2GES SW strategy compared to the strategies Fuel-1GES and Air-1GES. To highlight other aspects of the analyzed strategies (such as battery operation in chargesustained mode or values of other performance indicators) and then discuss them comparatively in the discussion section, the behavior of the FC RES HPS using *kRES* = 0 and strategies sFF, Fuel-1GES, Air-1GES, and Air/Fuel-2GES is presented in Figures 7–10 respectively. The graphs show the load power profile (*Pload*), oxygen excess ratio (OER), ESS power (*PESS*), airflow rate (*AirFr*), fuel flow rate (*FuelFr*), total fuel consumption (*FuelT*), fuel efficiency (*Fueleff*), and electrical energy efficiency of FC

The behavior of Air/Fuel-2GES SW strategy is not presented because its operation is based on the switching of strategies Fuel-1GES and Air-1GES depending on the chosen threshold *Pref*, so the waveforms would evolve in the same logic. system (*ηsys PFCnet/PFC*). The behavior of Air/Fuel-2GES SW strategy is not presented because its operation is based on the switching of strategies Fuel-1GES and Air-1GES depending on the chosen threshold *Pref*, so the

OER varied within the admissible limits for all the analyzed strategies, highlighting a safe operation for the FC system. OER variation will be detailed in Section 3.4 for FC RES HPS with *kRES* = 0 and *kRES* = 1. waveforms would evolve in the same logic. OER varied within the admissible limits for all the analyzed strategies, highlighting a safe operation for the FC system. OER variation will be detailed in Section 3.4 for FC RES HPS with *kRES* =

ESS power was almost zero during constant load levels (stationary regimes), except for transient regimes when the power balance was dynamically compensated by ESS, highlighting a battery operation in the charge-sustained mode for all the analyzed strategies. 0 and *kRES* = 1. ESS power was almost zero during constant load levels (stationary regimes), except for transient regimes when the power balance was dynamically compensated by ESS, highlighting a battery

operation in the charge-sustained mode for all the analyzed strategies.

**Figure 7.** Main waveforms for fuel cell (FC) RES HPS using *kRES* = 0 and static feed-forward (sFF) **Figure 7.** Main waveforms for fuel cell (FC) RES HPS using *kRES* = 0 and static feed-forward (sFF) strategy.

the PTC reference (

*ref PTC* ( ) *I*

each analyzed strategy and the load cycle of 20 s shown in Figure 2.

Fueling flow rates (*AirFr* and *FuelFr*) were set by FC current in sFF strategy, so both followed

The values of total fuel consumption have been provided in the first row of Tables 2 and 3 for

Air-1GES respectively. So, compared to sFF strategy, minor changes were seen in *FuelFr* and *AirFr* which were used in optimization by the strategies Fuel-1GES and Air-1GES respectively. Air/Fuel-2GES strategy used both fueling flow rates in optimization, so minor changes were seen in both

). *AirFr* and *FuelFr* were set by FC current in the strategies Fuel-1GES and

**Figure 8.** Main waveforms for FC RES HPS using *kRES* = 0 and Fuel-1GES strategy. *Sustainability*  **Figure 8. 2020**, *1* Main waveforms for FC RES HPS using *2*, x FOR PEER REVIEW *kRES* = 0 and Fuel-1GES strategy. 14 of 28

**Figure 9.** Main waveforms for FC RES HPS using *kRES* = 0 and Air-1GES strategy. **Figure 9.** Main waveforms for FC RES HPS using *kRES* = 0 and Air-1GES strategy.

economy and the percentages of fuel economy were evaluated using (19) and (20).

( ) ( ) ( ) *RES RES RES Fuel Fuel Fuel T strategy T sFF T strategy*

*RES T sFF T strategy T strategy RES*

balance from RES, i.e., for *kRES* = 1.

*3.3. Fuel Consumption for FC RES HPS with kRES = 1*

*Fuel*

( )

% 100

FC power variation will be detailed in Section 3.4 for FC RES HPS with *kRES* = 0 and *kRES* = 1. The

Fuel consumption, the fuel economy, and the percentages of fuel economy compared to the sFF strategy during the 20 s load cycle and RES power profile shown in Figures 2 and 3a are given in Table 3 for strategies sFF, Fuel-1GES, Air-1GES, Air/Fuel-2GES SW, and Air/Fuel-2GES. The fuel

( ) ( )

 

*RES RES*

*Fuel Fuel*

*Fuel*

( )

*T sFF*

(19)

(20)

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 15 of 28

**Figure 10.** Main waveforms for FC RES HPS using *kRES* = 0 and Air/Fuel-2GES strategy. **Figure 10.** Main waveforms for FC RES HPS using *kRES* = 0 and Air/Fuel-2GES strategy.

**Table 3.** Fuel consumption, fuel economy, and percentages of fuel economy compared to ( ) *RES FuelT sFF* (*kRES* = 1) during the load cycle and RES power profile shown in Figure 2 and Figure 3a. **Strategy Parameter (Unit) sFF Fuel-1GES Air-1GES Air/Fuel-2GES SW Air/Fuel-2GES** ( ) *RES FuelT strategy* (liters) 123.6 113.9 114.1 107.6 108.2 Fueling flow rates (*AirFr* and *FuelFr*) were set by FC current in sFF strategy, so both followed the PTC reference (*Ire f*(*PTC*) ). *AirFr* and *FuelFr* were set by FC current in the strategies Fuel-1GES and Air-1GES respectively. So, compared to sFF strategy, minor changes were seen in *FuelFr* and *AirFr* which were used in optimization by the strategies Fuel-1GES and Air-1GES respectively. Air/Fuel-2GES strategy used both fueling flow rates in optimization, so minor changes were seen in both fueling flow rates compared to sFF strategy.

( ) *RES FuelT strategy* (liters) 0 9.7 9.5 16 15.4 % ( ) *RES FuelT strategy* (%) 0 7.85 7.69 12.94 12.46 The values of total fuel consumption have been provided in the first row of Tables 2 and 3 for each analyzed strategy and the load cycle of 20 s shown in Figure 2.

As was expected, fuel consumption decreased due to the contribution of the RES power on DC bus (see the first row of Tables 2 and 3). Note also that the fuel economy increased for the Air/Fuel-**Table 3.** Fuel consumption, fuel economy, and percentages of fuel economy compared to *FuelRES T*(*sFF*) (*kRES* = 1) during the load cycle and RES power profile shown in Figures 2 and 3a.


Two important indicators for evaluating the performance of a strategy are fuel efficiency (*Fuele*ff) and electrical energy efficiency of the FC system (η*sys PFCnet*/*PFC*). An exhaustive analysis (for *kfuel* = 0, 25, and 50 (Lpm/W) of these performance indicators for seven strategies proposed in the literature

(including strategies Fuel-1GES, Air-1GES, and Air/Fuel-2GES) is presented in [34] compared to the sFF strategy. Here η*sys* variation is presented to highlight the similar values obtained for FC net power.

FC power variation will be detailed in Section 3.4 for FC RES HPS with *kRES* = 0 and *kRES* = 1. The next section will present the results for FC RES HPS with power support in maintaining to DC power balance from RES, i.e., for *kRES* = 1.

## *3.3. Fuel Consumption for FC RES HPS with kRES* = *1*

Fuel consumption, the fuel economy, and the percentages of fuel economy compared to the sFF strategy during the 20 s load cycle and RES power profile shown in Figures 2 and 3a are given in Table 3 for strategies sFF, Fuel-1GES, Air-1GES, Air/Fuel-2GES SW, and Air/Fuel-2GES. The fuel economy and the percentages of fuel economy were evaluated using (19) and (20).

$$\Delta\text{Fuel}\_{T(strategy)}^{\text{RES}} = \text{Fuel}\_{T(s\text{FF})}^{\text{RES}} - \text{Fuel}\_{T(strategy)}^{\text{RES}} \tag{19}$$

$$\% \text{Fuel}\_{T(sttarget)}^{\text{RES}} = 100 \cdot \left( \frac{\text{Fuel}\_{T(sFF)}^{\text{RES}} - \text{Fuel}\_{T(sttarget)}^{\text{RES}}}{\text{Fuel}\_{T(sFF)}^{\text{RES}}} \right) \tag{20}$$

As was expected, fuel consumption decreased due to the contribution of the RES power on DC bus (see the first row of Tables 2 and 3). Note also that the fuel economy increased for the Air/Fuel-2GES SW strategy compared to the strategies Fuel-1GES and Air-1GES (see the second row of Tables 2 and 3). It is also worth mentioning that here the fuel economy was better for the Air-1GES strategy compared to the Fuel-1GES strategy (because the FC power requested was lower due to the contribution of the RES power on DC bus). This also explains better fuel economy for the Air/Fuel-2GES SW strategy compared to the Air/Fuel-2GES strategy (see the second row of Tables 2 and 3).

To compare HPS operation with and without RES power support to DC power balance, the same strategies were used. So, the behavior of the FC RES HPS using *kRES* = 1 and strategies sFF, Fuel-1GES, Air-1GES, and Air/Fuel-2GES is presented in Figures 11–14 respectively. The structure of the graphs is identical to the one mentioned above for Figures 7–10, except for the inclusion of RES power as in the second graph in Figures 11–14.

The values of total fuel consumption presented in the seventh graph have been registered in see the first row of Table 3 for each analyzed strategy.

The following observations can be made for the FC RES HPS using *kRES* = 1:


So, as it was mentioned, OER variation will be presented and commented on in the next section for FC RES HPS with *kRES* = 0 and *kRES* = 1.

the second graph in Figures 11–14.

To compare HPS operation with and without RES power support to DC power balance, the same strategies were used. So, the behavior of the FC RES HPS using *kRES* = 1 and strategies sFF, Fuel-1GES, Air-1GES, and Air/Fuel-2GES is presented in Figures 11–14 respectively. The structure of the graphs

*Sustainability*  **Figure 11. 2020**, *12* Main waveforms for FC RES HPS using **F** , x FOR PEER REVIEW **igure 11.** Main waveforms for FC RES HPS using *kRES k* = 1 and sFF strategy. *RES* = 1 and sFF strategy. 17 of 28

**Figure 12.** Main waveforms for FC RES HPS using **Figure 12.** Main waveforms for FC RES HPS using *kRESk* = 1 and Fuel-1GES strategy. *RES* = 1 and Fuel-1GES strategy.

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 18 of 28

**Figure 13.** Main waveforms for FC RES HPS using **Figure 13.** Main waveforms for FC RES HPS using *kRESkRES* = 1 and Air = 1 and Air-1GES strategy. -1GES strategy. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 19 of 28

**Figure 14.** Main waveforms for FC RES HPS using *kRES* = 1 and Air/Fuel-2GES strategy. **Figure 14.** Main waveforms for FC RES HPS using *kRES* = 1 and Air/Fuel-2GES strategy.

the first row of Table 3 for each analyzed strategy.

the shape of power requested on DC bus,

operation for FC RES HPS using *kRES* = 1.

with *kRES* = 1 as well.

paper.

The values of total fuel consumption presented in the seventh graph have been registered in see

on RES power, highlighting the battery operation in the charge-sustained mode for FC RES HPS

*p p p DCreq Load RES*

 Fueling flow rates (*AirFr* and *FuelFr*) would have evolution as was explained for FC RES HPS with *kRES* = 0, except that for FC RES HPS with *kRES* = 1 the PTC reference and FC currentfollowed

 It is worth mentioning the low values of the performance indicators (*Fueleff* and *ηsys PFCnet/PFC*) during the operation of the FC system at low power. This mode of operation should be avoided by shutting down the FC system, but shutting down and starting of the FC system are complex processes [35]. An appropriate strategy must therefore be implemented in case the FC system operates for a long time at low power. However, these aspects are not in the objectives of this

OER varied within the admissible limits for all the analyzed strategies, highlighting a safe

#### *3.4. Oxygen Excess Ratio for FC RES HPS with kRES* = *0 and kRES* = *1* for FC RES HPS with *kRES* = 0 and *kRES* = 1.

The oxygen excess ratio of FC RES HPS with *kRES* = 0 is presented in Figure 15 for all strategies. OER varied within the limits of 2.2 and 3.6, which demonstrates the safe operation of HPS without RESs (*kRES* = 0). *3.4. Oxygen Excess Ratio for FC RES HPS with kRES = 0 and kRES = 1* The oxygen excess ratio of FC RES HPS with *kRES* = 0 is presented in Figure 15 for all strategies. OER varied within the limits of 2.2 and 3.6, which demonstrates the safe operation of HPS without RESs (*kRES* = 0).

So, as it was mentioned, OER variation will be presented and commented on in the next section

**Figure 15.** Oxygen excess ratio for FC RES HPS with *kRES* = 0. **Figure 15.** Oxygen excess ratio for FC RES HPS with *kRES* = 0.

Oxygen excess ratio of FC RES HPS with RESs (*kRES* = 1) is presented in Figures 16–19 using the strategies sFF, Fuel-1GES, Air-1GES, and Air/Fuel-2GES respectively. OER variations were represented in different Figures to highlight small variations from one strategy to another (as is the case with ESS power for example). OER varied approximately in the range from 2.3 to 7, so within the allowed limits of safe operation of the FC system. The same situation (with some minor differences between the representations obtained using Oxygen excess ratio of FC RES HPS with RESs (*kRES* = 1) is presented in Figures 16–19 using the strategies sFF, Fuel-1GES, Air-1GES, and Air/Fuel-2GES respectively. OER variations were represented in different Figures to highlight small variations from one strategy to another (as is the case with ESS power for example). OER varied approximately in the range from 2.3 to 7, so within the allowed limits of safe operation of the FC system.

the strategies analyzed in this study) applied in the case of FC net power (see next section). The same situation (with some minor differences between the representations obtained using the strategies analyzed in this study) applied in the case of FC net power (see next section).

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 21 of 28

**Figure 16.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and sFF strategy. **Figure 16.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and sFF strategy. **Figure 16.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and sFF strategy.

**Figure 17.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and Fuel-1GES strategy. **Figure 17.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and Fuel-1GES strategy. **Figure 17.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and Fuel-1GES strategy.

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 22 of 28

**Figure 18.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and Air-1GES strategy. **Figure 18.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and Air-1GES strategy. **Figure 18.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and Air-1GES strategy.

**Figure 19. Figure**  Oxygen excess ratio for FC RES HPS with **19.** Oxygen excess ratio for FC RES HPS with *k kRESRES* = 1 and Air/Fuel = 1 and Air/Fuel-2GES strategy. -2GES strategy.

**Figure 19.** Oxygen excess ratio for FC RES HPS with *kRES* = 1 and Air/Fuel-2GES strategy. *3.5. FC Net Power Requested from FC RES HPS with kRES* = *0 and kRES* = *1*

FC net power requested to sustain the DC power flow balance of FC RES HPS with *kRES* = 0 and *kRES* = 1 are presented in Figures 20 and 21 for all strategies analyzed in this study.

*3.5. FC Net Power Requested from FC RES HPS with kRES = 0 and kRES = 1*

*kRES* = 1 are presented in Figures 20 and 21 for all strategies analyzed in this study.

*3.5. FC Net Power Requested from FC RES HPS with kRES = 0 and kRES = 1*

FC net power requested to sustain the DC power flow balance of FC RES HPS with *kRES* = 0 and

FC net power requested to sustain the DC power flow balance of FC RES HPS with *kRES* = 0 and

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 23 of 28

**Figure 21.** FC net power requested from FC RES HPS with *kRES* = 1. **Figure 21.** FC net power requested from FC RES HPS with *kRES* = 1.

**Figure 21.** FC net power requested from FC RES HPS with *kRES* = 1. One issue that may be of interest in using these strategies, which are part of the class of strategies that use the same setting, is whether it can be identified based on the measurements made.

In addition to other discussions of the results obtained, the next section will show how to identify whether the strategy uses one or two GES controllers by simply processing the fuel consumption measurements for HPS with *kRES* = 0 and *kRES* = 1.

#### **4. Discussion**

The results obtained for HPS with *kRES* = 0 and *kRES* = 1 in Sections 3.1 and 3.2 are summarized in Tables 4 and 5, where other indicators have been calculated and discussed below.


**Table 4.** Fuel consumption for FC RES HPS with *kRES* = 0 and *kRES* = 1.

**Table 5.** Fuel economy for FC RES HPS with *kRES* = 0 and *kRES* = 1.


*FuelRES T*(*strategy*)

Ratio *FuelT*(*strategy*) was in range of 39.1 to 40.91 for the strategies analyzed in this study (Fuel-1GES, Air-1GES, Air/Fuel-2GES SW and Air/Fuel-2GES), highlighting the contribution of RESs to DC power flow balance compared to load demand (measured by the ratio between the average values of these powers).

If the dependency relationship is chosen linearly, then *FuelRES T*(*strategy*) *FuelT*(*strategy*) 1.2 · *Pload*(*AV*)−*PRES*1(*AV*) *Pload*(*AV*) − 0.2. This is verified in two points, as follows:

$$P\_{\text{load}(AV)} = \dots \text{ kW}\_{\prime}\\P\_{\text{RES1}(AV)} = 0 \Rightarrow 1 = \frac{\text{Fuel}\_{T(\text{stuffgy})}^{\text{EES}}}{\text{Fuel}\_{T(\text{stuffgy})}} \triangleq 1.2 \cdot \frac{P\_{\text{fall}(AV)} - P\_{\text{RES1}(AV)}}{P\_{\text{ball}(AV)}} - 0.2 = 1.2 \cdot \frac{5}{5} - 0.2 = 1 \tag{21}$$

$$P\_{\text{fail}(AV)} = 5 \text{ kW}, P\_{\text{RES1}(AV)} = 2.5 \text{ kW} \\ \Rightarrow 0.4 \approx \frac{\text{Fuel}\_{T(\text{entity})}^{\text{RES}}}{\text{Fuel}\_{T(\text{entity})}} \\ \Rightarrow 1.2 \cdot \frac{P\_{\text{fail}(AV)} - P\_{\text{RES1}(AV)}}{P\_{\text{fail}(AV)}} - 0.2 = 1.2 \cdot \frac{5 - 2.5}{5} - 0.2 = 0.4 \tag{22}$$

Minor differences between the ratio's values obtained with each strategy do not help to define some subclasses. However, the values obtained (close to 40), which was much higher than the value of 43.14 obtained in the case of sFF strategy, shows that all strategies use a similar technique to reduce fuel consumption.

Fuel economy for FC RES HPS with *kRES* = 0 and *kRES* = 1 is computed in Table 5 as percent from fuel consumption using sFF strategy.

Ratio %*FuelRES T*(*strategy*) %*FuelT*(*strategy*) was in range of 2.78 to 3.28 for strategies analyzed in this study, highlighting the same thing as the *FuelRES T*(*strategy*) *FuelT*(*strategy*) ratio (the contribution of RESs to DC power

flow balance compared to load demand). In this case, the linear dependence is given by %*FuelRES T*(*strategy*) %*FuelT*(*strategy*) 2.2 · *<sup>P</sup>load*(*Max*)−(*Pload*(*AV*)−*PRES*1(*AV*)) *Pload*(*Max*)−*Pload*(*AV*) − 1.2.

Considering *Pload*(*Max*) = η*boost* · *PFCnet*(*Max*) 7.6 *kW*, this relation is verified in two points, as follows:

$$P\_{\text{ball}(AV)} = 5 \text{ kW}, P\_{\text{RES1}(AV)} = 0\\ \Rightarrow 1 = \frac{\% \text{Fuel}\_{T(\text{stutge})}^{\text{ESS}}}{\% \text{Fuel}\_{T(\text{stutge})}} \triangleq 2.2 \cdot \frac{P\_{\text{ball}(\text{Max})} - \left(P\_{\text{ball}(AV)} - P\_{\text{RES1}(AV)}\right)}{P\_{\text{ball}(\text{Max})} - P\_{\text{Luid}(AV)}}\\ -1.2 = 2.2 \cdot 1 - 1.2 = 1 \tag{23}$$

$$\begin{array}{l} P\_{\text{load}(AV)} = \mathbf{5} \text{ kW}, P\_{\text{RES1}(AV)} = \mathbf{2.5} \text{ kW} \Rightarrow\\ \mathbf{5} \text{ mA}^{\text{BES}}\_{T(\text{sttry})} \approx \mathbf{2.2} \cdot \frac{P\_{\text{load}(\text{Max})} - \left(P\_{\text{load}(AV)} - P\_{\text{RES1}(AV)}\right)}{P\_{\text{load}(\text{Max})} - P\_{\text{load}(AV)}} - 1.2 = \mathbf{2.2} \cdot \frac{7.6 - (5 - 2.5)}{7.6 - 5} - 1.2 \neq 3.115 \end{array} \tag{24}$$

However, the difference %*FuelRES T*(*stategy*) <sup>−</sup> %*FuelT*(*stategy*) clearly shows that two subclasses can be defined: (1) the class of the strategies Fuel-1GES, Air-1GES (which use one GES controller) and (2) the class of the strategies Air/Fuel-2GES SW and Air/Fuel-2GES (which use two GES controllers). It is worth mentioning that the fuel economy was biggest when using Air/Fuel-2GES SW or Air/Fuel-2GES strategies because these use two GES controllers instead of one. This means a search with two variables in a larger search space.

Other findings of the study performed for HPS with *kRES* = 0 and *kRES* = 1 in Sections 3.1 and 3.2 were the following:


The main findings of the study performed for HPS with *kRES* = 0 and *kRES* = 1 in Sections 3.3 and 3.4 were the following:


This problem of recognizing subclasses of performance from the same class of optimization strategies can also arise for FC HPS (i.e., FC vehicles) by considering two different load cycles and evaluating the performance indicator %*Fuelload*<sup>1</sup> *T*(*stategy*) <sup>−</sup> %*Fuelload*<sup>2</sup> *T*(*stategy*) .

Furthermore, taking into account different load cycles, the validity of linear relationships such as those introduced below will be verified for other strategies proposed in the literature:

$$\frac{Fuel\_{T(strategy)}^{load1}}{Fuel\_{T(strategy)}^{load2}} \cong a\_1 \cdot \frac{P\_{load1(AV)}}{P\_{load2(AV)}} - a\_2 \tag{25}$$

$$\frac{\% \text{Fuel}^{\text{load1}}\_{T(\text{strategy})}}{\% \text{Fuel}^{\text{load2}}\_{T(\text{strategy})}} \cong a\_3 \cdot \frac{P\_{\text{load}(\text{Max})} - P\_{\text{load1}(\text{AV})}}{P\_{\text{load}(\text{Max})} - P\_{\text{load2}(\text{AV})}} - a\_4 \tag{26}$$

where *Fuelload T*(*strategy*) is the fuel consumed during the load cycle, %*Fuelload T*(*strategy*) = 100 · *Fuelload T*(*re f erence*) <sup>−</sup>*Fuelload T*(*strategy*) *Fuelload T*(*re f erence*) ! is computed using a reference strategy, and parameters *a*<sup>i</sup> , i = 1–4, are specifically determined for each strategy.

Evaluating these ratios would allow a rough estimate of fuel consumption over a predicted load cycle up to the first refueling station based on the fuel consumption on a standard load cycle or during the previous load cycle. Thus, the warning system would signal when it is necessary to refuel from nearby stations.

#### **5. Conclusions**

In this study, four fuel economy strategies that use fuel cell optimization through the control of the fueling regulators in the conditions and one reference strategy were analyzed in the conditions in which all strategies used power tracking control of the fuel cell boost converter.

The performance of a strategy (measured for example by the fuel consumption of the FC system) depended on the level of power required from the FC system during a load cycle. Thus, the energy management unit must have a subsystem for selecting the best strategy based on the current value of the load demand and RES power.

If the optimization strategy uses two GES controllers (extending the search for the optimal in two coordinates), then it is recommended to use the Air/Fuel-2GES SW strategy for 0 < *PFC* < *Pref*, and the Air/Fuel-2GES strategy for *Pref* < *PFC* < *PFC(max)*. The percentages of fuel economy for strategies Air/Fuel-2GES SW and Air/Fuel-2GES compared to the reference strategy were of 3.94% and 4.36%, and of 12.94% and 12.46%, in the case of a dynamic load cycle with an average of 5 kW and 2.5 kW.

The next research work will focus on testing if the identified indicator (%*FuelRES T*(*stategy*) − %*FuelT*(*stategy*) ) can recognize subclasses of performance from the same class of optimization strategies. For this, experimental validation to evaluate model accuracy will be performed using the general indicator (%*Fuelload*<sup>1</sup> *T*(*stategy*) <sup>−</sup> %*Fuelload*<sup>2</sup> *T*(*stategy*) ). The results presented in this paper highlight the fact that this approach has great chances of being confirmed.

The use of only ultracapacitors stacks instead of hybrid battery/ultracapacitors ESS will also be analyzed in terms of compensation and size performance for use in FC vehicles.

**Author Contributions:** Conceptualization, methodology, writing—original draft preparation: N.B.; investigation, writing—reviewing and editing: P.T. and D.G. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was partially supported by the International Research Partnerships: Electrical Engineering Thai-French Research Center (EE-TFRC) between King Mongkut's University of Technology North Bangkok and Université de Lorraine under Grant KMUTNB-BasicR-64-17.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## *Article* **New Market Model with Social and Commercial Tiers for Improved Prosumer Trading in Microgrids**

**Bogdan-Constantin Neagu \* , Ovidiu Ivanov , Gheorghe Grigoras , Mihai Gavrilas and Dumitru-Marcel Istrate**

Department of Power Engineering, Gheorghe Asachi Technical University of Iasi, 700050 Iasi, Romania; ovidiuivanov@tuiasi.ro (O.I.); ggrigor@tuiasi.ro (G.G.); mgavril@tuiasi.ro (M.G.); mistrate@tuiasi.ro (D.-M.I.) **\*** Correspondence: bogdan.neagu@tuiasi.ro; Tel.: +40-232-70-11-10

Received: 13 August 2020; Accepted: 2 September 2020; Published: 4 September 2020

**Abstract:** In the deregulated electricity markets, trading prices are determined by the offer-demand mechanism, and retail consumers can negotiate tariffs with their supplier of choice. For classic wholesale suppliers, the tariffs are determined by the prices of transactions performed on the wholesale market. In parallel with becoming eligible for participating in the market, the consumers use increasingly local generation sources based mostly on renewable electricity generation equipment such as Photovoltaic (PV) panels, and become prosumers. They want to be able to sell back to the market the generation surplus, in order to obtain the maximum benefits from their initial investment. This paper proposes a two-tier local market model oriented for prosumers and consumers connected in microgrids, based on the blockchain technologies and other technologies and concepts such as smart grids, crowdsourcing and energy poverty. Its goals are to improve the possibilities of local prosumers to sell electricity to local consumers and to increase their profitability, compared to the trading model often used in developing markets, of selling the surplus back to the grid via aggregators. The research aims to contribute to the sustainable development of the electricity sector using new and renewable sources of energy, state-of the art technologies and smart contracts, leading to prosumer proliferation and electricity cost reduction for consumers.

**Keywords:** local electricity market; smart grids; energy crowdsourcing; renewable energy sources; prosumers; blockchain technology; energy poverty; smart contracts

### **1. Introduction**

The European Commission's strategic framework envisages an improved and modernized European energy market, aimed at creating secure, sustainable, accessible and decentralized energy networks in response to the global challenge of greenhouse gas emissions [1]. In the context of the next generation of digital energy networks, and in the presence of multiple decentralized microgrids, managing the energy generation from various and complementary sources will result in gaining more flexibility in meeting demand and lowering costs for the community. The adoption of a decentralized electricity distribution network, in which ordinary consumers can also be energy producers, named 'prosumers', and can sell their surplus generation to the network, thus getting involved in market transactions inside a community represents an alternative to current traditional networks. It is expected that an increasing number of end-users will want to become active in the electricity sector, which will lead to a large number of transactions. A possible tool for enabling the creation of such microgrid-level markets is the blockchain technology which could provide secure and reliable means of communication and data management between the end-users [2].

Blockchain technology was created as a solution to the problem of mistrust and data security. The first steps in the development of the technology were taken in 1991, when Stuart Haber and

W. Scott Stornetta first spoke about a cryptographically secure blockchain [3]. In 1993, together with Dave Bayer, they integrated optimal Merkel type trees in the concept [4]. Following the financial crisis of 2008, the concept of blockchain as a distributed database was developed, proposing a solution to change the way monetary transactions are carried out through various financial institutions. With the help of a peer-to-peer (P2P) communications network and a distributed data server, a blockchain database can be autonomous [5].

In the recent years, billions of dollars have been invested in research on blockchain technology in an attempt to make the most of its potential and understand how appropriate it is in the different economic domains [6]. But not all domains are fully ready to assimilate the blockchain technology. In each particular case, the current technological opportunities must be analyzed, as well as the challenges that the end-users face and how a new decentralized architecture could create value for them. The electricity industry is an extremely suitable candidate for blockchain technology-based innovation, with its complex supply chain that requires transparency and improved data processing and its highly transactional trading market that would gain advantage from faster settlement. The transparency and immutability of the blockchain can empower end-users of this industry and consumers.

A blockchain system is primarily based on a decentralized ledger of transactions that take place in a network. This network consists of nodes owned by independent entities that use a cryptographic protocol to validate the transactions that are entered in the ledger and to ensure that the entered data cannot be altered or changed. It is immutable, secure and completely transparent. Fully decentralized and replicated to node level, blockchain networks are harder to penetrate and manipulate by dangerous entities.

The blockchain system, coupled with other innovative technologies such as smart grids, big data mining and remote sensing, has the potential to provide solutions to various challenges in the energy sector and to contribute to the achievement of energy efficiency objectives, including to compensate for the funding gap for various projects in the field [7]. The technologies regarding blockchain-based platforms will lead to fundamental changes that will require the involvement of the distribution and supply companies, manufacturers of equipment, regulators and, last but not least, end-users [8,9].

A review of renewable and sustainable energy published in [6] provides a thorough analysis of more than 140 blockchain research projects and startups in the energy sector, from countries belonging all around the world. The electricity sector has a high potential to implement the blockchain technology as part of addressing several challenges [7,10,11]:


reducing energy poverty. They meet those objectives by developing solidarity schemes aimed at lowering the energy bills of vulnerable members, providing them with services and training in reducing consumption. They also use the gains from RES energy generation to increase the living standards of vulnerable and low-income households.

• Simplifying the architecture of the current trading models. The implementation of a blockchain-based prosumer network leads to the elimination of a large number of intermediaries in the electricity trading process.

Among the technical advantages of this technology can be underlined the following: better management of power generation, fewer hours of supply interruption, secure energy transactions, increased distributed generation. The main economic advantages refer to protecting the identities of the traders, creating a distributed economy, reducing the tax burdens, data protection and control, and compensation for producers [12,13].

Another concept that can be associated with local electricity trading in microgrids is the mitigation of energy poverty. 'Energy poverty' can be defined as the lack of access to clean, renewable, affordable energy, which leads to costly energy bills [14]. The concept lies at the intersection of energy sustainability and social issues mitigation, being characterized by three realities: high energy prices, low or stagnating incomes, and energy inefficient homes in urgent need of renovations.

The mitigation of energy poverty can be achieved using crowdsourcing, a concept first introduced in 2005 by James Surowiecki [15], which can be defined as utilizing contributions from peers and the collective wisdom of the crowd to alleviate a problem. It can also be an effective approach to enable the crowd to provide a service in a community within a limited geographical area by using smart metering [16].

In Romania, according to Order 228/28.12.2018 published by ANRE (Romanian Energy Regulatory Authority), the prosumers can trade electricity generated from renewable sources such as photovoltaics (PV), biomass, wind, cogeneration. The suppliers are bound to buy the surplus at the weighted average day-ahead market price from the previous year [17], with the advantage of the exemption from the payment of the distribution network tariff. This trading system is the most basic, limiting the options of both parties [18]. More advanced trading models should be considered to increase the benefits of the prosumers and consumers who trade electricity in a local market organized at the microgrid or community level.

Usually, in classic wholesale electricity markets, electricity is traded using bilateral contracts with negotiated prices, for long periods (years, months, weeks). This trading manner helps to reduce the prices for the buyers, and provides stability and predictability for the producers. For shorter trading intervals, such as in the day-ahead (SPOT) markets, the merit order price setting mechanism is preferred, which ensures maximum benefits for producers when the demand is high and can lead to higher prices for suppliers and end-users.

On the other hand, the electricity quantities traded in local grids by prosumers are much smaller, and the trading intervals need to be smaller, because of renewable generation uncertainty. At the same time, the generation from prosumers needs to be incentivized to promote the proliferation of renewable electricity. Thus, a market model for microgrids should take into consideration creating advantages simultaneously for prosumers and consumers.

In this regard, the paper presents a new trading approach for prosumers that uses the blockchain technology for creating a local market at microgrid level, forecasts for consumer buy offers, obtained using technologies such as remote sensing tools, and the energy crowdsourcing concept for energy poverty mitigation. The proposed model takes as reference the trading model for excess prosumer generation used in Romania and applicable to developing markets, which consists in selling back the available electricity at fixed tariffs back to the grid. The authors propose a diversification of the trading methods and settlement procedures by creating a local trading mechanism intended to provide flexible market model that can be adapted to specific microgrid conditions and rules agreed at the community level. The proposed market model has two trading levels. The primary level is

intended for main trading. The secondary, two-tier market is designed by the authors for increasing the prosumer profitability and lowering consumer electricity cost while accommodating particular scenarios that can arise in real conditions. The considered scenarios are: mitigating energy poverty for vulnerable consumers, selling remaining prosumer surplus to consumers who do not participate in the primary market but have bilateral contracts with certain prosumers, allowing occasional access to the market in exchange for a tariff, and reducing the effect of erroneous consumer buy offers caused by inaccurate forecasts or temporary unusual consumption patterns. The primary market model offers two trading alternatives: 'first-come-first-served' (FCFS), and merit-order (MO). The secondary market proposes two tiers with three trading methodologies, which can be optionally used, in number and order, according to the specific needs of particular microgrids: energy poverty mitigation, tariff access and invite access. The proposed alternatives are tested in a case study, on an existing low voltage (LV) electricity distribution network from Romania which has microgrid characteristics, in order to assess the effects of the chosen trading methods on the profits achieved by prosumers and consumers.

The proposed market model provides flexible tools for incentivizing the sustainable development of local communities based on environment protection and economic and social inequality mitigation through the use of modern technology tools, by encouraging local trading of electricity generated from renewable, clean primary sources.

The results of the case study show that by using the local trading mechanisms designed for the primary and secondary markets, the prosumers can sell more electricity, at lower prices for the community and better individual profit. If the benefits are consistent, this can lead to the increase of distributed generation sources in microgrids, thus a more sustainable development of the electricity generation sector.

By lowering consumer prices, the sustainable economic and social development of communities is also encouraged. Not least, these goals are envisioned to be achieved by obtaining in parallel the modernization of the electricity distribution infrastructure, by using smart grid communication and energy management tools and involving digital instruments (specialized trading software and blockchain).

The remainder of the paper is structured as follows. Section 2 presents a literature review regarding the research proposed in the paper. Section 3 describes the proposed market model for microgrids. In Section 4 are presented the results of the case study, with a comparison between the proposed trading strategies, outlining their particularities. The paper ends with the sections dedicated for discussions and references, and annexes.

#### **2. Literature Review**

Recent studies have considered combining the operation of small-scale renewable energy sources (SSRES) in distribution networks and deregulated electricity markets. The range of these studies is covering unit commitment [19] and economic dispatch problems [20], in addition to scheduling of SSRES [21], and the uncertainty of renewable generation [22]. The main trends and approaches currently described in the literature are briefly summarized in the following paragraphs.

As it was presented in the introduction section, in Europe there are currently over 3400 green energy cooperatives (REScoop). In accordance with [23–26], the REScoop notion is defined in EU directives as "local energy communities", according to data from the Federation of Green Energy Cooperatives in Europe. More than one million European citizens are participating in REScoops to invest together in the transition from fossil fuels to clean primary energy resources and energy efficiency. In Romania, starting in 2020, the first established REScoop proposes that future members who generate energy (prosumers) will be able to sell the surplus to other members, rather than to an aggregator, following the concept of 'prosumer-friendly' [27].

In another perspective, paper [28] considers a P2P electricity trading method using a private Ethereum blockchain ledger where all bids are encrypted for anonymity and peer matching is done by a functional encryption-based contract.

Regarding the energy crowdsourcing in prosumer-enabled electrical networks, a small number of published papers is available in the literature [16,29]. The existing studies consider a two-stage algorithm for minimizing the cost of generation and the energy losses by prior rescheduling of user loads and SSRES.

In other work, a particular local energy market model was considered in [30], which integrates different P2P energy trading platforms based on unidirectional market clearing price (MCP) for a microgrid. Moreover, the settlement considers an MCP or P2P mechanism.

The future active distribution network (ADN) is a P2P community based on active energy agent (AEA) users [31]. The maximization of social welfare in local prosumer generation trading with an auction-based mechanism is used in [32]. The same first author considers that in a microgrid the energy flows in a transactive way and the transactions are based on bilateral contracts between peers [33]. Another concept of prosumer surplus trading based on the transactive energy concept is proposed in the literature [34–37]. Paper [34] uses a Stackelberg game-based method for solving the transactive energy problem, in which the DNO and the SSRES aggregators are participating simultaneously in the Local Electricity Market (LEM) and Wholesale Electricity Market (WEM). A comprehensive cost–benefit model for prosumer load sharing was proposed in [35], using game theory and considering non-cooperative game models of the microgrids for prosumers energy surplus. In the same context, a particular social welfare-based concept on transactive energy or demand response (DR) is applied in [36,37] using negotiated prices.

Another way to trade surplus are DR programs, whereby the LEM operators play a vital role in managing the exchange of data, to ensure the notification flow between balancing authorities, service companies and end-users. First, the microgrid operator assesses the electricity consumption patterns based on the structure of variable electricity tariffs and prices to establish trading plans. They also sign bilateral P2P contracts with end-users to take direct control of specific energy assets [38]. This information is aggregated to create commitment portfolios—load reduction schedules that are provided to network operators in exchange for compensation commensurate with the size of the capacity involved [39]. In the event of a system emergency or demand, the DSO shall request the aggregator to reduce or increase a portion of the contracted portfolio. For this reason, the aggregator receives additional compensation which can take the form of tariff reductions, incentive payments and invoice credits.

Using online platforms [40–46], the consumers can become prosumers who create and distribute their own information about the energy generation. Some authors proposed a demurrage mechanism (DM) and Home Energy Management (HEM) for prosumers' energy surplus in an LEM based on blockchain [41]. A particular P2P business model for 48 residential prosumers with PV panels installed in a Swedish village is proposed in [42]. This article identifies some new potential opportunities for optimizing the LEM and its variables for the best gain, taking into account that a significant influence is represented by the integration of energy demand, generation supply, and LEM rules. The aforementioned study can be used to provide information for regulatory bodies to create a fair, useful and cost-effective P2P electricity trading framework for prosumers. Another comprehensive platform for prosumers' digitalization was recommended in [43], and market simulations are developed in [44,45] for consumers integration in microgrids. In the same manner, a virtual platform was proposed in [46] for efficient management of multiple energy prosumers (MEP).

The presence of decentralized energy sources demands the analysis of the problem of continuity of energy supply to operators whose activities significantly depend on electricity. There are EU countries where power outages amount to about 20 min per year, but in other cases the average power outages range from 450 to 500 min [47]. Prosumers' microinstallations ensure the business continuity for producers in such countries and negotiated surplus trading increases social welfare [48]. Because the SSRES efficiency depends on atmospheric conditions and regional climate, even minor temporary changes in weather conditions can cause significant variability in power generation at different time and space scales. Methodologies based on the remote sensing of atmospheric conditions are the primary source of information for the development of numerical forecasting models that support the planning and operation of power systems in the presence of intermittent energy sources [49]. For local trading of such electricity surplus, the LEM operators consider the blockchain concept [11,12,16,28,29,40,41,48] or direct bilateral contracts [50,51]. These market models aim to provide secure and affordable energy supply for the end user, which is essential for the functioning of an economy in which energy poverty is reduced and the needs of vulnerable social groups are taken into account [52–54]. Social welfare is obtained by the authors in [53], where the smart P2P contracts are considered as a distributed optimization problem, solved with a virtual aggregator based on the Alternating Direction Method of Multipliers (ADMM). All the LEM actions can be completed by the peers who do not necessarily trust each other through an agreement algorithm which defines the speed of the transactions. One of the most used algorithms is the Proof-of-Work (PoW) [55]. Nonetheless, previous articles about energy sustainability have paid limited attention to prosumer engagement, management and administration. For example, according to [56,57] each of the providers can have a proper trading platform with specific architecture for sustainable planning of the local microgrid or region.

From other perspectives, the prosumer surplus trading process based on the specific transactive energy microgrids are examined by the researchers in [58–60]. The prosumers' aggregation to one group with the same interest based on virtual microgrids is analyzed by the authors in [61] for bill cost reduction as a particular energy poverty mitigation or social welfare. The aforementioned problem can be solved in smart buildings by using ADMM for energy sharing between the players, as is shown in [62,63].

In [64] remarkable directions for cost-effective use of digital cryptocurrencies in smart grid dynamic management are thoroughly explained to cover the challenging viewpoints of blockchain technology. The LEM is favorable for prosumers because the participation of the before-mentioned players is concrete in the purchase of energy surplus, but the revenues from the surplus traded are proportional between sellers [65]. Common consumers do not produce electricity and are only active in the purchasing process [66]. The load flexibility can change the trading offers. Other perspectives consider peak loads in the prosumer's vicinity with smart P2P subscribed capacity prices in [67], or the crowdsourcing concept for surplus energy planning or sharing, as is used in [68], or considering the indispensable local energy storage systems [69].

The main concepts taken from the literature and discussed above are compared with the market model proposed in the paper, in Table 1. In addition, the last column considers the type of settlement used in the market.

The objective of the local market is to enable an overlay social network of smart devices that facilitates the communication and trading process between players from LEM, prosumers, consumers and microgrid. They should share a common goal, such as optimal energy management, taking into account that the solution with local energy storage systems (as is battery banks) is too expensive [70,71], and without technical possibility for energy poverty mitigation.


**Table 1.** A comparison between the proposed model and the literature state-of-the-art survey.


**Table 1.** *Cont.*

#### **3. Materials and Methods**

In LV electricity distribution networks or local microgrids, there is an increasingly larger number of residential consumers who are opting to install local generation resources to gain independence from the grid. The predominant choice is the use of PV panels systems that are easier to install at household residences and provide energy by converting the solar irradiation into electricity. This trend is incentivized by the subsidies offered by governments worldwide. As the number of individual houses adopting this technology increases, new opportunities arise regarding the trading models used for selling the excess generation. Residences become prosumers, entities capable of consuming, producing and selling electricity. The prosumers will use their own generated electricity mainly to cover their individual consumption and when the generation exceeds this amount, they will sell the surplus to the grid. The simplest method of surplus trading is to sell the entire available quantity back to the supplier, though an aggregator entity, at a regulated price. However, this is the least profitable approach, as the regulated prices are usually low [72], and the benefits can be seen only by the suppliers/network operators, and the prosumers. New trading methods for microgrids are currently envisioned in the literature, aiming to create local electricity markets that would provide benefits for all the players involved (aggregators, prosumers and consumers). A main requirement for implementing such initiatives is the conversion of the classic electricity distribution infrastructures into intelligent or smart grids, capable of real-time communication between the supply and consumer buses, and centralized operation management and data processing at microgrid level.

In line with these trends, previous research efforts by the authors, published in [40], proposed an algorithm for prosumer surplus transactions at the microgrid level, using P2P contracts and blockchain technology. The market mechanism considers trading priorities set at central level and based on consumer or prosumer prices, or custom priorities determined by the prosumer–consumer geographical distances and the 'first-come-first-served' (FCFS) principle.

This paper extends the previous research considering an improved and extended market model, with two trading phases (primary and secondary). The basic flowchart of the proposed market model is depicted in Figure 1.

The primary market includes the blockchain approach from [40] and adds a supplementary trading method based on the merit order used in wholesale markets. These methods can be used as alternatives for trading.

A second market segment, with two tiers, is proposed to help the prosumers and consumers to better manage the sell and buy offers that can be affected by errors. Crowdsourcing and energy poverty mitigation are used for this purpose.

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 8 of 43

**Figure 1.** The basic diagram of the proposed market algorithm. **Figure 1.** The basic diagram of the proposed market algorithm.

The newly proposed algorithm provides market mechanisms designed to alleviate these problems. The following general assumptions are made: The prosumer and consumer selling and buying offers are managed by the local non-profit aggregator using two possible market mechanisms integrated in a blockchain trading system: The sell offers are the result of the surplus that the prosumers can generate but cannot use locally. The buy offers placed by the consumers in the local market are usually the result of forecasts made with variable precision. In the case of trading electricity obtained from PV panels, the forecasts must consider weather data obtained with technologies such as remote sensing and big data mining. Thus, the offers placed by the consumers in the market can be affected by errors which will result in mismatches between the needed and traded quantities.

o A primary market built on the blockchain technology, ensuring anonymity and security for the placed orders. o A secondary market with a two-tier trading mechanism for minimizing the imbalance In the Romanian market model, when the electricity acquired from the local market is less than the demand, the consumers would buy the rest at higher prices from the national grid, and the generators would be forced to sell any surplus to the aggregator, at a lower price.

between the offers placed in the blockchain system and the actual traded quantities. The primary market can use two alternative price-setting methods based on blockchain On the other hand, if trading is performed in a local market, when the consumers forecasts are higher than the actual demand, the buyers would be forced to sell the excess quantities to the aggregator if sufficient and cheap storage facilities are not available.

technology: the 'first-come-first-served' (FCFS) method or the merit-order method used in traditional day-ahead markets. The secondary market provides two optional trading tiers: The newly proposed algorithm provides market mechanisms designed to alleviate these problems. The following general assumptions are made:

	- o The commercial tier, with two options, aimed for expanding the market through crowdsourcing, with two types of consumers: those participating occasionally, in exchange # A primary market built on the blockchain technology, ensuring anonymity and security for the placed orders.
	- for a fee, and consumers who do not participate directly with offers but are represented (invited) in the market by other consumers. # A secondary market with a two-tier trading mechanism for minimizing the imbalance between the offers placed in the blockchain system and the actual traded quantities.

electricity, and the case where no storage capabilities are installed in the network. Electricity is


#### *3.1. Input Data for the Local Market*

The input data required for trading consist of the quantities and prices associated with the consumption and local generation measured in the market. This information is provided in six matrices: *<sup>C</sup>* <sup>=</sup> *<sup>C</sup>* (*h*, *<sup>i</sup>*) <sup>∈</sup> R*nhxNCM*, *CO* <sup>=</sup> *CO* (*h*, *<sup>i</sup>*) <sup>∈</sup> R*nhxNCM* and *PCO* <sup>=</sup> *PCO* (*h*, *<sup>i</sup>*) <sup>∈</sup> R*nh*×*NCM* for consumption quantity, offers and price offers, and *<sup>G</sup>* <sup>=</sup> *<sup>G</sup>* (*h, j*) <sup>∈</sup> R*nh*×*NPM*, *GO* <sup>=</sup> *GO* (*h, j*) <sup>∈</sup> R*nh*×*NPM*, *PGO* <sup>=</sup> *PGO* (*h, j*) <sup>∈</sup> R*nh*×*NPM* for generation quantity, offers and price offers, where *NCM* and *NPM* are the number of consumers and prosumers participating at hour *h* in the market. It is considered that generally *NCM* < *NC* and *NPM* < *NP*, *NC* and *NP* being the number of consumers and prosumers connected in the microgrid.

Trading in the primary market can occur at any hour *h* when there are consumer buying offers placed in the blockchain system (1), and there is generation surplus offered for selling (2).

$$\sum\_{i=1}^{N \le M} \text{CO}(h, i) > 0 \tag{1}$$

$$\sum\_{j=1}^{NPM} GO(h, j) > 0 \tag{2}$$

Surplus occurs when the local generation of a prosumer exceeds its individual consumption (3) and the surplus is traded in the market (4).

$$\mathbf{G}(h,j) = \mathbf{G}(h,j) \mathbf{-} \mathbf{C}(h,j), \ j = 1..\text{NPM} \tag{3}$$

$$S(h,j) \Rightarrow GO(h,j) \tag{4}$$

The consumer quantity offers for the primary market use two types of representation:


The prosumers can choose to sell their surplus directly to the aggregator for a fixed regulated tariff, or in the primary local market. In the paper, it is considered that all the available surplus is traded through sell offers placed in the market blockchain system.

The secondary market is activated at any hour *h* when at least one of the following conditions is fulfilled:

• The sum of the buy offers is lower than the aggregated offers placed by the prosumers, i.e., the prosumers need to sell the remaining surplus:

$$\sum\_{i=1}^{NCM} \text{CO}(h, i) < \sum\_{j=1}^{NPM} \text{GO}(h, j) \tag{5}$$

• The buy offer of a consumer *i* is greater than the actual consumption because of the forecast error or representation model used in the market (multiple of 100 kW).

$$CO(h, i) > TCO(h, i), \; i = 1..NCM\tag{6}$$

where *TCO*(*h*,*i*) is the quantity of electricity actually traded by the consumer *i* at hour *h*, which can be equal to or less than the offer placed on the market. where *TCO*(*h*,*i*) is the quantity of electricity actually traded by the consumer *i* at hour *h*, which can be equal to or less than the offer placed on the market.

#### *3.2. The Primary Market 3.2. The Primary Market*

clearing price (MCP).

aggregated buy and sell offers:

This market segment is the main trading tool for the prosumers and consumers in the microgrid. As outlined previously, two alternatives are provided for determining the consumer and prosumer trading priority: 'first-come-first-served' and merit order. Both methods use the consumer (buy) and prosumer (sell) offers placed in a centralized secure and anonymous blockchain system established at the microgrid or market level. The blockchain system is preferred because it guarantees trading fairness, all players being unaware of the offers placed by others, thus minimizing the risk of market manipulation. This market segment is the main trading tool for the prosumers and consumers in the microgrid. As outlined previously, two alternatives are provided for determining the consumer and prosumer trading priority: 'first-come-first-served' and merit order. Both methods use the consumer (buy) and prosumer (sell) offers placed in a centralized secure and anonymous blockchain system established at the microgrid or market level. The blockchain system is preferred because it guarantees trading fairness, all players being unaware of the offers placed by others, thus minimizing the risk of market manipulation.

Another assumption used in the paper is that, by means of an automated system comprising smart metering, two-way communication and continuous monitoring at the microgrid level, the algorithm has immediate access to measured and forecasted data at consumer and prosumer buses. For examining the possible effects on trading, two consumer offer mechanisms are considered: Another assumption used in the paper is that, by means of an automated system comprising smart metering, two-way communication and continuous monitoring at the microgrid level, the algorithm has immediate access to measured and forecasted data at consumer and prosumer buses. For examining the possible effects on trading, two consumer offer mechanisms are considered:


The first type of offer is used in the FCFS trading method, where a generic consumer *i* places fixed-price-per-kWh and variable quantity offers, the trading order being determined by the time tag of the offer. The quantities for these offers are determined in the settlement phase, based on consumption measurements taken from the microgrid. The flowchart of this trading method is given in Figure 2. The first type of offer is used in the FCFS trading method, where a generic consumer *i* places fixed-price-per-kWh and variable quantity offers, the trading order being determined by the time tag of the offer. The quantities for these offers are determined in the settlement phase, based on consumption measurements taken from the microgrid. The flowchart of this trading method is given in Figure 2.

**Figure 2.** The basic diagram of the primary market 'first-come-first-served' trading mechanism. **Figure 2.** The basic diagram of the primary market 'first-come-first-served' trading mechanism.

The second type of offer is used in the merit-order trading mechanism. The buy offer prices and quantities are placed in the blockchain system by the consumers before the trading interval. The second type of offer is used in the merit-order trading mechanism. The buy offer prices and quantities are placed in the blockchain system by the consumers before the trading interval. Quantities

min , 

Quantities are given as multiples of 100 W and prices are given for each kWh. The flowchart of this

For both methods, the prosumer sell offers are given as the full available surplus *S(i,h)*, in kWh. The maximum amount of traded electricity *TC* is determined by the minimum between the

1 1

*NCM NPM i j*

**Figure 3.** The basic diagram of the primary market merit-order trading mechanism.

 

*TC CO(h,i) GO(h, j)* (7)

are given as multiples of 100 W and prices are given for each kWh. The flowchart of this trading method is given in Figure 3. The trading order and price are determined by the standard merit-order method, provided in Figure 4, where the trading price is determined as the market clearing price (MCP). aggregated buy and sell offers: 1 1 min , *NCM NPM i j TC CO(h,i) GO(h, j)* (7)

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 10 of 43

where *TCO*(*h*,*i*) is the quantity of electricity actually traded by the consumer *i* at hour *h*, which can be

This market segment is the main trading tool for the prosumers and consumers in the microgrid. As outlined previously, two alternatives are provided for determining the consumer and prosumer trading priority: 'first-come-first-served' and merit order. Both methods use the consumer (buy) and prosumer (sell) offers placed in a centralized secure and anonymous blockchain system established at the microgrid or market level. The blockchain system is preferred because it guarantees trading fairness, all players being unaware of the offers placed by others, thus minimizing the risk of market

Another assumption used in the paper is that, by means of an automated system comprising smart metering, two-way communication and continuous monitoring at the microgrid level, the algorithm has immediate access to measured and forecasted data at consumer and prosumer buses. For examining the possible effects on trading, two consumer offer mechanisms are considered:

 Consumers place on the market buy offers for the entire consumption at hour *h*, in order to minimize their electricity bill by attempting to buy the maximum quantity of electricity from the

Consumers place on the market buy offers determined by forecast techniques using big data

**Figure 2.** The basic diagram of the primary market 'first-come-first-served' trading mechanism.

The second type of offer is used in the merit-order trading mechanism. The buy offer prices and quantities are placed in the blockchain system by the consumers before the trading interval. Quantities are given as multiples of 100 W and prices are given for each kWh. The flowchart of this trading method is given in Figure 3. The trading order and price are determined by the standard merit-order method, provided in Figure 4, where the trading price is determined as the market

The maximum amount of traded electricity *TC* is determined by the minimum between the

The first type of offer is used in the FCFS trading method, where a generic consumer *i* places fixed-price-per-kWh and variable quantity offers, the trading order being determined by the time tag of the offer. The quantities for these offers are determined in the settlement phase, based on consumption measurements taken from the microgrid. The flowchart of this trading method is given

local market, at lower prices, rather than from the main grid, at higher prices.

equal to or less than the offer placed on the market.

analysis or remote sensing techniques.

*3.2. The Primary Market*

manipulation.

in Figure 2.

**Figure 3. Figure 3.**  The basic diagram of the primary market merit-order trading mechanism. The basic diagram of the primary market merit-order trading mechanism. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 11 of 43

**Figure 4.** The merit-order trading mechanism. **Figure 4.** The merit-order trading mechanism.

The settlement price of a transaction *t* made by a prosumer *j* or consumer *i* is given by the amount of traded electricity *C*(*h*,*t*) and its price *P*(*h*,*t*), determined by each transaction, *TP*(*h*,*t*), which can be different from the sell or buy offer price submitted by the players in the market, *PCO*(*h*,*i*), *PGO*(*h*,*j*). For both methods, the prosumer sell offers are given as the full available surplus *S(i,h)*, in kWh. The maximum amount of traded electricity *TC* is determined by the minimum between the aggregated buy and sell offers:

$$TC = \min\left(\sum\_{i=1}^{N \text{CM}} \text{CO}(h, i), \sum\_{j=1}^{N \text{PM}} \text{GO}(h, j)\right) \tag{7}$$

The settlement price of a transaction *t* made by a prosumer *j* or consumer *i* is given by the amount of traded electricity *C*(*h*,*t*) and its price *P*(*h*,*t*), determined by each transaction, *TP*(*h*,*t*), which can be different from the sell or buy offer price submitted by the players in the market, *PCO*(*h*,*i*), *PGO*(*h*,*j*). The settlement price of a transaction *t* made by a prosumer *j* or consumer *i* is given by the amount of traded electricity *C*(*h*,*t*) and its price *P*(*h*,*t*), determined by each transaction, *TP*(*h*,*t*), which can be

**Figure 4.** The merit-order trading mechanism.

$$TP(h,t) = \mathcal{C}(h,t) \cdot P(h,t) \tag{8}$$

The basic flowchart of the primary market algorithm uses the steps presented in Figure 5. The basic flowchart of the primary market algorithm uses the steps presented in Figure 5.

**Figure 5.** The flowchart of the primary market trading algorithm.

The trading mechanisms used in the primary market can lead to electricity quantities that cannot

offers are the *S*(*h*,*i*) quantities. This leads to *S*(*h*,*i*) fractions that cannot be fulfilled*.* The consumers place in the market buy offers that exceed their real consumption, following **Figure 5.** The flowchart of the primary market trading algorithm. **Figure 5.** The flowchart of the primary market trading algorithm.

forecast errors or significant accidental deviations from the daily demand pattern. All these quantities can amount to an important value over longer time periods. If they are not The trading mechanisms used in the primary market can lead to electricity quantities that cannot be traded locally. Three scenarios can lead to this situation: The trading mechanisms used in the primary market can lead to electricity quantities that cannot be traded locally. Three scenarios can lead to this situation:

a two-tier secondary market, in order to make prosumer and consumer surplus quantities available

The consumers place in the market buy offers that exceed their real consumption, following

offers are the *S*(*h*,*i*) quantities. This leads to *S*(*h*,*i*) fractions that cannot be fulfilled*.*

forecast errors or significant accidental deviations from the daily demand pattern.

The local market is profitable mostly to consumers with high demand, who can better benefit from the energy cost reduction obtained from the difference between the grid tariffs and the price per kWh offered by the local producers. These consumers are also usually those who have the financial

The algorithm proposed in the paper offers the possibility of extending the primary market with a two-tier secondary market, in order to make prosumer and consumer surplus quantities available

The local market is profitable mostly to consumers with high demand, who can better benefit from the energy cost reduction obtained from the difference between the grid tariffs and the price per kWh offered by the local producers. These consumers are also usually those who have the financial

All these quantities can amount to an important value over longer time periods. If they are not traded in the local market, the prosumers would sell at minimum price to the aggregator, while the

resources to install the physical and software infrastructure required to access the market.

resources to install the physical and software infrastructure required to access the market.

for trading in the local network.

for trading in the local network.

consumption (buy offers).

*3.3. The Secondary Market—The Energy Poverty Tier*

*3.3. The Secondary Market—The Energy Poverty Tier*

consumers would buy electricity at standard, high tariffs.

traded in the local market, the prosumers would sell at minimum price to the aggregator, while the


All these quantities can amount to an important value over longer time periods. If they are not traded in the local market, the prosumers would sell at minimum price to the aggregator, while the consumers would buy electricity at standard, high tariffs.

The algorithm proposed in the paper offers the possibility of extending the primary market with a two-tier secondary market, in order to make prosumer and consumer surplus quantities available for trading in the local network.

#### *3.3. The Secondary Market—The Energy Poverty Tier*

The local market is profitable mostly to consumers with high demand, who can better benefit from the energy cost reduction obtained from the difference between the grid tariffs and the price per kWh offered by the local producers. These consumers are also usually those who have the financial resources to install the physical and software infrastructure required to access the market.

On the other hand, amongst the consumers connected in a microgrid can exist a number of low-income consumers, who in traditional networks would be classified as belonging to vulnerable categories and suffer from energy poverty. The paper proposes an optional secondary market tier in which the surplus that cannot be traded in the primary market would be automatically allocated in the initial settlement phase (see Figure 1) to such vulnerable consumers who, in normal conditions, would not be able to access the local market.

The surplus can come from both prosumers and consumers, as summarized in the previous subsection. In all the cases, the electricity quantities will result from the mismatch between the quantities offered for trading (higher)—*CO*(*h*,*i*) or *GO*(*h*,*j*)—and actual traded quantity, determined by the existing (lower) generation availability *TC*(*h*,*j*) or realized consumption *TC*(*h*,*i*):

$$\begin{aligned} \text{TC}(h, i) &= \text{CO}(h, i) \text{-TC}(h, i), \; i = 1 \dots \text{NCM}, \; for \; dimensions\\ \text{TC}(h, j) &= \text{GO}(h, j) \text{-TC}(h, j), \; j = 1 \dots \text{NPM}, \; for \; pressures \end{aligned} \tag{9}$$

Thus, consumers who were buyers in the primary market can act as sellers in the secondary market, together with the prosumers.

The quantities sold to vulnerable consumers in the secondary market are determined using the merit-order method where the buyers' prices are set as 0 mu/kWh (mu is the monetary units) and the quantities are ranked in descending order. The cost for traded kWh can be set using as reference the price obtained by the seller in the primary market, the original price offer placed by the seller in the primary market or an agreed fixed tariff, according to the policy agreed in the local market.

This trading scheme offers two benefits. The vulnerable consumers from the microgrid will see social welfare increase by the reduction of their electricity bill, which will be proportional to their consumption in the trading hours interval and the market price. On the other hand, the prosumers with remaining generation surplus and the consumers who have surplus to sell after the initial settlement of the primary market can sell electricity at higher prices than the tariff used by the aggregator.

The flowchart of the first tier of the secondary market is presented in Figure 6.

Since the demand of the vulnerable consumers selected for the energy poverty tier is expected to be low, the remaining surplus after the settlement of the first tier can be further traded in a second tier reserved for commercial trading.

On the other hand, amongst the consumers connected in a microgrid can exist a number of lowincome consumers, who in traditional networks would be classified as belonging to vulnerable categories and suffer from energy poverty. The paper proposes an optional secondary market tier in which the surplus that cannot be traded in the primary market would be automatically allocated in the initial settlement phase (see Figure 1) to such vulnerable consumers who, in normal conditions,

The surplus can come from both prosumers and consumers, as summarized in the previous subsection. In all the cases, the electricity quantities will result from the mismatch between the quantities offered for trading (higher)—*CO*(*h*,*i*) or *GO*(*h*,*j*)—and actual traded quantity, determined

Thus, consumers who were buyers in the primary market can act as sellers in the secondary

The quantities sold to vulnerable consumers in the secondary market are determined using the merit-order method where the buyers' prices are set as 0 mu/kWh (mu is the monetary units) and the quantities are ranked in descending order. The cost for traded kWh can be set using as reference the price obtained by the seller in the primary market, the original price offer placed by the seller in the

This trading scheme offers two benefits. The vulnerable consumers from the microgrid will see social welfare increase by the reduction of their electricity bill, which will be proportional to their consumption in the trading hours interval and the market price. On the other hand, the prosumers with remaining generation surplus and the consumers who have surplus to sell after the initial settlement of the primary market can sell electricity at higher prices than the tariff used by the

*TC(h,i)= CO(h,i) -TC(h,i), i = 1...NCM for consumers TC(h, j)= GO(h, j) -TC(h, j), j = 1...NPM for prosumers*

, ,

(9)

by the existing (lower) generation availability *TC*(*h*,*j*) or realized consumption *TC*(*h*,*i*):

primary market or an agreed fixed tariff, according to the policy agreed in the local market.

The flowchart of the first tier of the secondary market is presented in Figure 6.

**Figure 6.** The flowchart of the social inclusion tier of the secondary market. **Figure 6.** The flowchart of the social inclusion tier of the secondary market.

#### Since the demand of the vulnerable consumers selected for the energy poverty tier is expected *3.4. The Secondary Market—The Commercial Tier*

would not be able to access the local market.

market, together with the prosumers.

to be low, the remaining surplus after the settlement of the first tier can be further traded in a second tier reserved for commercial trading. *3.4. The Secondary Market—The Commercial Tier* The commercial tier of the secondary market is designed to incentivize market diversity by allowing other consumers to participate in trading. Several consumer categories are envisioned. Some consumers would not trade continuously and would seek only occasional access to the market, The commercial tier of the secondary market is designed to incentivize market diversity by allowing other consumers to participate in trading. Several consumer categories are envisioned. Some consumers would not trade continuously and would seek only occasional access to the market, buying the local generation surplus to supply automated receptors such as greenhouse irrigation systems in given hours of preset days. Other types of occasional consumers could benefit from the price difference when trading on the local market, but the initial investment for the infrastructure required to get access to the market would be prohibitive.

buying the local generation surplus to supply automated receptors such as greenhouse irrigation Two options are available in the algorithm for this trading segment:

systems in given hours of preset days. Other types of occasional consumers could benefit from the • Option 1: Fee access.

**4. Results**

price difference when trading on the local market, but the initial investment for the infrastructure required to get access to the market would be prohibitive. • Option 2: Invite access.

Two options are available in the algorithm for this trading segment: Option 1: Fee access. Option 2: Invite access. In the fee-access model, the consumers who need only occasional access to the market can submit offers in the secondary market to gain priority access for the surplus remaining after the settlement of the primary market offers. The trading model considers the merit-order priority method described In the fee-access model, the consumers who need only occasional access to the market can submit offers in the secondary market to gain priority access for the surplus remaining after the settlement of the primary market offers. The trading model considers the merit-order priority method described in Figure 5 for the primary market, but where the consumers offer to buy from the market their entire consumption measured in the trading interval, at the lowest price plus a fixed percent fee from the value of the transaction. The merit order is used to determine the succession in which the offers are fulfilled. The financial settlement is made using the MCP, the consumer or the prosumer price offers for all transactions, according to the market policy, and then a fee *f%* is added to the price resulting from the trading mechanism. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 13 of 43 in Figure 5 for the primary market, but where the consumers offer to buy from the market their entire consumption measured in the trading interval, at the lowest price plus a fixed percent fee from the value of the transaction. The merit order is used to determine the succession in which the offers are fulfilled. The financial settlement is made using the MCP, the consumer or the prosumer price offers for all transactions, according to the market policy, and then a fee *f%* is added to the price resulting

$$\text{TP}(h, i) = \text{C}(h, i) \cdot (\text{PCO}(h, i), \text{PGO}(h, j) \text{ or } \text{MCP}(h)) \cdot (1 + f\%) \tag{10}$$

The basic flowchart of the fee-access secondary market model is given in Figure 7. The basic flowchart of the fee-access secondary market model is given in Figure 7.

**Figure 7.** The flowchart of the secondary market fee-access model. **Figure 7.** The flowchart of the secondary market fee-access model.

In the invite-access model, existing market players can act as subcontractors for other consumers from the microgrid. Certain prosumers or consumers can still have surplus quantities unsold after the previous settlement sessions have been completed. In order to avoid getting the lowest price per kWh from the market aggregator, they can optionally choose a partner from the microgrid to which the remaining quantities will be sold. The transactions are based on P2P contracts existing between the two entities and notified to the market administrator, who is responsible for the final settlement at market level. The settlement price is agreed between the parties, chosen from the vendor and buyer In the invite-access model, existing market players can act as subcontractors for other consumers from the microgrid. Certain prosumers or consumers can still have surplus quantities unsold after the previous settlement sessions have been completed. In order to avoid getting the lowest price per kWh from the market aggregator, they can optionally choose a partner from the microgrid to which the remaining quantities will be sold. The transactions are based on P2P contracts existing between the two entities and notified to the market administrator, who is responsible for the final settlement at market level. The settlement price is agreed between the parties, chosen from the vendor and buyer offers.

offers. The flowchart of the secondary market invite-access model is provided in Figure 8. The flowchart of the secondary market invite-access model is provided in Figure 8.

**Figure 8.** The flowchart of the secondary market invite-access model.

It should be noted that the secondary market models are optional, and their order of activation can be changed according to the priorities of a specific microgrid. Instances can exist where the energy poverty mitigation tier is absent or one or both segments of the secondary commercial tier are used.

The new market was tested on an LV distribution network from Romania, with 28 buses and two four-wire three-phase bundled feeders, with an average distance between the connection points of 40 m. The network supplies only single-phase residential consumers, some of whom also have PV generation capabilities. The load and generation profiles used in the study are considered as daily 24-hour measured values, as provided from the smart metering infrastructure existing in the LV microgrid. The 24-hour load profiles for the network buses are presented in Table A1 in Appendix A. Each bus, except bus 1, which is a branching point, has one residence connected. The prosumers are located at buses 3, 6, 7, 10, 15, 25 and 27, as shown in the one-line diagram from Figure 9. Their 24-hour generation profiles were modeled using representative data for this type of generation and are provided in Appendix A, Table A2. The prosumers will use the generated electricity primarily for supplying their own hourly demand, and wish to sell the remaining surplus to the consumers participating in the local market set up at microgrid level and managed by a non-profit aggregator. From Table 2 and Figure 10, it is seen that generation occurs only in the 06:00–18.00 interval, when solar energy is available. The surplus is maximized in the 10:00–13:00 interval and minimized

towards the evening time, when the peak load hours are near.

from the trading mechanism.

The flowchart of the secondary market invite-access model is provided in Figure 8.

in Figure 5 for the primary market, but where the consumers offer to buy from the market their entire consumption measured in the trading interval, at the lowest price plus a fixed percent fee from the value of the transaction. The merit order is used to determine the succession in which the offers are fulfilled. The financial settlement is made using the MCP, the consumer or the prosumer price offers for all transactions, according to the market policy, and then a fee *f%* is added to the price resulting

*TP (h i) = C (h,i) PC O (h,i), P G O (h, j) o r M C P (h ) f%* , (1 )

**Figure 7.** The flowchart of the secondary market fee-access model.

In the invite-access model, existing market players can act as subcontractors for other consumers from the microgrid. Certain prosumers or consumers can still have surplus quantities unsold after the previous settlement sessions have been completed. In order to avoid getting the lowest price per kWh from the market aggregator, they can optionally choose a partner from the microgrid to which the remaining quantities will be sold. The transactions are based on P2P contracts existing between the two entities and notified to the market administrator, who is responsible for the final settlement at market level. The settlement price is agreed between the parties, chosen from the vendor and buyer

The basic flowchart of the fee-access secondary market model is given in Figure 7.

(10)

**Figure 8.** The flowchart of the secondary market invite-access model. **Figure 8.** The flowchart of the secondary market invite-access model.

It should be noted that the secondary market models are optional, and their order of activation can be changed according to the priorities of a specific microgrid. Instances can exist where the energy poverty mitigation tier is absent or one or both segments of the secondary commercial tier are used. It should be noted that the secondary market models are optional, and their order of activation can be changed according to the priorities of a specific microgrid. Instances can exist where the energy poverty mitigation tier is absent or one or both segments of the secondary commercial tier are used.

#### **4. Results 4. Results**

The new market was tested on an LV distribution network from Romania, with 28 buses and two four-wire three-phase bundled feeders, with an average distance between the connection points of 40 m. The network supplies only single-phase residential consumers, some of whom also have PV generation capabilities. The load and generation profiles used in the study are considered as daily 24-hour measured values, as provided from the smart metering infrastructure existing in the LV microgrid. The 24-hour load profiles for the network buses are presented in Table A1 in Appendix A. The new market was tested on an LV distribution network from Romania, with 28 buses and two four-wire three-phase bundled feeders, with an average distance between the connection points of 40 m. The network supplies only single-phase residential consumers, some of whom also have PV generation capabilities. The load and generation profiles used in the study are considered as daily 24-hour measured values, as provided from the smart metering infrastructure existing in the LV microgrid. The 24-hour load profiles for the network buses are presented in Table A1 in Appendix A.

Each bus, except bus 1, which is a branching point, has one residence connected. The prosumers are located at buses 3, 6, 7, 10, 15, 25 and 27, as shown in the one-line diagram from Figure 9. Their 24-hour generation profiles were modeled using representative data for this type of generation and are provided in Appendix A, Table A2. The prosumers will use the generated electricity primarily for supplying their own hourly demand, and wish to sell the remaining surplus to the consumers participating in the local market set up at microgrid level and managed by a non-profit aggregator. From Table 2 and Figure 10, it is seen that generation occurs only in the 06:00–18.00 interval, when solar energy is available. The surplus is maximized in the 10:00–13:00 interval and minimized towards the evening time, when the peak load hours are near. Each bus, except bus 1, which is a branching point, has one residence connected. The prosumers are located at buses 3, 6, 7, 10, 15, 25 and 27, as shown in the one-line diagram from Figure 9. Their 24-hour generation profiles were modeled using representative data for this type of generation and are provided in Appendix A, Table A2. The prosumers will use the generated electricity primarily for supplying their own hourly demand, and wish to sell the remaining surplus to the consumers participating in the local market set up at microgrid level and managed by a non-profit aggregator. From Table 2 and Figure 10, it is seen that generation occurs only in the 06:00–18.00 interval, when solar energy is available. The surplus is maximized in the 10:00–13:00 interval and minimized towards the evening time, when the peak load hours are near. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 14 of 43

**Figure 9.** The low voltage (LV) microgrid used in the case study. **Figure 9.** The low voltage (LV) microgrid used in the case study.

**Table 2.** The prosumers' electricity surplus, in kWh. **Hour P27 P21 P7 P15 P6 P3 P10 P25 Total** h6 0.000 1.588 0.000 1.948 0.000 1.208 2.496 3.052 10.292 h7 0.000 1.805 0.263 1.585 0.000 1.806 2.616 3.487 11.562

h11 1.655 2.038 1.400 2.775 1.886 3.372 0.000 4.175 17.301 h12 1.595 1.822 1.225 1.880 2.328 3.392 0.980 4.060 17.282 h13 1.508 0.685 1.413 2.826 2.294 3.462 0.826 4.240 17.254 h14 1.372 1.182 1.385 2.945 1.347 3.178 0.000 4.214 15.623 h15 1.106 2.028 1.048 1.546 1.184 2.331 0.000 3.702 12.945 h16 0.563 0.819 0.410 1.325 0.000 2.133 0.000 3.209 8.459 h17 0.000 0.000 0.000 1.062 0.000 1.134 0.046 2.877 5.119 h18 0.000 1.170 0.000 1.161 0.000 1.221 0.914 2.599 7.065 Total 11.511 18.904 9.997 24.169 10.896 32.203 12.665 47.629 167.974

> (**a**) (**b**) **Figure 10.** The total electricity surplus: (**a**) hourly; (**b**) for each prosumer.


**Table 2.** The prosumers' electricity surplus, in kWh. **Hour P27 P21 P7 P15 P6 P3 P10 P25 Total** h6 0.000 1.588 0.000 1.948 0.000 1.208 2.496 3.052 10.292

**Figure 9.** The low voltage (LV) microgrid used in the case study.

**Table 2.** The prosumers' electricity surplus, in kWh.

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 14 of 43

It is considered that they wish to sell the entire surplus on the market to maximize their revenue. The

**Figure 10. Figure 10.**  The total electricity surplus: ( The total electricity surplus: (**aa** ) hourly; ( ) hourly; ( **b b** ) for each prosumer. ) for each prosumer. mu/kWh applied in Romania [73,74], the total revenue of the prosumers would be of 42.16 mu/day.

#### *4.1. The Primary Market* For demonstrating the advantages and disadvantages of each trading priority method used in the market, FCFS and MO, the case study results are be provided as comparisons between these

given in Figures 12 and 13 and Tables 3–6.

From the 27 consumers existing in the microgrid, the case study considers that only 11 are participating in the primary market as buyers (from buses 5, 8, 9, 11, 12, 14, 16, 19, 20, 24, 26), chosen mainly between the residences with high daily electricity demand. For each hour *h*, they can submit to the market two types of offers according to the traded quantity: the entire hourly demand and forecasted values, in multiples of 100 kW, as discussed in Section 3.2. For the forecasted offers, the values used in the case study are given in Table A3 in Appendix A, and in Figure 11, only for the hour intervals in which prosumer generation exists. alternatives. As it can be seen from Figure 11, there are hours when the MO offers differ from the total demand used in the FCFS offers. This can happen because of two reasons: the forecast error and the standardized offer type (multiple of 100 W) used by the MO method. On the other hand, the offers placed by the consumers in the market are identical for both trading methods, and equal to the available surplus (Figure 10), because one of the main objectives of the local market is to enable prosumers to sell the entire surplus locally, and offers given as multiples of 100 W would impede the achievement of this goal.

**Figure 11.** The buyer quantity offers in the primary market: (**a**) hourly; (**b**) for each consumer. **Figure 11.** The buyer quantity offers in the primary market: (**a**) hourly; (**b**) for each consumer.

The traded quantities and revenues/costs for each prosumer/consumer and hourly interval are

consumer.

consumer.

Consumption

Consumption

Consumption

Consumption

The sellers who place offers in the primary market are the prosumers with generation surplus. It is considered that they wish to sell the entire surplus on the market to maximize their revenue. The quantities offered, derived from Tables A1 and A2, are presented in Table 2 and Figure 10, where it can be seen that surplus exists for trading in all hourly intervals from 06:00 to 18:00, but there are prosumers who cannot trade electricity at some hours (for example, P27 or P6).

For all quantity offers, the consumers and the prosumers must also provide in the blockchain system of the primary market the desired price offers, which are given in Tables A4 and A5 in Appendix A. These values were set between 0.39 and 0.6 mu/kWh for consumers, and in the 0.4–0.55 mu/kWh range for prosumers. The higher maximum prices for consumers were chosen taking into account the merit-order method, in which the offers with the highest prices are prioritized. Furthermore, both the prosumers' and consumers' price offers were set higher than the regulated tariff to incentivize the trading in the local market.

If the market would not be present, the total electricity surplus quantity (167.97 kWh) would be traded by the aggregator back in the grid, at a regulated tariff. Using the reference value of 0.251 mu/kWh applied in Romania [73,74], the total revenue of the prosumers would be of 42.16 mu/day.

For demonstrating the advantages and disadvantages of each trading priority method used in the market, FCFS and MO, the case study results are be provided as comparisons between these alternatives.

As it can be seen from Figure 11, there are hours when the MO offers differ from the total demand used in the FCFS offers. This can happen because of two reasons: the forecast error and the standardized offer type (multiple of 100 W) used by the MO method. On the other hand, the offers placed by the consumers in the market are identical for both trading methods, and equal to the available surplus (Figure 10), because one of the main objectives of the local market is to enable prosumers to sell the entire surplus locally, and offers given as multiples of 100 W would impede the achievement of this goal. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 16 of 43

The traded quantities and revenues/costs for each prosumer/consumer and hourly interval are given in Figures 12 and 13 and Tables 3–6. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 16 of 43

**Figure 12.** The traded quantities of the sellers in the primary market: (**a**) hourly; (**b**) for each **Figure 12.** The traded quantities of the sellers in the primary market: (**a**) hourly; (**b**) for each prosumer. prosumer.

(**a**) (**b**) **Figure 13.** The traded quantities of the buyers in the primary market: (**a**) hourly; (**b**) for each **Figure 13.** The traded quantities of the buyers in the primary market: (**a**) hourly; (**b**) for each consumer.

**Table 3.** The daily offer, traded and remaining quantities for each buyer in the primary market, kWh. **Consumer C5 C8 C9 C11 C12 C14 C16 C19 C20 C24 C26 Total**

**Consumer C5 C8 C9 C11 C12 C14 C16 C19 C20 C24 C26 Total**

(offers FCFS) 21.25 24.44 30.70 18.96 8.79 20.92 23.84 4.08 12.90 25.27 12.26 203.41 offers MO 23.2 25.30 30.9 16.50 9.30 20.80 23.8 4.10 11.80 25.20 12.50 203.40 traded FCFS 17.32 20.29 25.07 15.33 6.04 13.20 16.54 3.08 9.05 21.04 9.44 156.40 traded MO 12.55 25.30 26.42 10.30 4.85 20.80 16.36 1.40 7.40 24.02 4.70 154.10 rem. FCFS 3.93 4.15 5.62 3.64 2.75 7.72 7.30 1.01 3.85 4.23 2.82 47.01 rem. MO 10.65 0 4.48 6.20 4.45 0 7.44 2.70 4.40 1.18 7.80 49.30

(offers FCFS) 21.25 24.44 30.70 18.96 8.79 20.92 23.84 4.08 12.90 25.27 12.26 203.41 offers MO 23.2 25.30 30.9 16.50 9.30 20.80 23.8 4.10 11.80 25.20 12.50 203.40 traded FCFS 17.32 20.29 25.07 15.33 6.04 13.20 16.54 3.08 9.05 21.04 9.44 156.40 traded MO 12.55 25.30 26.42 10.30 4.85 20.80 16.36 1.40 7.40 24.02 4.70 154.10 rem. FCFS 3.93 4.15 5.62 3.64 2.75 7.72 7.30 1.01 3.85 4.23 2.82 47.01 rem. MO 10.65 0 4.48 6.20 4.45 0 7.44 2.70 4.40 1.18 7.80 49.30

**Table 4.** The hourly offer, traded and remaining quantities in the primary market for all buyers, kWh. **Hour h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total**

**Table 4.** The hourly offer, traded and remaining quantities in the primary market for all buyers, kWh. **Hour h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total**

(offer FCFS) 11.8 14.06 18.87 13.47 13.55 14.96 16.04 18.16 13.7 12.83 15.23 20.77 19.99 203.43 offer MO 12.1 14.9 17.5 13.6 13.6 14.7 13.6 18.3 13.8 14 15.8 20.5 21 203.40 traded FCFS 10.29 11.56 12.1 13.47 13.55 14.96 16.04 17.25 13.7 12.83 8.46 5.12 7.07 156.40 traded MO 10.29 11.56 12.1 13.6 13.6 14.7 13.6 17.25 13.8 12.95 8.46 5.12 7.07 154.10 rem. FCFS 1.51 2.5 6.77 0 0 0 0 0.91 0 0 6.77 15.65 12.92 47.03 rem. MO 1.81 3.34 5.40 0 0 0 0 1.05 0 1.05 7.34 15.38 13.93 49.30

(offer FCFS) 11.8 14.06 18.87 13.47 13.55 14.96 16.04 18.16 13.7 12.83 15.23 20.77 19.99 203.43 offer MO 12.1 14.9 17.5 13.6 13.6 14.7 13.6 18.3 13.8 14 15.8 20.5 21 203.40 traded FCFS 10.29 11.56 12.1 13.47 13.55 14.96 16.04 17.25 13.7 12.83 8.46 5.12 7.07 156.40 traded MO 10.29 11.56 12.1 13.6 13.6 14.7 13.6 17.25 13.8 12.95 8.46 5.12 7.07 154.10 rem. FCFS 1.51 2.5 6.77 0 0 0 0 0.91 0 0 6.77 15.65 12.92 47.03 rem. MO 1.81 3.34 5.40 0 0 0 0 1.05 0 1.05 7.34 15.38 13.93 49.30

The data from Tables 3–6 show some interesting results regarding the hourly and daily offers and traded quantities for the consumers and prosumers.

The local generation surplus (167.97 kW) is insufficient to supply all the consumer needs (203.43 kWh). From Table 3, it is seen that, for the chosen consumption, local generation and primary market offers, when using the FCFS trading priority, the consumers can trade quantities lower than their consumption, and will need to buy the rest from the grid, at higher tariffs. If the MO trading priority is used, Table 4 shows that the hourly buy offers placed by the consumers are usually not fully fulfilled, but the traded quantities exceed the consumption. This leads to a surplus with the consumers, which will be traded to the grid, at regulated tariffs, or sold in the secondary market.

For prosumers, there are trading intervals where the surplus exceeds the traded prosumer offer and traded consumer quantities which are equal (for example, at *h11*, as seen from Tables 4 and 6). This suggests that the prosumer will not be able to sell their entire surplus because of lack of demand. Additionally, applying the FCFS and MO trading priorities in fulfilling the market offers has different effects on the traded quantities, both hourly and for individual prosumers or consumers. If the FCFS trading priority is used, the total quantity traded by the prosumers is larger (Table 5) because the prosumer surplus offers can be matched more closely by the consumer offers. This means that if the MO trading priority is used, it is expected to have more surplus unsold to the local consumers, thus reducing the profitability of the prosumers. In this case, they would have to sell extra surplus to the grid in exchange for the regulated tariff, which is lower than the local consumer offers. As it can be seen from Table 6, the generation surplus remaining after the primary market is concentrated in the 09:00–14:00 interval, while the evening and morning intervals see the highest deficit in local generation (Table 4).

**Table 3.** The daily offer, traded and remaining quantities for each buyer in the primary market, kWh.


**Table 4.** The hourly offer, traded and remaining quantities in the primary market for all buyers, kWh.


**Table 5.** The daily offer, traded and remaining quantities for each seller in the primary market, kWh.



**Table 6.** The hourly offer, traded and remaining quantities in the primary market, for all sellers, kWh.

The profitability of the FCFS and MO trading priorities can be assessed from Figure 14 and Tables 7 and 8 for the buyers and Figure 15 and Tables 9 and 10 for the sellers. The market model offers the possibility of performing financial settlement in three assumptions for the prices: using the market clearing price (MCP), the consumer offers (COP) and the prosumer offers (POP), because different microgrids can pursue different objectives when establishing the local market. For example, using POP coupled with MO in the primary market can be an advantage for the buying consumers, who will buy electricity at lower prices from the local prosumers instead of paying the standard residential tariff. Using the MCP favors the prosumers with lower prices. In generation surplus scenarios, they can sell electricity at a higher clearing price. Using the COP will be an advantage for the prosumers, who will be able to obtain settlement prices larger than their initial offers. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 18 of 43 **Table 7.** The daily cost for each buyer in the primary market, mu. **Consumers C5 C8 C9 C11 C12 C14 C16 C19 C20 C24 C26 Total FCFS** MCP 8.28 9.23 11.30 6.96 2.70 5.87 7.59 1.36 4.00 9.42 4.39 71.11 COP 7.80 12.17 13.79 7.97 2.90 7.92 8.10 1.20 4.98 11.99 4.72 83.54 POP 8.28 9.23 11.30 6.96 2.70 5.87 7.59 1.36 4.00 9.42 4.39 71.11 MCP 6.40 13.15 13.91 5.44 2.47 10.89 8.49 0.68 3.94 12.53 2.46 80.36

The sellers/vendors with the highest cost/revenue can be considered as making the most profit because quantities are bought by consumers at a price lower than the standard LV residential tariff, while the sell offers are settled by the vendors at a price higher than the resell tariff to the grid. MO COP 5.65 15.18 14.53 5.36 2.33 12.48 8.01 0.55 4.07 13.69 2.35 84.20 POP 6.03 10.52 11.79 4.80 2.34 9.00 7.91 0.67 3.41 10.56 2.25 69.28

**Figure 14.** The primary market cost for buyers: (**a**) The hourly values, first-come-first-serve (FCFS); (**b**) The values for each consumer, FCFS; (**c**) The hourly values, MO; (**d**) The values for each consumer, MO. **Figure 14.** The primary market cost for buyers: (**a**) The hourly values, first-come-first-serve (FCFS); (**b**) The values for each consumer, FCFS; (**c**) The hourly values, MO; (**d**) The values for each consumer, MO.

(**a**) (**b**)

**FCFS**

MO

order used in wholesale markets (Figure 4).

**FCFS**

MO

**Table 7.** The daily cost for each buyer in the primary market, mu. **Consumers C5 C8 C9 C11 C12 C14 C16 C19 C20 C24 C26 Total**

MCP 8.28 9.23 11.30 6.96 2.70 5.87 7.59 1.36 4.00 9.42 4.39 71.11 COP 7.80 12.17 13.79 7.97 2.90 7.92 8.10 1.20 4.98 11.99 4.72 83.54 POP 8.28 9.23 11.30 6.96 2.70 5.87 7.59 1.36 4.00 9.42 4.39 71.11

MCP 6.40 13.15 13.91 5.44 2.47 10.89 8.49 0.68 3.94 12.53 2.46 80.36 COP 5.65 15.18 14.53 5.36 2.33 12.48 8.01 0.55 4.07 13.69 2.35 84.20 POP 6.03 10.52 11.79 4.80 2.34 9.00 7.91 0.67 3.41 10.56 2.25 69.28

(**a**) (**b**)

(**c**) (**d**) **Figure 14.** The primary market cost for buyers: (**a**) The hourly values, first-come-first-serve (FCFS);

**Figure 15.** The primary market revenue for sellers: (**a**) The hourly values, FCFS; (**b**) The values for each prosumer, FCFS; (**c**) The hourly values, MO; (**d**) The values for each prosumer, MO. **Figure 15.** The primary market revenue for sellers: (**a**) The hourly values, FCFS; (**b**) The values for each prosumer, FCFS; (**c**) The hourly values, MO; (**d**) The values for each prosumer, MO.

**Table 8.** The hourly cost in the primary market for all buyers, mu. **Consumers h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total FCFS** MCP 4.74 5.31 5.58 6.11 6.06 6.81 7.30 7.73 6.12 5.90 3.87 2.30 3.28 71.11 COP 5.60 6.33 6.21 7.20 7.35 7.84 8.51 9.12 7.51 7.06 4.42 2.61 3.79 83.54 POP 4.74 5.31 5.58 6.11 6.06 6.81 7.30 7.73 6.12 5.90 3.87 2.30 3.28 71.11 MO MCP 5.66 6.36 6.66 7.48 6.39 7.06 6.53 9.49 6.62 7.12 4.65 2.46 3.89 80.36 COP 5.66 6.43 6.60 7.28 7.33 7.68 7.26 9.13 7.53 7.18 4.90 3.05 4.15 84.20 For the scenario considered in the case study, Figures 14 and 15 show that the highest revenues are obtained by prosumers when the consumer offer prices (COP) are used for settlement. If the FCFS trading priority is used, the MCP and POP settlements give the same results, because the methodology from [40] uses as settlement price the prosumer offers, and the MCP and POP trading priorities would result the same, as the buy offer price is not relevant and thus considered 0 um/kWh for all buyers. For the MO trading priority, the MCP settlement results in higher trading prices than POP, because the trading price for all sellers and buyers is determined by the price unrestricted merit order used in wholesale markets (Figure 4).

POP 4.74 5.31 5.58 6.04 5.90 6.52 5.94 7.73 6.13 5.95 3.87 2.30 3.28 69.28 **Table 9.** The daily revenue for each seller in the primary market, mu. As it can be seen from Tables 7–10, the players who get the most advantage from the local market are C8, C9, C24, the consumers without generation capability that have the highest demand, and P15, P3, P25, the prosumers with the largest daily surplus.


**Prosumers h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total**

MCP 4.74 5.31 5.58 6.11 6.06 6.81 7.30 7.73 6.12 5.90 3.87 2.30 3.28 71.11 COP 5.60 6.33 6.21 7.20 7.35 7.84 8.51 9.12 7.51 7.06 4.42 2.61 3.79 83.54 POP 4.74 5.31 5.58 6.11 6.06 6.81 7.30 7.73 6.12 5.90 3.87 2.30 3.28 71.11

MCP 5.66 6.36 6.66 7.48 6.39 7.06 6.53 9.49 6.62 7.12 4.65 2.46 3.89 80.36 COP 5.66 6.43 6.60 7.28 7.33 7.68 7.26 9.13 7.53 7.18 4.90 3.05 4.15 84.20 POP 4.74 5.31 5.58 6.04 5.90 6.52 5.94 7.73 6.13 5.95 3.87 2.30 3.28 69.28

**Prosumers P27 P21 P7 P15 P6 P3 P10 P25 Total** MCP 4.95 9.75 3.95 10.98 3.83 11.85 5.32 20.48 71.11 **Table 7.** The daily cost for each buyer in the primary market, mu.

are obtained by prosumers when the consumer offer prices (COP) are used for settlement. If the FCFS trading priority is used, the MCP and POP settlements give the same results, because the methodology from [40] uses as settlement price the prosumer offers, and the MCP and POP trading priorities would result the same, as the buy offer price is not relevant and thus considered 0 um/kWh for all buyers. For the MO trading priority, the MCP settlement results in higher trading prices than POP, because the trading price for all sellers and buyers is determined by the price unrestricted merit


**Table 8.** The hourly cost in the primary market for all buyers, mu.

**Table 9.** The daily revenue for each seller in the primary market, mu.


**Table 10.** The hourly revenue in the primary market for all sellers, mu.


#### *4.2. The Secondary Market—The Energy Poverty Mitigation Tier*

The proposed local market model uses in the secondary market an optional energy poverty mitigation tier, designed to include a category of consumers that can usually will not be able to trade on the market because of their low income or other social vulnerabilities. The microgrid community can decide to assist these consumers by supporting the reduction of their electricity bill. The simplest way to achieve this goal is to automatically allocate the prosumer surplus available after the settlement of the primary market to cover the demand of such consumers. In the data used for the case study, a single consumer, C28, fulfills the requirements of a vulnerable consumer. As seen in Table A1, its total daily consumption amounts to 3.31 kWh, with 1.79 kWh in the 06:00–18:00 interval.

Since the two trading priority methods (FCFS and MO) give in the primary market different results regarding the trading participants and quantities at each hour, a similar behavior is propagated in the secondary market. Thus, the trading results will be presented in the same manner as for the primary market, as a comparison between the cases in which the primary market uses the FCFS or the MO in determining the priorities of the traded quantities. It is considered that the secondary market uses the same price offers entered in the blockchain system for the primary market.

According to the data from Tables 3 and 5, after the settlement of the primary market, prosumers P21, P7, P15, P6, P3, P25 have unsold surplus if the FCFS trading priority is used. No consumers can participate in the secondary market, because they cannot have surplus after trading. If the MO priority is used, the prosumers with available surplus are P21, P15, P3, and also there are consumers which have placed in the primary market offers exceeding their real consumption, and can become sellers on the secondary market (C5, C9, C11, C12, C16, C19, C20, C24, and C26). The hours in which the sellers are having surplus after the primary market are presented in Appendix B, Tables A6 and A7. The only entity buying in this market is C28, and its hourly buy offer match its entire consumption (See

Table A1). However, these are total quantities, and each seller can trade different surplus quantities in each hour. This will lead to the necessity of prioritization of the sell offers, and subsequent settlement between C28 and possibly multiple sellers. The quantities traded hourly are presented in Appendix B, Tables A8 and A9. The sell offers and traded quantities are given in Figures 16 and 17. Tables 11–14 summarize the daily and hourly offers and quantities traded by buyers and sellers. surplus quantities in each hour. This will lead to the necessity of prioritization of the sell offers, and subsequent settlement between C28 and possibly multiple sellers. The quantities traded hourly are presented in Appendix B, Tables A8 and A9. The sell offers and traded quantities are given in Figures 16 and 17. Tables 11–14 summarize the daily and hourly offers and quantities traded by buyers and sellers.

consumption (See Table A1). However, these are total quantities, and each seller can trade different

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 20 of 43

P3, P25, the prosumers with the largest daily surplus.

*4.2. The Secondary Market—The Energy Poverty Mitigation Tier*

As it can be seen from Tables 7–10, the players who get the most advantage from the local market are C8, C9, C24, the consumers without generation capability that have the highest demand, and P15,

The proposed local market model uses in the secondary market an optional energy poverty mitigation tier, designed to include a category of consumers that can usually will not be able to trade on the market because of their low income or other social vulnerabilities. The microgrid community can decide to assist these consumers by supporting the reduction of their electricity bill. The simplest way to achieve this goal is to automatically allocate the prosumer surplus available after the settlement of the primary market to cover the demand of such consumers. In the data used for the case study, a single consumer, C28, fulfills the requirements of a vulnerable consumer. As seen in Table A1, its total daily consumption amounts to 3.31 kWh, with 1.79 kWh in the 06:00–18:00 interval. Since the two trading priority methods (FCFS and MO) give in the primary market different results regarding the trading participants and quantities at each hour, a similar behavior is propagated in the secondary market. Thus, the trading results will be presented in the same manner as for the primary market, as a comparison between the cases in which the primary market uses the FCFS or the MO in determining the priorities of the traded quantities. It is considered that the secondary market uses the same price offers entered in the blockchain system for the primary market. According to the data from Tables 3 and 5, after the settlement of the primary market, prosumers P21, P7, P15, P6, P3, P25 have unsold surplus if the FCFS trading priority is used. No consumers can participate in the secondary market, because they cannot have surplus after trading. If the MO priority is used, the prosumers with available surplus are P21, P15, P3, and also there are consumers which have placed in the primary market offers exceeding their real consumption, and can become sellers on the secondary market (C5, C9, C11, C12, C16, C19, C20, C24, and C26). The hours in which

**Figure 16.** The sell offers of the vendors in the energy poverty mitigation market: (**a**) hourly; (**b**) for each prosumer/consumer. **Figure 16.** The sell offers of the vendors in the energy poverty mitigation market: (**a**) hourly; (**b**) for each prosumer/consumer. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 21 of 43

**Figure 17.** The traded quantities of the vendors in the energy poverty mitigation market: (**a**) hourly; (**b**) for each prosumer. **Figure 17.** The traded quantities of the vendors in the energy poverty mitigation market: (**a**) hourly; (**b**) for each prosumer.

**Table 11.** The daily traded quantities for consumer C28 in the energy poverty mitigation market, kWh. **Table 11.** The daily traded quantities for consumer C28 in the energy poverty mitigation market, kWh.


**Table 12.** The hourly traded quantities in the poverty mitigation market for consumer C28, kWh.

rem. MO 0


**Table 13.** The daily traded quantities for each vendor in the energy poverty mitigation market, kWh.

**Table 14.** The hourly traded quantities in the energy poverty mitigation market for all vendors, kWh.

**Hour h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total** surplus FCFS 0 0 0 1.82 4.14 2.35 1.24 0 1.92 0.11 0 0 0 11.58 surplus MO 1.81 3.34 5.40 1.68 4.09 2.60 3.68 1.05 1.82 1.06 7.34 15.38 13.94 63.18 traded-FCFS 0 0 0 0 0.00 0.08 0.51 0 0.02 0.11 0 0 0 0.72 traded-MO 0.19 0.14 0.15 0.00 0.00 0.08 0.51 0.06 0.02 0.24 0.09 0.08 0.23 1.79 rem. FCFS 0 0 0 1.82 4.14 2.27 0.73 0 1.90 0 0 0 0 10.86 rem. MO 1.62 3.20 5.25 1.68 4.08 2.53 3.17 0.99 1.80 0.81 7.25 15.30 13.71 61.39

**Vendor P21 P7 P15 P6 P3 C5 C9 C11 C12 C16 C19 C20 C24 C26 Total** surplus FCFS 1.18 0.11 1.30 1.98 7.00 0 0 0 0 0 0 0 0 0 11.58 surplus MO 9.02 0 4.37 0 0.49 10.65 4.48 6.20 4.46 7.44 2.70 4.40 1.18 7.80 63.18 traded FCFS 0 0.11 0 0.53 0.08 0 0 0 0 0 0 0 0 0 0.72 traded MO 0 0 0.60 0 0.00 0 0 0 0 0 1.18 0 0 0 1.79 rem. FCFS 1.18 0.00 1.30 1.45 6.92 0 0 0 0 0 0 0 0 0 10.86 rem. MO 9.02 0.00 3.76 0 0.49 10.65 4.48 6.20 4.46 7.44 1.52 4.40 1.18 7.80 61.39


**Table 13.** The daily traded quantities for each vendor in the energy poverty mitigation market, kWh.

**Table 14.** The hourly traded quantities in the energy poverty mitigation market for all vendors, kWh.


Figures 16 and 17 and Tables 11–14 reveal significantly different trading scenarios on the energy poverty mitigation market when the two trading priority methods (FCFS and MO) are used in the primary market. For FCFS, 3 out of 5 prosumers will trade electricity with C28, while if MO were to be used, only P15 and P3 will sell electricity, the rest of the buying offer being fulfilled by just one consumer, C19. Also, if the secondary market is activated, the available surplus rises when MO is used from 13.88 kWh in the primary market to 63.18 kWh, due to the presence of the consumers who need to sell the surplus generated by the forecast error or offer quantity rounding. In the absence of the secondary market, these two quantities would be sold back to the grid at minimal price. Thus, in addition to allowing prosumer to sell more surplus, the secondary market offers a mechanism for minimizing the effect of consumption forecast errors at the consumer side when the MO trading priority method is used. However, the prosumer and consumer surplus to be sold back to the grid remain high, at 13.27 kWh and 48.12 kWh respectively (Table 13).

The costs of the consumer C28 and revenues of the vendors in the energy poverty market tier are given in Tables 15–18 and Figures 18 and 19. The financial settlement is performed in this case using as reference only the vendor price offer, similar to POP from Tables 7–10, because with just one vulnerable consumer trading in the market, the COP is viable only if the consumer would buy at a fixed tariff, and MCP results are the same as POP when COP is not specified.

The results show that the vendor revenues are lower than in the primary market, because of the smaller traded quantities, but they can become significant if they are averaged over longer periods (months, years). The consumer C28 will pay less in the local market than when buying electricity from the grid, and the MO trading priority maximizes its earnings and the number of hourly intervals in which trading can be made. A more profitability analysis will follow in the Discussions section, for all the trading segments considered in the market algorithm.

remain high, at 13.27 kWh and 48.12 kWh respectively (Table 13).

Figures 16 and 17 and Tables 11–14 reveal significantly different trading scenarios on the energy poverty mitigation market when the two trading priority methods (FCFS and MO) are used in the primary market. For FCFS, 3 out of 5 prosumers will trade electricity with C28, while if MO were to be used, only P15 and P3 will sell electricity, the rest of the buying offer being fulfilled by just one consumer, C19. Also, if the secondary market is activated, the available surplus rises when MO is used from 13.88 kWh in the primary market to 63.18 kWh, due to the presence of the consumers who need to sell the surplus generated by the forecast error or offer quantity rounding. In the absence of the secondary market, these two quantities would be sold back to the grid at minimal price. Thus, in addition to allowing prosumer to sell more surplus, the secondary market offers a mechanism for minimizing the effect of consumption forecast errors at the consumer side when the MO trading priority method is used. However, the prosumer and consumer surplus to be sold back to the grid

The costs of the consumer C28 and revenues of the vendors in the energy poverty market tier are given in Tables 15–18 and Figures 18 and 19. The financial settlement is performed in this case using as reference only the vendor price offer, similar to POP from Tables 7–10, because with just one

**Figure 18.** The energy poverty mitigation market cost for buyers: (**a**) hourly values, FCFS; (**b**) daily values for each consumer, FCFS; (**c**) hourly values, MO; (**d**) daily values for each consumer, MO. **Figure 18.** The energy poverty mitigation market cost for buyers: (**a**) hourly values, FCFS; (**b**) daily values for each consumer, FCFS; (**c**) hourly values, MO; (**d**) daily values for each consumer, MO. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 23 of 43

**Figure 19.** The energy poverty mitigation market revenue for vendors: (**a**) hourly values, FCFS; (**b**) daily values for each consumer, FCFS; (**c**) hourly values, MO; (**d**) daily values for each consumer, MO. **Figure 19.** The energy poverty mitigation market revenue for vendors: (**a**) hourly values, FCFS; (**b**) daily values for each consumer, FCFS; (**c**) hourly values, MO; (**d**) daily values for each consumer, MO.

MO POP 0.75

**Table 16.** The hourly cost for all buyers in the energy poverty mitigation market, mu. **Consumers h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total FCFS** POP 0 0 0 0 0.00 0.08 0.51 0 0.02 0.11 0 0 0 0.72 MO POP 0.07 0.05 0.06 0 0.00 0.04 0.24 0.02 0.01 0.10 0.03 0.03 0.09 0.75

**Table 17.** The daily revenue for each vendor in the energy poverty mitigation market, mu.

**Vendors P21 P7 P15 P6 P3 C5 C9 C11 C12 C16 C19 C20 C24 C26 Total FCFS** POP 0 0.11 0 0.53 0.08 0 0 0 0 0 0 0 0 0 0.72 MO POP 0 0 0.29 0 0.00 0 0 0 0 0 0.46 0 0 0 0.75

**Table 18.** The hourly revenue in the energy poverty mitigation market for all vendors, mu. **Prosumers h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total FCFS** POP 0 0 0 0 0.00 0.08 0.51 0 0.02 0.11 0 0 0 0.72 MO POP 0.07 0.05 0.06 0 0.00 0.04 0.24 0.02 0.01 0.10 0.03 0.03 0.09 0.75

As seen previously, the vendors can remain after the primary market with surplus available for selling. Both prosumers and consumers can become sellers on the secondary market. The energy poverty mitigation tier can help to reduce the surplus, but, if the vulnerable consumers have low

*4.3. The Secondary Market—The Commercial Tariff Access Tier*


**Table 15.** The daily cost for each consumer in the energy poverty mitigation market, mu.

**Table 16.** The hourly cost for all buyers in the energy poverty mitigation market, mu.


**Table 17.** The daily revenue for each vendor in the energy poverty mitigation market, mu.


**Table 18.** The hourly revenue in the energy poverty mitigation market for all vendors, mu.


*4.3. The Secondary Market—The Commercial Tari*ff *Access Tier*

As seen previously, the vendors can remain after the primary market with surplus available for selling. Both prosumers and consumers can become sellers on the secondary market. The energy poverty mitigation tier can help to reduce the surplus, but, if the vulnerable consumers have low demand and are in low numbers, the quantities still remaining after the settlement can be significant. For the demand-generation balance and the set of offers used in the case study, the total primary market surplus is of 63.18 kWh and reduces only to 61.39 kWh after the energy poverty mitigation market, if the MO trading method is used. For the FCFS method, the remaining surplus decreases from to 11.58 kWh to 10.86 kW. For further reducing the quantity sold to the grid, the local market model uses the second tier of the secondary market, operated according to the MO trading priority method used in the primary market, but with different market participants.

The sellers that can enter this market segment are the same as for the energy poverty mitigation market: prosumers with remaining surplus and consumers whose offers placed in the blockchain system of the primary market exceed their actual demand, thus becoming surplus. The buyers are consumers from the same microgrid who did not participate in the primary market, but are ready to occasionally buy surplus from the secondary market when it is available, at market prices. In exchange for this facility, they pay an extra fee, according to the formula from Equation (10). The quantities are determined automatically in the settlement phase of the energy poverty market or at the end of the primary market, if the EP tier is not used. The sell price offers are the offer prices entered by prosumers in the blockchain system of the primary market. For consumers the buy prices are: C13–0.47 mu/kWh, C17–0.30 mu/kWh, C18–0.42 mu/kWh, lower than the average offers from the primary market, in order to minimize the effect of the added tariffs. The fulfilment priority for the buy and sell offers is determined using the MO strategy from Figure 4, and the actual quantities and financial exchanges between sellers and buyers are settled as in the primary market.

Using as reference the trading data from Table 13, the sellers participating in the market are P21, P15, P6 and P3, if the FCFS method is used in the primary market, and P21, P15, P3, C5, C9, C11, C12, C16, C19, C20, C24, and C26. The buyers are three consumers that did not participate in the primary market, namely C13, C17 and C18. The fee applied for all the consumers is a 10% increase of the final

seller.

buy price, and it is charged by the market administrator. For evaluating all the possibilities regarding the financial settlement, all three price alternatives will be considered: MCP, COP and POP, similar to the primary market. The quantities offered and actually traded by each vendor and buyer in the two primary market methodologies (FCFS and MO) are given in Appendix C, Tables A10–A14. system of the primary market exceed their actual demand, thus becoming surplus. The buyers are consumers from the same microgrid who did not participate in the primary market, but are ready to occasionally buy surplus from the secondary market when it is available, at market prices. In exchange for this facility, they pay an extra fee, according to the formula from Equation (10). The

market: prosumers with remaining surplus and consumers whose offers placed in the blockchain

method used in the primary market, but with different market participants.

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 24 of 43

demand and are in low numbers, the quantities still remaining after the settlement can be significant. For the demand-generation balance and the set of offers used in the case study, the total primary market surplus is of 63.18 kWh and reduces only to 61.39 kWh after the energy poverty mitigation market, if the MO trading method is used. For the FCFS method, the remaining surplus decreases from to 11.58 kWh to 10.86 kW. For further reducing the quantity sold to the grid, the local market model uses the second tier of the secondary market, operated according to the MO trading priority

The results show that the use of the MO in the primary market leads to higher quantities traded in the tariff-access market tier, while if the FCFS priority is chosen, prosumer surplus is lower. The hourly results for the market and the daily quantities traded by the prosumers and the consumers are summarized, as for the previous market tiers, in Figures 20–23 and Tables 19–22. quantities are determined automatically in the settlement phase of the energy poverty market or at the end of the primary market, if the EP tier is not used. The sell price offers are the offer prices entered by prosumers in the blockchain system of the primary market. For consumers the buy prices are: C13–0.47 mu/kWh, C17–0.30 mu/kWh, C18–0.42 mu/kWh, lower than the average offers from the

The results from Tables 19–22 show that the tariff-access consumers are able to acquire 7.67 kWh for the FCFS primary market trading priority, exclusively from prosumer surplus. 21.28 kWh are bought for the MO trading priority method, mainly from consumer surplus, as it can be seen in Table 21. When the MO method is used, the consumer buy offers are fulfilled from the most part from the local market (Table 20), only 1.2 kWh remaining to be bought from the grid. After the settlement of the two commercial market tiers, the prosumers lower their unsold surplus to only 3.19 kWh (FCFS) or 4.7 kWh (MO), while the consumer surplus remains high, at 35.94 kWh. The prosumer surplus is available mainly in the 09:00–14:00 interval, while the consumer surplus can be accessed outside this interval, between 06:00–8:00 and 15:00–18:00 (see Table A11). primary market, in order to minimize the effect of the added tariffs. The fulfilment priority for the buy and sell offers is determined using the MO strategy from Figure 4, and the actual quantities and financial exchanges between sellers and buyers are settled as in the primary market. Using as reference the trading data from Table 13, the sellers participating in the market are P21, P15, P6 and P3, if the FCFS method is used in the primary market, and P21, P15, P3, C5, C9, C11, C12, C16, C19, C20, C24, and C26. The buyers are three consumers that did not participate in the primary market, namely C13, C17 and C18. The fee applied for all the consumers is a 10% increase of the final buy price, and it is charged by the market administrator. For evaluating all the possibilities regarding the financial settlement, all three price alternatives will be considered: MCP, COP and POP, similar

Because of the larger quantities bought by the three consumers, the fee-access tier is more profitable for the surplus vendors, compared to the energy poverty mitigation market. In addition, considering the lower price offers used for the tariff-access consumers, the COP settlement option is the best choice for the consumers, incurring the lowest costs (see Table 25). For the FCFS trading priority method, MCP and POP give the same results, which suggests that the merit order clearing price is determined by higher vendor price offers (Table 26). to the primary market. The quantities offered and actually traded by each vendor and buyer in the two primary market methodologies (FCFS and MO) are given in Appendix C, Tables A10–A14. The results show that the use of the MO in the primary market leads to higher quantities traded in the tariff-access market tier, while if the FCFS priority is chosen, prosumer surplus is lower. The hourly results for the market and the daily quantities traded by the prosumers and the consumers are summarized, as for the previous market tiers, in Figures 20–23 and Tables 19–22.

**Figure 20.** The buyer quantity offers in the secondary tariff-access market: (**a**) hourly; (**b**) per **Figure 20.** The buyer quantity offers in the secondary tariff-access market: (**a**) hourly; (**b**) per consumer. *Sustainability* **2020**, *12*, x FOR PEER REVIEW 25 of 43

**Figure 21.** The buyer quantities traded in the secondary tariff-access market: (**a**) hourly; (**b**) for each consumer. **Figure 21.** The buyer quantities traded in the secondary tariff-access market: (**a**) hourly; (**b**) for each consumer.

(**a**) (**b**)

**Figure 22.** The seller quantity offers in the secondary tariff-access market: (**a**) hourly; (**b**) for each

**Table 19.** The daily traded quantities for each buyer in the secondary tariff market, kWh. **Consumer C13 C17 C18 Total** offer FCFS 7.30 8.55 6.62 22.48 offer MO 7.30 8.55 6.62 22.48 traded FCFS 2.49 2.99 2.20 7.67 traded MO 7.30 7.61 6.36 21.28 rem. FCFS 4.82 5.57 4.43 14.81 rem. MO 0.00 0.94 0.26 1.20

**Table 20.** The hourly traded quantities in the secondary tariff market for all buyers, kWh.

**Table 21.** The daily traded quantities for each vendor in the secondary tariff market, kWh.

**Vendor P21 P15 P6 P3 C5 C9 C11 C12 C16 C19 C20 C24 C26 Total** surplus FCFS 1.18 1.30 1.45 6.92 0 0 0 0 0 0 0 0 0 10.86 surplus MO 9.02 3.76 0.00 0.49 10.65 4.48 6.20 4.46 7.44 1.52 4.40 1.18 7.80 61.39

**Hour h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total** offer FCFS 1.99 1.03 1.11 1.39 2.12 1.85 2.16 1.08 1.58 1.55 2.41 1.79 2.42 22.48 offer MO 1.99 1.03 1.11 1.39 2.12 1.85 2.16 1.08 1.58 1.55 2.41 1.79 2.42 22.48 traded FCFS 0 0 0 1.39 2.12 1.85 0.73 0 1.58 0 0 0 0 7.67 traded MO 1.62 1.03 1.11 1.39 2.12 1.85 2.16 0.99 1.58 0.81 2.41 1.79 2.42 21.28 rem. FCFS 1.99 1.03 1.11 0.00 0.00 0.00 1.43 1.08 0.00 1.55 2.41 1.79 2.42 14.81 rem. MO 0.38 0.00 0.00 0.00 0.00 0.00 0.00 0.09 0.00 0.74 0.00 0.00 0.00 1.20

(**a**) (**b**)

*Sustainability* **2020**, *12*, x FOR PEER REVIEW 26 of 43

**Figure 21.** The buyer quantities traded in the secondary tariff-access market: (**a**) hourly; (**b**) for each

rem. FCFS 0.32 1.30 0 1.56 0 0 0 0 0 0 0 0 0 3.19

traded FCFS 0.86 0 1.45 5.36 0 0 0 0 0 0 0 0 0 7.67

**Figure 22.** The seller quantity offers in the secondary tariff-access market: (**a**) hourly; (**b**) for each **Figure 22.** The seller quantity offers in the secondary tariff-access market: (**a**) hourly; (**b**) for each seller.

**Table 20.** The hourly traded quantities in the secondary tariff market for all buyers, kWh. **Hour h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total Figure 23.** The buyer quantities traded in the secondary tariff-access market: (**a**) hourly; (**b**) for each seller. **Figure 23.** The buyer quantities traded in the secondary tariff-access market: (**a**) hourly; (**b**) foreach seller.

offer FCFS 1.99 1.03 1.11 1.39 2.12 1.85 2.16 1.08 1.58 1.55 2.41 1.79 2.42 22.48 offer MO 1.99 1.03 1.11 1.39 2.12 1.85 2.16 1.08 1.58 1.55 2.41 1.79 2.42 22.48 **Table 19.** The daily traded quantities for each buyer in the secondary tariff market, kWh.


surplus FCFS 1.18 1.30 1.45 6.92 0 0 0 0 0 0 0 0 0 10.86 interval, between 06:00–8:00 and 15:00–18:00 (see Table A11). **Table 20.** The hourly traded quantities in the secondary tariff market for all buyers, kWh.


COP 1.17 0.90 0.92 2.99 3.29 POP 1.14 1.47 1.01 3.61 3.98 **Table 21.** The daily traded quantities for each vendor in the secondary tariff market, kWh.


FCFS

MO

FCFS

MO

FCFS

MO


**Table 22.** The hourly traded quantities in the secondary tariff market for all vendors, kWh.

The costs of the buyers and the revenues of the vendors in this market tier are summarized in Figures 24 and 25 and Tables 23–26, for all three available settlement policies (MCP, COP, POP). *Sustainability* **2020**, *12*, x FOR PEER REVIEW 27 of 43

**Figure 24.** The tariff-access market cost for buyers: (**a**) hourly values, FCFS; (**b**) daily values for each consumer, FCFS; (**c**) hourly values, merit-order (MO); (**d**) daily values for each consumer, MO. **Figure 24.** The tariff-access market cost for buyers: (**a**) hourly values, FCFS; (**b**) daily values for each consumer, FCFS; (**c**) hourly values, merit-order (MO); (**d**) daily values for each consumer, MO.

**Table 24.** The hourly cost for all buyers in the tariff-access market, mu.

**Consumers h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total Total +** 

MCP 0 0 0 0.65 1.00 0.87 0.32 0 0.78 0 0 0 0 3.61 3.98 COP 0 0 0 0.56 0.88 0.65 0.34 0 0.55 0 0 0 0 2.99 3.29 POP 0 0 0 0.65 1.00 0.87 0.32 0 0.78 0 0 0 0 3.61 3.98

MCP 0.79 0.50 0.50 0.76 1.17 1.02 1.19 0.45 0.87 0.39 1.18 0.81 1.16 10.77 11.85 COP 0.75 0.45 0.42 0.56 0.88 0.65 0.88 0.38 0.55 0.33 0.95 0.65 0.95 8.39 9.23 POP 0.77 0.47 0.49 0.76 1.04 0.99 1.09 0.43 0.82 0.37 1.12 0.79 1.10 10.23 11.26

**Table 25.** The daily revenue for each vendor in the tariff-access market, mu. **Vendors P21 P15 P6 P3 C5 C9 C11 C12 C16 C19 C20 C24 C26 Total**

MCP 0.47 0 0.62 2.52 0 0 0 0 0 0 0 0 0 3.61 COP 0.26 0 0.63 2.10 0 0 0 0 0 0 0 0 0 2.99 POP 0.47 0 0.62 2.52 0 0 0 0 0 0 0 0 0 3.61

MCP 2.66 2.07 0 0.27 2.97 0 0 1.35 0.74 0.71 0 0 0 10.77 COP 1.65 1.65 0 0.23 2.55 0 0 1.05 0.56 0.70 0 0 0 8.39 POP 2.66 1.81 0 0.23 2.87 0 0 1.33 0.74 0.59 0 0 0 10.23

**10% Fee**

**Prosumers h06 h07 h08 h09 h10 h11 h12 h13 h14 h15 h16 h17 h18 Total**

MCP 0 0 0 0.65 1.00 0.87 0.32 0 0.78 0 0 0 0 3.61 COP 0 0 0 0.56 0.88 0.65 0.34 0 0.55 0 0 0 0 2.99 POP 0 0 0 0.65 1.00 0.87 0.32 0 0.78 0 0 0 0 3.61

MCP 0.79 0.50 0.50 0.76 1.17 1.02 1.19 0.45 0.87 0.39 1.18 0.81 1.16 10.77 COP 0.75 0.45 0.42 0.56 0.88 0.65 0.88 0.38 0.55 0.33 0.95 0.65 0.95 8.39 POP 0.77 0.47 0.49 0.76 1.04 0.99 1.09 0.43 0.82 0.37 1.12 0.79 1.10 10.23

**Figure 25.** The tariff-access market revenue for vendors: (**a**) hourly values, FCFS; (**b**) daily values for each consumer, FCFS; (**c**) hourly values, MO; (**d**) daily values for each consumer, MO. **Figure 25.** The tariff-access market revenue for vendors: (**a**) hourly values, FCFS; (**b**) daily values for each consumer, FCFS; (**c**) hourly values, MO; (**d**) daily values for each consumer, MO.


**Table 23.** The daily cost for each consumer in the tariff-access market, mu.

An alternative proposed in the local market model for the tariff-access secondary market is an **Table 24.** The hourly cost for all buyers in the tariff-access market, mu.


tariff-access market, but this approach is not mandatory, as the energy mitigation market, the tariff-**Table 25.** The daily revenue for each vendor in the tariff-access market, mu.

The market diagram from Figure 1 considers the invite-access market as an alternative to the



**Table 26.** The hourly revenue in the tariff-access market for all vendors, mu.

### *4.4. The Secondary Market—The Commercial Invite Access Tier*

An alternative proposed in the local market model for the tariff-access secondary market is an invite-access market tier. This solution, while it has lower impact on the surplus reduction at market level, is viable for individual prosumers and consumers which are in the situation of frequently having unsold surplus after the final settlement. The invite-access strategy proposes that long-term P2P contracts can be established between seller–buyer pairs, stipulating that the buyer can automatically access the unsold surplus of the seller when it is available. In this case, the settlement is not performed at market level, but only for the two parties involved, and it can be considered that the buyer is an 'invited guest' in the local market.

The market diagram from Figure 1 considers the invite-access market as an alternative to the tariff-access market, but this approach is not mandatory, as the energy mitigation market, the tariff-access market and the invite-access market can be used in any desired order or number in the architecture of the local market.

Considering the layout from Figure 1 and the data from Tables 2, A2, A7 and A13, the evolution of the surplus of prosumer P21 in the MO primary market priority case is the one seen in Table 27. The prosumer is able to sell 4.844 kWh on the tariff-access market.


**Table 27.** The surplus of prosumer P21 in the primary and secondary markets (energy poverty mitigation and tariff-access), kWh.

On the other hand, if the prosumer has a P2P contract with consumer C22 who did not participate in the primary market, and the tariff access option is not activated, then it would be possible to sell in the invite-access market almost the same quantity, as can be seen in Table 28. Furthermore, a scenario can be imagined in which the invite market is activated first, followed by the tariff-access market, in which case prosumer P21 would be able to sell their entire surplus in the local blockchain market. Thus, if the market model is optimally configured, it can lead to the maximization of the local trading, thus minimizing the surplus sold to the grid at regulated tariffs.


**Table 28.** Comparison between the quantities sold by prosumer P21 in the tariff- and invite-access markets, kWh.

#### **5. Discussion**

The results presented in the case study show that the secondary market has a positive effect regarding the surplus quantities sold by the prosumers in the local market. A key aspect that still needs to be discussed is the profitability of the local market, with its two components. Using Tables 3, 5, 11, 13, 19 and 21 for quantities, the influence of the primary and secondary markets on the quantities sold by the prosumers and consumers back to the grid is determined in Tables 29 and 30.

**Table 29.** The evolution of the electricity quantities bought from the grid in the time interval 06:00–18:00, before and after trading on each market segment, kWh.




Table 29 shows that the offer quantities used in the MO trading priority determine a 49.3 kWh surplus at the consumers, which represents electricity traded but not consumed. This represents a high value, at 25% of the total consumption, and is mainly determined by hourly demand forecast errors. In the absence of the secondary market, the entire quantity would be sold to the grid, and the price mismatch between the buy price on the market (high) and sell price to the grid (low) would represent a cost increase for the consumers. Thus, accurate demand forecasts could reduce the costs for the consumers participating in the market. Additionally, it can be seen that the FCFS trading priority results in lower quantities sold back to the grid, as consumer surplus is absent.

Table 30 shows that the secondary market makes a significant contribution to reducing the prosumer surplus from 11.58/13.88 kWh to 3.18/4.17 kWh. Here, it can be seen that while the bulk of the surplus is sold on the primary market, the secondary market allows an important increase

of local generation sold locally. The primary market helps prosumers to sell the majority of their surplus in the local market, and the supplementary market tiers allow consumers to mitigate forecast errors by acting as sellers, and also reduce the share of surplus prosumer generation sold back to the grid. These trading options can have, depending on local conditions, positive effects in increasing the number of prosumers in the microgrid and reducing the electricity acquired by the consumers from the grid, at higher prices and taxes. In other words, social and environmental sustainability can be improved.

The reduction of local generation quantities sold back to the grid has positive financial effects for both prosumers and consumers. In the absence of the local market, the prosumers would sell any surplus to the grid at the regulated price. The market allows them to obtain better prices, which are still attractive for consumers as long as they do not exceed the tariff paid for the electricity imported from the grid. On the other hand, by participating in the local market, the consumers have the chance of paying less for electricity. From Tables 7, 9, 15, 17, 23 and 25, the costs and revenues for the sellers and vendors on each market segment can be summarized in Tables 31 and 32, for the 06:00–18:00 interval of the analyzed day.

**Table 31.** Comparison between the costs of the consumers in each market segment and for each settlement price, mu.



**Table 32.** Comparison between the vendor revenues on all market segments, mu.

Table 31 shows that the highest costs for the consumers occur when the COP settlement is used, while the POP settlement offers the best buy prices from the market. In Table 32, it can be seen that the prosumer revenues can double when the primary and secondary markets are used, with the highest profits being achieved on the primary market. The secondary market is, however, useful for the consumers who need to sell surplus remaining from the primary market, increasing their daily revenue by up to 200% (14.89 mu, compared to 12.38 mu).

Using the traded quantities and factoring the costs and revenues presented above, a comparison can be made between the daily electricity costs for the aggregated network demand in the 06:00–18:00 interval. Table 33 shows that the combined effect of the primary and secondary markets can decrease the cost by up to 26% when the FCFS trading prioritization is used. For MO prioritization, because of the significant consumer surplus in the primary market, the cost increases when MCP or COP settlement is used, but the effect of the secondary market is to compensate a fraction of the increase.


**Table 33.** Comparison between the influence of the primary secondary market on the electricity costs for the microgrid, time interval 06:00–18:00, mu.

It is important to note that the results presented in the paper are highly dependent on the input data used for the case study. The profits of the prosumers and the cost reductions for the consumers are affected by the quantities and prices offered in the market by both parties and can vary significantly from the results presented in the paper. Also, depending on local constraints, the trading tiers of the secondary market can be used only partially and in a different order. The case study presents a scenario of a complete market trading sequence to show the capabilities of the proposed model.

The results presented in Tables 29–33 use for the commercial tier of the secondary market only the tariff-access option.

#### **6. Conclusions**

The paper proposes a new local market for active microgrids, designed to maximize the surplus sold by the prosumers to the local consumers. The local market requires smart grid features in the microgrid and a blockchain ledger for submitting buy and sell offers. Trading is performed in two phases, first on a primary marked, followed by a two-tier secondary market. The case study shows that the secondary market can help the prosumers to sell more surplus to the local consumers, increasing their profitability. The advantages of the local market can be discussed from several perspectives:


However, as main disadvantages, accurate demand forecasts are necessary for the consumers if the MO trading method is used, for optimal market benefits. Furthermore, the implementation of the proposed market model is dependent on several prerequisites: the implementation of smart grid capabilities in the microgrid, the creation of adequate regulations by regional or national authorities, and the development of residential renewable electricity generation, all these being in incipient development stages across the world.

The proposed algorithm is a comprehensive tool of the trading process for consumers and prosumers in microgrids, considering the current regulation framework regarding prosumer activity in the Romanian electricity market, and future research directions considered by the authors aim to extend its capabilities for social inclusion, analyzing the influence of storage capabilities on local market trading dynamics and profitability, and considering new trading options, by comparison with similar real local market models, as they become available in the literature.

## **7. Patents**

National Patent Application "Innovative method of decision-making assistance aimed at streamlining the management of prosumer activity", Romania, 2020, in press.

**Author Contributions:** Conceptualization, B.-C.N., O.I. and G.G.; methodology, B.-C.N. and O.I.; software, B.-C.N. and O.I.; validation, O.I. and B.-C.N.; formal analysis, M.G. and D.-M.I.; investigation, O.I. and G.G.; data curation, O.I.; writing—original draft preparation, B.-C.N. and O.I.; writing—O.I., G.G., D.-M.I. and M.G.; supervision, M.G. and D.-M.I. All the figures and tables used in the paper were created by the authors. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by "Gheorghe Asachi" Technical University of Iasi, Romania, through the support of national project PNIII-1.2.PDI-PFC-C1–2018, as COMPETE project no. 9PFE/2018, financed by the Romanian Government.

**Acknowledgments:** The authors would like to express their gratitude to Maria Carmen Loghin, the Vice Rector of the "Gheorghe Asachi" Technical University of Iasi for his technical support, supporting logistics and open access of this journal publication.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Abbreviations**



#### **Appendix A. Input Data for the Primary Market**

**Table A1.** The hourly demand profiles for the entire microgrid, in kW (27 consumers).




**Table A2.** The hourly generation profiles for the prosumers in the microgrid, in kW (8 prosumers).



**Table A2.** *Cont.*

**Table A3.** The forecasted quantity offers of the buyers (consumers) for the primary market, MO trading priority, in kWh (11 consumers).


**Table A4.** The offer prices submitted by the buyers (consumers) in the primary market, in mu/kWh.


**Table A5.** The offer prices submitted by the sellers (prosumers) in the primary market, in mu/kWh.


### **Appendix B. Data for the Energy Poverty Mitigation Market**


**Table A6.** The sell offer quantities for the energy poverty mitigation tier (kWh), FCFS trading priority.

**Table A7.** The sell offer quantities for the energy poverty mitigation tier, MO trading priority, in kWh.


**Table A8.** The sell quantities traded in the energy poverty mitigation tier, FCFS priority, in kWh.



**Table A9.** The sell quantities traded in the energy poverty mitigation tier, MO priority, in kWh.

#### **Appendix C. Data for the Commercial Secondary Market, Fee-Access Method**

**Table A10.** The sell offer quantities for the commercial fee-access tier, FCFS trading priority, in kWh.


**Table A11.** The sell offer quantities for the commercial fee-access tier, MO trading priority, in kWh.



**Table A12.** The sell quantities traded in the commercial fee-access tier, FCFS trading priority.

**Table A13.** The sell quantities traded in the commercial fee-access tier, MO trading priority, in kWh.


**Table A14.** The buy quantities traded in the commercial fee-access tier, MO trading priority, in kWh.



**Table A15.** The buy quantities traded in the commercial fee-access tier, MO trading priority, in kWh.

#### **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

*Article*

## **Scheduling Charging of Electric Vehicles in a Secured Manner by Emphasizing Cost Minimization Using Blockchain Technology and IPFS**

**Muhammad Umar Javed <sup>1</sup> , Nadeem Javaid 1,\*, Abdulaziz Aldegheishem <sup>2</sup> , Nabil Alrajeh <sup>3</sup> , Muhammad Tahir <sup>4</sup> and Muhammad Ramzan 5,6**


Received: 2 April 2020; Accepted: 16 June 2020; Published: 24 June 2020

**Abstract:** In this work, Electric Vehicles (EVs) are charged using a new and improved charging mechanism called the Mobile-Vehicle-to-Vehicle (M2V) charging strategy. It is further compared with conventional Vehicle-to-Vehicle (V2V) and Grid-to-Vehicle (G2V) charging strategies. In the proposed work, the charging of vehicles is done in a Peer-to-Peer (P2P) manner; the vehicles are charged using Charging Stations (CSs) or Mobile Vehicles (MVs) in the absence of a central entity. CSs are fixed entities situated at certain locations and act as charge suppliers, whereas MVs act as prosumers, which have the capability of charging themselves and also other vehicles. In the proposed system, blockchain technology is used to tackle the issues related with existing systems, such as privacy, security, lack of trust, etc., and also to promote transparency, data immutability, and a tamper-proof nature. Moreover, to store the data related to traffic, roads, and weather conditions, a centralized entity, i.e., Transport System Information Unit (TSIU), is used. It helps in reducing the road congestion and avoids roadside accidents. In the TSIU, an Inter-Planetary File System (IPFS) is used to store the data in a secured manner after removing the data's redundancy through data filtration. Furthermore, four different types of costs are calculated mathematically, which ultimately contribute towards calculating the total charging cost. The shortest distance between a vehicle and the charging entities is calculated using the Great-Circle Distance formula. Moving on, both the time taken to traverse this shortest distance and the time to charge the vehicles are calculated using real-time data of four EVs. Location privacy is also proposed in this work to provide privacy to vehicle users. The power flow and the related energy losses for the above-mentioned charging strategies are also discussed in this work. An incentive provisioning mechanism is also proposed on the basis of timely delivery of credible messages, which further promotes users' participation. In the end, simulations are performed and results are obtained that prove the efficiency of the proposed work, as compared to conventional techniques, in minimizing the EVs' charging cost, time, and distance.

**Keywords:** blockchain; M2V; IPFS; charging scheduling; Great-Circle Distance

#### **1. Introduction**

With the huge increase in both population and urbanization, issues such as drastic climate changes, increased gas emissions, and depletion of fossil fuels arise. Rapid progress has been made in the vehicle industry over the past few years, leading to an increase in the number of vehicles. For this reason, road congestion has also increased drastically. This has created huge amounts of environmental pollution, which includes noise pollution, air pollution, land pollution, etc. These factors disturb the global economy and community to a greater extent. This disturbance further leads to the need for new revolutions for mitigating the previously mentioned problems [1]. To reduce the huge amount of energy required by the vehicles, the scientific and research communities have joined hands and started focusing on Electric Vehicles (EVs) as sources of clean energy. EVs have the ability of reducing fuel demands and gas emissions. Autonomous EVs are a cutting-edge technology of the modern era, which includes self-driving cars as well as services like ride-sharing and smart-pay. EVs also act as environment friendly and green energy sources, as they help in de-carbonization owing to the above-mentioned factors. Conventional combustion engines, which used fossil fuels, are replaced by electric motors that run on Renewable Energy Sources (RESs). EVs can be powered either from Charging Stations (CSs) or from the batteries installed within [2]. The EVs that are emerging drastically in the local market aim to make the power grid into a beneficial entity by introducing the concept of the Grid-to-Vehicle (G2V) charging strategy [3].

With immense developments being made in the Information and Communication Technologies (ICT) sector, bi-directional communication and trading are becoming a reality. In Smart Grids (SGs), EVs play major roles in transportation management. EVs can be charged both from RESs and even from other vehicles via a bi-directional trading mechanism.

In recent times, vehicle manufacturers have not only been competing in terms of providing the latest and most modern infrastructures, but also in terms of providing the latest functionalities and services to drivers. It is expected that conventional vehicles will be replaced with autonomous vehicles, and the entire transportation sector will be taken over by EVs in the near future. The reason is because of the immense amount of research being done in this sector, which enables the vehicular industries to manufacture efficient and highly capable vehicles. Moreover, the battery manufacturing industries also aim at manufacturing batteries with long lifetimes and that are capable of storing more charge. Even now, some conventional vehicles are equipped with the latest technologies for making them semi-autonomous. The increasing number of EVs also poses some problems, like the range anxiety problem, the lack of charging spots, and privacy and security issues. The range anxiety problem is the fear of running out of battery power when going on long distances and being unsure of the availability of CSs. Therefore, batteries with large energy storage capabilities are required when going on long travels, which will, in turn, increase the weight of the car, hindering its performance [4].

In conventional energy trading systems, vehicles have to buy energy from the grid, i.e., a central entity, which makes G2V a centralized system. The involvement of a centralized third party means that there exist single-point failure and privacy leakage issues. The entire system is not optimal and inherits great security risks, as the data residing in the central body are quite easily accessible by hackers. To overcome these issues, a Peer-to-Peer (P2P) system is the optimal solution. A P2P system involves energy trading between EVs, i.e., a Vehicle-to-Vehicle (V2V) trading system. This system has the advantage that the centralized body is eliminated, along with the problems associated with it. However, this decentralized system has some problems. EVs with surplus electricity are hesitant to trade energy with other vehicles due to the privacy and security concerns. Users do not trust each other, as the system is not transparent [5].

To overcome the above-mentioned problems, it is the need of the hour that such a decentralized system is introduced that ensures security, privacy, and data immutability. For this, blockchain technology is introduced and incorporated into various fields of life, like Wireless Sensor Networks (WSNs), Internet of Things (IoT) [6,7], energy [8–10], healthcare, agriculture [11], etc. Blockchain is a decentralized technology that eliminates the need for the centralized party and promotes privacy and trust among entities. In blockchain technology, the transactions are saved in a distributed ledger; copies are available with every node, ensuring transparency. The transaction data are first stored in a block with a unique hash. Then, these blocks are linked together in a chronological manner. For data verification, consensus algorithms, like Proof of Work (PoW), Proof of Stake (PoS), etc., are used in a blockchain network. Agreement of 51% between nodes is required for any action to take place, e.g., the addition of a new vehicle, sharing of a service, etc., in a blockchain network [12].

A number of problems are associated with the charging of EVs, like limited battery capacities, lower numbers of CSs, trust issues, etc. The cost of charging also plays a vital role in charging of EVs. The vehicle users are reluctant to have their vehicles charged at higher costs. The charging behavior of EVs also affects the grids and the CSs. Therefore, the primary focus of the current research is on the scheduling strategies of EVs. The problem of the limited number of CSs can also be resolved using blockchain technology. It will promote trust between users, which will lead to users' willingness to trade energy amongst themselves. The state information of an EV is collected in the first step, and if the battery level is low, i.e., if the charge stored in the battery is less, then a charging request will be broadcasted to the network. Meanwhile, using a Global Positioning System (GPS), the location information of the EV can be traced and sent to the other vehicles of the network. Then, the shortest driving path is calculated from information obtained through the GPS [13]. The remainder of the paper is organized as follows. Section 2 presents an overview of the related work along with a critical analysis. Section 3 put forwards the problem statement of the proposed work. Section 4 covers the discussion of our proposed system models. The proposed charging schedule is given in Section 5. Section 6 is dedicated to the mathematical formulation of the cost functions and the objective function. Section 7 discusses the power flow and the formulation of the associated energy losses in different charging strategies. The incentive provisioning to the users is presented in Section 8. Furthermore, Section 9 discusses the simulation results in a comprehensive manner. Finally, conclusions and directions for future work are given in Section 10.

After reviewing the work done by several authors in [12,14,15], the motivations for the proposed work are summarized as follows:


This work is the extended version of [16]. The major contributions made in this paper are as follows:


#### **2. Related Work**

Nowadays, the Vehicular Network (VN) is getting smarter with every coming day, and research is aiming towards making it an integral part of the smart city infrastructure. EVs play vital roles in distributed RES transportation and management in SGs. EVs are able to get energy both from the CSs as well as from other EVs using V2V trading. In the near future, the traffic sector will be comprised of a huge number of intelligent EVs. To ensure the security and cost reduction, blockchain will surely play a major role. Several research organizations are currently working on integration of blockchain in the vehicular sector. The blockchain technology promises the advantages of decentralization, security, and trust among EVs. The authors of [5] proposed a system using blockchain along with multisignatures to address transaction security issues. However, the proposed model lacks in providing an efficient system, as it is quite expensive to implement. The authors of [14] proposed a blockchain-based system that makes use of consortium blockchain in order to establish a distributed ledger with nominal cost. In the proposed method, Local Aggregators (LAGs) were introduced to audit and verify the transactions.

In [17], the authors used blockchain technology for creating a decentralized, secured, and trusted ecosystem. The proposed ecosystem consisted of a seven-layer blockchain model. The relationship between the Blockchain-based Intelligent Transport System (B<sup>2</sup> ITS) and Parallel transportation Management Systems (PtMS) was also studied. It was proved that B<sup>2</sup> ITS along with PtMS can be used for building better future transportation management systems. In [18], the authors proposed that blockchain technology be integrated into Vehicular Ad-hoc Networks. The proposed system was termed VANET. It consisted of two applications: Mandatory applications and optional applications. Mandatory applications consisted of traffic regulation, vehicle taxation, and vehicle insurance, whereas optional applications consisted of weather information and information about roads, traffic jams, etc. The authors of [19] proposed a blockchain model that ensured that users' data remain secure and private. However, it created trust issues. Services associated with wireless softwares and the respective updates were used to illustrate the efficiency of the proposed model. The authors of [20] described the methods for making the EV communication secure by using cryptographic keys and establishing a public key infrastructure. The proposed model used visible light and acoustic side-channel techniques for minimizing the throughput requirement and providing device independence.

In [21], the authors compared different mechanisms employed in the SG for provisioning of incentives to users. Moreover, they also comprehensively considered the cloud-based V2V energy trading process. Comparison between different existing incentive-based trading schemes was done in order to establish an optimized scheme, which will increase the profit. The authors of [22] presented a decentralized security model that ensured that the trading security is enhanced in the P2P network. The scheduling of vehicle charging was also presented and was supported by a realistic infrastructure. A novel RES pricing scheme in smart cities was brought under consideration by the authors of [23] to achieve domestic electricity bill reduction. The charging schedule was performed using an advanced cross-entropy optimization technique. The proposed system was able to cut down the energy cost at both the community level and the individual level. A game-based energy trading model was proposed in [24] to work out the decision-making processes of electricity operators and consumers in VNs. Small Energy Suppliers (SESs) and Energy Consumers (ECs) were incorporated into the proposed system, and such strategies were designed that made the proposed system beneficial for both the SESs

and ECs. By implementing various stochastic dynamic programming methods, the authors of [25] investigated the energy management in a Smart Home (SH) equipped with Plug-in EVs (PEVs) to address the issue of volatility of RES supply while considering the electricity cost.

The uncontrolled EV charging and discharging created problems for the grid and the CSs, e.g., amplifying the voltage peak, reducing the system's stability, and creating voltage dips. Authors discussed the effects of EVs on energy demand and supply, stability, and reliability in [26]. Two different scenarios were discussed: Vehicle-to-Grid (V2G) and G2V. The authors of [27] proposed a double-layered model and tried to properly allocate the EV charging lots. In the first stage, lots were properly allocated, whereas, in the second stage, integration of RESs in the charging lots was studied. The authors of [28,29] studied the user response behavior, multi-resource coordination strategies, and hierarchies of the electricity markets to model incentive programs. Similarly, the authors of [30,31] proposed Micro-Grid (MG) scheduling for EV charging, and also discussed the algorithms that could make EV charging and discharging an easy and efficient task. Ways to reduce the operational costs and environmental pollution were also discussed.

Integrating RESs in EVs can prove to be a beneficial task and can overcome the hazards of environmental pollution. The authors of [32] proposed an MG architecture running on RESs. It is equipped with a charging lot and aggregated EVs. The main objective is to reduce charging cost and also to provide incentives to those EV users who took part in Demand Response (DR) strategies. The authors of [33] proposed a secure service-provisioning mechanism for lightweight clients. Blockchain technology is used to provide security and privacy to the network. In [34], the authors proposed the PageRank mechanism to assign reputation values to the customers. The customer with the highest reputation value is then authorized to add blocks in the blockchain network. Three different types of attacks were addressed using the modified form of Proof of Authority (PoA).

Conventionally, data are stored in a centralized server, which is vulnerable to attacks. The authors of [35] proposed a secure online storage scheme to store the data provided by users in a P2P manner. The users' information is stored in the form of chunks, which protects it from attacks by malicious entities. All of the data and the metadata are stored online, which means that nothing is stored in the user node. The data are not compromised with the passage of time because they are accessed only by the authorized nodes. The proposed work ensures security provision to the users' data. Similarly, to provide security for the medical data of the users, an attribute-based signature scheme with multiple authorities is proposed by the authors of [36]. In the proposed work, the medical data are attested by the respective patients to avoid disclosure of information to untrusted entities. The proposed work is compared with existing works, which further validates its performance. The authors of [37] proposed a blockchain-based data-sharing platform integrated with the IPFS. In the proposed model, the metadata are uploaded to the IPFS and then divided into a number of sectors. The users are assigned roles and are authenticated using digital signatures. The users are asked to give reviews of the data uploaded to IPFS. Upon successful data delivery, users are awarded with incentives. In this way, maximum honest reviews are uploaded against each file. The authors of [38] proposed a blockchain-based framework for document sharing and version control. The proposed work facilitated multi-user collaboration and change tracking in a secured and trusted environment. The documents are stored in the IPFS, which promotes security. In [39], the authors used the IPFS along with blockchain technology to provide a trusted data traceability and authorization protection mechanism. It also provides a transparent auditing track to trace the data delivery from the sender to the receiver. The proposed model is termed BlockIPFS, in which the metadata is stored in the IPFS and the respective hashes in the blockchain network. Table 1 gives a summary of the related work being studied.

#### *2.1. Critical Analysis*

In this subsection, different papers used in the related work (see Section 2) are critically analyzed and evaluated on the bases of three different factors, i.e., scalability, privacy, and resource utilization.



*Sustainability* **2020**, *12*, 5151

#### 2.1.1. Scalability

Scalability is defined as the change in a system's response with the change in hardware components or dataset size. The scalability of a system makes it efficient, competitive, and reputable. From all the papers discussed, References [14,19,21,33] considered scalability. However, some limitations still exist in these papers. For example, in [14], scalability is achieved at the expense of temporal complexity. With the increase in the number of iterations, the computational time also increases. In [19], hardware components' scalability is achieved with the increase in number of blocks generated by EVs. This increase in number of blocks requires enhanced privacy provisioning. However, the proposed work lacks in providing the necessary privacy.

#### 2.1.2. Privacy

Privacy is defined as the ability of an individual or a group of individuals to protect themselves from external interferences. It is of vital importance in any network, especially in blockchain technology, which removes the third party and helps in ensuring the privacy of the network users. Security, encryption, authentication, authorization, etc. all come under the umbrella of privacy. Different papers addressed privacy provisioning in blockchain-based models in different ways and for different purposes, like secure P2P energy trading [14], secure energy trading between EVs [22], and fair data sharing in deregulated SGs [34]. Encryption in the proposed networks of different papers also contributes towards privacy provisioning. The aforementioned three papers, along with Reference [19], used different encryption techniques to encrypt the data and promote data security. However, some limitations still exist; e.g., in [19], an asymmetric encryption technique is used, which fails when encrypting bulk transactions.

#### 2.1.3. Resource Utilization

Resource utilization refers to the achievement of maximum output using minimum resources. This is in relation with the consensus mechanisms used in blockchain-based networks. The work done in References [33,34] is efficient in terms of resource utilization because they both use the PoA consensus mechanism. However, other papers mostly used the PoW consensus mechanism, which has the limitations of excessive power consumption and increased resource utilization.

#### **3. Problem Statement**

With the rapid advancements made in various fields of life, a huge shift from conventional forms to the latest and most advanced forms is observed. For instance, traditional grids have been transformed into SGs, which solve the issues of load mismanagement and users' participation using two-way communication methods and advanced infrastructures. Previously, the centralized systems were being used to handle various tasks like sharing of data, energy trading, resource sharing, etc. These systems performed well in their respective domains. However, they have the issues of lack of security, trust, and privacy, along with increased costs and a single point of failure. These problems arise due to the vulnerability of the centralized systems to the malicious entities. To tackle these issues, centralized systems are being changed into decentralized systems, which further ensure reduction of vehicles' charging costs, removal of the single point of failure, and minimization of charging time in the vehicular sector. Without a doubt, the decentralized systems have helped a great deal in solving the above-mentioned issues. Still, they face a number of issues, such as lack of increased security or enhanced privacy, absence of trustworthiness, and lack of users' willingness to participate in the VNs, which need to be tackled. The causes of these issues are reliance on intermediate parties, usage of inefficient security protocols, involvement of inexperienced personel, etc. To tackle these issues, blockchain technology is introduced, which has some highly fascinating features like immutability, resistance to tampering, and security.

The concept of the smart city is not new; however, it still requires much work to transform the simpler cities into the smarter ones. A VN is also a major part of a smart city, which is to be made smart, intelligent, and to be powered using RESs. In modern times, vehicles are getting smarter, throttling is getting faster, and infrastructure is becoming more complex. To fully aid the movement of EVs on the roads and to enhance security of the VNs, the first and foremost requirement is the authentication of the vehicles [12]. The vehicles must be authorized before they become part of the network. Once the vehicles are authenticated, they are free to move in the VN without the fear of legal disobedience.

With the drastic increase in the number of vehicles, the issue of data storage also arises. The mobile vehicles communicate with the surrounding vehicles, Roadside Units (RSUs), and CSs, hence generating and sharing a huge amount of data continuously. As a result of this continuous data sharing, issues such as improper data storage and delayed timely response arise, which lead to mismanagement in VNs. The huge and ever-growing increase in the number of vehicles on the roads leads to further issues, such as road congestion and frequent traffic jams. Due to these reasons, road accidents are increasing in number, resulting in the loss of human life in some cases [40]. To further ensure secure and manageable provisioning of information between entities, a decentralized data storage mechanism is required [35]. Furthermore, to decrease the burden of data storage, the data must be filtered and made less redundant. The data filtration will help in solving the issue of data redundancy. Storage of less redundant data improves the efficiency of the overall VN and also solves the issue of delayed response. Due to the rapid migration of people from traditional vehicles to EVs, the need for proficient knowledge of people about the batteries installed within their vehicles is also increasing. Due to the low literacy rates in many countries, the issue of the lack of such awareness is arising. People are less knowledgeable about their vehicles and also about the exact locations of the charging entities, which causes mismanagement in the VNs. Moreover, the lack of knowledge about the methods required to calculate the shortest distance to the nearest charging entities, the time required to cover that distance, and the time required to charge the vehicles leads to burdens on charging entities and irregular flows of energy in the VNs [41]. This further leads to issues like load-shedding and imbalances between energy supply and demand.

To promote users' participation and privacy, incentive provisioning and location privacy are factors that play vital roles. When users are guaranteed that they are being provided with enhanced security and better incentives, they tend to participate actively and without selfishness. However, much work has not been done in providing these two aspects simultaneously; therefore, they demand quick and active attention from the research community [42].

#### **4. Proposed System Model**

The proposed blockchain-based VN is comprised of EVs, MVs, CSs, an Authorization Unit (AU), and a TSIU. It covers various aspects, such as authentication of vehicles, charging scheduling of vehicles depending upon distance and charging time calculation, uploading and saving the files related to weather information and road conditions using the IPFS-integrated TSIU along with data redundancy minimization, incentive provisioning based on data credibility and timely responses by vehicles, etc. Moreover, the transaction details of the verified transactions are stored in a blockchain in a distributed manner; copies are kept at every node's end, hence ensuring data integrity, trust, and transparency. Figure 1 shows the proposed system model comprised of all the involved entities. In the figure, different types of charging strategies, i.e., V2V, M2V, and G2V, are given. Moreover, the authorization of new vehicles by the AU is also shown in Figure 1. Along with that, the uploading of data to the RSUs and then to the TSIU and IPFS is also given in the same diagram. Furthermore, the incorporation of blockchain technology in the proposed system model is also shown. The blue arrows used in the diagram show the flow of data between different entities. The stepwise workflow of the proposed system model is given in Section 4.1.

**Figure 1.** Proposed system model.

The details of the entities involved in charging of vehicles are given below.


Table 2 shows the comparison between the work done in Reference [43] and the proposed work done in this paper. From this comparison, it is inferred that our work is almost 70–80% different from the work done in [43]. Different parameters are considered while carrying out this comparison, such as contributions made, mathematical formulations done, performance parameters chosen, etc.

## *4.1. Workflow of the Proposed System Model*

The workflow of the proposed system model, shown in Figure 1 and discussed in the above section, is given here.

Step 1: Every new incoming vehicle in the network needs to be registered before it can become a part of the network and move freely. This registration is done through the AU, which assigns a pair of public and private keys to the vehicle.

Step 2: After a vehicle becomes a part of the network, it is supposed to send information to the nearest RSUs for storage purposes. This information can be of any type, such weather information, roadside information, or charging selling/buying requests. Meanwhile, the RSUs collect and save the incoming demands and the vehicles' data, keeping a check on the total number of requests being made.

Step 3: As the number of vehicles increases, the amount of information generated and sent to the RSUs also increases. Therefore, the TSIU and IPFS are used to filter the data and reduce data redundancy.

Step 4: When a vehicle needs energy, it broadcasts its request in the network, which includes EVs, MVs, CSs, and RSUs. This request is received by all of the other nearest entities that are part of the network.

Step 5: Upon receiving the request, the RSU decides the best charging entity for the vehicle. For the selection of the charging entity, different factors are considered, such as traveling distance, time taken to cover the distance, etc. The distance between the entities is calculated using the Great-Circle Distance formula.

Step 6: After reaching a suitable charging entity selected by the vehicle, the time required for charging the vehicle is calculated. This time varies with the State of Charge (SoC).

Step 7: After the time required for charging the vehicle is calculated, the total charging cost is calculated, which involves charging cost, distance cost, waiting cost, and reward/penalty cost. All of these costs are summed up to give the final charging cost, which needs to be minimized.

Step 8: The vehicles are also awarded with incentives to increase their participation in the proposed model. The incentives are calculated using reputation values based on two factors: Timely response and credible message delivery. The vehicles with negative reputations are penalized up to a certain threshold value. After that, they are blacklisted and eventually removed from the network.


**Table 2.** Comparison between work done in [43] and in our paper.

Table 3 shows the one-to-one mapping of the identified limitations with the proposed solutions. In the table, the limitations identified and discussed in Section 3 and shown in Figure 1 are referred to

as *L.1–L.9*. The solutions proposed for tackling these limitations are also provided in Table 3 and are referred to as *S.1–S.9*.


**Table 3.** Mapping of problems with proposed solutions.

#### *4.2. Authentication of Vehicles*

Figure 2 shows the authentication process of the vehicles, which was motivated by [44]. First of all, the new vehicles are directed towards the AU for registration. The arrows pointing towards the AU from the vehicles in Figure 2 show the coming in of new vehicles. The AU assigns unique identity key pairs to the vehicles, consisting of a private key and a public key. The personal data of vehicles are linked and accessed using the private key, whereas the public key is used when the request is to be made in the network. The AU signs every new incoming vehicle digitally using some sort of encryption technique and ensures the security of the vehicles and the network. Only the vehicles with the pair of keys are able to join the network and share information with other vehicles.

#### *4.3. TSIU*

The TSIU ensures the reliable transfer of information between the vehicles and the charging entities in a two-way communication manner. The pairs of keys assigned to the vehicles are digitally signed through the AU. The TSIU provides vehicles with various types of information, e.g., the weather conditions, the road congestion information, the locations of the CSs, etc. The vehicle users then decide upon what should be the optimal time and route for traveling using this information. This also helps to combat the range anxiety issue. The vehicle owners know beforehand how much battery charge and time is required for reaching the required destination so that they will not be in constant worry about the availability of the CSs. Figure 3 gives an overview of the TSIU model used. In the figure, different entities exist, such as EVs, MVs, TSIU, etc. The arrows used in the figure show the sharing of data between vehicles and the TSIU. All of the vehicles moving on the road are capable of sharing the road-related information with the TSIU, such as road conditions, number of vehicles, roadside accidents, etc. The TSIU is also capable of sharing this information with all of the vehicles at all times.

As all vehicles are capable of sending the information to the TSIU, this increases the burden on TSIU. To minimize it, the unwanted data are discarded before being sent to the TSIU. For removal of data redundancy, data filtration is performed by comparing the incoming data strings with the predefined string templates stored in the TSIU. If they both match, then the incoming data string will be stored in the TSIU. Otherwise, it will be discarded. Once the less redundant data are received by the TSIU, they are sent to the IPFS for further reducing the storage issue.

**Figure 2.** Authentication of vehicles.

## 4.3.1. IPFS

The vehicles send the information related to weather and road conditions to the TSIU, where this information is stored in the IPFS in a Distributed Hash Table (DHT). The IPFS helps in storing data in a secured distributed manner [45]. The hashes are assigned to each incoming file, and are then forwarded to the blockchain network. Whenever a new vehicle needs some information, it provides the hash to the TSIU, where it is matched with the existing hash. If the hashes are matched, then the information is provided to the vehicle. Otherwise, the request is regarded as fake. Once the information is provided to the network, the blockchain network is updated and a new transaction is stored in a block. The smart contract is written in Solidity and verified in RemixIDE for the IPFS. The main functions involved in the IPFS are: *Add road file, add weather file, get file count, get file ID*, and *assign malicious state*. The first two functions, i.e., *add road file* and *add weather file*, are for storing the files in the IPFS, and have maximum gas consumption. The other functions perform small tasks only; e.g., *get file count* gives the total number of files uploaded to the IPFS, *get file ID* gives the vehicle's ID for a specific file, and *assign malicious state* checks for the malicious status of a vehicle. Therefore, these functions have minimum gas consumption. Figure 4 shows the sequence diagram of the IPFS. However, Algorithm 1 gives the working of the IPFS in the TSIU.

## *4.4. Location Privacy*

In the proposed system model, the location of the vehicles is not shared with other entities in order to increase the vehicles' privacy. This privacy is achieved using the AES128 encryption technique. The actual location of the vehicle in the network is only known to the vehicle authorized by it. Whenever any unauthorized vehicle wants to know the actual location of another vehicle, it first has to get itself authorized by that vehicle. Without authorization, it will only get an encrypted alphanumeric string, which is almost impossible to decrypt. This location privacy solves the issue of users' hesitance to communicate with other vehicles.


**Figure 3.** TSIU Model.

**Figure 4.** Sequence diagram of the IPFS.

## **5. Charging Schedule**

In this section, the charging schedule of the EVs is discussed. It is important to ensure that the EVs added in the proposed blockchain-based network should have a proper scheduling scenario. For calculation purposes, real-time data are taken from the Electric Vehicle Database [46] and are given in Table 4.


### *5.1. Scheduling of Vehicle Charging*

Figure 5 shows the charging of an EV in three different sources, i.e., using an MV, using another EV, and using a CS. The charging source of the EV is decided by the EV according to the distance and price relationship. If the distance between the EV and the charging source is large, then the price will automatically be high. So, the EV will discard that source and go for the next nearest charging source.

**Figure 5.** Charging process of an EV using different sources.

## *5.2. Great-Circle Distance*

In this subsection, the distance between vehicles, CSs, and MVs is calculated. This distance calculation is very important for the selection of the entity for charging purpose. This formula gives the shortest distance between two points on a spherical surface. The inputs are the longitude and the latitude values for two different locations. The output is the distance between the provided locations in terms of kilometers or miles [47]. Great-Circle Distance is used in this work because it gives the spherical distance between two entities located on the circumference of the circle. In our work, we set a threshold of 50 km for the selection of the charging entity by an EV. If the charging entity lies outside the 50 km radius, then it will not be selected. Algorithm 2 gives the algorithm for shortest distance selection using Great-Circle Distance. In the algorithm, lines 4–12 record the geographical coordinates of the EVs, MVs, and CSs, respectively. After recording the coordinates, line 13 calculates the distance between an EV and MV, an EV and CS, and an EV and another vehicle using the Great-Circle Distance formula. Furthermore, the conditional statements, e.g., the nested-if loop given in lines 14–26, help in determining the shortest distance.

**Algorithm 2:** Algorithm for shortest distance selection using the Great-Circle Distance.

```
1 Initialization
```

```
2 Inputs: EVlong, EVlat, MVlong, MVlat, CSlong, CSlat
```
**<sup>3</sup> Output:** Shortest distance calculation

```
4 for EV do
```

```
5 Take its longitude and latitude values as EVlong and EVlat, respectively
```

```
6 end
```

```
7 for MV do
```

```
8 Take its longitude and latitude values as MVlong and MVlat, respectively
```
**<sup>9</sup> end**

```
10 for CS do
```

```
11 Take its longitude and latitude values as CSlong and CSlat, respectively
```

```
12 end
```

```
13 Find distances between vehicle and MV (disM2V), vehicle and CS (disS2V), and vehicle and EV
   (disV2V) using respective coordinates
```
**<sup>14</sup> if** *disM*2*<sup>V</sup>* < *disS*2*V, disM*2*<sup>V</sup>* < *disV*2*<sup>V</sup> and disV*2*<sup>V</sup>* < *50km* **then**

```
15 Select the distance between vehicle and MV as the shortest distance
```

```
16 end
```

```
17 else
```

```
18 if disS2V < disM2V, disS2V < disV2V and disS2V < 50km then
19 Select the distance between vehicle and CS as the shortest distance
20 end
21 end
22 else
23 if disV2V < 50km then
24 Select the distance between vehicle and EV as the shortest distance
25 end
```
## **<sup>26</sup> end**

**<sup>27</sup>** End

### *5.3. Calculation of Time Taken for Covering the Distance*

In this subsection, the total time taken by a vehicle for traversing the distance to the nearest charging entity, obtained using the Great-Circle Distance formula, is calculated. For this calculation, real-time data of four different EVs are used. The time taken by the vehicle for traversing the distance is

given in minutes using Equation (1). The time taken for covering the distance is calculated by dividing the total distance between an EV and the nearest charging entity by the average speed of that EV.

$$\text{Total time taken} = \frac{\text{Total distance}}{\text{Average speed}} \tag{1}$$

#### *5.4. Calculation of Time Taken for Charging the Vehicles*

In this subsection, the time taken for the charging of the vehicles is calculated. For calculation of the charging time, we make use of the real-time data given in Table 4. The time taken for charging the vehicles is taken in hours and is calculated using Equation (2).

$$\text{Total charging time} = \frac{\text{Battery capacity}}{\text{Charging power}} \tag{2}$$

#### *5.5. Charging Scheduling Algorithm*

Algorithm 3 gives the charging schedule and cost calculation of the vehicles. Line 1 initializes the algorithm, whereas lines 2 and 3 are for declaring the inputs and the output. Line 4 finds the total number of vehicles present in the network. After finding the total number of vehicles, lines 5–13 calculate the SoC values of the vehicles to check which vehicles need charging and at what percentage. After that, lines 14–26 select the charging entity on the basis of distance.

**Algorithm 3:** Algorithm of Charging Schedule

```
1 Initialization
```

```
2 Inputs: Vehicles, EV, MV, CS, disS2V, disM2V, disV2V
3 Output: EV charging schedule and cost calculation
4 Find the number of registered vehicles
5 for Each vehicle, vehicle = 1, ..., n do
6 Find State of Charge (SoC) of the vehicles
7 if (Vehicle is discharging) then
8 SoC = 1
9 else
10 SoC = 0
11 end
12 end
13 end
14 for Each vehicle, vehicle = 1, ..., n do
15 Find distance between vehicle and MV (disM2V), vehicle and CS (disS2V), and vehicle and
      EV (disV2V)
16 if (disM2V ≤ τ) then
17 Charge vehicle through MV
18 else
19 disV2V ≤ τ
20 Charge vehicle through EV
21 end
22 else
23 Charge vehicle through CS
24 end
25 end
26 end
27 End
```
#### **6. Mathematical Formulation**

This section provides the mathematical formulations of the calculations of the total charging cost and of the objective function in Sections 6.1 and 6.2, respectively.

#### *6.1. Charging Cost Calculation*

The total charging cost is calculated by calculating the sum of four individual costs, i.e., charging cost, distance cost, waiting cost, and reward/penalty cost, motivated by [43]. These costs are denoted as *C*1*T, C*2*T, C*3*T*, and *C*4*T*, respectively. These costs are given in Equations (3)–(6).

The first cost is the total charging cost for CSs, EVs, and MVs. P*CS*, P*MV*, and P*EV* are the generation costs per unit for CSs, EVs, and MVs, respectively, whereas *CCS, CMV*, and *CEV* are the energy selling costs for CSs, EVs, and MVs, respectively. The product of generation cost with the selling cost provides a complete cost of an entity; when the costs of all three entities are added up, the total charging cost is given, as shown in Equation (3).

$$\mathbf{C}\_{1T} = \left(\mathbf{P}\_{\mathbf{C}S} \* \sum\_{i=1}^{I} \mathbf{C}\_{\mathbf{C}S\_{i}}\right) + \left(\mathbf{P}\_{MV} \* \sum\_{j=1}^{J} \mathbf{C}\_{MV\_{j}}\right) + \left(\mathbf{P}\_{EV} \* \sum\_{k=1}^{K} \mathbf{C}\_{EV\_{k}}\right) \tag{3}$$

After calculating the charging cost, the next cost that needs to be calculated is the distance cost. This cost is related to the distance between the charging and discharging entities. The main objective of the vehicles is that they should be charged using their closest entities, either using the CSs, MVs, or other EVs. Equation (4) calculates the total distance cost, where *disS*2*V, disM*2*V*, and *disV*2*<sup>V</sup>* give the distance from vehicle to CS, vehicle to MV, and vehicle to EV, respectively.

$$\mathbf{C\_{2T}} = (\mathbf{P\_{CS}} \ast \mathrm{dis}\_{\mathrm{S2V}}) + (\mathbf{P\_{MV}} \ast \mathrm{dis}\_{\mathrm{M2V}}) + (\mathbf{P\_{EV}} \ast \mathrm{dis}\_{\mathrm{V2V}}) \tag{4}$$

The third cost, i.e., the waiting cost, also needs consideration. This cost is incurred when the vehicle needs to wait at the time of charging. For instance, a vehicle goes to the CS for charging. At that CS, a number of vehicles are already present for charging purposes. Therefore, this new incoming vehicle is added to the waiting queue. This is also implied even when the vehicle intends to be charged by the MV or the EV. So, for calculating this cost, the distance is calculated, and is then multiplied with the number assigned to the vehicle in the queue. This cost calculation is given in Equation (5).

$$\mathcal{C}\_{3T} = \left( (\text{dis}\_{S2V} \* \text{diff}(V, v)) \* \left( \sum\_{y=1}^{Y} V e\_y + \sum\_{z=1}^{Z} V m\_z \right) \right) \tag{5}$$

The fourth cost is the reward/penalty cost. If a certain vehicle saves some units of charge or if it generates some extra units that it can sell to other vehicles, then the particular vehicle is given some reward, and vice versa. Equation (6a), Equation (6b) show the reward and penalty calculations. In the given equations, *Q* is the price per unit, *T<sup>s</sup>* are the total units saved, and *T<sup>w</sup>* are the units wasted; *ev* and *mv* are the numbers of EVs and MVs, respectively.

$$\mathcal{C}\_{4Tr} = (Q \ast T\_s) \ast \left(\sum\_{l=1}^{L} ev\_l + \sum\_{m=1}^{M} mv\_m\right) \tag{6a}$$

$$\text{or}$$

$$\mathbf{C}\_{4Tp} = -(\mathbf{Q} \ast T\_w) \ast \left(\sum\_{l=1}^{L} ev\_l + \sum\_{m=1}^{M} mv\_m\right) \tag{6b}$$

Equations (3)–(6) are all summed up to calculate the total cost, as given in Equation (7).

$$\mathbf{C}\_{Total} = \mathbf{C}\_{1T} + \mathbf{C}\_{2T} + \mathbf{C}\_{3T} + \mathbf{C}\_{4Tr/4Tp} \tag{7}$$

#### *6.2. Objective Function*

The total charging cost is minimized using Equation (11), which is the objective function [43].

$$\min \left( \mathbb{C}\_{\text{Total}} \right) = \mathbb{C}\_{1T} + \mathbb{C}\_{2T} + \mathbb{C}\_{3T} + \mathbb{C}\_{4T} \tag{8}$$

It is subject to following constraints:

• Minimizing the EV and MV charging costs, as given in Equation (9a), Equation (9b).

$$0 \le \mathcal{C}\_{MV} \le \mathcal{C}\_{MV}^{\max} \tag{9a}$$

$$0 \le \mathcal{C}\_{EV} \le \mathcal{C}\_{EV}^{\max} \tag{9b}$$

• The other is maximizing the units saved or minimizing the units being wasted, as given in Equation (9c).

$$\max\left(T\_{\mathbf{s}}\right) \text{ or } \min\left(T\_{\mathbf{w}}\right) \tag{9c}$$

#### *6.3. Comparison of Equations*

In this subsection, the comparison between the existing equations [43] and our proposed equations is given in a tabular form. This comparison helps the reader to understand which changes have been made to the previous equations, which help in further reducing the total charging cost. Table 5 gives the comparison of Equations (3)–(9c). In the first column, the Equations used in [43] are given. The Equations used in our paper are given in the second column. In the third column, the differences between the equations are given.

#### **7. Power Flow and Associated Losses**

In the charging of EVs, efficient energy flow plays an important role. This is because EVs may pose serious economical impacts if not charged properly. The major reason behind this economic disturbance is the ultimate loss that is incurred while charging EVs [48]. This loss is further comprised of different losses that occur due to inefficiency of inverters, worn and outdated infrastructure, weather conditions, etc. These losses occur in all types of charging strategies, like V2G, V2V, and M2V. These losses not only pose economic concerns, but also lead to degradation of the lifetime of the batteries installed within the vehicles [49]. The amounts of the economic losses incurred in the V2G are the maximum, while they are minimum in M2V. The reason is because V2G uses conventional fuels for charging vehicles, whereas M2V uses RESs, due to which both the financial and the infrastructural losses are minimized. Figure 6 shows different types of losses incurred in VNs, termed Loss 1, Loss ,2 and Loss 3. Loss 1 is cable loss, which occurs due to the usage of old and worn cables. Loss 2 and Loss 3 are the losses that occur due to inverters' inefficiencies and severe weather conditions, respectively.

#### *7.1. Formulating the Associated Energy Losses*

In this subsection, the energy losses associated with the charging of vehicles are formulated along with the parameters they rely on. Equation (10) is used for calculating the Total Power Loss (*P total loss* ) incurred while charging the vehicles.

$$P\_{loss}^{total} = (L\_{cable} \* I\_l) + \overline{\eta\_{inverter}} + \omega\_r \tag{10}$$



**Figure 6.** Energy losses in Vehicular Networks (VNs).

where, *Lcable* denotes the cable length, and *I<sup>t</sup>* shows the current passing through the cable at time *t*. *ηinverter* represents the inefficiency of an inverter installed within a vehicle and *ω* denotes the weather effects on the charging process. The ranges of these parameters are given in Table 6. The value of *ηinverter* depends on the life cycle of the vehicle's battery, while the value of the weather effect coefficient *ω* depends on the effects caused by weather conditions, i.e., its value is 0 when there is no effect, while the value is 1 in the case of severe weather effects.



The objective function is formulated to minimize the *P total loss* , given in Equation (11). The objective function can be achieved using updated and efficient cables, inverters, batteries, etc., and by increasing the insulation to protect the devices against severe weather effects.

$$\text{Objective Function} = \min(P\_{\text{loss}}^{total}) \tag{11}$$

This is subject to the constraints provided in Equations (12a)–(12d).

• The length of a cable used for charging the vehicles should lie within a specific range, given in Equation (12a). If a longer cable is used, then the power losses will be greater, and vice versa [50].

$$0 < L\_{\text{cable}} \le 5m \tag{12a}$$

• The current supplied at a certain time *t* should lie within a specific range, taken from [51] and given in Equation (12b).

$$16Amp \le I\_t \le \text{32}Amp\tag{12b}$$

• The inefficiency of an inverter installed within a vehicle should not be greater than a certain limit, given in Equation (12c). There exists a direct relation between the inefficiency of an inverter and the power losses [52].

$$0 \le \overline{\eta\_{efficancy}} \le 40\% \tag{12c}$$

• The charging infrastructure should not be affected by weather conditions to a great extent. Equation (12d) gives the value of the weather effect coefficient, i.e., *ω*.

$$0 \le \omega < 1\tag{12d}$$

Moving ahead, the losses that occur in the aforementioned strategies are discussed according to case. Cases 1–3 discuss the energy losses in V2G, V2V, and M2V, respectively. The discussions of these cases, along with the mathematical equations, are given below.

• **Case 1: Energy Losses in V2G**

In this case, the losses incurred in V2G charging of vehicles are discussed. In V2G, maximum economic losses occur, while the power losses are less as compared to the V2V charging strategy. The reason for the maximal economic losses is the usage of conventional fuels in the charging stations. The power losses incurred in V2G are calculated using Equation (10).

#### • **Case 2: Energy Losses in V2V**

In V2V charging of vehicles, the maximum amount of power losses occurs. The reason is increased amount of inefficiency of the inverters [52]. Energy trading is done between two vehicles, both equipped with energy inverters; therefore, the inverter inefficiency will be squared, i.e., (*ηinverter*) 2 . Equation (13) is used to calculate the power loss incurred in V2V charging of vehicles.

$$P\_{loss}^{total} = (L\_{cable} \* I\_t) + (\overline{\eta\_{inner}})^2 + \omega \tag{13}$$

### • **Case 3: Energy Losses in M2V**

In M2V, we have the minimum amounts of both economic and power losses. The primary reason is that the Mobile Vehicles (MVs) make use of RESs to generate electricity and have the ability to store and provide the surplus amount of energy to other EVs. The power loss incurred in the M2V charging strategy is calculated using Equation (13).

#### **8. Incentive Provisioning**

In the proposed model, the EVs with high message credibility and good timely responses are given reputation and incentives to motivate them further. On the other hand, the EVs that act maliciously or that have low message credibility are penalized. The degree of the penalty is more than the degree of reward given to the vehicles to restrict them from acting maliciously or selfishly. The reputation and incentives are provided on the basis of the following two conditions.


The vehicles delivering authentic messages are given a reputation value of +1 and are awarded with \$1 as an incentive, whereas the vehicles broadcasting fake messages are given a reputation value of −1 and penalized \$1.5. At the beginning, all vehicles are given equal reputation values. The vehicles that continuously broadcast fake messages are finally blacklisted after their reputation value reaches −1. Figure 7 shows the flowchart of the rewards and penalties incurred by the vehicles.

**Figure 7.** Flowchart of rewards/penalties incurred by vehicles.

#### **9. Results and Discussion**

This section covers the simulation results and their discussion.

#### *9.1. Simulation Environment*

The simulations are performed in two different environments: Solidity in Visual Studio Code and RemixIDE. Solidity is used for writing smart contracts and is provided by Ethereum. The connectivity of smart contracts with the web interface is done using MetaMask. To log into MetaMask, accounts with digital currency are required. These accounts are provided by Ganache. The smart contracts cover the registration of the vehicles and the nature of the requests being made: Requests accepted and requests denied. In the later stage, the charging schedule was done in Spyder (Python 3.6 package), provided by Anaconda. These simulations were performed on HP 450G ProBook with a 1 TB hard drive and 8 GB RAM.

#### *9.2. Simulation Parameters*

Table 7 shows the average values of different simulation parameters that were used in the proposed work. These values are taken from the Electric Vehicle Database [46].


**Table 7.** Simulation parameters.

Initially, when the smart contract was made and deployed, the transaction and execution costs were calculated. These costs are calculated in terms of 'gas'. Table 8 shows the values of Ether and its multipliers. These values are taken from [53].


**Table 8.** Values of Ether and its multipliers.

Figure 8 shows the transaction and execution costs in terms of gas for five different functions. These are some of the functions used in the smart contract deployed for vehicles' registration and charging scheduling. It is seen that the function "EV registration" incurs the highest gas consumption, as it is the major function that assigns details to all new EVs added to the system. Similar behavior is observed for "MV registration", the function designed to add new MVs to the network. The transaction costs are always higher than the execution costs because the former costs are linked with the deployment of the contract, whereas the latter costs are incurred while executing a specific function.

Figure 9 shows the comparison between the time taken to store the redundant information and the time taken to store the filtered information in the TSIU. A vivid difference is seen in the aforementioned times. Along with time reduction, the storage burden on the TSIU is also decreased. The data with more than the predefined number of entities, i.e., ID of the vehicle, location of the vehicle, time of reporting, and nature of the event that occurred are discarded, as more data entities will increase the storage burden on the TSIU.

Figure 10 shows the cost comparison between the transaction cost and the execution cost when a vehicle uploads the weather information and road information to the TSIU. The graph shows the gas consumption for five different functions, which are included in the smart contract. It is seen that the gas consumptions of *add weather file* and *add road file* are greater in comparison with other functions. The reason is that these files consist of all of the weather-related information and the road-related information.

**Figure 8.** Gas consumption for EV registration and charging schedule.

**Figure 9.** Storage time comparison of redundant and filtered data.

**Figure 10.** Gas consumption for the IPFS.

Figure 11 shows the average payments and rewards of the charging and discharging EVs. A comparison was done between the existing techniques and the proposed techniques. This graph was motivated by [54]. The graph shows that the costs are reduced as compared to the existing work due to the scheduling algorithm proposed in this paper. The graph also shows that the convergence rate for both the payments of charging EVs and rewards of discharging EVs are fast in comparison with the existing techniques.

Figure 12 shows the charging price and the traveling price of G2V, V2V, and M2V. It is observed that both the charging price and the traveling price are less for the proposed technique, i.e., M2V. This is because, when charging through the CSs, waiting cost and distance cost are also incurred by the vehicles. On the other hand, charging through the EVs incurs the distance cost along with the charging cost of the EVs through CSs. MVs, on the other hand, have lower charging costs because they are equipped with batteries and are self-charged. So, the major cost that exists in M2V is the distance cost. Figure 12 shows the increasing trend with the increasing number of vehicles. The traveling cost consists of fuel costs, maintenance costs, etc.

The time taken by the EVs to be charged is shown in Figure 13. In the figure, real-time data of four different EVs are used, as given in Table 4 in Section 5.3. The charging time is calculated using Equation (2). It is observed from the figure that the time taken to charge the Nissan Leaf is the maximum, as it has the slowest charging speed of all of the vehicles. All EVs are charged using Type-2 chargers, which allow the vehicles to be charged both from single-phase and three-phase main supplies.

**Figure 12.** Cost comparison of different scenarios.

**Figure 13.** Charging times taken by EVs.

Figure 14 shows the time taken by four different vehicles to cover the distance to the nearest charging entities. For this time calculation, real-time data of four different EVs are used, which are given in Table 4 in Section 5.3. This time is calculated using Equation (1).

**Figure 14.** Time taken by EVs to traverse the distance to the nearest charging entity.

The real-time power losses incurred in all three charging strategies, i.e., V2G, V2V, and M2V are shown in Figures 15–18. The comparison of cable losses incurred in the aforementioned charging strategies is shown in Figure 15. It is observed that the cable loss incurred in V2G is the maximum because it also includes the transformer loss along with other losses, like copper loss, hysteresis loss, etc.

**Figure 15.** Cable losses incurred.

Figure 16 shows the comparison between the inverter losses of V2G, V2V, and M2V. It is seen that the inverter losses are the greatest for both V2G and M2V because, in these strategies, two inverters are involved simultaneously, which means that the inverters' inefficiencies will be squared.

Moving on, the third type of loss incurred in vehicle charging is due to the effects caused by weather conditions. The comparison between these losses is given in Figure 17. It is observed that the weather losses are the most in V2G because it also involves the weather effects on other devices, such as transformers, circuit breakers, etc.

In Figure 18, the combined losses for the three different strategies are given. The total combined loss involves the cable loss, inverter loss, and loss caused by sever weather effects. It can be seen that V2V has the maximum amount of incurred losses, mainly due to the increase in inefficiency of the inverters.

Figure 19 shows the participation rates of users with the increase in the reputation values, which in turn increases the amount of incentives awarded. These reputation values are given on the basis of timely responses of credible messages. In accordance with these, monetary incentives are given. On the contrary, the incentives are converted into penalties upon false reputation values and are deducted from users' wallets. The amount of the penalty charged is more than the incentive given to users. This difference in amount restricts the users from acting maliciously.

Figures 20 and 21 show the number of hashes generated and the mining time for the transactions performed against different difficulty levels. It is observed that both the number of hashes generated and the mining time taken increase with the increase in difficulty level. Difficulty is defined as the measure of the complexity for miners to find a hash or a signature for a block in the network. The hash is generated using random numbers. The number of zeros that a signature requires initially determines the difficulty level. The formula for calculating difficulty is given in Equation (14), taken from [55].

$$\text{(difficulty} = \frac{\text{Hash\ target}\_{(genissible)}}{\text{Hash\ target}\_{(current\block)}} \tag{14}$$

where the target is a 256 bit number. The hash target becomes smaller and smaller, thereby making the difficulty greater.

**Figure 16.** Inverter losses incurred.

**Figure 17.** Weather losses incurred.

**Figure 18.** Combined losses incurred.

**Figure 19.** Users' participation versus reputation values.

**Figure 20.** Hashes generated for different transactions.

**Figure 21.** Mining time for different transactions.

Table 9 gives an abstract view of the simulation results given above and maps them with the limitations that they tackle. The limitations identified in Figure 1 and further mentioned in Table 3 are given in Table 9 along with the proposed solutions that are given in Table 3. In the fourth column of Table 9, the validation results are presented and mapped with the identified limitations.


**Table 9.** Mapping of problems with validation results.

Table 10 gives the values of the public key and the private key generated for 10 different vehicles. The public key is open to all the participants of the network, whereas the private key is used only by a specific participant and also for digitally signing the transactions. Table 11 gives all the important details related to the contract creation phase. It is seen that both the execution cost and the transaction cost of contract creation are the greatest because they cover all the functions involved in the smart contract.

Tables 12 and 13 give the details related to the EV and MV registration in the proposed blockchain network. Whenever a new vehicle wants to join the network, it first has to register itself through a central entity. For registration purposes, information consisting of different aspects of a vehicle is required, such as ID, model, make, etc. Moreover, Tables 14 and 15 show the details associated with the scheduling of the energy in the future. Initially, the energy of the current time slot is calculated.

Then, the energy requirement for the next time slot is calculated; finally, energy is scheduled as per the requirements. Table 16 gives the values for the mining time and number of hashes generated against different difficulty levels in tabular form. In the table, difficulty level is abbreviated as 'Diff. level'. Diff. level 1 is not addressed because it performs transactions in a very short time as compared to other difficulty levels. Difficulty is encountered when mining is performed using PoW. The mining becomes difficult with the increase in the difficulty level. This table makes the comparison between different difficulty levels easy to understand.


**Table 10.** Keys generated for digital signatures.


**Table 11.** Contract creation.




**Table 13.** MV registration.

**Table 14.** Getting the energy requirements.


**Table 15.** Energy requirement for the next schedule.



**Table 16.** Mining time and hashes generated against different difficulty levels.

Figure 22 shows the output results when a weather information file is added to the IPFS according to the conditions set in the smart contract. Similarly, Figure 23 shows the output when the IPFS assigns a malicious state to a vehicle, denies the file retrieval request, and considers it a malicious request. Figure 24 shows the output results when a user inquires about the total number of files stored already in the IPFS and retrieves the ID of a specific file from the IPFS. Similar outputs are obtained when a road information file is added to the IPFS.

**Figure 22.** Adding a weather information file to the IPFS.

**Figure 23.** Assigning a malicious state to a vehicle by the IPFS.


**Figure 24.** Getting file count and file ID from the IPFS.

#### **10. Conclusion and Future Work**

In this paper, the vehicles communicate with each other in a P2P manner for data sharing and energy trading. For an efficient charging schedule of the vehicles, new algorithms are proposed. Using the scheduling algorithm, an efficient cost reduction is observed. The proposed work uses blockchain technology for vehicles' registration and also for ensuring the immutability, security, and tamper proof-nature of the data. In the proposed work, the PoW consensus mechanism is used to achieve consensus between nodes, which makes the entire system trustworthy. The data generated by the vehicles are important entities and are stored in the TSIU after filtration.

Moreover, the shortest distance between an EV and the nearest charging entity is calculated using the Great-Circle Distance formula. The time taken by the EVs to cover this distance and the time taken to charge are also calculated in this work. Moving ahead, user participation is increased by awarding the users with incentives based upon their reputation and also by providing them with location privacy. The locations of vehicles are encrypted using the AES128 encryption technique. The power flow and the associated energy losses are also presented in this work. The mathematical formulation guarantees that all possible costs are calculated and the total charging cost is reduced. The proposed vehicle charging scenario, i.e., M2V, is compared with the existing scenarios, i.e., G2V and V2V, and the results are shown in the simulation section. Furthermore, the simulation results show that the charging cost incurred using M2V is 20%–25% less than in V2V and 35%–40% less than in G2V. It is also observed that the time required to store the data in TSIU is almost 45%–50% less for filtered data in comparison with original data, which reduces the storage complexity. Besides the positive aspects of the proposed system, it still has some limitations. For example, PoW is used in the proposed system, which has the major limitation of being computationally resource-expensive.

In the future, PoW will be replaced with a better consensus mechanism to deal with the issue of excessive resource utilization. Moreover, AES128 will be replaced by a better encryption technique to enhance privacy provisioning.

**Author Contributions:** M.U.J. and N.J. proposed and implemented the main idea, M.U.J. and M.R. performed the simulations and wrote the simulations section, N.J., A.A., and M.T. organized and refined the manuscript, and M.U.J. and N.J. worked together and responded to the respected reviewers' comments. Supervision, N.A. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by Deanship of Scientific Research, King Saud University, through the Vice Deanship of Scientific Research.

**Acknowledgments:** The authors are grateful to the Deanship of Scientific Research, King Saud University, KSA for funding through the Vice Deanship of Scientific Research Chairs.

**Conflicts of Interest:** The authors declare no conflicts of interest.

## **Abbreviations**

The following abbreviations are used in this paper:



### **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## *Article* **Blockchain of Carbon Trading for UN Sustainable Development Goals**

**Seong-Kyu Kim <sup>1</sup> and Jun-Ho Huh 2,\***


Received: 14 March 2020; Accepted: 10 May 2020; Published: 14 May 2020

**Abstract:** Carbon credits should reduce the environmental pollution and carbon emission of the Earth in the future. The market for carbon credits will become a critical issue from 2021, and carbon credits will be applied to systems where individuals can trade. In order for these carbon credits to be traded between individuals, however, a corresponding exchange of carbon credits is needed. Policies, strategies, and technologies are also necessary to measure the trading of carbon credits. This paper aims at making transactions more reliable by applying blockchain technology to measure carbon emission rights. It uses blockchain to verify carbon emissions rights among the UN-SDGs' (United Nations Sustainable Development Goals') 17 tasks. In addition, it introduces the necessary dApp. In fact, we can protect against carbon emissions anomalies by using big data and artificial intelligence in mobile cloud environments. Thus, this paper proposes a blockchain-based carbon emission rights verification system to learn proven data further by using the governance system analysis and blockchain mainnet engine to solve these problems.

**Keywords:** blockchain; artificial intelligence; information security; UN sustainable development goals; UN SDGs; carbon trading; dApp

### **1. Introduction**

The Kyoto Protocol is a market-based mechanism that formed the framework of the international climate change response system, as described by the United Nations, to ease the burden of cost of greenhouse gas reduction activities by the mandatory reduction bureau. The Kyoto Method consists of carbon emissions trading (ET), a clean development mechanism (CDM), and a joint implementation system (JI); in particular, carbon emission trading (emissions trading) refers to the market wherein greenhouse gas emission rights (emissions trading) are acquired. Where carbon emission rights cover allocations and credits 1), quotas refer to greenhouse gas emission rights paid to major greenhouse gas sources, such as power generation facilities or production facilities, and credits pertain to unit-to-consumption business projects projected for external greenhouse gas reduction projects (BAU-U, BAS-US, etc.). Meanwhile, "market" means that the price of carbon credits is determined by the demand and supply of carbon credits in the market instead of being fixed by policy. This is done in a way that reflects the costs of producing goods or services as the environmental and social costs of climate change [1].

This is in contrast to the carbon tax, wherein the size is determined. According to the World Bank's tally, the carbon emission trading market reached about 10.9 billion USD in 2005 when the Kyoto Protocol took effect and continued to grow at an annual rate of 108%, growing to 143.7 billion USD in 2009. Meanwhile, the growth of the carbon emission trading market slowed down a bit in 2009 when economic activity shrank in the wake of the global financial crisis. Based on the recovery outlook for the global economy, however, the global carbon emission trading market is expected to

reach about 669 billion USD in 2013, according to a report. The carbon emission trading market can be classified in various ways. First, depending on the nature of the carbon emission rights, it can be largely classified as a quota market and a credit market. As shown in Figure 1, Retail allows users to buy and sell goods, energy, etc. using Carbon Impact. In addition, Back-End signed an electronic contract for Carbon Credit, which is a smart contract that is generated by UserProfile, and can use trading rights for carbon transactions in all mobile apps, called Ecosystem. Credit markets are often referred to as project-based markets, which, in turn, can be divided into primary markets and secondary markets. On the other hand, depending on the way the transaction is made, the carbon emission trading market can be classified into OTC (Over-the-Counter) markets and in-house markets. These carbon credits translate into more and more transactions, and they are divided into 17 important subdivisions in the future SDGs (Sustainable Development Goals) at the United Nations. To recognize these carbon credits, carbon credits are accurately measured using non-modifiable blockchain technology and, by extension, proposed by the UN's (United Nations) SDGs as the environmental factors referred to by the UN's SDGs [2]. reach about 669 billion USD in 2013, according to a report. The carbon emission trading market can be classified in various ways. First, depending on the nature of the carbon emission rights, it can be largely classified as a quota market and a credit market. As shown in Figure 1, Retail allows users to buy and sell goods, energy, etc. using Carbon Impact. In addition, Back-End signed an electronic contract for Carbon Credit, which is a smart contract that is generated by UserProfile, and can use trading rights for carbon transactions in all mobile apps, called Ecosystem. Credit markets are often referred to as project-based markets, which, in turn, can be divided into primary markets and secondary markets. On the other hand, depending on the way the transaction is made, the carbon emission trading market can be classified into OTC (Over-the-Counter) markets and in-house markets. These carbon credits translate into more and more transactions, and they are divided into 17 important subdivisions in the future SDGs (Sustainable Development Goals) at the United Nations. To recognize these carbon credits, carbon credits are accurately measured using nonmodifiable blockchain technology and, by extension, proposed by the UN's (United Nations) SDGs as the environmental factors referred to by the UN's SDGs [2].

outlook for the global economy, however, the global carbon emission trading market is expected to

**Figure 1.** Smart renewable energy and P2P (Peer-to-Peer) blockchain service. **Figure 1.** Smart renewable energy and P2P (Peer-to-Peer) blockchain service.

The reason is that the governance system is applied to the carbon credits based on the accuracy of blockchain according to its stability, decentralization, and reliability. To overcome these problems, a hybrid blockchain is proposed. In addition, we use blockchain to verify carbon emission rights in our efforts to manage energy [3]. These efforts are taken a little further in the verification system for blockchain. Therefore, in order to prevent hacking and strengthen security vulnerabilities, the available blockchain network protocol will be applied and changed to the appropriate blockchain network protocol for the greenhouse gas comprehensive information center. In addition, this study provides a scope for the purpose of verifying carbon emission rights using blockchain to conduct transactions between individuals and for the performance of trading of carbon emission rights. The method also aims to instantiate blockchain performance data, Transactions per Second (TPS), and to The reason is that the governance system is applied to the carbon credits based on the accuracy of blockchain according to its stability, decentralization, and reliability. To overcome these problems, a hybrid blockchain is proposed. In addition, we use blockchain to verify carbon emission rights in our efforts to manage energy [3]. These efforts are taken a little further in the verification system for blockchain. Therefore, in order to prevent hacking and strengthen security vulnerabilities, the available blockchain network protocol will be applied and changed to the appropriate blockchain network protocol for the greenhouse gas comprehensive information center. In addition, this study provides a scope for the purpose of verifying carbon emission rights using blockchain to conduct transactions between individuals and for the performance of trading of carbon emission rights. The method also aims to instantiate blockchain performance data, Transactions per Second (TPS), and to ensure the transparency and integrity of carbon credits for future P2P (Peer-to-Peer) transactions.

ensure the transparency and integrity of carbon credits for future P2P (Peer-to-Peer) transactions. Section 1 discusses the problems of carbon emissions in the UN-SDGs and the artificial intelligence blockchain for verifying the trading rights when future carbon emissions are traded between individuals. When we introduce this blockchain, we talk about the important consensus algorithm. Section 2 presents directions on how to apply blockchain in the UN-SDGs from realized Section 1 discusses the problems of carbon emissions in the UN-SDGs and the artificial intelligence blockchain for verifying the trading rights when future carbon emissions are traded between individuals. When we introduce this blockchain, we talk about the important consensus algorithm. Section 2 presents directions on how to apply blockchain in the UN-SDGs from realized work, and specifically

discusses Information Technology (IT) application and blockchain application for carbon credits and renewable energy. Section 3 describes the UN SDGs' Performance and Blockchain Algorithms for Design and Implementation. Section 4 shows configurations for performance comparison. The actual performance comparison shows 15,000 TPS. Section 5 discusses the direction of future research and current problems. Section 6 concludes with a conclusion on the study of the application of blockchain carbon credits.

#### **2. Background Knowledge**

Studies related to blockchains and energy trading have been conducted by several researchers. M. Andoni et al. published their research work titled "Blockchain Technology in the Energy Sector: A Systematic Review of Challenges and Opportunities," whereas S. Wang et al. came up with "Energy Crowdsourcing and Peer-to-Peer Energy Trading in Blockchain-Enabled Smart Grids." F. Luo et al. and K. Gai et al. also released "A Distributed Electricity Trading System in Active Distribution Networks Based on Multi-Agent Coalition and Blockchain" and "Privacy-Preserving Energy Trading Using Consortium Blockchain in Smart Grid," respectively [4–6].

#### *2.1. Carbon Emission*

A certified emission reduction (CER; certification reduction or public certification reduction) refers to a confirmation made by the UN that a Clean Development System (CDM) project reduced greenhouse gas emissions. These carbon credits can be traded on the market through the emission trading system. If advanced countries go to developing countries for greenhouse gas reduction projects, the UN will examine and assess them and give them a certain amount of carbon emission rights. This greenhouse gas reduction project is called the Clean Development System (CDM) project. Not only advanced countries, but also developing countries themselves can carry out CDM projects to acquire carbon emission rights, which the Republic of Korea does. This refers to companies in each country that have failed to reduce carbon dioxide (CO2) emissions within a set period of time, paying money to buy rights from businesses that have been able to afford emissions or grow forests. Under the Kyoto Protocol, parties were required to reduce their carbon dioxide emissions by an average of 132% from 2008 to 2012, based on the 1990 emissions [7]. Countries that have succeeded in reducing their emissions have been allowed to buy and sell the corresponding carbon credits. In other words, petrochemical companies and other companies emitting a lot of carbon dioxide must reduce their carbon dioxide emissions themselves or buy rights from forest land owners in countries with low emissions. The Republic of Korea introduced such carbon emission rights from 2015 to 2018 (see Figure 2). *Sustainability* **2020**, *xx*, x FOR PEER REVIEW 4 of 32 accounted for 81%, 3%, and 15%, respectively, with 1.4231 trillion KRW; KCU accounted for 54 billion KRW and KOC for 270.6 billion KRW, while the total transaction amount in the market and over-thecounter trading market was 781 billion KRW and 966.7 billion KRW, respectively, representing 45% and 55% of the share, similar to the share of the trading volume [8].

**Figure 2.** Growth rate of carbon emissions [8]. **Figure 2.** Growth rate of carbon emissions [8].

Carbon emission credits refer to the right to emit greenhouse gases, one of the substances giving the Earth's environment a load. When humans emit carbon dioxide (CO2), nature absorbs it and keeps the CO2 concentration in the atmosphere at a certain level; when the emission exceeds Earth's In addition, the total volume of emissions traded in both in-house and over-the-counter transactions during the branch line result period (2015.1–2018.8) was 86.2 million tons, with 37.5 million tons and 48.7 million tons traded in disability and over-the-counter transactions, accounting for 44% and 56%,

which took effect in 2005 by giving companies the right to emit greenhouse gases only at a manageable level, is set at 41.8 billion tons, or about 5.2% less greenhouse gas emissions from developed countries. The Emission Trading Scheme is a system that uses the advantages of the market mechanism to reduce greenhouse gases to maximize social costs, and the emission trading system is expanding worldwide, including in Korea, allowing companies to trade their remaining or

**Figure 3.** Trend of carbon dioxide (CO2) emissions related to global energy. Source: Korean Government; "Second National General Management Plan for Greenhouse Gas Statistics (2020–

Blockchain technology is considered to be a suitable technology for implementing an emission trading platform that enhances the efficiency, security, and transparency of transactions, since it enables the establishment of multiple trust networks among stakeholders without the need for a

In particular, the effective linkage of emission markets operating in different countries/regions requires the use of blockchain technologies that implement global networks involving multiple

insufficient emission allowances freely [10,11].

2024)"; KEA Brief Issues of Energy, 2018 [8].

Trusted Third Party.

respectively. By emission rights, 66.6 million tons of Korean Allowance Units (KAU), 3.4 million tons of Korean Credit Unit (KCU), and 16.2 million tons of Korean Offset Credit (KOC) were traded, representing 77%, 4%, and 19% of the total. The total volume of transactions per year increased by 208%, 246%, and 134% year-on-year to 5.7 million tons in 2015, 11.9 million tons in 2016, 29.3 million tons in 2017, and 39.2 million tons in 2018, and the last year was similar to 2018, reflecting only the performance of transactions in the first half of the year. In addition, during the same period, the average price increased by 156%, 122%, and 106% year-on-year to 17,1799 KRW in 2016, 20,897 KRW in 2017, and 22,127 KRW in 2018, ending with a double increase compared to the initial average price in 2015. The average transaction price for the entire trading period was 20,279 KRW. In addition, by emission rights, KAU was traded at 15,767 KRW, KOC was 16,703 KRW, and KAU was traded at a relatively higher price than other emission rights, and the market price was slightly higher than the over-the-counter price. Continued increases in transaction prices and expansion of trading volume also affected transaction payments, rising 324%, 333%, and 142% year-on-year to 204.4 billion KRW in 2016, 612.3 billion KRW in 2017, and 868 billion KRW in 2018 from 63.1 trillion KRW in 2015; combined, the total transaction amount was 1.7477 trillion KRW. KAU accounted for 81%, 3%, and 15%, respectively, with 1.4231 trillion KRW; KCU accounted for 54 billion KRW and KOC for 270.6 billion KRW, while the total transaction amount in the market and over-the-counter trading market was 781 billion KRW and 966.7 billion KRW, respectively, representing 45% and 55% of the share, similar to the share of the trading volume [8]. accounted for 81%, 3%, and 15%, respectively, with 1.4231 trillion KRW; KCU accounted for 54 billion KRW and KOC for 270.6 billion KRW, while the total transaction amount in the market and over-thecounter trading market was 781 billion KRW and 966.7 billion KRW, respectively, representing 45% and 55% of the share, similar to the share of the trading volume [8]. **Figure 2.** Growth rate of carbon emissions [8]. Carbon emission credits refer to the right to emit greenhouse gases, one of the substances giving

*Sustainability* **2020**, *xx*, x FOR PEER REVIEW 4 of 32

Carbon emission credits refer to the right to emit greenhouse gases, one of the substances giving the Earth's environment a load. When humans emit carbon dioxide (CO2), nature absorbs it and keeps the CO2 concentration in the atmosphere at a certain level; when the emission exceeds Earth's own capacity to conserve the environment, however, CO2 concentration increases gradually, resulting in global warming and climate change. Global CO2 emissions rose 1.4% (4.6 billion tons) year-on-year to 32.5 billion tons in 2017 from 32.5 billion tons (see Figure 3) [9]. Kyoto Protocol 2, which took effect in 2005 by giving companies the right to emit greenhouse gases only at a manageable level, is set at 41.8 billion tons, or about 5.2% less greenhouse gas emissions from developed countries. The Emission Trading Scheme is a system that uses the advantages of the market mechanism to reduce greenhouse gases to maximize social costs, and the emission trading system is expanding worldwide, including in Korea, allowing companies to trade their remaining or insufficient emission allowances freely [10,11]. the Earth's environment a load. When humans emit carbon dioxide (CO2), nature absorbs it and keeps the CO2 concentration in the atmosphere at a certain level; when the emission exceeds Earth's own capacity to conserve the environment, however, CO2 concentration increases gradually, resulting in global warming and climate change. Global CO2 emissions rose 1.4% (4.6 billion tons) year-on-year to 32.5 billion tons in 2017 from 32.5 billion tons (see Figure 3) [9]. Kyoto Protocol 2, which took effect in 2005 by giving companies the right to emit greenhouse gases only at a manageable level, is set at 41.8 billion tons, or about 5.2% less greenhouse gas emissions from developed countries. The Emission Trading Scheme is a system that uses the advantages of the market mechanism to reduce greenhouse gases to maximize social costs, and the emission trading system is expanding worldwide, including in Korea, allowing companies to trade their remaining or insufficient emission allowances freely [10,11].

**Figure 3.** Trend of carbon dioxide (CO2) emissions related to global energy. Source: Korean Government; "Second National General Management Plan for Greenhouse Gas Statistics (2020– 2024)"; KEA Brief Issues of Energy, 2018 [8]. **Figure 3.** Trend of carbon dioxide (CO2) emissions related to global energy. Source: Korean Government; "Second National General Management Plan for Greenhouse Gas Statistics (2020–2024)"; KEA Brief Issues of Energy, 2018 [8].

Blockchain technology is considered to be a suitable technology for implementing an emission trading platform that enhances the efficiency, security, and transparency of transactions, since it enables the establishment of multiple trust networks among stakeholders without the need for a Trusted Third Party. Blockchain technology is considered to be a suitable technology for implementing an emission trading platform that enhances the efficiency, security, and transparency of transactions, since it enables the establishment of multiple trust networks among stakeholders without the need for a Trusted Third Party.

In particular, the effective linkage of emission markets operating in different countries/regions

In particular, the effective linkage of emission markets operating in different countries/regions requires the use of blockchain technologies that implement global networks involving multiple members without the need for centralized management. In addition, the climate change response system is changing from the top-down method of allocating greenhouse gas emission rights to developed countries only to the bottom-up formula of self-determination of national reduction targets and methods involving both developed and developing countries. This is a common task of reducing greenhouse gas emissions by establishing a blockchain-based platform wherein the majority of countries around the world participate as members to trade emission rights on their own and jointly verify, record, and store them.

Using this decentralized blockchain technology, the information and transmission details of carbon emission rights can be utilized to incorporate the technologies of blockchain and have safer transactions. In the future, carbon credits are expected to be traded using personal communication in P2P. In the EU (European Union), individuals buy and sell carbon credits. To ensure the safe trade of these carbon credits, we suggest a methodology applied with blockchain technology [12,13].

#### *2.2. UN Sustainable Development Goals*

The Sustainable Development Goals (SDGs), as the agenda that the 70th UN General Assembly held in 2015 resolved to achieve by 2030, are 17 shared goals for realizing the ideology of sustainable development. The 2030 Sustainable Development Goals (SDGs), together with the slogan "Leave no one behind," consist of 17 goals and 169 detailed goals for humanity in five areas: Human, earth, prosperity, peace, and partnership [14,15]. In 2015, the expiration of the MDGs' (Millennium Development Goals) implementation target deadline required governments to continue their efforts to achieve their goals and address new issues. Over the past 15 years, the United Nations has been discussing what the global priorities should be. At the Rio+20 meeting in June 2012, we agreed on the post-2015 global development system and came up with 17 new goals or global priorities: Sustainable Development Goals (SDGs) [16].

The MDGs were applied to all countries in principle; in practice, however, the goal was focused on developing countries. SDGs call for all countries, including developed, developing, and underdeveloped, to work toward the prosperity of humankind and to protect the environment. The MDGs were a useful development agenda but had too narrow of a target range, whereas the SDGs are even more comprehensive. The Sustainable Development Goals (SDGs) are flexible in a variety of national situations, allowing countries to select and measure detailed goals and indicators within their most relevant objectives. Even now, countries around the world are making great efforts to implement the Sustainable Development Goals (SDGs). Korea in particular is implementing individual UN-SDGs through government policies and related laws, such as the Framework Act on Sustainable Development, Framework Act on Low-Carbon Green Growth, and Framework Act on International Development and Cooperation [17].

#### 2.2.1. Clean Energy

Energy is the core of the major challenges and opportunities facing the world today. Energy use is essential for jobs, security, climate change, food production, or income growth. Trying to achieve this goal is particularly important because it is linked to other sustainability goals. Focusing on the generalization and efficiency of energy, the increasing use of renewable energy through new economies and job creation will help create sustainable and inclusive communities and address environmental issues such as climate change. Currently, three billion people are at risk of air pollution due to the inability to use clean cooking utensils. Likewise, less than a billion people live without electricity, and 50% of them are found in sub-Saharan Africa. Fortunately, over the past decade, there has been great progress in the use of hydroelectric, solar, and wind power, and energy use per unit of GDP has decreased. Nonetheless, the challenges at hand have not yet been resolved. We need greater access to clean fuel and technology, and more progress needs to be made to integrate renewable energy into the

final energy of buildings, transportation, and industry. Public and private investments in energy need to be increased, with focus on regulatory regimes and innovative business models to change the global energy system [18].

### 2.2.2. Response to Climate Change

Climate change is now affecting all countries across the continent. It is disrupting the national economy, affecting life, and causing great losses to humanity, communities, and countries today and in the future. Weather patterns are changing, sea levels are rising, climate change is frequent, and greenhouse gas emissions are now at their highest levels. If no action is taken, sea level temperatures are expected to rise above an average of three degrees this century. This has the most effect on the poor and vulnerable. By seeking economic and scalable solutions, the nation can become a cleaner and more resilient economy. The pace of change is accelerating as more people seek ways to use renewable energy and reduce and adapt to greenhouse gas emissions. However, climate change is a transnational global challenge. We need an international level of improvement to help developing countries move toward a low-carbon economy. To strengthen the international response to the threat of climate change, countries adopted the Paris Convention at the Conference of Parties to the United Nations Framework Convention on Climate Change (COP 21), which took effect in November 2016. Under the agreement, all countries agreed to limit the Earth's temperature rise to less than two degrees Celsius. In April 2018, 175 countries ratified the Paris Agreement, and 10 developing countries submitted their first national response plans to combat climate change.

### 2.2.3. Poverty Eradication

The global poverty rate has been halved since 2000, but one in 10 developing countries still lives below the 1.9 USD-a-day international poverty line, and there are millions of people making less than a day's living expenses. Despite outstanding progress in East Asia and Southeast Asia, 42% of sub-Saharan Africa's population is still suffering from extreme poverty. Poverty means more than just a lack of income and resources to ensure a sustainable livelihood. These include hunger and malnutrition, restrictions on education and living services, social discrimination and exclusion, and restrictions on decision-making participation. Economic development must have a comprehensive goal to provide sustainable jobs and improve the structures of inequality. Social protection needs support to alleviate the suffering of countries at risk of disaster and to overcome economic crises, and these systems will help strengthen the responsiveness of those suffering from unexpected cost losses in the event of disaster and, ultimately, end extreme poverty in areas of absolute poverty.

### 2.2.4. Famine Species

It is time to rethink how we grow, distribute, and consume food. If done properly, agriculture, forestry, and fishing can provide everyone with nutritious food, generate a significant level of income, and, at the same time, support people-centered rural development and protect the environment. Now, biodiversity is rapidly decreasing due to damage to soil, fresh water, sea, and forests. Climate change is having a devastating effect on the resources we depend on, and it is increasing the risk of disasters, such as drought and flooding. Many farmers are no longer able to make ends meet on their land and have to move to cities to find opportunities, and poor food security causes serious undernourishment, hurting the growth of millions of children or shortening their lifespan. The world's undernourished population is expected to be 815 million, and an additional 2 billion by 2050, which requires fundamental changes in the world's food and agriculture systems. Investment in agriculture is essential to the development of agricultural productivity, and sustainable food production systems are necessary to reduce the risk of malnutrition.

#### 2.2.5. Health and Well-Being

Ensuring a healthy life for all ages and promoting welfare are essential to sustainable development. While significant progress has been made, including increasing human life expectancy and decreasing infant and pregnant women's death rates, a professional improvement in the delivery system is needed to reduce the death rate of fewer than 70 children per 100,000 people by 2030. In order to achieve the goal of reducing early death rates from non-inflammatory diseases by one-third by 2030, efficient techniques are encouraged, such as the use of clean oils in cooking, and training on the dangers of cigarettes is needed. It also takes a lot of effort to eradicate a variety of diseases and to address the ongoing health problems. By focusing on providing effective funding for healthcare systems, improving sanitation, increasing access to medical services, and providing information on preventing environmental pollution, we can make great strides in saving millions of lives.

#### 2.2.6. Quality Education

Quality education is the foundation for sustainable development. In addition to improving the quality of life, providing comprehensive education also helps local people have the creative thinking they need to find innovative solutions to international issues. Currently, more than 265 million children have dropped out of school, and 22% of them are only elementary school students. In addition, even children who go to school lack basic skills, such as reading and calculating. Over the past decade, efforts have been made to increase access to full-course education and to increase women's school enrollment. The eradication of basic illiteracy has increased dramatically, but more effort is needed to achieve universal educational goals and progress. For example, while the equality of primary education between men and women has been achieved, few countries have achieved that goal in the whole course of education. The reason for the lack of quality education is linked to capital issues, such as the lack of trained teachers, poor school facilities, and relatively poor opportunities for rural children. In order to provide quality education to children from poor families, we need to invest in educational scholarships, teacher training workshops, school building and water quality improvement, and school electrical facilities.

#### 2.2.7. Gender Equality

While the Millennium Development Goals (including achieving universal primary education, MDGs) have made progress in gender equality and women's rights and interests, women and girls continue to suffer discrimination and violence throughout the world. Gender equality is not only a basic human right, but a necessary foundation for a sustainable world that pursues peace and prosperity. One in five women between the ages of 15 and 49 stated that they had been victimized by an intimate partner within 12 months of the survey date, and 49 countries currently do not have laws to protect women from domestic violence. Over the past decade, child marriages have been on the decline and progress has been made, with the harmful practice of female genital resection (female circumcision) decreasing by 30%, but more intensive efforts are needed to eradicate this practice. Providing women and girls with education, health care, quality jobs, and increasing their participation in the political and economic decision-making process will bring overall benefits to the sustainable economy, society, and humanity. Therefore, establishing a new legal system for equality of women in the workplace and eradicating harmful practices against women is critical to ending gender discrimination in many countries around the world.

#### *2.3. Blockchain*

Blockchain is a distributed computing technology-based data tampering prevention technology. This is a technology that stores managed data in a distributed data storage environment called a "block", where small data are linked in chain form based on the P2P method, so that no one can arbitrarily modify it and anyone can access the results of the change. The block also records all transactions that

were propagated to users prior to the discovery of the block, which is sent equally to all users in a P2P manner, so that the transaction details cannot be modified or omitted arbitrarily. Blocks have links to the date they were found and previous blocks; a collection of these blocks is called a blockchain [18–21].

Simply put, it is a technique that merely sets a bunch of records together. Unlike keeping transaction records on a central server when trading e-money in the past, blockchain shows the transaction records to all users and compares them to prevent forgery. As shown by Bitcoin's initial demonstration of the concept of blockchain and Ethereum's initial implementation of the concept of smart transport, there is a close relationship between blockchain and cryptocurrency. Still, blockchain is not a technology that can be used for cryptocurrency only. Cryptocurrency is said to be subordinate to blockchain.

Thus, technologies or services that have already applied blockchain are being developed. Interestingly, Satoshi Nakamoto solved the problem of developing and applying blockchain instead of developing blockchain first and applying it to Bitcoin, an electronic money system operated only by P2P. This can be seen in "Bitcoin: A Peer-to-Peer Electronic Cash System," the white paper released at the time of the unveiling of Bitcoin to the world. Largely divided into public blockchain, Private blockchain, and concourse blockchain, Bitcoin, which can be seen as the first implementation of the first public blockchain, introduced a proof-of-work approach to verify that the transaction history contained in each "block" was not tampered with by a malicious attacker and to leave only normal blocks. This is done in "proof" fashion, demonstrating that one of the many nodes (partners of the blockchain network) has succeeded in creating a new block that is directly connected to the old blocks (in a chain), which correspond to a work. All nodes (users) participating in the Bitcoin network have the right to create blocks to follow. Still, the next block, considered part of the normal chain on the network, will result in only one. Bitcoin mining refers to the process of changing the non-node value of the block header of new "block candidates" until the result of the execution is less than the "difficulty" value set in the Bitcoin network. The new block candidate will then contain the transaction details made since the last block creation [22–24]. Under this architecture, if more than 50% of nodes are "honest nodes"—a healthy node that does not continue to span blocks containing erroneous transactions—Bitcoin will maintain integrity. If more than 50% of the computing power consumed in mining is an "attacker node" that spans blocks containing erroneous transactions, the integrity of Bitcoin can be destroyed, often referred to as a "51% attack".

The second one is a private blockchain, which refers to a blockchain network where only authorized users (nodes) can participate. If the entire trading history on the network is made transparent, it can be introduced around troubled financial sectors and others [25]. The key feature is that it does not rely on cryptocurrency and, ironically, the reason it exists is that nodes that have validated the validity of a blockchain need a medium for payment. In a private blockchain, an unspecified number of people need not adopt an encryption-waste system because it does not have to serve as a node. There is also a point where the processing speed is fast against the public block chain. This is due to other variance consensus algorithms. Typical solutions include the Linux Foundation, IBM's Hyperledger Fabric, and the Hyperledger Iroha managed by the Linux Foundation and under development by a Japanese company [26–30], Corda of R3. Hyperledger is a blockchain project managed by the Linux Foundation, jointly developed by IBM and Digital Asset, and released as open-source [31]. It enables implementation with the actual code, and IBM provides blockchain solutions based on this project. In the case of a private blockchain by a single entity, it has been regarded as a slow database system with no advantage over a server-based database. Blockchain's security algorithms are aimed at keeping the same data among unreliable players because, if there is one entity, it is only a waste of computation and time. In defense against external attacks, the same effect can be achieved by using a server-based distributed system [32–36], and the scalability, convenience, economy, and performance are also superior to those of the server. Finally, there is the Consortium Blockchain, which combines public and private blockchains [37–45] (see Table 1).



Source: Software Policy Institute, 2018 [25].

The rapid increase in world energy demand over the last decade and the requests for sustainable development can be approached through micro- and nanogrids using hybrid power systems based on the energy internet, blockchain technology, and smart contracts. In this way, renewable energy sources, fuel cell systems, and other energy generating sources will be optimally combined and connected to the grid system using advanced energy transaction methods [46]. In particular, this paper's contribution has the point that carbon credits should reduce the environmental pollution and carbon emissions of the Earth in the future. While the size of the carbon emission trading system has grown to a low point, there is a lack of technology to limit it, so research has begun. So, we are talking about the blockchain process for reducing greenhouse gas (GHG) and the measurement, reporting, and verification (MRV) methodology, as well as the verification process in a total of five stages.

For Protocol Design for Hybrid Governance, blockchain talks about how to use and verify IT governance. A procedure for verifying and agreeing on a carbon-tracking AI blockchain platform and a methodology for applying a hybrid governance protocol applicable to the UN SDGs are presented. The procedures of certificate-based hybrid blockchain and authentication of hybrid blockchain based on a cryptographic protocol are applied by applying this methodology: Certification of hybrid blockchain based on MAC (Media Access Control Address) Address, Authentication of Hybrid Blockchain based on ID/password, Hybrid Governance Protocol for Design Pattern, Hybrid Governance Protocol for Visitor Pattern, Hybrid Governance Protocol for Governance Protocol for Protocols, and Hybrid Governance Protocol for Protocols. It will then unveil the source code for the implementation of the hybrid governance protocol.

Thus, this paper proposes a blockchain-based carbon emission rights verification system to further learn proven data using the governance system analysis and blockchain (dApp) mainnet engine to solve these problems.

#### **3. UN SDGs' Performance and Blockchain Algorithms for Design and Implementation**

#### *3.1. Issue Raising*

Blockchain is also called a public exchange book, and it is not a central manager that manages the transaction book, but is managed instead by all traders together without a central manager. According to the current banking system, all trading books are owned by banks and can be traded only through banks, which can cause major problems in the event of hacking. In contrast, blockchain does not need a central management system, and it is safe from hacking, as all traders have their own transaction books and their books are constantly updated. With the Paris agreement taking effect, carbon emission rights are one of the hottest issues. China recently announced the implementation of the emission trading system in the power generation sector, and Korea is considering linking the emission market with China and Japan [47,48].

In addition, California and Canada's Quebec have linked emissions trading systems. The European Union has a common emissions trading system. Japan operates a common offset system with 17 developing countries, including Vietnam. In other words, the world is striving to link the carbon markets between countries. This is possible because there is an international agreement called the Paris Agreement, including a common unit of emission calculations called tCO2-eq. In this respect, emissions rights have very similar characteristics to blockchain-based transactions. The maximum permissible amount of greenhouse gas emissions across the globe can be calculated according to the Paris Agreement's goal of curbing global warming (2 ◦C). In addition, based on each country's greenhouse gas reduction targets, the maximum amount of emissions allowed by the Earth can be defined in the future. The Paris Agreement also applies the same standards to developed and developing countries. In addition, if the maximum greenhouse gas emission capacity of the Earth or the emission rights under the national reduction objective are allocated to the country and businesses, the emission rights can be traded on the same basis with a common worldwide transaction unit: Carbon dioxide equivalent. The Paris Agreement strictly requires prevention of double counting of emissions (reduction) through transparency mechanisms. Blockchain has the advantage of lowering transaction costs and ensuring transparency, as it is managed through common trading accounts around the world. Last year saw the world's first carbon emission trading between a Russian carbon fund and an African carbon emission holding company. In addition, emissions trading using blockchain was a key issue at the International Association of Emissions Trading in Barcelona. The era of the single global emission trading market and emission currency using blockchain could come faster than expected. Blockchain is also a key topic for the fourth revolution in state affairs. Although the UN and others are talking about the possibility of P2P transactions, we are proposing blockchain governance based on blockchain performance and stability through the main algorithms of blockchain.

#### *3.2. Research Methodology*

Governance is the generic term for the actions of all decision-making processes that create, update, and discard the formal and informal rules of a system. It consists of factors such as rules, smart tradeoffs, laws (punishment for malicious actors), procedures (what will be done when X occurs), or responsibilities (as to who should do what). The types of governance are largely blockchain governance, project governance, and fund governance. Blockchain governance also proceeds in the form of voting. Of course, voting can be used not only in voting, but also in other ways; also in terms of efficiency, voting is commonly used. The most representative blockchain determines the direction of the network through BIP (Bitcoin Improvement Proposals), EIP (Ethereum Improvement Proposal), developer forums, and various communities; in addition, various blockchains manage the network in slightly different ways. The meaning of project governance is that blockchain networks are a world. Based on this world, we can share on-chain governance and off-chain governance. On-chain governance, the former, refers to a form in which governance can be achieved within a chain without any other elements other than blockchain network components, and blockchain networks can be considered complete as an independent world. Conversely, if governance is done outside the network and it has a direct impact on the blockchain network, this form of governance can be said to be off-chain governance. Fund governance is an act to create a fund to raise the resources needed to create a blockchain ecosystem. Governance is important in blockchain because, over time, the network of blockchain cannot survive without the technology of change that can flexibly cope with the new problems. These quick updates make enterprise and mass market end-user use cases possible. If it takes too long to fix the problem, users will not abandon the service or even participate in it from scratch. Moreover, too-frequent changes divide the community and cause uncertainty to prevail. In a company, a representative's word is law. Thus, changes within a company may be very quick and efficient depending on the capabilities of the representative. In decentralized systems such as blockchain, however, each party has different

incentives. Users, miners, and developers all have different goals. For example, developers were satisfied with Monero's ASIC (Application Specific Integrated Circuit) protection updates, but minor players using ASICs were unhappy, as their profits were shrinking. Eventually, a hard fork broke out, and Monero was divided into several versions. The most important thing in understanding governance is that the incentives that each party constituting governance has may not match. It can be good for users but may be bad for miners (operating companies that implement governance), good for developers but bad for miners. Blockchain governance is designed to achieve network mining agreements through special algorithms. Typical algorithms include Proof-of-Work (PoW), Proof-of-Stake (PoS), and a mix of them. Nonetheless, this governance framework is currently developed and studied extensively, and it has many kinds of governance systems. Funding governance regulates how projects manage the collected funds. Project governance is a kind of meta or meta-meta governance that regulates technology, blockchain governance, funding governance, and meta governance (for example, changing governance procedures altogether). Technology topics include blockchain parameters (block size or gas prices), bug fixes, and new features. On-chain governance is where governance takes place within a blockchain. Ongoing governance involves developers/users/miners alike, and it is largely voted on to modify policies/policy. Off-chain governance is an architecture wherein discussions outside the blockchain are reflected to the blockchain. For example, developers run forums in places like Reddit in a blockchain park, measuring amendments and forming public opinion, and then reflecting them within the blockchain. In cross-chain projects, multiple governance can be implemented simultaneously. For example, in a project called Cosmos, malicious changes cannot be avoided, and rollback procedures must be possible. Blockchain's own token is not a useful incentive or a perfect solution to encourage good behavior. In particular, in situations such as trade shoulder, the token itself can be downgraded as an incentive. In cases like liquid democracy, the centralization of voting rights can be eased but still cannot completely block the populist phenomenon. Because governance is inherently the establishment of mechanisms that address changes in a useful way, several matters are important. In off-chain governance, governance is conducted through online forums outside the blockchain. Developers use the forum to check the revision proposals and their opinions and reflect them as policy changes within the blockchain. Bitcoin mainly runs forums through Reddit. In the case of Etherium, the revised proposals are used to collect public opinion by publishing them on YouTube in lecture form. As such, this paper proposes a Hybrid Governance Protocol, which integrates different types of governance systems. We describe the architecture for introducing blockchain for MRV (Measurement, Reporting, and Verification) application in the GHG (Greenhouse Gas) reduction process. It provides a basic foundation for MRV according to the national CDM (Clean Development Mechanism) methodology. In addition, most nations are developing and equipped with a greenhouse gas reduction zone. There are a lot of data every year, including statistics on greenhouse gas emissions. However, this is because it is the basis for each country to manipulate MRVs. Thus, in order to reduce this GHG, the reduction target must be achieved. There is a lot of discussion about this reduction target. So far, however, the state has arbitrarily granted carbon credits. In addition, each country's guidelines exist, but no clear standardization is made. Thus, the Climate Change and Energy Program emerged as a program to manage climate change and energy. However, these programs are also being challenged by manipulation or by malicious hackers.

Therefore, this research was conducted with Blockchain Agreement Algorithm and Artificial Intelligence Deep Learning Engine for research through verification of GHG reduction and MRV.

In addition, the types of governance structures are largely divided into blockchain governance, project governance, and fund governance.

#### (1) Blockchain Governance Structure

This refers to an algorithm that verifies accurate data and various data using blockchain. This level of governance is the stage in which all blockchain governance systems are established. It is also in the process of utilizing existing verification algorithms.

(1) Step 1

(2) Step 2

algorithms.

#### (2) Structural Structure Project

The project governance structure is used to establish the ICT (Information Communication Technology) and environmental governance systems required to build and implement carbon emission reduction projects. The project for carbon reduction is a very important step and is related to blockchain agreement algorithms. *Sustainability* **2020**, *xx*, x FOR PEER REVIEW 12 of 32 emission reduction projects. The project for carbon reduction is a very important step and is related

#### (3) Fund Governance Structure to blockchain agreement algorithms.

Fund governance refers to the blockchain fund governance structure that is needed when the financial sector funds are made when the carbon emission exchange is formed in future P2P transactions in the financial market of carbon emission rights. (3) Fund Governance Structure Fund governance refers to the blockchain fund governance structure that is needed when the financial sector funds are made when the carbon emission exchange is formed in future P2P transactions in the financial market of carbon emission rights.

#### *3.3. Blockchain Process for Reducing GHG and MRV 3.3. Blockchain Process for Reducing GHG and MRV*

The flexible mechanism for securing liquidity in the greenhouse gas emission trading market allows allocated companies to use emission rights in various and flexible ways in addition to trading emission rights when submitting emission rights in accordance with their target monthly greenhouse gas emission reduction activities. The purpose of flexibility is to secure liquidity in the emission market by diversifying greenhouse gas reduction methods and inducing more greenhouse gas reduction activities by ensuring flexibility in the method of submitting emission rights. Types of flexible mechanisms include banking and borrowing, recognition of early reduction performance, and certification of external reduction projects, such as offset. In addition, to reduce this MRV, a verification platform that is interlinked with these policy segments must be a mix of goods. This is the same for the whole world. This paper used an artificial intelligence blockchain for the verification platform in line with the process of GHG reduction and MRV reduction, and is expected to show a lot of trading volume if the carbon emission trading system comes out as an individual trading system in the future. Therefore, this paper is equipped with a process to perform these verification procedures. The process required for it is shown in Figure 4. The flexible mechanism for securing liquidity in the greenhouse gas emission trading market allows allocated companies to use emission rights in various and flexible ways in addition to trading emission rights when submitting emission rights in accordance with their target monthly greenhouse gas emission reduction activities. The purpose of flexibility is to secure liquidity in the emission market by diversifying greenhouse gas reduction methods and inducing more greenhouse gas reduction activities by ensuring flexibility in the method of submitting emission rights. Types of flexible mechanisms include banking and borrowing, recognition of early reduction performance, and certification of external reduction projects, such as offset. In addition, to reduce this MRV, a verification platform that is interlinked with these policy segments must be a mix of goods. This is the same for the whole world. This paper used an artificial intelligence blockchain for the verification platform in line with the process of GHG reduction and MRV reduction, and is expected to show a lot of trading volume if the carbon emission trading system comes out as an individual trading system in the future. Therefore, this paper is equipped with a process to perform these verification procedures. The process required for it is shown in Figure 4.

**Figure 4.** Verification blockchain for measurement, reporting, and verification (MRV) and greenhouse gas (GHG) data. **Figure 4.** Verification blockchain for measurement, reporting, and verification (MRV) and greenhouse gas (GHG) data.

Blockchain is a step to propose a blockchain architecture that can achieve a very fast agreement according to Hyper PoR (Proof of Random) consensus algorithm and verify it by these consensus

### (1) Step 1

Large amounts of carbon credits will be created, and individuals will be able to purchase them in the future. Thus, the verification of the data is required to reduce the MRV and GHG required.

#### (2) Step 2

Blockchain is a step to propose a blockchain architecture that can achieve a very fast agreement according to Hyper PoR (Proof of Random) consensus algorithm and verify it by these consensus algorithms.

#### (3) Step 3

The verification algorithm of the blockchain is used to verify each node and to verify it through work in the mesh network.

#### (4) Step 4

Algorithms to agree and verify carbon emission rights are obtained. Carbon emission rights are the steps to verifying carbon credits mined by individuals and exchanges necessary for this reduction.

#### (5) Step 5

The final validated data divided into agreed nodes after the data consistency verification process are stored. These storage steps are stored thoroughly prepared for hacking.

#### *3.4. Protocol Design for Hybrid Governance*

The Hybrid Governance Protocol is a transaction that occurs on a blockchain network. Transactions that are recorded on the chain are permanent; thus, once they are written in the network, they can never be erased. Still, many problems can arise from relying solely on the chain. The first is slow speed. After a transaction occurs, it takes quite a long time to be confirmed, so it is difficult to process quickly. The second is privacy. In the case of on-chain, there is a problem wherein the transaction history occurring in the blockchain network is disclosed to everyone. The third is cost and scalability. The cost of all the activities occurring in the blockchain network must be paid for by each person, and the slow speed of transactions is a disadvantage.

Blockchain governance protocols are also a concept created to solve the problems in these onand off-chains. These protocols can be said to be divided into on- and off-chain protocols. On-chain protocols are those other than blockchain network components, a form wherein governance can be achieved in internal strife without a dispute. Under these special circumstances, blockchain is complete in one independent world. In addition, if this is done outside the governance network, and it directly affects the interior of the blockchain network, then this type of protocol should be designed. In other words, it can be defined as the ongoing governance protocol. Still, this governance is very important because the governance protocol of blockchain plays a very important role in designing consensus algorithms. These protocols have a very important role to play. The SDGs announced by the United Nations have 17 categories. This protocol is also characterized by being optimized for carbon emission rights verification.

These protocols can be developed in the same way as governance systems. This paper compares the Internet environment and the distribution of the value of blockchain by designing these governance protocols and dividing them into application layers and protocol layers, using the text to represent the layer of the network protocol of items in the UN SDGs. The existing application layers, physical layers, and protocol layers are different. This is because the application layer has an accurate stack structure to achieve blockchain decentralization. Moreover, due to the characteristics of blockchain, which is always verified with shared data, the change in the value of blockchain is attributed to

its critical role in the sharing of data. Prior to that, the definition of data is critical. First, existing network protocols define the headers of packets for the data transmission of applications. Transmitters are encapsulated, receivers are encapsulated to create headers for data transmission in protocols, and receivers are referred to as reverse capsules for interpreting and processing headers. Subsequently, hybrid governance can refer to a private–public-based approach to protocol. This meaning will be a breakthrough margin for one-sided protocols of existing single-oriented ones. Submitting blockchain data to a network of applications does not save it all. The protocol makes the agreement, validates the data through the consensus process, and requires approval before the data can be stored. It also tends to be the opposite of the level of applications at which sensitive data are not protected by privacy (see Figure 5). *Sustainability* **2020**, *xx*, x FOR PEER REVIEW 14 of 32

**Figure 5.** Protocol design for hybrid governance. **Figure 5.** Protocol design for hybrid governance.

This meaning is designed to store the desired data whenever a particular event occurs. Modulation or artificial intelligences have a very difficult structure for modulation because of the control of protocols of the data. The hybrid blockchain protocol is designed to be used to verify carbon This meaning is designed to store the desired data whenever a particular event occurs. Modulation or artificial intelligences have a very difficult structure for modulation because of the control of protocols of the data. The hybrid blockchain protocol is designed to be used to verify carbon credits with hybrid structures that go beyond traditional private and public limits.

credits with hybrid structures that go beyond traditional private and public limits. The task of developing and improving the most important carbon emission blockchain (MRV) must be the central task. Although the government submitted the information specification for the inference of greenhouse gas emissions after receiving third-party verification from the company concerned, the emission trading system will be submitted to the environment minister who is in charge of the emission trading system, and the emission certification committee will review the government certification status following third-party verification. The emission rights can be allocated free of charge, and the proportion of the emission rights allocated free of charge has increased the elasticity of operations by making the global carbon emission rights determined by the Presidential Decree considering the industry's international competitiveness, international trends, and impact on the national economy, such as prices. In other words, emission rights are allocated free of charge by the percentage specified by the allocation plan: 100% during the first planning period, 97% during the second period, and 90% after the third period. It should be noted that Korea's free quota ratio is slightly different from the EU-ETS (EU Emissions Trading System) calculation method. For the EU-ETS, excluding the proportion of emissions allocated on a paid basis is a free allocation ratio; for countries, the percentage of "standard greenhouse gas emissions" of each allocated The task of developing and improving the most important carbon emission blockchain (MRV) must be the central task. Although the government submitted the information specification for the inference of greenhouse gas emissions after receiving third-party verification from the company concerned, the emission trading system will be submitted to the environment minister who is in charge of the emission trading system, and the emission certification committee will review the government certification status following third-party verification. The emission rights can be allocated free of charge, and the proportion of the emission rights allocated free of charge has increased the elasticity of operations by making the global carbon emission rights determined by the Presidential Decree considering the industry's international competitiveness, international trends, and impact on the national economy, such as prices. In other words, emission rights are allocated free of charge by the percentage specified by the allocation plan: 100% during the first planning period, 97% during the second period, and 90% after the third period. It should be noted that Korea's free quota ratio is slightly different from the EU-ETS (EU Emissions Trading System) calculation method. For the EU-ETS, excluding the proportion of emissions allocated on a paid basis is a free allocation ratio; for countries, the percentage of "standard greenhouse gas emissions" of each allocated company is "multiplied by the mandatory reduction rate specified by the company's past average greenhouse gas emissions" to get the free allocation ratio. Therefore, considering the emission rights reserved by the EU-ETS, even though the EU-ETS has a free allocation ratio of 90%, the companies subject to each quota may be allocated all of the standard greenhouse gas emissions free of charge; in Korea's emission trading system, however, only 90% of each allocated company's standard greenhouse gas emissions

subject to each quota may be allocated all of the standard greenhouse gas emissions free of charge; in Korea's emission trading system, however, only 90% of each allocated company's standard greenhouse gas emissions are allocated free of charge. Thus, if the allocated company had a similar

Ultimately, even if Korea's emission trading system has a free quota ratio of 100%, if 20% of the

total emission rights were to be reserved, the EU-ETS ratio would have the same effect as 80% based on the standard. An important factor here is the monitoring service for MRVs using artificial intelligence blockchains. Monitoring means the collection, storage, and management of all data necessary to determine the baseline and to measure artificial emissions and leaks within the business boundaries. Monitoring plans should be established for existing CDM (Clean Development Mechanism) projects and reflected in the project plans. The key elements of the monitoring plan are the data and variables to be monitored, and other data retention deadlines, responsibilities, and authority for data collection and management, quality assurance and management procedures, uncertainty levels, measurement methods, and calibration cycles for measuring equipment should be included; these should include artificial intelligence and blockchain mechanisms. For the data and variables to be monitored, the business plan should include data (variables) names, units of

emission rate in the past, they should purchase 10%.

are allocated free of charge. Thus, if the allocated company had a similar emission rate in the past, they should purchase 10%.

Ultimately, even if Korea's emission trading system has a free quota ratio of 100%, if 20% of the total emission rights were to be reserved, the EU-ETS ratio would have the same effect as 80% based on the standard. An important factor here is the monitoring service for MRVs using artificial intelligence blockchains. Monitoring means the collection, storage, and management of all data necessary to determine the baseline and to measure artificial emissions and leaks within the business boundaries. Monitoring plans should be established for existing CDM (Clean Development Mechanism) projects and reflected in the project plans. The key elements of the monitoring plan are the data and variables to be monitored, and other data retention deadlines, responsibilities, and authority for data collection and management, quality assurance and management procedures, uncertainty levels, measurement methods, and calibration cycles for measuring equipment should be included; these should include artificial intelligence and blockchain mechanisms. For the data and variables to be monitored, the business plan should include data (variables) names, units of measurement, descriptions of data, data sources, applicable numbers, methods, and procedures, monitoring cycles, quality assurance and management procedures, and the purpose of data use. If sampling is included in the monitoring method, the corresponding sampling plan listed in the project plan is prepared in accordance with the relevant guidance (UNFCCC 2015c), including the sampling design, data to be collected, and implementation plan. The organization of monitoring plans for all CDM projects shall comply with the CDM Business Standards (UNFCCC 2015d). In addition, each approved methodology or new baseline and monitoring methodology will differ in all other details, such as monitoring target, frequency, quality assurance and management procedures, and their levels. Therefore, specific criteria should be established for each item of the monitoring plan in the project plan based on an already approved methodology or a new methodology applied to the CDM project.

Finally, verification of whether such carbon emissions rights are being duly traded is performed based on the CDM verification and certification standards as the procedure for CDM operating bodies to assess the reduction of greenhouse gas emissions by business participants over a specified period of time. The CDM operating body verifies that the project activities comply with the CDM's detailed principles and requirements of the procedure when carrying out the verification. The CDM-certified bodies that perform verification and certification utilize the engine data of the blockchain and present a platform for it considering the grace period and revision of the form.

The above (see Figure 6) stores MRV data, GHG data, and unstructured/structured data in the Web Application Server (WAS). The natural network is mapped to reflect this. These analyzed engines are stored in the Deep Learning repertoire. These stored databases are stored in the real-time enterprise (RTE) server, and the data analyze and deliver databases that can analyze real-time data.


**Figure 6.** Carbon trading AI (Artificial Intelligence) blockchain platform. **Figure 6.** Carbon trading AI (Artificial Intelligence) blockchain platform. **Figure 6.** Carbon trading AI (Artificial Intelligence) blockchain platform.

#### *3.5. Verification Method using Hybrid Governance Protocol 3.5. Verification Method using Hybrid Governance Protocol 3.5. Verification Method using Hybrid Governance Protocol*

Looking at blockchain-based technology, there are protocols that use the blockchain concept, and the structure is based on protocol-based tokens. Blockchain itself is a distributed database or a data structure. Each node distributes and stores data using encryption technology. The protocol is one that can communicate between blockchain nodes (see Figure 7). Nodes using the same protocol can communicate with each other. An environment where various kinds of software can operate based on the protocol is produced. There are various tokens that operate in such protocol-based environments. Existing blockchains do not provide development environments, such as development environments or virtual machines, so they do not have tokens, but must be accessed in terms of initial value storage. Various kinds of tokens used on the basis of smart contracts can be seen as a program that performs each unique type of contract. Compared to communication, there are protocols for exchanging over the Internet and file/email with protocols such as HTTP, FTP, and SMTP based on TCP/IP technology, and various programs are produced using such protocols. Various programs such as websites, email, and file sharing are kinds of tokens, and there are attempts to create a decentralized world free of intermediaries through blockchain technology. Looking at blockchain-based technology, there are protocols that use the blockchain concept, and the structure is based on protocol-based tokens. Blockchain itself is a distributed database or a data structure. Each node distributes and stores data using encryption technology. The protocol is one that can communicate between blockchain nodes (see Figure 7). Nodes using the same protocol can communicate with each other. An environment where various kinds of software can operate based on the protocol is produced. There are various tokens that operate in such protocol-based environments. Existing blockchains do not provide development environments, such as development environments or virtual machines, so they do not have tokens, but must be accessed in terms of initial value storage. Various kinds of tokens used on the basis of smart contracts can be seen as a program that performs each unique type of contract. Compared to communication, there are protocols for exchanging over the Internet and file/email with protocols such as HTTP, FTP, and SMTP based on TCP/IP technology, and various programs are produced using such protocols. Various programs such as websites, email, and file sharing are kinds of tokens, and there are attempts to create a decentralized world free of intermediaries through blockchain technology. Looking at blockchain-based technology, there are protocols that use the blockchain concept, and the structure is based on protocol-based tokens. Blockchain itself is a distributed database or a data structure. Each node distributes and stores data using encryption technology. The protocol is one that can communicate between blockchain nodes (see Figure 7). Nodes using the same protocol can communicate with each other. An environment where various kinds of software can operate based on the protocol is produced. There are various tokens that operate in such protocol-based environments. Existing blockchains do not provide development environments, such as development environments or virtual machines, so they do not have tokens, but must be accessed in terms of initial value storage. Various kinds of tokens used on the basis of smart contracts can be seen as a program that performs each unique type of contract. Compared to communication, there are protocols for exchanging over the Internet and file/email with protocols such as HTTP, FTP, and SMTP based on TCP/IP technology, and various programs are produced using such protocols. Various programs such as websites, email, and file sharing are kinds of tokens, and there are attempts to create a decentralized world free of intermediaries through blockchain technology.

**Figure 7.** Interchain blockchain diagram. **Figure 7.** Interchain blockchain diagram. **Figure 7.** Interchain blockchain diagram.

## 3.5.1. Hybrid Governance Protocol Applicable to UN SDGs

A protocol in communication is one wherein a computer or a system communicates with another. Pre-promised operational regulations are required to perform data transfers quickly and accurately and to provide error detection and recovery functions. The Internet has communication over the network based on protocols such as TCP/IP, SMTP, HTTP, and HTTPS. A standard is always necessary, and the network always requires interoperability.


Next, we went through Web 1.0 and 2.0, and on top of these protocols were applications like Google and Facebook. Their business model was to build their own data and, based on that (centralized), demand/charge services directly from customers or collect advertising fees. At that time, the DB was closed, owned. Being able to obtain data and information only by using that service limited the possibility of creating new value from an open source from a different angle. Blockchain leads to a "change in protocol level" that has enabled these existing Web services. With an open-source, distributed DB, anyone can access data and share information freely. It is all about hardware, software, networks, and data. Blockchain protocols allow everyone to download software, become nodes, and replicate and use data. Joel Mongro [49] of Placeholder VC/Union Square Ventures describes blockchain as the embodiment of the Fat Protocol, unlike the traditional web-based Thin Protocol. The value created through the development of protocols and the return on the value created were low because information was locked in the application. Over the next few years, however, blockchain will rebuild protocols in decentralized form, which will revolve around the development and value creation of technologies.


While monetization over protocol was to create and sell S/W (Software) that utilizes the protocol, blockchain allows people who agree to the protocol to purchase each token and create better value for that protocol, resulting in an increase in value and price so that people can immediately obtain economic rewards. Thus, creating a new protocol and becoming dominant create the value of the token, giving rise to the underlying protocol project itself. They share computing power (Data Base), but they can decentralize and manage their resources. Now that the security tokenization is in earnest, we think it will be possible to develop more active protocol levels. In the early days, when one thinks of Netscape and Google, the Web was more like a thin protocol. In fact, data showed that most investments were made in infrastructure corresponding to protocols/core throughout 2017. Project financing in infrastructure amounts to 10 billion USD, with the sum of infra, payment, finance, exchange, and computing, which correspond to protocols and major vertical apps, practically making up the majority. Actually, the return is also high here. In a token economy, all assets are tokenized, and people take advantage of the goods/services written on top of the protocols they support, purchase token/coins in the process, and, in return, get rewarded as much as all participants contribute. However, we have a long way to go, and we do not think that human-developed technology itself will solve the social problems that we care about. On the other hand, if we remain still for many reasons, the world of blockchain and decentralization will not be as beautiful as expected [50].

## Certificate-Based Hybrid Blockchain

The certificate-based hybrid blockchain's public key password is used to authenticate the certificate based on the certificate containing the information of the certificate. In Korea, however, the Korean government has prepared a system for issuing public certificates through the 1999 Autobiography Act to certify the certificates through five public certificates under the best certificate authority, Root CA. For foreign countries, personal in-device, Eve modem device authentication, and WiMAX industry certificates are provided through Verisign's device certification service. In addition, the certificate-based authentication technology is being used in VoIP (Voice over Internet Protocol) and network surveillance cameras, and the station is expanding. Certificate-based authentication technology provides high stability through strong authentication functions and supports anti-denial functions. Nonetheless, device certification processing software algorithm requires high computational throughput. Therefore, it is not suitable for use in IoT (Internet of Things) devices that have power and performance. As such, blockchain is used instead of certificates for authentication to present a functional and usable enough blockchain.

### Authentication of Hybrid Blockchain based on Cryptographic Protocol

A protocol that authenticates objects based on the private and public blockchains' public key passwords and symmetric key passwords is used primarily in wireless Internet security protocols. It supports various tables, such as 802.1x/802.11i and WPA. The cryptographic protocol-based authentication method can include technologies such as ID/password-based authentication, MAC-address-based authentication, and certificate-based device certificate authentication depending on the cryptographic protocol used. A variety of authentication methods can be provided to select the combined authentication method according to the use environment, and the anti-denial function can be supported according to the code protocol adopted. Depending on the security-based encryption technology, however, if any vulnerability in encryption technology is found, it can lead to vulnerability in authentication technology. These blockchain technologies offer many blockchain architectures based on various encryption technologies.

### Certification of Hybrid Blockchain based on MAC Address

MAC address is an authentication method using a unique identification address (MAC) address assigned to the underlying hybrid network interface, which is used primarily for network rooting in intranet environments. It has a difference that compares the MAC address registered in the server with the message sent from the device when the device requests one in the network, and it is easier and faster than the ID/password-based authentication method. With the advent of IoT, however, there is a need for new MAC address forms to be defined, and new tables are being defined. MAC addresses can be tightened, so without extra security equipment, they are vulnerable to attacks by spoofing and others. These hybrid-based blockchain types can be applied to a variety of industry groups for hybrid-based blockchain authentication based on the MAC address of a computer system. In addition, blockchain is proposed for authentication work for authentication and protocol.

## Authentication of Hybrid Blockchain based on ID/Password

This is a technology used mainly in server/client authentication environments by storing each user ID and password of blockchain users in the server's DB and authenticating them based on stored knowledge. To prevent a list of passwords stored on a server from being exposed and consequently disabling authentication, a method of storing values through a hash function is often adopted. To ensure greater safety, hide SSIDs (Service Set IDentifier), use the WEP key between AP and device, adopt the PAP authentication method, and use the RFID method. The ID/password method in the IoT environment has problems, such as the server's load due to the characteristics of the IoT environment, where many devices are used without human intervention, and it is important to exclude human intervention in the additional process of device modification.

The problem is that it is not suitable for authentication technology in an IoT environment because it does not provide an anti-witching function. Based on blockchain technology for these IDs/passwords, it provides the necessary skills for the most basic authentication.

#### 3.5.2. Hybrid Governance Protocol for Design Pattern

Visitor patterns are often used with composition patterns. In the picture above, when dealing with the class that implements an element on the left, the composition pattern is used to implement the visitor pattern by implementing the individual objects and their parent objects in the form of a list. In general, NodeBlock allows a member variable and a method to be written together within an object; in a visitor pattern, however, the variable and method are created separately. For a similar pattern, Java does not support multiple inheritances from multiple different objects simultaneously. The term multiple inheritance here means that language internally supports double dispatch, and that multiple inheritance is not supported. The non-identifier pattern eventually results in the object's inheritance to the element and the non-identifier's inheritance, which is not supported by Java, resulting in a somewhat complex form (two interfaces and two implementations). The block is also very important because of the pattern design, which is very important here. AssignmentBlock and VariableRefBlock have many meanings with regard to the status of blockchain.

#### Hybrid Governance Protocol for Visitor Pattern

This design is a common way of implementing processing-related logic in each node class when processing data are formed from syntax trees, file systems, or hierarchical structures that are often encountered among design patterns. The design patterns nodeblock and typecheckingblock can be found in a diagram of the file system in the class and coxegeneratingblock. Recursively, the methods have a logic output, i.e., a list of files. This is called, like Linux, ls-R, which is lower in the output to the list of files. An abstract method named to the abstract class from a higher node, which probably looks solved, is added by the respective method in classes and implementation. Since these requirements increase the number of nodes or the number of logic units handling each node, the analysis should be done by looking at the logic that is sweeping around the code. Moreover, the difficulty of debugging or analyzing related logic increases because of the lack of coordination of related logic; if there is a common task in some processing, the common tasks are spread across all nodes, and they can lead to shotgun surgery if changed. To process the cohesive logic and common logic as much possible, assignmentblock is extracted and used separately. When files are moved or copied to a specific location while traveling around a file tree, the code may have asynchronous methods that are passed to a separate system other than variableRefBlock, or the code is highly cohesive, which increases reuse and allows extended processing of node classes without modification, thus complying with the blockchain principle. On each node directory path in particular, the actual data are calculated to send a webrequest (see Figure 8).

#### Hybrid Governance Protocol for Observer Pattern

Using the interface, the Observer pattern of the Hybrid Governance Protocol recommended loose coupling between objects. In other words, it uses composition, not implementation through inheritance. Configuration means that A has B, which is often used to include interfaces rather than objects in an object. The Observer pattern that we are trying to use also uses interfaces like this. There are two main roles to play here. One is the role of Publisher, and the other is the role of Observer. Once they have defined their interfaces, they use the initial classes. The interface called Publisher will have a method of managing Observers. Three methods can be defined: Receiving and registering (add), excluding (delete), and notifying registered Observers (notifyObserver). The Observer interface will have an update method that updates the information. If you draw a class diagram based on this,

it will be shown below. The CodeGenerationVisitor class, which implements the Publisher, becomes the informative Publisher and has Observer objects. Likewise, the Node and NodeBlock classes implementing the Observer interface update are called each time TypeCheckingVisitor notifies you when calling a new Node. Based on this, let us code it as JAVA. The way Publisher sends information or status changes to the Observer is called push, as we commonly know it. On the other hand, the way the Observer asks the Publisher for information whenever it is needed is called pull. So far, it has been a push-button approach. Of course, a pooling method can be implemented with an observer pattern. In JAVA, we basically provide the applications of this Observer pattern. This is the Observable class and the Observer interface. This makes it easier to apply Observer patterns without having to implement a direct interface. Nonetheless, there is one problem here, as there are pros and cons. Specifically, Observable is not an interface, but a class. In the end, if you are forced to inherit, but the inheritance must be from another class, you cannot use it. Because JAVA does not support multiple over-the-counter inheritances, it will need to be used appropriately in view of the circumstances (see Figure 9). found in a diagram of the file system in the class and coxegeneratingblock. Recursively, the methods have a logic output, i.e., a list of files. This is called, like Linux, ls-R, which is lower in the output to the list of files. An abstract method named to the abstract class from a higher node, which probably looks solved, is added by the respective method in classes and implementation. Since these requirements increase the number of nodes or the number of logic units handling each node, the analysis should be done by looking at the logic that is sweeping around the code. Moreover, the difficulty of debugging or analyzing related logic increases because of the lack of coordination of related logic; if there is a common task in some processing, the common tasks are spread across all nodes, and they can lead to shotgun surgery if changed. To process the cohesive logic and common logic as much possible, assignmentblock is extracted and used separately. When files are moved or copied to a specific location while traveling around a file tree, the code may have asynchronous methods that are passed to a separate system other than variableRefBlock, or the code is highly cohesive, which increases reuse and allows extended processing of node classes without modification, thus complying with the blockchain principle. On each node directory path in particular, the actual data are calculated to send a webrequest (see Figure 8). *Sustainability* **2020**, *xx*, x FOR PEER REVIEW 20 of 32 3.5.2.2. Hybrid Governance Protocol for Observer Pattern Using the interface, the Observer pattern of the Hybrid Governance Protocol recommended loose coupling between objects. In other words, it uses composition, not implementation through inheritance. Configuration means that A has B, which is often used to include interfaces rather than objects in an object. The Observer pattern that we are trying to use also uses interfaces like this. There are two main roles to play here. One is the role of Publisher, and the other is the role of Observer.

Once they have defined their interfaces, they use the initial classes. The interface called Publisher will

This design is a common way of implementing processing-related logic in each node class when

encountered among design patterns. The design patterns nodeblock and typecheckingblock can be

*Sustainability* **2020**, *xx*, x FOR PEER REVIEW 19 of 32

VariableRefBlock have many meanings with regard to the status of blockchain.

Visitor patterns are often used with composition patterns. In the picture above, when dealing with the class that implements an element on the left, the composition pattern is used to implement the visitor pattern by implementing the individual objects and their parent objects in the form of a list. In general, NodeBlock allows a member variable and a method to be written together within an object; in a visitor pattern, however, the variable and method are created separately. For a similar pattern, Java does not support multiple inheritances from multiple different objects simultaneously. The term multiple inheritance here means that language internally supports double dispatch, and that multiple inheritance is not supported. The non-identifier pattern eventually results in the object's inheritance to the element and the non-identifier's inheritance, which is not supported by Java, resulting in a somewhat complex form (two interfaces and two implementations). The block is also very important because of the pattern design, which is very important here. AssignmentBlock and

3.5.2. Hybrid Governance Protocol for Design Pattern

3.5.2.1. Hybrid Governance Protocol for Visitor Pattern

**Figure 8.** Hybrid Governance Protocol for the design pattern. **Figure 8.** Hybrid Governance Protocol for the design pattern. circumstances (see Figure 9).

**Figure 9.** Hybrid Governance Protocol for Observer pattern. **Figure 9.** Hybrid Governance Protocol for Observer pattern.

nodes to download the latest blockchain. This refers to the relationship between these nodes, considering the fact that the computer does not recognize all or some nodes in Bitcoin. Hardcoding of node addresses in Hybrid Governance can be incorrect. The node may be attacked or shut down, preventing the new node from participating in the network. In Hybrid Governance, the DNS (Domain Name System) seeds are hard-coded instead. This is not a node, but a DNS server that knows the addresses of some nodes. The first time you run Hybrid Governance, the core will be

*3.5.3. Implementation of the Hybrid Governance Protocol*

## 3.5.3. Implementation of the Hybrid Governance Protocol

This is the first time to download and run for Hybrid Governance. It must be connected to some nodes to download the latest blockchain. This refers to the relationship between these nodes, considering the fact that the computer does not recognize all or some nodes in Bitcoin. Hardcoding of node addresses in Hybrid Governance can be incorrect. The node may be attacked or shut down, preventing the new node from participating in the network. In Hybrid Governance, the DNS (Domain Name System) seeds are hard-coded instead. This is not a node, but a DNS server that knows the addresses of some nodes. The first time you run Hybrid Governance, the core will be connected to one of the seeds, and you will get a list of addresses of the pool nodes to download the blockchain.

In our implementation, however, centralization will be achieved. We have three kinds of nodes.


Below is the target scenario. *Sustainability* **2020**, *xx*, x FOR PEER REVIEW 21 of 32


The node communicates through the message. When a new node runs, it imports multiple nodes from the DNS seed and sends a version message (see Figure 10). The message can be implemented as follows. The Version field is not important because our blockchain has only one version. BestHeight stores the length of blockchain that a node has. AddrFrom stores the sender's address. The node that receives the version message responds with its version message. This is a kind of handshake, and we cannot interact until we send and receive greetings from each other. This is not simply an expression of politeness. Version is used to find a longer blockchain. Upon receiving a version message, a node checks if its blockchain is longer than BestHeight. In shorter cases, the node requests and downloads the missing blocks. You need a server to receive a message (see Figure 11). (2) The other wallet nodes are connected to the central node, and the blockchain is downloaded. (3) Collector nodes are also connected to the central node to download the blockchain. (4) The wallet nodes generate transactions. (5) The collator node receives the transaction and stores it in the memory pool. (6) When enough transactions are accumulated in the memory pool, the miner node begins mining the new blocks. (7) When a new block is mined, it is sent to the central node. (8) The wallet node is synchronized with the central node. (9) The user of the wallet node checks if payment is made normally.

#### **Figure 10.** Importing multiple nodes. **Figure 10.** Importing multiple nodes.

The node that receives the version message responds with its version message. This is a kind of handshake, and we cannot interact until we send and receive greetings from each other. This is not simply an expression of politeness. Version is used to find a longer blockchain. Upon receiving a version message, a node checks if its blockchain is longer than BestHeight. In shorter cases, the node requests and downloads the missing blocks. You need a server to receive a message (see Figure 11).

The node communicates through the message. When a new node runs, it imports multiple nodes

*Sustainability* **2020**, *xx*, x FOR PEER REVIEW 22 of 32

*Sustainability* **2020**, *xx*, x FOR PEER REVIEW 22 of 32

**Figure 11.** AddrFrom stores the sender's address. **Figure 11.** AddrFrom stores the sender's address. **Figure 11.** AddrFrom stores the sender's address.

First is the hard-coding of the address of the central node. All nodes need to know which node to connect to at first (see Figure 12). The minerAddress factor specifies the address where mining compensation will be received. If the current node is not a central node, then a version message must be sent to the central node to ensure that its blockchain is up to date. The message is a sequence of bytes viewed at the low level. The first 12 bytes represent the command name ("version") followed by the gob-encoded message structure. CommandToBytes is implemented as follows: First is the hard-coding of the address of the central node. All nodes need to know which node to connect to at first (see Figure 12). The minerAddress factor specifies the address where mining compensation will be received. If the current node is not a central node, then a version message must be sent to the central node to ensure that its blockchain is up to date. The message is a sequence of bytes viewed at the low level. The first 12 bytes represent the command name ("version") followed by the gob-encoded message structure. CommandToBytes is implemented as follows: First is the hard-coding of the address of the central node. All nodes need to know which node to connect to at first (see Figure 12). The minerAddress factor specifies the address where mining compensation will be received. If the current node is not a central node, then a version message must be sent to the central node to ensure that its blockchain is up to date. The message is a sequence of bytes viewed at the low level. The first 12 bytes represent the command name ("version") followed by the gob-encoded message structure. CommandToBytes is implemented as follows:

This function creates a buffer of 12 bytes, populates the command name, and leaves the remaining bytes blank. Conversely, there is also a function of converting a byte sequence into a command. Upon receiving a command, a node takes the command name through bytesToCommand and processes the command content with the appropriate handler. First, decode the request and import the payload. Since this is common to all handlers, this code will be omitted from the code snippet to be written in the future. The node then compares its bestHeight with the value received in the message. If the blockchain of a node is longer, reply with a version message; if it is shorter, send This function creates a buffer of 12 bytes, populates the command name, and leaves the remaining bytes blank. Conversely, there is also a function of converting a byte sequence into a command. Upon receiving a command, a node takes the command name through bytesToCommand and processes the command content with the appropriate handler. First, decode the request and import the payload. Since this is common to all handlers, this code will be omitted from the code snippet to be written in the future. The node then compares its bestHeight with the value received in the message. If the blockchain of a node is longer, reply with a version message; if it is shorter, send the getblocks message (see Figure 13). This function creates a buffer of 12 bytes, populates the command name, and leaves the remaining bytes blank. Conversely, there is also a function of converting a byte sequence into a command. Upon receiving a command, a node takes the command name through bytesToCommand and processes the command content with the appropriate handler. First, decode the request and import the payload. Since this is common to all handlers, this code will be omitted from the code snippet to be written in the future. The node then compares its bestHeight with the value received in the message. If the blockchain of a node is longer, reply with a version message; if it is shorter, send the getblocks message (see Figure 13).

the getblocks message (see Figure 13). When the block hash values are received, they are stored in the blocksInTransit variable to track the downloaded blocks. This lets you download blocks from other nodes. Immediately after switching the block to the transport state, send the getdata command to the node that sent the inv message and update blockInTransit. In the actual P2P network, you try to transfer blocks from different nodes, not just from the node that sent the message. Our implementation does not transmit multiple hashes

*Sustainability* **2020**, *12*, 4021

to Inv. This is why the first hash is only taken in payload. Type = "tx". Check if there is a hash in the mempool; if there is no hash, send getdata. *Sustainability* **2020**, *xx*, x FOR PEER REVIEW 23 of 32

**Figure 13.** Getblocks message code. **Figure 13.** Getblocks message code.

#### When the block hash values are received, they are stored in the blocksInTransit variable to track **4. Experimental Results**

#### the downloaded blocks. This lets you download blocks from other nodes. Immediately after *4.1. Experimental Environment*

switching the block to the transport state, send the getdata command to the node that sent the inv message and update blockInTransit. In the actual P2P network, you try to transfer blocks from different nodes, not just from the node that sent the message. Our implementation does not transmit It is necessary to verify through a test net to develop dynamic (within one second of overhead) multi-channel blockchain technology that supports real-time transaction parallel processing through graph profiling of carbon emission blockchain event-based health management.

multiple hashes to Inv. This is why the first hash is only taken in payload. Type = "tx". Check if there is a hash in the mempool; if there is no hash, send getdata. Establish an environment to obtain blockchain performance data. System environment


#### Establish an environment to obtain blockchain performance data. *4.2. Experimental Conditions*

*4.2. Experimental Conditions*


(4) Hierarchical block chain creation and maintenance system.


(1) Real-time multi-channel communications protocol.

(5) Parallel processing and optimization of transactions using dependent graphs.

Finally, carbon verification is required among carbon emission blockchain verification systems based on the end point.

	- Multi-chain health management system.
	- Multi-chain block creation and maintenance system.
	- Multi-channel communication protocol module.
	- Virtual machines that process transactions in parallel through profiling and speculative execution.
	- Dynamic channel allocation and merging algorithm.
	- Blockchain test net with scalability solution for this task.
	- Mainnet (SW).
	- Blockchain-based NoSQL real-time database and health path event function structure.
	- Transaction separation processing system based on channel-to-channel dependencies.
	- Blockchain virtual machines that can execute speculation through parallel processing and profiling of transactions in a channel.
	- A system that dynamically manages channels using profile information to ensure uniform transaction throughput for each channel.
	- Transaction processing speed 15,000 TPS.
	- One hundred concurrent transaction types.
	- Thirty seconds of throughput for transactions dependent on more than one channel.
	- Ten times the in-channel transaction parallel throughput.
	- Overhead of two seconds for dynamic channel management.

## *4.3. Blockchain Validation Comparison*

This measures the time that it takes for transactions to process the change that the state managed by more than one channel for verification of carbon blockchain. It also compares the transaction throughput (TPS) measured in parallel with the transaction throughput (TPS) in the control group, which continuously processes the transactions within. Figure 14 shows the average value of 12,000 averages when these performance data are rotated five times.

In addition, the testbed network environment consisting of 10 nodes is established, and the performance data are measured with approximately 15,000 TPS performance data values when measured, as shown in Figure 15, and about 100 times when the test bed network environment is constructed with the same 10 nodes as the client sending the transaction request to each channel through a non-numeric method. Thus, the results of measuring the number of channels that can be generated while maintaining the appropriate number of transactions in a testbed network environment consisting of these 50 identical nodes show that the performance information is stable as the average value is paid 100 times.

based on the end point. (1) Major Functions

> - Mainnet (SW). (2) Major skills

profiling of transactions in a channel.

*4.3. Blockchain Validation Comparison*

transaction throughput for each channel.

(3) Comparison of key performance data - Transaction processing speed 15,000 TPS. - One hundred concurrent transaction types.

execution.

(6) Develop dynamic channel allocation and merge technologies.





averages when these performance data are rotated five times.

Finally, carbon verification is required among carbon emission blockchain verification systems




This measures the time that it takes for transactions to process the change that the state managed by more than one channel for verification of carbon blockchain. It also compares the transaction throughput (TPS) measured in parallel with the transaction throughput (TPS) in the control group,



**Figure 14.** Number of current transaction types of performance data (average number 5). **Figure 14.** Number of current transaction types of performance data (average number 5). as the average value is paid 100 times.

**Figure 15.** Number of current transaction types of performance data (average number 100). **Figure 15.** Number of current transaction types of performance data (average number 100).

#### **5. Discussion**

**5. Discussion** Discussions have been held since 2017, and the consensus is that it is not too early to modify the system, but it was concluded in August that Bitcoin cache is hard to fork out to networks. Likewise, a problem exists in the trade of carbon credits according to UN-SDGs between individuals. Because the governance system became very important in validating carbon credits with peer-to-peer (P2P), the governance system is applied to carbon emission rights based on the stability, decentralization, and reliability of the blockchain. This created the dApp, which developed the carbon emission blockchain. The ID for certification of these carbon credits, PWD (Password), will be used to certify these carbon credits. Still, there is one problem that needs to be solved in a decentralized network. While start-ups and other general companies can quickly modify and put products on the market (especially if the product is software), blockchain networks are decentralized, making it very difficult Discussions have been held since 2017, and the consensus is that it is not too early to modify the system, but it was concluded in August that Bitcoin cache is hard to fork out to networks. Likewise, a problem exists in the trade of carbon credits according to UN-SDGs between individuals. Because the governance system became very important in validating carbon credits with peer-to-peer (P2P), the governance system is applied to carbon emission rights based on the stability, decentralization, and reliability of the blockchain. This created the dApp, which developed the carbon emission blockchain. The ID for certification of these carbon credits, PWD (Password), will be used to certify these carbon credits. Still, there is one problem that needs to be solved in a decentralized network. While start-ups and other general companies can quickly modify and put products on the market (especially if the product is software), blockchain networks are decentralized, making it very difficult for anyone to

major impediment to the growth of the network if it flows in the wrong direction.

will be a number of stakeholders, including miners (or witnesses and validators), developers, coin holders, and coin investors, all of whom have different interests, thereby making it quite difficult to coordinate and reach an agreement. In addition, in some cases, the security and stability of the network are more important than quick response to the market, such as with Bitcoin, so it is important to think about how to make decisions when designing a network. Therefore, governance becomes very important because decision-making is not effective in a decentralized network, or it can be a respond quickly to what the market wants. That is why the way of making decisions in such a decentralized network becomes very important. In addition, once the network starts, there will be a number of stakeholders, including miners (or witnesses and validators), developers, coin holders, and coin investors, all of whom have different interests, thereby making it quite difficult to coordinate and reach an agreement. In addition, in some cases, the security and stability of the network are more important than quick response to the market, such as with Bitcoin, so it is important to think about how to make decisions when designing a network. Therefore, governance becomes very important because decision-making is not effective in a decentralized network, or it can be a major impediment to the growth of the network if it flows in the wrong direction. *Sustainability* **2020**, *xx*, x FOR PEER REVIEW 26 of 32

In addition, the required dApp is selected by choosing either carbon credits or energy blockchains. These decisions are made, and the energy agreement algorithm-applied data are selected. The members can calculate the usage based on the use of carbon emission using various points, and so on (see Figure 16). Then, the required dApp is selected to run the energy blockchain. In addition, the required dApp is selected by choosing either carbon credits or energy blockchains. These decisions are made, and the energy agreement algorithm-applied data are selected. The members can calculate the usage based on the use of carbon emission using various points, and so on (see Figure 16). Then, the required dApp is selected to run the energy blockchain.

**Figure 16.** Carbon emission blockchain login screen. **Figure 16.** Carbon emission blockchain login screen.

One must decide between the actual seller and buyer and click the add button to build and operate an applicable dApp for the carbon emission blockchain (see Figure 17). One must decide between the actual seller and buyer and click the add button to build and operate an applicable dApp for the carbon emission blockchain (see Figure 17).

One can also choose the type of carbon emission that one needs. For example, one can choose from solar energy, wind energy, or geothermal energy and actually buy the power one needs (see Figure 18).

This paper followed the recommendations of the UN-SDGs, and there were many problems in dealing with individual carbon credits in the existing carbon emission system. The first reason is that the country is now centralized in carbon trading. Second, in order to conduct turn-on transactions among individuals, authorized agencies must measure and verify carbon transactions. Nonetheless, it is difficult to verify all of them centrally in an individual transaction. Therefore, the blockchain's artificial intelligence decentralization service has been designed.

In addition, the necessary dApp was introduced. In fact, we can protect against carbon emissions anomalies by using big data and artificial intelligence in mobile cloud environments. In addition, there is no way of restoring the private key used in electronic signatures when using blockchain in carbon emission monitoring/trading using smart collect, or of protecting the private key from being hacked (see Figure 19). As such, it is necessary to establish criteria for verifying the normal operation of smart contracts because programs recorded in programs can operate abnormally, causing problems

**Figure 17.** Carbon emission blockchain trading screen.

Figure 18).

mainnet engine.

such as economic damage or personal information leaks. One will have to search in advance. To solve these problems, this study proposed a blockchain-based carbon emission rights verification system to learn proven data further using governance system analysis and a blockchain mainnet engine. **Figure 16.** Carbon emission blockchain login screen. One must decide between the actual seller and buyer and click the add button to build and operate an applicable dApp for the carbon emission blockchain (see Figure 17).

*Sustainability* **2020**, *xx*, x FOR PEER REVIEW 26 of 32

In addition, the required dApp is selected by choosing either carbon credits or energy blockchains. These decisions are made, and the energy agreement algorithm-applied data are selected. The members can calculate the usage based on the use of carbon emission using various points, and so on (see Figure 16). Then, the required dApp is selected to run the energy blockchain.


**Figure 17. Figure 17.** Carbon emission blockchain trading screen. Carbon emission blockchain trading screen. from solar energy, wind energy, or geothermal energy and actually buy the power one needs (see


**Figure 18.** Details of a carbon blockchain transaction. **Figure 18.** Details of a carbon blockchain transaction.

artificial intelligence decentralization service has been designed.

the country is now centralized in carbon trading. Second, in order to conduct turn-on transactions among individuals, authorized agencies must measure and verify carbon transactions. Nonetheless, it is difficult to verify all of them centrally in an individual transaction. Therefore, the blockchain's

In addition, the necessary dApp was introduced. In fact, we can protect against carbon emissions anomalies by using big data and artificial intelligence in mobile cloud environments. In addition, there is no way of restoring the private key used in electronic signatures when using blockchain in carbon emission monitoring/trading using smart collect, or of protecting the private key from being hacked (see Figure 19). As such, it is necessary to establish criteria for verifying the normal operation of smart contracts because programs recorded in programs can operate abnormally, causing problems such as economic damage or personal information leaks. One will have to search in advance. To solve these problems, this study proposed a blockchain-based carbon emission rights verification system to learn proven data further using governance system analysis and a blockchain


*Sustainability* **2020**, *xx*, x FOR PEER REVIEW 28 of 32

**Figure 19.** Carbon blockchain monitoring/trading system. **Figure 19.** Carbon blockchain monitoring/trading system.

#### **6. Conclusion 6. Conclusions**

While many topics, such as consensus algorithm (PoW, PoS, etc.), coin economy (how to distribute coin/talk to whom, etc.), and scalability, are discussed in the blockchain-based decentralized network, governance related to how to make decisions is not likely to be discussed well. Thus, in this paper, the centralized network talks about why the UN-SDGs' governance is important. In general, planning a product is a process of looking at what the user's potential demand in the market is, and then designing a solution that can meet this demand (i.e., addressing the user's problems). Even if one identifies the hidden needs of the market, it is very difficult to create a product that can accurately address those needs, i.e., "shooting at what the market wants." In most cases, no matter how well prepared and released the product is, it does not capture the demand of the market fully, but meets it only partially. Because it is so difficult to predict demand in the market, instead of planning elaborately at first with high cost and effort, the company makes a minimal functional product (MVP) that can meet the expected market demand even if quality drops a little, and then quickly modifies the product according to the market response to find a product–market combination at the beginning of the business. This need to make products that satisfy what the market wants is the same for decentralized projects based on blockchain. It is equally difficult to satisfy the market, so no matter how sophisticated the blockchain characteristics and token explosions are before the start, the market rarely flows in the direction predicted before the launch of the network; in most cases, the market will flow in a different direction from the originally predicted one. It would be the same for blockchain-based decentralized projects that have to make products satisfying the needs of the market, but it is not easy to satisfy the market; thus, no matter how sophisticated the blockchain characteristics and token explosions are before the start, the market rarely flows in the direction predicted before the launch of the network; in most cases, the market runs in a different direction from the originally predicted one. Carbon credits are currently a very difficult technology to While many topics, such as consensus algorithm (PoW, PoS, etc.), coin economy (how to distribute coin/talk to whom, etc.), and scalability, are discussed in the blockchain-based decentralized network, governance related to how to make decisions is not likely to be discussed well. Thus, in this paper, the centralized network talks about why the UN-SDGs' governance is important. In general, planning a product is a process of looking at what the user's potential demand in the market is, and then designing a solution that can meet this demand (i.e., addressing the user's problems). Even if one identifies the hidden needs of the market, it is very difficult to create a product that can accurately address those needs, i.e., "shooting at what the market wants." In most cases, no matter how well prepared and released the product is, it does not capture the demand of the market fully, but meets it only partially. Because it is so difficult to predict demand in the market, instead of planning elaborately at first with high cost and effort, the company makes a minimal functional product (MVP) that can meet the expected market demand even if quality drops a little, and then quickly modifies the product according to the market response to find a product–market combination at the beginning of the business. This need to make products that satisfy what the market wants is the same for decentralized projects based on blockchain. It is equally difficult to satisfy the market, so no matter how sophisticated the blockchain characteristics and token explosions are before the start, the market rarely flows in the direction predicted before the launch of the network; in most cases, the market will flow in a different direction from the originally predicted one. It would be the same for blockchain-based decentralized projects that have to make products satisfying the needs of the market, but it is not easy to satisfy the market; thus, no matter how sophisticated the blockchain characteristics and token explosions are before the start, the market rarely flows in the direction predicted before the launch of the network; in most cases, the market runs in a different direction from the originally predicted one. Carbon credits are currently a very difficult technology to physically verify with emission rights. Therefore, this paper aims to establish

a governance system for the UN-SDGs to verify these carbon emissions. In order to establish this governance system, technological independence must be achieved first. Technology is something that needs to be reliable. As such, this paper designed the architecture to enhance the performance information of the trust-based blockchain. It is also equipped with an expanded version of the DPoS (Delegation Proof of Stake) method, an agreement algorithm. Second, the verification encryption algorithm needed to build the engine of the blockchain is discussed. The verification algorithm is a performance- and trust-based encryption algorithm. The third point is the convergence of artificial intelligence and blockchain algorithms. It discusses the mechanism of using blockchain and artificial intelligence algorithms to make sure that carbon emission rights are the correct or wrong answer. This paper now says that carbon credits were previously converted into B2B (Business-to-Business) markets from carbon emission exchanges, but are now expanding to P2P markets. Therefore, if this P2P (Peer-to-Peer) market becomes a P2P market, this is a paper for establishing and verifying carbon emission blockchain governance to verify carbon emission rights.

**Author Contributions:** Conceptualization, S.-K.K. and J.-H.H.; Data curation, S.-K.K.; Formal analysis, S.-K.K.; Funding acquisition, J.-H.H.; Investigation, S.-K.K. and J.-H.H.; Methodology, S.-K.K. and J.-H.H.; Project administration, J.-H.H.; Resources, S.-K.K. and J.-H.H.; Software, S.-K.K. and J.-H.H.; Supervision, J.-H.H.; Validation, S.-K.K. and J.-H.H.; Visualization, J.-H.H.; Writing—original draft, S.-K.K. and J.-H.H.; Writing—review and editing, J.-H.H. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korean government (MSIT) (No. 2017R1C1B5077157). In addition, this research was supported by the Energy Cloud R&D Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Science, ICT (NRF-2019M3F2A1073385).

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Abbreviations**



#### **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## *Article* **Blockchain IoT for Smart Electric Vehicles Battery Management**

## **Bogdan Cristian Florea \*,† and Dragos Daniel Taralunga †**

Faculty of Electronics, Telecommunications and Information Technology, Politehnica University of Bucharest, 061071 Bucharest, Romania; dragos.taralunga@upb.ro

**\*** Correspondence: bogdan.florea@upb.ro

† These authors contributed equally to this work.

Received: 9 April 2020; Accepted: 12 May 2020; Published: 13 May 2020

**Abstract:** Electric Vehicles (EVs) have generated a lot of interest in recent years, due to the advances in battery life and low pollution. Similarly, the expansion of the Internet of Things (IoT) allowed more and more devices to be interconnected. One major problem EVs face today is the limited range of the battery and the limited number of charging or battery swapping stations. A solution is to not only build the necessary infrastructure, but also to be able to correctly estimate the remaining power using an efficient battery management system (BMS). For some EVs, battery swapping can also be an option, either at registered stations, or even directly from other EV drivers. Thus, a network of EV information is required, so that a successful battery charge or swap can be made available for drivers. In this paper two blockchain implementations for an EV BMS are presented, using blockchain as the network and data layer of the application. The first implementation uses Ethereum as the blockchain framework for developing smart contracts, while the second uses a directed acyclic graph (DAG), on top of the IOTA tangle. The two approaches are implemented and compared, demonstrating that both platforms can provide a viable solution for an efficient, semi-decentralized, data-driven BMS.

**Keywords:** blockchain; battery management; electric vehicle; state of charge estimation; Internet of Things; smart contract; Ethereum; IOTA

### **1. Introduction**

In recent years the development of electric vehicles has become one of the main interests for most major automobile manufacturers. One of the most concerning aspects for consumers regarding the adoption of electrical vehicles (EVs) is the autonomy and the lack of infrastructure in most areas, except for large cities.

The history of electric vehicles dates back almost to the introduction of the electric motor. EVs can be classified in the following categories: hybrid electric vehicles (HEVs), plug-in hybrid electric vehicles (PHEVs), and battery electric vehicles (BEVs) [1]. HEVs and PHEVs are powered by two sources: an electric motor and an internal combustion engine which can operate independently or in parallel, while BEVs operate solely using an electric motor powered by batteries or fuel-cells (FCEV) [2]. Moreover, HEVs do not provide an external charger for the batteries, while PHEVs allow external battery charging.

For HEVs and PHEVs, multiple drive-train configurations are available. Series operation EVs use only the electric motor for propulsion, which is coupled with the transmission, while the internal combustion engine is used solely to charge the battery when the state of charge is low. This method is useful for city driving, where frequent start-stops are required. The parallel operation uses both engines for propulsion, by simultaneously transmitting power to the wheels, thus improving the efficiency of the vehicle. Finally, the series-parallel mode combines the features of the two previous modes, but the design of the vehicle is more complicated [1].

On the other hand, BEVs rely solely on battery power and an electric motor for propulsion, and both BEVs and PHEVs can be externally charged from a power source. There are two types of charges used: (i) on-board chargers, which are often designed for small size and low weight with the usual downside of providing a slow charge, and (ii) dedicated fast chargers that can be used in designated locations such as charging stations. For EV charging, various methods are used, such as constant current (CC), constant voltage (CV), constant power (CP) or a combination of these methods [1,3].

With the recent advances in battery technology [4–7], the autonomy of EVs has increased to well over 200 km and it will probably continue to increase over the next few years. However, EV drivers are still faced with many challenges related to battery life, battery charging time and especially the availability of charging stations. Thus, numerous pilot projects exist for implementing inductive charging on designated road sections, such as parking areas, traffic light stops or airport road segments for electric buses [8,9]. Until the technology becomes mainstream, EV drivers will still depend on fixed charging points.

One solution for this problem could be a decentralized network for battery charging or swapping, where users or charging stations can trade energy or batteries. Moreover, such a decentralized network can also be used by autonomous (self driving) vehicles (a new trend in vehicle development). These vehicles must be able to process a lot of information, so that the safety of the passengers is always ensured. Ideally, these vehicles should be able to communicate directly with other smart vehicles on the road and share information about traffic conditions, incidents, weather, etc. A method of machine-to-machine (M2M) communication is required so that true autonomy can be achieved. Since these vehicles are equipped with an array of sensors, one can perceive them as IoT (Internet of Things) devices.

To implement a decentralized IoT network of charging and swapping stations, which could allow even regular users to provide some of these services, some vital information is necessary, such as the type of batteries used in electric vehicles, the possibility of swapping these batteries, the state of the battery (charge cycles, health, remaining capacity, etc.) and the location of the stations and their availability of charging and swapping services. Such a system can be implemented using IoT, by monitoring the battery parameters while driving and warn the user when a charge is necessary. Due to the fact that the security of IoT applications is essential, new strategies have to be used to offer high security and reliability for IoT networks.

Blockchain is a novel technology, which was first introduced in 2008 as the underlying network architecture for the cryptocurrency Bitcoin [10]. The technology created an environment for secure, anonymous transactions, using a decentralized network of devices [11]. The main goal of the architecture was to create trust between the participants without the regulation of a central authority [10]. This technology has found many applications outside the financial world. Wang et al. proposed a decentralized electricity transaction model for microgrids, defining a continuous double auction mechanism directly between the buyer and the seller, while continuously adjusting the energy price according to market changes [12]. In [13], Khan et al. proposed and developed a method for validating microgrid transactions using signatures of multiple producers based on their attributes. These signatures are verified by consumers with matching attributes, without the regulation of a central authority. Wu and Tran presented an overview for blockchain technology in sustainable energy systems, describing different scenarios for blockchain use in energy systems [14]. In [15], Miller proposes a survey for the use of blockchain and IoT technologies in the industrial sector, providing solutions for supply chain management, autonomous vehicles and manufacturing plant asset management. Florea proposed a blockchain data provider, using IOTA to integrate IoT devices to create a decentralized data provider [11].

One of the main problems of IoT has always been the security of the communication between the devices. Son et al. proposed a directed acyclic graph (DAG)-based IoT protocol, using IOTA for securing IoT applications [16]. Odysseas and Gialelis introduced a IOTA-based sensor node system [17], while Bartolomeu et al. used IOTA for vehicular applications [18].

This paper presents a blockchain application for electric vehicles' (EVs) battery charge and swap, considering two approaches: custom Ethereum blockchain and the IOTA public tangle. For both scenarios, the performance of the system is analyzed, highlighting the advantages and disadvantages of each method. The application is tested using lithium-polymer (LiPo) batteries driving DC motors in an environment similar to that of an EV. The battery voltage and state of charge (SOC) is continuously monitored and the data are stored on the blockchain, together with the required functionalities, such as user and battery information and charge/swap requests.

In the following sections, the paper will present the general background knowledge for blockchain, smart contracts and the IOTA tangle (Section 2), electric vehicles batteries and SOC estimation (Section 3), the proposed application structure and test build (Section 4), followed by the results and comparison between the two proposed methods (Section 5), the general discussion and the conclusions (Sections 6 and 7).

#### **2. Background**

#### *2.1. Blockchain and Distributed Ledgers*

Since the introduction of blockchain in 2008, blockchain and cryptocurrencies have become mainstream terms. The technology proposes a network similar to that of a distributed ledger technology(DLT). Specifically, it implements a peer-to-peer (P2P) network of distributed data sets shared over multiple locations, where every change in the ledger is reflected in all copies on the network [19]. This means that once a change is submitted by one of the participants, it must be validated and approved by the entire network before it is added to the ledger. To achieve this, a consensus mechanism is required, so that the information, once accepted, cannot be altered by any user or group of users. Different implementations of the blockchain technology provide different methods of consensus, but in most cases consensus is achieved by means of cryptographic functions.

The first blockchain application was introduced in [10], where the cryptocurrency Bitcoin was introduced, with the goal to replace the trust provided by a 3rd party with proof. The term *blockchain* suggests that the network consists of a series (or *chain*) of *blocks*, linked together by means of a cryptographic hash function (Figure 1). Each block can have multiple transactions (Tx1, Tx2, . . . ). When a new block is created, the corresponding transactions are stored as a Merkle tree (or hash tree), where each leaf (data) node is labeled with its cryptographic hash and each non-leaf node is labeled with the hash of the labels of its children [20]. When the block is created, only the root node of the hash tree is included in the block, which allows for old blocks to be compacted. Each new block includes the reference to the previous block hash. The network participants (or *miners*) will generate the corresponding hash of the new block with the restrictions imposed by the consensus algorithm (difficulty of the hash function). The miners can inject a *nonce* in order to find a resulting hash that respects the network specifications. Once this hash is created, the new block is added to the chain and the other users must validate and approve the block by verifying the generated hash. Once the block has been confirmed by the network it can no longer be changed, as any change on the block (or any of the previous blocks) will invalidate the computed hash and will be rejected by the network. In this way, data immutability is achieved, which is one of the main advantages of blockchain technologies because it ensures that no single entity can have control over the data.

**Figure 1.** Typical blockchain structure [10,11].

On public blockchains, especially in the cryptocurrency applications, incentives are provided for network participants as rewards for discovering new blocks (generating the block's hash function). The user (miner) that submits the valid block is rewarded using a token specific for each platform. These tokens can be used in further transactions on the blockchain or even be exchanged for fiat currency. This method of submitting and verification of new blocks (consensus) is called *proof of work* (POW).

#### *2.2. Ethereum and Smart Contracts*

With the rapid development and adoption of the Bitcoin model, the need for an automated transaction model was evident. In 2014, the Ethereum platform was launched, introducing *smart contracts* to the blockchain [21]. The term *smart contract* was first introduced in [22] as a set of promises, defined in digital form, including the protocols within which the parties will perform them. Ethereum uses the same basic consensus mechanism of POW where the network nodes continuously mine new blocks by means of their hash function. Similar to Bitcoin, a network token is used as an incentive for the network participants, rewarding the node who successfully generates a valid block by a number of tokes (ETH). To support this reward system and keep the network running, any participant who submits a transaction to the blockchain pays a fee, called *gas*, in the same way that banks charge their clients a transaction fees for their operations.

Transactions on the Ethereum blockchain can be created either externally or by smart contracts, introducing the concept of functions to the blockchain [21]. Smart contracts are programs that are recorded and verified on the blockchain (Figure 2). Once the contract is deployed, its code cannot be altered, thus ensuring that the initial conditions will always be respected for any future executions. Just like real world contracts, a smart contract on the blockchain is created between two parties and is executed once some triggering event is set, such as a deadline or a specific target value being reached. In [23], the architecture and applications of blockchain smart contracts are described.

**Figure 2.** Smart contract anatomy.

Many blockchain implementations provide languages for the development of smart contracts to a certain extent of Turing-completeness. Ethereum, the most popular platform for smart contract and decentralized apps (dApp) development, introduced Solidity, a Turing complete language that allows the creation and deployment of smart contracts on the blockchain [21]. The code of the smart contract is written and compiled using the available language for each specific platform. A contract can have two main attributes: value and state [23]. Once the contract has been created and deployed, users can create calls (*execute*) to the contract functions. These calls can either query the contract state (*read* operations) or make changes which will result in a different state (*write* operations).

In Ethereum a very important difference must be made between these two types of functions. Calling (reading) a contract function is processed immediately, since they are executed locally without consulting the network, by accessing the current state of the blockchain. For this reason, *calls* do not require gas for their execution (they do not involve any fees).

Verified transactions have the potential (although not mandatory) to change the state of the contract (writing data). These types of executions must be validated by the entire network and the new state of the contract must be agreed upon. Since the data are processed by the entire network, these function calls require gas, which is determined by the number of computational steps and the amount of data which is handled by the contract [21]. These transactions are included in blocks (mined),data are and the change is reflected on the network once the new block is added to the blockchain (a new consensus is reached).

When a verified transaction is submitted it can have the following outcomes based on the amount of gas that is assigned for the transaction [21]:


On a privately owned network, the gas limit and cost can be controlled so that the users do not run into these problems or their impact will be reduced. Furthermore, for specific applications, a possible solution to the gas-related costs could be the implementation of a semi-decentralized (permissioned) blockchain, where the cost of gas (processing) can be supported by one or more trusted nodes. This will be the network topology proposed in this paper.

#### *2.3. IOTA Tangle*

Since the blockchain consists of a series of blocks linked together by means of their cryptographic hash, when the number of transactions increases, the difficulty of the hash function also increases, which means that the creation of new blocks will require longer times and greater processing power [24]. This is currently one of the main drawbacks of public blockchain networks. The so-called *mining* operation is a required mechanism to achieve consensus between all participating nodes. To overcome the resource intensive protocols that are implemented by most platforms, various other consensus methods have been proposed. In [25], a comprehensive study of available and proposed consensus methods is presented. Regardless of the consensus mechanism employed, the scalability of the blockchain will still remain an issue due to the linear fashion in which the data are stored. For data-driven systems, which require a large number of data points, such as IoT applications, this limitation may become an issue. To overcome this issue a novel approach was introduced by the IOTA foundation [26].

The IOTA network was specifically designed with IoT applications in mind, proposing a different method of organizing the transaction data, by using a directed acyclic graph (DAG) instead of a linear blockchain. The IOTA DAG is often referred to as *the tangle*. Its main characteristic is that it allows zero-fee and zero-value transactions [26] (Figure 3a).

(**a**) The tangle (**b**) Transaction validation path **Figure 3.** IOTA structure [11,26].

IOTA uses a trinary representation of data, as opposed to the usual binary system. Balanced trinary data can have the following states: 0, 1, or −1 (trits). Similar to how 8 bits form a byte, in IOTA 27 3 3 from a tryte. IOTA uses special trinary hashing functions for data encoding and POW, which are described in [26].

In the usual blockchain implementation, the users have to perform the POW continuously until a hash is successfully found. This is a power-intensive operation that discourages new users from competing in the mining phase. In IOTA, each new transaction (*tip*) is attached to two previous transactions that it must validate by performing the necessary POW. In this manner, POW is only necessary when a node wants to create a new transaction on the network, thus validating two previous transactions. This means that the node that actually initiates the transaction is the one that computes the POW hash. This allows the elimination of network fees, since it is in the interest of the initiating node for its transaction to be completed. Hence, the network fee is replaced by the "on-demand" POW computation. Since a new transaction validates two previous transactions, the scaling problem can be successfully solved, because more transactions on the network result in more validated transactions.

Once a new transaction is attached to the tangle it also confirms all the previous transactions referenced by the two former tips to which it was attached. This creates a validation path (Figure 3b), which increases the trust for all the transactions inside this path. The IOTA network employs a Markov chain Monte Carlo (MCMC) method of choosing the tips to which the new transaction is attached [26].

#### **3. Electric Vehicles Batteries and SOC Estimation**

The battery is the single most important component in an EV. Most of the weight of an EV comes from the battery pack, so an efficient battery system, together with an optimized consumption model, are crucial in electric vehicle development. Most EV models use lithium-based batteries (lithium-ion, lithium-polymer, lithium-iron-phosphate) [27,28].

The energy requirements and number of battery-operated systems have changed drastically over the last decade. Thus, a real battery management system is required for most battery-operated applications and appliances. One of the most important parameters of a battery is the state of charge (SOC), which represents the available battery capacity. SOC can be influenced by a very large number of factors: battery chemistry, age, temperature, load characteristics, etc.

State of charge estimation methods vary depending both on the type of battery and on the application where it is used. In [29], various methods of SOC estimation and their applications were presented. The authors concluded that the most used technique is the Ampere-hour counting, because of its ease of implementation and good-enough results, but other methods, such as linear modeling, Kalman filter, or artificial intelligence could be used, provided that the system can provide the necessary computational resources or training data.

In [30,31] the authors compared the available methods for lithium-ion batteries with specific applications for EVs. According to the authors, the best-suited methods for EV applications are the electrical circuit model (ECM) or the Kalman filter (KF) model. Machine learning and artificial intelligence models, although very accurate, are not well suited to the field of EV due to the high computational costs involved.

In this section two methods will be briefly presented: the Ampere-hour (Ah) counting and the open circuit voltage (OCV) estimation.

#### *3.1. Ampere-Hour Counting SOC Estimation*

The Ah counting (or Coulomb counting) method has become an industry standard and one of the most used methods for SOC estimation, because of its accuracy for short-term calculations [30]. The Ah method defines the SOC as:

$$\text{SOC}\left(t\right) = \text{SOC}\left(t\_0\right) + \frac{1}{\mathcal{C}\_n} \int\_{t\_0}^{t} I\_{\text{battery}} d\tau \times 100\text{\%} \tag{1}$$

where *SOC* (*t*0) is the initial state of charge, *C<sup>n</sup>* is the nominal capacity and *Ibattery* is the charging or discharging current of the battery [30].

The method is very simple, but it does not take into account the loss current. If the battery current is measured incorrectly, the method will accumulate the measuring errors. This can be compensated by better measuring techniques and sensors.

Taking into account the loss current, Equation (1) could be rewritten as:

$$\text{SOC}\left(t\right) = \text{SOC}\left(t\_0\right) + \frac{1}{\text{C}\_n} \int\_{t\_0}^{t} \left(I\_{battery} - I\_{loss}\right) d\tau \times 100\%\_{\prime} \tag{2}$$

where *Iloss* is the current consumed by loss reactions [31].

In order to use this method, the initial SOC must be known. If it is not known, or it is incorrectly estimated, the errors will accumulate throughout the process. This method is generally used in combination with other methods to improve the estimated result.

#### *3.2. Open Circuit Voltage SOC Estimation*

The OCV method uses the battery open circuit voltage as a function of the SOC by means of a polynomial equation or look-up table. The SOC is determined as a reverse function of OCV [30]:

$$\text{SOC}\,(t) = f^{-1}\left(\text{OCV}\right). \tag{3}$$

The open circuit voltage is continuously measured and the corresponding SOC is obtained using a look-up table specific for each battery type. The accuracy of the method can be very good if enough rest time is provided to estimate the SOC. Therefore, it is not ideal for real-time operation. The method can be used to calibrate the Ah counting Equation (1). Different OCV measurements can be obtained for the same battery under different charging or discharging currents, so the method may not always provide the same result, depending on the C-rates of the charging/discharging process [30].

In the following sections the OCV method is used for SOC estimation, because of the available battery data (look-up tables and empirical measurements). The proposed blockchain application will base its logic around the computed SOC values that can be improved by different estimation methods and measurement techniques.

### **4. Proposed Application for EV Battery Charging and Swapping**

### *4.1. System Diagram*

The proposed battery swapping and charging system is described in Figure 4. Each EV will have an on-board computer, which will monitor the battery data and send the information to the BMS application. Since the on-board computer may not have sufficient resources for computing the POW hashing functions, the charging stations will act as peers on the implemented blockchain and the transactions will be handled by the stations (computing the necessary POW).

The users can register on the system, add new batteries, and create charge or swap requests. These requests are handled by a smart contract and are deployed on the network.

Two blockchain implementations will be implemented and analyzed: a customized Ethereum blockchain (Section 4.4) and the IOTA tangle (Section 4.5).

**Figure 4.** The proposed battery charging and swapping system diagram.

#### *4.2. Battery Level and SOC Monitoring*

For the purpose of developing and testing the application, lithium-polymer (LiPo) batteries were used because of their high current and discharge rates, which make them a common solution for EV battery packs.

Four LiPo batteries were chosen:


The chosen SOC estimation method is the OCV. The voltage-SOC table (Table 1) was created using available LiPo look-up tables and checking them empirically.

To extend the life of the battery pack and to avoid deep discharging of the battery [32], it is recommended to remain outside the highlighted area. The data were mapped with a minimum safe battery voltage (*Vmin*) of 3.5 V/cell (7.0 V/cell for two cells and 10.5 V/cell for three cells). Three approximations [33] were considered: linear, symmetric sigmoidal, and asymmetric sigmoidal.


**Table 1.** LiPo Voltage-SOC (state of charge) table.

The highlighted values represent the unsafe battery operating range.

The linear approximation is described by the following relation:

$$\text{SOC} = \frac{V - V\_{\text{min}}}{V\_{\text{max}} - V\_{\text{min}}} \,\text{\,\,\,\text{}}\tag{4}$$

where *V* is the battery voltage, *Vmax* is the maximum voltage (for 100% charge), and *Vmin* is the minimum safe voltage, as described in the previous paragraph.

The symmetric sigmoidal approximation was fitted using a 4-parameter logistics function (4PL):

$$SOC = d + \frac{a - d}{1 + \left(\frac{V\_{normalized}}{c}\right)^b} \,\prime \tag{5}$$

where:

$$V\_{\text{normalized}} = \frac{V - V\_{\text{min}}}{V\_{\text{max}} - V\_{\text{min}}} \,\prime \tag{6}$$

and the parameters *a*, *b*, *c*, and *d* have the following meaning: *a* and *d* control the position of the horizontal asymptotes (upper and lower, respectively), *b* controls the slope of the response, and *c* controls the position of the transition region [34].

The asymmetric sigmoidal approximation was fitted using a 5-parameter logistics function (5PL):

$$\text{SOC} = d + \frac{a - d}{\left[1 + \left(\frac{V\_{normalized}}{c}\right)^b\right]^{\mathcal{S}'}} \tag{7}$$

where *a*, *c*, and *d* are defined in (5) and *Vnormalized* is defined in (6). In this case, the *b* parameter solely controls the approach to the top asymptote and together with *g* controls the approach to the bottom asymptote [34].

Using curve fitting tools, the parameters for the 4PL function were determined as: *a* = 0, *b* = 2.9, *c* = 1/1.9, and *d* = 112. With these values, Equation (5) becomes:

$$\text{SOC} = 112 - \frac{112}{1 + \left(1.9 \cdot V\_{normalized}\right)^{2.9}}.\tag{8}$$

In the case of the 5PL function the parameters are: *a* = 0, *b* = 8, *c* = 1/3.5, *d* = 270, and *g* = 0.045. With these values Equation (7) becomes:

$$SOC = 270 - \frac{270}{\left[1 + \left(3.5 \cdot V\_{normalized}\right)^8\right]^{0.045}}\tag{9}$$

The voltage data in Table 1 are plotted together with the three approximations in Figure 5 for a 2-cell battery, with *Vmax* = 8400 mV and *Vmin* = 7000 mV.

It can be noted that both the 4PL (Figure 5b) and 5PL (Figure 5c) approximations provide good results, while the linear approximation (Figure 5a) is not suitable for SOC estimation of LiPo batteries. In the next section the 4PL approximation is chosen, as it requires less computational effort with very good results.

#### *4.3. Battery Monitoring System*

The battery monitoring system should be available on any registered EV. For this application, the BMS measures the battery voltage and, using Equation (8), estimates the remaining charge. The data are processed by a micro-controller and sent via I2C (inter-integrated-circuit) communication to an on-board computer (in this case a Raspberry Pi), which generates the transaction and submits the data to the blockchain network.

A monitoring board (Figure 6) was designed and implemented. An ATMega164p micro-controller is used to measure the battery voltage and compute the SOC using the 4PL approximation (8).

The board monitors all four test batteries simultaneously, which can also power the microcontroller using the power switch. The battery voltages are read from the analog pins of the microcontroller (A0–A3). Since the battery voltages are higher than the 5V accepted by the microcontroller, the voltage is adjusted using voltage dividers.

For the 3-cell batteries the voltage dividers are formed using *R*1 and *R*2 (*R*3 and *R*4 for the second battery), providing a ratio of 3.12. The divider ratio for the 2-cell batteries is 1.68 (*R*5 and *R*6 for the 3rd battery and *R*7 and *R*8 for the 4th).

**Figure 6.** Battery monitoring board.

For the 3-cell batteries the read voltage ranges between 0 and 4.03 V and for the 2-cell batteries between 0 and 5 V.

The microcontroller transmits the data to the Raspberry Pi via I2C communication. The data are averaged over a series of 60 samples and the blockchain transaction is created. The anatomy of the transaction depends on the blockchain implementation and will be detailed in the following sections.

A battery test bed was designed and implemented (Figure 7), using a Raspberry Pi as an on-board computer for collecting the battery data and relaying the information to the blockchain.

**Figure 7.** Battery test bed.

The transactions are created using the Python libraries Web3.py (Ethereum) and PyOTA (IOTA). These libraries implement the necessary functions for creating and submitting the transactions for their respective networks. The methods for each implementation will be described in their respective sections below.

For user interaction, a web application has been developed using NodeJS and the libraries specific for each platform (Web3.js for Ethereum and iota.js for IOTA). The web application allows the users and stations to register on the network, add new batteries and manage their requests.

The overall system architecture is presented in Figure 8.

**Figure 8.** The blockchain interface for the proposed battery swapping and charging system. POW: proof of work.

#### *4.4. Ethereum Blockchain*

The first implementation of the charging/swapping application uses a smart contract deployed on a custom Ethereum blockchain.

In Ethereum, participating nodes have to perform POW to discover new blocks. To motivate users into participating in the block discovery process, a transaction fee (called *gas*) is paid by the user submitting the transaction. On the public chain the gas cost can be very high depending on the payload of the transaction. This makes the public Ethereum chain not well suited for data transactions, such as IoT applications.

On a customized chain, the gas cost and difficulty of the hash function can be controlled, in order to be used for specific applications, such as the battery management of electric vehicles.

On the main network any user with sufficiently capable processing resources can join. In a custom deployed network user access can be handled according to the application needs, thus allowing the implementation of permissioned blockchains.

In this paper, a permissioned network is created where the registration of new users or charging stations is handled by a master node. This creates a semi-decentralized network, but it can provide certain advantages, which will be highlighted in this section.

Users of the network are the EV owners. The EV computer (Raspberry Pi in this study) will sync to the network in light mode, where only the current state of the network and block headers are synced. For all processing operations a light node depends on the full node peers on the network (it does not take part in the *mining* process). The semi-decentralized structure ensures that there is at least one full node that is the master node of the application. Transactions and the necessary POW are handled by the charging/swapping station nodes, which will be synced as full nodes on the network.

When a user or station registers on the network via a web application, the master node creates a new address on the blockchain, which will be used to identify the user. The newly created address is stored and managed by the master node.

The registration process is handled by a smart contract deployed on the network. The proposed smart contract is described in Figure 9.

**Figure 9.** The smart contract structure.

The user management section provides the functions for registering new users or stations and for displaying their information.

The user and station information are stored inside the smart contract using the following structure:

```
struct User {
uint id;
uint balance ; // user balance
uint8 userType ; // user or station
bool set ; // differentiate between unset and zero struct values
}
```
Upon registration, each user will have a unique id generated (similar to the primary keys in relational databases) and it can have an initial balance of virtual tokens that can be used to perform transaction on the network. The userType field specifies if the user is an EV owner or a charging station.

Each user or station is associated with an address by using a special mapping type, which maps the user address to the user data. All users can be accessed through the user variable.

```
mapping ( address => User ) public users ;
```
The newUser function has the following prototype:

```
function newUser ( address _address , uint8 _type ) public
```
The function checks if a user with the specified address exists. If the address is not found, a new user object is created and its mapping is assigned. The newUser transaction is shown in Table 2 and the result is described in Table 3. The new user has an initial balance of 50 tokens.

In Table 2, the **From** address is different from the new user address (in the **Decoded input** field). The **From** address is the address of the master, as this is the node that actually creates the transaction. In this way, the gas cost required by the transaction is actually paid by the master instead of the user.

The gas used for this transaction would correspond to 0.00234 ETH on the main Ethereum network. For an ETH price of 258 USD (as of May 2019) the transaction cost would be around 0.60 USD. By running a separate network and allowing only mining nodes to submit transactions, the user is not required to have an actual Ethereum token (ETH) balance. Table 3 shows that for a **call** (read) operation, there is no cost involved, as the function only queries and returns the user data.


#### **Table 2.** New user transaction on the Ethereum blockchain.

#### **Table 3.** New user result on the Ethereum blockchain.


Once users are registered they can add new batteries for their EVs. The battery information is stored in a structure as follows:

```
struct Battery {
uint id;
bytes32 manufacturer ; // eg. Yuki
bytes32 model ; // eg. Radium
bytes32 batteryType ; // eg. LiPo
uint32 capacity ; // eg. 800 ( mAh )
uint8 cells ; // eg. 2
uint manufactureDate ; // Unix timestamp
uint32 maxChargeCount ; // eg. 200
```
*Sustainability* **2020**, *12*, 3984

```
bool set ; // differentiate between unset and zero struct values
}
```
The newBattery function has the following prototype:

```
function newBattery ( address _address , bytes32 _manufacturer , bytes32 _model ,
bytes32 _batteryType , uint32 _capacity , uint8 _cells ,
uint256 _manufactureDate , uint32 _maxChargeCount ) public
```
The function requires the battery owner's address (which was provided after registering) and the battery information. The resulting transaction is presented in Table A1. Since the amount of data written to the contract is much higher than the newUser transactions, the gas cost is almost double.

When a battery runs low, the user can manually submit a charge or swap request to the contract newRequest method (Table A2):

```
function newRequest ( address _address , uint _batteryId , uint8 _requestType ,
uint _timestamp ) public
```
The \_requestType parameter specifies if it is a charge or swap request. Note that the request does not specify a specific station. All stations can view the request and whichever one can provide the requested service can accept it (Table A3). The function acceptRequest has the following definition:

```
function acceptRequest ( address _address , uint _userIndex , address _station ,
uint _stationIndex , uint _approved ) public
```
where the \_address and \_userIndex represent the user address and their battery identifier is used to locate the battery in the structure mapping; the \_station and \_stationIndex are used to specify the station's battery and the \_approved parameter is the timestamp of the approval. The function changes the owners of the two batteries and the change will be reflected on the network once the transaction is confirmed. The result after the request is accepted is presented in Table A4.

The previous requests are created by the users/stations using the web interface. The battery information is submitted by the on-board computer and the data are stored in the smart contract using the following structure:

```
struct BatteryData {
uint id;
uint8 SOC ; // percentage
uint32 voltage ; // mV
uint32 chargeCount ; // eg. 7
uint timestamp ; // eg. 1562662637000
bool set ;
}
```
The Raspberry Pi collects the data and averages them over 60 samples (30 samples/minute). The newData contract function is called from the Python script:

```
function newData ( address _address , uint _id , uint _index , uint8 _soc ,
uint32 _voltage , uint32 _chargeCount , uint _timestamp ) public
```
where the \_address, \_id, and \_index parameters are used to identify the user and the battery, \_voltage and \_soc are the actual measurements, and \_chargeCount and \_timestamp are the current charge count and the date and time of the measurement.

In this section, a full implementation of a battery swapping/charging system is described, using an Ethereum smart contract on a custom network. This approach allows further actions or improvements to be added to the smart contract, while the transaction costs are supported by the master node due to the semi-decentralized, permission-based approach.

Using the same contract on the main Ethereum network would be unfeasible, due to the high transaction costs (gas). The nature of the application is perfectly suited for a permission-based network, since the aim of the application is to transfer data rather than tokens on the blockchain.

#### *4.5. IOTA Tangle*

The Ethereum implementation uses the power and flexibility of smart contracts to implement the application logic on the blockchain ensuring that all nodes run the same code and data immutability.

The first difference between IOTA and other blockchain platforms is the way the data are stored (directed acyclic graph vs. linear chained blocks). This solves the scalability issue by linking a new transaction to two previous transactions by validating them, as described in Section 4.5.

Since the IOTA network does not have transaction fees, the implementation can run on the public network. One important disadvantage is that IOTA does not (*yet*) support smart contracts, and thus the application logic has to be handled by a master node, resulting in a semi-decentralized system. In this case, the master node has to perform extra operations to extract and filter the data from the tangle, whereas in the Ethereum version these operations were handled directly by the smart contract functions.

To implement the required functionality, the transaction structure is used (Table 4) by routing the different types of transactions to their specific actions.



To route the transaction to specific actions, the **tag** field is used, similar to a function call of a smart contract. Based on this the application will filter the data and assign it to the appropriate structures.

For example, the equivalent of the newUser operation from the Ethereum implementation would have the structure described in Table 5.

The tag field specifies the action of the transaction. Since the application is running on the public development network, any user can create a transaction with this tag. However, since all transactions are still handled by the master node as the sender, the application will only filter its own transactions from the tangle.

Since the IOTA implementation uses only raw transactions, their structure for the other operations are similar to the one presented in Table 5. Each operation has a corresponding tag field: IOTABMSNEWUSER for the new user transactions; IOTABMSNEWBATTERY for the new battery operation; IOTABMSNEWDATA for battery data information; and IOTABMSNEWREQUEST and IOTABMSACCEPTREQUEST

for the request operations. Because the IOTA implementation uses the public Devnet tangle, these tags can be used to examine the transaction details at https://devnet.thetangle.org.

For this implementation, the monitoring board collects the data over 60 samples, at the same rate of 30 samples/minute. The data are stored directly on the tangle, so the Raspberry Pi has to create a new transaction using the ProposedTransaction class from the PyOTA Python library:

```
tx = ProposedTransaction (
address = Address ( IOTAAddress ) ,
value =0 ,
tag = Tag (b' IOTABMSDATA ') ,
message = TryteString . from_string ( IOTAJSONData )
)
```
where IOTAAddress is the address of the master node and IOTAJSONData is a JSON object containing the measurement information, with the same properties as the newData function from the Ethereum implementation. The ProposedTransaction object is a transaction that was created locally and has not yet been submitted to the network. To actually broadcast the transaction, the send\_transfer function is used:

```
IOTAApi . send_transfer (
depth =3 ,
transfers =[ tx],
min_weight_magnitude = 14 ,
inputs = BatteryAddress
)
```
where BatteryAddress is the address of the registered battery (acting as the sender of the message), depth is the maximum depth in the tangle for the tip selection mechanism, and min\_weight\_magnitude is an optional parameter used to specify the POW difficulty. Note that the transfers parameter contains a list of transactions (in this case only one), since there is no value transferred between the two addresses. When transferring IOTA tokens, at least two transactions are required: one that adds tokens to the recipient and one that subtracts the same amount from the sender.

Ideally, the POW should be performed locally. However, the Raspberry PI does not have the necessary resources to compute the POW, so the transaction is handled by the master node of the system, which computes the validation hashes for two selected tips. If the master node is not reachable, the transaction data are stored locally and resubmitted when the connection can be established.

The biggest challenge and limitation of this implementation is the battery swapping operation. Since the swap request is not sent to a particular station (similar to the Ethereum implementation), the station that accepts the request has to do so by creating a new transaction. This new transaction has to somehow reference the swap request submitted by the user. Two solutions can be outlined for this problem: either reference the swap request transaction hash in the message field of the transaction, together with the rest of the information, or override the IOTA's tip selection mechanism and attach the acceptRequest transaction directly to the related request transaction using the trunkTransaction or branchTransaction fields (Table 4). For this implementation, the first method was preferred.

The main difference between the IOTA implementation and the Ethereum one is that the code which handles the data storage and processing is not contained in a smart contract (distributed across all nodes), but runs solely on the master node. This makes the IOTA implementation more centralized than its Ethereum counterpart, due to the fact that the master node still represents a single point of failure for the application.


**Table 5.** New user transaction on the IOTA tangle.

In the case of smart contracts, the corresponding function is executed whenever a transaction is submitted. In the IOTA implementation the master node has to monitor the network state continuously using the transaction **tag** field and decide which function should be executed locally. Here, the tangle is used only as a decentralized data storage (instead of a traditional database management system). When the user wants to access the information from the web application, the master node queries the tangle for the raw data and any necessary processing is done before presenting the data to the user.

Off-chain processing is recommended when working with distributed applications, since computational power is expensive on any blockchain implementation, but it is much more difficult to work with unstructured data than with organized data structures achieved through smart contracts.

One important difference between the IOTA implementation and the Ethereum counterpart is the fact that Ethereum requires at least two full nodes (the master node and at least one charging station) to perform the POW and create new blocks on the network. In IOTA, the charging stations can be connected to the tangle, but this is not mandatory, since the actual POW is done by the device that creates the transaction (the master node in this implementation). This reduces the setup time and the necessary hardware requirements for the stations, but has the downside that if the master node is not available, the system may encounter some down-times.

#### **5. Results**

Figures 10 and 11 show the voltage and state of charge plots for a 2-cell and 3-cell battery, respectively. These results are obtained directly in the front-end application and can be viewed by the users. They can help improve the SOC estimation by accounting for battery age and other environmental factors, and possibly allow stations or users to properly service or replace batteries in

safe operating conditions. It can be noted that the SOC vs. Voltage plot (Figures 10c and 11c) is similar to the theoretical 4-PL approximation in Figure 5b, which is the expected result.

To compare the two implementations, the transaction times were measured for a set of 500 transactions submitting new battery data (Figure 12). For the Ethereum blockchain (Figure 12a), running with two mining nodes (one master node and one charging station), the time from submitting a transaction until its first confirmation by the network ranged between 1.65 and 75.45 s, with an average of 12.97 s per transaction. These confirmation times can vary depending on the network congestion, the number of operations required in the contract function and the difficulty of the network, which, in the case of a permission-based chain, can be controlled by the network administrator.

**Figure 12.** Transaction confirmation times.

For the IOTA tangle the results for the same transactions are presented in Figure 12b. It can be seen that the transaction times are slightly higher than the Ethereum implementation, with an average of 17.86 s and the minimum and maximum values of 3.78 and 104.14 seconds, respectively. These differences can be easily explained by the different approach of the two platforms. While in Ethereum, mining nodes perform the POW operations continuously, in IOTA these operations are performed only when a new transaction is submitted. In the proposed implementation the IOTA POW is not done locally due to the limited resources of the Raspberry Pi board. Instead, the required operations are performed by a public node outside the application infrastructure (in this case, the IOTA Devnet node). Depending on the load of the node and the network congestion, the expected transaction recording time can vary. However, the benefit is an easier setup and fewer resources necessary for the master and station nodes of the BMS application.

#### **6. Discussion**

The Ethereum blockchain demonstrates that the technology is mature enough to be used in many fields of industry, offering the possibility of developing any kind of application logic on the blockchain in a decentralized manner. The main disadvantage of this approach is the rather complicated setup required to deploy the blockchain and smart contract. Since the application would not be suited to function on the main network, due to the high transaction fees, the creation of a separate network is absolutely necessary. Hence, one advantage is the possibility to manage the network settings and difficulty, so that the response time can be reduced, compared to a transaction on the public blockchain. Another advantage, which will be considered in future works, is to setup the blockchain using a different consensus mechanism, such as proof-of-authority (POA), where designated nodes can add new blocks to the chain without requiring a swarm of mining nodes.

IOTA was considered as an alternative because of its zero-fee transaction model and its scalability, which allows the application to run on the main tangle with minimal additional setup. The lack of smart contracts is the main disadvantage of this approach, because the application logic has to be maintained by one or more central nodes and it is more susceptible to failures, while possible changes of the application may affect its overall functionality on the network. These problems could be resolved when smart contracts become available in IOTA (which were already announced as of 2019), but the implementation may provide additional difficulties that cannot yet be estimated.

The main problem of the proposed IOTA implementation is the tag-based routing system, which can be replicated by users not registered on the battery management application. This can be solved either by having one or more trusted nodes (or *oracles*) that will generate the transactions on behalf of their users (as proposed in this paper), or by using masked authenticated messages (MAM) [35] as a means to create direct channels of communication between data publishers (EV owners) and subscribers (stations). This approach will be further studied in future works.

Battery charging requests on IOTA can be easily created because they do not involve changing the ownership of the battery, but, without the capabilities of on-chain processing, swap requests can be more difficult to handle, as they require the front-end application to search through the transaction history to find the latest state of the requested batteries. Due to this fact, IOTA is better related to producer–consumer applications, where sensors or embedded devices are the data producers and the users query and use the data off-tangle (data flow is unidirectional).

An issue for any application which relies on user information and value exchange (tokens, electricity, batteries, fiat currency, etc.) must deal with the privacy issues that may arise from these interactions. Several methods can be considered, depending on the type of blockchain that is being used and on the visibility of the blockchain network. Feng et al. [36] and Jia et al. [37] introduced such methods that deal with blockchain privacy.

The Ethereum-based implementation presented in this paper uses a private blockchain network where user access control (UAC) methods can be implemented to protect the user information. Furthermore, sensitive user information can be encrypted using a private–public key mechanism.

The proposed IOTA implementation uses the public tangle; thus, MAM can be used to establish a direct channel between the involved parties when an exchange is requested (battery swap or driver-to-driver charging).

These issues are an interesting extension for this study and the authors plan on extending the results of the current paper with an in-depth study on blockchain data privacy and protection.

#### **7. Conclusions**

In this paper, a complete battery management system for electric vehicles was presented using blockchain technology to create a semi-decentralized network of electric vehicles and charging stations that are able to share data (battery information and condition) based on continuous monitoring.

Blockchain is a relatively young technology that has seen major growth and adoption in the last 10 years with the development of cryptocurrencies. The underlying architecture makes it a strong candidate for data-driven applications, such as electric and autonomous vehicles.

To analyze the feasibility of the proposed application, two distinct implementations were considered and tested: the first method uses an Ethereum blockchain, powered by a smart contract, which allows the distributed processing and sharing of data, while at the same time ensuring data immutability and privacy. The second approach uses the IOTA network, which lacks the support for smart contract development, but provides zero-fee transactions and is built with data-driven applications in mind, thus allowing better application scaling.

The results show that both platforms can be used for developing blockchain IoT applications having acceptable transaction confirmation times for the purpose of the proposed battery monitoring system, which does not require real-time confirmations. Ethereum is still the main platform for developing decentralized applications, which can be deduced from the large number of projects and research papers available. This may change in the future especially for IoT and data-driven applications, as alternative approaches specially designed for this field mature and become available.

**Author Contributions:** Methodology, B.C.F. and D.D.T.; implementation, B.C.F.; writing—original draft, B.C.F.; writing—review and editing, D.D.T. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Abbreviations**

The following abbreviations are used in this manuscript:


## **Appendix A. Ethereum Transactions**



### **Table A2.** New swap request transaction on the Ethereum blockchain.



**Table A3.** New accept swap request transaction on the Ethereum blockchain.


## **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

### *Article*

## **Implementing Blockchain Technology in Irrigation Systems That Integrate Photovoltaic Energy Generation Systems**

**Florentina Magda Enescu 1,\*, Nicu Bizon 1,2,3,\* , Adrian Onu <sup>4</sup> , Maria Simona Răboacă 2 , Phatiphat Thounthong <sup>5</sup> , Alin Gheorghita Mazare <sup>1</sup> and Gheorghe S, erban <sup>1</sup>**


Received: 29 December 2019; Accepted: 16 February 2020; Published: 18 February 2020

**Abstract:** Traditionally, the energy industry has been slow in adopting new disruptive technologies and the transition to a new energy market will require a new digital transformation plan, involving all parties from the energy market. Although it now seems to be an impossible and hard-to-accept scenario, especially by the big players in the industry, the pilot projects so far demonstrate that blockchain can play a major role in the future energy market, even if the technology is still in the first stages of the adoption life cycle. This article attempts to describe a solution to provide alternative irrigation systems for small farmers. The solution involves creating associations of small farmers that will use green energy from photovoltaic panels for the irrigation of agricultural lands. The efficiency of the proposed system can be monitored not only through digital hardware connected to photovoltaic panels and water pumps, but also by using the new blockchain technology that stimulates innovation and growth in the energy and a high level of automation though smart contracts. To accelerate the transition to the green energy economy, a SolarCoin version similar to the Bitcoin cryptocurrency has also been proposed, which is a utility token that creates new possibilities for energy and water trading.

**Keywords:** irrigation system; photovoltaic water pumping systems (PWPS); floating photovoltaic panels; SCADA; blockchain; SolarCoin

#### **1. Introduction**

It is expected that in about 12 years, more than half of the electricity produced in the European Union will come from renewable energy sources, and the decarbonization of electricity is expected to be achieved by 2050 [1]. Under these conditions, the entire energy industry will have to go through a massive transformation, which will affect everyone in the value chain from the production, consumption, distributors, and networks [2–5].

The use of solar energy in various applications has grown over the past few years, and the irrigation sector is one of its most appropriate uses [6–8]. Many agricultural producers are attracted to this solution as it helps to maximize their profits by reducing the costs of electricity or fuel [9–11]. In addition, during the cold season after the irrigation interruption, electricity obtained from the

photovoltaic panels can still be used at high capacity to supplement the energy required to run the farm [4,12,13]. photovoltaic panels can still be used at high capacity to supplement the energy required to run the farm [4,12,13]. Photovoltaic systems are ideal in isolated areas that do not have access to the national energy

Photovoltaic systems are ideal in isolated areas that do not have access to the national energy system. Below, the most important advantages of applying the photovoltaic systems in agriculture have been listed [14–16]: system. Below, the most important advantages of applying the photovoltaic systems in agriculture have been listed [14–16]: If the annual electricity consumption is known, then the photovoltaic system is easy to design

If the annual electricity consumption is known, then the photovoltaic system is easy to design because the network-connected systems have a small number of components and do not require too much space. because the network-connected systems have a small number of components and do not require too much space. Research has confirmed that plants can also work with unfiltered water or chemical fertilizers

Research has confirmed that plants can also work with unfiltered water or chemical fertilizers dissolved in water. dissolved in water.

Photovoltaic technology is getting cheaper. It does not rely on intense sunlight. The technology is simple enough to be easily implemented. Photovoltaic technology is getting cheaper. It does not rely on intense sunlight. The technology is simple enough to be easily implemented.

Irrigation is mandatory in obtaining profits from agriculture. Irrigation is mandatory in obtaining profits from agriculture.

When pumping water, farmers need energy, but energy distributors sell it at too high a price for farmers' incomes and they are not interested in using irrigation channels. When pumping water, farmers need energy, but energy distributors sell it at too high a price for farmers' incomes and they are not interested in using irrigation channels.

Existing irrigation channels have deteriorated over time due to abandonment, which can be due to bad intentions. Existing irrigation channels have deteriorated over time due to abandonment, which can be due to bad intentions.

This can be argued by the collection of images from a farm (see Figure 1) that resorted to these possibilities of realizing the irrigation of agricultural lands by using renewable energy, obtained with the help of PV (photovoltaic) panels [17]. This can be argued by the collection of images from a farm (see Figure 1) that resorted to these possibilities of realizing the irrigation of agricultural lands by using renewable energy, obtained with the help of PV (photovoltaic) panels [17].

**Figure 1.** Photovoltaic panels used for irrigation. **Figure 1.** Photovoltaic panels used for irrigation.

In the study carried out, the surplus of energy obtained in the months with a greater number of hours with brightness will not be stored in batteries but will be traded by cooperatives from which the farm is part to another cooperative or farm to the national system. In the study carried out, the surplus of energy obtained in the months with a greater number of hours with brightness will not be stored in batteries but will be traded by cooperatives from which the farm is part to another cooperative or farm to the national system.

Regarding the maintenance of the panels (cleaning), high costs are not necessary, and in the case of a large number of panels, there are automatic systems for cleaning by miniroboting [18]. The possible lack of the national energy system in the area where the farm (cooperative) is located must also be considered [19]. Regarding the maintenance of the panels (cleaning), high costs are not necessary, and in the case of a large number of panels, there are automatic systems for cleaning by miniroboting [18]. The possible lack of the national energy system in the area where the farm (cooperative) is located must also be considered [19].

Considering the adoption level of solar energy, it might be recommended for the small producers to make use of any additional income source, such as SolarCoin. Being based on blockchain technology [20–31], SolarCoin is global and decentralized, similar in many ways to cryptocurrency such as Bitcoin, but more efficient and environmentally friendly [32–34]. SolarCoin Considering the adoption level of solar energy, it might be recommended for the small producers to make use of any additional income source, such as SolarCoin. Being based on blockchain technology [20–31], SolarCoin is global and decentralized, similar in many ways to cryptocurrency such as Bitcoin, but more efficient and environmentally friendly [32–34]. SolarCoin stands out because, unlike other types of cryptocurrency, it ensures contribution to an economically and environmentally beneficial activity by vertically produced solar energy [35–37].

The study [38] has showed that despite the barriers to using blockchain technology, these technologies contribute to the Sustainability Development Goals by producing a series of changes and practices in various fields. In [39], the blockchain technology has been taken into consideration for an irrigation system.

We are proposing a software solution based on Ethereum blockchain and Distributed Ledger technology that aims to reduce the costs for farmers related to irrigation systems. A somewhat similar blockchain-based software platform was built and launched in Australia—Power Ledger (https://www.powerledger.io/) is a platform where businesses and consumers can trade energy peer-to-peer. The platform primarily caters to clean energy, such as wind and solar energy, that can be produced by individuals and businesses and then shared.

The main objectives and the novelty of this study are as follows:


Also, this study presents the energy production of a photovoltaic system that may be coupled with the proposed Photovoltaic Water Pumping System (PWPS) when more energy for irrigation is necessary.

Thus, the structure of the paper is as follows: Different possibilities of energy transaction's first advanced methods and Blockchain SolarCoin variant are presented in Section 2. The model of the energy consumption flow within a farmers' association is presented in Section 3. The experimental study for an irrigation system based on renewable energy is presented in Section 4. The design of the photovoltaic energy system needed to supply the water pumps and the SCADA system for the association, and the analysis of the energy generated by the photovoltaic system during a year are also discussed based on the main results presented in an appendix. The proposed approach to reduce costs for the system under study is presented and discussed in Section 5. The last section concludes the paper.

#### **2. Current State of Irrigation Systems**

Regarding the water balance in Europe, 44% of captured water is used for energy production, 24% for agriculture, 21% for water supply to the population, and 11% for industry [1]. However, this distribution varies depending on location; in southern Europe, for example, agriculture accounts for 60% of the total water captured, with the percentage even reaching 80% in certain areas [1].

It is supposed that with the change of rainfall regimes, some parts of Europe will have more freshwater resources in the future and other parts will not be able to cover the overall need.

Crop irrigation is an area in which innovative practices and new policies can significantly facilitate the efficient use of water. In southern European countries such as Greece, Italy, Portugal, Cyprus, Spain, and southern France, arid or semi-arid conditions require the use of irrigation. In these areas, almost 80% of the water used in agriculture is currently used for irrigation [1–3]. A methodology that allows an optimal estimation of water quantity and energy used in an irrigation system in Spain has

been presented in [4]. Another example, which has been verified in the long run by such a system, was developed by Daud and Mahmoud in Jordan [5]. The water is extracted from a well and the available average solar radiation is 5.5 kWh/m<sup>3</sup> /day. The tests proved the safety of the system with a general efficiency of more than 3%. This result was compared with similar studies that reported a high efficiency for photovoltaic solar water pumping systems [6–8].

In Romania, the situation is entirely different. The agricultural lands are large, there are many freshwater sources, and before 1989, Romania had an irrigation network spread over an area of 3.2 million hectares, which was almost entirely destroyed with the installations being stolen or left to waste. Most functional irrigation systems from 1989 have been dismantled and some have not even been built [3].

In May 2009, irrigation facilities for 563,000 hectares of agricultural land were in operation, of which 553,000 hectares (or 99%) were contracted by irrigation water user organizations [3].

In the irrigation field, Romania has a deficit of 2.6 million unrecorded hectares. In 2009 in Romania, 2.6 million hectares of land were unrecorded when it comes to irrigation statistics (today the area is even larger). According to these statistics, 300,000 hectares of land is irrigated, but in fact, there are only 100,000 hectares. Other sources indicate an irrigated area of 560,000 hectares [3].

For small farmers (usually with between 1 to 10 ha of land) located in areas with no electricity, it is appropriate and necessary to use funding opportunities for the purchase of mobile drip irrigation equipment (dripping or spraying) and for the insurance provision of electricity for the water pumps based on the photovoltaic panels [9–11].

Romania has one of the largest agricultural potentials in Europe, having a really high hydrological potential and a major advantage for organic farming (pollution of agricultural lands is still low compared to other EU countries).

Unfortunately, due to the destruction of the old irrigation system and the absence of a coherent governmental plan or other viable solution, a significant part of the agricultural area has been deserted.

To rehabilitate irrigation systems, high investments are needed, but besides that, there is the possibility for small farmers to not be able to afford purchasing water from rehabilitated irrigation systems, as the costs are high compared to the obtained incomes [17–19].

Although difficult to query for data in distributed databases, as stated in [39], they still provide fast processing. The biggest advantage of distributed ledger technology (DLT) is the ability to build trust in digital ecosystems [40].

Taking into consideration the security risks of a highly automated decentralized digital system for this kind of applications, the possible risks involved cannot be neglected. The Ethereum blockchain is one of the most used for deploying and running smart contracts, with lots of decentralized applications already in production [20–22]. As an open-source platform, it is already being code reviewed by the community, and thus it is one of the most secure platforms to run smart contracts on [23–25]. It is worth mentioning that all the software modules require core development principles, such as security in depth, unit testing, pre-and post-condition sanity checks, code consistency, and regular audits [26–28].

The performances of a photovoltaic system supervised by Supervisory Control and Data Acquisition (SCADA) system highlighted in [41,42] and the online surveillance on mobile applications as shown in [43] further accentuate the possibility of their application in this work oriented towards agriculture.

As has been shown, agriculture is facing problems due to water management and the cost of purchasing electricity. The work presented in [44] does not evaluate the performance of the blockchain technology applied in support of the community and the possibilities of communication with the blockchain network. The same is approached in [45] in managing the agro-food supply chain through the use of IoT of the consumption data.

How to use a water pumping system in irrigation system is fully described [46]. In this method, the water demands for irrigation are met and qualitatively analyzed, and energy products for

small producers;

rehabilitation of the existing irrigation system;

photovoltaic systems and the surplus of economic energy are redirected to the necessary coverage in the area. *Sustainability* **2019**, *11*, x FOR PEER REVIEW 5 of 33

So, an experimental study of renewable energy-based irrigation system is presented here in order to highlight the SCADA interfaces for a farmer and for the association, and the main features and advantages of the implemented blockchain-based application compared with the aforementioned proposals. So, an experimental study of renewable energy-based irrigation system is presented here in order to highlight the SCADA interfaces for a farmer and for the association, and the main features and advantages of the implemented blockchain-based application compared with the

The location selected for the study is located in the Oltenia area of Romania, a geographical area where the solar radiation is high, and the quantity of natural water is reduced. aforementioned proposals. The location selected for the study is located in the Oltenia area of Romania, a geographical area

It is an area with low potential both economically and socially. The analyzed area is considered as agricultural area. The cultivation of the land is the main means of existence of most families. According to the [47] existing irrigation system, "it worked partially year after year, in an increasingly advanced state of degradation: pumps and equipment were damaged, they clogged channels, some pipes were stolen directly from the field". where the solar radiation is high, and the quantity of natural water is reduced. It is an area with low potential both economically and socially. The analyzed area is considered as agricultural area. The cultivation of the land is the main means of existence of most families. According to the [47] existing irrigation system, "it worked partially year after year, in an increasingly advanced state of degradation: pumps and equipment were damaged, they clogged

With the help of the World Bank [47] the system was rehabilitated, but even after that it was only partially functioning due to the bureaucratic and impractical way of administration. The electricity subsidy needed to start the pumps, considered state aid, has been canceled since 2010, which has made it impossible for small farmers to bear the costs [47]. channels, some pipes were stolen directly from the field". With the help of the World Bank [47] the system was rehabilitated, but even after that it was only partially functioning due to the bureaucratic and impractical way of administration. The electricity subsidy needed to start the pumps, considered state aid, has been canceled since 2010,

This area features a photovoltaic park with high energy efficiency. Nearby there is a system with a non-functional irrigation channel with a high degradation status, which is not currently in use (see Figure 2). Farmers in the area do not have the possibility to use water for crop irrigation during the droughts of the year (spring-summer), even if the channel is supplied with water. which has made it impossible for small farmers to bear the costs [47]. This area features a photovoltaic park with high energy efficiency. Nearby there is a system with a non-functional irrigation channel with a high degradation status, which is not currently in use (see Figure 2). Farmers in the area do not have the possibility to use water for crop irrigation during the droughts of the year (spring-summer), even if the channel is supplied with water.

**Figure 2.** Images from the area where the study has been carried out. **Figure 2.** Images from the area where the study has been carried out.

The problem of rehabilitation of the channel and pumping stations has been raised, but the small farmers cannot accept the connection to these systems as the costs of running water in the channel are very high compared to their income. Considering the possibility of using renewable energy through photovoltaic panels, whose costs are in a continuous decline, their concentration in micro grids, and the possibility to establish from the beginning their profitability by tracking the production of the photovoltaic park near the pumping station, three possible irrigation solutions will be explored in this study: The problem of rehabilitation of the channel and pumping stations has been raised, but the small farmers cannot accept the connection to these systems as the costs of running water in the channel are very high compared to their income. Considering the possibility of using renewable energy through photovoltaic panels, whose costs are in a continuous decline, their concentration in micro grids, and the possibility to establish from the beginning their profitability by tracking the production of the photovoltaic park near the pumping station, three possible irrigation solutions will be explored in this study:

national energy system and this can be used by farmers to supply the water pumps for the

Energy supply from the national energy system for land improvements and water supply to


The first solution was already tried in another agricultural area in our country, by rehabilitating an irrigation system with European funds [47]. Considering the data presented in [48]—parliamentary report reveals the deterioration of the irrigation system—it is shown that in terms of the state of the pumping states, "they are mostly inoperative or require rehabilitation of a smaller or greater extent. On the whole of the analyzed areas, only five hours from the pumping stations are functional". It turned out to not be efficient, and the investment could not be amortized as expected. Water can be delivered to farmers, but at a high price. So, individual producers cannot afford it.

Innovations in electronics, information technology, as well as in energy storage solutions, allow the emergence of dispersed energy systems based on unconventional sources. The high costs and the random and intermittent nature of some of these energy sources make some a far-away alternative, or in other words, a possibility only in the future when there is no alternative, and the technologies of capitalization will be much more advanced, and of course, cheaper than they are currently. However, the prospect of capitalizing other forms of energy (unconventional energies) is very close, as they are also the energy hope of mankind. For these reasons, the latter solution is the most advantageous method to be accepted by small farmers and this can be demonstrated with this study.

#### **3. Comparison of the Advanced Methods for Energy Transaction**

SolarCoin represents an alternative digital coin that uses a Proof-of-Stake blockchain to stimulate solar electricity production [49–51].

The technology allows safe quantification of the amount of energy generated and used. SolarCoin owners—individuals or large solar panels—are proposing to build a currency transaction based on the assumption that electricity produced from solar energy is worth more in the world than its value in traditional energy markets [52–54].

SolarCoin represents tokens emitted in circulation when checking the production of solar energy. They can be traded just as normal cryptocurrency, being available at the moment on four different public crypto-currency exchanges. All the transactions are gathered, checked, and synthesized in specific blocks—which create the blockchain for the SolarCoin. It is a high-trust database underlying the project: A distributed, trustworthy, and verifiable ledger of the total energy produced by PV panels [55–57]. It remunerates the producers of solar power with blockchain-based tokens at a rate of 1 SolarCoin (SLR) for each 1 MWh of produced solar energy [58–60].

The technology behind the project is a POST (Proof of Stake Time) blockchain derived from the Vericoin implementation. Being an alternative to the proof-of-work blockchains, SolarCoin is more efficient than Bitcoin because it requires miners to solve computational puzzles [61–63].

SolarCoin is a zero-charge supplementary recompense, which does not depend on other stimuli that the producers of solar energy could receive (such as grants from the government, fixed green energy prices, tax reductions, green certificates, etc.). Anyone who produces solar energy in order to reduce CO<sup>2</sup> gas emissions can be rewarded with SolarCoin [64,65].

#### A. SolarCoin Economy:

The holder of a solar power plant is qualified to obtain SolarCoin as a zero-charge recompense for the generation of solar energy. For solar plants with a power of less than 20 kW, the right to coins lies with the consumer of the electricity produced rather than the financial holder [62,63].

### B. Working principle [66,67]:

Step 1: To qualify for a SolarCoin grant, owners must register their facilities through the SolarCoin Foundation. The registrations can be realized directly on the website of the foundation through a SolarCoin associate or through a tracking program.

The record includes evidence of plant ownership, network connection documentation (verifiable by an independent entity), solar power production parameters (e.g., meter readings), and KYC data (Know-Your-Customer).

Step 2: Upon completion of the registration, the foundation generates SolarCoin to the owner's SolarCoin digital wallet directly.

Step 3: SolarCoin is issued every six months to plant owners who are registered.

So, the SolarCoin will become a good/[an asset] with increasing liquidity, and it will be transparently released and tracked through blockchain, which can be stored in electronic wallets (e.g., mobile devices, computer) or offline (e.g., paper wallets).

Because environmental issues are getting more and more visible through the media (e.g., with the Amazon rainforest fires), green energy is getting more attention. This means more affordable photovoltaic panels, and that the SolarCoin demand and prices might go up in the following years, becoming additional revenue for solar power producers. Owners who generate solar energy could use/sell this energy and also obtain SolarCoin that can be reclaimed, exchanged, or used.

C. Profit SolarCoin [68]:

Use of the SolarCoin may be an important stimulant for the investors in solar energy in order to increase the capacity of production. Investors will take the commitment to put money into solar energy by relying on:


SolarCoin implements the remarkable features of blockchain technology in order to obtain a new situation:


Partnerships can also be rewarded with SolarCoin—all contributing to building the ecosystem. SolarCoin ensures the distribution of digital coins to a beneficial and real economic and environmental activity: Vertically produced solar energy. SolarCoin is, thus, able to develop into a special, limitless stimulus for solar energy, independently of any other national or local stimuli [69]. Also, it is worth mentioning that all of the transactions are clear and can be visualized by any user of the blockchain explorer. Due to their distribution, blockchains can diminish the cost and duration of transactions. More significantly, the blockchain technology is prepared to transform the value exchange, eliminating the requirement of having intermediate energy distributors or banks [70–72].

This being the context of the problem, the scope of this study is related to the development of modern land improvement systems at low exploitation prices in order to be accessible to all farmers [73–75]. Table 1 summarizes the main features of purchasing and, in turn, distributing the energy surplus produced in a household/association using photovoltaic panels.

Manufacturers can opt for the method they consider to be the one that can bring them a high profit from an economic point of view. When choosing the optimal solution, the following table might be helpful, but obviously, there are many other details to be taken into consideration, such as the location, the number of possible members of the association, the current status of the nearby irrigation channel, etc. [76–78].


**Table 1.** Characteristics of purchasing energy technologies.

The aforementioned features (see Table 1) of the possible implementation solutions are explored in the next sections of this study and compared with the proposed solution.

#### **4. The model of the Energy Consumption Flow within a Farmers' Association**

The association of farmers in the studied area, in the first stage, will acquire collective energy from the energy suppliers. The greater the participation in this association, the easier it is to estimate the consumption time (due to the law of large numbers) and thus the easier it is to negotiate a discount with the energy provider. At the end of the period, a balance sheet of the consumer profiles of the integrated users will be made. Profit earned by associates can be invested in the next year.

In the next stage, knowing the energy consumption, it is possible to estimate the electric energy needed by the association, and in these conditions, it can be purchased in the case of Romania directly from OPCOM (the Romanian Electricity and Gas Market Operator). Under these conditions, with the classic system, the association can obtain a profit that is invested in the acquisition of renewable sources that lead to independent energy, but also to energy storage solutions.

The solar radiation flux reaching the earth's surface has an energy potential corresponding to the impressive amount of 172 billion GW [79]. This energy source could permanently ensure the need for ever-increasing consumption. However, from a practical point of view, with regards to the actual volume that can be used, this becomes a very complex problem.

Photovoltaic water pumping systems (PWPS) consist of a series of photovoltaic panels, a motor, and a pump (Figure 3). Depending on the design, the system may contain batteries for storing electricity and charging the regulator. The motor is chosen according to the required power and the nature of the current provided by the system. If the motor uses alternating current, it is necessary to install an inverter. PWPS without an energy storage system are cheaper and require less maintenance compared to battery systems. Adding a water storage tank to the PWPS is a more economical method of storing energy than using a battery and useful if irrigation if possible, using gravity afterward. If the tank is built deep, some energy from the PWPS is required to take the water out. Photovoltaic solar energy is considered to be an important resource for regions of Romania where direct solar radiation can reach up to 1000 W/m<sup>2</sup> , even if some cost is involved, mostly due to batteries lifespan, panel maintenance (cleaning), and upfront costs [80].

Attention is paid to the daily variation of the volume of water pumped. A threshold value (at which the pump starts/stops) of the total solar irradiance on the surface of the photovoltaic module is set to 450 W/m<sup>2</sup> , which means that when the total solar irradiance is less than 450 W/m<sup>2</sup> , the pump does not work. It starts at 450W/m<sup>2</sup> and the water flow increases with the increase of solar irradiance.

At this stage, when 6000 Wh is needed for a pump, the energy produced by the photovoltaic park in the analyzed area can be used.

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 9 of 33

**Figure 3.** Photovoltaic system for pumping water. **Figure 3.** Photovoltaic system for pumping water.

At this stage, when 6000 Wh is needed for a pump, the energy produced by the photovoltaic park in the analyzed area can be used. Being a legal entity, the association can build its own photovoltaic park by acquiring photovoltaic panels. In this way, the association will be able to trade the energy produced both to the Being a legal entity, the association can build its own photovoltaic park by acquiring photovoltaic panels. In this way, the association will be able to trade the energy produced both to the consumers inside the association and to the association's neighboring consumers. The profit obtained will come in the endowment of the photovoltaic park.

consumers inside the association and to the association's neighboring consumers. The profit obtained will come in the endowment of the photovoltaic park. The profit is simply obtained by registering in the SOLARCOIN database, through which each farmer and the respective association can win SolarCoin. These can be purchased and subsequently The profit is simply obtained by registering in the SOLARCOIN database, through which each farmer and the respective association can win SolarCoin. These can be purchased and subsequently reinvested, for energy acquisition and other resources. The SolarCoin Foundation will ask for registration data on the purchase of photovoltaic panels, as provided in the operating status [67,68].

reinvested, for energy acquisition and other resources. The SolarCoin Foundation will ask for registration data on the purchase of photovoltaic panels, as provided in the operating status [67,68]. The amount of additional energy generated will be sold through the novelty blockchain system. The amount of additional energy generated will be sold through the novelty blockchain system. An important objective of the association is the realization of a software application that monitors the performance of each user.

An important objective of the association is the realization of a software application that monitors the performance of each user. The association is the owner of the equipment that will be given in the form of commodities to the persons in the association on the ground of which they are located. In this case, a solution for The association is the owner of the equipment that will be given in the form of commodities to the persons in the association on the ground of which they are located. In this case, a solution for optimal land use would be to place the panels above the channel, as well as to hygienically protect the water in the canal.

optimal land use would be to place the panels above the channel, as well as to hygienically protect the water in the canal. The unused energy surplus will be traded on behalf of the association to members who, at that The unused energy surplus will be traded on behalf of the association to members who, at that time, have an energy demand not covered by their own production or to the national energy system (Energy Distributor) (see Figure 4).

time, have an energy demand not covered by their own production or to the national energy system

(Energy Distributor) (see Figure 4).

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 10 of 33

**Figure 4.** Proposed diagram for the software platform used in the association in order to make the activity profitable. **Figure 4.** Proposed diagram for the software platform used in the association in order to make the activity profitable.

#### **5. Experimental Study for an Irrigation System Based on Renewable Energy 5. Experimental Study for an Irrigation System Based on Renewable Energy**

The direct connection of the photovoltaic module to the water pumping system is the cheapest commercial solution. At a high-level description, the system consists of a photovoltaic module directly connected to the DC motor of a centrifugal pump. Due to its simplicity (not including batteries and the control system), such a system is simple and reliable. The pump was monitored for five months, during the spring and summer months when the crops were irrigated, in order to evaluate the volume of pumped water and its distribution over time and the influence of the solar radiation regime on the performance of the system. The first information is essential for photovoltaic system sizing to ensure optimal operation of the water pumping system. The second information may provide an overview on the case study in order to generalize the results obtained. The direct connection of the photovoltaic module to the water pumping system is the cheapest commercial solution. At a high-level description, the system consists of a photovoltaic module directly connected to the DC motor of a centrifugal pump. Due to its simplicity (not including batteries and the control system), such a system is simple and reliable. The pump was monitored for five months, during the spring and summer months when the crops were irrigated, in order to evaluate the volume of pumped water and its distribution over time and the influence of the solar radiation regime on the performance of the system. The first information is essential for photovoltaic system sizing to ensure optimal operation of the water pumping system. The second information may provide an overview on the case study in order to generalize the results obtained.

A. Choosing Panels: A. Choosing Panels:

For each member of the association, the energy requirement for pumping water will be calculated depending on the area owned. In order to determine the number of photovoltaic panels and the total power generated by the photovoltaic system, the steps and relationships mentioned in the Appendix A may be used. For each member of the association, the energy requirement for pumping water will be calculated depending on the area owned. In order to determine the number of photovoltaic panels and the total power generated by the photovoltaic system, the steps and relationships mentioned in the Appendix A may be used.

B. SCADA system for association members—users: B. SCADA system for association members—users:

The CitectSCADA® software from Schneider Electric has been used to implement the tracking system. A friendly interface (see Figures 5 and 6) allows tracking and control of the actual state of the irrigation system by both cultivators and the association. The CitectSCADA®software from Schneider Electric has been used to implement the tracking system. A friendly interface (see Figures 5 and 6) allows tracking and control of the actual state of the irrigation system by both cultivators and the association.

At the beginning of the study, an isolated agricultural farm was analyzed, from an energy point of view and water supply, equipped with photovoltaic panels to generate the energy required to supply the water pump (depth), which was distributed in the irrigation system. With the help of this interface (see Figure 5), the state of the system can be monitored and controlled, namely: Average temperature, water level in the basin, battery charge level, and soil moisture.

Starting from this, it was continued to reduce costs and increase the reliability of the system. So, these unique farms will be constituted in cooperatives or associations (see Figure 6) that will be able to manage the situation of production, consumption of energy and water, costs, surplus of energy

water.

realized, when appropriate, not by storage in batteries but by sale (smart contracts and utility token) to other farmers from outside cooperatives, either by feeding the national system. *Sustainability* **2019**, *11*, x FOR PEER REVIEW 11 of 33

**Figure 5.** Human-Machine Interface (HMI) Supervisory Control and Data Acquisition (SCADA)—Farmer 1. *Sustainability* **2019 Figure 5.** , *11*, x FOR PEER REVIEW Human-Machine Interface (HMI) Supervisory Control and Data Acquisition (SCADA)—Farmer 1. 12 of 33

**Figure 6.** SCADA system at the farmers' association level. **Figure 6.** SCADA system at the farmers' association level.

In Figure 6, we can see how the farmers will interact with our proposed system. Basically, the association of farmers will allow members to interact with the platform through the mobile application, which will interact via the backend with the utility token (Ethereum blockchain), distributed database, and the SCADA system for the monitoring and controlling the energy and In Figure 6, we can see how the farmers will interact with our proposed system. Basically, the association of farmers will allow members to interact with the platform through the mobile application, which will interact via the backend with the utility token (Ethereum blockchain), distributed database, and the SCADA system for the monitoring and controlling the energy and water.

the consumption of each member, each of the members will be equipped with a system for tracking and measuring the amount of consumed energy. So, the system will be provided with sensors and a warning system to alert users on the state of humidity and the necessity of watering the crops.

**Figure 7.** The architecture of the monitoring system—farmers' association.

In the first phase, if the agricultural association cannot generate enough energy from its own resources, it can resort to the use of green energy resources in the immediate vicinity. At the end of

C. Analysis of the photovoltaic power generation:

quality of the system and correct any losses. The system architecture is shown in Figure 7.

All energy consumption and surplus energy data will be stored in distributed ledger databases. These data will be accessible for both the associate and the association so that each of the two entities knows very well the stage they are in. In this way, each will be able to monitor the

In order to have control over the amount of energy produced by the association, but also over the consumption of each member, each of the members will be equipped with a system for tracking and measuring the amount of consumed energy. So, the system will be provided with sensors and a warning system to alert users on the state of humidity and the necessity of watering the crops. water. In order to have control over the amount of energy produced by the association, but also over the consumption of each member, each of the members will be equipped with a system for tracking and measuring the amount of consumed energy. So, the system will be provided with sensors and a warning system to alert users on the state of humidity and the necessity of watering the crops.

distributed database, and the SCADA system for the monitoring and controlling the energy and

**Figure 6.** SCADA system at the farmers' association level.

In Figure 6, we can see how the farmers will interact with our proposed system. Basically, the association of farmers will allow members to interact with the platform through the mobile

.

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 12 of 33

All energy consumption and surplus energy data will be stored in distributed ledger databases. These data will be accessible for both the associate and the association so that each of the two entities knows very well the stage they are in. In this way, each will be able to monitor the quality of the system and correct any losses. The system architecture is shown in Figure 7. All energy consumption and surplus energy data will be stored in distributed ledger databases. These data will be accessible for both the associate and the association so that each of the two entities knows very well the stage they are in. In this way, each will be able to monitor the quality of the system and correct any losses. The system architecture is shown in Figure 7.

**Figure 7.** The architecture of the monitoring system—farmers' association. **Figure 7.** The architecture of the monitoring system—farmers' association.

C. Analysis of the photovoltaic power generation: C. Analysis of the photovoltaic power generation:

In the first phase, if the agricultural association cannot generate enough energy from its own resources, it can resort to the use of green energy resources in the immediate vicinity. At the end of In the first phase, if the agricultural association cannot generate enough energy from its own resources, it can resort to the use of green energy resources in the immediate vicinity. At the end of this stage, it can be decided how the profit may be used for the acquisition of photovoltaic panels by the association, in order to create its own photovoltaic park (as it is shown in Figure 4).

A scheme of the proposed working model for the association to make the activity profitable is presented in Figure 8.

Step 1

In the first stage (first year), in order to be able to carry out its cooperative activity (the association), it acquires the necessary electricity from the national system, until the proposed objectives are achieved. By using the irrigation system, it is obvious that the production and quality of the farmers' products will increase, compared to the incomes obtained before using the irrigation system.

The material advantage obtained will be reinvested in the following year in the acquisition of photovoltaic panels.

Step 2

Near the irrigation channel, a photovoltaic park is located. Considering that this photovoltaic park is located in the studied area, it was possible to track, through the SCADA system existing in the park, the amount of energy produced daily and especially during the spring–summer periods, when the farmers need electricity to supply the pumps.

By realizing the cooperative (the farmers' association), the energy can be negotiated from that existing photovoltaic park or from the stock exchange. In this way, the association can save funds by reducing costs by purchasing electricity.

The money obtained will be invested in the purchase of photovoltaic panels that will be conceded by the farmers from the cooperative, or if the PV purchase will be considerable, it will be made own photovoltaic park. Also, income can be obtained in the form of SolarCoiN, by simply registering in the database, from the respective platform of the PV holders (demonstrating through documents).

#### Step 3

This is the time when the association has its own photovoltaic park, they can produce their own electricity, and therefore the benefits will be great in terms of production costs. With the help of the proposed platform, the surplus of energy, especially the electricity produced in the months in which it is not irrigated, will be delivered (sold) to the farmers outside cooperatives for their own needs or to another association, thus creating a chain of associations. During the periods of the year in which it is not irrigated, the energy will be delivered for cost for domestic purposes.

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 14 of 33

**Figure 8.** Diagram of the working model for the association. **Figure 8.** Diagram of the working model for the association.

The availability of energy from the 7.5 MW photovoltaic park (30,646 modules and 14 inverters covering 17 ha in the vicinity of the irrigation channel; see Figure 9) is estimated massed on the energy production budget and performance presented in the Appendix B. The availability of energy from the 7.5 MW photovoltaic park (30,646 modules and 14 inverters covering 17 ha in the vicinity of the irrigation channel; see Figure 9) is estimated massed on the energy production budget and performance presented in the Appendix B.

The energy production budget for a calendar year is presented in Table A1 and Figures A1 and A2 of the Appendix B based on the values obtained from the SCADA system of the photovoltaic park.

Analyzing the values recorded during the peak months (May–September), when it is necessary to supply the electric power for the pumps from the irrigation system stations, it can be ascertained that they meet the requirements. Also, analyzing the values of the extra-season months, a profit may be obtained by either delivering the energy for the household needs of the members of the association or delivering it into the national energy system (see Figure 10).

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 15 of 33

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 15 of 33

**Figure 9.** Map of the photovoltaic park. **Figure 9.** Map of the photovoltaic park. may be obtained by either delivering the energy for the household needs of the members of the association or delivering it into the national energy system (see Figure 10).

**Figure 10.** Graph with annual energy production delivered to national energy system. **Figure 10.** Graph with annual energy production delivered to national energy system.

The performance of the park of photovoltaic panels during time T (*PRT*) can be estimated using the relationship (1): [ ] The performance of the park of photovoltaic panels during time *T* (*PRT*) can be estimated using the relationship (1):

## 6 m. pam o phouovonan: pamos ouming unte  $\mathbf{T}$  ( $\mu\_1$ ) cunt no e Summation uang 1):

$$\text{PR}\_T = \frac{\text{Energy produced during a certain period T [kWh]}}{\frac{\text{Average incident solar radiation during T}}{1000 \text{ W/}m^2}} \text{-Peak plant utatage: T [h]}\tag{1}$$

[ ]

(1)

**Figure 10.** Graph with annual energy production delivered to national energy system. The performance of the park of photovoltaic panels during time T (*PRT*) can be estimated using the relationship (1): [ ] *Energy produced during a certain period T kWh PR Average incident solar radiation during T Peak plant wattage T h* For example, the results obtained are presented in Tables A2 and A3 for December, which looks to be the month with the least energy produced (see Figures A3 and A4). This assumption is validated by the energy availability of the photovoltaic park presented in Figure 11.

2

*W m*

1000 /

*T*

validated by the energy availability of the photovoltaic park presented in Figures 11.

**Figure 11.** The energy availability of the photovoltaic park. **Figure 11.** The energy availability of the photovoltaic park.

#### **6. The Proposed Approach to Reduce Costs 6. The Proposed Approach to Reduce Costs**

Considering the solutions presented and discussed in the first part of the study and the need of the small producers to use the irrigation system (and they are aware of this necessity), this study proposes new methods of generating income for producers while keeping low prices for water purchased from the irrigation channels. Considering the solutions presented and discussed in the first part of the study and the need of the small producers to use the irrigation system (and they are aware of this necessity), this study proposes new methods of generating income for producers while keeping low prices for water purchased from the irrigation channels.

Three scenarios have been proposed depending on the area chosen for the study as well as the existing resources. In the proposed methodology, the reduction of costs will be first (see Figure 8). This can be mainly achieved by lowering the energy price using the renewable energy and the proposed method for energy transactions. Three scenarios have been proposed depending on the area chosen for the study as well as the existing resources. In the proposed methodology, the reduction of costs will be first (see Figure 8). This can be mainly achieved by lowering the energy price using the renewable energy and the proposed method for energy transactions.

#### *6.1. The System Description 6.1. The System Description*

#### 6.1.1. Current System 6.1.1. Current System

The current solution (energy supply from the national electricity system) has proven to be unprofitable and thus unacceptable to small farmers due to high costs involved (see the argumentation made in Introduction). So, the energy cost must be reduced by use of renewable energy sources. The current solution (energy supply from the national electricity system) has proven to be unprofitable and thus unacceptable to small farmers due to high costs involved (see the argumentation made in Introduction). So, the energy cost must be reduced by use of renewable energy sources.

#### 6.1.2. Use of a Photovoltaic Park 6.1.2. Use of a Photovoltaic Park

Another solution is to use energy from a photovoltaic park located close to the farms. If the photovoltaic park is equipped with a SCADA system for real-time monitoring and control of the power generation, then the farmers' association can be easily connected and monitored. Another solution is to use energy from a photovoltaic park located close to the farms. If the photovoltaic park is equipped with a SCADA system for real-time monitoring and control of the power generation, then the farmers' association can be easily connected and monitored.

The analysis of the data (see the previous section) has shown that such a system is energy efficient but also cost-effective for the owner of this photovoltaic park. However, this solution is not so attractive for the farmers because the energy obtained is delivered at the price set by the The analysis of the data (see the previous section) has shown that such a system is energy efficient but also cost-effective for the owner of this photovoltaic park. However, this solution is not so attractive for the farmers because the energy obtained is delivered at the price set by the distributors.

#### distributors. 6.1.3. Acquisition of Individual Photovoltaic Panel Manufacturers

6.1.3. Acquisition of Individual Photovoltaic Panel Manufacturers So, one of the profitable small businesses of the coming years will be that of small electricity production, due to a continuously growing of energy demand and high prices on the energy market. However, for small energy producers, it is almost impossible to distribute energy and obtain profits because, today, only big manufacturers have access to the energy market. Consequently, only associations of small producers could enter the market (see Figure 12). The local distributor would be obliged to take over the quantity produced by them at a fixed price. The price would be up to 50% So, one of the profitable small businesses of the coming years will be that of small electricity production, due to a continuously growing of energy demand and high prices on the energy market. However, for small energy producers, it is almost impossible to distribute energy and obtain profits because, today, only big manufacturers have access to the energy market. Consequently, only associations of small producers could enter the market (see Figure 12). The local distributor would be obliged to take over the quantity produced by them at a fixed price. The price would be up to 50% lower than the actual market price.

lower than the actual market price. So, this solution would be advantageous for the small farmer in order to benefit from a considerable profit, but it is difficult to be implemented in this stage. Thus, for a start, a simple and beneficial solution for the farmers' association will be proposed in next section.

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 17 of 33

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 17 of 33

**Figure 12.** The national power system that integrates the green energy producers. **Figure 12.** The national power system that integrates the green energy producers. considerable profit, but it is difficult to be implemented in this stage. Thus, for a start, a simple and beneficial solution for the farmers' association will be proposed in next section.

#### So, this solution would be advantageous for the small farmer in order to benefit from a 6.1.4. Manufacturers Associations

considerable profit, but it is difficult to be implemented in this stage. Thus, for a start, a simple and beneficial solution for the farmers' association will be proposed in next section. The small farmers will join an association that will concede the abandoned irrigation channel. The energy produced by photovoltaic panels will be directly used, without being pumped into the national power system and then used. 6.1.4. Manufacturers Associations The small farmers will join an association that will concede the abandoned irrigation channel. The energy produced by photovoltaic panels will be directly used, without being pumped into the

6.1.4. Manufacturers Associations The small farmers will join an association that will concede the abandoned irrigation channel. The energy produced by photovoltaic panels will be directly used, without being pumped into the national power system and then used. Equipping the irrigation channels with photovoltaic panels will be done in such a way that the association will make a profit. The association will continue to expand the photovoltaic park in an efficient way, taking into consideration the supply and demand, just like in the market economy. In Equipping the irrigation channels with photovoltaic panels will be done in such a way that the association will make a profit. The association will continue to expand the photovoltaic park in an efficient way, taking into consideration the supply and demand, just like in the market economy. In order not to occupy the land necessary for the agriculture, the water channel can be also covered with floating photovoltaic panels that resist corrosion, and the anchors should last for 25 years or more (see Figure 13). national power system and then used. Equipping the irrigation channels with photovoltaic panels will be done in such a way that the association will make a profit. The association will continue to expand the photovoltaic park in an efficient way, taking into consideration the supply and demand, just like in the market economy. In order not to occupy the land necessary for the agriculture, the water channel can be also covered with floating photovoltaic panels that resist corrosion, and the anchors should last for 25 years or more (see Figure 13).

**Figure 13.** Photovoltaic panels mounted on the irrigation channel. **Figure 13.** Photovoltaic panels mounted on the irrigation channel.

**Figure 13.** Photovoltaic panels mounted on the irrigation channel. In comparison with the photovoltaic system mounted on the ground, the photovoltaic system mounted on the surface of the channel has the following advantages:

• The panels do not occupy land;


The association will be interested in selling the energy surplus, especially in the months when the soil does not need extra water or can be motivated to increase the capacity in order to meet the demand of possible external consumers. Also, some of the energy will be used by association members.

There will be a so-called blockhouse of a restricted community, real-time counting of local energy generation and use, and the analysis of related data. The proposed solution is similar, but more efficient than that proposed in other peer–peer solar energy trading projects, as will be explained below.

#### *6.2. Blockchain Application for the Association*

The following software solution is proposed for the management of water and energy in an association, which adds a value through the transparency and decentralization of the data. Using blockchain technology, the solution aims to reduce overall costs of irrigation in associations of small farmers. The following components are proposed: A backend application, which processes all the events and transactions and smart contracts; a mobile application, which enables farmers to buy and sell energy and water; and a distributed ledger database, which offers a high degree of transparency and could build trust in the network of farmers in the association.

The detailed components of the platform.

I. The backend module—the backend module will play the main role in the proposed software solution. It will interact with the clients through the mobile application, with the blockchain, and with the databases; SQL and a distributed ledger database (e.g., BigchainDB) will be able to store the accounts (associations and association's members) with all the details such as photovoltaic panels owned, the energy produced, water used, application programming interfaces (APIs) for the mobile applications, SCADA systems, and with the Ethereum main-net blockchain. The Distributed Ledger Technology's (DLT) role is to add a high degree of transparency and to build trust in the network through the decentralization of data.

The administrators of the association can access the backend module trough a web interface in order to set up and configure details such as farmers' accounts, permissions, authentication, etc.

II. The ERC20 utility token—will be created on the Ethereum blockchain using the Solidity programming language. The token will have a fixed total supply and will be used as currency inside the associations to create an internal trading market. Members of the association will be rewarded with the token depending on the amount of energy produced with the owned photovoltaic panels. Buying water from the irrigation channel will also be made using the token.

Farmers will interact with the smart contracts through the mobile application.

III. The Mobile application will be used by the association members to control and monitor the energy produced and the water consumed. Also, it can be used to trade the utility token, allowing households outside of the association to buy water from the irrigation channel (see Figures 14 and 15). 15).

Farmers will interact with the smart contracts through the mobile application.

III. The Mobile application will be used by the association members to control and monitor the energy produced and the water consumed. Also, it can be used to trade the utility token, allowing

**Figure 14.** Visual representation of the digital platform proposed. **Figure 14.** Visual representation of the digital platform proposed.

The architecture of the proposed platform is represented in Figure 14 (high-level) and in the technically detailed diagram from Figure 15. Members of the association (the farmers) will use the mobile application to interact with the utility token (buying and selling the token, energy, and water). The administrators of the association will be able to set up the new members into the system, along with their hardware: Photovoltaic panels and water meters. This will be achieved using the SCADA system and smart waters meters with Ethernet connectivity. The architecture of the proposed platform is represented in Figure 14 (high-level) and in the technically detailed diagram from Figure 15. Members of the association (the farmers) will use the mobile application to interact with the utility token (buying and selling the token, energy, and water). The administrators of the association will be able to set up the new members into the system, along with their hardware: Photovoltaic panels and water meters. This will be achieved using the SCADA system and smart waters meters with Ethernet connectivity.

#### A. Working principle:

The operating principle is simple to use by a wide range of users.

Step 1: A member of the association will access the platform from a mobile application and will sign into the account. The new members will have the option to create new accounts. A complete set of self-serving features will be implemented.

Step 2: The farmers will fill in the identification data and purchase documents of the photovoltaic panels and after the configuration of the smart water metering and SCADA system, the platform will map to the account the correct amount of energy produced and to all the tokens earned so far. The administrators of the association will enroll the new farmers into the system.

Step 3: Users will be able to spend their tokens via the platform by exchanging tokens for water from irrigation channel, for energy, or simply selling them to the highest bidder (other users of the platform, a member of the association, or to an external user).

Step 4: Users will have the possibility to hide any personal data, and the information stored in the distributed ledger database will contain only pseudorandomized data, following the General Data Protection Regulation (GDPR) accordingly.

After completing these steps, the entire system will be automated by the internal economy created with the help of the utility token. This proposed concept can be used for an association or can be configured for a cluster of associations. At a higher scale, the blockchain will produce even greater benefits as members will be able to avoid energy distributors' costs almost entirely.

## B. Access to data:

The identity of the owner and the authenticity of photovoltaic acquisition documents are verified through a hash and after that can be accessed by the members of the association, the management of the association, or other interested households.

After enrolling each member in the database, it can access data with daily energy production, the amount of available energy available for sale, daily consumption of households in the association, and households who want to join the association. The same thing goes for the water used or that will be used, and the number of tokens owned by each member.

#### C. System Automation:

Using the SCADA system and smart water metering solution, the entire system will reach a high level of automation. The operations not automated will be the members enrolling in the system and physically connecting the devices to the irrigation channel. *Sustainability* **2019**, *11*, x FOR PEER REVIEW 20 of 33

**Figure 15.** Blockchain-based smart contract system for irrigation systems. platform, a member of the association, or to an external user) **Figure 15.** Blockchain-based smart contract system for irrigation systems.

A. Working principle:

of self-serving features will be implemented.

so far. The administrators of the association will enroll the new farmers into the system.

Step 2: The farmers will fill in the identification data and purchase documents of the photovoltaic panels and after the configuration of the smart water metering and SCADA system, the platform will map to the account the correct amount of energy produced and to all the tokens earned

Step 3: Users will be able to spend their tokens via the platform by exchanging tokens for water from irrigation channel, for energy, or simply selling them to the highest bidder (other users of the

The operating principle is simple to use by a wide range of users.

D. Implementing a prototype and some samples of the obtained results:

In the implemented prototype, an ERC20 token, a basic backend API, and a basic web interface has been developed with the following functionalities: Creating accounts, profiles, and sending and receiving tokens.

```
(a) Smart Contracts:
```
The platform interface was built using Truffle framework and web3.js library for interfacing with the Ropsten Ethereum testnet.

The following snippets of code represent the token created using Solidity (Figure 16) and deployment to the testnet blockchain (Figure 17). As it can be observed below, our implementation makes use of the open-source contracts library called Open Zeppelin. *Sustainability* **2019**, *11*, x FOR PEER REVIEW 22 of 33

**Figure 16.** ERC20 implementation of the token's constructor. **Figure 16.** ERC20 implementation of the token's constructor.

The contract developed and deployed as an experiment is named "Small Irrigation System Token" (Figure 16). The constructor is an optional function declared with the constructor keyword, which is executed upon contract creation, and where you can run contract initialization code. The name of the token contract is the long name by which the token contract should be known. The symbol represents the short name by which the token contract should be known; in our case, it is "SIST". Decimals refer to how divisible a token can be, from 0 (not at all divisible) to 18 (maximum Ethereum decimals). The "Amount" defined in the contract refers to the number of tokens that will be minted (created on the first deploy). Contracts used from OpenZeppelin open-source smart contract library are the following: ERC20, ERC20Detailed, and ERC20Burnable; these three offer a secure way of implementing basic token functionalities such as sending and receiving tokens. The contract developed and deployed as an experiment is named "Small Irrigation System Token" (Figure 16). The constructor is an optional function declared with the constructor keyword, which is executed upon contract creation, and where you can run contract initialization code. The name of the token contract is the long name by which the token contract should be known. The symbol represents the short name by which the token contract should be known; in our case, it is "SIST". Decimals refer to how divisible a token can be, from 0 (not at all divisible) to 18 (maximum Ethereum decimals). The "Amount" defined in the contract refers to the number of tokens that will be minted (created on the first deploy). Contracts used from OpenZeppelin open-source smart contract library are the following: ERC20, ERC20Detailed, and ERC20Burnable; these three offer a secure way of implementing basic token functionalities such as sending and receiving tokens.

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 23 of 33

**Figure 17.** Token's transfer and ban functions. **Figure 17.** Token's transfer and ban functions.

As a security measure, the association's administrator could make use of the above smart contract functions. The administrator is named by the "setTransferAgent" function and he could deny specific users to use the token. These functions will be called every time a transfer is initiated and will check if the specific account is allowed to make transactions. As a security measure, the association's administrator could make use of the above smart contract functions. The administrator is named by the "setTransferAgent" function and he could deny specific users to use the token. These functions will be called every time a transfer is initiated and will check if the specific account is allowed to make transactions.

b) Deploy the contract to Ropsten: The token deployment to the testnet blockchain will be made with the Truffe framework. (b) Deploy the contract to Ropsten:

1. Build the smart contract with the following console command: The token deployment to the testnet blockchain will be made with the Truffe framework.


2. Deploy the contract: *truffle deploy --network ropsten* Once the contract is deployed, the platform can make use of the token enabling transfers between members and exchanges for energy or water. Initial functional and security testing can be Once the contract is deployed, the platform can make use of the token enabling transfers between members and exchanges for energy or water. Initial functional and security testing can be achieved using Remix Ethereum IDE.

achieved using Remix Ethereum IDE. (c) The interface for the mobile application:

c) The interface for the mobile application: The user interface proposed for the mobile application should be minimalistic and The user interface proposed for the mobile application should be minimalistic and user-friendly, making it very intuitive and easy to use (see Figure 18).

user-friendly, making it very intuitive and easy to use (see Figure 18). So, the farmers will interact with the platform via the mobile application shown in Figure 17. So, the farmers will interact with the platform via the mobile application shown in Figure 17. One of the challenges to be faced will be the quality of user experience and training.

One of the challenges to be faced will be the quality of user experience and training.

#### *6.3. Discussion*

After running the experiment, we could create the associations, farmer accounts, simulate energy and water data, and perform transactions via the Ethereum Blockchain. There is a clear set of advantages of the blockchain technology used in associations of small farmers.


The next step of the experiment is to integrate the next version of the proposed platform into an association of small farmers. This will help to receive feedback on the user interaction and functionalities of the small farmers. Also, the first tests within the association will provide a direction for scaling the platform and supporting transactions between multiple associations or villages and will confirm the effectiveness of developing an internal economy inside the associations. The internal economies will ensure the system is highly performant and is maintained properly even in the winter when the demand for water is not that high. Also, the internal economy needs to reduce the overall cost of irrigation water.

*Sustainability* **2019**, *11*, x FOR PEER REVIEW 24 of 33

**Figure 18.** Sample screen of the interface proposed for the mobile application. **Figure 18.** Sample screen of the interface proposed for the mobile application.

*6.3. Discussion* After running the experiment, we could create the associations, farmer accounts, simulate energy and water data, and perform transactions via the Ethereum Blockchain. There is a clear set of advantages of the blockchain technology used in associations of small farmers. Implementing the blockchain-based system in just one association would be the first step in the digital transformation of the irrigation industry and even the solar energy industry. Once this step is confirmed and achieves a good level of adoption, the next step is to enable association-to-association transactions or village-to-village.

#### Secure payment and transaction systems based on the blockchain. **7. Conclusions**

the overall cost of irrigation water.

transactions or village-to-village.

**7. Conclusions**

 The blockchain technology offers a high level of transparency, as each member of the association can see the number of tokens owned and all transfers. The advantages of the photovoltaic systems for isolated areas without access to the national energy system led to an attempt to propose the rehabilitation of irrigation systems.

 Implementing the DLT will enhance the trust in associations, as everyone could see relevant data such as the amount of energy produced and the amount of water consumed. The next step of the experiment is to integrate the next version of the proposed platform into an association of small farmers. This will help to receive feedback on the user interaction and functionalities of the small farmers. Also, the first tests within the association will provide a direction for scaling the platform and supporting transactions between multiple associations or villages and will confirm the effectiveness of developing an internal economy inside the associations. The internal economies will ensure the system is highly performant and is maintained properly even in The proposed solution is based on creating associations of small farmers that are using the irrigation system connected at photovoltaic panels. The efficiency of the proposed system is monitored not only through the location and type of photovoltaic panels, but also by using the new blockchain technology. Creating an internal economy inside the small farmers association can be a great benefit for the members. Firstly, the token value will be dictated by the demand, offering opportunities for the producers to maintain the infrastructure even in the winter when all the activities in the agriculture industry will be at a low level. Secondly, the non-members interested in acquiring energy or water from the association can make use of the internal economy to get the best price available at that time.

confirmed and achieves a good level of adoption, the next step is to enable association-to-association

The advantages of the photovoltaic systems for isolated areas without access to the national

energy system led to an attempt to propose the rehabilitation of irrigation systems.

the winter when the demand for water is not that high. Also, the internal economy needs to reduce

Innovative and sustainable solutions for agro-power-problems, interchange smoothness, and Human–Machine Interface (HMI) are important contributions of this paper, where the energy efficiency and chain-power-requirements are also considered. To validate the objectives of this study, an experimental renewable energy-based irrigation system with SCADA interfaces based on the proposed blockchain applications has been used.

So, the main findings of this study are as follows:


From the research, it is fact that the takeover of the agricultural irrigation activity by an association is one of the best solutions for enforcing agricultural production, but also for getting benefits from the community by reducing the costs of electricity in part or in some cases totally. An important profit is also obtained by selling the surplus energy you get.

Also, it should not be forgotten that a decommissioned and uncleaned channel can be rehabilitated to become functional.

**Author Contributions:** Conceptualization, methodology, and writing—original draft preparation: F.M.E. and N.B.; validation and supervision: A.O.; formal analysis: M.S.R.; writing—review and editing: N.B., P.T., G.S, ., and A.G.M. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was partially funded by Research Center "Modeling and Simulation of the Systems and Processes" based on grants of the Ministry of National Education and Ministry of Research and Innovation, CNCS/CCCDI-UEFISCDI within PNCDI III "Increasing the institutional capacity of bioeconomic research for the innovative exploitation of the indigenous vegetal resources in order to obtain horticultural products with high added value" PN-III P1-1.2-PCCDI2017-0332. This work was also funded in part by King Mongkut's University of Technology North Bangkok. Contract no. KMUTNB-63-KNOW-040. The APC was free of charge, being an invited paper for the special issue in Sustainability: "Efficiency and Sustainability of the Distributed Renewable Hybrid Power Systems Based on the Energy Internet, Blockchain Technology and Smart Contracts".

**Conflicts of Interest:** The authors declare no conflict of interest.

### **Abbreviations**


### **Appendix A**

Design of the photovoltaic system: The number of photovoltaic panels can be established using the following steps and relationships:

1. Calculate the energy needed to charge the batteries:

$$
\eta\_{\text{BATTERY}} = 0.7 \Rightarrow \mathcal{W}\_1 = \frac{W\_{\text{DAY}}}{\eta\_{\text{BATTERY}}} = \frac{3529.41}{0.7} = 5042.01 \text{ W}h \tag{A1}
$$

2. Determine of the energy required to be supplied daily:

$$
\eta\_{\text{BATTERY\\_CHargER}} = 0.85 \Rightarrow \mathcal{W}\_2 = \frac{\mathcal{W}\_1}{\eta\_{\text{BATTERY\\_CHargER}}} = \frac{5042.01}{0.85} = 5931.78 \text{ Wh} \tag{A2}
$$

3. Evaluate the power of a module:

$$
\begin{pmatrix}
\eta\_{paneIVV} = 0.9 \\
P = 190 \text{ W}
\end{pmatrix} \Rightarrow P\_{REAL mode} = P\_{FV} \cdot \eta\_{paneIVV} = 190 \cdot 0.9 = 171 \text{ W}
\tag{A3}
$$

4. Estimate the average number of hours for standard illumination (hours/day) for the least favorable month (December):

$$N\_{HOURSemiroment} = 6 \, hours \tag{A4}$$

5. Estimate the energy obtained per day:

$$\mathcal{W}\_{\text{day}FV} = P\_{\text{REAL}|\text{model}} \cdot \text{N}\_{\text{HOURS environment}} = 171 \cdot 6 = 1026 \text{ Wh} \tag{A5}$$

where: *PFV*—the power of a photovoltaic panel; η*panelFV*—the yield of a photovoltaic panel. *NHOURSenviroment*—the approximate illumination time.

6. Calculate the number of needed PV modules:

$$N\_{\text{MODIIES}} = \frac{W\_4}{W\_{dayFV}} = \frac{5931.78}{1026} = 5.78 \text{panels} \approx 6 \text{ panels} \tag{A6}$$

7. Calculate the number of modules in series for Un = 24V:

$$N\_{\text{seriesMODILES}} = \frac{\mathcal{U}\_n}{V\_{mp}} = \frac{\mathbf{24}}{\mathbf{35.8}} = 0.67 \approx 1 \text{ piece} \tag{A7}$$

8. Calculate the number of modules in parallel:

$$N\_{\text{parallel}\text{MODIILES}} = \frac{N\_{\text{MODIILES}}}{N\_{\text{series}\text{MODIILES}}} = \frac{6}{1} = 6 \text{ pieces} \tag{A8}$$

9. Calculate the number of modules needed to be purchased:

$$N\_{\text{MODILES}} = N\_{\text{series}\text{MODILES}} \cdot N\_{\text{parallel}\text{MODILES}} = 1 \cdot 6 = 6 \text{ pieces} \tag{A9}$$

10. Estimate the total power generated by the photovoltaic system:

$$P\_N = 190 \text{ } \mathcal{W}(f \text{from dataset}) \Rightarrow P\_{\text{TOTAL}} = N\_{\text{MOODLES}} \cdot P\_N = 6 \cdot 190 = 1140 \text{ } \mathcal{W} \tag{A10}$$

#### **Appendix B**

The energy production budget and performance of the 7.5 MW photovoltaic park:

**Table A1.** Production budget.


**Appendix B**

<sup>24</sup> 0.67 1

1 6

*pieces*

(A7)

(A8)

(A9)

(A10)

35.8

*seriesMODULES MODULES MODULES parallel* 6

*N N N pieces MODULES seriesMODULES parallelMODULES* 1 6 6

*P W from datasheet P N P W N TOTAL MODULES N* 190 6 190 1140

**Table A1.** Production budget.

**Monthly (MWh) Cumulative (MWh)**

The energy production budget and performance of the 7.5 MW photovoltaic park:

January 386.81 386.81 February 520.76 907.57 March 882.30 1789.88 April 943.31 2733.18 May 1102.99 3836.17 June 1086.91 4923.08 July 1204.52 6127.59 August 1141.43 7269.02 September 1017.09 8286.11

December 407.93 9934.00

*n*

*mp U N piece V*

> *N N*

*seriesMODULES*

8. Calculate the number of modules in parallel:

*N*

10. Estimate the total power generated by the photovoltaic system:

9. Calculate the number of modules needed to be purchased:

**Figure A1.** Graph with solar photovoltaic production (MWh) each month of one year and cumulatively from the beginning of the calendar year. **Figure A1.** Graph with solar photovoltaic production (MWh) each month of one year and cumulatively *Sustainability*  from the beginning of the calendar year. **2019**, *11*, x FOR PEER REVIEW 28 of 33 *Sustainability* **2019**, *11*, x FOR PEER REVIEW 28 of 33

**Figure A2.** Monthly energy production (MWh) of the photovoltaic park. **Figure A2.** Monthly energy production (MWh) of the photovoltaic park. **Figure A2.** Monthly energy production (MWh) of the photovoltaic park.


**Table A2.** Energy production in December. **Table A2.** Energy production in December.

**Figure A3.** Production representation (MWh)–SCADA vs. meter. **Figure A3.** Production representation (MWh)–SCADA vs. meter. **Figure A3.** Production representation (MWh)–SCADA vs. meter.

SCADA [MWh] 407.93 9934.00 |Difference Meter| [MWh] 97.52 650.23 Dev. Meter [%] 23.21 6.55

SCADA [MWh] 407.93 9934.00 |Difference Meter| [MWh] 97.52 650.23 Dev. Meter [%] 23.21 6.55

**Source December Cumulative** 

**Source December Cumulative** 


**Table A3.** Production—meter vs. budget.

**Figure A4.** Production representation (MWh)—meter vs. budget. **Figure A4.** Production representation (MWh)—meter vs. budget.

#### **References References**


16. Li, Z.; Bahramiradb, S.; Paasob, A.; Yan, M.; Shahidehpour, M. Blockchain for decentralized transactive energy management system in networked microgrids. *Electr. J.* **2019**, *32*, 58–72,

17. Karavas, C.S.; Arvanitis, K.; Papadakis, G. A Game Theory Approach to Multi-Agent Decentralized Energy Management of Autonomous Polygeneration Microgrids. *Energies* **2017**, *10*, 1756–1767,

Things and smart grid. *Renew. Sustain. Energy Rev.* **2018**, *91*, 90–108, doi:10.1016/j.rser.2018.03.089.

integrity of distributed mobile networks. *IEEE Trans. Inf. Forensics Secur.* **2018**, *13*, 2240–2255.

doi:10.1016/j.tej.2019.03.008.

doi:10.3390/en10111756.


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

MDPI St. Alban-Anlage 66 4052 Basel Switzerland Tel. +41 61 683 77 34 Fax +41 61 302 89 18 www.mdpi.com

*Sustainability* Editorial Office E-mail: sustainability@mdpi.com www.mdpi.com/journal/sustainability

MDPI St. Alban-Anlage 66 4052 Basel Switzerland

Tel: +41 61 683 77 34 Fax: +41 61 302 89 18

www.mdpi.com ISBN 978-3-0365-1833-6