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

[MOG,DEF]=lance_sauve(MOGi,DEFi,NUM,DEN)
function [MOG,DEF]=lance_sauve(MOGi,DEFi,NUM,DEN)


DEF=DEFi;
MOG=MOGi;
 stop_simulation_tournant_eventuellement;
if DEF(2)==2
     modele='filtre_FIR';
     test=~isempty(NUM);
else
     modele='filtre_IIR'; 
     test=(~isempty(NUM)&&~isempty(DEN));
end;
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
            nettoyage;
            carte='National_Instruments/PCI-6221_37-pin';            
            te=DEFi(1);
           
            open_system([modele,'.mdl'])
             bloc3=[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);
             sbao=[s,'/Analog Output'];
            set_param(sbao,'drvname',carte_sortie);
            set_param(sbao,'voltrange',plage_sortie);
            set_param(sbao,'drvname',carte);
            set_param(gcs,'SimulationMode','external');
            set_param(gcs,'ExtMode','on');
            duration=100000;
            set_param(gcs,'ExtModeTrigDuration',duration);
            bloc_filtre=[modele,'/Discrete Filter'];
             %set_param(bloc_filtre,'numerator',['[',num2str(NUM),']']);
            %set_param(bloc_filtre,'denominator',['[',num2str(DEN),']']);
            if DEF(2)==2
                           bloc_filtre=[modele,'/Discrete FIR Filter'];
                        set_param(bloc_filtre,'numcoeffs',['[',num2str(NUM,'%16.7e'),']']);
            else
                 bloc_filtre=[modele,'/Discrete Filter'];
                set_param(bloc_filtre,'numerator',['[',num2str(NUM,'%16.7e'),']']);
                set_param(bloc_filtre,'denominator',['[',num2str(DEN,'%16.7e'),']']);
            end;
           
            if faut_il_recompiler
                 set_param(bloc3,'foregroundcolor','red')
                 pause(1)
                rtwbuild(gcs);
                pause(1)
                 set_param(bloc3,'foregroundcolor','white')
            end;
            set_param(gcs,'SimulationCommand','connect');          
            set_param(gcs,'SimulationCommand','start')
            [tim,dum,dum,drv,slice,perf,dum,dum,mach]=rttool('read',0,'timers');
            [per,dum,dum,run]=rttool('read',tim,'period');
            DEF(1)=per;
             bloc=[modele,'/Subsystem'];
            set_param(bloc,'maskvaluestring',num2str(DEF(1)))
          
end;




            
    

Contact us