Operational supply and demand optimisation of a multi-vector district energy system using artificial neural networks and a genetic algorithm

• An optimisation strategy


Pl e a s e n o t e:
C h a n g e s m a d e a s a r e s ul t of p u blis hi n g p r o c e s s e s s u c h a s c o py-e di ti n g, fo r m a t ti n g a n d p a g e n u m b e r s m a y n o t b e r efl e c t e d in t his ve r sio n.Fo r t h e d efi nitiv e ve r sio n of t hi s p u blic a tio n, pl e a s e r ef e r t o t h e p u blis h e d s o u r c e.You a r e a d vis e d t o c o n s ul t t h e p u blis h e r's v e r sio n if yo u wi s h t o cit e t hi s p a p er.
Thi s v e r sio n is b ei n g m a d e a v ail a bl e in a c c o r d a n c e wit h p u blis h e r p olici e s. S e e h t t p://o r c a .cf. a c. u k/ p olici e s. h t ml fo r u s a g e p olici e s.Co py ri g h t a n d m o r al ri g h t s fo r p u blic a tio n s m a d e a v ail a bl e in ORCA a r e r e t ai n e d by t h e c o py ri g h t h ol d e r s .

Introduction
Building energy consumption is an important sector in both the current and future energy landscapes given that it is estimated to account for 40% of the total EU energy consumption [1].Buildings are also at the forefront of large changes in the overall energy system due to significant growth in the deployment of renewable resources such as solar photovoltaics (PV) and solar thermal panels.The increased penetration of renewable energy generation and alternate energy sources has led to a paradigm shift in the way energy is deployed and managed.This is one of the key drivers towards the concept of the microgrid which aims to decentralise energy generation and control closer to the communities in which the energy is utilised.Microgrids are commonly connected to existing national scale energy networks but may have the capacity to operate independently in so called 'islanded' mode.It is theorised that the future of energy generation will be devolved to a collection of interconnected microgrids operating within a wider 'smart grid' [2].
Management of the smart grid has become increasingly challenging as energy supply is only partially controllable due to fluctuating generation from renewable sources.There is also an increasing trend towards multi-vector energy systems.These feature multiple sources of primary input energy, convert it through various technologies, and output the energy vector required by the user.This could include a CHP which converts gas to electricity and heat, a heat pump to convert electricity to heat, or a power to gas system which converts electricity to hydrogen or synthetic natural gas.Therefore, multi-vector energy systems must be managed and holistically optimised, as optimisation of a single energy vector without consideration of the others may lead to an overall sub-optimal solution [3].To tackle this challenge, simultaneous control of both energy supply, demand and storage will be required to ensure stable, cost-effective and efficient energy supply that maximises the use of renewable resources.At the same time, there has been an increase in the amount of data available through technological advancements such as the Internet of Things (IoT).If contextual information can be leveraged from these data sources, combined with weather services and existing Building Management Systems (BMS), then a step change can be achieved in the field of building and district energy management.This provides an opportunity for the use of Artificial Intelligence (AI) techniques to be deployed to enhance building and district energy management strategies.Rather than relying on reactive, rule-based controls, AI can pave the way for a new generation of predictive, context-aware energy management tools [4].In view of this context, this work aims to address the following research questions: • In a multi-vector district energy system with several energy con- version technologies, how can the optimal operation of these technologies be determined?
• How can the resulting optimal schedule be adjusted to account for prediction uncertainties?
• Can partially controlling building energy demand in addition to district energy supply reduce total district energy costs and emissions?

