Configuring the Objective Function of A Model Predictive Controller for An Integrated Thermal-Electrical Decentral Renewable Energy System

With the increasing integration of decentral renewable energy systems in the residential sector, the opportunity to enhance the control via model predictive control is available. In this article, the main focus is to investigate the objective function of the model predictive controller (MPC) of an integrated thermal-electrical renewable energy system consisting of photovoltaics, solar thermal collectors, fuel cell along with auxiliary gas boiler and electricity grid using electrical and thermal storage in a single-family house. The mathematical definition of the objective function and the depth of detailing the objectives are the prime focus of this particular article. Four different objective functions are defined and are investigated on a day-to-day basis in the selected six representative days of the whole year for the single-family house in Ehingen, Germany with a white-box simulation model simulated using TRNSYS and MATLAB. Using the clustering technique then the six representative days are weighted extrapolated to a whole year and the outcomes of the whole year MPC implementation are estimated. The results show that the detailing of the mathematical model, even though is time and personnel consuming, does have its advantages. With the detailed objective function J#, 9% more solar thermal fraction; 32% less powerto-heat at an expense of 32% more gas boiler usage; 6% more thermal system effectiveness along with 10% increased total self-consumption fraction with 16% decrease in space heating demand, 492 kWh more battery usage and 66% reduced fuel cell production is achieved by the MPC in comparison to the status quo controller. Except for the effectiveness of the thermal system with increased gas boiler usage, which occurs due to less power-to-heat, the detailed objective function in comparison to the simple mathematical definition does evidently increase the smartness of the MPC.


