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_smith.m
nom=get_param(gcs,'name');
schema_modele='boucle_fermee_anal_smith';
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_smith';
    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/smith/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);
end;
schema_modelecor=[schema_modele,'/Correcteur'];
bloc_smith=[schema_modelecor,'/smith'];
bloc_R=[schema_modele,'/R'];
bloc_G=[schema_modele,'/G'];
bloc_T=[schema_modele,'/ValeurT'];
try
    set_param(bloc_smith,'NUMRZ',['[',num2str(enleve_zero(P_smith(3,:)),'%24.15e'),']']);
    set_param(bloc_smith,'DENRZ',['[',num2str(enleve_zero(P_smith(4,:)),'%24.15e'),']']);
    set_param(bloc_smith,'NUMGZ',['[',num2str(enleve_zero(P_smith(7,:)),'%24.15e'),']']);
    set_param(bloc_smith,'DENGZ',['[',num2str(enleve_zero(P_smith(8,:)),'%24.15e'),']']);
    set_param(bloc_smith,'N_RET',['[',num2str(P_ret),']']);
    set_param(bloc_R,'NUM',['[',num2str(P_smith(1,:)),']']);
    set_param(bloc_R,'DEN',['[',num2str(P_smith(2,:)),']']);
    set_param(bloc_G,'NUM',['[',num2str(P_smith(5,:)),']']);
    set_param(bloc_G,'DEN',['[',num2str(P_smith(6,:)),']']);
    set_param(bloc_T,'T',num2str(P_smith(9,1)));
catch
    set_param(gcs,'simulationcommand','stop')
    pause(1)
     set_param(bloc_smith,'NUMRZ',['[',num2str(enleve_zero(P_smith(3,:)),'%24.15e'),']']);
    set_param(bloc_smith,'DENRZ',['[',num2str(enleve_zero(P_smith(4,:)),'%24.15e'),']']);
    set_param(bloc_smith,'NUMGZ',['[',num2str(enleve_zero(P_smith(7,:)),'%24.15e'),']']);
    set_param(bloc_smith,'DENGZ',['[',num2str(enleve_zero(P_smith(8,:)),'%24.15e'),']']);
    set_param(bloc_smith,'N_RET',['[',num2str(P_ret),']']);
    set_param(bloc_R,'NUM',['[',num2str(P_smith(1,:)),']']);
    set_param(bloc_R,'DEN',['[',num2str(P_smith(2,:)),']']);
    set_param(bloc_G,'NUM',['[',num2str(P_smith(5,:)),']']);
    set_param(bloc_G,'DEN',['[',num2str(P_smith(6,:)),']']);
    set_param(bloc_T,'T',num2str(P_smith(9,1)));
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,'/Correcteur'];
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'),'/Correcteur'];
bloc_plot=[nom,'/Splot'];
set_param(bloc_plot,'parameters',num2str(DEF(3)));
bloc_smith=[schema_modelecor,'/smith'];
bloc_R=[schema_modele,'/R'];
bloc_G=[schema_modele,'/G'];
bloc_T=[schema_modele,'/ValeurT'];
set_param(bloc_smith,'NUMRZ',['[',num2str(enleve_zero(P_smith(3,:)),'%24.15e'),']']);
set_param(bloc_smith,'DENRZ',['[',num2str(enleve_zero(P_smith(4,:)),'%24.15e'),']']);
set_param(bloc_smith,'NUMGZ',['[',num2str(enleve_zero(P_smith(7,:)),'%24.15e'),']']);
set_param(bloc_smith,'DENGZ',['[',num2str(enleve_zero(P_smith(8,:)),'%24.15e'),']']);
set_param(bloc_smith,'N_RET',['[',num2str(P_ret),']']);
set_param(bloc_R,'NUM',['[',num2str(P_smith(1,:)),']']);
set_param(bloc_R,'DEN',['[',num2str(P_smith(2,:)),']']);
set_param(bloc_G,'NUM',['[',num2str(P_smith(5,:)),']']);
set_param(bloc_G,'DEN',['[',num2str(P_smith(6,:)),']']);
set_param(bloc_T,'T',num2str(P_smith(9,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