top of page

The proposed smart control for the West Whins energy centre utilises the Emoncms monitored data, weather forecasting Application Programming Interfaces (APIs) and the recently developed PyLESA modelling software. The Emoncms data serves to update the model as changes in the system occur, whilst logging information such that a demand profile can be learned. PyLESA serves to model the West Whins system whilst providing the algorithms used in both fixed order and model predictive controls. To explain the logic involved, first the control capabilities of PyLESA will be evaluated.  

Proposed Smart Controls

PyLESA Controls: Fixed Order

The simplest way to control the simulated model in PyLESA is using Fixed Order Controls (FOC). This effectively gives a level of priority to each source of energy available to meet the demand.

 

 

​

​

 

 

 

​

​

​

​

​

​

​

 

Figure 1 shows the energy sources available in PyLESA. By inputting each sources’ designated number (to the left of the description) in the desired order of priority, PyLESA will then simulate the response of the system over a fixed timeframe. A grid import price setpoint can also be set such that the energy source used to meet the demand will change when the demand reaches a certain level. 

 

Fixed order control has primarily been used in this project to approximate the behaviour of the current West Whins system. In reality, the West Whins system has no controls in place; however, an output can be achieved that resembles the behaviour of the system using this control. 

Picture 1.png

Figure 1: PyLESA fixed order control  

PyLESA Controls: Model Predictive

Picture 2.png

The other way to control the system in PyLESA is by using Model Predictive Controls (MPC). This follows a much more complicated process that runs several simulations, varying specific parameters such as charging times for electrical and thermal storage.

 

 

​

​

​

​

​

​

​

​

​

 

​

​

 

 

This is represented by ‘initial/update state variables’ in Figure 2 on the left column. The responses of the system to these changes are recorded and compared in an optimiser. The optimiser then checks if the outputs meet set constraints such as comfort metrics and capacity of the storage. The most appropriate output is then compared based on an objective function – for the version of PyLESA uploaded by Andrew Lyden, the objective function is economic performance.

Figure 2: PyLESA model predictive control (Reproduced from (Lyden, 2020))

As this is open source software, the objective function could theoretically include the optimised use of local renewable energy, but for the purposes of this project it has been kept the same. For more information of how MPC has been constructed in PyLESA, see Andrew Lyden’s Thesis. (Lyden, 2020) 

​

For the purposes of this project, PyLESA’s ability to simulate the developed West Whins model using model predictive control is invaluable. With the emergence of research topics such as ‘hardware in the loop’ control systems and backlog of papers regarding system control using weather forecasting and user occupancy, the utilisation of PyLESA as a practical integration for predictive control seemed a worthy idea to develop. (Rolandoa, et al., 2017), (Frison, et al., 2019), (Tuohy, et al., 2015) 

Proposed Smart Control Design

The proposed smart control has been designed with a focus on the requirements of the West Whins system. The main purpose of this control is to output optimal charge and discharge times for a form of energy storage – in the case of West Whins, the main component sought to be controlled is the domestic hot water thermal storage. The smart logic of this design is embedded within PyLESA’s MPC algorithm that uses the West Whins model previously developed. The challenge in this design is to form profiles for forecasted weather and demand such that the output of the PyLESA simulation predicts the optimal control for the system. 

Picture 3.png

Figure 3: Proposed control schematic

Figure 3 shows the three main components of this proposed control: APIs which provide weather forecasting for local energy generation prediction and tariff prices; data feeds which will be extracted via Emoncms’ monitoring feeds to update the system state of charge and create a learned demand profile; and PyLESA, the central piece that pulls this data together to predict the optimal charge/ discharge time of the thermal storage via the developed West Whins model and MPC algorithm.  

API : Application Programming Interface

An API allows specific information to be requested and received to a computer via a data server. This is a particularly useful tool in retrieving weather data and is widely utilised in the digital world for this purpose. (Tuohy, et al., 2015) Tariff prices have also been included in Figure 3 as tariffs such as Octopus Agile vary their prices depending on the current demand/generation ratio on the grid. For more information on this, see our focussed review. It should be noted however that, as of present, the West Whins tariff is fixed and so no API is required.  

 

