Model predictive control of solar-coupled innovative heat pump: a comparison of economic and environmental optimizations in Latvia

Background: Heating and cooling in buildings represents a significant amount of the energy demand in the EU, but the market penetration of renewable solutions is still marginal. The SunHorizon project aims at proving the viability and benefits of innovative coupling between heat pumps and various advanced solar panels. Methods: This study focuses on the optimal operation strategies of a technological package located in Latvia, and composed of hybrid photovoltaic thermal (PVT) panels, a gas driven heat pump and a hot water storage tank. In this work, a model predictive control is developed, based on mixed integer linear programming (MILP) optimization. This model uses innovative elements compared to traditional model predictive control (MPC), with environmental indicators for the Latvian electricity grid accounting for imports, co-simulation with TRNSYS using the transmission control protocol (TCP) and modelling of long-term storage for long and short-term decisions. The usual minimization of costs is compared to two new optimization approaches, which aims to minimize greenhouse gas (GHG) emissions and maximizing renewable use and self-consumption. Results and conclusions: The results of the optimization of costs and GHG emissions show that gains can be found within the variations in time series related to the electricity grid, but the overall operation strategies remain similar. Optimization of renewable share and self-consumption is another path for control strategy, but with less economic and environmental performance.


Introduction
Heating and cooling (H&C) for buildings represents 32% of the EU energy demand, of which only 13% comes from renewable energies (HeatRoadMap EU, 2017).In order to comply with the targets of the Paris agreement, new technological solutions for H&C in buildings must be implemented, with a reduced environmental impact as well as financial savings compared to conventional solutions.
The SunHorizon project aims at demonstrating such solutions, with innovative and reliable heat pumps (thermal compression, adsorption, reversible) which, properly coupled and managed with advanced solar panels (thermal, photovoltaic [PV], photovoltaic thermal [PVT]), provide H&C to residential and tertiary buildings with lower emissions, energy bills and fossil fuel dependency.Four different technological packages (TPs) are being developed and demonstrated across EU climates (i.e.Germany, Spain, Belgium and Latvia) and building typologies (small and large-scale residential and tertiary buildings).This paper is focused on the smart control algorithms that are demonstrated in virtual environment in the Sunisi demo site context: a residential house located near Riga in Latvia, equipped with DUALSUN PVT panels, a BOOSTHEAT gas fired thermal compression heat pump and RATIOTHERM thermal storage (TP2 concept).The control tools aim at finding decision-making strategies that guarantee to cover the energy demand while minimizing costs or environmental impact and complying with comfort constraints.
Many works investigate the influence of control algorithms on the actual performance of building energy systems, like the article « Ten questions concerning model predictive control for energy efficient buildings » 1 that summarizes well the benefits and issues with MPC for building systems.In many cases, the model-predictive control (MPC) approach makes it possible to reach superior performance, especially thanks to a better anticipation of future conditions and optimized use of energy storage units.As an example, Ghilardi et al. 2 report up to 80% gains for cooling a building.
As illustrated by Figure 1, MPC uses an optimization algorithm to compute optimal control setpoints by minimizing an objective function while accounting for predictions of time series such as electricity prices or intermittent solar energy production.The optimization often relies on the MILP formalism, which is particularly well suited as it offers good modelling capabilities, guarantees optimality and is supported by efficient solvers 3,4 .

Amendments from Version 1
Main changes compared to previous version of the article : -More background is added on motivation of the article and literature review -A more extensive description of the test case is included -The scenario previously called "MPC on REN" has been renamed to avoid confusion with scenario called "MPC on GHG" Any further responses from the reviewers can be found at the end of the article One of the difficulties for MPC is that significant effort may be required for designing and evaluating the optimization model depending on the controlled systems.Some studies have been performed on similar systems.For instance Herrera et al. 5 studies a solar absorption cooling system, Chen et al. 6 studies a heat pump coupled with a PV/T system.In our case, we consider a hybrid system, solar PVT coupled gas fired heat pump and thermal storage, which can provide benefits when the electricity mix has a high carbon content.Hence, the precise setup of the system differs from the previous studies and has different characteristics.In particular, in our case, the large storage tanks allows for storage of thermal energy over several weeks.In order to handle longer optimization horizon in reasonable computational times, previous work 7 has proposed a formulation with variable time steps, which we use in this paper to evaluate its performance in another context.

