nass-metrology-test-bench/run_test.m

62 lines
1.3 KiB
Mathematica
Raw Normal View History

2019-08-22 15:48:47 +02:00
tg = slrt;
%%
if tg.Connected == "Yes"
if tg.Status == "stopped"
%% Load the application
tg.load('test_cercalo');
%% Run the application
tg.start;
pause(101);
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
2019-09-12 15:50:31 +02:00
cuh = data(:, 5); % Voltage of the cercalo's inductors used for horizontal
cuv = data(:, 6); % [...] vertical
2019-08-22 15:48:47 +02:00
%% Plot the data
figure;
hold on;
plot(t, uh, 'DisplayName', 'uh');
plot(t, uv, 'DisplayName', 'uv');
2019-08-22 15:48:47 +02:00
hold off
xlabel('Time [s]');
ylabel('Voltage [V]');
legend();
2019-08-22 15:48:47 +02:00
2019-09-10 16:05:05 +02:00
figure;
hold on;
plot(t, xh, 'DisplayName', 'xh');
plot(t, xv, 'DisplayName', 'xv');
2019-09-10 16:05:05 +02:00
hold off
xlabel('Time [s]');
ylabel('Voltage [V]');
legend();
figure;
hold on;
plot(t, cuh, 'DisplayName', 'Cuh');
plot(t, cuv, 'DisplayName', 'Cuv');
hold off
xlabel('Time [s]');
ylabel('Voltage [V]');
legend();
%% Save
save('mat/data_uh.mat', 't', 'uh', 'uv', 'xh', 'xv', 'cuh', 'cuv');