Next Article in Journal
Characteristics of Air Resistance in Aerostatic Bearings
Previous Article in Journal
Nondestructive Tomographic Imaging of Rust with Rapid THz Time-Domain Spectroscopy
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Modular Model Composition for Rapid Implementations of Embedded Economic Model Predictive Control in Microgrids

1
Chair of Measurement and Control Systems, Center of Energy Technology (ZET), University of Bayreuth, Universitätsstraße 30, 95447 Bayreuth, Germany
2
Richter R&W Steuerungstechnik GmbH, 95491 Ahorntal, Germany
*
Author to whom correspondence should be addressed.
Submission received: 25 October 2021 / Revised: 8 November 2021 / Accepted: 9 November 2021 / Published: 11 November 2021
(This article belongs to the Section Energy Science and Technology)

Abstract

:
Economic model predictive control in microgrids combined with dynamic pricing of grid electricity is a promising technique to make the power system more flexible. However, to date, each individual microgrid requires major efforts for the mathematical modelling, the implementation on embedded devices, and the qualification of the control. In this work, a field-suitable generalised linear microgrid model is presented. This scalable model is instantiated on field-typical hardware and in a modular way, so that a class of various microgrids can be easily controlled. This significantly reduces the modelling effort during commissioning, decreases the necessary qualification of commissioning staff, and allows for the easy integration of additional microgrid devices during operation. An exemplary model, derived from an existing production facility microgrid, is instantiated, and the characteristics of the results are analysed.

1. Introduction

Economic model predictive control (MPC) in smart grids and microgrids is a topical field of research, and many successful applications have already been demonstrated, even if often only in simulation studies. One of these applications is unit commitment, dispatch, and demand-side optimisation in microgrids, based on dynamic pricing at the electricity exchange [1]. In this application, the optimal energy or power scheduling of microgrid components is computed based on predictions of weather, electrical, or thermal load, electricity prices, etc. The optimal schedule is used as the setpoint for the microgrid components. This optimisation of the schedule is repeated periodically with a receding horizon. The implementation of such optimisation methods on embedded hardware for industrial control is a still developing but expanding research field [2,3,4].
A critical requirement of MPC implementations is the availability of accurate and detailed mathematical models of the controlled systems. The high modelling effort can pose a significant hurdle to a widespread application of MPC in microgrids due to the time and qualification needed for the generation and identification of suitable control-oriented models [5]. A large number of models for a variety of systems are described in the literature, but they are usually designed for one specific system to be controlled, major effort is spent on the implementation of these unique models, and often, they are implemented in desktop software such as Simulink or Modelica [6]. Depending on the grid regulatory framework, the cost of the modeling effort and control implementation may exceed the potential benefits from implementing MPC in microgrids. As stated by Forbes et al. [7], “many industries do not necessarily need better [MPC] algorithms, but rather improved usability of existing technologies to allow a limited workforce of varying expertise to easily commission, use, and maintain these valued applications”.
The goal of this work is to reduce the modelling effort that is required to implement MPC in a class of microgrids with various configurations and to enable rapid commissioning of MPC on field-typical hardware. The focus is on commercial microgrids in small and medium enterprises (SMEs), using industrial information and communication technology (ICT).
One approach to rapidly implement MPC on embedded hardware is to develop the control solution in desktop software such as Matlab or Modelica and then use automatic code generation for the real-time implementation on the target embedded hardware, as presented by Krupa et al. [3]. While providing comfortable high-level engineering tools, this approach also has disadvantages. The engineering process still requires personnel who have in-depth knowledge of MPC and microgrid modelling. The automatically generated code can cause a major effort for long-term maintenance or even the need for redesign when the system architecture changes, e.g., when new components such as photovoltaic power plants or electric vehicles are put into operation. The difficulties of rapid development of MPC solutions were also addressed by Lucia et al. [8], who reduced the effort of going from simulation to an online application by providing a modular software system with standardised interfaces for simulator, model, estimator, and optimiser. An experimental validation was conducted on a laboratory reactor, where optimal control was computed on a desktop computer, and hardware was interfaced with laboratory communication equipment. Verschueren et al. [9] presented a software package for model predictive control, avoiding a separate code generation phase for prototyping and embedded applications and trying to reduce the high price to pay in flexibility, maintainability, and extensibility of code generation. Validation was conducted numerically with an inverted pendulum model on a notebook computer. Another approach to reduce modelling and system identification effort is to replace traditional physics-based models with black box models, obtained by learning techniques. However, these data-driven approaches often use highly nonlinear models resulting in high computational complexity of the MPC problem. It is not yet clear, if such data-driven methods provide significant advantages, as most studies lack benchmarking, model validation, and the proof of scalability or generalisation when applied to other buildings or systems [10].
The main aim of this work is to reduce the modelling effort needed to implement economic MPC on field devices for a wide range of microgrids and to reduce the qualification needed by the commissioning staff. We achieve this by developing a generalised model that can be easily assembled in a modular fashion when concrete microgrids are commissioned. Commissioning is carried out in IEC 61131 programming languages, which are commonly known in the automation industry [11,12]. The presented solution provides a major complexity reduction for the commissioners, who need to be trained but do not need to be MPC experts. Moreover, we investigate the effects of the generalisation and its scalability. This paper presents a generalisation of our research on field-ready implementations of economic MPC in small and medium enterprises (SMEs) [13].

2. Materials and Methods

This section describes a generic linear microgrid model, its modular composition, the implementation specifics on field-typical hardware, and its commissioning process. Finally, the conditions and scenarios of system tests are specified. The tests are performed in a hardware-in-the-loop test environment, which is a digital twin of an exemplary microgrid of a production facility in Germany, that is to be controlled.