Introduction
International energy agency (Laustsen, 2008) has already emphasized that around 40% of the world's end energy is used for residential buildings. With the requirement of energy in buildings in terms of electricity, space heating or cooling and for domestic hot water, the system is complex enough and with each building being different in terms of their consumption pattern due to the human behavior or due to the building's characteristics, the simple control does prove inadequate to achieve better efficiency. In Germany, the residential sector is dominated by 12.7 million single and two-family houses out of the 19 million residential buildings (Deutsche Energie Agentur, DENA, 2019). Also, unlike other countries, the thermal energy supply to German households is still largely by decentral energy systems. With the increase of decentral renewables installed in buildings (for e.g. solar thermal system or a photovoltaic system), the buildings could cover a part of their demand by self-generation. Such prosumers are increasingly gaining importance and Germany's energy transition and climate law aim to reduce the total emissions by 80-95% before 2050 in reference to 1990. pump) and renewable electrical energy systems (photovoltaics with battery or micro wind turbines or micro combined heat and power) in single-family houses, the potential to decentral sector coupling is made possible. Thus, more sophisticated advanced control for such a hybrid renewable thermal-electrical home energy system is required. In addition, with advanced control, the use of decentral sector coupling could be enhanced. Moreover, energy management becomes more efficient and effective by planning its production via complex control strategies making the system adaptive to the demand of the building and the consumer. In the Energiefortschrittbericht (Bundesministerium für Wirtschaft und Energie (BMWi), 2019) (Energy Progress Report), Prognos 2020 (Prognos AG et al., 2020), Energieeffizienz Strategie Gebäude (Bundesministerium für Wirtschaft und Energie (BMWi), 2015) (Energy Efficiency Strategy in Buildings) and several instances, the need for intelligent control of hybrid renewable energy systems (thermal and electrical) which promotes optimal integration of renewables in residential buildings along with decentral sector coupling is emphasized.
One such advanced control is model predictive control where a digital twin of the real system is created and used to predict the future outcomes with the feed-in of predicted disturbances and the desired objectives with the allowed boundary conditions. Model predictive controller (MPC) does the optimal control with some predictions and is a non-optimal advanced control which makes the best of the situation even though it is not optimal (e.g. heating the building by using electricity when PV is working with certain boundary conditions) (Reynders et al., 2013;Thieblemont et al., 2017).
MPC is already widely used in the automotive sector and supply chain management. The importance of advanced controls in building heating and for the integration of renewable systems is already well versed. The implementation of MPC on just heating was already implemented by (Sturzenegger et al. 2016;Zakula, 2013;Görtler and Beigelböck 2010;Jungwirth 2014) and for energy systems components alone; as examples, heat pump in (Pichler et al., 2017), thermal storage in (Thieblemont et al., 2017;Yu et al., 2015), solar thermal system in Pintaldi et al., 2019;Serale et al., 2018;Zemann et al., 2020) and electrical system with PV and battery in (Alibabaei et al., 2016;Khakimova et al., 2017;Ostadijafari et al., 2019). But a combination of them all together as a system with decentral sector coupling of the electrical and the thermal system with the buildings is still open. Also, another barrier for MPC is its obligation to customization for that particular case. Therefore, the universalization of the MPC to be adaptive to different building standards is necessary.
In the previous research , the authors have created a simulation framework to simulate a white-box model predictive controller for an integrated thermal-electrical renewable energy system for a singlefamily house. The created simulation framework was then used in (Narayanan, 2020) to identify an evaluation method to evaluate the MPC equivalent to a year via sixday MPC analysis and implementing a corrected weighted-extrapolation.
One disadvantage of the MPC is that the intelligence of the system has to be brought to a mathematical form by an experienced user which is time and resourceconsuming. The final quest of the author is to investigate the ways to universalize the MPC. But initially, the objective function has to be configured to perfection for one single case. In (Narayanan, 2020;Narayanan et al., 2020), there were small discrepancies in the results where the MPC results were a bit off from the desired global optimum solution.
Also in the previous literature (for e.g. Badanjak & Bogdanović, 2019;Kuboth et al., 2019;, it can be seen that until now, the optimization with economic MPC is given priority and in this particular article, the aim is to define an objective function with the aim of increasing the decentral renewable energy supply fraction and to increase the self-supply of the demands when also increasing the effectivity of the energy use. A sophisticated objective function to serve this purpose is defined and then configured to study the sensitivity of the objective function in an MPC in this article. Thus, the authors decided to investigate different details of objective function aiming for the same goal (increased renewable fraction and decentral system self-consumption). This paper focuses explicitly on investigating different objective functions of the MPC and ways to improve the results of the MPC and if very detailed models are necessary. The same energy system with the same MPC as in  is taken for this system and is briefly explained in Section 2.1. Then in Section 2.3 and 2.4, the selected objective functions for the investigation are explained following which in Section 2.5, the method of results extrapolation into an annual scale is explained. In Section 3, the outcomes are shown, compared, and discussed in detail. Finally, in Section 4 and Section 5, the results are discussed and concluded.

Energy system
For this study, a single-family house (Julia 1-3 -Dammann-Haus, 2018) according to Sonnenhaus standard (a voluntary standard which requires a minimum of 50% solar fraction of the total thermal loads in the building (Sonnenhauskriterien für Wohngebäude, 2014)) with the following characteristics:   • With space heating demand of 9504 kWh/a and domestic hot water demand of 4000 kWh/a • Electrical loads according to VDI 4655 of a fourperson household -4140 kWh/a • 26 m 2 solar thermal collectors with 7 kW auxiliary gas boiler coupled to 2 m 3 stratified thermal storage • 2.94 kW photovoltaic system with 6.75 kW lithiumion battery storage and a 2 kWel natural gas powered micro SOFC (solid oxide fuel cell) CHP • Power-to-heat conversion implemented via heating elements with maximum 4 kW input into thermal storage to feed-in excess decentral produced electricity and the remaining is exported to the grid

Model Predictive Controller
A time-varying deterministic discrete-time model MPC framework for a whitebox Building-HVAC system was developed in . As shown in Fig. 1, the MPC first requires the disturbances forecast (weather and occupancy) and for this article, this is taken as 100% accuracy. Then, the MPC awaits input of the setpoint constraints, for example, the desired room temperature, required space heating inlet temperature, storage auxiliary setpoint temperature. There could also be other state constraints such as battery fractional state of charge, maximum heating power, etc. which don't directly affect the setpoints but indirectly do. Along with these inputs, the MPC runs the Building-HVAC system model, a digital twin of the real plant, a whitebox model created in TRNSYS and aims to reduce the objective function fitness value. The objective function as developed in , is to maximize the renewable energy fraction for the given time horizon while satisfying the given constraints of space heating (SH) as a soft constraint; DHW and electricity demand as hard constraints. The optimizer in this article is implemented in MATLAB environment as shown in Fig. 2 and calls the 24-hour TRNSYS model via DOS to iterate and find the best case manipulated variable inputs that acquire the best objective function fitness value. The best-case u is then sent further to the real Building-HVAC system (for this study also a sequential TRNSYS model). In real applications, the occupancy and weather prediction do have a certain error which tends to be measured disturbances along with the unmeasured disturbances, which cannot be identified by the system model due to model accuracy or due to behavioral change of the system components or users. A control horizon of 24 hours is taken with the same 24-hour prediction horizon and a minimum control timestep of 15 minutes.
The optimizer as developed in  with particle swarm optimization (PSO) algorithm using swarm size as 50 and functional tolerance as 1x10 -5 is used for the case study in this article. As the TRNSYS model takes ca. 3-10 seconds for one iteration, a maximum optimization time of 12 hours for the MPC optimization has to be assigned and the compromise of not finding the global optimum has to be taken, so as to not run the optimizer for an unrealistic duration for an optimization problem with 24-hour control horizon. Moreover, as the initial point of the optimization, the previous horizon's optimum solution is taken.

Manipulated variables
The MPC optimizer as mentioned before changes the manipulated variables, u, so that the best objective function fitness value is acquired. As enlisted in Table 1, the gas boiler maximum power control, fuel cell CHP electrical power setpoint, power-to-heat maximum power control, active battery charging control and active battery discharging control are the manipulated variables. The gas boiler is controlled every 15 minutes as a continuous floating-point variable (0 to 1) by the MPC. If the auxiliary volume temperature is less than the desired setpoint, the MPC input allows the gas boiler and the respective pump for storage feed-in to be activated.  The battery on the other hand is controlled by an onoff binary signal (0 or 1) from the MPC in one-hour control timestep. The battery is controlled both for charging and discharging, so as the MPC can decide if the battery should be charged right away when PV produces electricity or to wait till there is no load demand and also to decide if the battery should be discharged right away when the PV and FC-CHP production are deficient or to supply the peak loads in the latter part of the day. As here the taken SOFC-CHP needs 30 hours to switch on and up to 30 minutes to reach the new setpoint, a full shutdown of the FC-CHP is not aforethought. The MPC control time step is defined as 3 hours and is varied between 500 W, 1000 W, 1500 W, and 2000 W.
Alike gas boiler control, the power-to-heat control also is considered as a continuous floating-point variable (0 to 1) and the single input sent by the MPC is then locally in TRNSYS used to control the three heating elements installed at the top (1 kW), middle (2 kW) and bottom (1 kW) of the thermal storage, assumed to be controlled by a thyristor for a step-free control of the three heating elements. All the unused electricity after the battery control, load supply, and power-to-heat supply will be exported into the grid.

Objective Function
The aim of the objective function is to increase not only the usage of the non-controllable renewables, especially the use of solar thermal and photovoltaic, but also to reduce the auxiliary energy, gas boiler in the thermal side and the grid on the electrical side, and to also enhance self-consumption in the electrical side by reducing the grid import. It should at the same time not compromise the comfort in the space heating and always satisfying the DHW requirements, thereby effectively reducing the heat losses in the thermal storage. Also, the active control of the FC-CHP to optimize the power-to-heat and make sure the power-to-heat doesn't take up the space of the solar thermal contribution in the thermal storage is necessary. Similarly, battery storage should also be managed effectively. Thus, an overall goal for the given time horizon as a maximization problem is to increase renewable energy, and as a minimization problem is to reduce the usage of gas boiler input, grid import and reduce the grid export. (2) (1) and Equation (2) explained after Equation (7) subject to As shown in Equation (1), the objective function can be defined as a maximization problem where a sum of the integrated daily renewable thermal fraction plus the integrated daily renewable electricity fraction along with the daily decentral system self-utilization and an added integral penalty ( ) if the hard and soft output constraints are not satisfied. The penalty function is shown in Equation (3), (4), (5), and (6). As described in , the space heating load penalty ( lC ) is the most important and is a soft constraint, thus is defined as a quadratic penalty function (Nocedal & Wright, 2006) to penalize the constraint violation with increasing severity in case of a positive temperature difference between real room temperature and set room temperature. Similarly, the DHW penalty function ( #Cm ) is calculated for the simulation, but in a real implementation, this is unnecessary, but as for the simulation, it is used so that the objective function does not end up in an unfeasible optimized solution. Then a simple penalty function ( HI ) with constant ϒ is also defined for electricity demand. But due to the simplicity in terms of mathematical optimization, the same optimization goal should be defined as a minimization function as shown in Equation

Abbreviations used in Equation
(2), Variation A ( Z ), to reduce the auxiliary energy usage.
One of the limitations of the MPC is that the objective function plays an important role in the amount of intelligence and smartness of the control optimization. And with multi-objective optimizations, when not Pareto (non-inferior solutions via objective function vector in which an improvement in one objective requires a degradation in another), the weightage of the functions does play an important role. To study the robustness and sensitivity of the objective function, the simple minimization function, Equation (2), Variation A ( Z ), was further detailed to a complex function as shown in Equation (7), Variation B ( € ), weighted multi-objective function incurring a penalty for the use of auxiliary energy and bonus for the use of the renewable function.  The objective function, Variation C ( R ), as in Equation (8) is further extended to differentiate the power-to-heat into its source, either PV or from FC-CHP and having an appropriate bonus, so as to not encourage the production of electricity using FC-CHP from natural gas and then convert it again to heat via power-to-heat. Also the same is done on the electrical side to differentiate between PV power supplied and the FC-CHP electricity supplied to the electrical loads and also a battery usage bonus is included to prioritize battery usage than to increase FC-CHP production. Additionally, to investigate whether the manipulated variables definition is hindering the performance of the battery supply, the battery discharge as a manipulated variable is removed from the MPC and is analyzed as Variation D.

Annual Evaluation
Further to compare the MPC, as shown by the author in the previous publication (Narayanan, 2020), using the weather of Ehingen (48.2°N) from the year 2018, sixrepresentative days from the 365 days were chosen via unsupervised hard partitional clustering using ambient temperature (Tamb), solar irradiation (Ghor), space heating demand (ESH), gas boiler demand (EGB), solar thermal production(EST), and power-to-heat supply (EP2H) as data point dimensions using k-medoids in MATLAB. An annual status quo simulation results of the HVAC-Building residential energy system are compared with the extrapolated yearly results from the six-day status quo simulation and a deviation vector of the key performance indicators (KPIs) are acquired. With this acquired deviation vector ‰ , the outcomes ( ‰ , weighted extrapolated energy value of the respective n energy system component in kWh/a), as shown in Equation (9), of the six-day MPC simulation ( ‰,d , the daily energy value of the respective energy type n in kWh/day for the particular cluster representative day) is then extrapolated with the weightage of the respective cluster by the cluster population ( d ) in each of the cluster i. Other than the main KPIs, a balanced correction factor linear equation solver estimation method is used to approximate the energy values, as the direct correction factor powered weighted extrapolation is not feasible, as explained in (Narayanan, 2020).

Results
Using the chosen representative days, the simulation of the system with MPC controller was carried out and the day-wise results of the MPC implementation using the three different objective function definitions are compared to the status quo controller and presented here. Fig. 3 shows the overview of the thermal demand and supply of the system; Table 3 and Table 4 enlists the energy values. Fig. 3 Heat demand and supply of the representative days in Sonnenhaus standard single-family house building with status quo controller and with MPC controller using PSO Optimizer As Day 2 and 3 are summer, the thermal energy demand for space heating is nil, and only the DHW load (EDHW) of less than 14 kWh had to be supplied. With status quo controllers, the power-to-heat (EP2H) did though feed into the storage in the night which led to reduced solar thermal production even though solar thermal production alone was good enough on both days. And when using MPC, all three definitions could reduce the EP2H to 0 kWh/day from 8.55 kWh/day and to 0.9-1.3 kWh/day from 3.91 kWh/day on Day 2 and 3 respectively. On Day 3, € functions better than its counterpart with respect to EP2H. Nevertheless, in terms of the solar thermal contribution (EST), all three J perform better by increasing the solar thermal production in Day 3 and increasing the effectivity of the whole system by reducing the required total thermal energy input in Day 2.
For Day 4 (autumn day) as shown in Table 4, the ambient temperature (Tamb) is high enough (Fig. 4), due to which the building heating is not required. Also the gas boiler thermal energy input is unnecessary. By reducing the EP2H, € and R could achieve relatively increased solar thermal production. For Day 5, due to the low ambient temperature, the building requires 22.2 kWh heating on that day and using MPC only 1 kWh is reduced in the energy demand. But on Day 5, solar production is increased by 4.7 kWh uniformly by all MPC variations, and the power-to-heat conversion is reduced from 22.17 to 5.35 kWh/day in R , slightly more than the others. But surprisingly, representative Day 5 does not require the gas boiler input. Thus highlighting the limitations of the clustering technique where a medoid of that cluster is chosen and for the autumn days, these tend to be the ones with no auxiliary heating requirement. And finally, in the winter days, Day 6 and Day 1, it can be seen that also the space heating requirements are reduced by 5 and 13 kWh/day respectively, and this though comes at the cost of a negligible amount of room temperature difference (without exactly matching the comfort parameter) as seen in Fig. 4. And on both days, the main differences in the thermal side of the system between the objective function variations can be seen.
Especially on Day 6, one can see that there is 6 kWh of difference in the reduction of the EP2H supply between € and # , this is due to the clear definition of penalties for power-to-heat differentiating PV power-to-heat and FC power-to-heat and not preferring the latter. EP2H is reduced by ca. 22 kWh/day on both Day 6 and Day 1, but this obviously comes at the cost of increased gas boiler usage than the status quo in both the days. While closely analyzing it, on Day 1 with # , the gas boiler input requirement is reduced in comparison to € and R . And in terms of energy effectivity, also on Day 6, the total thermal energy input required to satisfy the loads is reduced from 72.88 kWh/day to 60.02 kWh/day using # , 10 kWh less than R but € manages even 10 kWh lesser.
In terms of the electrical system (Fig. 5), due to the fuel cell CHP producing almost always more than the electricity demand, the power sent to the grid is always high in the reference case. Also, the battery usage is much low in the status quo. And with MPC, via reducing the FC-CHP production, grid export is reduced, and also battery usage is increased. In terms of FC-CHP production, only # manages to keep it to a minimum all 6 days, thus notably increasing the battery usage and in turn the direct PV use, especially in Day 6 where the detailed definition of the objective helps to achieve the desired outcome. The load demand (Eload,el) and PV production (EPV) remain the same and by reducing the FC-CHP, the grid export is enormously reduced in summer and autumn days.    Table 4 Daily energy values (Day 4-6) in kWh/day of the representative days in reference case and with MPC implementation  With PV production in the daytime, the PV supplies the electrical load; the battery is charged (Fig. 6); and simultaneously, the thermal storage is fed with PV P2H production on Day 5. On contrary, on the other transition season day, Day 4, most of the PV production is fed to the grid in the latter part of the day, and power-to-heat is avoided so as to enhance the solar thermal supply when using MPC. In the summer days (Day 2 and Day 3), with no complexity, with almost no P2H, the load is easily supplied by the PV with minimum FC-CHP contribution. Since the grid import penalty is smaller than the grid export penalty, the optimizer decides to import a little from the grid instead of increasing the FC-CHP production on Day 1 with € and R , but with # , this is avoided. Same trends can be seen on Day 5 and Day 6. This is also partially due to increased use of the battery with # as evidently seen in Fig. 6.  With developed weighted clustering extrapolation in a previous article (Narayanan, 2020), the results of the six representative days are extrapolated, as shown in Equation (9). 'HZc,cH † is the yearly simulation value of the reference case, '#Z',cH † is the yearly extrapolation of the reference case from six representative days, '#Z',"<9 is the annual energy values extrapolation of the MPC from six days and with deviation ‰ , '#Z',"<9 is corrected. Table 5 lists the main yearly energy values. It can be seen that the MPC does bring in some preferred optimizations. With the EDHW (4000 kWh/a), EPV (4202 kWh/a), and Eload,el (4140 kWh/a) being the same, the ESH reduces by 13% using € from 9504 kWh/a in status quo, mainly due to the implementation of the predictive space heating and gas boiler control sequence and also due to the soft constraint of the building temperature (T_BUI). The reduction in ESH is enhanced by another 0.5% by R and another 3% by # . EST via MPC produces 4799 kWh/a at an increase by 14% compared to status quo using # , showcasing 4% increase in EST due to detailed objective function. In terms of EP2H, uniformly 83% reduction is achieved by the usage of MPC controller. On contrary, the gas boiler production (EGB) supply is needed to be increased by ca. 40% in € and # due to the reduction of power-to-heat input. MPC also reduces the EFC,el by 52%, which in turn also reduces the grid export by 51%. Abnormally, using R , gas boiler requires 10% more energy input.

MPC-
Since the other energy values are not feasible for a direct correction factor ( ‰ ) powered weighted extrapolation, a balanced correction factor linear equation solver estimation method is used to approximate the energy values as shown in Table 6. Obviously, from the daily values, it could be safely said that the grid import and battery usage is increased. It is trifling to see that the battery usage with status quo controller was only 49 kWh/a, mainly because the FC-CHP almost always supplies the electrical load, even in the evening periods.   However, by reducing the EFC,el, the EP2H,FC is reduced enormously by ca. 92% which also tends to be the reason for pronounced utilization of the battery to ca. 494 kWh/a with the simple objective function and another 14 kWh due to R and another 33 kWh due to # . Also, the reduction of EFC,el, causes a ca. 13% increase in direct PV use (EPV,direct) and the introduction of a small penalty to use of PV as heat in # , EP2H,PV reduces by 20%. The grid import, on the other hand, is estimated to increase from 0 kWh/a in status quo to 25 kWh/a when R is used and in # , the MPC manages without any grid import. Table 7 lists the energy efficiency and the key performance indicators on a yearly scale. It indicates a 9% increase in solar thermal production along with a 21% increase also in gas boiler supply fraction and a 32% decrease in power-to-heat supply using # . € though requires ca. 2% less gas boiler input, does only incur a 6.5% increase in solar thermal input fraction.
On the electrical side of the system, a 14% decrease in the FC-CHP electricity supply fraction is reported. On the positive side, this 14% decrease in FC-CHP supply is made available by PV but comes only at a liability of 1% grid import when € and R is used. For self-consumption, it is certain that the thermal system production is solely focused on 100% self-consumption. And for the electrical system with the implementation of MPC, a selfconsumption fraction difference of +3.5% is achieved. With reduced EFC,el also the consumption fraction of PV is increased by +10%. For the total thermal system supply fraction, the yearly efficiency with MPC (η 'HZc,"<9 ) of 105% with a 11% reduction using € from 116% in reference case is very ideal. And the effectivity reduces when more gas boiler input is required, as is the case with R and # . But the trend could definitely be confirmed by the reduction of the loss factor (energy input minus energy output) in the daily energy values, thus indicating the effective use of the system. In terms of electricity supply fraction, the total 100% of the electricity could be supplied by the decentral system without grid import using # . Overall, the total decentral system's supply fraction of 99.9% for the load demands of this residential thermal-electrical system is achieved by € and R , but # on the other hand manages a 100% autonomy. Hence, without reducing the autonomy of the decentral energy system, the self-consumption could be boosted by 10% using MPC and in the process, the space heating demand is reduced by 16% and FC-CHP production reduced by 66%.

Discussion
As a novelty from the usual economic MPC approach, this article approaches the control optimization from the renewable energy utilization point of view via a supervisory MPC and as shown in the results, the outcomes are quite promising. (Khakimova et al., 2017) had a similar system with PV and ST and a decentral sector coupling for a heating system but they only evaluated for 48 hours and a direct comparison is thus not possible. (Serale et al., 2018) reported a 19% reduction in energy demand in a solar thermal system with latent heat storage. Here for this building, a 16% reduction is visible due to the introduction of soft constraint with a maximum of 1°C reduced room temperature before incurring a penalty for comfort violation. For a solar combi-system in a single-family house, the MPC developed  could only result in a 2 to 4% increase in solar fraction and later to 5% in . A 7% increase in the solar thermal fraction is reported by (Zemann et al., 2020) where the solar thermal was investigated along with a wood boiler using an MPC. In this paper, a 9% increase in solar fraction could be reached for the designed energy system in the selected Sonnenhaus building in comparison to the reference case. On the electrical side, a PV+Battery system reported by (Badanjak & Bogdanović, 2019) could achieve 3.8% more renewable energy utilization via MPC while this paper reports a similar 3.5% more decentral electrical system utilization with a 14% increase in PV utilization. The decentral system utilization in terms of power-to-heat for an enhanced decentral sector coupling and integration of a fuel cell CHP are unique system configurations accomplished in this particular case study investigation. The main aim of this particular article is to investigate the necessity of detail in the mathematical objective function definition for the decentral renewable energy system to enhance renewable energy use and self-utilization in contrary to the state-of-the-art economic MPCs.
The detailing of the objective function really does help in the winter days (Day 1 and Day 6) and also improvements are visible in the autumn days. Especially from the space heating demand, around 4% more energy could be saved and 3% more solar thermal fraction with the use of # in comparison to € is evident. All these are achieved even when withholding the autonomy of the decentral energy system and in comparison to the status quo controller, # could achieve a 10% increase in the decentral system self-consumption; 32% less power-toheat supply fraction; 14% more PV supply fraction. Along with these a 9% more solar thermal fraction; 16% less space heating demand; 491 kWh more battery use; 66% less FC-CHP production; 83% less power-to-heat thermal energy supply; 6% more thermal system effectiveness could also be reported. The only disadvantage seen in detailing the objective function is that the gas boiler is used more due to the non-preference of FC-CHP supplied power-to-heat. And due to increased gas boiler supply, the effectiveness of the system also reduces, because of the increased gas boiler supply. Nevertheless, the system reports better effectiveness than the status quo controllers.
Natural gas powered SOFC-CHP is somewhat a complicated system component in this energy system which has a constrained control flexibility and due to the fact that the FC-CHP could not charge the battery storage and neither be totally switched off as the BlueGen SOFC-CHP takes 30 hours for a complete switch on. But for a future case, a total shut down of the FC-CHP in summer could be evaluated. And with respect to the reference case, due to reduced FC-CHP production and due to the unpreferred P2H-FC conversion, the P2H from FC is reduced, and the gas boiler contribution had to be increased, as direct heat production via gas boiler using natural gas is much efficient than producing electricity via FC-CHP and supplying the electricity produced to the heating element in the thermal storage. The detailing of the objective function exactly helps in the decision of such complicated differentiation of the energy input even though the definition of a complicated mathematical function is time and personnel consuming.
It is also important to mention that in this study, the forecast accuracy of the weather and occupancy is taken as 100% so as to specifically study the sensitivity of the objective function. Moreover, due to the selection of whitebox system model, the computation time is too high, and hence as a compromise, the MPC had to be evaluated only on an estimation basis for an annual scale using the clustering approach.

Conclusion
The focus of this article is to study the effects of the objective function and to investigate if it is worthwhile to have a detailed mathematical definition of the objective function. From the results, it can be seen that due to the detailed function for the MPC of the integrated decentral thermal-electrical renewable energy system, the potential of the MPC does increase.
In this case study, a Sonnenhaus standard building with PV, solar thermal, fuel cell CHP along with auxiliary gas boiler and the electrical grid are investigated. The already previously developed MPC with PSO algorithm optimizer in ) is shortly explained. As shown in Equation (1), the objective is as simple as to increase the renewable energy system contribution and enhance self-consumption. But this had to be modified into a minimization problem due to its easiness in the optimization as in Z . The question answered in this article is, if this simple, generalized objective function, which can be implemented easily also for another energy system components, does serve better? Or is it worthwhile to spend more time in developing a time consuming, high knowledge personnel consuming process of a complicated € , where the auxiliary energy usage was further detailed as gas boiler usage, power-to-heat, and electrical grid import. Also each of these were given a penalty factor for auxiliary usage along with a bonus factor when more renewable energy is used. In R , this objective was furthermore detailed by differentiating the power-to-heat supply by PV and by FC-CHP, so as to not prefer producing electricity by FC-CHP and convert later using power-to-heat which is an inefficient process compared to using natural gas directly in a gas boiler to produce heat. Also, an additional factor of bonus for the usage of battery is included so as to enhance battery usage rather than using FC-CHP electricity. Finally, it was also of interest to study if removing the battery discharge control variable will speed up the optimization as in # .
In this study, it is evident that detailing the objective function can help to improve the function of the MPC however from it is quite complicated to universally implement such complex objective functions. The solution would be to include a user interface in which at the commissioning of the MPC, the objective function can be customized by the installer where a provision to custom define the objective function can be indulged. For example, if there is a heat pump in place of a power-to-heat conversion, the efficiency of importing electricity from the grid and using this electricity for the heat pump as auxiliary heat input would be more efficient than the gas boiler. So in simple words, a questionnaire at the commissioning of the MPC can be carried out to customize the MPC where a programmed switch case concept to choose the different objective function element and a customized penalty value or bonus factor can be made possible.
It is interesting to further investigate the developed objective function with different building standards and different optimization algorithms so as to explore the opportunities of mass implementation of the model predictive controller and to analyze what advantages can an MPC bring with respect to a status quo controller in different scenarios. It could also be interesting to investigate the same system with a hydrogen fuel cell or without fuel cell. Also, the effect of the prediction accuracy, model accuracy in the MPC could be evaluated with the acquired detailed objective function for the selected case study.