Related work
Several studies found in the literature aim to optimise the supply of energy to a microgrid of buildings from multiple generation sources.A leading approach to model the energy interactions within multi-vector microgrids is the 'Energy Hub' concept outlined in [5].This approach reduces the energy generation and conversion into a single input-output model with all the mathematical modelling of specific units contained within the Energy Hub. Energy Hub modelling has been utilised in conjunction with optimisation strategies.These studies utilised linear programming techniques [6], dynamic particle swarm optimisation [7] and a network of energy hubs [8].However, these papers assume the future building demand and renewable supply is known a priori.
A complex, multi-vector, microgrid system containing micro gas turbines, solar PV, concentrating solar powered systems, an absorption chiller and energy storage capacity is optimised using a model predictive control approach in [9].Renewable supply and building demand was forecast, from which an optimal operating schedule of the dispatchable energy generators and the energy storage units were produced.Chaouachi et al. [10] combined a fuzzy logic optimisation strategy with AI-based prediction of the electricity produced by a wind turbine and solar PV array as well as the load demand.Using this framework, a simulation-based case study showed a small reduction in cost and emissions compared to a baseline strategy.However, this study assumes that the forecasts produced by the artificial neural networks (ANN) are entirely accurate therefore do not include an error-management procedure to match the actual generation and load between optimisation timesteps.Mallol-Poyato et al. [11] used a Hyper-heuristic algorithm to optimally control the charging and discharging of an electrical energy storage (EES) system.Two case studies showed that the inclusion of EES produced significant cost savings and implementing the optimisation framework increased the savings further.Once again, this study failed to consider the impact of generation and demand forecasting errors.
Zhang et al. [12] used a Mixed-Integer Linear Programming (MILP) optimisation procedure applied to a multi-vector district energy system.The study aims to schedule renewable supply, EES, and a CHP.Case study results showed that operating as Model Predictive Control (MPC) rather than day-ahead control made better use of the energy storage device providing the consumer significant savings.Ma et al. [13] produced an MPC-based microgrid central controller to manage distributed generation and energy storage.Whilst the controller effectively shifts some load away from peak pricing periods, the control horizon is only one hour and the demand profile is perfectly predicted.A MILP-MPC strategy for managing the heat and electrical supply to a group of residential buildings in a microgrid setting was developed in [14].Shared energy generation and storage are best utilised to flatten peak loads and hence reduce the cost of energy for the district as a whole.The coordination of a series of centralised heat pumps supplying buildings in a district is addressed in [15].The authors display a cooperative optimisation strategy that exploits the flexibility provided by sharing centralised resources.The larger building in the district is able to achieve cost savings of 15% however the smaller buildings receive a small rise in cost raising issues of fairness.Furthermore, the buildings' thermal dynamics are modelled using fairly simplistic state space models that does not take into account internal equipment gains or occupancy.Razmara et al. [16] developed a bi-level optimisation that aimed to control building thermal energy demand and then checks the given solutions to ensure they do not breach district-level constraints.If these constraints are breached a second, district-level, optimisation strategy is carried out which feeds back results to the building-level optimisation.A case study based on a university campus with a ground source heat pump demonstrates a 25% reduction in cost without breaching grid constraints.All of the previous papers aimed to optimise the energy supply to a consumer.However, they have failed to consider any level of demandside flexibility from the buildings supplied by the microgrid.Buildinglevel optimisation strategies have been proven to adapt building demand around dynamic pricing strategies and/or renewable energy generation.For example, a zone-level building set-point optimisation is carried out using a genetic algorithm and an ANN in [17].This optimisation framework was shown to be adaptable to different occupancy patterns, time-of-use (TOU) energy pricing and weather conditions.Similarly a multi-stage optimisation procedure combining a genetic algorithm, fuzzy logic control, and ANN was successfully applied to a Greek hospital in [18].Lee et al. [19], used an ANN based MPC strategy to control a zone Air Handling Unit (AHU).It aimed to calculate the optimal AHU cooling operation over the next 24 h to minimise the energy cost and maintain thermal comfort using Mixed Integer Non-Linear Programming, MINLP.The ANN accurately predicted indoor temperature and energy consumption, but the application was limited to only a single zone within a building.An ANN based controller was also developed in [20].The ANN predicted the change in indoor conditions including temperature, relative humidity and the PMV.These predictions are subsequently used to control heating, cooling, humidifying and dehumidifying devices to minimise over or undershoots often found in non-predictive, conventional control.Whilst this approach provided better thermal comfort compared to conventional controllers, it did not consider the minimisation of energy consumption as an objective in its control scheme.
Grey-box, resistor-capacitance (RC) models were applied in conjunction with an MPC optimisation in [21].This study aimed to control the supply water temperature to a university building to minimise the energy consumption.This study effectively demonstrated that a more context-aware building control system can be flexible to external energy systems.Oldewurtel et al. [22], adapted traditional MPC to Stochastic MPC.Essentially, this means the MPC strategy took into consideration uncertainties in forecasts when carrying out the optimisation.This resulted in a slightly more cautious optimisation that did not go so close to the comfort boundaries whilst still achieving good energy savings.Mahendra et al. [23], also aimed to address the problems that stem from forecasting uncertainties produced by a RC model.This solution runs a reactive algorithm in between the MPC time steps that can take swift action if the forecasts are clearly incorrect due to an unexpected spike in occupancy for example.
Given that buildings form such a crucial component of a microgrid energy system, it is pivotal that they are included as active participants within a district optimisation strategy.Several studies aim to achieve this by creating an internal energy market within a microgrid.Anees and Chen [24] controlled the electricity demand of a group of smart buildings equipped with smart appliances which are scheduled via a community controller accessing real-time energy pricing.Another district energy management strategy was developed in [25].Consumers were required to optimise their own power profiles that satisfied their comfort constraints and submit these to the district controller a day ahead.Then during the day, a system of energy trading and balancing is implemented to manage deviations from the stated power profile.A multi-agent approach is utilised in [26].Aggregated consumer loads were represented by an agent which initially tried to meet it's demand and then calculate spare capacity or the energy deficit.Energy buyers and sellers then submitted bids to a central market agent to determine the energy trade between microgrids and consumers.
Abdulaal et al. [27] developed a demand response optimisation framework aimed at the industrial sector.A two-stage approach is used where stage one identifies the amount of load to be shifted over the next two hours and stage two then tries to follow that strategy with minimal loss of comfort to the user.However, the study makes the assumption that any load shed in hour one must be consumed in hour two and vice versa.This assumption may be applicable for some consuming devices but significantly oversimplifies the thermal dynamics of a building.Razmara et al. [28] effectively demonstrates the benefits of a combined supply and demand optimisation.The optimisation strategy receives weather and energy cost forecasts from which it determines the optimal energy supply strategy to minimise energy costs whilst keeping the building at a comfortable temperature.An additional stage then checks the feasibility with respect to the electrical network.However, this work only considers optimisation of one energy vector, electricity, and uses a relatively simplistic RC model to calculate the heat dynamics of the building.Xu et al. [29] developed an optimisation framework which combined optimisation at a building level whilst coordinating energy exchange between buildings at a wider district level.This is achieved through applying Lagrangian Relaxation to decentralise a stochastic mixed integer programming problem.Whilst producing significant cost savings at a building and district level, this study again only considers electricity and uses a simplistic state space model of a room to calculate the indoor temperature of the buildings.Furthermore, these studies fail to consider the impact of the demand side optimisation on the price of energy provided by the utility.

Contribution
Previous studies rarely aimed to fully integrate demand and supplyside optimisation.Often demand-side optimisation may consider a dynamic energy pricing tariff, however, they fail to consider that the demand-side optimisation can impact these tariffs.If energy generation is localised at a microgrid level, peak load shifting could have a direct consequence on energy supply cost, as expensive backup generation units may not be utilised.Similarly, supply-side optimisation often considers known and inflexible demand.Studies that do consider the flexibility provided by buildings, model this in a very simplified way that may not fully capture the thermal dynamics within a building and therefore the impact on occupant comfort.The majority of the literature reviewed in the previous section failed to consider a multi-energy vector district with most only aiming to optimise a completely electrical system.This paper's contribution lies in the combination of the following features: • A holistic optimisation that manages the operation of supply gen- eration units, thermal energy storage and building demand through control of the heating set point temperature.
• Optimisation of a multi-vector energy system including natural gas, electricity, and heat.
• Utilisation of multiple ANN to predict variables such as building energy consumption, indoor temperature and PV generation.
• An intermediate, real-time control adaptation is included to adjust the optimal solution to account for prediction errors that ensures a feasible solution.
• A clear comparison between optimisation of just energy supply and optimisation of both energy supply and demand demonstrates the potential savings when exploiting building thermal flexibility.
Following this section, a description of the case study district is provided in Section 2. The modelling of the case study district is given in Section 3 and optimisation strategy of the supply-side is shown in Section 4. The adaptations to include demand-side optimisation are discussed in Section 5. A comparison of the results produced by the two optimisation strategies compared to baseline operation is given in Section 6.These results are discussed alongside the limitations of this study and future objectives in Section 7. Finally, the conclusion is provided in Section 8.

