initial commit

This commit is contained in:
Thomas Dehaeze 2020-08-12 17:53:51 +02:00
commit 842200ccb8
25 changed files with 1774 additions and 0 deletions

35
.gitignore vendored Normal file
View File

@ -0,0 +1,35 @@
# Windows default autosave extension
*.asv
# OSX / *nix default autosave extension
*.m~
# Compiled MEX binaries (all platforms)
*.mex*
# Packaged app and toolbox files
*.mlappinstall
*.slxc
*.mldatx
*.mltbx
*.xml
piezoapa_slrt_rtw/
# Generated helpsearch folders
helpsearch*/
# Simulink code generation folders
slprj/
sccprj/
# Matlab code generation folders
codegen/
# Simulink autosave extension
*.autosave
# Simulink cache files
*.slxc
# Octave session info
octave-workspace

View File

@ -0,0 +1,45 @@
piezo1 = load('mat/cedrat_la75b_med_1_stack.mat', 't', 'V_in', 'V_out');
piezo2 = load('mat/cedrat_la75b_med_2_stack.mat', 't', 'V_in', 'V_out');
piezo3 = load('mat/cedrat_la75b_med_3_stack.mat', 't', 'V_in', 'V_out');
%%
run setup;
win = hann(ceil(0.1/Ts));
[tf_1, f_1] = tfestimate(piezo1.V_in, piezo1.V_out, win, [], [], 1/Ts);
[co_1, ~] = mscohere(piezo1.V_in, piezo1.V_out, win, [], [], 1/Ts);
[tf_2, f_2] = tfestimate(piezo2.V_in, piezo2.V_out, win, [], [], 1/Ts);
[co_2, ~] = mscohere(piezo2.V_in, piezo2.V_out, win, [], [], 1/Ts);
[tf_3, f_3] = tfestimate(piezo3.V_in, piezo3.V_out, win, [], [], 1/Ts);
[co_3, ~] = mscohere(piezo3.V_in, piezo3.V_out, win, [], [], 1/Ts);
%%
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f_1, abs(tf_1), 'DisplayName', '1 stack')
plot(f_2, abs(tf_2), 'DisplayName', '2 stacks')
plot(f_3, abs(tf_3), 'DisplayName', '3 stacks')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); xlabel('Frequency [Hz]');
hold off;
legend('location', 'southwest');
ylim([0.1, 20]);
ax2 = subplot(2, 1, 2);
hold on;
plot(f_1, 180/pi*unwrap(angle(tf_1)))
plot(f_2, 180/pi*unwrap(angle(tf_2)))
plot(f_3, 180/pi*unwrap(angle(tf_3)))
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
hold off;
ylim([-360, 0]);
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);

44
analysis_capacitance_pi.m Normal file
View File

@ -0,0 +1,44 @@
piezo1 = load('mat/pi_505_high.mat', 't', 'V_in', 'V_out');
piezo2 = load('mat/pi_505_high_2_stacks.mat', 't', 'V_in', 'V_out');
piezo3 = load('mat/pi_505_high_3_stacks.mat', 't', 'V_in', 'V_out');
%%
run setup;
win = hann(ceil(0.1/Ts));
[tf_1, f_1] = tfestimate(piezo1.V_in, piezo1.V_out, win, [], [], 1/Ts);
[co_1, ~] = mscohere(piezo1.V_in, piezo1.V_out, win, [], [], 1/Ts);
[tf_2, f_2] = tfestimate(piezo2.V_in, piezo2.V_out, win, [], [], 1/Ts);
[co_2, ~] = mscohere(piezo2.V_in, piezo2.V_out, win, [], [], 1/Ts);
[tf_3, f_3] = tfestimate(piezo3.V_in, piezo3.V_out, win, [], [], 1/Ts);
[co_3, ~] = mscohere(piezo3.V_in, piezo3.V_out, win, [], [], 1/Ts);
%%
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f_1, abs(tf_1), 'DisplayName', '1 stack')
plot(f_2, abs(tf_2), 'DisplayName', '2 stacks')
plot(f_3, abs(tf_3), 'DisplayName', '3 stacks')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); xlabel('Frequency [Hz]');
hold off;
legend('location', 'southwest');
ylim([0.1, 50]);
ax2 = subplot(2, 1, 2);
hold on;
plot(f_1, 180/pi*unwrap(angle(tf_1)))
plot(f_2, 180/pi*unwrap(angle(tf_2)))
plot(f_3, 180/pi*unwrap(angle(tf_3)))
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
hold off;
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);

43
analysis_level_cedrat.m Normal file
View File

@ -0,0 +1,43 @@
hi = load('mat/cedrat_la75b_high_1_stack.mat', 't', 'V_in', 'V_out');
me = load('mat/cedrat_la75b_med_1_stack.mat', 't', 'V_in', 'V_out');
lo = load('mat/cedrat_la75b_low_1_stack.mat', 't', 'V_in', 'V_out');
%%
run setup;
win = hann(ceil(0.1/Ts));
[tf_hi, f_hi] = tfestimate(hi.V_in, hi.V_out, win, [], [], 1/Ts);
[co_hi, ~] = mscohere(hi.V_in, hi.V_out, win, [], [], 1/Ts);
[tf_me, f_me] = tfestimate(me.V_in, me.V_out, win, [], [], 1/Ts);
[co_me, ~] = mscohere(me.V_in, me.V_out, win, [], [], 1/Ts);
[tf_lo, f_lo] = tfestimate(lo.V_in, lo.V_out, win, [], [], 1/Ts);
[co_lo, ~] = mscohere(lo.V_in, lo.V_out, win, [], [], 1/Ts);
%%
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f_lo, abs(tf_lo), 'DisplayName', 'low')
plot(f_me, abs(tf_me), 'DisplayName', 'med')
plot(f_hi, abs(tf_hi), 'DisplayName', 'high')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); xlabel('Frequency [Hz]');
hold off;
legend('location', 'southwest');
ylim([0.1, 50]);
ax2 = subplot(2, 1, 2);
hold on;
plot(f_lo, 180/pi*unwrap(angle(tf_lo)))
plot(f_me, 180/pi*unwrap(angle(tf_me)))
plot(f_hi, 180/pi*unwrap(angle(tf_hi)))
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
hold off;
ylim([-360, 0]);
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);

37
analysis_level_pi.m Normal file
View File

@ -0,0 +1,37 @@
hi = load('mat/pi_505_high.mat', 't', 'V_in', 'V_out');
lo = load('mat/pi_505_low.mat', 't', 'V_in', 'V_out');
%%
run setup;
win = hann(ceil(0.1/Ts));
[tf_hi, f_hi] = tfestimate(hi.V_in, hi.V_out, win, [], [], 1/Ts);
[co_hi, ~] = mscohere(hi.V_in, hi.V_out, win, [], [], 1/Ts);
[tf_lo, f_lo] = tfestimate(lo.V_in, lo.V_out, win, [], [], 1/Ts);
[co_lo, ~] = mscohere(lo.V_in, lo.V_out, win, [], [], 1/Ts);
%%
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f_hi, abs(tf_hi), 'DisplayName', 'high')
plot(f_lo, abs(tf_lo), 'DisplayName', 'low')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); xlabel('Frequency [Hz]');
hold off;
legend('location', 'southwest');
ylim([0.1, 20]);
ax2 = subplot(2, 1, 2);
hold on;
plot(f_hi, 180/pi*unwrap(angle(tf_hi)))
plot(f_lo, 180/pi*unwrap(angle(tf_lo)))
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
hold off;
ylim([-360, 0]);
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);

34
comp_pi_cedrat.m Normal file
View File

