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.m
nom_modele=get_param(gcs,'name');
schema_modele='boucle_fermee_anal';
test=strcmp(nom_modele,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';
    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);
    sbao=[s,'/Analog Output'];
    set_param(sbao,'drvname',carte_sortie);
    set_param(sbao,'voltrange',plage_sortie);
    bloc_sat=[schema_modele,'/Correcteur/PID/Saturation'];
    set_param(bloc_sat,'upperlimit',num2str(A.S.sortie.val_max));
    set_param(bloc_sat,'lowerlimit',num2str(A.S.sortie.val_min));
    set_param(gcs,'SimulationMode','external');
    set_param(gcs,'ExtMode','on');
    duration=100000;
    set_param(gcs,'ExtModeTrigDuration',duration);
    bloc3=[schema_modele,'/compil'];
   if faut_il_recompiler
                 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')
end;
pause(1)
schema_modelecor=[schema_modele,'/Correcteur'];
blocsw=[schema_modelecor,'/Constant3'];
if DEF(4)==1
    set_param(blocsw,'value','1')
else
    set_param(blocsw,'value','0')
end;
blocsw=[schema_modelecor,'/Constant'];
set_param(blocsw,'value','0')
nom=[get_param(gcs,'name'),'/Correcteur'];
bloc_plot=[nom,'/Splot'];
set_param(bloc_plot,'parameters',num2str(DEF(3)));
bloc_pid=[nom,'/PID'];
 set_param(bloc_pid,'K',num2str(P_PID(1,1)))
 set_param(bloc_pid,'Ki',num2str(P_PID(5,1)))
 set_param(bloc_pid,'Kd',num2str(P_PID(4,1)))
 set_param(bloc_pid,'a',num2str(P_PID(6,1)))
 bloc_K=[schema_modele,'/ValeurK'];
 set_param(bloc_K,'K',num2str(P_PID(1,1)))
 bloc_Ti=[schema_modele,'/ValeurTi'];
 set_param(bloc_Ti,'Ti',num2str(P_PID(2,1)))
 bloc_Td=[schema_modele,'/ValeurTd'];
 set_param(bloc_Td,'Td',num2str(P_PID(3,1)))
 bloc_Kd=[schema_modele,'/ValeurKd'];
 set_param(bloc_Kd,'Kd',num2str(P_PID(4,1)))
 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