Case study district description
The analysis carried out in this study is based on a virtual, simulated, eco-district containing mixed-use buildings alongside an energy centre producing heat, delivered by a district heating network.The district is designed to be based in the city of Cardiff, UK, with real historical weather files used as inputs to simulation models.This district has been inspired by the authors' involvement with real eco-districts, including "The Works" district in Ebbw Vale, Wales (UK) [30].However, a fully simulated district has been used for a number of reasons.It allows freedom with respect to scenario generation such as the type of buildings and generation technologies included.A simulated district also allows like-for-like comparison using different strategies but maintaining the same user behaviour and weather conditions.Where there are data availability issues at a pilot site, these can be filled from alternate sources.However, at all stages, the authors have endeavoured to make the virtual eco-district as realistic as possible using a combination of detailed simulation models and environmental data from real pilot sites to model the case study district.

Demand-side design
District energy demand is modelled at a building level using the established building energy simulation tool, EnergyPlus [31].In order to make the demand-side simulation as realistic as possible, Commercial Reference Building Models have been directly downloaded from the US Department of Energy's website [32].Using these models ensures a rigorously verified, realistic model of a modern, energy efficient building without arbitrary parameters introduced based on a particular modellers perception.It also has the added benefit of allowing this work to be open, reproducible and directly comparable to any future energy optimisation platform.Specifically, the buildings chosen to be represented in the virtual eco-district are the Large Office, Secondary School, Hospital, Large Hotel, and High-Rise Apartment.Both the hospital and hotel provide a considerable and steady baseload with the school and office generating daily peaks forming and interesting scheduling challenge for facility managers.The overall district heating consumption over a typical winter week is shown in Fig. 1.

Supply-side design
To increase the resilience, flexibility and efficiency, and given the nature of the demand presented in Section 2.1, the district energy supplied from the energy centre will come from multiple sources and multiple generation units.The relatively large and consistent baseload makes a combined heat and power (CHP) unit highly attractive as it achieves very high combined efficiency provided it can maintain operation for long periods.In this case, the CHP has been sized to be operational for 5000-6000 h per annum in line with current standards [33].It was found that a CHP size of around 200-225 kW th fulfilled this specification and therefore the CHP was modelled on a Power Box 138SNG with a nominal thermal and electrical capacity of 207 kW and 138 kW respectively.
In addition to the CHP providing a base load, a heat pump (HP) has been included to provide additional, more flexible heat output.The HP has been sized relative the CHP to allow the maximum CHP electrical output to be similar to the maximum electrical input of the HP.In reality, a HP of this size is likely to be a water-source HP and due to the relatively high district heating supply temperature of 80 °C, the HP coefficient of performance (COP) is likely to be a relatively low 3 [34].Therefore, in this case study, a HP with a nominal thermal capacity of 400kWh is included.
To provide crucial flexibility and resilience a series of gas boilers are included to provide the peak load capacity.The total gas boiler capacity has been sized to meet the maximum possible demand of 2400 kW.This has been split into four separate units 600 kW gas boilers modelled on the Rehema gas 310 eco pro 650.Whilst natural gas remains a polluting, non-renewable, fossil fuel, it is currently viewed as the least worst option during the transition to a clean, renewable future [35] and is therefore used in this case study.However, it is likely that in the near future, natural gas boilers and CHP could be modified or replaced to utilise biomass, synthetic natural gas or biogas.The optimisation strategy and modelling procedure outlined in this study is equally applicable in such a scenario.
Renewable energy generation in the form of solar photovoltaic (PV) panels are included in the simulated eco-district.The modelling of solar PV generation will be based on the historical data of a real pilot site, namely "St Teilo's School" in Cardiff [36].The modelled solar PV capacity is 250 kWp.Finally, a thermal storage tank has been included to increase the generation flexibility and providing the opportunity for an intelligent management system to capitalise on this.Note that this storage tank goes beyond the traditional buffer or mixing tanks which are commonplace in a district heating system with multiple generation sources.The thermal storage tank considered in this study is actively controlled and can be 'charged' by increasing the water temperature above that of the district supply temperature.A schematic representation of the virtual eco-district considered in this work is presented in Fig. 2. Note that in this study, the district heating network has not been explicitly modelled and it is expected that for a modern network, the heat loss during distribution will be small (around 1-2% during normal operating conditions [37]).However, it is proposed that if this control strategy was deployed in reality, the heating network characteristics such as heat losses, thermal lag and return temperatures would need to be modelled.Based on the observed district heating characteristics, the heat demand of each building relative to the energy centre would need to be adjusted.It is expected that the predicted building demand would need to be increased due to distribution losses and the demand would need to be brought forward to account for the propagation time.The proposed methodology is flexible to incorporate almost any form of district heating simulation model (computational time permitting) whereas traditional linear or gradient-based methods will always require simplified models.District heating distribution modelling will be addressed in future work and calibrated once sufficient data has been collected from pilot sites.Fig. 1.A sample week of heating demand in winter.

District modelling
The complete district model is made up of several sub-components including controllable generation units (CHP, HP and gas boilers), a thermal storage hot water tank, uncontrollable energy generation from solar PV panels, and demand from the connected buildings.This section will outline how each of these components is modelled for use in the optimisation strategy.

Controllable generation units
The heat energy generated by the production units is simply calculated by multiplying their percentage load (an optimisation decision variable) and the nominal thermal capacity of the production unit.
where Q t U is the heat generated by production unit U at time t due to the load percentage L and the nominal thermal capacity C th U .The electricity produced by the CHP is calculated in a similar manner in Eq. (2).
where E t CHP represents the electrical load produced at time t by a CHP with a nominal electrical capacity of C el CHP .The raw fuel consumption of each generation unit is calculated based on the percentage load, nominal efficiency and part load factor.Crucially, this optimisation has the capacity to include non-linear part load functions which would need to be calculated experimentally or from data provided by manufacturers.These non-linearities are often ignored by optimisation methods commonly found in the literature such as MILP.In this study we have considered a polynomial regression equation relating relative efficiency and load percentage shown in Eq.
(3) similar to that found in [38].However, this optimisation methodology would be flexible to include a variety of part-load efficiency computations such as relationships with outdoor temperature, atmospheric pressure or calculation via a black box model.
where Rel t U is the relative efficiency of generation unit U at time t and a b , and c are regression coefficients.Finally, the raw fuel consumption is calculated in Eq. ( 4).
where F t U is the fuel consumption (e.g.gas or electricity) of generation unit U at time t and U is the nominal thermal efficiency of the generation unit and Rel t U is the relative thermal efficiency due to part load characteristics.Note that in the case of a HP, the coefficient of performance (COP) will be used in the place of the nominal thermal efficiency.Due to the size of the HP simulated in this case study, it is assumed to be modular.Therefore, part-load factors are not applicable in the case of the HP as modules will either operate on or off, and to vary the output of the HP the number of operating modules will vary.
The cost of the generation, V t , is simply the multiplication of the fuel consumed at time, t, and the energy tariff at that hour, P t , as shown in Eq. ( 5) As well as cost, the district can receive income, I, through government subsidies such as the Renewable Heat Incentive (RHI) and feed-in tariff.RHI income is related to the energy provided from sources such as biomass, heat pumps and solar thermal systems.The feed-in tariff is the price at which electricity can be sold back to the national grid.They are calculated as shown in Eqs. ( 6) and ( 7) respectively.
The final objective function to be minimised, f, is the total cost of generation minus the income from RHI and the feed-in tariff calculated using Eq. ( 8).
Despite not being an explicit objective of the optimisation, the CO 2 emissions resulting from each control strategy will be calculated to provide additional comparison.The CO 2 emissions of each scenario was calculated using Eq. ( 9), which multiplies the raw fuel consumption by their respective CO 2 emission factors, X.The emission factors have been taken from UK government statistics [39].The electricity factor in particular would vary from country to country and year to year depending on the make-up of electricity generation in each specific case.For reference, a complete list of the constant parameters is included in Table 1.A time of use electricity tariff has been used with data retrieved from the 'Octopus Energy Agile Tariff' [40] with varying halfhourly prices linked to the wholesale electricity market.