@ -0,0 +1,34 @@
ce_results = load('mat/cedrat_la75b_high_1_stack.mat', 't', 'V_in', 'V_out');
pi_results = load('mat/pi_505_high.mat', 't', 'V_in', 'V_out');
%%
run setup;
win = hann(ceil(0.1/Ts));
[tf_ce, f_ce] = tfestimate(ce_results.V_in, ce_results.V_out, win, [], [], 1/Ts);
[tf_pi, f_pi] = tfestimate(pi_results.V_in, pi_results.V_out, win, [], [], 1/Ts);
%%
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f_pi, abs(tf_pi), 'DisplayName', 'PI')
plot(f_ce, abs(tf_ce), 'DisplayName', 'Cedrat')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); xlabel('Frequency [Hz]');
hold off;
legend('location', 'southwest');
ylim([0.1, 50]);
ax2 = subplot(2, 1, 2);
hold on;
plot(f_pi, 180/pi*unwrap(angle(tf_pi)))
plot(f_ce, 180/pi*unwrap(angle(tf_ce)))
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
hold off;
ylim([-360, 0]);
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);

BIN
data/apa95ml.dat Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
mat/pi_505_high.mat Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
mat/pi_505_low.mat Normal file

Binary file not shown.

BIN
piezoapa.slx Normal file

Binary file not shown.

206
piezoapabio.m Normal file
View File

@ -0,0 +1,206 @@
function bio=piezoapabio
bio = [];
bio(1).blkName='Random Number';
bio(1).sigName='';
bio(1).portIdx=0;
bio(1).dim=[1,1];
bio(1).sigWidth=1;
bio(1).sigAddress='&piezoapa_B.RandomNumber';
bio(1).ndims=2;
bio(1).size=[];
bio(1).isStruct=false;
bio(getlenBIO) = bio(1);
bio(2).blkName='Saturation1';
bio(2).sigName='';
bio(2).portIdx=0;
bio(2).dim=[1,1];
bio(2).sigWidth=1;
bio(2).sigAddress='&piezoapa_B.Saturation1';
bio(2).ndims=2;
bio(2).size=[];
bio(2).isStruct=false;
bio(3).blkName='Analog input /p1';
bio(3).sigName='';
bio(3).portIdx=0;
bio(3).dim=[1,1];
bio(3).sigWidth=1;
bio(3).sigAddress='&piezoapa_B.Analoginput_o1';
bio(3).ndims=2;
bio(3).size=[];
bio(3).isStruct=false;
bio(4).blkName='Analog input /p2';
bio(4).sigName='';
bio(4).portIdx=1;
bio(4).dim=[1,1];
bio(4).sigWidth=1;
bio(4).sigAddress='&piezoapa_B.Analoginput_o2';
bio(4).ndims=2;
bio(4).size=[];
bio(4).isStruct=false;
bio(5).blkName='Analog input /p3';
bio(5).sigName='';
bio(5).portIdx=2;
bio(5).dim=[1,1];
bio(5).sigWidth=1;
bio(5).sigAddress='&piezoapa_B.Analoginput_o3';
bio(5).ndims=2;
bio(5).size=[];
bio(5).isStruct=false;
bio(6).blkName='Analog input /p4';
bio(6).sigName='';
bio(6).portIdx=3;
bio(6).dim=[1,1];
bio(6).sigWidth=1;
bio(6).sigAddress='&piezoapa_B.Analoginput_o4';
bio(6).ndims=2;
bio(6).size=[];
bio(6).isStruct=false;
bio(7).blkName='Analog input /p5';
bio(7).sigName='';
bio(7).portIdx=4;
bio(7).dim=[1,1];
bio(7).sigWidth=1;
bio(7).sigAddress='&piezoapa_B.Analoginput_o5';
bio(7).ndims=2;
bio(7).size=[];
bio(7).isStruct=false;
bio(8).blkName='Analog input /p6';
bio(8).sigName='';
bio(8).portIdx=5;
bio(8).dim=[1,1];
bio(8).sigWidth=1;
bio(8).sigAddress='&piezoapa_B.Analoginput_o6';
bio(8).ndims=2;
bio(8).size=[];
bio(8).isStruct=false;
bio(9).blkName='Analog input /p7';
bio(9).sigName='';
bio(9).portIdx=6;
bio(9).dim=[1,1];
bio(9).sigWidth=1;
bio(9).sigAddress='&piezoapa_B.Analoginput_o7';
bio(9).ndims=2;
bio(9).size=[];
bio(9).isStruct=false;
bio(10).blkName='Analog input /p8';
bio(10).sigName='';
bio(10).portIdx=7;
bio(10).dim=[1,1];
bio(10).sigWidth=1;
bio(10).sigAddress='&piezoapa_B.Analoginput_o8';
bio(10).ndims=2;
bio(10).size=[];
bio(10).isStruct=false;
bio(11).blkName='Analog input /p9';
bio(11).sigName='';
bio(11).portIdx=8;
bio(11).dim=[1,1];
bio(11).sigWidth=1;
bio(11).sigAddress='&piezoapa_B.Analoginput_o9';
bio(11).ndims=2;
bio(11).size=[];
bio(11).isStruct=false;
bio(12).blkName='Analog input /p10';
bio(12).sigName='';
bio(12).portIdx=9;
bio(12).dim=[1,1];
bio(12).sigWidth=1;
bio(12).sigAddress='&piezoapa_B.Analoginput_o10';
bio(12).ndims=2;
bio(12).size=[];
bio(12).isStruct=false;
bio(13).blkName='Analog input /p11';
bio(13).sigName='';
bio(13).portIdx=10;
bio(13).dim=[1,1];
bio(13).sigWidth=1;
bio(13).sigAddress='&piezoapa_B.Analoginput_o11';
bio(13).ndims=2;
bio(13).size=[];
bio(13).isStruct=false;
bio(14).blkName='Analog input /p12';
bio(14).sigName='';
bio(14).portIdx=11;
bio(14).dim=[1,1];
bio(14).sigWidth=1;
bio(14).sigAddress='&piezoapa_B.Analoginput_o12';
bio(14).ndims=2;
bio(14).size=[];
bio(14).isStruct=false;
bio(15).blkName='Analog input /p13';
bio(15).sigName='';
bio(15).portIdx=12;
bio(15).dim=[1,1];
bio(15).sigWidth=1;
bio(15).sigAddress='&piezoapa_B.Analoginput_o13';
bio(15).ndims=2;
bio(15).size=[];
bio(15).isStruct=false;
bio(16).blkName='Analog input /p14';
bio(16).sigName='';
bio(16).portIdx=13;
bio(16).dim=[1,1];
bio(16).sigWidth=1;
bio(16).sigAddress='&piezoapa_B.Analoginput_o14';
bio(16).ndims=2;
bio(16).size=[];
bio(16).isStruct=false;
bio(17).blkName='Analog input /p15';
bio(17).sigName='';
bio(17).portIdx=14;
bio(17).dim=[1,1];
bio(17).sigWidth=1;
bio(17).sigAddress='&piezoapa_B.Analoginput_o15';
bio(17).ndims=2;
bio(17).size=[];
bio(17).isStruct=false;
bio(18).blkName='Analog input /p16';
bio(18).sigName='';
bio(18).portIdx=15;
bio(18).dim=[1,1];
bio(18).sigWidth=1;
bio(18).sigAddress='&piezoapa_B.Analoginput_o16';
bio(18).ndims=2;
bio(18).size=[];
bio(18).isStruct=false;
bio(19).blkName='Manual Switch';
bio(19).sigName='';
bio(19).portIdx=0;
bio(19).dim=[1,1];
bio(19).sigWidth=1;
bio(19).sigAddress='&piezoapa_B.ManualSwitch';
bio(19).ndims=2;
bio(19).size=[];
bio(19).isStruct=false;
bio(20).blkName='Discrete Transfer Fcn';
bio(20).sigName='';
bio(20).portIdx=0;
bio(20).dim=[1,1];
bio(20).sigWidth=1;
bio(20).sigAddress='&piezoapa_B.DiscreteTransferFcn';
bio(20).ndims=2;
bio(20).size=[];
bio(20).isStruct=false;
function len = getlenBIO
len = 20;

902
piezoapapt.m Normal file
View File

