commit 27f8efb98f8edde092dd367542dbdcda62750e98 Author: Thomas Dehaeze Date: Thu Aug 22 15:48:47 2019 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..75405de --- /dev/null +++ b/.gitignore @@ -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 diff --git a/index.org b/index.org new file mode 100644 index 0000000..e778e59 --- /dev/null +++ b/index.org @@ -0,0 +1,12 @@ +#+TITLE:Test of Cercalo +:DRAWER: +#+STARTUP: overview +#+HTML_HEAD: + +#+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: diff --git a/run_test.m b/run_test.m new file mode 100644 index 0000000..2d6cee2 --- /dev/null +++ b/run_test.m @@ -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); diff --git a/setup.m b/setup.m new file mode 100644 index 0000000..97489ad --- /dev/null +++ b/setup.m @@ -0,0 +1 @@ +Ts = 1e-4; % [s] \ No newline at end of file diff --git a/test_cercalo.slx b/test_cercalo.slx new file mode 100644 index 0000000..23e1900 Binary files /dev/null and b/test_cercalo.slx differ