Thermal storage
A thermal hot water storage tank is modelled relatively simply in this study as a percentage of its maximum energy capacity.The maximum thermal capacity of the storage tank is assumed calculated via Eq.(10).
S DH (10) where C th S is the maximum energy available in the storage tank, m is the mass of water, c p is the specific heat capacity of water, T max S is the maximum temperature of the storage tank and T DH is the district heating supply temperature, assumed to be a constant 80 °C in this work.Therefore it is evident that the only variable in determining the 'charge' of the storage tank is the tank temperature (assuming a constant c p ).
The net heat energy taken from, or supplied to, the storage tank, Q t S , is determined in Eq. ( 11) by computing the difference between current and previous tank storage percentage, S t multiplied by the maximum capacity of the storage tank, C th S and the charging and discharging efficiency S .(11) Note that modelling the thermal storage in this way assumes a uniform tank temperature and constant district heating temperature.It also lumps ambient heat losses from the storage tank with losses due to discharging and charging and is held constant in this study.However, it is likely that the ambient heat losses from the thermal storage would be related to the storage tank temperature, so Eq. ( 11) could be adapted with an additional term to include this if the effect could be quantified through experimental data.

Uncontrollable generation
As discussed in Section 2, a solar PV field of 250 kWp capacity is considered in the studied case study district.The PV generation modelling will be scaled up based on data from a real installation based in Cardiff with half-hourly recorded data over a period of two years from 2015 to 2016.The available length of data makes this scenario prime for the use of machine learning models to predict the next 24-h of PV power output.Throughout this paper, back-propagation Artificial Neural Networks (ANN) will be trained to predict several key variables using MATLAB's 'Neural Network Toolbox'.Their effectiveness in the building and energy domain has been well demonstrated in the literature.They have been shown to achieve high accuracy, computationally efficient, and require no knowledge of the physical relationships between inputs and outputs.Due to a lack of space within this paper, interested readers are referred to [41] for a detailed explanation of how an ANN works and their applicability to the building and energy domain.
In brief, an ANN is made up of a number of layers, each of which contains a number of neurons.They have an input layer, a number of hidden layers, and the output layer.Each neuron within each layer is connected to every neuron within the following layer.Each connection is assigned a weight, and each neuron has a bias term.During the training phase, the ANN is given a large amount of training data for which both inputs and outputs are known to the ANN.The training algorithm then iteratively changes the internal weights and biases until the mean squared error between the ANN predicted outputs and the target outputs is minimised.Once complete, the weights and biases are fixed and unseen testing inputs are provided to assess the true performance of the trained ANN.
In the case of the solar PV model, the possible inputs were as follows; forecast outdoor dry-bulb temperature, relative humidity, solar radiation, wind speed, atmospheric pressure, the hour of the day, the day of the year, the month and the PV output at the same time on the previous day.The ANN output was hourly PV electricity generation in kWh.The complete dataset was split randomly, 70% for training, 15% for validation and 15% for testing.Throughout this paper, an iterative, stepwise searching approach to training the ANN was taken to find the best combination of input variables and ANN architecture parameters such as the number of hidden neurons, transfer and training functions.This approach is described and validated in [42].Following the offline tuning of the ANN architecture, several inputs were found to be redundant and hence not used in the final PV ANN architecture.The resulting model uses only outdoor temperature, relative humidity, solar radiation, hour, day, month and the output 24-h ago.It contains two hidden layers with 15 neurons in each, uses the 'tansig' transfer function and is trained using the Levenberg-Marquardt training algorithm.
The training and testing R 2 values were 0.9489 and 0.9412 respectively.The prediction performance is displayed graphically for a sample week in Fig. 3.

Building demand modelling
ANN were also used to predict the energy consumption for the next 24-h of each building within the district.The EnergyPlus models described in Section 2 were run with real Cardiff weather data over two years over 2015-2016.15% of the dataset, spread throughout all seasons, was removed to form the testing dataset.The validation dataset comprised another 15% leaving 70% of the original dataset as training data.Weather, time, date, occupancy, and previous energy consumption values were tested as inputs, and the heating energy consumption was the output.Independent ANN were created for each building to capture the particular characteristics of each energy demand profile.Once again, several possible inputs reduced the prediction performance of the ANN (e.g.wind speed) and hence were removed as ANN inputs.The resulting models used only the following variables as inputs; the hour of the day, outdoor temperature, relative humidity, day of the week, energy consumption at the same timestep the previous day, and energy consumption at the same timestep the previous week.The output of each model was the hourly heating energy consumption of each building.The resulting ANN architecture is shown in Fig. 4. Due to a lack of space and given that the aggregated total heat demand is the input to the optimisation; only a comparison between the aggregated predicted and actual demand has been shown for two test weeks in

Supply-side optimisation methodology
This section will outline the methods used to optimise the energy generation set point schedule for the proposed eco-district.The objective of the optimisation is to maximise the operational profit (note this excludes maintenance and capital costs) to the district energy hub while meeting the thermal demands of the district.This study will use a genetic algorithm (GA) in Model Predictive Control (MPC) format to complete the optimisation.Therefore, this section will also give an introduction to the theory behind MPC and GA's and how they are implemented in this scenario.