REVISED
Most of the time the MPC optimization is performed to find the best ways to minimize the operational costs of a system.Environmental impacts of the system like GHG emissions and the use of renewable energy are often considered external to the problem and do not represent the focus of the optimization problem.A key contribution of this paper is to propose a comparison of traditional cost minimization with two other control strategies: a GHG emissions minimization strategy and a strategy for the maximization of the use of renewable energy and self-consumption, in order to find what differences in operation these three types of control would induce.In order to do so, precise environmental indicators of the electricity grid need to be calculated.
As the studied demosite is not installed at the time of this study, the controlled system of the MPC is a non-linear modelling of the technological package, modelled using the software TRNSYS.Due to technical constraints, TRNSYS and the software used for MILP modelling and co-simulation are not using the same computer architecture (32-bits versus 64-bits).An alternative method to traditional functional mock-up (FMU) interface standards needs to be implemented.
In this paper, we therefore demonstrate the application of MPC with MILP methodology on the TP2 innovative technological package at the residential building scale.This requires developments regarding environmental indicators of the electricity grid, an alternative method to functional mock-up (FMU) interface standards for co-simulation and the modelling of long-term energy storage.
The development of the methods is described in Section 2, and the results are discussed in Section 3.

Test case presentation
This study focuses on the Riga demo site of the SunHorizon project where the building on which the new technological package will be installed is a residential individual house located in Sunisi, near Riga, Latvia.The house was previously equipped with a gas boiler to cover the heating demand.
The objective of the project in Riga is to demonstrate the performance of a hybrid system relying on integrated installation of solar, heat pump, thermal storage and controls components as shown in Figure 2, overall energy system layout: • 50 m² of DualSun solar hybrid PVT uninsulated panels will be carried out on the premises, for a total installed peak power of 9.6 kWp.
• 20kW BoostHeat CO 2 heat pump in replacement of the current boiler.The indoor unit consists in the brine-to-water heat pump which compressor is thermally driven and gas fired (unlike conventional electric vapor compression heat pumps), for space heating supply, and a secondary gas burner to prepare DHW in compact DHW tank inside the indoor unit.The secondary gas burner is complementing the heat pump's space heating supply to reach desired temperature flow set point.Details about the thermodynamic working principles of the Boostheat innovative heat pump are given in 8.The lab measurement of Boostheat unit's Gas Utilization Efficiency (GUE) achieves 2.0 in A7/W35 conditions when connected to the Boostheat outdoor fan coil unit.
• These heat sources components will integrate in the building with hot water storage tank, cold glycol buffer tank and SmartHeater, under the global supervision of controller developed by Ratiotherm technology provider.The SmartHeater component is an electric resistive heater that is switching several resistors in real time to consume up to 15kW.It aims usually at photovoltaic electricity self-consumption objective with regard to the entire building consumption, therefore reducing the amount of electricity fed into the grid as much as can be stored as heat in to the hot water tank, up to 85°C.
The preliminary performance study of the innovative technological package TP2 was performed by SunHorizon partners through TRNSYS 9 modelling and simulations together with models of the building, users' specific electricity and DHW consumptions, Riga climate, and reported in Chèze et al. 10 together with three other solar and heat pump systems analyzed in SunHorizon project.The main parameter values from TRNSYS components for the current test case TP2 are summarized in Table 1.The parametric study revealed a low influence of the storage tanks sizes on the Key Performance Indicators (KPI) like savings of Green House Gas emissions, non-renewable primary Energy consumptions, or cost bills reduction when considering the current electricity Net metering regulation in Latvia.Thus, the decision to incorporate a quite large capacity hot water tank was mainly assuming probable evolution of the renewable electricity feed-in scheme towards self-consumption incentives.
A prototype of this solar and heat pump technology package was built by technology manufacturers in 2021, then tested by CEA following hardware-in-the-loop methodology, so-called Typical Short Sequences (TYPSS).In 12 the overall behavior and control of the real TP2 prototype are compared to previous detailed simulation results.It emphasized the need to set carefully the control parameters of this TP2 to achieve expected energy performance level on such real dynamic system.
Indeed, in order to maximize the solar heat collection efficiency of PVT panels, the reference control strategy in the Riga demo case intends to store solar heat either in the hot water storage or in glycol storage tank according to the coldest tank, which depends on the solar loop temperature grade and heat pump activation rate.The connection of the heat pump's evaporator to solar heated glycol tank is activated against connection to the outdoor air fan coil, according to the highest temperature level to maximize the current GUE efficiency of the heat pump.After solar thermal heat from PVT panels potentially preheats SH return loop or fresh water in the hot water storage, the Boostheat unit is activated complementary to grant the heat supply to the users at the desired temperature.
In addition, the simulations accounted for the grid net metering mechanism in Latvia.It allows the user to feed into the grid the PV electricity that is not self-consumed by the building and, the following year, to buy the equivalent amount of energy for discounted price where only distribution fees are paid (in average 35% of the actual grid price).It is a kind of electricity storage on the grid.
From the application on TP2 test case detailed TRNSYS simulation, the objective of this work is to analyze the influence on the performance figures of the control decisions relying on MPC upgraded control approach.