The weather data required for the PyLESA input is the windspeed, air temperature and solar radiation. Seeing as the simulation will take place over a 24 hour period, a forecasted 24 hour weather profile is required. As the control is set to run every hour, the forecasted weather profile should also update by the hour. There are various websites that allow this information to be extracted, some free for public use and others requiring a paid subscription. The most applicable, free weather API found during this project is sourced from open weather map. (OpenWeather, n.d.) This allows for the extraction of the windspeed and air temperature in either JSON or XML data types every hour over the next 48 hour period. It also allows for 1000 API calls per day which is more than sufficient for the proposed system. Solcast provide an API toolkit for accessing solar radiation freely to researchers and students. (Solcast, n.d.) It should be noted however that this is not available for commercial use and only allows 10 calls per day – limiting its effectiveness. This can be upgraded to 1000 calls a day for $5/ month. This API allows for the extraction of all required radiation details requested in the PyLESA input file, i.e. DHI (diffuse horizontal irradiation), DHR (direct horizontal radiation) and GHI (global horizontal irradiation).  

​

​

​

​

​

​

​

​

A key challenge of the overall design is integrating weather forecasting directly into the PyLESA inputs such that the MPC can run automatically throughout the day. Figure 4 provides a framework for this and a PyLESA input sheet including API integration for air temperature and windspeed will be available for download in the resources section.

Picture 4.png

Figure 4: A framework for integrating APIs into the proposed smart control

Local Emoncms

The other source of information utilised in forming the PyLESA inputs is the local version of Emoncms – the West Whins’ hub for monitoring feeds. On the local version of Emoncms,  data feeds are downloaded directly to a PC which can then be called into come sort of machine learning designed to predict a 24 hour demand forecast. This has been previously achieved during the ORIGIN project where a user input was also installed so the prediction could account for residents going on holiday or to account for visitors. (Tuohy, et al., 2015) This element of the proposed control is decidedly out of the scope of this student project due to the complexities of machine learning. 

PyLESA

With the PyLESA inputs for weather resources and demand profile integrated, a MPC simulation can be run with the same models developed in the previous section. The output of this simulation will show the behaviour of the optimised behaviour for thermal storage based on the predicted information. As this information is subject to change, it is suggested that the simulation be run every hour such that weather and demand profiles can be updated.  

Demonstrating and Analysing the Proposed Smart Control

By recording API weather forecasting data and extracting a demand profile from recoded monitoring feeds, a simulation can be run to analyse the PyLESA MPC output in comparison to the behaviour of the current system and fixed order control using data from the real system. 

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

Figures 5a and 5b show that the weather and demand profiles have been taken over a 24 hour period. This is as the integrated MPC only considers a 24 hour period due to the uncertainties involved in these predictions. The weather data has been converted into wind generation within PyLESA and for the heat demand, domestic hot water has been solely considered as this is the only form of heat supply that passes through the thermal storage (space heating only offers a buffer tank). The data taken is from the 8th of April, 2021 – an arbitrary day that’s simulation results proved an interesting output for this project.  

 

The inputs can be used to run a simulation with both of PyLESA’s control options: fixed order control which can be used to represent a system that prioritises local renewable energy (see order in Figure 1); and model predictive control which can be used to represent the proposed control. The local generation capacity has been calibrated such that the grid is importing 57% of the time, as is observed within the West Whins system. (Flett, et al., 2020) All other models have been carried over from the previous section.  

Picture 5.png
Picture 6.png

Figure 5a: Proposed smart control simulation inputs for a 24 hour period – wind generation 

Figure 5b: Proposed smart control simulation inputs for a 24 hour period – hot water demand 

The output of the fixed order control simulation is shown in Figure 6a. Numerical data for this simulation shows a total energy input of 7.5 kWh to the thermal storage within the charge times shown above. Monitoring data within Emoncms (on the 8th April, 2021) shows a total energy input of 10 kWh to the thermal storage within a charging period from 08:00 to 13:00 with a period of rest between 10:30 and 12:00.  

 

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

