Code covered by the BSD License  

Highlights from
Logiciels temps réel

Logiciels temps réel

by

 

Real-time software concerning the domains of the signal processing, feedback and regulation

lance_correcteur_2_boucles.m
nom=get_param(gcs,'name');
schema_modele='boucle_fermee_anal_2_boucles';
test=strcmp(nom,schema_modele);
repertoire=pwd;
cd ..
A=load('parametres_carte.mat');
cd(repertoire)
carte_entree=A.S.entree.carte;
carte_sortie=A.S.sortie.carte;
plage_entree=num2str(A.S.entree.pop);
plage_sortie=num2str(A.S.sortie.pop);
if ~test
    schema_modele='boucle_fermee_anal_2_boucles';
    open_system([schema_modele,'.mdl'])
    set_param(gcs,'location',ecran)
    set_param(gcs,'zoomfactor','fitsystem')
    bloc3=[schema_modele,'/compil'];
    set_param(bloc3,'foregroundcolor','white')
    set_param(gcs,'solver','FixedStepDiscrete')
    set_param(gcs,'StartTime','0') 
    set_param(gcs,'StopTime','Inf') 
    set_param(gcs,'SystemTargetFile','rtwin.tlc') 
    s=get_param(gcs,'Name');
    sbai=[s,'/Analog Input'];
    set_param(sbai,'drvname',carte_entree);
    set_param(sbai,'voltrange',plage_entree);
    sbai1=[s,'/Analog Input1'];
    set_param(sbai1,'drvname',carte_entree);
    set_param(sbai1,'voltrange',plage_entree);
    sbai2=[s,'/Analog Input2'];
    set_param(sbai2,'drvname',carte_entree);
    set_param(sbai2,'voltrange',plage_entree);
    sbai3=[s,'/Analog Input3'];
   set_param(sbai3,'drvname',carte_entree);
    set_param(sbai3,'voltrange',plage_entree);
    sbao=[s,'/Analog Output'];
     set_param(sbao,'drvname',carte_sortie);
    set_param(sbao,'voltrange',plage_sortie);
    sbao1=[s,'/Analog Output1'];
     set_param(sbao1,'drvname',carte_sortie);
    set_param(sbao1,'voltrange',plage_sortie);
    bloc_sat=[schema_modele,'/Correcteurs/R1/Saturation'];
    set_param(bloc_sat,'upperlimit',num2str(A.S.sortie.val_max));
    set_param(bloc_sat,'lowerlimit',num2str(A.S.sortie.val_min));
    bloc_sat1=[schema_modele,'/Correcteurs/R2/Saturation'];
    set_param(bloc_sat1,'upperlimit',num2str(A.S.sortie.val_max));
    set_param(bloc_sat1,'lowerlimit',num2str(A.S.sortie.val_min));
    set_param(gcs,'SimulationMode','external');
    set_param(gcs,'ExtMode','on');
    duration=100000;
    set_param(gcs,'ExtModeTrigDuration',duration);
end;
schema_modelecor=[schema_modele,'/Correcteurs'];
bloc1=[schema_modelecor,'/R1'];
bloc2=[schema_modelecor,'/R2'];
bloc_R1=[schema_modele,'/R1'];
bloc_R2=[schema_modele,'/R2'];

try
    set_param(bloc1,'NUM1Z',['[',num2str(enleve_zero(P_tachy(3,:)),'%24.15e'),']']);
    set_param(bloc1,'DEN1Z',['[',num2str(enleve_zero(P_tachy(4,:)),'%24.15e'),']']);
    set_param(bloc2,'NUM2Z',['[',num2str(enleve_zero(P_tachy(7,:)),'%24.15e'),']']);
    set_param(bloc2,'DEN2Z',['[',num2str(enleve_zero(P_tachy(8,:)),'%24.15e'),']']);
    set_param(bloc_R1,'NUM',['[',num2str(P_tachy(1,:)),']']);
    set_param(bloc_R1,'DEN',['[',num2str(P_tachy(2,:)),']']);
    set_param(bloc_R2,'NUM',['[',num2str(P_tachy(5,:)),']']);
    set_param(bloc_R2,'DEN',['[',num2str(P_tachy(6,:)),']']);
catch
    set_param(gcs,'simulationcommand','stop')
    pause(1)
     set_param(bloc1,'NUM1Z',['[',num2str(enleve_zero(P_tachy(3,:)),'%24.15e'),']']);
    set_param(bloc1,'DEN1Z',['[',num2str(enleve_zero(P_tachy(4,:)),'%24.15e'),']']);
    set_param(bloc2,'NUM2Z',['[',num2str(enleve_zero(P_tachy(7,:)),'%24.15e'),']']);
    set_param(bloc2,'DEN2Z',['[',num2str(enleve_zero(P_tachy(8,:)),'%24.15e'),']']);
    set_param(bloc_R1,'NUM',['[',num2str(P_tachy(1,:)),']']);
    set_param(bloc_R1,'DEN',['[',num2str(P_tachy(2,:)),']']);
    set_param(bloc_R2,'NUM',['[',num2str(P_tachy(5,:)),']']);
    set_param(bloc_R2,'DEN',['[',num2str(P_tachy(6,:)),']']);
end;

if faut_il_recompiler
                 bloc3=[schema_modele,'/compil'];
                 set_param(bloc3,'foregroundcolor','red')
                 pause(1)
                rtwbuild(gcs);
                pause(1)
                 set_param(bloc3,'foregroundcolor','white')
end;
DEF(10)=0;
set_param(gcs,'SimulationCommand','connect');          
set_param(gcs,'SimulationCommand','start')
pause(1)
schema_modelecor=[schema_modele,'/Correcteurs'];
blocsw=[schema_modelecor,'/Constant3'];
if DEF(4)==1
    set_param(blocsw,'value','1')
else
    set_param(blocsw,'value','0')
end;
nom=[get_param(gcs,'name'),'/Correcteurs'];
bloc_plot=[nom,'/Splot'];
set_param(bloc_plot,'parameters',num2str(DEF(3)));
bloc1=[schema_modelecor,'/R1'];
bloc2=[schema_modelecor,'/R2'];
bloc_R1=[schema_modele,'/R1'];
bloc_R2=[schema_modele,'/R2'];
  set_param(bloc1,'NUM1Z',['[',num2str(enleve_zero(P_tachy(3,:)),'%24.15e'),']']);
    set_param(bloc1,'DEN1Z',['[',num2str(enleve_zero(P_tachy(4,:)),'%24.15e'),']']);
    set_param(bloc2,'NUM2Z',['[',num2str(enleve_zero(P_tachy(7,:)),'%24.15e'),']']);
    set_param(bloc2,'DEN2Z',['[',num2str(enleve_zero(P_tachy(8,:)),'%24.15e'),']']);
    set_param(bloc_R1,'NUM',['[',num2str(P_tachy(1,:)),']']);
    set_param(bloc_R1,'DEN',['[',num2str(P_tachy(2,:)),']']);
    set_param(bloc_R2,'NUM',['[',num2str(P_tachy(5,:)),']']);
    set_param(bloc_R2,'DEN',['[',num2str(P_tachy(6,:)),']']);
 
 bloc_plot=[schema_modelecor,'/Splot'];
set_param(bloc_plot,'parameters',num2str(DEF(3)));
bloc_plot=[schema_modelecor,'/Constant1'];
set_param(bloc_plot,'value',num2str(DEF(6)));
bloc_plot=[schema_modelecor,'/Constant2'];
set_param(bloc_plot,'value',num2str(DEF(5)));
ajuste_temps_scope(2*DEF(2),0);
 
 
 

Contact us