MPC implementation
MPC is based on MILP optimization.In this type of control, the considered system is modelled as a MILP, taking various time series as inputs and calculating the optimized trajectories of a set of control variables in order to minimize an objective function.During the successive optimizations, the controller is given feedback from a TRNSYS digital twin, in order to update the initial state of the MILP with actual information on the controlled system.The detailed structure of MPC is presented in Figure 3. MILP was chosen for the optimization as it provides computation times that are suitable for future live implementation on demosite.The MILP model of the considered energy system on which relies the optimization part of the MPC is detailed in Section 2.4.
The optimizer sends to the TRNSYS model optimized control variables, the smart heater power, and gets as feedback from the simulation the actual level of the Ratiotherm storage.Due to technical constraints of the demosite, only the smart heater in the technological package can be controlled by external control algorithms, therefore it represents our main control variable.Other variables could have been implemented in simulation but it was not representative of the actual controlled system.The tool implemented to perform this data exchange is described in Section 2.5.
The MPC is using the rolling horizon methodology (Figure 4).For a one-year simulation, the forecasted horizon of each optimization is limited, and optimizations are solved successively with a 1h time-shift between them.The initial state of each optimization is set both by the results of the previous optimization and the feedback from the TRNSYS model.The grid net metering measure in Riga behaves similarly to long-term storage.With a typical 48h horizon, the behavior of such storage cannot be forecast, as electricity can be stored in the grid for more than a few days and used later.In order to optimize its use, a longer horizon would be required to forecast long-term changes.With a 1h time step and an 8760h horizon, this will induce a high number of constraints that will increase the complexity of the problem and make the computation time skyrocket.
A new methodology is implemented in this paper, proposed by Cuisinier et al. 7 .It uses a horizon with a variable time step, which allows the optimization of long-term decisions as well as short-term decisions.
With this methodology, a control horizon of 58 days (1392 hours) with only 56 time steps is proposed.This global control horizon is the combination of a short-term and a long-term horizon, that have different time steps, as presented in Figure 5.In addition to a short-term 48h horizon (with a 1h time step), a long-term horizon covering 8 weeks is also included (this time with a time step of 168h, hence a week).Thus, the actual number of time steps on which the optimization needs to be performed is only of 56, but the total period covered by the horizon is 2 months and 2 days.With a traditional approach, 1392 time steps would be needed to cover the same period.Heating load is the aggregated demand of radiators on both floors of the building and of domestic heating water.
The electricity load covers the demand of all basic appliances and the use of a chiller in summer (not modelled in our optimization problem as it will not be replaced within the project).
Typical loads for winter and summer are presented in Figure 6.

Electricity related data.
In order to optimize the system, external indicators regarding the electricity grid need to be calculated.In addition to the variable electricity costs for costs minimization, indicators such as CO2 intensity and renewable share are needed for environmental impact minimization.
This electricity related data is obtained from the European Network of Transmission System Operators (ENTSOE) platform, where "Augstsprieguma tīkls AS", the Latvian transmission system operator, shares historical data.
Spot prices for the year 2018 in Latvia were used.In addition to these variable costs, a fixed part is added, which corresponds to distribution fees from the TSO (49.3 €/MWh) and subsidies for the development of renewable energies and cogeneration (17.9 €/MWh).The final electricity prices are shown on Figure 7.  Regarding the environmental indicators, CO2 intensity for generated electricity is calculated using actual generation per production type in Latvia and CO2 intensity factors from the Intergovernmental Panel on Climate Change (IPCC) guidelines 13 , shown in Table 2.As shown in Figure 8, base load in Latvia comes mostly from biomass, hydro represents a high share of electricity production but with high seasonal variability and most of the variable load is covered with natural gas.
The mean CO2 intensity of produced electricity in Latvia is therefore around 346 gC02eq/kWh, with 43.7% of the renewable share.
However, when accounting for CO2 emissions of electricity, there are important differences between produced and consumed electricity as mentioned by Tranberg et al. 14 .
In Latvia, 11% of the consumed electricity in 2018 came from imports and 68% of these imports came from Estonia (28% from Russia and 3% from Lithuania), as can be seen in Figure 9.Because of this high import share, CO2 intensity for consumed electricity is underestimated if only national electricity generation is considered.Electricity in Estonia is mainly produced from oil shale, which has a very high CO2 intensity.Oil shale represented 81% of electricity production in 2018, therefore the average CO2 intensity of its electricity production is 1209 gC02eq/kWh).
A new calculation of these indicators is proposed in this paper (Equation ( 1)), which accounts more precisely for the part due to imports in the final consumed electricity.