Model predictive control
MPC is a branch of control that has been extensively applied in the literature to building and district energy management problems.MPC solves an optimisation problem over a pre-determined optimisation horizon, in our scenario 24 h.This means that the optimisation determines the optimal decision variables over that entire period split into optimisation timesteps, in our case 1 h.Once the optimisation is complete, only the decision variables of the first timestep are implemented, the optimisation horizon shifts forward by one hour and starts again.
MPC is well suited to these types of problems as it is predictive in nature, takes outside disturbances into account, and reacts to forecasting errors by re-optimising every timestep [43].Fig. 6 illustrates the generic structure of an MPC process.Measurements from the system along with any other necessary external inputs are provided to the MPC controller.Within the controller the optimisation algorithm runs in conjunction with an internal model that aims to replicate the actual system.This model may be used to determine the optimal solution or check feasibility constraints.Once the optimisation is complete the set points are passed to the system and time is allowed to pass for one increment before restarting the whole process with updated measurements and external signals.

Genetic algorithms
GA's are a branch of meta-heuristic algorithm inspired by the process of evolution present in the natural world.Recent reviews demonstrate that GA's are one of the most popular techniques applied within the field of building and energy optimisation [44].Meta-heuristic optimisation techniques have the advantage of being able to find a nearoptimal solution in cases where exact, deterministic, mathematical modelling of the objective with respect to the decision variables is not possible (such as the use of black-box models) and for non-continuous decision variables.Furthermore, they are suitable in applications with a large search space and tend not to get stuck in local minima [45].A GA typically consists of the following steps or functions; an initialisation  Once the population of solutions has been generated, each solution is evaluated for fitness, in our case this is related to the profit (or loss) each solution would lead to.Based on the fitness of each individual the population is ranked in order of best to worst.This ranking is used by the selection function to determine the likeliness that each solution will proceed to the crossover and mutation step.During the crossover stage, two 'parent' individuals are chosen via the selection function and recombined, mixing chromosomes from each parent, to form a 'child' solution.Some individuals pass through the mutation process whereby single chromosomes of an individual 'mutate' to another random feasible solution to produce the child solution.Note the exact method of recombination in both crossover and mutation can vary depending on the type of function used.Some GAs also use the concept of 'elitism' which takes the best solution (s) from the previous generation and automatically places them in the next generation without passing through either crossover or mutation.The process of generating population after population continues until a pre-defined stopping criterion has been met.The stopping criteria can relate to the optimisation time, number of generations, the best solutions fitness or the deviation between previous and current optimal solution.

Fitness calculation
As described in Section 4.2, the fitness of each individual solution within the GA needs to be computed.An overview of the fitness calculation procedure is shown in Algorithm 1.This procedure starts by retrieving the predicted heat demand, renewable generation, energy price tariffs and decision variables for the following 24 h in 1 h timesteps.The decision variables in this case are the percentage load output of the CHP and HP as well as the percentage charge of the thermal storage tank at each hour of the day giving a total of 72 decision variables.From this, the output energy of each unit is calculated as well as the primary energy input.Following this, the difference between the predicted heat demand and the heat produced from the CHP, HP and storage is calculated.Any hour in which the production does not meet the demand is automatically met by the gas boilers which provide the flexible reserve.The fitness function is modelled in this way for a number of reasons.It allows a reduction in the number of required decision variables by 24 as the gas boilers are not explicitly modelled as decision variables but implicitly controlled as their consumption will still have a significant impact on the fitness of each solution.It removes the requirement for constraint handling and penalisation of solutions which fail to meet the demand [46].In this fitness formulation, the predicted demand is always met and this constraint cannot be breached.Note that oversupply is not explicitly punished in the fitness calculation and it is assumed that excess heat can be dumped, it is presumed that oversupply will naturally be curtailed by the optimisation as it is not economical.
Finally, the cost of primary input energy including natural gas and electricity is calculated by multiplying consumption by the relevant tariff.The income provided by the Renewable Heat Incentive (RHI) associated with the HP is calculated, along with the income received through selling excess electricity to the grid.Note that only delivered heat is eligible for RHI income, which is a government subsidy aimed at encouraging low carbon heating.Any heat that is dumped is deducted from heat eligible to gain RHI income, preventing any 'gaming' of the system by the optimisation.The optimisation objective (and final fitness) is to minimise the total cost of primary energy consumption minus the income from RHI and selling excess electricity to the grid.

Constraint handling, bounds and GA settings
Due to the nature of the decision variables used in this study some adaptations were required to ensure all decision variables remained within bounds.Due to technical constraints, the CHP was modelled as having a lower operating bound of 70% of maximum capacity.Therefore, the only valid values for the decision variable to take would be 0 (off) or 70-100%.This discontinuity could not be modelled within MATLAB's pre-existing GA functions and custom creation and mutation functions were required.During the creation function, individuals are randomly generated.For the 24 decision variables relating to the CHP, the function produces a random integer between 69 and 100 representing the load percentage of the CHP.Then any of these decision variables with a value of 69 was changed to 0. The remaining 48 decision variables relating to the HP and the thermal storage could take any value between 0 and 100.
The crossover function used is MATLAB's 'crossoverscattered' function as this recombines two parent solutions, mixing the existing decision variables and hence ensuring all solutions remain feasible with respect to the operating constraints.A custom mutation function was required for the same reason as the custom creation function.In the mutation function, each decision variable within the individual has a constant 5% probability of mutating.If the variable does mutate then it follows the same procedure outlined for the creation function.If the decision variable relates to the CHP, a random integer between 69 and 100 is generated and then, if the value is 69, it is changed to 0. These custom functions ensure that every individual remains a feasible solution throughout the optimisation procedure.Ensuring that every individual remains a feasible solution throughout the optimisation procedure mitigates the intrinsic discontinuity of the search space brought by the CHP's technical specificity and consequently makes the GA less likely to get stuck in a local optimum.The remainder of the GA parameter settings include an elite count of 5% of the population, a tournament selection function, a crossover fraction of 80%, a population size of 200, and a function tolerance of e 1 7.Note that for all results discussed throughout this work, the GA exited each optimisation due to the function tolerance rather than the maximum number of generations or time limits, this ensured that the optimisation was well converged.

