Script de simulation Scilab
fr -
eng
Simulation d'un synthétiseur de fréquence fractionnaire accroché
synthe_frac_phase_sim.cos
//Define simulation name
sim_name='synthe_frac_phase_sim';
//##
load(MODNUMCOS+'/simu/'+sim_name+'/'+sim_name+'.cos')
context=scs_m.props("context");
//## fftsize
context=strsubst(context,'nfft = 2048*256','nfft = 2048*128');
context=strsubst(context,'aver = 8','aver = 4');
//context=strsubst(context,'DZDSM = 0','DZDSM = 1');
//context=strsubst(context,'dither = 1','dither = 0');
//context=strsubst(context,'K = 3013','K = 3010');
//## SD only
contxt=strsubst(context,'sig_ref = 3*%pi','sig_ref = 0');
contxt=strsubst(contxt,'j_vco = 75e3','j_vco = 0e3');
contxt=strsubst(contxt,'Idown = Icp+1/100*Icp','Idown = Icp');
contxt=strsubst(contxt,'Ileak = 10e-6','Ileak = 0');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h1=scf(213);
p1=h1.children.children;
//pp1=copy(p1);
//## SD + DZ
contxt=strsubst(context,'sig_ref = 3*%pi','sig_ref = 0');
contxt=strsubst(contxt,'DZDSM = 0','DZDSM = 1');
contxt=strsubst(contxt,'j_vco = 75e3','j_vco = 0e3');
contxt=strsubst(contxt,'Idown = Icp+1/100*Icp','Idown = Icp');
contxt=strsubst(contxt,'winfft = 213','winfft = 214');
contxt=strsubst(contxt,'Ileak = 10e-6','Ileak = 0');
//contxt=strsubst(contxt,'dither = 1','dither = 0');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h2=scf(214);
p2=h2.children.children;
pp2=copy(p2);
//## PFD only
contxt=strsubst(context,'DSM = 1','DSM = 0');
contxt=strsubst(contxt,'sig_ref = 3*%pi','sig_ref = 0');
contxt=strsubst(contxt,'j_vco = 75e3','j_vco = 0');
contxt=strsubst(contxt,'winfft = 213','winfft = 215');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h3=scf(215);
p3=h3.children.children;
//pp3=copy(p3);
//## SD + DZ + PFD
contxt=strsubst(context,'sig_ref = 3*%pi','sig_ref = 0');
contxt=strsubst(contxt,'DZDSM = 0','DZDSM = 1');
contxt=strsubst(contxt,'j_vco = 75e3','j_vco = 0e3');
contxt=strsubst(contxt,'winfft = 213','winfft = 216');
//contxt=strsubst(contxt,'dither = 1','dither = 0');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h4=scf(216);
p4=h4.children.children;
pp4=copy(p4);
copy(pp2,h1.children);
//copy(pp3,h1.children);
//copy(pp4,h1.children);
h1.children.children(1).foreground=1;
h1.children.children(2).foreground=4;
//h1.children.children(3).foreground=4;
//h1.children.children(4).foreground=6;
copy(pp4,h3.children);
h3.children.children(1).foreground=1;
xdel(214);
xdel(216);
//////////////////////////////////////////////////////////////////////
//## VCO only (open loop)
contxt=strsubst(context,'sig_ref = 3*%pi','sig_ref = 0');
contxt=strsubst(contxt,'Idown = Icp+1/100*Icp','Idown = Icp');
contxt=strsubst(contxt,'Ileak = 10e-6','Ileak = 0');
contxt=strsubst(contxt,'DSM = 1','DSM = 0');
contxt=strsubst(contxt,'winfft = 213','winfft = 2013');
contxt=strsubst(contxt,'closed = 1','closed = 0');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h1=scf(2013);
p1=h1.children.children;
//pp1=copy(p1);
//## VCO only (closed loop)
contxt=strsubst(context,'sig_ref = 3*%pi','sig_ref = 0');
contxt=strsubst(contxt,'Idown = Icp+1/100*Icp','Idown = Icp');
contxt=strsubst(contxt,'Ileak = 10e-6','Ileak = 0');
contxt=strsubst(contxt,'DSM = 1','DSM = 0');
contxt=strsubst(contxt,'winfft = 213','winfft = 2014');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h2=scf(2014);
p2=h2.children.children;
pp2=copy(p2);
//## VCO + PFD
contxt=strsubst(context,'sig_ref = 3*%pi','sig_ref = 0');
contxt=strsubst(contxt,'DSM = 1','DSM = 0');
contxt=strsubst(contxt,'winfft = 213','winfft = 2015');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h3=scf(2015);
p3=h3.children.children;
//pp3=copy(p3);
//## VCO + PFD + REF
contxt=strsubst(context,'DSM = 1','DSM = 0');
contxt=strsubst(contxt,'winfft = 213','winfft = 2016');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h4=scf(2016);
p4=h4.children.children;
pp4=copy(p4);
copy(pp2,h1.children);
//copy(pp3,h1.children);
h1.children.children(1).foreground=1;
h1.children.children(2).foreground=4;
//h1.children.children(3).foreground=8;
copy(pp4,h3.children);
//copy(pp3,h1.children);
h3.children.children(1).foreground=1;
h3.children.children(2).foreground=4;
xdel(2014);
xdel(2015);
//////////////////////////////////////////////////////////////////////
//## REF only (closed loop)
contxt=strsubst(context,'Idown = Icp+1/100*Icp','Idown = Icp');
contxt=strsubst(contxt,'j_vco = 75e3','j_vco = 0e3');
contxt=strsubst(contxt,'Ileak = 10e-6','Ileak = 0');
contxt=strsubst(contxt,'DSM = 1','DSM = 0');
contxt=strsubst(contxt,'winfft = 213','winfft = 20014');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h1=scf(20014);
p1=h1.children.children;
//pp2=copy(p2);
//## REF + PFD
contxt=strsubst(context,'j_vco = 75e3','j_vco = 0e3');
contxt=strsubst(contxt,'DSM = 1','DSM = 0');
contxt=strsubst(contxt,'winfft = 213','winfft = 20015');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h2=scf(20015);
p2=h2.children.children;
pp2=copy(p2);
copy(pp2,h1.children);
h1.children.children(1).foreground=1;
h1.children.children(2).foreground=4;
xdel(20015);
/////////////////////////////////////
//## SD + PFD mistmatch + REF + VCO
contxt=strsubst(context,'winfft = 213','winfft = 1');
contxt=strsubst(contxt,'DZDSM = 0','DZDSM = 1');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h1=scf(1);
p1=h1.children.children;
pp1=copy(p1);
contxt=strsubst(context,'winfft = 213','winfft = 2');
scs_m.props("context")=contxt;
Info=list();
Info=scicos_simulate(scs_m,Info);
h2=scf(2);
p2=h2.children.children;
pp2=copy(p2);
copy(pp1,h2.children);
h2.children.children(2).foreground=4;
xdel(1)
//
// //## SD(dither) + PFD mistmatch + REF + VCO
// contxt=strsubst(context,'winfft = 213','winfft = 216');
// contxt=strsubst(contxt,'dither = 0','dither = 1');
// scs_m.props("context")=contxt;
// Info=list();
// Info=scicos_simulate(scs_m,Info);
// h4=scf(216);
// p4=h4.children.children;
// pp4=copy(p4);
//
// copy(pp2,h1.children);
// copy(pp3,h1.children);
// copy(pp4,h1.children);
// h1.children.children(1).foreground=1;
// h1.children.children(2).foreground=10;
// h1.children.children(3).foreground=4;
// h1.children.children(4).foreground=6;
//
// xdel(214);
// xdel(215);
// xdel(216);
//
// //context=strsubst(context,'j_vco = 75e3','j_vco = 10e3');
// //context=strsubst(context,'sig_ref = 3*%pi','sig_ref = 3*%pi');
//
// //## VCO only (open loop)
// contxt=strsubst(context,'sig_ref = 3*%pi','sig_ref = %eps');
// contxt=strsubst(contxt,'Idown = Icp+1/100*Icp','Idown = Icp');
// contxt=strsubst(contxt,'Ileak = 10e-6','Ileak = %eps');
// contxt=strsubst(contxt,'DSM = 1','DSM = 0');
// contxt=strsubst(contxt,'winfft = 213','winfft = 214');
// contxt=strsubst(contxt,'closed = 1','closed = 0');
// scs_m.props("context")=contxt;
// Info=list();
// Info=scicos_simulate(scs_m,Info);
// h1=scf(214);
// p1=h1.children.children;
// pp1=copy(p1);
//
// //## VCO only (closed loop)
// contxt=strsubst(context,'sig_ref = 3*%pi','sig_ref = %eps');
// contxt=strsubst(contxt,'Idown = Icp+1/100*Icp','Idown = Icp');
// contxt=strsubst(contxt,'Ileak = 10e-6','Ileak = %eps');
// contxt=strsubst(contxt,'DSM = 1','DSM = 0');
// contxt=strsubst(contxt,'winfft = 213','winfft = 215');
// scs_m.props("context")=contxt;
// Info=list();
// Info=scicos_simulate(scs_m,Info);
// h2=scf(215);
// p2=h2.children.children;
// pp2=copy(p2);
//
// //## PFD only
// contxt=strsubst(context,'DSM = 1','DSM = 0');
// contxt=strsubst(contxt,'sig_ref = 3*%pi','sig_ref = 0');
// contxt=strsubst(contxt,'j_vco = 75e3','j_vco = 0');
// contxt=strsubst(contxt,'winfft = 213','winfft = 216');
// scs_m.props("context")=contxt;
// Info=list();
// Info=scicos_simulate(scs_m,Info);
// h3=scf(216);
// p3=h3.children.children;
// pp3=copy(p3);
//
// //## VCO + REF + PFD
// contxt=strsubst(context,'DSM = 1','DSM = 0');
// contxt=strsubst(contxt,'winfft = 213','winfft = 217');
// scs_m.props("context")=contxt;
// Info=list();
// Info=scicos_simulate(scs_m,Info);
// h4=scf(217);
// p4=h4.children.children;
// pp4=copy(p4);
//
// //## VCO + REF + PFD + SD(dither)
// contxt=strsubst(context,'winfft = 213','winfft = 218');
// contxt=strsubst(contxt,'dither = 0','dither = 1');
// scs_m.props("context")=contxt;
// Info=list();
// Info=scicos_simulate(scs_m,Info);
// h5=scf(218);
// p5=h5.children.children;
// pp5=copy(p5);
//
// copy(pp2,h1.children);
// copy(pp3,h1.children);
// copy(pp4,h1.children);
// copy(pp5,h1.children);
// h1.children.children(1).foreground=1;
// h1.children.children(2).foreground=10;
// h1.children.children(3).foreground=4;
// h1.children.children(4).foreground=5;
// h1.children.children(5).foreground=6;
//
// xdel(215);
// xdel(216);
// xdel(217);
// xdel(218);
synthe_frac_phase_sim.sce
Alan Layec INRIA