El
[kWh] the total of electricity produced in Latvia, % j t imp the share of imports coming from neighbor j, Balance t [kWh] the net total of import and The difference between produced electricity and final consumption is plotted in Figure 10.On average, the final CO2 intensity for the Latvian grid is 468 gCO2eq/kWh, with a renewable share of 39.5 %.This MPC uses perfect forecast for the above-mentioned electricity and weather time series.In live implementation of the controller, time series forecasting algorithms (with machine learning for example) could be implemented for better accuracy in the results, but it is outside the scope of this study.Prediction of variables such as CO2 intensity of electricity could prove rather complex as it seems to require a great amount of explanatory variables, as well as reliable forecasts for market, power generation and weather data 15 .

System MILP modelling
The optimization model of the Riga technological package, described in Section 2.1, is based on MILP formalism.The objective of a MILP problem is to find the vector of decision variables x T = (x 1 ,…,x k ,x k+1 ,…,x n ) solution of system (2), where x is composed of k continuous variables and (nk) integer variables.The MILP model is based on the following component types: -Buses: each bus performs a balance of energy flux of its specific energy carrier.
With, for each time t, t out P the produced output power of the converter, t in P the input power for the converter and η converter the efficiency of the converter.
-Storages: Ratiotherm Storage and Grid Net Metering are energy storages that charge and discharge energy to the buses.the discharge power of the storage and K loss an aggregated loss coefficient of the storage.
-Loads and productions: loads and production are imposed time series on a bus.
-Grids: grids offers an infinite source of energy that can be purchased by the system.In this paper, three objectives functions are compared, the first one on costs minimization in Equation ( 6) (referred to as MPC on costs), and the second one on GHG emissions minimization in Equation ( 7) (referred to as MPC on GHG).The last objective function is designed to maximize both self-consumption of the building (which is 100% renewable) and renewable energy use, and is detailed in Equation ( 8) (referred to as MPC on SELF).This is done by minimizing the gas consumption as well as the non-renewable part of electricity bought from the grid.

Grid
[%] the instantaneous fossil fuel share of electricity from the grid.

Co-simulation with TRNSYS
As part of the MPC methodology, in order to account for the non-linear phenomenon that cannot be modelled through MILP, feedback from the actual system or detailed simulation model are needed at each timestep to update the state of the system.As the Riga building site with real technology package is not operational yet, co-simulation is implemented with the detailed TRNSYS simulation model that was developed in the early stage of the project on sizing purpose 10 .Co-simulation is implemented on PEGASE, a platform developed at CEA 17 that provides a framework for the design and deployment of advanced control strategies Co-simulation is usually done through FMU.Even if an open source project for an FMU tool for TRNSYS is available online, compatibility issues between 32 bits TRNSYS model and 64 bits optimization software made the use of standard FMU impossible.
An alternative method was developed in this paper, using a local TCP (Transmission Control Protocol) server and sockets.TCP is a protocol of the Internet Protocol suite, that provides communication services at a lower level than an application program.It relies on a connection between a server and a client.A module was developed in PEGASE to launch a TCP server and a newly developed TRNSYS type is working as the client side.
In actual operation, both models are running in parallel and at the end of each time step, both pause until data through the TCP socket is received.

