[Notebooks] First version of MPC, bad GP
1652
Notebooks/10_wdb_from_experimental_data.ipynb
Normal file
1130
Notebooks/20_simulating_carnot_model.ipynb
Normal file
2956
Notebooks/30_gaussiandome_identification.ipynb
Normal file
369
Notebooks/31_gpflow_first_test.ipynb
Normal file
1873
Notebooks/40_casadi_gaussiandome.ipynb
Normal file
687
Notebooks/41_casadi_gp_test.ipynb
Normal file
19188
Notebooks/50_mpc_formulation.ipynb
Normal file
BIN
Notebooks/Images/first_simulation.gif
Normal file
After Width: | Height: | Size: 1.3 MiB |
BIN
Notebooks/model/gp_params.gpf
Normal file
BIN
Notebooks/model/gp_trainset.pkl
Normal file
BIN
Notebooks/model/x_scaler.pkl
Normal file
200
Simulink/Images/Exp1_simulation.svg
Normal file
After Width: | Height: | Size: 93 KiB |
184
Simulink/Images/Exp2_simulation.svg
Normal file
After Width: | Height: | Size: 89 KiB |
173
Simulink/Images/Exp3_simulation.svg
Normal file
After Width: | Height: | Size: 104 KiB |
189
Simulink/Images/Exp4_simulation.svg
Normal file
After Width: | Height: | Size: 107 KiB |
215
Simulink/Images/Exp5_simulation.svg
Normal file
After Width: | Height: | Size: 88 KiB |
173
Simulink/Images/Exp6_simulation.svg
Normal file
After Width: | Height: | Size: 104 KiB |
214
Simulink/Images/Exp7_simulation.svg
Normal file
After Width: | Height: | Size: 154 KiB |
|
@ -26,26 +26,23 @@ HVAC_COP = 3;
|
||||||
Heating_coeff = sign(Setpoint - InsideTemp);
|
Heating_coeff = sign(Setpoint - InsideTemp);
|
||||||
Heating_coeff(Heating_coeff == -1) = -1 * HVAC_COP;
|
Heating_coeff(Heating_coeff == -1) = -1 * HVAC_COP;
|
||||||
|
|
||||||
|
|
||||||
%% Set the model parameters
|
|
||||||
|
|
||||||
surface_part = 0.1;
|
|
||||||
|
|
||||||
%% Set the run parameters
|
%% Set the run parameters
|
||||||
|
|
||||||
air_exchange_rate = tin;
|
air_exchange_rate = tin;
|
||||||
air_exchange_rate(:,2) = 2.0;
|
air_exchange_rate(:,2) = 1.0;
|
||||||
|
|
||||||
% Set the initial temperature to be the measured initial temperature
|
% Set the initial temperature to be the measured initial temperature
|
||||||
t0 = Exp_data.(exp_id).InsideTemp.values(1);
|
t0 = Exp_data.(exp_id).InsideTemp.values(1);
|
||||||
|
|
||||||
power = [tin Heating_coeff .* (Exp_data.(exp_id).Power.values - 1.67 * 1000)];
|
power = Exp_data.(exp_id).Power.values - 1.67 * 1000;
|
||||||
|
|
||||||
|
power = [tin Heating_coeff .* power];
|
||||||
|
|
||||||
|
|
||||||
% Turn down the air exchange rate when the HVAC is not running
|
% Turn down the air exchange rate when the HVAC is not running
|
||||||
night_air_exchange_rate = 0;
|
night_air_exchange_rate = 0.5;
|
||||||
air_exchange_rate(abs(power(:, 2)) < 100, 2) = night_air_exchange_rate;
|
air_exchange_rate(abs(power(:, 2)) < 100, 2) = night_air_exchange_rate;
|
||||||
|
|
||||||
|
|
||||||
%% Run the simulation
|
%% Run the simulation
|
||||||
% Note: The simlulink model loads the data separately, includes the
|
% Note: The simlulink model loads the data separately, includes the
|
||||||
% calculated solar position and radiations from pvlib
|
% calculated solar position and radiations from pvlib
|
||||||
|
@ -53,17 +50,15 @@ load_system("polydome");
|
||||||
set_param('polydome', 'StopTime', int2str(tin(end)));
|
set_param('polydome', 'StopTime', int2str(tin(end)));
|
||||||
simout = sim("polydome");
|
simout = sim("polydome");
|
||||||
|
|
||||||
|
SimulatedTemp = simout.SimulatedTemp;
|
||||||
%% Compare the simulation results with the measured values
|
%% Compare the simulation results with the measured values
|
||||||
SimulatedTemp = simout.SimulatedTemp.Data;
|
|
||||||
|
|
||||||
figure; hold on; grid minor;
|
figure; hold on; grid minor;
|
||||||
plot(tin, InsideTemp);
|
plot(tin, InsideTemp);
|
||||||
plot(tin, OutsideTemp);
|
plot(tin, OutsideTemp);
|
||||||
plot(simout.tout, SimulatedTemp, 'LineWidth', 2);
|
plot(SimulatedTemp, 'LineWidth', 2);
|
||||||
|
|
||||||
|
|
||||||
legend('InsideTemp', 'OutsideTemp', 'SimulatedTemp');
|
legend('InsideTemp', 'OutsideTemp', 'SimulatedTemp');
|
||||||
|
|
||||||
|
|
||||||
x0=500;
|
x0=500;
|
||||||
y0=300;
|
y0=300;
|
||||||
width=1500;
|
width=1500;
|
||||||
|
@ -75,3 +70,7 @@ title(exp_id);
|
||||||
hold off;
|
hold off;
|
||||||
|
|
||||||
saveas(gcf, strcat(exp_id, '_simulation'), 'svg')
|
saveas(gcf, strcat(exp_id, '_simulation'), 'svg')
|
||||||
|
|
||||||
|
%% Export simulated temperature to a .mat file for further use
|
||||||
|
carnot_output_dir = strcat("../Data/CARNOT_output/",exp_id,"_carnot_temp.mat");
|
||||||
|
save(carnot_output_dir, 'SimulatedTemp');
|
||||||
|
|