Autonomous Electrical System Monitoring and Control Strategies to Avoid Oversized Storage Capacity

A significant solution to achieve energy efficiencies and stability of the electrical network is upgrading auto-consumption in a single PV system. In this paper, we presented a methodology to implement low-cost sensors and actuators to have better monitoring and control for a feasibility solution. This approach has been conducted through a case study on Greenhouse’s PV system in Grenoble, France. We proposed a minimal set of sensors to reduce system complexity while giving us enough information to make decisions. Some technical issues were analyzed as accuracy, sampling rate, response-ability of our system. The influences of inverter operation mode to system losses were considered. After that, we figured out energy problematics in our system based on available design data and simulation data from PVSyst. A PV production prediction model was investigated with input as forecast cloudiness data collected from web service, updated every 3 hours. This model, combined with real-time monitoring data and setting mode on an off-grid inverter, was used to identify control strategies with objectives of avoiding oversize storage capacity and maximizing the autonomous duration of the PV system.


Case study: Autonomous greenhouse
Filling our shopping cart with expensive toxic food that travels miles and miles does not seem like a good idea nowadays with all this technological advance. The necessity to produce our own food sustainably and autonomously pave the way toward a new agriculture process where three organisms (fishes, bacteria and plants) collaborate in a greenhouse using self-produced energy to power an advanced monitoring system, resulting in a 90% savings in water consumption. The aquaponics greenhouse is installed on the roof of an engineering school in Grenoble city as shown in Figure 1. We used this platform to test and apply our studies in energy modeling and optimal control strategies. Electrical parts on Greenhouse for our study consist of solar panels, batteries, inverter, and controllable load (water pump). Parameters of each part are the following: The energy monitoring and control system needs five sensors (PV Panels, Battery, 2 for AC input/output of the inverter, Pump) for measuring Voltage/Current/Power/Energy and a speed driver for the pump. The measured data from sensors will be stored in time series on the local Raspberry Pi server as in the database and displayed on a web-based dashboard. Therefore, users will be able to access and see data. Our schematic of monitoring and control system and electrical board were shown in Figure 2, 3. We have designed the sensors according to characteristics of electrical components that were detailed in table 1. The application noted in [24] commented on some advantages and obstacles of various sensors technologies. The Rogowski Coil and Hall Effect sensors have high accuracy, but they still are more expensive than other technologies. In order to reduce complicated testing procedures and investment costs, the digital sensors that have been calibrated by the manufacturer are preferred choice. For current measurement in this work, we looked on shunt (DC Pzem-xxx and INA219) and the current transformer sensor (AC Pzem-004T). The required precision of sensors depends on different applications and can be improved by users with calibration. A measure accuracy of 1% is targeted, as advised on page 60 of [19]. We have reduced the set of sensors to a minimal number in order to reduce cost investment and maintenance. It has been done by neglecting energy sensor for battery charging mode. Figure 4 demonstrated the wiring of components in our developing system. In which, we chose cheap energy sensors for DC/AC measuring:  DC Pzem-003 sensor 1 was for PV panels with built-in Shunt , an accuracy of 1% and a measured range of 0.01-10A. DC Pzem-017 sensor 2 was for Battery in discharging mode with an external shunt, an accuracy of 1%, and a range 0-100A. Both of these sensors have a physical layer from UART to RS485 communication interface, the application layer of Modbus RTU protocol. Two DC Pzem were wired to Raspberry Pi through USB port by converter cable.  AC Pzem-004T sensors 3 were for input and output of inverter with measured range (80 -260 VAC)/( 0 -100A). These sensors were connected with an Arduino Atmega2560 module by UART protocol, which transmits data to Raspberry Pi through USB protocol.  Adafruit DC INA219 sensor 4 for Pump has a Shunt of 0.1 ohm-2W-1%, measuring up to +26VDC/±3.2A and support I2C communication protocol because the starting current of the motor is about 5-7 times higher than the nominal current. Our pump has a 1.25A of rated current. Therefore, we replaced by other Shunt with 0.01 ohm-1W-1% to extend the current range to ± 10A.  Actuator 5 was developed an actuator based on a two channels relay module to control the up/down motor speed of pump.  Raspberry pi is our system data center, developed with open source solutions: InfluxdB 6 , Grafana 7 , Python 8 .

Data acquisition, storage and display
In Figure 5, the dashboard displays measured data from the energy monitoring and control system. Users can access Raspberry through the internet to exploit and study. This information helps to track energy behaviors as (production, consumption, and storage) in the PV system.