@ -0,0 +1,902 @@
function pt=piezoapapt
pt = [];
pt(1).blockname = 'Constant6';
pt(1).paramname = 'Value';
pt(1).class = 'scalar';
pt(1).nrows = 1;
pt(1).ncols = 1;
pt(1).subsource = 'SS_DOUBLE';
pt(1).ndims = '2';
pt(1).size = '[]';
pt(1).isStruct = false;
pt(1).symbol = 'piezoapa_P.Constant6_Value';
pt(1).baseaddr = '&piezoapa_P.Constant6_Value';
pt(1).dtname = 'real_T';
pt(getlenPT) = pt(1);
pt(2).blockname = 'Random Number';
pt(2).paramname = 'Mean';
pt(2).class = 'scalar';
pt(2).nrows = 1;
pt(2).ncols = 1;
pt(2).subsource = 'SS_DOUBLE';
pt(2).ndims = '2';
pt(2).size = '[]';
pt(2).isStruct = false;
pt(2).symbol = 'piezoapa_P.RandomNumber_Mean';
pt(2).baseaddr = '&piezoapa_P.RandomNumber_Mean';
pt(2).dtname = 'real_T';
pt(3).blockname = 'Random Number';
pt(3).paramname = 'StdDev';
pt(3).class = 'scalar';
pt(3).nrows = 1;
pt(3).ncols = 1;
pt(3).subsource = 'SS_DOUBLE';
pt(3).ndims = '2';
pt(3).size = '[]';
pt(3).isStruct = false;
pt(3).symbol = 'piezoapa_P.RandomNumber_StdDev';
pt(3).baseaddr = '&piezoapa_P.RandomNumber_StdDev';
pt(3).dtname = 'real_T';
pt(4).blockname = 'Random Number';
pt(4).paramname = 'Seed';
pt(4).class = 'scalar';
pt(4).nrows = 1;
pt(4).ncols = 1;
pt(4).subsource = 'SS_DOUBLE';
pt(4).ndims = '2';
pt(4).size = '[]';
pt(4).isStruct = false;
pt(4).symbol = 'piezoapa_P.RandomNumber_Seed';
pt(4).baseaddr = '&piezoapa_P.RandomNumber_Seed';
pt(4).dtname = 'real_T';
pt(5).blockname = 'Saturation1';
pt(5).paramname = 'UpperLimit';
pt(5).class = 'scalar';
pt(5).nrows = 1;
pt(5).ncols = 1;
pt(5).subsource = 'SS_DOUBLE';
pt(5).ndims = '2';
pt(5).size = '[]';
pt(5).isStruct = false;
pt(5).symbol = 'piezoapa_P.Saturation1_UpperSat';
pt(5).baseaddr = '&piezoapa_P.Saturation1_UpperSat';
pt(5).dtname = 'real_T';
pt(6).blockname = 'Saturation1';
pt(6).paramname = 'LowerLimit';
pt(6).class = 'scalar';
pt(6).nrows = 1;
pt(6).ncols = 1;
pt(6).subsource = 'SS_DOUBLE';
pt(6).ndims = '2';
pt(6).size = '[]';
pt(6).isStruct = false;
pt(6).symbol = 'piezoapa_P.Saturation1_LowerSat';
pt(6).baseaddr = '&piezoapa_P.Saturation1_LowerSat';
pt(6).dtname = 'real_T';
pt(7).blockname = 'Analog input ';
pt(7).paramname = 'P1';
pt(7).class = 'scalar';
pt(7).nrows = 1;
pt(7).ncols = 1;
pt(7).subsource = 'SS_DOUBLE';
pt(7).ndims = '2';
pt(7).size = '[]';
pt(7).isStruct = false;
pt(7).symbol = 'piezoapa_P.Analoginput_P1';
pt(7).baseaddr = '&piezoapa_P.Analoginput_P1';
pt(7).dtname = 'real_T';
pt(8).blockname = 'Analog input ';
pt(8).paramname = 'P2';
pt(8).class = 'scalar';
pt(8).nrows = 1;
pt(8).ncols = 1;
pt(8).subsource = 'SS_DOUBLE';
pt(8).ndims = '2';
pt(8).size = '[]';
pt(8).isStruct = false;
pt(8).symbol = 'piezoapa_P.Analoginput_P2';
pt(8).baseaddr = '&piezoapa_P.Analoginput_P2';
pt(8).dtname = 'real_T';
pt(9).blockname = 'Analog input ';
pt(9).paramname = 'P3';
pt(9).class = 'scalar';
pt(9).nrows = 1;
pt(9).ncols = 1;
pt(9).subsource = 'SS_DOUBLE';
pt(9).ndims = '2';
pt(9).size = '[]';
pt(9).isStruct = false;
pt(9).symbol = 'piezoapa_P.Analoginput_P3';
pt(9).baseaddr = '&piezoapa_P.Analoginput_P3';
pt(9).dtname = 'real_T';
pt(10).blockname = 'Analog input ';
pt(10).paramname = 'P4';
pt(10).class = 'scalar';
pt(10).nrows = 1;
pt(10).ncols = 1;
pt(10).subsource = 'SS_DOUBLE';
pt(10).ndims = '2';
pt(10).size = '[]';
pt(10).isStruct = false;
pt(10).symbol = 'piezoapa_P.Analoginput_P4';
pt(10).baseaddr = '&piezoapa_P.Analoginput_P4';
pt(10).dtname = 'real_T';
pt(11).blockname = 'Analog input ';
pt(11).paramname = 'P5';
pt(11).class = 'scalar';
pt(11).nrows = 1;
pt(11).ncols = 1;
pt(11).subsource = 'SS_DOUBLE';
pt(11).ndims = '2';
pt(11).size = '[]';
pt(11).isStruct = false;
pt(11).symbol = 'piezoapa_P.Analoginput_P5';
pt(11).baseaddr = '&piezoapa_P.Analoginput_P5';
pt(11).dtname = 'real_T';
pt(12).blockname = 'Analog input ';
pt(12).paramname = 'P6';
pt(12).class = 'scalar';
pt(12).nrows = 1;
pt(12).ncols = 1;
pt(12).subsource = 'SS_DOUBLE';
pt(12).ndims = '2';
pt(12).size = '[]';
pt(12).isStruct = false;
pt(12).symbol = 'piezoapa_P.Analoginput_P6';
pt(12).baseaddr = '&piezoapa_P.Analoginput_P6';
pt(12).dtname = 'real_T';
pt(13).blockname = 'Analog input ';
pt(13).paramname = 'P7';
pt(13).class = 'vector';
pt(13).nrows = 1;
pt(13).ncols = 16;
pt(13).subsource = 'SS_DOUBLE';
pt(13).ndims = '2';
pt(13).size = '[]';
pt(13).isStruct = false;
pt(13).symbol = 'piezoapa_P.Analoginput_P7';
pt(13).baseaddr = '&piezoapa_P.Analoginput_P7[0]';
pt(13).dtname = 'real_T';
pt(14).blockname = 'Analog input ';
pt(14).paramname = 'P8';
pt(14).class = 'scalar';
pt(14).nrows = 1;
pt(14).ncols = 1;
pt(14).subsource = 'SS_DOUBLE';
pt(14).ndims = '2';
pt(14).size = '[]';
pt(14).isStruct = false;
pt(14).symbol = 'piezoapa_P.Analoginput_P8';
pt(14).baseaddr = '&piezoapa_P.Analoginput_P8';
pt(14).dtname = 'real_T';
pt(15).blockname = 'Analog input ';
pt(15).paramname = 'P9';
pt(15).class = 'scalar';
pt(15).nrows = 1;
pt(15).ncols = 1;
pt(15).subsource = 'SS_DOUBLE';
pt(15).ndims = '2';
pt(15).size = '[]';
pt(15).isStruct = false;
pt(15).symbol = 'piezoapa_P.Analoginput_P9';
pt(15).baseaddr = '&piezoapa_P.Analoginput_P9';
pt(15).dtname = 'real_T';
pt(16).blockname = 'Analog input ';
pt(16).paramname = 'P10';
pt(16).class = 'scalar';
pt(16).nrows = 1;
pt(16).ncols = 1;
pt(16).subsource = 'SS_DOUBLE';
pt(16).ndims = '2';
pt(16).size = '[]';
pt(16).isStruct = false;
pt(16).symbol = 'piezoapa_P.Analoginput_P10';
pt(16).baseaddr = '&piezoapa_P.Analoginput_P10';
pt(16).dtname = 'real_T';
pt(17).blockname = 'Analog input ';
pt(17).paramname = 'P11';
pt(17).class = 'scalar';
pt(17).nrows = 1;
pt(17).ncols = 1;
pt(17).subsource = 'SS_DOUBLE';
pt(17).ndims = '2';
pt(17).size = '[]';
pt(17).isStruct = false;
pt(17).symbol = 'piezoapa_P.Analoginput_P11';
pt(17).baseaddr = '&piezoapa_P.Analoginput_P11';
pt(17).dtname = 'real_T';
pt(18).blockname = 'Analog input ';
pt(18).paramname = 'P12';
pt(18).class = 'scalar';
pt(18).nrows = 1;
pt(18).ncols = 1;
pt(18).subsource = 'SS_DOUBLE';
pt(18).ndims = '2';
pt(18).size = '[]';
pt(18).isStruct = false;
pt(18).symbol = 'piezoapa_P.Analoginput_P12';
pt(18).baseaddr = '&piezoapa_P.Analoginput_P12';
pt(18).dtname = 'real_T';
pt(19).blockname = 'Analog output ';
pt(19).paramname = 'P1';
pt(19).class = 'scalar';
pt(19).nrows = 1;
pt(19).ncols = 1;
pt(19).subsource = 'SS_DOUBLE';
pt(19).ndims = '2';
pt(19).size = '[]';
pt(19).isStruct = false;
pt(19).symbol = 'piezoapa_P.Analogoutput_P1';
pt(19).baseaddr = '&piezoapa_P.Analogoutput_P1';
pt(19).dtname = 'real_T';
pt(20).blockname = 'Analog output ';
pt(20).paramname = 'P2';
pt(20).class = 'scalar';
pt(20).nrows = 1;
pt(20).ncols = 1;
pt(20).subsource = 'SS_DOUBLE';
pt(20).ndims = '2';
pt(20).size = '[]';
pt(20).isStruct = false;
pt(20).symbol = 'piezoapa_P.Analogoutput_P2';
pt(20).baseaddr = '&piezoapa_P.Analogoutput_P2';
pt(20).dtname = 'real_T';
pt(21).blockname = 'Analog output ';
pt(21).paramname = 'P3';
pt(21).class = 'scalar';
pt(21).nrows = 1;
pt(21).ncols = 1;
pt(21).subsource = 'SS_DOUBLE';
pt(21).ndims = '2';
pt(21).size = '[]';
pt(21).isStruct = false;
pt(21).symbol = 'piezoapa_P.Analogoutput_P3';
pt(21).baseaddr = '&piezoapa_P.Analogoutput_P3';
pt(21).dtname = 'real_T';
pt(22).blockname = 'Analog output ';
pt(22).paramname = 'P4';
pt(22).class = 'scalar';
pt(22).nrows = 1;
pt(22).ncols = 1;
pt(22).subsource = 'SS_DOUBLE';
pt(22).ndims = '2';
pt(22).size = '[]';
pt(22).isStruct = false;
pt(22).symbol = 'piezoapa_P.Analogoutput_P4';
pt(22).baseaddr = '&piezoapa_P.Analogoutput_P4';
pt(22).dtname = 'real_T';
pt(23).blockname = 'Analog output ';
pt(23).paramname = 'P5';
pt(23).class = 'scalar';
pt(23).nrows = 1;
pt(23).ncols = 1;
pt(23).subsource = 'SS_DOUBLE';
pt(23).ndims = '2';
pt(23).size = '[]';
pt(23).isStruct = false;
pt(23).symbol = 'piezoapa_P.Analogoutput_P5';
pt(23).baseaddr = '&piezoapa_P.Analogoutput_P5';
pt(23).dtname = 'real_T';
pt(24).blockname = 'Analog output ';
pt(24).paramname = 'P6';
pt(24).class = 'vector';
pt(24).nrows = 1;
pt(24).ncols = 8;
pt(24).subsource = 'SS_DOUBLE';
pt(24).ndims = '2';
pt(24).size = '[]';
pt(24).isStruct = false;
pt(24).symbol = 'piezoapa_P.Analogoutput_P6';
pt(24).baseaddr = '&piezoapa_P.Analogoutput_P6[0]';
pt(24).dtname = 'real_T';
pt(25).blockname = 'Analog output ';
pt(25).paramname = 'P7';
pt(25).class = 'vector';
pt(25).nrows = 1;
pt(25).ncols = 8;
pt(25).subsource = 'SS_DOUBLE';
pt(25).ndims = '2';
pt(25).size = '[]';
pt(25).isStruct = false;
pt(25).symbol = 'piezoapa_P.Analogoutput_P7';
pt(25).baseaddr = '&piezoapa_P.Analogoutput_P7[0]';
pt(25).dtname = 'real_T';
pt(26).blockname = 'Analog output ';
pt(26).paramname = 'P8';
pt(26).class = 'vector';
pt(26).nrows = 1;
pt(26).ncols = 8;
pt(26).subsource = 'SS_DOUBLE';
pt(26).ndims = '2';
pt(26).size = '[]';
pt(26).isStruct = false;
pt(26).symbol = 'piezoapa_P.Analogoutput_P8';
pt(26).baseaddr = '&piezoapa_P.Analogoutput_P8[0]';
pt(26).dtname = 'real_T';
pt(27).blockname = 'Analog output ';
pt(27).paramname = 'P9';
pt(27).class = 'scalar';
pt(27).nrows = 1;
pt(27).ncols = 1;
pt(27).subsource = 'SS_DOUBLE';
pt(27).ndims = '2';
pt(27).size = '[]';
pt(27).isStruct = false;
pt(27).symbol = 'piezoapa_P.Analogoutput_P9';
pt(27).baseaddr = '&piezoapa_P.Analogoutput_P9';
pt(27).dtname = 'real_T';
pt(28).blockname = 'Analog output ';
pt(28).paramname = 'P10';
pt(28).class = 'scalar';
pt(28).nrows = 1;
pt(28).ncols = 1;
pt(28).subsource = 'SS_DOUBLE';
pt(28).ndims = '2';
pt(28).size = '[]';
pt(28).isStruct = false;
pt(28).symbol = 'piezoapa_P.Analogoutput_P10';
pt(28).baseaddr = '&piezoapa_P.Analogoutput_P10';
pt(28).dtname = 'real_T';
pt(29).blockname = 'Analog output ';
pt(29).paramname = 'P11';
pt(29).class = 'scalar';
pt(29).nrows = 1;
pt(29).ncols = 1;
pt(29).subsource = 'SS_DOUBLE';
pt(29).ndims = '2';
pt(29).size = '[]';
pt(29).isStruct = false;
pt(29).symbol = 'piezoapa_P.Analogoutput_P11';
pt(29).baseaddr = '&piezoapa_P.Analogoutput_P11';
pt(29).dtname = 'real_T';
pt(30).blockname = 'Analog output ';
pt(30).paramname = 'P12';
pt(30).class = 'scalar';
pt(30).nrows = 1;
pt(30).ncols = 1;
pt(30).subsource = 'SS_DOUBLE';
pt(30).ndims = '2';
pt(30).size = '[]';
pt(30).isStruct = false;
pt(30).symbol = 'piezoapa_P.Analogoutput_P12';
pt(30).baseaddr = '&piezoapa_P.Analogoutput_P12';
pt(30).dtname = 'real_T';
pt(31).blockname = 'Analog output ';
pt(31).paramname = 'P13';
pt(31).class = 'scalar';
pt(31).nrows = 1;
pt(31).ncols = 1;
pt(31).subsource = 'SS_DOUBLE';
pt(31).ndims = '2';
pt(31).size = '[]';
pt(31).isStruct = false;
pt(31).symbol = 'piezoapa_P.Analogoutput_P13';
pt(31).baseaddr = '&piezoapa_P.Analogoutput_P13';
pt(31).dtname = 'real_T';
pt(32).blockname = 'Analog output ';
pt(32).paramname = 'P14';
pt(32).class = 'scalar';
pt(32).nrows = 1;
pt(32).ncols = 1;
pt(32).subsource = 'SS_DOUBLE';
pt(32).ndims = '2';
pt(32).size = '[]';
pt(32).isStruct = false;
pt(32).symbol = 'piezoapa_P.Analogoutput_P14';
pt(32).baseaddr = '&piezoapa_P.Analogoutput_P14';
pt(32).dtname = 'real_T';
pt(33).blockname = 'Analog output ';
pt(33).paramname = 'P15';
pt(33).class = 'scalar';
pt(33).nrows = 1;
pt(33).ncols = 1;
pt(33).subsource = 'SS_DOUBLE';
pt(33).ndims = '2';
pt(33).size = '[]';
pt(33).isStruct = false;
pt(33).symbol = 'piezoapa_P.Analogoutput_P15';
pt(33).baseaddr = '&piezoapa_P.Analogoutput_P15';
pt(33).dtname = 'real_T';
pt(34).blockname = 'Setup';
pt(34).paramname = 'P1';
pt(34).class = 'scalar';
pt(34).nrows = 1;
pt(34).ncols = 1;
pt(34).subsource = 'SS_DOUBLE';
pt(34).ndims = '2';
pt(34).size = '[]';
pt(34).isStruct = false;
pt(34).symbol = 'piezoapa_P.Setup_P1';
pt(34).baseaddr = '&piezoapa_P.Setup_P1';
pt(34).dtname = 'real_T';
pt(35).blockname = 'Setup';
pt(35).paramname = 'P2';
pt(35).class = 'scalar';
pt(35).nrows = 1;
pt(35).ncols = 1;
pt(35).subsource = 'SS_DOUBLE';
pt(35).ndims = '2';
pt(35).size = '[]';
pt(35).isStruct = false;
pt(35).symbol = 'piezoapa_P.Setup_P2';
pt(35).baseaddr = '&piezoapa_P.Setup_P2';
pt(35).dtname = 'real_T';
pt(36).blockname = 'Setup';
pt(36).paramname = 'P3';
pt(36).class = 'scalar';
pt(36).nrows = 1;
pt(36).ncols = 1;
pt(36).subsource = 'SS_DOUBLE';
pt(36).ndims = '2';
pt(36).size = '[]';
pt(36).isStruct = false;
pt(36).symbol = 'piezoapa_P.Setup_P3';
pt(36).baseaddr = '&piezoapa_P.Setup_P3';
pt(36).dtname = 'real_T';
pt(37).blockname = 'Setup';
pt(37).paramname = 'P4';
pt(37).class = 'vector';
pt(37).nrows = 3318808;
pt(37).ncols = 1;
pt(37).subsource = 'SS_DOUBLE';
pt(37).ndims = '2';
pt(37).size = '[]';
pt(37).isStruct = false;
pt(37).symbol = 'piezoapa_P.Setup_P4';
pt(37).baseaddr = '&piezoapa_P.Setup_P4[0]';
pt(37).dtname = 'real_T';
pt(38).blockname = 'Setup';
pt(38).paramname = 'P5';
pt(38).class = 'vector';
pt(38).nrows = 1;
pt(38).ncols = 2;
pt(38).subsource = 'SS_DOUBLE';
pt(38).ndims = '2';
pt(38).size = '[]';
pt(38).isStruct = false;
pt(38).symbol = 'piezoapa_P.Setup_P5';
pt(38).baseaddr = '&piezoapa_P.Setup_P5[0]';
pt(38).dtname = 'real_T';
pt(39).blockname = 'Setup';
pt(39).paramname = 'P6';
pt(39).class = 'scalar';
pt(39).nrows = 1;
pt(39).ncols = 1;
pt(39).subsource = 'SS_DOUBLE';
pt(39).ndims = '2';
pt(39).size = '[]';
pt(39).isStruct = false;
pt(39).symbol = 'piezoapa_P.Setup_P6';
pt(39).baseaddr = '&piezoapa_P.Setup_P6';
pt(39).dtname = 'real_T';
pt(40).blockname = 'Setup';
pt(40).paramname = 'P7';
pt(40).class = 'scalar';
pt(40).nrows = 1;
pt(40).ncols = 1;
pt(40).subsource = 'SS_DOUBLE';
pt(40).ndims = '2';
pt(40).size = '[]';
pt(40).isStruct = false;
pt(40).symbol = 'piezoapa_P.Setup_P7';
pt(40).baseaddr = '&piezoapa_P.Setup_P7';
pt(40).dtname = 'real_T';
pt(41).blockname = 'Setup';
pt(41).paramname = 'P8';
pt(41).class = 'scalar';
pt(41).nrows = 1;
pt(41).ncols = 1;
pt(41).subsource = 'SS_DOUBLE';
pt(41).ndims = '2';
pt(41).size = '[]';
pt(41).isStruct = false;
pt(41).symbol = 'piezoapa_P.Setup_P8';
pt(41).baseaddr = '&piezoapa_P.Setup_P8';
pt(41).dtname = 'real_T';
pt(42).blockname = 'Setup';
pt(42).paramname = 'P9';
pt(42).class = 'scalar';
pt(42).nrows = 1;
pt(42).ncols = 1;
pt(42).subsource = 'SS_DOUBLE';
pt(42).ndims = '2';
pt(42).size = '[]';
pt(42).isStruct = false;
pt(42).symbol = 'piezoapa_P.Setup_P9';
pt(42).baseaddr = '&piezoapa_P.Setup_P9';
pt(42).dtname = 'real_T';
pt(43).blockname = 'Setup';
pt(43).paramname = 'P10';
pt(43).class = 'scalar';
pt(43).nrows = 1;
pt(43).ncols = 1;
pt(43).subsource = 'SS_DOUBLE';
pt(43).ndims = '2';
pt(43).size = '[]';
pt(43).isStruct = false;
pt(43).symbol = 'piezoapa_P.Setup_P10';
pt(43).baseaddr = '&piezoapa_P.Setup_P10';
pt(43).dtname = 'real_T';
pt(44).blockname = 'Setup';
pt(44).paramname = 'P11';
pt(44).class = 'scalar';
pt(44).nrows = 1;
pt(44).ncols = 1;
pt(44).subsource = 'SS_DOUBLE';
pt(44).ndims = '2';
pt(44).size = '[]';
pt(44).isStruct = false;
pt(44).symbol = 'piezoapa_P.Setup_P11';
pt(44).baseaddr = '&piezoapa_P.Setup_P11';
pt(44).dtname = 'real_T';
pt(45).blockname = 'Setup';
pt(45).paramname = 'P12';
pt(45).class = 'scalar';
pt(45).nrows = 1;
pt(45).ncols = 1;
pt(45).subsource = 'SS_DOUBLE';
pt(45).ndims = '2';
pt(45).size = '[]';
pt(45).isStruct = false;
pt(45).symbol = 'piezoapa_P.Setup_P12';
pt(45).baseaddr = '&piezoapa_P.Setup_P12';
pt(45).dtname = 'real_T';
pt(46).blockname = 'Setup';
pt(46).paramname = 'P13';
pt(46).class = 'scalar';
pt(46).nrows = 1;
pt(46).ncols = 1;
pt(46).subsource = 'SS_DOUBLE';
pt(46).ndims = '2';
pt(46).size = '[]';
pt(46).isStruct = false;
pt(46).symbol = 'piezoapa_P.Setup_P13';
pt(46).baseaddr = '&piezoapa_P.Setup_P13';
pt(46).dtname = 'real_T';
pt(47).blockname = 'Setup ';
pt(47).paramname = 'P1';
pt(47).class = 'scalar';
pt(47).nrows = 1;
pt(47).ncols = 1;
pt(47).subsource = 'SS_DOUBLE';
pt(47).ndims = '2';
pt(47).size = '[]';
pt(47).isStruct = false;
pt(47).symbol = 'piezoapa_P.Setup_P1_p';
pt(47).baseaddr = '&piezoapa_P.Setup_P1_p';
pt(47).dtname = 'real_T';
pt(48).blockname = 'Setup ';
pt(48).paramname = 'P2';
pt(48).class = 'scalar';
pt(48).nrows = 1;
pt(48).ncols = 1;
pt(48).subsource = 'SS_DOUBLE';
pt(48).ndims = '2';
pt(48).size = '[]';
pt(48).isStruct = false;
pt(48).symbol = 'piezoapa_P.Setup_P2_h';
pt(48).baseaddr = '&piezoapa_P.Setup_P2_h';
pt(48).dtname = 'real_T';
pt(49).blockname = 'Setup ';
pt(49).paramname = 'P3';
pt(49).class = 'scalar';
pt(49).nrows = 1;
pt(49).ncols = 1;
pt(49).subsource = 'SS_DOUBLE';
pt(49).ndims = '2';
pt(49).size = '[]';
pt(49).isStruct = false;
pt(49).symbol = 'piezoapa_P.Setup_P3_f';
pt(49).baseaddr = '&piezoapa_P.Setup_P3_f';
pt(49).dtname = 'real_T';
pt(50).blockname = 'Setup ';
pt(50).paramname = 'P4';
pt(50).class = 'scalar';
pt(50).nrows = 1;
pt(50).ncols = 1;
pt(50).subsource = 'SS_DOUBLE';
pt(50).ndims = '2';
pt(50).size = '[]';
pt(50).isStruct = false;
pt(50).symbol = 'piezoapa_P.Setup_P4_i';
pt(50).baseaddr = '&piezoapa_P.Setup_P4_i';
pt(50).dtname = 'real_T';
pt(51).blockname = 'Setup ';
pt(51).paramname = 'P5';
pt(51).class = 'scalar';
pt(51).nrows = 1;
pt(51).ncols = 1;
pt(51).subsource = 'SS_DOUBLE';
pt(51).ndims = '2';
pt(51).size = '[]';
pt(51).isStruct = false;
pt(51).symbol = 'piezoapa_P.Setup_P5_p';
pt(51).baseaddr = '&piezoapa_P.Setup_P5_p';
pt(51).dtname = 'real_T';
pt(52).blockname = 'Setup ';
pt(52).paramname = 'P6';
pt(52).class = 'scalar';
pt(52).nrows = 1;
pt(52).ncols = 1;
pt(52).subsource = 'SS_DOUBLE';
pt(52).ndims = '2';
pt(52).size = '[]';
pt(52).isStruct = false;
pt(52).symbol = 'piezoapa_P.Setup_P6_o';
pt(52).baseaddr = '&piezoapa_P.Setup_P6_o';
pt(52).dtname = 'real_T';
pt(53).blockname = 'Manual Switch';
pt(53).paramname = 'CurrentSetting';
pt(53).class = 'scalar';
pt(53).nrows = 1;
pt(53).ncols = 1;
pt(53).subsource = 'SS_UINT8';
pt(53).ndims = '2';
pt(53).size = '[]';
pt(53).isStruct = false;
pt(53).symbol = 'piezoapa_P.ManualSwitch_CurrentSetting';
pt(53).baseaddr = '&piezoapa_P.ManualSwitch_CurrentSetting';
pt(53).dtname = 'uint8_T';
pt(54).blockname = 'Discrete Transfer Fcn';
pt(54).paramname = 'Numerator';
pt(54).class = 'vector';
pt(54).nrows = 1;
pt(54).ncols = 2;
pt(54).subsource = 'SS_DOUBLE';
pt(54).ndims = '2';
pt(54).size = '[]';
pt(54).isStruct = false;
pt(54).symbol = 'piezoapa_P.DiscreteTransferFcn_NumCoef';
pt(54).baseaddr = '&piezoapa_P.DiscreteTransferFcn_NumCoef[0]';
pt(54).dtname = 'real_T';
pt(55).blockname = 'Discrete Transfer Fcn';
pt(55).paramname = 'Denominator';
pt(55).class = 'vector';
pt(55).nrows = 1;
pt(55).ncols = 2;
pt(55).subsource = 'SS_DOUBLE';
pt(55).ndims = '2';
pt(55).size = '[]';
pt(55).isStruct = false;
pt(55).symbol = 'piezoapa_P.DiscreteTransferFcn_DenCoef';
pt(55).baseaddr = '&piezoapa_P.DiscreteTransferFcn_DenCoef[0]';
pt(55).dtname = 'real_T';
pt(56).blockname = 'Discrete Transfer Fcn';
pt(56).paramname = 'InitialStates';
pt(56).class = 'scalar';
pt(56).nrows = 1;
pt(56).ncols = 1;
pt(56).subsource = 'SS_DOUBLE';
pt(56).ndims = '2';
pt(56).size = '[]';
pt(56).isStruct = false;
pt(56).symbol = 'piezoapa_P.DiscreteTransferFcn_InitialStat';
pt(56).baseaddr = '&piezoapa_P.DiscreteTransferFcn_InitialStat';
pt(56).dtname = 'real_T';
function len = getlenPT
len = 56;