Results
In this section, results obtained by the MPC for a yearly simulation for the three objective functions are compared 18 .Yearly operation of the smart heater is presented on Figure 12.
In the MPC on costs and MPC on GHG scenarios, the operation of the smart heater shows similar trends.The smart heater is mostly used when PV production increases from March to July, In November and December, the control is the same as before March, where the smart heater is not used and heat production is covered with the heat pump only.
For the MPC on SELF, the smart heater has a more predominant role.It is used as soon as PV electricity is produced.This allows for less use of the heat pump and therefore of natural gas.Consumption from the grid is however increased, as it has a higher renewable share than the fossil gas used by the heat pump.
The energy stored in the Ratiotherm storage and the grid net metering are plotted in Figure 13 and Figure 14.The thermal storage is used in winter on a daily basis but for small amount of energy as the heating demand is high and PVT production low.During summer, the excess of solar thermal production is stored in the water tank, which is use as a buffer before the increase of demand in winter.In summer, the thermal production of PVT panels is indeed higher than the daily heating demand, so despite the heat losses, this production is stored in the tank so it can be used for free at the end of summer when PVT production decreases and heating demand increases.
The main differences between the scenarios lie in the energy stored between November and March.With the MPC on SELF, because of the high use of the smart heater, the thermal energy storage has higher use during this period.Even when heating demand is high, most of the PV production is converted into heat in order to decrease the use of fossil fuel.
Regarding the net metering, for all scenarios electricity is stored mostly at the end of summer, in order to lower the extraction from grid when PV production decreases.However, because more PV production is converted into heat with the MPC on SELF, the cumulative energy stored in net metering is lower.Energy stored through grid metering in SELF scenario drops as soon as the heating demand starts after the summer, so the electricity produced by the PVT panels can be used by the smart heater, in order to minimize the gas consumption.
The total energy balances for heat and electricity are summed up in Figure 15 and Figure 16.It can be seen in these energy balances that MPC on costs and MPC on GHG have similar behaviors.In all scenarios most of the heat demand is covered by the use of the heat pump.However, as mentioned beforehand, the total heat pump production is lower with the MPC on SELF as the smart heater covers some of the demand outside of summer.
For the electricity balance, the impact of the higher use of smart heater shows a lower use of net metering and higher grid consumption with the MPC on SELF than the two others.
Main indicators for the two control types can be found in Table 3.The optimization of costs is 1.5% cheaper than the optimization of GHG, and the emission are almost 1% lower in the second scenario.The two first control types offer gains on either costs or GHG emissions differences in the final indicators, however, are small.This comes from the low level of flexibility of the system, the only control variable being the use of the smart heater.The high CO2 intensity of electricity in Latvia and the low cost of natural gas makes the use of the heat pump an inevitable choice in terms of both costs and GHG emissions.
MPC is however able to profit from the variations in electricity prices or CO2 intensity, to highlight potential gains depending of the chosen control strategy.
The scenario for self-consumption and renewable share results in an increase of both the electricity self-consumption and the renewable energy share.However, this comes with a notable increase in both costs and GHG emissions of the overall system.In this scenario, the smart heater is more used, therefore less gas is bought for heating and more electricity is bought from the grid.As electricity from the Latvian grid has, in average, higher CO2 intensity than natural gas (467 gCO2eq/kWh in average for the grid and 244 gCO2eq/kWh for natural gas), GHG emissions are higher in the scenario.However, as gas is 100% fossil and grid electricity is always partly renewable, the overall renewable share is therefore higher.This control provides interesting results in the case where self-consumption is an important issue, but its economic and environmental interests are low.

