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_tt_xy.m
function [MOG,DEF,G]=lance_tt_xy(MOGi,DEFi,Gi)


MOG=MOGi;
DEF=DEFi;
G=Gi;
set(MOG(8,1),'KeyPressFcn',{@lance_enregistrement_xy,MOG,DEF});
% on enlve le bouton PLOT
if MOG(10,2)~=0
    delete(MOG(10,2));
    MOG(10,2)=0;
end;
etat=get_param(gcs,'simulationstatus');
if strcmp(etat,'stopped')
    modele=get_param(gcs,'name');
    fes=get(MOG(1,2),'string');
    DEF(4)=1/str2num(fes);
    modele=get_param(gcs,'name');
    sbai=[modele,'/Analog Input'];
    set_param(sbai,'sampletime',num2str(DEF(4)));
    sbai1=[modele,'/Analog Input1'];
    set_param(sbai1,'sampletime',num2str(DEF(4)));
    bloc=[modele,'/XY Graph'];
    set_param(bloc,'st',num2str(DEF(4)));
     bloc=[modele,'/Constant'];
    set_param(bloc,'sampletime',num2str(DEF(4)));
     bloc=[modele,'/Constant1'];
    set_param(bloc,'sampletime',num2str(DEF(4)));
% rglage du gain de chaque voie   
    calibre_y=[2,1,0.5,0.2,0.1,0.05,0.02,1];
    for k=1:1:2
        if MOG(7,k+2)==0
            cal_y=get(MOG(1+k,2),'value');
            G(k)=1/calibre_y(cal_y-1);
            bloc=[get_param(gcs,'name'),'/Gain'];
            if k~=1
                bloc=[bloc,num2str(k-1)];
            end;
            set_param(bloc,'Gain',num2str(G(k)));
        end;
    end;
    for k=1:1:2
        set(MOG(1+k,2),'Enable','on');       
    end;
    set(MOG(1,2),'Enable','on');       
    set_param(gcs,'fixedstep','auto')
    filtre=[modele,'/Filtre'];
 % paramtrage filtres
    set_param(filtre,'te',num2str(DEF(4)));
    for k=2:1:2
        filtre=[modele,'/Filtre',num2str(k-1)];
        set_param(filtre,'te',num2str(DEF(4)));
    end;
   
    for k=1:1:2
        v=get(MOG(12,2+k),'value');
        if v==3
            set(MOG(11,2+k),'Enable','on');  
            Nb=get(MOG(11,2+k),'string');
        else
            Nb='1';
        end;
        filtre=[modele,'/Filtre'];
        if k~=1
            filtre=[filtre,num2str(k-1)];
        end;
        set_param(filtre,'N',Nb);
    end;
    s=get_param(gcs,'parent');
    if isempty(s)
        modele=get_param(gcs,'name');
    else
        modele=s;
    end;
    
    if faut_il_recompiler
                 MOG(7,1)=uicontrol(MOG(1,6),'style','text','unit','normalized',...
		            'position',[0.1,0.01,0.8,0.05],'backgroundcolor','w',...
	                'foregroundcolor','r','fontunits','normalized','fontsize',0.4,'fontweight','bold','string','COMPILATION EN COURS');
                pause(0.1)
                rtwbuild(gcs);
                delete(MOG(7,1))
    end;
    set_param(gcs,'SimulationCommand','connect');  
end;
MOG(7,1)=uicontrol(MOG(1,6),'style','text','unit','normalized',...
		            'position',[0.1,0.01,0.8,0.05],'backgroundcolor','w',...
	                'foregroundcolor','r','fontunits','normalized','fontsize',0.4,...
                    'fontweight','bold','string','POUR LANCER L''ENREGISTREMENT APPUYER SUR LA BARRE ESPACE');

for k=1:1:2
    y1=0.26;
    y2=0.23;
    d=1;
   
   p_p=[0.25*(k-d)+0.125,y1,0.05,0.03]; 
   cal_y=get(MOG(1+k,2),'value');
% rglage gain si VAR   
   if cal_y==9
        MOG(7,2+k)=uicontrol(MOG(1,6),'style','push','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',['+10%'],'foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');G=regle_gain(7,K,G);'); 
        p_p=[0.25*(k-d)+0.125,y2,0.05,0.03]; 
        MOG(8,2+k)=uicontrol(MOG(1,6),'style','push','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',['-10%'],'foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');G=regle_gain(8,K,G);');   
        p_p=[0.25*(k-d)+0.175,y1,0.05,0.03]; 
        MOG(9,2+k)=uicontrol(MOG(1,6),'style','push','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',['+0,5%'],'foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');G=regle_gain(9,K,G);'); 
        p_p=[0.25*(k-d)+0.175,y2,0.05,0.03]; 
        MOG(10,2+k)=uicontrol(MOG(1,6),'style','push','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',['-0,5%'],'foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');G=regle_gain(10,K,G);');
         p_p=[0.25*(k-d)+0.05,0.23,0.05,0.03];
        MOG(5+k,2)=uicontrol(MOG(1,6),'style','text','unit','normalized','position',p_p,...
                    'backgroundcolor','w','string','Calibre','foregroundcolor','b','fontunits','normalized','fontsize',0.6,'fontweight','bold');
   else
       if MOG(7,2+k)~=0
           delete(MOG(7:10,2+k));
           MOG(7:10,2+k)=zeros(4,1);
            p_p=[0.25*(k-d)+0.05,0.23,0.05,0.03];
        %MOG(7+k,6)=uicontrol(MOG(1,6),'style','text','unit','normalized','position',p_p,...
        %            'backgroundcolor','w','string','Calibre','foregroundcolor','w','fontunits','normalized','fontsize',0.6,'fontweight','bold');
       end;
   end;
             
end;



Contact us