Real-time control adaptation
As discussed earlier in this section, this optimisation will run as MPC meaning it will re-optimise every hour with updated information such as weather conditions, building demand prediction, generation unit failures, etc.Operating as MPC contributes significantly towards managing the errors between predictions and reality as the most up to date information is always used.It also allows the optimisation to adapt to unforeseen circumstances and change course within a relatively short period of time.
However, despite operating as MPC, small errors between prediction and reality are to be expected and must be handled between each hourly optimisation step.To tackle this, a rule-based schedule adapter has been developed to adjust the optimal set points to meet the actual demand.Firstly, this algorithm calculates if there is an energy deficit or surplus between the net predicted heat demand and actual net demand.If there is an energy deficit, i.e. observed demand is higher than that predicted, the algorithm enacts the following steps until the deficit becomes zero: 1. Increase the supply percentage from the lead heat supplier (the CHP or HP depending on which has a higher percentage load) 2. Increase the supply from the secondary supplier 3. Increase the supply from the gas boilers Alternatively, if there is an energy surplus, which is the case when the predicted demand is higher than the actual demand, the following steps are taken until the remaining energy surplus is zero: 1. Reduce the energy supply from the gas boiler 2. Increase the energy stored within the thermal storage tank 3. Reduce the secondary supplier (the CHP or HP depending on which has a lower percentage load) 4. Reduce the heat production from the lead supplier The philosophy behind this adjustment algorithm is to make minimal changes to the optimal set point schedule provided by the GA.Whilst it may not achieve the absolute optimal result, it is intended as a quick and simple method to be implemented between each optimisation timestep.

Combined supply and demand optimisation
To extend the current state of the art beyond a supply-side optimisation only, this study will also aim to leverage the flexibility available through a building's thermal mass.This section will discuss how the optimisation described in Section 4 is adapted to simultaneously optimise at a building level and district level.In this scenario, the heating temperature set point of the office building is also included as a decision variable alongside the percentage load output of the CHP, the HP, and the thermal storage.The inclusion of building temperature control may give the optimisation some scope to shift some of the heating demand (through pre-heating) away from hours where the production of that heat generation is more expensive.To trial this hypothesis, the office building alone has been chosen as it is expected to have the most thermal flexibility in comparison to a hospital, hotel, school and apartment block.

Controllable building modelling
To model the controllable office building additional ANN models must be produced.Note that these office specific models are not the same as the office energy consumption ANN developed in Section 3.4, as this model must take the decision variable (heating temperature set point) as an input.Furthermore, to ensure the office remains comfortable to the occupants, it is also necessary to produce a prediction model of the average indoor temperature.Other measures of indoor comfort, such as Predicted Mean Vote (PMV) or the Predicted Percentage Dissatisfied (PPD) are available, but here the volume weighted average indoor temperature has been chosen as a proxy measurement of thermal comfort as it is cheaper and more simple to measure within a building.The building level ANN models used for the controllable office building are similar to those used successfully in the authors' previous work [17].
The office building model was run using weather data recorded in Cardiff in 2016.However, due to the relatively high insulation and the large amount of internal gains, many of the zones such as the core's, data centres and the bottom level zones are cooling dominated and do not require heating.As no heating system is simulated in these zones, they are not controlled by the optimisation and their temperatures have been excluded from the average temperature calculation.To generate the training data, the EnergyPlus model was run ten times each with a different heating set point schedule.These set point schedules were generated by adding random numbers from a normalised distribution to the original, baseline heating set point temperature schedule.The aim of this methodology was to adequately cover the potential search space with little manual intervention that could be applied to other buildings in the future.A separate simulation using 2017 weather data and a different set point schedule was carried out to produce the testing data by which the ANN prediction performance could be measured.
The inputs and ANN architecture were selected using the same methods described in Section 3.4 and will not be repeated here for the sake of brevity.The resulting models receive the predicted outdoor temperature, solar irradiance, hour, day type, occupancy, the temperature set point and the indoor temperature at the previous hour as inputs.Each ANN has 2 hidden layers with 15 neurons in each layer, the training function is Levenberg-Marquardt and the transfer function between each layer is the 'tansig' function.One ANN outputs the predicted hourly energy consumption, the other predicts the hourly average indoor temperature.All of these variables, except the previous hour indoor temperature, are retrieved for the next 24 h.In the case of the previous indoor temperature input, the first value can be retrieved from the building BMS system.The first hour inputs are passed to the ANN which predicts the indoor temperature at time t.This predicted value of indoor temperature is then used as the input to predict the indoor temperature at time + t 1 and so on until the complete 24-h profile has been predicted.This full range of inputs is then used to predict the 24-h profile of the energy consumption.
The ANN developed using this method and implemented through the rest of this paper have a high accuracy to predict office energy consumption and average indoor temperature.For energy consumption, an R 2 value of 0.9712 and 0.9561 is achieved for training and testing data respectively.For temperature prediction, an R 2 of 0.9805 and 0.9679 has been achieved for training and testing data respectively.The relatively modest fall between training and testing shows no obvious signs of overfitting.A two-week sample of the ANN prediction compared to the target values is shown in Fig. 7.This figure demonstrates the ANN has effectively learned the trends within the training data and can effectively model the building characteristics.

Optimisation methodology
To include building level demand control alongside district level supply optimisation a number of adaptations need to be made to the GA procedure outlined in Section 4. The complete optimisation procedure is shown in Algorithm 2. The decision variable matrix now contains 96 values, 24 relating to the percentage load of the CHP, HP and the thermal storage, as well as 24 related to the heating set point temperature of the office.The procedure requires an additional step compared to the supply side optimisation.Firstly, the additional variables such as the forecast weather conditions, time, date, occupancy and energy tariffs are retrieved.Then the day-long, hourly load predictions of the solar panels and the heat demand of the four non-directly controlled buildings are made using the various ANN described previously.The GA parameters are provided, and the GA is initialised.

Fitness function
Within the fitness function, the initial stage retrieves the individual's heating set point schedule, T sp , and from this determines the 24-h indoor temperature, T i , and energy consumption profile Q Office .To ensure occupant comfort is met, any solution which leads to an hour where the indoor temperature is below 19.5 °C or above 24 °C is discouraged.This is done through penalising the individual by overriding that hour's energy consumption to 10,000 kWh.This penalty is very harsh and is intended to ensure that all solutions that breach the comfort bounds are discarded through the GA process.Note that the comfort bounds of 19.5 °C and 24 °C could be altered depending on user preference and the specific building in question.Once the adjusted energy consumption profile has been calculated it is added to the predicted demand of the other four buildings and the remainder of the fitness function is identical to that explained in Section 4.3 and shown in Algorithm 1.

