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

ouvre_tt_y_t.m
function [MOG,DEF,G]=ouvre_tt_y_t(MOGi,DEFi,Gi)

MOG=MOGi;
DEF=DEFi;
G=Gi;
switch DEF(8)
    case 1
        modele='table_yi_t';
    case 2
        modele='table_yi_t_diff';
end;
repertoire=pwd;
cd ..
A=load('parametres_carte.mat');
cd(repertoire)
carte_entree=A.S.entree.carte;
plage_entree=num2str(A.S.entree.pop);
open_system([modele,'.mdl'])
set_param(gcs,'solver','FixedStepDiscrete')
set_param(gcs,'StartTime','0') 
set_param(gcs,'StopTime','Inf')
set_param(gcs,'SystemTargetFile','rtwin.tlc') 
s=modele;
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);
sbai2=[s,'/Analog Input2'];
set_param(sbai2,'drvname',carte_entree);
set_param(sbai2,'voltrange',plage_entree);
sbai3=[s,'/Analog Input3'];
set_param(sbai3,'drvname',carte_entree);
set_param(sbai3,'voltrange',plage_entree);
switch DEF(8)
    case 1
        set_param(sbai,'drvoptions','[0 0 0 0 0]');
        set_param(sbai1,'drvoptions','[0 0 0 0 0]');
        set_param(sbai2,'drvoptions','[0 0 0 0 0]');
        set_param(sbai3,'drvoptions','[0 0 0 0 0]');
    case 2
        set_param(sbai,'drvoptions','[1 0 0 0 0]');
        set_param(sbai1,'drvoptions','[1 0 0 0 0]');
        set_param(sbai2,'drvoptions','[1 0 0 0 0]');
        set_param(sbai3,'drvoptions','[1 0 0 0 0]');
end;
set_param(gcs,'SimulationMode','external');
set_param(gcs,'ExtMode','on');
duration=100000;
set_param(gcs,'ExtModeTrigDuration',duration);
scopeBlk = [modele,'/Scope'];
set_param(scopeBlk,'LimitDataPoints','on');
set_param(scopeBlk,'MaxDataPoints','12501');
%*** On ouvre le bloc Scope
open_system(scopeBlk)
% rcupration du handle scope_figure
MOG(1,6)= get_param(scopeBlk, 'Figure');
% prparation de la scope_figure
% taille, couleur du fond, etc...
set(MOG(1,6),'color','white');
e=ecran;
p_ecran=[e(1)+10,e(4)/2,e(3)/2,e(4)/2];
set(MOG(1,6),'position',e)
pause(0.1)
n_fig=get(MOG(1,6),'name');
% On affiche dans le titre
% la position du zro de chaque voie
for k=1:1:DEF(1)
    zs=get_param([get_param(gcs,'name'),'/Constant',num2str(k+1)],'value');
    n_fig=[n_fig,'   VOIE',num2str(k),' : zro = ',zs,' cm'];
end;
pause(0.1)
set(MOG(1,6),'name',n_fig);
% rcupration du handle
% axes de scope_figure
MOG(6,1)=get(MOG(1,6),'currentaxes');
% dfinition des proprits axes
set(MOG(6,1),'xcolor',[0.5 0.5 0.5],'ycolor',[0.5 0.5 0.5],'color','black');
set(MOG(6,1),'Ylim',[-7.5,7.5])
set(MOG(6,1),'position',p_ecran);
pause(0.1)
choix_txt_bdt={'','20 ms/cm','50 ms/cm','0,1 s/cm','0,2 s/cm','0,5 s/cm','1 s/cm','2 s/cm','5 s/cm','10 s/cm','20 s/cm'};
bdt=[20e-3,50e-3,0.1,0.2,0.5,1,2,5,10,20];
p_bdt=[0.55,0.9,0.2,0.1];
% choix de la BdT
txt_bdt_titre=uicontrol(MOG(1,6),'style','text','unit','normalized',...
		            'position',p_bdt,'backgroundcolor','w',...
	                'foregroundcolor','b','fontunits','normalized','fontsize',0.3,'fontweight','bold','string','Base de Temps');
p_popup=[0.6,0.8,0.1,0.1];
MOG(1,2)=uicontrol(MOG(1,6),'style','popupmenu','unit','normalized','position',p_popup,...
                    'string',choix_txt_bdt,'backgroundcolor','w',...
	                'foregroundcolor','r','fontunits','normalized','fontsize',0.3,'fontweight','bold');
% choix synchro OUI ou NON                
p_synchro=[0.55,0.7,0.2,0.1];             
 txt_synchro=uicontrol(MOG(1,6),'style','text','unit','normalized',...
		            'position',p_synchro,'backgroundcolor','w',...
	                'foregroundcolor','b','fontunits','normalized','fontsize',0.3,'fontweight','bold','string','Synchro (Y1)');   