11
piezoaparef.m Normal file
View File

@ -0,0 +1,11 @@
function sys=piezoaparef
sys = [];
sys.child = [];
sys.NumDataTypes = 2;
sys.DataTypes = [];
temp.EnumNames='';
temp.EnumValues = [];
temp.Name = '';
sys.DataTypes = repmat(temp,1,2);
sys.DataTypes(1).Name = 'real_T';
sys.DataTypes(2).Name = 'uint8_T';

4
piezoapari.m Normal file
View File

@ -0,0 +1,4 @@
function ri = piezoapari
ri = [];

347
piezoapaxcp.m Normal file
View File

@ -0,0 +1,347 @@
function xcp = piezoapaxcp
xcp.events = repmat(struct('id',{}, 'sampletime', {}, 'offset', {}), getNumEvents, 1 );
xcp.parameters = repmat(struct('symbol',{}, 'size', {}, 'dtname', {}, 'baseaddr', {}), getNumParameters, 1 );
xcp.signals = repmat(struct('symbol',{}), getNumSignals, 1 );
xcp.models = cell(1,getNumModels);
xcp.models{1} = 'piezoapa';
xcp.events(1).id = 0;
xcp.events(1).sampletime = 0.0001;
xcp.events(1).offset = 0.0;
xcp.signals(1).symbol = 'piezoapa_B.RandomNumber';
xcp.signals(2).symbol = 'piezoapa_B.Saturation1';
xcp.signals(3).symbol = 'piezoapa_B.Analoginput_o1';
xcp.signals(4).symbol = 'piezoapa_B.Analoginput_o2';
xcp.signals(5).symbol = 'piezoapa_B.Analoginput_o3';
xcp.signals(6).symbol = 'piezoapa_B.Analoginput_o4';
xcp.signals(7).symbol = 'piezoapa_B.Analoginput_o5';
xcp.signals(8).symbol = 'piezoapa_B.Analoginput_o6';
xcp.signals(9).symbol = 'piezoapa_B.Analoginput_o7';
xcp.signals(10).symbol = 'piezoapa_B.Analoginput_o8';
xcp.signals(11).symbol = 'piezoapa_B.Analoginput_o9';
xcp.signals(12).symbol = 'piezoapa_B.Analoginput_o10';
xcp.signals(13).symbol = 'piezoapa_B.Analoginput_o11';
xcp.signals(14).symbol = 'piezoapa_B.Analoginput_o12';
xcp.signals(15).symbol = 'piezoapa_B.Analoginput_o13';
xcp.signals(16).symbol = 'piezoapa_B.Analoginput_o14';
xcp.signals(17).symbol = 'piezoapa_B.Analoginput_o15';
xcp.signals(18).symbol = 'piezoapa_B.Analoginput_o16';
xcp.signals(19).symbol = 'piezoapa_B.ManualSwitch';
xcp.signals(20).symbol = 'piezoapa_B.DiscreteTransferFcn';
xcp.parameters(1).symbol = 'piezoapa_P.Constant6_Value';
xcp.parameters(1).size = 1;
xcp.parameters(1).dtname = 'real_T';
xcp.parameters(2).baseaddr = '&piezoapa_P.Constant6_Value';
xcp.parameters(2).symbol = 'piezoapa_P.RandomNumber_Mean';
xcp.parameters(2).size = 1;
xcp.parameters(2).dtname = 'real_T';
xcp.parameters(3).baseaddr = '&piezoapa_P.RandomNumber_Mean';
xcp.parameters(3).symbol = 'piezoapa_P.RandomNumber_StdDev';
xcp.parameters(3).size = 1;
xcp.parameters(3).dtname = 'real_T';
xcp.parameters(4).baseaddr = '&piezoapa_P.RandomNumber_StdDev';
xcp.parameters(4).symbol = 'piezoapa_P.RandomNumber_Seed';
xcp.parameters(4).size = 1;
xcp.parameters(4).dtname = 'real_T';
xcp.parameters(5).baseaddr = '&piezoapa_P.RandomNumber_Seed';
xcp.parameters(5).symbol = 'piezoapa_P.Saturation1_UpperSat';
xcp.parameters(5).size = 1;
xcp.parameters(5).dtname = 'real_T';
xcp.parameters(6).baseaddr = '&piezoapa_P.Saturation1_UpperSat';
xcp.parameters(6).symbol = 'piezoapa_P.Saturation1_LowerSat';
xcp.parameters(6).size = 1;
xcp.parameters(6).dtname = 'real_T';
xcp.parameters(7).baseaddr = '&piezoapa_P.Saturation1_LowerSat';
xcp.parameters(7).symbol = 'piezoapa_P.Analoginput_P1';
xcp.parameters(7).size = 1;
xcp.parameters(7).dtname = 'real_T';
xcp.parameters(8).baseaddr = '&piezoapa_P.Analoginput_P1';
xcp.parameters(8).symbol = 'piezoapa_P.Analoginput_P2';
xcp.parameters(8).size = 1;
xcp.parameters(8).dtname = 'real_T';
xcp.parameters(9).baseaddr = '&piezoapa_P.Analoginput_P2';
xcp.parameters(9).symbol = 'piezoapa_P.Analoginput_P3';
xcp.parameters(9).size = 1;
xcp.parameters(9).dtname = 'real_T';
xcp.parameters(10).baseaddr = '&piezoapa_P.Analoginput_P3';
xcp.parameters(10).symbol = 'piezoapa_P.Analoginput_P4';
xcp.parameters(10).size = 1;
xcp.parameters(10).dtname = 'real_T';
xcp.parameters(11).baseaddr = '&piezoapa_P.Analoginput_P4';
xcp.parameters(11).symbol = 'piezoapa_P.Analoginput_P5';
xcp.parameters(11).size = 1;
xcp.parameters(11).dtname = 'real_T';
xcp.parameters(12).baseaddr = '&piezoapa_P.Analoginput_P5';
xcp.parameters(12).symbol = 'piezoapa_P.Analoginput_P6';
xcp.parameters(12).size = 1;
xcp.parameters(12).dtname = 'real_T';
xcp.parameters(13).baseaddr = '&piezoapa_P.Analoginput_P6';
xcp.parameters(13).symbol = 'piezoapa_P.Analoginput_P7';
xcp.parameters(13).size = 16;
xcp.parameters(13).dtname = 'real_T';
xcp.parameters(14).baseaddr = '&piezoapa_P.Analoginput_P7[0]';
xcp.parameters(14).symbol = 'piezoapa_P.Analoginput_P8';
xcp.parameters(14).size = 1;
xcp.parameters(14).dtname = 'real_T';
xcp.parameters(15).baseaddr = '&piezoapa_P.Analoginput_P8';
xcp.parameters(15).symbol = 'piezoapa_P.Analoginput_P9';
xcp.parameters(15).size = 1;
xcp.parameters(15).dtname = 'real_T';
xcp.parameters(16).baseaddr = '&piezoapa_P.Analoginput_P9';
xcp.parameters(16).symbol = 'piezoapa_P.Analoginput_P10';
xcp.parameters(16).size = 1;
xcp.parameters(16).dtname = 'real_T';
xcp.parameters(17).baseaddr = '&piezoapa_P.Analoginput_P10';
xcp.parameters(17).symbol = 'piezoapa_P.Analoginput_P11';
xcp.parameters(17).size = 1;
xcp.parameters(17).dtname = 'real_T';
xcp.parameters(18).baseaddr = '&piezoapa_P.Analoginput_P11';
xcp.parameters(18).symbol = 'piezoapa_P.Analoginput_P12';
xcp.parameters(18).size = 1;
xcp.parameters(18).dtname = 'real_T';
xcp.parameters(19).baseaddr = '&piezoapa_P.Analoginput_P12';
xcp.parameters(19).symbol = 'piezoapa_P.Analogoutput_P1';
xcp.parameters(19).size = 1;
xcp.parameters(19).dtname = 'real_T';
xcp.parameters(20).baseaddr = '&piezoapa_P.Analogoutput_P1';
xcp.parameters(20).symbol = 'piezoapa_P.Analogoutput_P2';
xcp.parameters(20).size = 1;
xcp.parameters(20).dtname = 'real_T';
xcp.parameters(21).baseaddr = '&piezoapa_P.Analogoutput_P2';
xcp.parameters(21).symbol = 'piezoapa_P.Analogoutput_P3';
xcp.parameters(21).size = 1;
xcp.parameters(21).dtname = 'real_T';
xcp.parameters(22).baseaddr = '&piezoapa_P.Analogoutput_P3';
xcp.parameters(22).symbol = 'piezoapa_P.Analogoutput_P4';
xcp.parameters(22).size = 1;
xcp.parameters(22).dtname = 'real_T';
xcp.parameters(23).baseaddr = '&piezoapa_P.Analogoutput_P4';
xcp.parameters(23).symbol = 'piezoapa_P.Analogoutput_P5';
xcp.parameters(23).size = 1;
xcp.parameters(23).dtname = 'real_T';
xcp.parameters(24).baseaddr = '&piezoapa_P.Analogoutput_P5';
xcp.parameters(24).symbol = 'piezoapa_P.Analogoutput_P6';
xcp.parameters(24).size = 8;
xcp.parameters(24).dtname = 'real_T';
xcp.parameters(25).baseaddr = '&piezoapa_P.Analogoutput_P6[0]';
xcp.parameters(25).symbol = 'piezoapa_P.Analogoutput_P7';
xcp.parameters(25).size = 8;
xcp.parameters(25).dtname = 'real_T';
xcp.parameters(26).baseaddr = '&piezoapa_P.Analogoutput_P7[0]';
xcp.parameters(26).symbol = 'piezoapa_P.Analogoutput_P8';
xcp.parameters(26).size = 8;
xcp.parameters(26).dtname = 'real_T';
xcp.parameters(27).baseaddr = '&piezoapa_P.Analogoutput_P8[0]';
xcp.parameters(27).symbol = 'piezoapa_P.Analogoutput_P9';
xcp.parameters(27).size = 1;
xcp.parameters(27).dtname = 'real_T';
xcp.parameters(28).baseaddr = '&piezoapa_P.Analogoutput_P9';
xcp.parameters(28).symbol = 'piezoapa_P.Analogoutput_P10';
xcp.parameters(28).size = 1;
xcp.parameters(28).dtname = 'real_T';
xcp.parameters(29).baseaddr = '&piezoapa_P.Analogoutput_P10';
xcp.parameters(29).symbol = 'piezoapa_P.Analogoutput_P11';
xcp.parameters(29).size = 1;
xcp.parameters(29).dtname = 'real_T';
xcp.parameters(30).baseaddr = '&piezoapa_P.Analogoutput_P11';
xcp.parameters(30).symbol = 'piezoapa_P.Analogoutput_P12';
xcp.parameters(30).size = 1;
xcp.parameters(30).dtname = 'real_T';
xcp.parameters(31).baseaddr = '&piezoapa_P.Analogoutput_P12';
xcp.parameters(31).symbol = 'piezoapa_P.Analogoutput_P13';
xcp.parameters(31).size = 1;
xcp.parameters(31).dtname = 'real_T';
xcp.parameters(32).baseaddr = '&piezoapa_P.Analogoutput_P13';
xcp.parameters(32).symbol = 'piezoapa_P.Analogoutput_P14';
xcp.parameters(32).size = 1;
xcp.parameters(32).dtname = 'real_T';
xcp.parameters(33).baseaddr = '&piezoapa_P.Analogoutput_P14';
xcp.parameters(33).symbol = 'piezoapa_P.Analogoutput_P15';
xcp.parameters(33).size = 1;
xcp.parameters(33).dtname = 'real_T';
xcp.parameters(34).baseaddr = '&piezoapa_P.Analogoutput_P15';
xcp.parameters(34).symbol = 'piezoapa_P.Setup_P1';
xcp.parameters(34).size = 1;
xcp.parameters(34).dtname = 'real_T';
xcp.parameters(35).baseaddr = '&piezoapa_P.Setup_P1';
xcp.parameters(35).symbol = 'piezoapa_P.Setup_P2';
xcp.parameters(35).size = 1;
xcp.parameters(35).dtname = 'real_T';
xcp.parameters(36).baseaddr = '&piezoapa_P.Setup_P2';
xcp.parameters(36).symbol = 'piezoapa_P.Setup_P3';
xcp.parameters(36).size = 1;
xcp.parameters(36).dtname = 'real_T';
xcp.parameters(37).baseaddr = '&piezoapa_P.Setup_P3';
xcp.parameters(37).symbol = 'piezoapa_P.Setup_P4';
xcp.parameters(37).size = 3318808;
xcp.parameters(37).dtname = 'real_T';
xcp.parameters(38).baseaddr = '&piezoapa_P.Setup_P4[0]';
xcp.parameters(38).symbol = 'piezoapa_P.Setup_P5';
xcp.parameters(38).size = 2;
xcp.parameters(38).dtname = 'real_T';
xcp.parameters(39).baseaddr = '&piezoapa_P.Setup_P5[0]';
xcp.parameters(39).symbol = 'piezoapa_P.Setup_P6';
xcp.parameters(39).size = 1;
xcp.parameters(39).dtname = 'real_T';
xcp.parameters(40).baseaddr = '&piezoapa_P.Setup_P6';
xcp.parameters(40).symbol = 'piezoapa_P.Setup_P7';
xcp.parameters(40).size = 1;
xcp.parameters(40).dtname = 'real_T';
xcp.parameters(41).baseaddr = '&piezoapa_P.Setup_P7';
xcp.parameters(41).symbol = 'piezoapa_P.Setup_P8';
xcp.parameters(41).size = 1;
xcp.parameters(41).dtname = 'real_T';
xcp.parameters(42).baseaddr = '&piezoapa_P.Setup_P8';
xcp.parameters(42).symbol = 'piezoapa_P.Setup_P9';
xcp.parameters(42).size = 1;
xcp.parameters(42).dtname = 'real_T';
xcp.parameters(43).baseaddr = '&piezoapa_P.Setup_P9';
xcp.parameters(43).symbol = 'piezoapa_P.Setup_P10';
xcp.parameters(43).size = 1;
xcp.parameters(43).dtname = 'real_T';
xcp.parameters(44).baseaddr = '&piezoapa_P.Setup_P10';
xcp.parameters(44).symbol = 'piezoapa_P.Setup_P11';
xcp.parameters(44).size = 1;
xcp.parameters(44).dtname = 'real_T';
xcp.parameters(45).baseaddr = '&piezoapa_P.Setup_P11';
xcp.parameters(45).symbol = 'piezoapa_P.Setup_P12';
xcp.parameters(45).size = 1;
xcp.parameters(45).dtname = 'real_T';
xcp.parameters(46).baseaddr = '&piezoapa_P.Setup_P12';
xcp.parameters(46).symbol = 'piezoapa_P.Setup_P13';
xcp.parameters(46).size = 1;
xcp.parameters(46).dtname = 'real_T';
xcp.parameters(47).baseaddr = '&piezoapa_P.Setup_P13';
xcp.parameters(47).symbol = 'piezoapa_P.Setup_P1_p';
xcp.parameters(47).size = 1;
xcp.parameters(47).dtname = 'real_T';
xcp.parameters(48).baseaddr = '&piezoapa_P.Setup_P1_p';
xcp.parameters(48).symbol = 'piezoapa_P.Setup_P2_h';
xcp.parameters(48).size = 1;
xcp.parameters(48).dtname = 'real_T';
xcp.parameters(49).baseaddr = '&piezoapa_P.Setup_P2_h';
xcp.parameters(49).symbol = 'piezoapa_P.Setup_P3_f';
xcp.parameters(49).size = 1;
xcp.parameters(49).dtname = 'real_T';
xcp.parameters(50).baseaddr = '&piezoapa_P.Setup_P3_f';
xcp.parameters(50).symbol = 'piezoapa_P.Setup_P4_i';
xcp.parameters(50).size = 1;
xcp.parameters(50).dtname = 'real_T';
xcp.parameters(51).baseaddr = '&piezoapa_P.Setup_P4_i';
xcp.parameters(51).symbol = 'piezoapa_P.Setup_P5_p';
xcp.parameters(51).size = 1;
xcp.parameters(51).dtname = 'real_T';
xcp.parameters(52).baseaddr = '&piezoapa_P.Setup_P5_p';
xcp.parameters(52).symbol = 'piezoapa_P.Setup_P6_o';
xcp.parameters(52).size = 1;
xcp.parameters(52).dtname = 'real_T';
xcp.parameters(53).baseaddr = '&piezoapa_P.Setup_P6_o';
xcp.parameters(53).symbol = 'piezoapa_P.ManualSwitch_CurrentSetting';
xcp.parameters(53).size = 1;
xcp.parameters(53).dtname = 'uint8_T';
xcp.parameters(54).baseaddr = '&piezoapa_P.ManualSwitch_CurrentSetting';
xcp.parameters(54).symbol = 'piezoapa_P.DiscreteTransferFcn_NumCoef';
xcp.parameters(54).size = 2;
xcp.parameters(54).dtname = 'real_T';
xcp.parameters(55).baseaddr = '&piezoapa_P.DiscreteTransferFcn_NumCoef[0]';
xcp.parameters(55).symbol = 'piezoapa_P.DiscreteTransferFcn_DenCoef';
xcp.parameters(55).size = 2;
xcp.parameters(55).dtname = 'real_T';
xcp.parameters(56).baseaddr = '&piezoapa_P.DiscreteTransferFcn_DenCoef[0]';
xcp.parameters(56).symbol = 'piezoapa_P.DiscreteTransferFcn_InitialStat';
xcp.parameters(56).size = 1;
xcp.parameters(56).dtname = 'real_T';
xcp.parameters(57).baseaddr = '&piezoapa_P.DiscreteTransferFcn_InitialStat';
function n = getNumParameters
n = 56;
function n = getNumSignals
n = 20;
function n = getNumEvents
n = 1;
function n = getNumModels
n = 1;