Conclusion
This paper investigates the application of MPC-MILP methodology on an innovative technological package for residential building following possible developments of Latvian context.To proceed with the optimal control, the environmental impacts of the electricity grid are calculated, accounting for imports from neighboring countries.Co-simulation is performed outside of the FMU standard by using TCP protocol.Finally, long-term energy storage is modelled thanks to an optimization problem with variable time step.
Three control strategies were compared in this paper.Optimal control on costs and GHG show that gains can be found within the variations in time series related to the electricity grid, but the overall operation strategies remain similar.Optimal control of renewable share and self-consumption shows another path for control strategy but economic and environmental performances are lower.
These control strategies could be improved by performing internally multi-criteria optimization.Tradeoffs between the three objectives tested in this paper could then be found, but these calculations usually require high computation times.It would also be interesting to test this technological package in other European countries, as lower CO2 intensity in electricity could induce major variations in control between the cost and GHG minimization scenarios.In parallel, further investigations in simulation for such kind of solar and heat pump system are needed to establish the relationships between the size of the thermal storage, its thermal losses and the optimal control's time horizon.Finally, time series forecasting of weather and electricity related data could be investigated to improve reliability of the results in live implementation.
However, in order to replicate the results presented in this article, below is a list of alternative open-source software that can be used as replacements: -OpenModelica (https://openmodelica.org/):based on the modeling language Modelica, it offers a free environment to model and analyze complex dynamic systems (alternative to TRNSYS)

Pengmin Hua
Aalto University, Espoo, Finland In this paper, the authors focused on developing optimal strategies for a residential building with hybrid photovoltaic panels, a gas driven heat pump and a hot water storage tank.They developed a model predictive control method based on mixed integer linear programming optimization, built models in TRNSYS, and implemented the co-simulation on PEGASE.However, the manuscript needs to be majorly modified to further consider the paper for possible indexing.There are many variables and abbreviations in your manuscript, and I suggest you add a Nomenclature to summarise all the variables and abbreviations in your manuscript. 1.
There is much related research on applying MPC on buildings with various heating systems.Your manuscript does not accurately introduce the current literature.Thus, you need to add more analysis of related research in Introduction.

2.
The Conclusion is too general, and you need to describe more details of your research results and emphasize what are your work's contributions.

If applicable, is the statistical analysis and its interpretation appropriate? Yes
Are all the source data underlying the results available to ensure full reproducibility?

Are the conclusions drawn adequately supported by the results? Partly
Competing Interests: No competing interests were disclosed.
Reviewer Expertise: Model predictive control for buildings with various energy systems I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard, however I have significant reservations, as outlined above.

Etienne Saloux
CanmetENERGY, Natural Resources Canada, Varennes, QC, Canada Although it is not easy to see the changes in the revised version (no version with track changes), the authors seem to have partially addressed most of the reviewer's comments overall.The literature review, which has already been slightly extended, could still be further expanded: it only contains a few papers on related topics (2 papers on advanced controls and MPC; 2 papers on building integrated systems) while more initiatives are available in the literature and can be easily found.For the rest, the case study has been described in more depth and technical details have been added to address minor comments (FMI, variable energy price and CO2 intensity forecasting, control variables and time steps, optimization, building load, etc.).

If applicable, is the statistical analysis and its interpretation appropriate? Partly
Are all the source data underlying the results available to ensure full reproducibility?

Are the conclusions drawn adequately supported by the results? Partly
Competing Interests: No competing interests were disclosed.
Reviewer Expertise: Design and advanced controls for buildings and integrated energy systems The article currently has multiple shortcomings: The title does not match the content.There is only one heat pump, it is not described at all in the article and its control is not addressed either.It is also not sun-coupled, the heating rod is.Only the second part of the title makes sense.Crucial information is missing both in the title and in the abstract: There is no mention of the Latvian electricity CO2 intensity even though this is -at least in the eyes of the reviewer -one of the most relevant contributions of the article.

○
There is no motivation for the method in the introduction.The "required developments regarding environmental indicators of the electricity grid", the "alternative method to functional mock-up" and the "modelling of inter-seasonal energy storage" are presented as ○ necessities while never having been mentioned before and not having been motivated (it would, at least, make sense to move the corresponding paragraph one position down to at least have motivation for the environmental indicators).
The test case is not sufficiently explained.There is no information about the efficiency of the PVT modules, The MPC and its interaction with the TRNSYS simulation is not sufficiently explained If only the smart heater power is a decision variable of the optimizer, where do all the other setpoints come from?How is the heat pump operated?When is energy stored in (one of) the thermal storages?(is it a simple two-point controller with hysteresis based on temperature levels?)When is electricity stored or retrieved from the grid?

○
Is the glycol storage also modeled?

○
What is actually simulated in TRNSYS?Is this simply a 1D water storage model?Is the heat pump simulated?
○ Is perfect foresight assumed?Or are there any forecast algorithms involved?

○
The figure on "Rolling horizon methodology" is misleading ("timeshift" of 1h vs. the smaller hops of... also 1h?) The conclusions seem dubious concerning the difference between GHG and REN objective functions If the CO2 intensity of the grid in the GHG optimization can be approximated as the CO2 intensity of gas times the fossil fuel share of the network at that time, as would be intuitive, then the two cost functions should be approximately identical.This raises the question on how the fossil fuel share was calculated and why it should be so different from the CO2 intensity.Table 2 indicates that MPC on REN share actually maximizes GHG emissions, which seems completely counterintuitive.

○ ○
The data provided are the results, not the data required to obtain the results

○
These shortcomings must be addressed before the article can be deemed fit for indexing.

Other comments:
Why is the CO2/renewable energy share not considered for power bought back via the net metering process in the cost functions for GHG and REN?It should result in CO2 reduction when sold, and CO2 increase when bought back, thus enabling "CO2 trading".

○
The name "seasonal storage" is a bit pretentious and should be re-named to, at most, "longterm storage" (the prediction horizon is 2 months and the storage is actually quite small).
○ Figure 11 on the use of thermal storage indicates that the small 1,3 m 3 storage is used as a seasonal storage.This is very unlikely given the heat losses this would incur."Use of thermal energy storage" is also quite misleading, since the storage should of course be "used" in winter, but seems to be empty all the time...? The two first control types offer gains on either costs or GHG emissions_;_ differences in the final indicators, however, are _small_.

○
The scenario for renewable share offers an incease _of_ both the electricity... (--> why "offers"?"results in" would be better, I guess) Reviewer Expertise: Optimization-based hybrid energy system operation I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard, however I have significant reservations, as outlined above.
Author Response 10 May 2023 according to your comment Figure 11 [...] This is very unlikely[...]: We added the following explanation "The thermal storage is used in winter on a daily basis but for small amount of energy as the heating demand is high and PVT production low.In summer, the thermal production from PVT panel is higher than the daily heating demand, so despite the heat losses, this production is stored in the tank so it can be used for free at the end of summer when PVT production decreases and heating demand increases." ○ Figure 12: Why is there a clean drop in grid metering usage for the REN scenario?Energy stored through grid metering in SELF scenario drops as soon as the heating demand starts after the summer, so the electricity produced by the PVT panels can be used by the smart heater, in order to minimize the gas consumption.
(comment added in the article) ○ "Software availability" still only mentions GLPK: At the time of the project, only GLPK was supported by the PERSEE software as an alternative to CPLEX.However Cbc has been recently added to the supported solvers so it has been added to the "Software availability" Section ○ Errata: All errors were corrected.We thank the reviewer for providing such a careful feedback and apologize for the inconvenience.

Etienne Saloux
CanmetENERGY, Natural Resources Canada, Varennes, QC, Canada The manuscript deals with the evaluation of control strategies targeting different objectives (reduction of energy costs, GHG emissions; increase of renewable energy usage) for a novel system equipped with photovoltaic/thermal panels, gas-driven heat pump, hot water storage tank and smart heater.Results showed that the optimization function slightly impacts the system performance.
The manuscript is very interesting and looks innovative with the evaluation of different objective functions in a practical context (Latvia).My main comment is that the manuscript is relatively short (less than 5,000 words while the limit is 15,000), the literature review is succinct and some sections should be expanded to provide more details.Detailed comments are given below.
Can you provide a reference for PERSEE software?
○ Why is gas consumption included in Eq 8?

○
In the Results section (page 11/16), could you discuss why the smart heater is more used in the REN, but not in the GHG scenario?

○
The results section shows very interesting results.The authors have mentioned that the design has already been investigated but how the control strategy could impact system design?This aspect could be discussed or further investigated.An example tackling this topic can be found here 2 , (no need to cite this paper if it is not relevant).Reviewer Expertise: Design and advanced controls for buildings and integrated energy systems I confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard, however I have significant reservations, as outlined above.

2. 3
Time series development 2.3.1 Load profiles.Demand profiles for 2018 were calculated within the project.It uses a detailed building model of the house in Sunisi and weather data measured in Riga in 2018.The details for these loads calculation can be found in 11.

Figure 6 .
Figure 6.Load profiles for a typical week in winter and in summer.

Figure 5 .
Figure 5. MPC horizon with variable time step.
kWh] the CO2 intensity of produced electricity from neighbor j.

