initial commit

This commit is contained in:
Thomas Dehaeze 2019-08-22 15:48:47 +02:00
commit 27f8efb98f
5 changed files with 112 additions and 0 deletions

52
.gitignore vendored Normal file
View File

@ -0,0 +1,52 @@
auto/
*.tex
**/figs/*.pdf
**/figs/*.svg
**/figs/*.tex
# Emacs
auto/
# Simulink Real Time
*bio.m
*pt.m
*ref.m
*ri.m
*xcp.m
*.mldatx
*.slxc
*.xml
*_slrt_rtw/
# data
data/
# Windows default autosave extension
*.asv
# OSX / *nix default autosave extension
*.m~
# Compiled MEX binaries (all platforms)
*.mex*
# Packaged app and toolbox files
*.mlappinstall
*.mltbx
# Generated helpsearch folders
helpsearch*/
# Simulink code generation folders
slprj/
sccprj/
# Matlab code generation folders
codegen/
# Simulink autosave extension
*.autosave
# Octave session info
octave-workspace

12
index.org Normal file
View File

@ -0,0 +1,12 @@
#+TITLE:Test of Cercalo
:DRAWER:
#+STARTUP: overview
#+HTML_HEAD: <script type="text/javascript" src="../js/readtheorg.js"></script>
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :results output
#+PROPERTY: header-args:matlab+ :exports both
#+PROPERTY: header-args:matlab+ :eval no-export
#+PROPERTY: header-args:matlab+ :output-dir figs
:END:

47
run_test.m Normal file
View File

@ -0,0 +1,47 @@
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_003.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);

1
setup.m Normal file
View File

@ -0,0 +1 @@
Ts = 1e-4; % [s]

BIN
test_cercalo.slx Normal file

Binary file not shown.