60
runtest.m Normal file
View File

@ -0,0 +1,60 @@
tg = slrt;
%%
f = SimulinkRealTime.openFTP(tg);
mget(f, 'apa95ml.dat', 'data');
close(f);
%% Convert the Data
data = SimulinkRealTime.utils.getFileScopeData('data/apa95ml.dat').data;
V_in = data(:, 1);
V_out = data(:, 2);
t = data(:, 3);
%% Save Data
save('mat/cedrat_la75b_med_3_stack.mat', 't', 'V_in', 'V_out');
%%
run setup;
win = hann(ceil(10/Ts));
[tf_est, f] = tfestimate(V_in, V_out, win, [], [], 1/Ts);
[co_est, ~] = mscohere(V_in, V_out, win, [], [], 1/Ts);
%%
figure;
hold on;
plot(f, co_est, 'k-')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Coherence'); xlabel('Frequency [Hz]');
hold off;
%%
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f, abs(tf_est), 'k-', 'DisplayName', 'Identified')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); xlabel('Frequency [Hz]');
hold off;
ax2 = subplot(2, 1, 2);
hold on;
plot(f, 180/pi*unwrap(angle(tf_est)), 'k-')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
hold off;
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);
%%
run setup;
win = hann(ceil(1/Ts));
[tf_est, f] = tfestimate(u, um, win, [], [], 1/Ts);
[co_est, ~] = mscohere(u, um, win, [], [], 1/Ts);

6
setup.m Normal file
View File

@ -0,0 +1,6 @@
s = tf('s');
Ts = 1e-4;
Glpf = 1/(1 + s/2/pi/500);
Gz = c2d(Glpf, Ts, 'tustin');

Binary file not shown.