Figure 10 .
Figure 10.Environmental indicators for the electricity grid in Latvia (2018).
c [n] is the vector of costs, A [m × n] is the matrix of linear constraints and LHS [m] and RHS[m] are the vectors of linear constraints.l b [n] and u b [n] are the lower and upper bounds vector of the decision variables, respectively.The optimization problem was modelled on PERSEE16 , a modelling software developed internally in CEA (The French Alternative Energies and Atomic Energy Commission) dedicated to optimization and techno-economical assessment of energy systems with multiple energy carriers.PERSEE allows modelling of complex energy system by assembling individual MILP model contributions into a larger problem.The optimization problem is then solved by a CPLEX solver.

Figure 11
Figure 11 gives an overview of the SunHorizon problem architecture as it was implemented inside PERSEE.

Figure 11 .
Figure 11.MILP model architecture as implemented in the modelling software.DHW: domestic hot water; MILP: mixed integer linear programming.

Reviewer
Report 26 May 2023 https://doi.org/10.21956/openreseurope.17260.r31738© 2023 Saloux E. This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

1 Reviewer
confirm that I have read this submission and believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard.Version Report 09 February 2023 https://doi.org/10.21956/openreseurope.16207.r30728© 2023 Muschick D. This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.Daniel Muschick BEST -Bioenergy and Sustainable Technologies GmbH, Graz, AustriaThe article presents a simple optimization-based simulation study of a single family home with a thermal-compression, gas fired heat pump, PVT, two thermal storages, an electrical heating element and the possibility to "store" electrical energy in the grid via a specialty of the Latvian net metering billing mechanism.It considers a variable time step prediction horizon to include longterm decisions in the optimization problem and includes a model to represent the time-varying share of renewable energy and CO2 intensity of electricity produced in Latvia or imported from other countries.The main contributions are this time-varying model and the comparison of the results of three optimization tasks: Optimizing costs, optimizing CO2 emissions and optimizing the share of renewables.

