add documentation and data file

This commit is contained in:
DEHAEZE Thomas 2019-04-17 17:24:35 +02:00
parent 06a85d93d8
commit 3bdab45e03
6 changed files with 84 additions and 6 deletions

3
.gitignore vendored
View File

@ -9,6 +9,9 @@
*.xml
*_slrt_rtw/
# data
data/
# Windows default autosave extension
*.asv

View File

@ -6,10 +6,10 @@
We first copy the =dat= file from the target computer to the host computer:
#+begin_src matlab
tg=slrt;
f=SimulinkRealTime.openFTP(tg);
mget(f, 'DATA_001.dat');
close(f);
tg=slrt;
f=SimulinkRealTime.openFTP(tg);
mget(f, 'DATA_001.dat', 'local_folder');
close(f);
#+end_src
We then import the =dat= file to the workspace:
@ -21,14 +21,21 @@ We then import the =dat= file to the workspace:
* Commands with the target object
https://fr.mathworks.com/help/xpc/api/simulinkrealtime.target.html
| Connect | No Yes |
| Status | stopped runing |
| start | Start execution of real-time application on target computer |
| stop | Stop execution of real-time application on target computer |
| tg.viewTargetScreen | Show target computer screen |
| ping | Test communication between development and target computers |
| reboot | Restart target computer |
| close | Close connection between development and target computers |
| load | Download real-time application to target computer |
| unload | Remove real-time application from target computer |
| start | Start execution of real-time application on target computer |
| stop | Stop execution of real-time application on target computer |
| addscope | Create a scope of specified type |
| getscope | Return scope identified by scope number |
| remscope | Remove scope from target computer |
@ -50,3 +57,22 @@ https://fr.mathworks.com/help/xpc/api/simulinkrealtime.target.html
| getProfilerData | Retrieve profile data object |
| resetProfiler | Reset profiling service state to Ready |
| getDiskSpace | Return free space and total space on the drive, in bytes |
* FTP access to the target computer
https://fr.mathworks.com/help/xpc/api/simulinkrealtime.openftp.html?s_tid=doc_ta
First run the following commands to have the =FTP= Object:
#+begin_src matlab
tg=slrt;
f=SimulinkRealTime.openFTP(tg);
#+end_src
Then, the =f= object can be used to access the filesystem on the target computer.
| cd | | |
| dir | | |
| mget | Used to download data from the target host | =f.mget('data.dat', 'local_folder')= |
| mkdir | | |
| mput | | |
| rename | | |
| rmdir | | |
| close | | |

Binary file not shown.

View File

@ -0,0 +1 @@
* TODO Register data on the computer

48
slip-ring-test/run_test.m Normal file
View File

@ -0,0 +1,48 @@
tg = slrt;
%% TODO - Build this application if updated
%%
if tg.Connected == "Yes"
if tg.Status == "stopped"
%% Load the application
tg.load('test');
%% Run the application
tg.start;
pause(10);
tg.stop;
%% Load the data
f = SimulinkRealTime.openFTP(tg);
mget(f, 'data/data_001.dat');
close(f);
end
end
%% Convert the Data
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
t = data(:, end);
x1 = data(:, 1);
x2 = data(:, 2);
save('mat/data_001.mat', 't', 'x1', 'x2');
%% Plot the data
figure;
hold on;
plot(t, x1);
plot(t, x2);
hold off
xlabel('Time [s]');
ylabel('Voltage [V]');
%% Compute the PSD
dt = t(2)-t(1);
window_L = ceil(length(x1)/10);
window_han = .5*(1 - cos(2*pi*(1:window_L)'/(window_L+1)));
[pxx, f] = pwelch(x1, window_han, 0, [], 1/dt);

Binary file not shown.