Quality of the monitoring and control
In this section, we are presenting some solutions for testing and calibration to improve the quality of our energy monitoring and control system, to have better data quality and higher reliability operation.
The sensor's accuracy relates to data quality. All most sensors are calibrated in factories. These devices evaluation information are provided by the manufacturer to support user finding the suitable sensors for their applications. Nevertheless, sensor errors come from users, the sensor's working environment, and degradation quality. Testing and calibration are therefore mandatory requirements before using them, which allow us an evaluation of measurement quality, determining the time to recalibrate sensors or replacing them to a new one. Some studies on the calibration of low-cost energy sensors are listed by [25]. However, it is not easy to proceed due to certain conditions such as high accuracy of reference tools, complex calculations, and testing time. The challenges of maintaining the quality of low-cost sensors still need to be addressed. Experiences of calibrating low-cost sensors from laboratory to real systems were shown in [23]. We should select the right reference instrument accuracy (depend on the application, but it must be higher than testing devices) and measurement scale (as noted in table 2 [26]). In our system, AC Pzem-004T has a current of 0-100A, while the measured ranges (AC input/output of inverter) have maximum values of 17.7A / 13A, respectively. Therefore, we multiply four times of AC input by increasing wired rings through the current transformer to reach a maximum current of 70.8A/52A (to have over 50% of 100A).Correction of conversion errors (for instance INA219 sensor) by a calibrated function could reduce voltage/current error from 1.07% / 1.7% to 1%, 1.2% respectively. Uncertainties of measurement can be reduced by averaging measurement results [27]. Our data were collected every second and then were averaged every 1 minute. The sampling rate shown in [25] is seconds to minutes per sample, time uploading data is 1s to 5 min. Other authors in [19] suggested timestamp of recorded data is around 5 to 15 min that is enough for tracking and can avoid overload database system. In our application, we collected 20-30 samples/minute (depending on sensors), and then store average data every 1 min. Some importance evaluated factors are often used as RMSE (root mean square error), MAPE (mean absolute percentage error), MRE (mean relative error) [25], or STD (standard deviation) [27]. Our estimations in this study are based on RMSE. Controller and loads: In order to control the pump, a two-channel relay has been connected to the existing speed driver. Our controller is a simulating button pushes on the existing one. Therefore, it is necessary to test the response of load and calibrate commands to ensure that loads can conduct the controller requests with expected accuracy in real-time. In our system, the time to complete command is approximately 2 seconds. The load was characterized to produce a model useful for the controller with input of power and output of motor speed (e.g., what is the speed if we want to consume only 10W). In this part, a Greenhouse study case helps us to highlight implementation issues and recommendations to settle a monitoring and control system. This first one is required to be accurate enough and well configured in order to start energy analysis and develop control strategies to reach a robust and autonomous system.

Energy balance evaluation
The characteristics associated with photovoltaic production simulation obtained by PVSyst software are to estimate the energy autonomy in our system. The relationship between demand and self-supply is represented by load matching indicators, including supply cover factor (γ supply in Equation 1) and load cover factor (γ load in Equation 2) on the different time scale (year, month, ...), which are defined in [28]: (3) Where: t 1 /t 2 are start/end of the evaluation period; ζ(t) is energy losses; l(t) is the power of loads; S(t) is the storage energy balance defined by Equation 3. In which, s c /s dc are charging/discharging storage energy. On Greenhouse, the nominal power of loads is equal to 42 (W), and the losses system was approximated 10% nominal power of loads (4.2 W). We assume that the operation time of the system is 24h per day. So energy consumption of loads per (month and year) could be identified in table 2. As showing in table 2, the annual time scale, γ load = 1, and γ supply = 0.91 indicated that the system's annual energy production meets demand and has only small surplus energy (around 9%). On a monthly scale, during the winter months (Jan, Feb, Oct, Nov, and Dec), the load cover factor varies from 0.42-0.78, indicating that local production does not meet the demand. In the summer months, energy excess fluctuates strongly in range (0 < γ supply <1), especially in August, the self-consumption level reached the highest value (γ supply = 0.84). The intermittent of energy production on Greenhouse made influence significantly to load operation. Imagine that we want to store the exceeding summer energy (104kWh) in batteries, to reuse it during winter (need 66kWh), then approximately 250 batteries (22Ah-12 V) were required. This is not possible. That is why reducing load during winter is required. It is also coherent with the winter period, where fewer plants are in the Greenhouse. The same study has to be made on a daily scale, but we need a dedicated PV production model or enough data to produce some statistics during a year, on hourly energy balance. Indeed, the supply load during the night requires energy storage. In order to limit this battery capacity, we would like to manage the load to reduce its consumption when the hourly load cover factor is lower than 1. In the next part, we are introducing how to reach such control strategies.