2.1. Generalised Dynamic System Model

For the configurable and modular model composition, a generalised microgrid model was developed. The microgrid can consist of photovoltaic power plants (PV), electric vehicles (EV), battery electric storage systems (BESS), a single immutable load representing the total aggregated power demand of a generic production facility (LOAD), and the utility grid connection (GRID). The device types PV, BESS, and EV are not limited to single devices, as usually more than one of these can be found in SMEs and commercial microgrids. These devices are organised in sets A, B, and  Γ . The utility grid connection is modelled as single instance, as multiple-grid connections are uncommon. The aggregated power demand of the production facility is also modelled as a single instance, as considering the power demand of all electrical loads separately brings no benefit in this modelling approach. The typical system architecture, in which all devices are connected to a common bus, is depicted in Figure 1.
The utility grid can be used as an energy source with the supply power P g , s or as an energy sink for surplus renewable generation with the feed-in power P g , f . The aggregated power demand of the production facility is modelled as load power P l . Each PV power plant α A feeds into the common bus (main node) with a power P α , resulting in the summarised PV power
P A = α A P α .
Each BESS β B has a charging power P β , ch and a discharging power P β , dc , resulting in summarised charging and discharging powers
P B , ch = β B P β , ch and P B , dc = β B P β , dc .
The energy content of each BESS is E β , and the summarised energy content of all BESSs is
E B = β B E β .
Each EV γ Γ has a charging power P γ , ch and a discharging power P γ , dc with summarised powers
P Γ , ch = γ Γ P γ , ch and P Γ , dc = γ Γ P γ , dc .
Each EV is discharged by driving during its absence with P γ , a . The summarised EV energy content is
E Γ = γ Γ E γ .
The equality constraints of the MPC controller model, given in explicit discrete state space representation, are
P A k + P B , dc k + P Γ , dc k + P g , s k = P l k + P B , ch , k + P Γ , ch k + P g , f k k N ,
E β k + 1 E β k = Δ t ( η β , ch × P β , ch k 1 / η β , dc × P β , dc k ) k N , β B ,
E γ k + 1 E γ k = Δ t ( η γ , ch × P γ , ch k 1 / η γ , dc × P γ , dc k P γ , a k ) k N , γ Γ ,
P α k = P α , f k k N , α A ,
P 1 k = P l , f k k N ,
where
P i k = P i ( t = t k ) with t k = k Δ t
denotes the active power of component i I = { A , B , Γ , l , g } at timestep k, and 
E i k = E i ( t = t k )
are the energy contents of the component i at timestep k. The time interval Δ t is the time difference between discretisation steps (sampling interval). This was chosen to be 15 min, which is a common billing period in energy economics, and the MPC prediction horizon was chosen to be 48 h, resulting in N = 192 timesteps, allowing a reasonably foresighted microgrid scheduling. The equality constraints in Equations (6)–(10) express the following system interrelationships: Energy conservation is required at the bus (main node) at all timesteps and includes all summarised incoming and outgoing powers. Moreover, there is energy conservation in all BESSs β B and EVs γ Γ , where η β , ch and η γ , ch are the charging efficiencies and η β , dc and η γ , dc are the discharging efficiencies, which are simplified to be constant and independent of cell temperature, power, etc. The generated power P α k of every PV plant α A is assumed to equal a plant-specific PV power forecast P α , f k . The power demand of the aggregated loads in the production facility P l k is assumed to equal a load power forecast P l , f k .
In this generalised model, devices of the category BESS, EV, or PV can be modularly added to the system of equations. By adding devices to the microgrid, corresponding terms are added to the summary powers in Equation (6) and sets of N equations of type (7)–(9) are added to the equality constraints. The same principle applies to the following inequalities and bounds.
Feed-in from BESSs or EVs into the utility grid is typically regulated by region-specific rules. In Germany, grid regulation allows compensated feed-in from storage units into the utility grid only if these components are exclusively charged from on-site renewable generation [14]. However, this makes the exploitation of dynamic grid electricity pricing with these storage units impossible. To exploit time-variable energy tariffs by predictively charging BESSs and EVs and to satisfy the abovementioned grid regulation, feed-in from BESS or EV into the utility grid must therefore be prohibited by the inequality constraint.
P B , dc k + P Γ , dc k P l + P B , ch , k + P Γ , ch k k N .
The EU Network Code Requirements for Generators (RfG) [15], which is the underlying European regulation, is not specific on this topic and leaves room for individual regulatory design in the member states, such that the inequality of Equation (13) is not directly applicable to other European member states. However, similar national regulations have been passed in other states.
In order not to charge the EVs from the BESSs, the inequality constraint applies. Further constraints result from the limited rated power of the components and cabling.
P Γ , ch k P g , s k + P A k k N
0 P i k P i , max k N , i I .
The energy contents of the BESSs with the capacities C β and the EVs with the capacities C γ are limited with their respective minimum and maximum permitted state of charge (SOC).
S O C β , min C β E β k S O C β , max C β k N , β B ,
S O C γ , min C γ E γ k S O C γ , max C γ k N , γ Γ .
The SOC operating window can be a subset of [ 0 , 1 ] , in order to increase battery life [16] or to guarantee minimum battery uptime for uninterruptible power supply during grid faults. The vehicle’s feed into the local grid can be (temporarily or constantly) limited by the inequality constraint.
P γ , dc k P γ , dc , max k k N , γ Γ .
To guarantee a desired range within the EV’s planned operation, their minimum SOC thresholds to be achieved at one or multiple scheduled timesteps, deviating from Equation (17), are
S O C γ , th k C γ E γ k k N , γ Γ .
The predicted SOCs of arriving EVs at timestep k are
E γ k S O C γ , arr k C γ γ Γ .
Transmission losses due to cabling, etc., are omitted for simplicity because it would require unreasonable efforts to determine them in practical commissioning situations.
The linear cost function
J = Δ t k = 0 N 1 ( c f P g , f k + c s k P g , s k )
represents the sum of grid supply cost and feed-in revenue for all timesteps in the prediction horizon. This function is to be minimised. The feed-in revenue at timestep k equals the product of a fixed feed-in tariff c f and surplus feed-in of renewable energy into the utility grid P g , f k . The grid supply cost at timestep k equals the product of the dynamic grid electricity price c s k and grid electricity supply P g , s k . In many European countries, different PV power plants are subject to different feed-in tariffs, depending on their size and their year of commissioning. In this case, the overall feed-in tariff c f is the sum of the individual feed-in tariffs c f , β , weighted with the share of the individual installed power P β , inst in the total installed PV power P B , inst :
c f = 1 P B , inst β B c f , β P β , inst .
Depending on the device type, we define one to three power vectors of type
P i : = ( P i 0 , , P i N 1 )
and, if applicable, one energy vector of type
E i : = ( E i 0 , , E i N )
for each device i { A , B , Γ , l , g } . A state vector x is defined, containing all power and energy content vectors P i and E i of all devices, arranged by device type
x : = ( E BESS , E EV , P GRID , P LOAD , P PV , P BESS , P EV ) ,
where these device class vectors are concatenations of the respective power and energy vectors
E BESS = ( E 1 , , E | B | ) ,
E EV = ( E 1 , , E | Γ | ) ,
P BESS = ( ( P 1 , ch , , P | B | , ch ) , ( P 1 , dc , , P | B | , dc ) ,
P EV = ( ( P 1 , ch , , P | Γ | , ch ) , ( P 1 , dc , , P | Γ | , dc ) , ( P 1 , a , , P | Γ | , a ) ) ,
P PV = ( P 1 , , P | A | ) ,
P GRID = ( P g , f , P g , s ) ,
P LOAD = P l ,
and their size depends on the number of devices in each class (the cardinality of the sets). The linear optimisation problem can then be written in general form as
min x = c T x
s . t . = A eq x = b eq ,
= A ub x b ub , and
= l x u .
where c is a cost vector, which contains the cost of grid energy supply and revenue from feed-in at the corresponding indices of P g , s and P g , f and otherwise equals the zero vector. A eq and A ub are the equality and upper-bound inequality constraint matrices and b eq and b ub are the corresponding constraint vectors. Equation (34) represents the equality constraints in Equations (6)–(10), and the inequality in Equation (35) represents the constraints in Equations (13) and (14). The state vector x is constrained by the lower and upper bounds l and u . The inequality in Equation (36) represents the power and energy bounds of Equations (15)–(20). Thus, the problem is formulated in general form, and standard linear optimisation procedures such as simplex or interior-point algorithms can be used [17].
The number of rows and columns of the constraint matrices each scale linearly with additional components:
A eq R m eq × n eq ,
A ub R m ub × n ub ,
where
m eq = N ( | A | + 2 ) + ( N + 1 ) ( | B | + | Γ | ) ,
n eq = N ( | A | + 2 | B | + 3 | Γ | + 3 ) + ( N + 1 ) ( | B | + | Γ | ) ,
m ub = 2 N , and
n ub = n eq .
The presented modular modelling approach aims at deployment in several different plants with a simplified commissioning routine. Since BESS degradation and cycle life are quite device specific, these are not included in the optimisation model. To consider degradation, it is sufficient to (automatically) adjust the BESS parameters that change over time (e.g., capacity or efficiency) in the field hardware implementation (see Section 2.2). These parameters are usually given by the battery management system of industrial BESSs via field-bus and can be retrieved automatically. If the BESS manufacturer does not perform condition monitoring, a general model from the literature can be used. The chosen degradation model should generalise well across operating conditions and should be computationally efficient and simple enough to be used in model-based system design [18]. The cost function in Equation (21) does not consider the cost of battery degradation. However, the degradation cost could be easily included by adding a specific charging or discharging cost to the cost function
J = Δ t k = 0 N 1 ( c f P g , f k + c s k P g , s k + c deg P B , c h k )
where c deg is calculated from the levelised cost of storage of the specific BESS device. This preserves linearity and does not obstruct modular assembly. Due to the now high cycle stability of typical stationary BESS and the low expected number of cycles in this application, degradation costs are not considered further, and the cost function in Equation (21) is used in the presented evaluation.

2.2. Control Hardware Structure and Commissioning Process

The generalised controller model was used to implement MPC on industrial-level control hardware, which is a programmable logic controller (PLC) and an edge computer (EC). Both embedded components are mounted on DIN-rails and are suitable for switchboard cabinets. The PLC is responsible for the system sampling (measurements of the devices, e.g., PV power generation) and for the application of optimal setpoints to underlying control circuits (e.g., battery charge controller). Moreover, the specifications of the concrete controller model (the individual device parameters and the number of devices, i.e., the cardinality of the sets) are defined by a commissioning staff in the PLC in IEC 61131 languages. These specifications are communicated via field bus to the EC, where the modular model composition and the embedded optimisation take place. The hardware structure is depicted schematically in Figure 2. The device separation is conducted for reasons of commissioning, reliability, maintainability, and IT-security as explained in [13]. After the system is specified in the PLC, the optimisation, which is performed every 15 min, works as follows:
  • A measurement of all configured devices is conducted by the PLC and its connected input and output modules.
  • The system configuration, the component parameters, and the component measurements are communicated to the EC via field bus (PLC to EC).
  • The dynamic system model, depending on the transmitted configuration, is automatically composed in the EC.
  • An economic optimisation is conducted based on PV and power demand predictions and the recently sampled system state (EC).
  • The optimal device setpoints are communicated via field bus (PLC to EC).
  • The device setpoints are applied in the energy system (simulation) by the PLC.

2.3. Programming Implementation of the Configuration and Measurements (PLC)

For a widespread application of economic MPC in power systems, it is crucial to not only reduce the modelling effort but as well to reduce the commissioning time and the training needs of commissioning staff. In the presented implementation, the commissioners do not need to be trained MPC experts, because the system configuration is conducted entirely on the PLC within the widely used IEC 61131 programming style using the Codesys V3 runtime system [11]. Since 2013, the third and current edition of the standard (IEC 61131-3) allows for object-oriented programming. A PLC program contains function blocks (FBs) that can be linked together in graphical programming languages such as the function block diagram language (FBD). These FBs correspond to classes in the object-oriented programming paradigm.
The developed program contains preconfigured FBs for all component types. Figure 3 shows the FBs (classes) of the PLC program. For every device in the power system, one instance of a corresponding FB has to be instantiated by the commissioner. All device parameters, that describe the corresponding device (e.g., maximum charge power, minimum and maximum SOC/energy content of a BESS, etc.), must be passed to the FB instance. Furthermore, the measurements from the power system are passed from I/O components of the PLC to the FB instances. All FBs contain methods for the publication of parameters and measurements on the communication bus, which can then be accessed by the edge computer in order to assemble the equation system, depending on the system configuration and parametrisation. The IEC standard allows extensions of function blocks, a concept that is similar to inheritance. This allows commissioning engineers to extend function blocks in order to incorporate functionalities, that are additional to the presented core properties and methods and add to the flexibility that is required to adapt the general model in concrete microgrids. This includes device-specific battery degradation models.

2.4. Programming Implementation of the Modular Model Composition (Edge Computer)

After receiving the configuration, parametrisation, and measurements on the communication bus from the PLC, the concrete model is automatically composed in the EC, and the economic optimisation is computed as follows: The model composition and economic optimisation is implemented in Python [21] using the coin-or/pulp modelling language [22] and the coin-or/clp solver [23]. The parametrisation in the PLC is communicated via Modbus to the EC. The bus address of each device is composed of class-specific address-offsets together with sequential numbers instance_no for every additional component. The parametrisation is read by the EC. The system equations are then instantiated depending on the configured system architecture (number of devices) and the parameters of the corresponding devices. The system equations are composed by using classes for the device types. Figure 4 shows an UML class diagram for the five device types that are used in the modular model composition. The classes for the device types that can occur multiple times (BESS, PV, and EV) contain the class variable instances of type list. The constructor-method of each class registers all invoked instances in the instances variable. Using Pythons’ list comprehension, iterating over instances (derived from the parametrisation) is used to modularly compose the equation system. The assembly of the system of equations is conducted before every computation of the LP-solution (every 15 min), such that the model can be reconfigured on the fly when parameters change or additional devices are commissioned. Again, read-and-write methods for parameters, measurements and optimal setpoints are implemented for each class. The predictors for load and PV are also configured by parametrisation. These prediction methods and their accuracy have already been described in a previous publication, on which this modular model is based [13].

2.5. Extension on Mixed Integer and Nonlinear Problem Formulation

The basic idea of the linear model assembly is that any additional linear constraint preserves the inherent convexity. This is not the case for mixed-integer linear programs (MILP), since integer problems are inherently nonconvex. On the other hand, solution methods for MILP are typically based on LP relaxation; therefore, the modular methodology is in principle transferable. The used modelling language Pulp [22] allows integer modelling and the integration of the MILP solver CBC [24].
However, complexity is the enemy of dependability [25]. This is especially true in unsupervised embedded implementations such as the presented one, in contrast to supervised MILP implementations on workstation PCs and control rooms that are common in the recent literature [26,27]. MILP formulation of the energy system model can be avoided, as explained in [13]. As a consequence, the linear formulation avoids the necessity of solving NP-hard MILP problems and avoids the necessity of computationally and eventually economically expensive solvers such as CPLEX or Gurobi that can endanger the overall economic feasibility of an MPC implementation in the field.
The approach is in principle transferable to nonlinear modelling, as long as convexity is preserved. However, the convexity of all possible model assemblies should be rigorously assessed. The necessity of expensive solvers can again endanger the economic feasibility of an MPC implementation in the field.

2.6. System Test Conditions of the MPC Controller

Together, the PLC and EC form the MPC controller. A flow chart of the two components and their tasks is shown in Figure 5. The PLC tasks are executed cyclically with cycle times of 10–100 milliseconds, i.e., virtually continuously compared to the discrete optimisation intervals of the EC every 15 min. Optimisation in the EC is triggered by Linux’ systemd daemon in order to maintain precise MPC cycles.
The implementation was tested with a system model in which the number of modular components (PVs, BESSs, and EVs) is two per category. For the tests, the measurement data and predictions from an existing production facility were used as scenarios. The configured device parameters for BESSs and EVs, used for the system tests, are shown in Table 1. The static feed-in tariff of c f = 0.14 €/kWh is taken from German grid regulation and corresponds to the installed PV power plants at the facility. The dynamic electricity tariffs were taken from a German utility, which provides tariffs based on European electricity exchange prices. The price and scenario data were taken from 18 September 2020 and 19 September 2020.

3. Results

Results of an exemplary optimisation are shown in Figure 6, where PV, load, and grid supply price scenarios are plotted, as well as planned BESS and EV power, the resulting SOCs, and the resulting grid residual power. This exemplary optimisation was carried out in a system that had been assembled as described above.
The summary power of the storage units (EVs and BESSs) is plausible and scheduled as expected. Charging is scheduled when prices are low (e.g., EV-charging from the grid in the hours 37–40) or when excess PV energy is available (e.g., EV-charging from PV in the hours 11–17). Discharging is scheduled when prices are high (e.g., in the hours 6–9 and 19–25). However, the allocation of the total power to the individual storage units seems erratic as it shows randomly appearing on–off behaviour. This is especially visible during the discharging of the BESSs in the hours 19–26 and 43–48. The summarised BESS power during these hours is equal to the power demand of the load, while the two units are alternately operated at their maximum discharge power. The erratic behaviour is also visible during charging of the EVs. The summary power follows the PV scenario power after hour 11, while the allocation to the units is random. This solution of the optimal control problem is indeed erratic since multiple optimal solutions exist, which is a common characteristic of LPs. Multiple optimal solutions can occur when a hyperplane of the constraint polytope is perpendicular to the cost vector. Translated to the application, two sources for the occurrence of multiple optimal solutions were identified.
First, for the economic optimisation under the given cost function, it does not matter which storage unit is charged or discharged, as long as the summary power is scheduled optimally, SOC limits of the EVs and BESSs are considered, and the threshold SOCs of the EVs are reached. There is no mechanism in the cost function that governs the allocation of charging or discharging among the units.
Secondly, when excess renewable power is available during a longer time period, it does not matter when the storage units are charged, because no grid power supply is used during these times, and dynamic supply prices, therefore, have no influence (the feed-in tariff is static). This becomes especially clear, when surplus renewable energy is fed into the grid in the hours 9–13, but the EVs are not charged yet.
The computation time for the two main software modules in the EC (i.e., assembler and solver) was measured for energy systems containing one device per class up to six devices per class (a total number of 3–18 modular devices). The computation time of both software modules scales linearly with additional energy system components. This contributes to the practical applicability of the solution for larger systems, especially in the light of the fact that solution algorithms for LPs in general are polynomially or exponentially bounded algorithms.

4. Discussion

The demonstrated simplification of microgrid modelling on embedded devices is a novel and major contribution to the accelerated deployment of economic MPC application in the power system. It has the potential to increase the penetration of this advanced control technique in the power system, as the effort for the implementation in existing and new systems is significantly reduced. Unique modelling for every concrete microgrid is no longer a main hurdle, and expert knowledge is no longer required for each commissioning process. In addition, extending the control model with new components does not require a complete redesign, as the system assembly is conducted in every optimisation step. New components can easily be configured and included in the control system. This is especially important, as commercial microgrids tend to change over time, when companies grow. In light of small intraday price spreads of real-world dynamic electricity tariffs [13], the proposed simplification of the commissioning process is a necessity in order to make the application of economic MPC in a variety of SME microgrids economically feasible.
It has been shown that the solutions to the optimal control problem can also be ambiguous. With the described cost function, which represents the actual cost of supplying energy from the power grid, several optimal solutions may exist. While the behaviour shown in Section 3 is perfectly acceptable with respect to the objective function, it may not be perceived as intuitive by the user. In this context, three possible improvements are conceivable:
  • Giving privilege to early charging when excess renewable power is available by adding a cost term to the objective function that penalises the charging power of storage devices and that increases over time. The cost per Watt must be small enough not to significantly alter the objective function value. This privilege can be given under the assumption that the forecast quality decreases over time. Thus, it is intuitive to use surplus renewable generation earlier rather than later, as later surplus generation may not be available anymore if the forecast is wrong. Privileging earlier charging does not have negative influences in case the forecast is right; therefore, there is no trade-off to be taken, as long as the original objective is not substantially changed by the added costs.
  • Giving privilege to selected storage devices by adding a device-specific charging cost to the objective function that penalises the charging of storage devices more/less than others. Again, the cost per Watt must be small enough to not significantly alter the objective function value. A privilege sequence can be established by gradually offsetting the cost terms of the storage units.
  • The commissioner has the possibility to ignore the device specific charging and discharging of the BESSs. He can use the summary charging and discharging power and share it among the two units. This can be conducted either equally or weighted with the SOCs, capacities, etc. of the storage units. Of course, the equality and inequality constraints have to be met. Nevertheless, this is the case anyway, as the PLC must continuously meet the constraints, because the economic optimisation is conducted only every 15 min and the real PV or load power can differ from the assumed prediction scenarios. This approach, however, is not suitable for the EVs, as their presence and SOC thresholds are device specific, and a summarised power approach is not possible.
The presented modular model composition avoids data-driven modelling approaches, which might not be feasible in a practical context. If a company decides to implement advanced control techniques such as MPC, a long-lasting period of data acquisition and model training might not be practicable. This is even more the case for changes in the system architecture. It is not viable to retrain models with every additional device (one might think about the dynamic development of a commercial vehicle fleet).
However, the presented solution is limited to linear modelling and the five device types power grid, loads, PVs, BESSs, and EVs. This linear approach was chosen as the result of a trade-off between performance and dependability. The integration of other devices might make nonlinear modelling or mixed logical dynamic system modelling necessary, in order to represent nonlinear or discrete behaviour of these components. The presented approach is in principle transferable to MILP or NLP formulations, but in the context of reliable unsupervised operation, this requires an ex ante study and rigorous proof of convexity and feasibility of the problem formulation and of reachability of the global optimum, which is comparatively straightforward in linear optimisation.

5. Conclusions

In this article, a way to decrease modelling and commissioning effort for the application of economic MPC in microgrids on field-typical hardware is presented. This was achieved by the concept of a generalised model, which can be composed for a class of microgrids in a modular fashion on embedded devices. The modular composition is limited to a linear model and the components grid, aggregated power demand, photovoltaic power plants, electric vehicles, and battery electric storage systems. No expert knowledge of economic MPC is required during commissioning, as the model assembly is fully automated and the necessary configuration is performed on a PLC in the IEC 61131 languages, which are widely used in the automation industry. This can help to significantly increase the use of this advanced control method in microgrids, which is undoubtedly necessary to make the power grid more flexible. Future research should aim to replicate these results in field studies. In addition, the extension to mixed integer, mixed logical dynamic systems or nonlinear systems might prove an important subject for future research to include other device types that show nonlinear or discrete behaviour.

Author Contributions

Conceptualization, methodology, software, visualisation, and writing—original draft preparation, T.K.; investigation, validation and data curation, T.K. and B.Z.; writing—review and editing, B.Z. and G.F.; resources and supervision, G.F.; project administration and funding acquisition, T.K., B.Z. and G.F. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Central Innovation Programme for small- and medium-sized enterprises (ZIM) of the Federal Ministry for Economic Affairs and Energy (BMWi) grant numbers ZF4152303LF7 and ZF4152309LF9. The APC was funded by the University of Bayreuth in the funding program Open-Access Publication.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

This research was supported by Wago Kontakttechnik GmbH. We are thankful to Bernd Schröder and colleagues of Wago for donation of hardware and product support.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following symbols and abbreviations are used in this manuscript:
ASet of PV power plants
BSet of BESSs
Γ Set of EVs
α PV index
β BESS index
γ EV index
P g , s Grid supply power
P g , f Grid feed-in power
P α Supply power of PV power plant α
P A Summarised supply power of all PV plants
P β , ch Charge power of BESS β
P β , dc Discharge power of BESS β
E β Energy content of BESS β
E B Summarised energy content of all BESSs
P γ , ch Charge power of EV γ
P γ , dc Discharge power of EV γ
P γ , a Discharge power of EV γ by driving
P Γ , ch Summarised charge power of all EVs
P Γ , dc Summarised discharge power of all EVs
E γ Energy content of EV γ
E Γ Summarised energy content of all EVs
kDiscretisation timestep
t k Time at step k
iGeneralised index of the components
Δ t Sampling interval
NNumber of timesteps
η β , ch Charging efficiency of BESS β
η γ , ch Charging efficiency of EV γ
η β , dc Discharging efficiency of BESS β
η γ , dc Discharging efficiency of EV γ
P α , f Power forecast of PV plant α
P l , f Power forecast of load
P i , max Maximum power of general component i
P i k = P i ( t = t k ) Power of general component i at timestep k
E i k = E i ( t = t k ) Energy content of general component i at timestep k
S O C β State of charge of BESS β
S O C γ State of charge of EV γ
C β Capacity of BESS β
C γ Capacity of EV γ
c f Feed-in tariff
c s k Dynamic electricity tariff at timestep k
c f , β Feed-in tariff of PV plant β
P β , inst Installed power of PV plant β
P B , inst Installed power of all PV plants
P i Power vector of general component i
E i Energy vector of general component i
x State vector
c Cost vector
A eq Equality constraint matrix
A ub Upper bound inequality constraint matrix
b eq Equality constraint vector
b ub Upper bound inequality constraint vector
l Lower bounds
u Upper bounds
BESS                     Battery electric storage system
ECEdge computer
EVElectric vehicle
FBFunctional block
FBDFunctional block diagram language
ICTInformation and communication technology
MPCModel predictive control
PLCProgrammable logic controller
PVPhotovoltaic
SMESmall and medium enterprise
SOCState of charge
UMLUnified modeling language

References

  1. Garcia-Torres, F.; Zafra-Cabeza, A.; Silva, C.; Grieu, S.; Darure, T.; Estanqueiro, A. Model Predictive Control for Microgrid Functionalities: Review and Future Challenges. Energies 2021, 14, 1296. [Google Scholar] [CrossRef]
  2. Ferreau, H.; Almér, S.; Verschueren, R.; Diehl, M.; Frick, D.; Domahidi, A.; Jerez, J.; Stathopoulos, G.; Jones, C. Embedded Optimization Methods for Industrial Automatic Control. IFAC-PapersOnLine 2017, 50, 13194–13209. [Google Scholar] [CrossRef]
  3. Krupa, P.; Limon, D.; Alamo, T. Implementation of Model Predictive Control in Programmable Logic Controllers. IEEE Trans. Control Syst. Technol. 2021, 29, 1117–1130. [Google Scholar] [CrossRef]
  4. Johansen, T.A. Toward Dependable Embedded Model Predictive Control. IEEE Syst. J. 2017, 11, 1208–1219. [Google Scholar] [CrossRef] [Green Version]
  5. Thieblemont, H.; Haghighat, F.; Ooka, R.; Moreau, A. Predictive control strategies based on weather forecast in buildings with energy storage system: A review of the state-of-the art. Energy Build. 2017, 153, 485–500. [Google Scholar] [CrossRef] [Green Version]
  6. Drgoňa, J.; Arroyo, J.; Figueroa, I.C.; Blum, D.; Arendt, K.; Kim, D.; Ollé, E.P.; Oravec, J.; Wetter, M.; Vrabie, D.L.; et al. All you need to know about model predictive control for buildings. Annu. Rev. Control 2020, 50, 190–232. [Google Scholar] [CrossRef]
  7. Forbes, M.G.; Patwardhan, R.S.; Hamadah, H.; Gopaluni, R.B. Model Predictive Control in Industry: Challenges and Opportunities. IFAC-PapersOnLine 2015, 48, 531–538. [Google Scholar] [CrossRef]
  8. Lucia, S.; Tătulea-Codrean, A.; Schoppmeyer, C.; Engell, S. Rapid development of modular and sustainable nonlinear model predictive control solutions. Control Eng. Pract. 2017, 60, 51–62. [Google Scholar] [CrossRef]
  9. Verschueren, R.; Frison, G.; Kouzoupis, D.; van Duijkeren, N.; Zanelli, A.; Quirynen, R.; Diehl, M. Towards a modular software package for embedded optimization. IFAC-PapersOnLine 2018, 51, 374–380. [Google Scholar] [CrossRef]
  10. Kathirgamanathan, A.; Rosa, M.D.; Mangina, E.; Finn, D.P. Data-driven predictive control for unlocking building energy flexibility: A review. Renew. Sustain. Energy Rev. 2021, 135, 110120. [Google Scholar] [CrossRef]
  11. IEC 61131-3:2013. Programmable Controllers—Part 3: Programming Languages; Standard, International Organisation for Standardization: Geneva, Switzerland, 2013. [Google Scholar]
  12. Sehr, M.A.; Lohstroh, M.; Weber, M.; Ugalde, I.; Witte, M.; Neidig, J.; Hoeme, S.; Niknami, M.; Lee, E.A. Programmable Logic Controllers in the Context of Industry 4.0. IEEE Trans. Ind. Inform. 2021, 17, 3523–3533. [Google Scholar] [CrossRef]
  13. Kull, T.; Zeilmann, B.; Fischerauer, G. Field-Ready Implementation of Linear Economic Model Predictive Control for Microgrid Dispatch in Small and Medium Enterprises. Energies 2021, 14, 3921. [Google Scholar] [CrossRef]
  14. VDE-AR-N 4100. Technische Anschlussregeln Niederspannung; Standard, VDE Verlag: Berlin, Germany, 2019. [Google Scholar]
  15. Commission Regulation (EU) 2016/631. Establishing a network code on requirements for grid connection of generators. Off. J. Eur. Union 2016, 631, 1–68. [Google Scholar]
  16. Han, X.; Lu, L.; Zheng, Y.; Feng, X.; Li, Z.; Li, J.; Ouyang, M. A review on the key issues of the lithium ion battery degradation among the whole life cycle. eTransportation 2019, 1, 100005. [Google Scholar] [CrossRef]
  17. Boyd, S.P.; Vandenberghe, L. Convex Optimization; Cambridge University Press: Cambridge, UK, 2004. [Google Scholar]
  18. Jin, X.; Vora, A.; Hoshing, V.; Saha, T.; Shaver, G.; Wasynczuk, O.; Varigonda, S. Applicability of available Li-ion battery degradation models for system and control algorithm design. Control. Eng. Pract. 2018, 71, 1–9. [Google Scholar] [CrossRef]
  19. WAGO. 750-8212 Controller PFC200, 2nd Generation; Datasheet; WAGO Kontakttechnik GmbH & Co. KG: Minden, Germany, 2021; Available online: https://www.wago.com/global/plcs-%E2%80%93-controllers/controller-pfc200/p/750-8212 (accessed on 25 October 2021).
  20. WAGO. 752-9400 Edge Computer; Datasheet; WAGO Kontakttechnik GmbH & Co. KG: Minden, Germany, 2021; Available online: https://www.wago.com/global/plcs-%E2%80%93-controllers/edge-computer/p/752-9400 (accessed on 25 October 2021).
  21. Python Software Foundation. Python Language Reference, Version 3.8.8. Available online: https://docs.python.org (accessed on 5 August 2021).
  22. Mitchell, S.; Peschiera, F.; Duquesne, C.M.; O’Neil, R.J.; Usher, W.; Hsueh, F.Y.; Prypin, O.; Detha, U.; Feng, J.; Marvin, A.; et al. Coin-or/Pulp: Version 2.4. 2020. Available online: https://zenodo.org/record/4326970#.YYy4froxVjU (accessed on 25 October 2021).
  23. Forrest, J.; Vigerske, S.; Ralphs, T.; Hafer, L.; Fasano, J.; Santos, H.G.; Saltzman, M.; Gassmann, H.; Kristjansson, B.; King, A. Coin-or/Clp: Version 1.17.6. 2020. Available online: https://zenodo.org/record/3748677#.YYy4k7oxVjU (accessed on 25 October 2021).
  24. Forrest, J.; Vigerske, S.; Santos, H.G.; Ralphs, T.; Hafer, L.; Kristjansson, B.; Fasano, J.; Straver, E.; Lubin, M.; Lougee, R.; et al. Coin-or/Cbc: Version 2.10.5. 2020. Available online: https://zenodo.org/record/3700700#.YYy4rroxVjU (accessed on 25 October 2021).
  25. Littlewood, B. Complexity is the enemy of dependability—Can diversity provide a defence? In Proceedings of the Eighth IEEE International Conference on Engineering of Complex Computer Systems, Greenbelt, MD, USA, 2–4 December 2002. [Google Scholar]
  26. Sangi, R.; Kümpel, A.; Müller, D. Real-life implementation of a linear model predictive control in a building energy system. J. Build. Eng. 2019, 22, 451–463. [Google Scholar] [CrossRef]
  27. Bolzoni, A.; Parisio, A.; Todd, R.; Forsyth, A. Model Predictive Control for optimizing the flexibility of sustainable energy assets: An experimental case study. Int. J. Electr. Power Energy Syst. 2021, 129, 106822. [Google Scholar] [CrossRef]
Figure 1. Block diagram of the controller system model containing multiple devices. The device types PV, EV, and BESS are modelled individually and occur in sets A, B, and Γ . The grid connection (GRID) and the aggregated power demand (LOAD) are each modelled as a single instance.
Figure 1. Block diagram of the controller system model containing multiple devices. The device types PV, EV, and BESS are modelled individually and occur in sets A, B, and Γ . The grid connection (GRID) and the aggregated power demand (LOAD) are each modelled as a single instance.
Applsci 11 10602 g001
Figure 2. Block diagram of the control system structure: measurements of the energy system (or a digital twin energy system simulation) are taken by the PLC (Wago PFC200 [19]) and are forwarded to the edge computer (Wago Edge Computer [20]) together with configuration data from commissioning. In the edge computer, the system model is composed, and optimal setpoints are calculated, which are then applied to the energy system by the PLC.
Figure 2. Block diagram of the control system structure: measurements of the energy system (or a digital twin energy system simulation) are taken by the PLC (Wago PFC200 [19]) and are forwarded to the edge computer (Wago Edge Computer [20]) together with configuration data from commissioning. In the edge computer, the system model is composed, and optimal setpoints are calculated, which are then applied to the energy system by the PLC.
Applsci 11 10602 g002
Figure 3. UML class diagram of the system configuration in the PLC. Exemplary system configuration (fbCFG) and parametrisation: one component each for the load (fbAggregatedDemand) and the utility grid (fbUtilityGrid), two PV Plants (fbpvCarport, fbpvWorkshop), two EVs (fbID4, fbID4), and two battery storages (fbBYD, fbCommeo).
Figure 3. UML class diagram of the system configuration in the PLC. Exemplary system configuration (fbCFG) and parametrisation: one component each for the load (fbAggregatedDemand) and the utility grid (fbUtilityGrid), two PV Plants (fbpvCarport, fbpvWorkshop), two EVs (fbID4, fbID4), and two battery storages (fbBYD, fbCommeo).
Applsci 11 10602 g003
Figure 4. UML class diagram for the modular model composition in the EC.
Figure 4. UML class diagram for the modular model composition in the EC.
Applsci 11 10602 g004
Figure 5. Flow chart of the scalable MPC implementation on PLC and EC. Initial configuration steps by the commissioning staff are highlighted green. Cyclic behaviour of the control components is highlighted blue. Dashed lines mark field-bus communication.
Figure 5. Flow chart of the scalable MPC implementation on PLC and EC. Initial configuration steps by the commissioning staff are highlighted green. Cyclic behaviour of the control components is highlighted blue. Dashed lines mark field-bus communication.
Applsci 11 10602 g005
Figure 6. Results of an exemplary optimisation. The number of modular components (PVs, BESSs, and EVs) is two per category. The predicted PV power of the two plants is depicted in (a,b). Subplot (c) shows the predicted power demand P l . The charging power (blue) and discharging power (orange) of the two BESSs are shown in subplot (d,e). Subplot (f) shows the summary charging power (blue) and discharging power (orange) of both BESSs. The resulting SOC is shown in (g,h). The grid supply price is plotted in (i). The background of all subplots is color-coded with the grid supply price (i), green meaning low prices, and red meaning high prices. The charging power (solid line) and availability (dashed line) of the EVs are plotted in (j,k). Subplot (l) shows the summary charging power of the EVs. The resulting SOCs are shown in (m,n). Finally, the grid residual power (supply: blue, feed-in: orange) is shown in subplot (o).
Figure 6. Results of an exemplary optimisation. The number of modular components (PVs, BESSs, and EVs) is two per category. The predicted PV power of the two plants is depicted in (a,b). Subplot (c) shows the predicted power demand P l . The charging power (blue) and discharging power (orange) of the two BESSs are shown in subplot (d,e). Subplot (f) shows the summary charging power (blue) and discharging power (orange) of both BESSs. The resulting SOC is shown in (g,h). The grid supply price is plotted in (i). The background of all subplots is color-coded with the grid supply price (i), green meaning low prices, and red meaning high prices. The charging power (solid line) and availability (dashed line) of the EVs are plotted in (j,k). Subplot (l) shows the summary charging power of the EVs. The resulting SOCs are shown in (m,n). Finally, the grid residual power (supply: blue, feed-in: orange) is shown in subplot (o).
Applsci 11 10602 g006
Table 1. Device parameters of EVs and BESSs in an exemplary production facility, which were used for the model composition in the system tests.
Table 1. Device parameters of EVs and BESSs in an exemplary production facility, which were used for the model composition in the system tests.
Device ParameterUnitEV1EV2BESS1BESS2
P c h , m a x kW111322
P d c , m a x kW0022
CkWh77771611.04
η ch = η dc %99999895
S O C γ , a r r 24 = S O C γ , a r r 24 + 192 %1030n/an/a
S O C γ , t a r 68 = S O C γ , t a r 68 + 192 %9070n/an/a
S O C β , m i n %n/an/a1090
S O C β , m a x %n/an/a1090
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Kull, T.; Zeilmann, B.; Fischerauer, G. Modular Model Composition for Rapid Implementations of Embedded Economic Model Predictive Control in Microgrids. Appl. Sci. 2021, 11, 10602. https://0-doi-org.brum.beds.ac.uk/10.3390/app112210602

AMA Style

Kull T, Zeilmann B, Fischerauer G. Modular Model Composition for Rapid Implementations of Embedded Economic Model Predictive Control in Microgrids. Applied Sciences. 2021; 11(22):10602. https://0-doi-org.brum.beds.ac.uk/10.3390/app112210602

Chicago/Turabian Style

Kull, Tobias, Bernd Zeilmann, and Gerhard Fischerauer. 2021. "Modular Model Composition for Rapid Implementations of Embedded Economic Model Predictive Control in Microgrids" Applied Sciences 11, no. 22: 10602. https://0-doi-org.brum.beds.ac.uk/10.3390/app112210602

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

Article Metrics

Back to TopTop