%% Import recorded data
clear all; close all; clc;
data = readtable('20240429_20_36_12_944756_data.csv');

timestamps = table2array(data(:,"ts")); % timestamps in [ms]
T_setpoint = table2array(data(:, "Setpoint1")); % setpoint temperature in [°C]
T_obj = table2array(data(:,"Obj1")); % thermode temperature in [°C]

val_peltier = table2array(data(:,"TEC1_val")); % TEC output value [0-3110]
V_peltier = table2array(data(:,"Obj1")); % voltage applied to the Peltier [V]
I_peltier = table2array(data(:,"TEC1_I")); % current delivered to the Peltier [A]

R_ATS = table2array(data(:,"ATS1_R")); % ATS sensor resistance [Ohm]
T_ATS = table2array(data(:,"ATS1_T")); % ATS sensor temperature [°C] 

%% example plot
figure();
plot((timestamps-timestamps(1))/1000, T_obj);  grid;
xlabel('time [s]'); ylabel('Temperature [°C]');