Seeing as less energy is being used and the charging period is primarily during the low-tariff period the fixed order controller demonstrates some system improvements. However, as the grid interaction and cashflow of the real system is not available for the purposes of this student project, a statistical analysis cannot be undertaken between the proposed MPC simulation and monitored data. For this reason, the fixed order control will act as the basis for comparison with the proposed MPC design. 

Picture 7.png

Figure 6a: Proposed smart control simulation outputs showing thermal output of the heat pump and grid interactions for a full day using FOC 

The output of the model predictive simulation shown in Figure 6b (representing the proposed system) demonstrates key changes from the fixed order control simulation. The most prominent is the behaviour of the thermal storage. The charge/ discharge time is altered to primarily support times of peak load. Any surplus energy in the system previously used to charge the thermal storage is instead exported to the national grid. This results in an increased cashflow due to increased export, demonstrating the MPC’s success in optimising the system’s economic performance.  

Picture 8.png

Figure 6b: Proposed smart control simulation outputs showing thermal output of the heat pump and grid interactions for a full day using MPC 

Numerical data shows a total energy input to the thermal storage of 5.7 kWh with the charge times shown above. Recalling that the real system uses 10 kWh, this is almost half the total energy used in comparison to the current system. This suggests a more optimised use of the heat pump energy throughout the day can be extracted using this proposed smart control.   

 

 

 

​

​

​

​

​

​

 

Table 1 shows that overall, the performance of the system is significantly improved when model predictive controls are implemented. Although the total energy imported throughout the day is observed to increase slightly, the energy exported increases dramatically. This results in the system’s import ratio:

 

 

​

​

This input ratio decreases by 27%. The resulting economic change for this particular day is 31p. Speculating further and scaling this up demonstrates potential savings of over £100/year for all six flats.  

​

A concerning outcome of the MPC simulation is the grid import slightly increasing. Previous research has demonstrated grid imports to decrease when MPC is applied. (Flett, et al., 2020) Figure 6b shows a short spike in grid import at around 18:00 which is not required in the fixed order control simulation shown in Figure 6a. It can be said that this is due to the economic gain of export superseding the losses of the added import when this system action is taken. One way of optimising the MPC output further would be to edit the PyLESA open-source code such that the MPC output is oriented around the utilisation of local renewable energy as well as economic performance.

Picture 9 (Table).png

Table 1: Grid interactions and cashflow results  for the Proposed Smart Control 

Equation.png

Discussion

Overall, the proposed smart control design has demonstrated a significant upgrade to the way the West Whins system currently behaves. However, there are several limitations to be addressed before it can be integrated in practice. The main outcomes and limitations have been detailed below. 

Outcomes 

The development of an API integration framework and PyLESA input file 

Appropriate weather forecasting APIs have been presented for use in the proposed smart control alongside a framework and downloadable demonstration of how this works.  

 

​The utilisation of Emoncms monitoring feeds 

The current feeds being logged via the Open Energy Monitor kit aren’t being fully utilised at present. Seeing as the proposed smart control uses these to both update the thermal storage’s state of charge and to predict the system’s energy demand, this design provides further purpose to these feeds.  

 

The proposed smart control savings demonstration  

The proposed smart control’s value has been demonstrated with real data to show dramatic cost savings of MPC integration. 

​

Limitations

Predicting the energy demand of West Whins 

Machine learning must be integrated to create a learned demand profile. This is an opportunity for future work as the required feeds for creating this are already in place. 

 

The PyLESA models are not directly catered to the West Whins system 

PyLESA’s models are limited in that there is no way to account for West Whins’ solar thermal panels. As this is directly connected to thermal storage, in a practical system a model should be added to account for this heat input. This could be done by utilising the solar radiation weather resource inputs. 

 

The uncertainty of weather and demand forecasting  

The optimised output for the proposed smart control is likely to vary throughout the day due to changes in weather forecasting and uncertainty in demand prediction. It has been suggested that the simulation every hour to counter this; however, a mechanism must be put in place to definitively decide which time the storage should be charged and discharged.  

bottom of page