I have the data of the outside temperatures [8,2,10,13 ..] and I have the thermal inertia (8h) of my building. One of the constraints would be to keep an inside temperature of my building within 20 degrees.
We start at equilibrium and we say that the T_in = 20, T_o = 20 but the T_o in one hour = 18 so the Delta_T_o = 18 and the loss in degrees = 2 / Inertia = 0.22K / h
So we have a T_in = 20-19.78, so the power must react to keep the T_in at 20 by applying the following function: Power = Delta_T (in-out) * U (W / m2.K) * Building area (m2) U being the heat transmission. Suppose that U = 3 and Building Area = 1900 Power = 10146 W.
The purpose of my function would be to minimize the power of my boiler according to the T_o that change and keeping T_in at 20.
See the graph to better visualize the objective.
I thought to use Pyomo or cvxpy but I do not see how to do it to make this MPC (Model Predictive Control)