-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathon_off_control_script.m
More file actions
38 lines (33 loc) · 1.2 KB
/
on_off_control_script.m
File metadata and controls
38 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
clc, clearvars, close all;
% ritual to erase all the previous terminal message, vars, plots
set_val = 60;
% load dataset 1
f1 = xlsread('on-off-control-low-hyst-data.xlsx', 'Sheet1', 'B2:B70');
t1 = xlsread('on-off-control-low-hyst-data.xlsx', 'Sheet1', 'A2:A70');
% load dataset 2
f2 = xlsread('on-off-control-high-hyst-data.xlsx', 'Sheet1', 'B2:B107');
t2 = xlsread('on-off-control-high-hyst-data.xlsx', 'Sheet1', 'A2:A107');
% Plot dataset 1
figure;
plot(t1, f1); % main plot
ylim([20 80]);
hold on;
plot([t1(1), t1(end)], [f1(1),f1(1)]); % ambient temperature
hold on;
plot([t1(1), t1(end)], [set_val,set_val]); % temperature setpoint
xlabel('Time (s)');
ylabel('Temperature (°C)');
title('ON-OFF control - Low hysteresis')
legend("System response", "Ambient temperature", "Temperature setpoint", 'Location', 'best');
% Plot dataset 2
figure;
plot(t2, f2); % main plot
ylim([20 80]);
hold on;
plot([t2(1), t2(end)], [f2(1), f2(1)]); % ambient temperature
hold on;
plot([t2(1), t2(end)], [set_val,set_val]); % temperature setpoint
xlabel('Time (s)')
ylabel('Temperatue (°C)')
title('ON-OFF control - High hysteresis')
legend("System response", "Ambient temperature", "Temperature setpoint", 'Location', 'best');