add documentation and data file
This commit is contained in:
parent
06a85d93d8
commit
3bdab45e03
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,6 +9,9 @@
|
|||||||
*.xml
|
*.xml
|
||||||
*_slrt_rtw/
|
*_slrt_rtw/
|
||||||
|
|
||||||
|
# data
|
||||||
|
data/
|
||||||
|
|
||||||
# Windows default autosave extension
|
# Windows default autosave extension
|
||||||
*.asv
|
*.asv
|
||||||
|
|
||||||
|
32
readme.org
32
readme.org
@ -8,7 +8,7 @@ We first copy the =dat= file from the target computer to the host computer:
|
|||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
tg=slrt;
|
tg=slrt;
|
||||||
f=SimulinkRealTime.openFTP(tg);
|
f=SimulinkRealTime.openFTP(tg);
|
||||||
mget(f, 'DATA_001.dat');
|
mget(f, 'DATA_001.dat', 'local_folder');
|
||||||
close(f);
|
close(f);
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
@ -21,14 +21,21 @@ We then import the =dat= file to the workspace:
|
|||||||
* Commands with the target object
|
* Commands with the target object
|
||||||
https://fr.mathworks.com/help/xpc/api/simulinkrealtime.target.html
|
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 |
|
| tg.viewTargetScreen | Show target computer screen |
|
||||||
|
|
||||||
| ping | Test communication between development and target computers |
|
| ping | Test communication between development and target computers |
|
||||||
| reboot | Restart target computer |
|
| reboot | Restart target computer |
|
||||||
| close | Close connection between development and target computers |
|
| close | Close connection between development and target computers |
|
||||||
|
|
||||||
| load | Download real-time application to target computer |
|
| load | Download real-time application to target computer |
|
||||||
| unload | Remove real-time application from 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 |
|
| addscope | Create a scope of specified type |
|
||||||
| getscope | Return scope identified by scope number |
|
| getscope | Return scope identified by scope number |
|
||||||
| remscope | Remove scope from target computer |
|
| 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 |
|
| getProfilerData | Retrieve profile data object |
|
||||||
| resetProfiler | Reset profiling service state to Ready |
|
| resetProfiler | Reset profiling service state to Ready |
|
||||||
| getDiskSpace | Return free space and total space on the drive, in bytes |
|
| 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 | | |
|
||||||
|
BIN
slip-ring-test/mat/data_001.mat
Normal file
BIN
slip-ring-test/mat/data_001.mat
Normal file
Binary file not shown.
1
slip-ring-test/readme.org
Normal file
1
slip-ring-test/readme.org
Normal file
@ -0,0 +1 @@
|
|||||||
|
* TODO Register data on the computer
|
48
slip-ring-test/run_test.m
Normal file
48
slip-ring-test/run_test.m
Normal 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.
Loading…
Reference in New Issue
Block a user