nass-metrology-test-bench/run_test.m

50 lines
1.0 KiB
Mathematica
Raw Normal View History

2019-08-22 15:48:47 +02:00
tg = slrt;
%%
2019-09-10 16:05:05 +02:00
% if tg.Connected == "Yes"
% if tg.Status == "stopped"
% %% Load the application
% tg.load('test_cercalo');
%
% %% Run the application
% tg.start;
% pause(10);
% tg.stop;
% end
% end
2019-08-22 15:48:47 +02:00
2019-09-10 16:05:05 +02:00
%%
f = SimulinkRealTime.openFTP(tg);
mget(f, 'data/data_001.dat');
close(f);
2019-08-22 15:48:47 +02:00
%% Convert the Data
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
t = data(:, end);
uh = data(:, 1); % Voltage sent to cercalo in horizontal direction
uv = data(:, 2); % [...] in vertical direction
xh = data(:, 3); % Measured horizontal position of the beam by the 4QD
xv = data(:, 4); % [...] vertical position
cuh = data(:, 3); % Voltage of the cercalo's inductors used for horizontal
cuv = data(:, 4); % [...] vertical
2019-08-22 15:48:47 +02:00
2019-09-12 14:40:18 +02:00
save('mat/data_uv.mat', 't', 'uh', 'uv', 'xh', 'xv', 'cuh', 'cuv');
2019-08-22 15:48:47 +02:00
%% Plot the data
figure;
hold on;
plot(t, uh);
plot(t, uv);
2019-08-22 15:48:47 +02:00
hold off
xlabel('Time [s]');
ylabel('Voltage [V]');
2019-09-10 16:05:05 +02:00
figure;
hold on;
plot(t, xh);
plot(t, xv);
2019-09-10 16:05:05 +02:00
hold off
xlabel('Time [s]');
ylabel('Voltage [V]');