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

[x,DEF]=signal_acquis(DEFi)
function [x,DEF]=signal_acquis(DEFi)

DEF=DEFi;
m=DEFi(9);
te=DEFi(10);
N=2^m;
repertoire=pwd;
cd ..
A=load('parametres_carte.mat');
cd(repertoire)
carte_entree=A.S.entree.carte;
plage_entree=num2str(A.S.entree.pop);
carte_digit=A.S.digit.carte;
if DEFi(8)==1
    x=zeros(2^m,1);
    switch DEFi(6)
        case 2
            modele='fft_acquisition_1voie_synchro';
            open_system([modele,'.mdl'])
            bloc1=[modele,'/Manual Switch'];
            set_param(bloc1,'maskvaluestring','0|0|off')
             bloc2=[modele,'/declenchement'];
             set_param(bloc2,'foregroundcolor','white')
             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);
            sbdo=[s,'/Digital Output'];
            set_param(sbdo,'drvname',carte_digit);
             retard=[modele,'/Bloc_synchro/Unit Delay'];
            if DEF(4)>0
                set_param(retard,'X0',num2str(A.S.entree.val_max));
            else
                set_param(retard,'X0',num2str(A.S.entree.val_min));
            end;
            set_param(gcs,'SimulationMode','external');
            set_param(gcs,'ExtMode','on');
            duration=get_param(gcs,'ExtModeTrigDuration');
            if duration<2^(m+1)
                set_param(gcs,'ExtModeTrigDuration',2^(m+1));
            end;
            
            delete(gcf)
      
            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(bloc1,'foregroundcolor','red')
            set_param(bloc2,'foregroundcolor','red')
            set_param(gcs,'SimulationCommand','start') 
            
        case 3
            modele='fft_acquisition_1voie_pas_synchro';
            open_system([modele,'.mdl'])
            bloc1=[modele,'/Manual Switch'];
            set_param(bloc1,'maskvaluestring','0|0|off')
             bloc2=[modele,'/declenchement'];
             set_param(bloc2,'foregroundcolor','white')
             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);
            sbdo=[s,'/Digital Output'];
            set_param(sbdo,'drvname',carte_digit);
            
            set_param(gcs,'SimulationMode','external');
            set_param(gcs,'ExtMode','on');
            duration=get_param(gcs,'ExtModeTrigDuration');
            if duration<2^(m+1)
                set_param(gcs,'ExtModeTrigDuration',2^(m+1));
            end;
             
            delete(gcf)
           
            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(bloc1,'foregroundcolor','red')
            set_param(bloc2,'foregroundcolor','red')
            set_param(gcs,'SimulationCommand','start') 
    end;
elseif DEFi(8)==2
    x=zeros(2^m,2);
    switch DEFi(6)
        case 2
            modele='fft_acquisition_2voie_synchro';
            open_system([modele,'.mdl'])
            bloc1=[modele,'/Manual Switch'];
            set_param(bloc1,'maskvaluestring','0|0|off')
             bloc2=[modele,'/declenchement'];
             set_param(bloc2,'foregroundcolor','white')
             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);
            sbai1=[s,'/Analog Input1'];
             set_param(sbai1,'drvname',carte_entree);
            set_param(sbai1,'voltrange',plage_entree);
            sbdo=[s,'/Digital Output'];
            set_param(sbdo,'drvname',carte_digit);
             retard=[modele,'/Bloc_synchro/Unit Delay'];
            if DEF(4)>0
                set_param(retard,'X0',num2str(A.S.entree.val_max));
            else
                set_param(retard,'X0',num2str(A.S.entree.val_min));
            end;
            set_param(gcs,'SimulationMode','external');
            set_param(gcs,'ExtMode','on');
            duration=get_param(gcs,'ExtModeTrigDuration');
            if duration<2^(m+1)
                set_param(gcs,'ExtModeTrigDuration',2^(m+1));
            end;
            
            delete(gcf)
            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(bloc1,'foregroundcolor','red')
            set_param(bloc2,'foregroundcolor','red')
            set_param(gcs,'SimulationCommand','start') 
            
        case 3
            modele='fft_acquisition_2voie_pas_synchro';
            open_system([modele,'.mdl'])
            bloc1=[modele,'/Manual Switch'];
            set_param(bloc1,'maskvaluestring','0|0|off')
             bloc2=[modele,'/declenchement'];
             set_param(bloc2,'foregroundcolor','white')
             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);
            sbai1=[s,'/Analog Input1'];
             set_param(sbai1,'drvname',carte_entree);
            set_param(sbai1,'voltrange',plage_entree);
            sbdo=[s,'/Digital Output'];
            set_param(sbdo,'drvname',carte_digit);
            set_param(gcs,'SimulationMode','external');
            set_param(gcs,'ExtMode','on');
            duration=get_param(gcs,'ExtModeTrigDuration');
            if duration<2^(m+1)
                set_param(gcs,'ExtModeTrigDuration',2^(m+1));
            end;

            delete(gcf)
            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(bloc1,'foregroundcolor','red')
            set_param(bloc2,'foregroundcolor','red')
            set_param(gcs,'SimulationCommand','start') 
    end;
end;
[tim,dum,dum,drv,slice,perf,dum,dum,mach]=rttool('read',0,'timers');
[per,dum,dumnrun]=rttool('read',tim,'period');
DEF(10)=per;

Contact us