Constraint handling, bounds and GA settings
When optimising both building demand and district supply, the GA parameter settings have remained the same as that described in Section 4. The creation and mutation of the CHP, HP and thermal storage variables is also identical.The set point temperature upper bound is held constant at 24 °C whereas the lower bound is 19.5 °C for the occupied hours (between 6 am and 10 pm) and 12 °C during the hours outside this.

Real-time control adaptation
To demonstrate how the optimisation procedure would operate in real-time, this study is using the Building Controls Virtual Test Bed (BCVTB) [47].BCVTB is a software designed to allow coupling between simulation software such as EnergyPlus and external software such as MATLAB.Each timestep of the optimisation is simulated to run on the hour, every hour of the day.The optimisation is expected to complete within 10 min.Once the optimisation is complete, the optimum set point temperature at that timestep is passed, via BCVTB, to be implemented in the EnergyPlus simulation model of the office building.The simulation model is run for the remainder of that hour with the optimal set point temperature until the next optimisation starts at the beginning of the next hour.During this time, the EnergyPlus simulation model has been recording the weighted average indoor temperature of the office building.The hourly average temperature is passed to MA-TLAB to be utilised in the next optimisation timestep.As well as the Fig. 8. Flowchart outlining the complete optimisation procedure incorporating control of energy supply, energy demand and error management.average indoor temperature, the sum of the energy consumption over that hour is also sent to MATLAB and combined with the actual energy consumption of the other four buildings.This information is used by the same error management algorithm described in Section 4.5.BCVTB is used to recreate as close to real-world conditions as possible, but if deployed on a real case study it would not be required.Instead, an intermediary connection between the optimisation and the BMS would be used as the BMS has the actuation and measurement capabilities required by the proposed optimisation strategy.The complete optimisation strategy including the management of energy supply and energy demand via the controllable office building is illustrated in Fig. 8.

Results
The optimisation strategies described in Sections 4 and 5 were applied to the simulated case study district described in Section 2 over a winter test week from the 8th to the 13th of February 2016 (note that Sunday is not included as the office is unoccupied) using real weather data for the city of Cardiff.To provide a comparison for both optimisation strategies a baseline, reactive, rule-based, control strategy has been developed.This strategy will not actively control the office building demand or the thermal storage.Instead, it will follow a priority order generation strategy.Firstly, the CHP will be used to provide the base load as it is the least flexible generator.If demand is greater than the CHP capacity then the HP will be used.If the heat load exceeds this, then the gas boilers will be utilised to meet these peak loads.

Supply-side optimisation
The behaviour of the supply-side optimisation in comparison to the baseline solution is shown in Fig. 9.For clarity, only a sample 3 days of results are shown and discussed, but the optimisation makes similar decisions on all case study days.These results demonstrate a consistent pattern, the optimisation chooses to charge the thermal storage during the early hours, during the saddle point in the middle of the day, and during the evening.The thermal storage energy is generally used to displace the gas boiler generation as this the most costly form of heat generation for the district.The result of the decisions taken by the optimisation leads to an overall reduction in CHP and gas boiler output, by 3.1% and 5.4% respectively, offset by a 6.3% increase in HP output.These changes have a number of financial implications to the district.In the baseline scenario the district buys no electricity from the national grid, however in the optimised scenario, a modest total of 254 kWh is required over the week.The optimised scenario also sells less electricity back to the national grid, suggesting the optimisation balances the CHP and PV electricity output and HP input as it is economically advantageous to utilise electricity locally rather than sell to the national grid at relatively low prices.The increased electricity costs in the optimised scenario is outweighed by a significant increase in the income from the government RHI incentive for the HP.Over the test week, the profit generated whilst fulfilling the heat demands of the district is increased from £362.25 to £524.85.As well as achieving an economic benefit the optimisation has also resulted in an environmental benefit in terms of a 3.75% reduction in CO 2 emissions.These results show that in this scenario the objective of minimising cost and reducing CO 2 emissions are mutual as both objectives are achieved through reducing the gas boiler usage with thermal energy storage scheduling.The average time to complete an optimisation was 143 s per timestep using a 4-core, Intel i7-6700 2.60 GHz, 16 GB RAM PC.

Combined supply and demand optimisation
The combined optimisation strategy described in Section 5 was run for the same test week and is compared against both the baseline strategy and the supply only optimisation.To understand the solution generated by this optimisation strategy the energy consumption and indoor temperature of the controlled office building is compared with the baseline heating strategy in Fig. 10.The baseline heating set point schedule uses the same schedule every day, maintaining a temperature of 21 °C during occupied hours.The results demonstrate an attempt to pre-heat in the early hours of the morning to reduce the morning peak load.It maintains a lower setpoint temperature between 7 and 10 am and then raises the temperature during the midday period where district demand is lower.This is a cheaper time for the district to provide heat and also reduces the afternoon energy peak.
Despite consuming similar amounts of energy during the displayed day, the inclusion of the demand-side control has provided additional flexibility to the optimisation.A detailed breakdown of the three scenarios is given in Table 2.The statistics contained in this table show the average load from the three generation technologies over the course of the week.In addition it shows the total costs of buying electricity and gas over the test week and the income received from selling electricity to the grid and the RHI from the heat pump.Evident from the results in the table, both the supply only and supply and demand optimisations reduce the amount of electricity sold to the grid and increase the amount of electricity bought with respect to the baseline scenario.This is reflected in the lower average CHP loads but offset by an increased heat pump load.The use of the thermal storage allows a reduction in the reliance on the gas boilers hence a reduction in total gas cost.The increase in heat pump RHI income and the reduction in gas cost more than offsets the loss of income from selling electricity to the grid at relatively low prices.The differences between the supply only and the supply and demand optimisation is a further decrease in gas boiler usage, reduced electricity costs and greater electricity income.This is achieved through the intelligent load shifting of the office building heating consumption and the additional flexibility provided by directly controlling the office.
A macro-level comparison of the overall net profit and the CO 2 emissions associated with each scenario is shown in Table 3.Over the course of the entire week, the additional flexibility provided by controlling the combined supply and demand optimisation achieves a 52.92% increase in profit compared to the baseline control strategy which is 8% higher than optimising just the energy supply.As well as an increase in profit compared to the baseline and the supply only optimisation, this strategy also results in the lowest CO 2 emissions of the three scenarios.Once again the reduction in CO 2 emissions is largely as a result of reduced gas boiler consumption.The average time to complete an optimisation was 145 s per timestep using a 4-core, Intel i7-6700 2.60 GHz, 16 GB RAM PC which is well below the foreseen 10 min limit.