s={'','NON','OUI'};
MOG(1,3)=uicontrol(MOG(1,6),'style','popupmenu','unit','normalized','position',[0.7,0.7,0.1,0.1],...
                    'string',s,'backgroundcolor','w',...
	                'foregroundcolor','r','fontunits','normalized','fontsize',0.3,'fontweight','bold',...
                    'callback','[MOG,DEF]=synchro(MOG,DEF);');
choix_calibre_y={'','2 V/cm','1 V/cm','0,5 V/cm','0,2 V/cm','0,1 V/cm','50 mV/cm','20 mV/cm','VAR'};
calibre_y=[2,1,0.5,0.2,0.1,0.05,0.02,1];
% Choix des calibres des voies Y
for k=1:1:min(DEF(1),4)
    p_y=[0.25*(k-1)+0.125,0.35,0.1,0.1];
    s=['VOIE Y',num2str(k)];
    txt_y_titre=uicontrol(MOG(1,6),'style','text','unit','normalized',...
		            'position',p_y,'backgroundcolor','w',...
	                'foregroundcolor','b','fontunits','normalized','fontsize',0.25,'fontweight','bold','string',s);
    p_p=[0.25*(k-1)+0.125,0.30,0.1,0.1];   
    MOG(1+k,2)=uicontrol(MOG(1,6),'style','popupmenu','unit','normalized','position',p_p,...
                    'string',choix_calibre_y,'backgroundcolor','w',...
	                'foregroundcolor','r','fontunits','normalized','fontsize',0.25,...
                    'fontweight','bold');
       
end
MOG(12,1)=uicontrol(MOG(1,6),'style','text','unit','normalized','position',[0.02,0.18,0.06,0.05],...
           'backgroundcolor','w','string','Filtrage ?','foregroundcolor','b','fontunits','normalized','fontsize',0.4,'fontweight','bold');
% Filtrage (oui ou non) pour chaque voie
for k=1:1:min(DEF(1),4)
    p_p=[0.25*(k-1)+0.125,0.18,0.05,0.03]; 
    s={'','NON','OUI'};
    MOG(12,2+k)=uicontrol(MOG(1,6),'style','popupmenu','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',s,'foregroundcolor','r','fontunits','normalized','fontsize',0.6,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');MOG=nombre_point(MOG,K);'); 
end;
% Rglage zero de chaque voie
% gros (+ ou - 1 cm)
% ou fin (+ ou - 0,5 mm)
for k=1:1:min(DEF(1),4)
   p_p=[0.25*(k-1)+0.125,0.33,0.05,0.03]; 
    MOG(3,2+k)=uicontrol(MOG(1,6),'style','push','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',['+1cm'],'foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');MOG=regle_zero2(3,K,G,MOG);'); 
   p_p=[0.25*(k-1)+0.125,0.30,0.05,0.03]; 
    MOG(4,2+k)=uicontrol(MOG(1,6),'style','push','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',['-1cm'],'foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');MOG=regle_zero2(4,K,G,MOG);');   
     p_p=[0.25*(k-1)+0.175,0.33,0.05,0.03]; 
    MOG(5,2+k)=uicontrol(MOG(1,6),'style','push','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',['+1/2mm'],'foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');MOG=regle_zero2(5,K,G,MOG);'); 
   p_p=[0.25*(k-1)+0.175,0.30,0.05,0.03]; 
    MOG(6,2+k)=uicontrol(MOG(1,6),'style','push','unit','normalized','position',p_p,'userdata',k,...
                    'backgroundcolor','w','string',['-1/2mm'],'foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
                    'callback','K=get(gco,''userdata'');MOG=regle_zero2(6,K,G,MOG);');  
    p_p=[0.25*(k-1)+0.05,0.32,0.05,0.03];
    MOG(2,2+k)=uicontrol(MOG(1,6),'style','text','unit','normalized','position',p_p,...
                    'backgroundcolor','w','string','ZERO','foregroundcolor','b','fontunits','normalized','fontsize',0.6,'fontweight','bold');
end;

MOG(8,1)=uicontrol(MOG(1,6),'style','push','unit','normalized',...
		'position',[0.9 0.9 0.1 0.05],...
	    'string','OK','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','[MOG,DEF,G]=lance_tt(MOG,DEF,G);');
MOG(9,1)=uicontrol(MOG(1,6),'style','push','unit','normalized',...
		'position',[0.9 0.8 0.1 0.05],...
	    'string','STOP','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','[MOG,DEF,G]=stop_tt(MOG,DEF,G);');
MOG(10,1)=uicontrol(MOG(1,6),'style','push','unit','normalized',...
		'position',[0.9 0.7 0.1 0.05],...
	    'string','MENU','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','close_system(gcs,0);[MOG,DEF,G]=table_menu(MOG,DEF,G);');

MOG(11,1)=uicontrol(MOG(1,6),'style','push','unit','normalized',...
		'position',[0.9 0.6 0.1 0.05],...
	    'string','FIN','foregroundcolor','r','fontunits','normalized','fontsize',0.5,'fontweight','bold',...
        'callback','[MOG,DEF,G]=stop_tt(MOG,DEF,G);close_system(gcs,0);cd ..;');

Contact us