nass-micro-station-measurem.../slip-ring-test/run_test.m

55 lines
1.2 KiB
Mathematica
Raw Normal View History

2019-05-03 17:07:22 +02:00
%%
Tsim = 100; % [s]
%%
2019-04-30 10:38:22 +02:00
tg = slrt;
%% TODO - Build this application if updated
%%
if tg.Connected == "Yes"
2019-05-03 17:07:22 +02:00
if tg.Status == "running"
disp('Target is Running, Stopping...');
tg.stop;
while tg.Status == "running"
pause(1);
end
disp('Target is Stopped');
end
2019-04-30 10:38:22 +02:00
if tg.Status == "stopped"
2019-05-03 17:07:22 +02:00
disp('Load the Application');
2019-04-30 10:38:22 +02:00
tg.load('slip_ring_test');
%% Run the application
2019-05-03 17:07:22 +02:00
disp('Starting the Application');
2019-04-30 10:38:22 +02:00
tg.start;
2019-05-03 17:07:22 +02:00
pause(Tsim);
2019-04-30 10:38:22 +02:00
tg.stop;
end
else
error("The target computer is not connected");
2019-04-30 10:38:22 +02:00
end
2019-05-03 17:07:22 +02:00
%%
f = SimulinkRealTime.openFTP(tg);
cd(f, 'data/slip_ring_test/');
mget(f, 'data_001.dat', 'data');
close(f);
2019-04-30 10:38:22 +02:00
2019-05-03 17:07:22 +02:00
%%
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
2019-04-30 10:38:22 +02:00
%%
2019-05-07 14:20:53 +02:00
n = 19;
2019-05-03 17:07:22 +02:00
while isfile(['mat/data_', num2str(n, '%03d'), '.mat'])
disp('File exists.');
if input(['Are you sure you want to override the file ', 'mat/data_', ...
num2str(n, '%03d'), '.mat', ' ? [Y/n]']) == 'Y'
break;
end
n = input('What should be the measurement number?');
end
save(['mat/data_', num2str(n, '%03d'), '.mat'], 'data');