Discussion
The outcomes shown in Section 6 demonstrate that including building level, demand-side flexibility at a district level, energy supply optimisation problem can lead to increased benefits to the district both financially and environmentally.The combined supply and demand optimisation outperforms the supply only optimisation by an additional 8% despite only being able to control a proportion of one out of five buildings in the district.For an optimisation framework, like that described in this paper, to be deployed on a real site, a wider management and communication infrastructure would be required.The energy management platform would have to integrate contextualised information from several external sources such as dynamic energy tariffs, weather forecasting services, and sensor data from building management systems (BMS) and generation units.Furthermore, the platform would require several distinct modules including prediction, optimisation, time-series database store and connection with existing BMS for data retrieval and actuation.The authors envisage that this would be achieved within a semantically enriched environment whereby an underpinning semantic model could describe the diverse components within the district and their inter-relationships.This type of modelling could lead the way for additional modules built on top of this  architecture such as automatic feature extraction for prediction models or automatic fault detection within critical systems.The contextual nature of such an architecture could allow a scalable and robust system that is more widely applicable to additional sites.The case study results reflect the optimisation performance within the specific context of this case study district.It is not possible to extrapolate the performance of the optimisation to districts with a different energy configuration.However, in the authors' opinion, an optimisation-based approach is significantly more flexible than static rules implemented by a facility manager.Whereas it may take a human expert several months to adjust to new pricing tariffs or the addition of new equipment, the optimisation can adjust immediately if appropriately programmed.Furthermore, the optimisation is free to assess the feasibility of unintuitive solutions, for example the displayed results show an increase in electricity purchased from the grid actually led to an overall increase in profit.Nevertheless, future work will aim to implement the control methodology on a wider range of scenarios with different gas and electricity prices as well as additional energy conversion technologies such as biomass, solar thermal, and power-to-gas.The prediction of building energy demand has been achieved by running energy simulation models to build a bank of historical training data.In practice, generating calibrated simulation models of buildings may be prohibitive in terms of time, cost and expertise.A possible alternative could be provided by 'unsupervised' learning.Essentially, this is a form of machine learning where data is not labeled as inputs and outputs, instead the algorithm assesses the entire dataset with the aim of constructing it's own relationships between different variables.Developments in this field could reduce the modelling and training barrier that is currently required for this work.
The case study district optimised in this study is a centralised district where it is assumed the heat energy required by each building is produced and distributed from a central energy centre where the buildings have no alternate means of producing energy.It also assumes the controller of the energy centre would have direct control over the buildings within the district which may be the case for a single owner business park, university or municipal centre.This has led to a centralised optimisation approach that is not necessarily adaptable to districts with different ownership structures and also poses issues of scalability if there are additional controllable generation sources or more directly controllable buildings.Therefore, future work will aim to develop a more decentralised optimisation framework where local, building level optimisation would interact iteratively with a district level supply optimisation.The district would effectively request demand flexibility from buildings through a real time pricing mechanism which would trigger a building level optimisation similar to that shown in this study.The shifted load would lead to overall lower costs for the district which could then pass on a proportion of the savings to the building to reward the flexibility provided.These buildings are likely to be 'prosumers' in the near future, and there could be scope for bi-directional energy transfer depending on the capability of the smart building and the pricing incentives set by the district controller.A decentralised optimisation would be more scalable and appropriate to a wider category of district energy system or microgrid.
This study has aimed to predict the key variables such as building demand and PV generation without assuming known loads beforehand at 100% accuracy.However, the input weather forecasts have been assumed to be completely accurate.This was due to a lack of historical record of weather forecasts alongside the actual measured weather data that was available.The accuracy of short-term weather predictions is generally very high and accessible from modern weather services companies, therefore, an assessment of how weather forecasting errors effect ANN prediction was considered beyond the scope of this study but will be assessed during future work.

Conclusion
This paper has illustrated the development of two optimisation strategies for the management of a multi-vector energy network at a district level.The first optimisation strategy optimises the generation of heat to meet building demand at minimal cost.The second optimisation strategy extends the first by also aiming to control the demand of the office building by managing the heating set point temperature.Both optimisation strategies use ANN to predict the building demand over the next 24-h as well as solar PV generation.From this, a GA is used to set the percentage output of the gas CHP, HP, and thermal storage.In between timesteps a rule-based error management algorithm is used to adjust the optimal solution based on the forecasting error between predicted demand and actual demand with minimal impact on the optimised schedule.The optimisation is run in a sliding window MPC fashion whereby it re-optimises every hour with a 24-h time horizon to allow quick reaction to unforeseen circumstances or forecasting errors.The outcomes of the control strategy were: • Supply-side only optimisation strategy increased profit by 44.88%   over the baseline by using thermal storage to shift load away from high cost periods.
• Combined supply and demand optimisation strategy increased profit by 52.92% compared to the baseline by utilising the thermal demand and flexibility of the office building.
• Both strategies decreased the CO 2 emissions by around 4% com- pared to the baseline due to decreased consumption by the gas boilers.
Future work will aim to decrease the timestep from 1 h to 30 or 15 min.This will likely make the optimisation more realistic as the variations in hourly load are not currently considered in this work.The authors will also aim to assess the benefits of using more advanced machine learning models compared to the back-propagation ANN used in this work.Recent advances in deep learning models and ensemblebased algorithms could improve the prediction accuracy and hence improve the optimisation.Future work will also aim to deploy this optimisation methodology at real pilot sites to assess the impact of the modelling assumptions and simplifications.

Fig. 5 .
Fig. 5.The figure demonstrates excellent agreement between prediction and target reinforced by R 2 values of 0.9745 and 0.9660 for training and testing respectively.

Fig. 3 .
Fig. 3. Test data comparing solar PV generation (a) ANN prediction vs actual data, (b) absolute error between the two.

Fig. 4 .
Fig. 4. Overview of the ANN architecture for predicting building energy demand.

Fig. 6 .
Fig. 6.A generic schematic of model predictive control operation.

Fig. 7 .
Fig. 7.A two-week sample of ANN prediction of (a) energy consumption and (b) indoor temperature compared to target values.

Table 1
Summary of optimisation constants.

Table 3
Summary of results for the test week.

Table 2
Detailed breakdown of scenario results for the test week.