Control strategies approach for autonomous energy system sizing
In order to control and improve energy autonomy, we would like to provide a predictive strategy based on predictive models. PV production forecast can be based on sun irradiance forecast, which can itself  9 . This leads us to develop the irradiance forecast model in the first phase of our project [29]. In this second phase, we continued by the PV production forecast model from the previous irradiance model. The power generated by photovoltaic panels (PPV) is given by the equation below [18], [29]: . .
Where: S PV -PV area (m 2 );  PV -System global efficiency; I PV -Global solar irradiance on the panel plane (W/m 2 ), as following: .
DNI -Direct Normal Irradiance (W/m 2 ); DHI -Diffuse Horizontal Irradiance (W/m 2 ); GHI -Global horizontal irradiance (W/m 2 );  -Panel Tilt angle (rad); θz -Zenith angle (rad); θ -Theta angle (rad); ρ -Albedo coefficient of Ground. PV power generation forecast is updated every 3 hours from web service. The measured GHI/DNI dataset from Campbell Scientific weather station (including Rotating Shadowband Radiometer) located just beside Greenhouse, and measured PV power data from our building PV's system in 2018, were used to validate our model. The accuracy of forecasting energy production models could affect the performance of the PV system and control strategies. Figure 6 pointed out that our model has a good agreement with measured data.

Losses calculation
A monitoring and control system is integrated into the inverter in order to control battery modes. The integrated algorithms are in black-boxes supplied by manufactures. In this case, an additional monitoring and control system can help us implement saving energy strategies more easily. According to some studies, inverter operating modes significantly affect losses [14][15], and this value increases while the system runs with a small load. Therefore, loads shedding could be leading to much fluctuation of losses, but it has not been considered in many studies [13]. In this study, we took into account inverter losses during battery charging and discharging modes. In order to calculate inverter losses while lack measured data in charging battery mode, we had to identify periods of charging or discharging basing on tracking the increasing/decreasing trend of battery voltage. A function D(t) was created to observe the duration time of charging/discharging battery modes:  In discharging mode:  In charging mode: _ 0 (10) We considered a set of experiments data consisting of the start time, stop time while battery capacity was preserved (C i = C end ). Where: (C i , C end -Corespongding with battery capacity at initial, endpoint).
(11) (12) For two days of data, we assumed that inverter losses were constant in each operation mode. Therefore, power and energy losses through the inverter in charging and discharging modes were determined.
(13) _ (14) SOC(t n )=SOC(t (n-1) )+P bat (∆t) (15) By Equation 7-15, unknown parameters as inverter losses in charging/discharging modes, stage of charge of the battery (SOC), and autonomous level were identified.  Figure 7, from 14/8/2019 to 16/8/2019 with a start/stop time while the battery was full, inverter's operating modes created significant energy losses (over 50% of the power produced by system). In which, there is a big gap (over two times) between losses in charging and discharge modes with E_(loss-discharge)=0.67 (kWh) and E_(loss-charge)=1.54 (kWh). On a daily scale (2 days of summer), Greenhouse has only a maximum of 26.2 hours of energy autonomy. That means losses and analysis on a smaller time scale should be considered to ensure the precision of solutions. In summer with 10 days data, there was small deficient energy because an average of PV energy production (1kWh) was lower than a demand for loads and losses (1.1kWh). During the night (13h), when the sun is not available, we need to supply (around 600Wh) for pump and losses in discharge mode. In this case, two batteries of (22Ah, 12V) to storage energy are required. Nevertheless, we need bigger energy storage to maintain this consumption level because of lower energy production in the winter days. Figure 8, with a minute time scale, shown that PV production was not enough to supply for the load even while the solar energy was available, that we can see several points with γ load <1. Therefore, load control strategies in a minute are necessary to avoid oversized storage capacity and increase auto-consumption (γ load =1). A comparison between our PV production prediction model with measured data figured out a small gap, but total energy prediction obtained a better accuracy. Therefore, our model with a load profile can use to predict SOC of battery by Equation15. Then, we can develop energy-saving strategies to avoid power consumption exceeding the system supplying capacity. The evaluation of SOC and PV power will be updated according to the load control and weather conditions, every 3 hours. Then, a controller will reduce the power of the pump when the forecast shows that there is a deficiency of energy in the system and will increase the power of the pump when the system is predicted a surplus of energy.

Conclusions
In this study, we developed an energy monitoring and control system based on power sensors, an actuator to control the load, and model predictive strategy. The low-cost hardware and open-source software were considered to accelerate the progress of our project and reduce costs. Several tests and evaluations were done to ensure accuracy, stability, response-ability of the system, and limit data errors. A suitable controller and load model were estimated, and unknown parameters were calculated based on a minimal set of measured data. The experiment of low-cost sensors in the laboratory has several challenges in real-world applications because of many uncertainty conditions and robustness issues. But they can be used for non-critical systems such as our greenhouse autonomous system. A model of PV energy prediction was developed and validated with real data. Based on load matching indicators, we assessed the system's ability to self-supply power on-site in different seasons, but a battery is still necessary to overcome daily variations. Losses in various modes of inverter were pointed out. Analyzing energy autonomy levels of Greenhouse figured out lacking power supply to loads on Greenhouse in a day and monthly scale. In further work, the control strategies need to be done to achieve an autonomous energy system adapted to the limited size of our storage.