○
on the COP of the heat pump, ○ on the size of the glycol tank (if it is at all relevant), ○ on the temperatures (feed, return) which determine the capacity of the thermal storage, ○ on the loss term describing the storage, ○ on the prices for gas, electricity, ○ on the true workings of the net metering billing mechanism (the use of the word "later" is much too vague ○ ○ clearly and accurately presented and does it cite the current literature?PartlyIs the study design appropriate and does the work have academic merit?YesAre sufficient details of methods and analysis provided to allow replication by others?NoIf applicable, is the statistical analysis and its interpretation appropriate?Not applicableAre all the source data underlying the results available to ensure full reproducibility?PartlyAre the conclusions drawn adequately supported by the results?PartlyCompeting Interests: No competing interests were disclosed.

○
Competing Interests: No competing interests were disclosed.Reviewer Report 09 February 2023 https://doi.org/10.21956/openreseurope.16207.r30727© 2023 Saloux E. This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

2 ,
could you identify the outdoor unit?○ Page 5/16: demands, not dem ands ○ Page 6/16, first paragraph after Figure 4: cannot be forecasted, not forecast ○ Page 6/16: air conditioner, rather than chiller ○ In Figure 5, consider reformulating "hour of the week" ("hour"?) ○ In Figure 12, should the y axis be net metering instead?○ Are the conclusions drawn adequately supported by the results?Yes Competing Interests: No competing interests were disclosed.

Table 1 . Outlook of the main TRNSYS components from the TP2 test case. Type Name Type identifier Type description
The input time series for the MILP model are weather data, heating and electricity demand and electricity related data such as variable price and CO2 intensity.Demands are detailed in Section 2.3.1 and electricity indicators in Section 2.3.2.

Table 2 . CO2 intensity by production technology. Production technology CO2 intensity (gCO2/kWh)
kWh] the CO2 intensity of produced electricity, exports t [kWh] the amount of exported energy, imports t [kWh] the amount of imported energy, Energy converters: Smart Heater, BoostHeat heat pump and back-up boiler are energy converters, converting one type of energy carrier to the other with a fixed efficiency.
With, for each time t, i t in P the i input power to the bus and j t ou t P the j output powers from the bus -

Table 3 . Main indicators for the three control types. MPC on costs MPC on GHG emissions MPC on SELF consumption
GHG: greenhouse gas; MPC: model predictive control; OPEX: operating expenses

Open Peer Review Current Peer Review Status: Version 2
This is an open access peer review report distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Why is there a clean drop in grid metering usage for the REN scenario?This looks weird and requires an explanation.And again: What does "usage" mean?Is this the energy shifted daily, the energy really stored in the grid... Software availability" still only mentions GLPK as an open source alternative to the powerful commercial solvers (CPLEX, Gurobi).In our experience, this solver has been outperformed by at least Cbc and HiGHS for a long time and has not been able to solve many of the optimization problems we posed it.This might have changed, however, the home page has last been updated in 2012.I have the feeling that everybody just copies the same reference over and over again because GLPK pops up almost everywhere in literature.