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

def_param_smith.m
function [MOG,DEF,P_smith,P_ret,fe]=def_param_smith(fei)


fe=fei;
MOG=zeros(4,17);
DEF=zeros(10,1);
NUMR=[1 1];
DENR=[0.1 1];
H=tf(NUMR,DENR);
Hd=c2d(H,1/fe,'tustin');
[NUMRZ,DENRZ]=tfdata(Hd,'v');
NUMG=[0 1];
DENG=[1 1];
Hp=tf(NUMG,DENG);
Hdp=c2d(Hp,1/fe,'tustin');
[NUMGZ,DENGZ]=tfdata(Hdp,'v');
P_smith=[NUMR;DENR;NUMRZ;DENRZ;NUMG;DENG;NUMGZ;DENGZ;[0 0]];
P_ret=zeros(1,5000);
P_ret(1)=1;
figure(1)
e=ecran;
set(gcf,'position',e)
set(gcf,'unit','normalized','color','w')
grid off
set(gca,'xcolor','w','ycolor','w')
pause(0.1)
s='Paramtres';
text(0.5,0.97,s,'color','r','fontunits','normalized','fontsize',0.03,...
    'fontweight','bold','horizontalalignment','center',...
    'verticalalignment','middle');
text(0.01,1,'R_0(p)','color','b','fontunits','normalized','fontsize',0.03,...
    'fontweight','bold','horizontalalignment','left',...
    'verticalalignment','middle','interpreter','Tex');

MOG(2,1)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.02 0.85 0.4 0.05],...
    'backgroundcolor','w',...
	'foregroundcolor','b',...
    'string','Dfinition des coefficients du numrateur',...
    'fontunits','normalized','fontsize',0.5,'fontweight','bold');

sn='NUM=[1,1]';    
MOG(1,1)=uicontrol(gcf,'style','edit',...
    'unit','normalized',...
	'position',[0.02 0.8 0.5 0.05],...
    'backgroundcolor','y',...
	 'foregroundcolor','b',...
    'string',sn,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
	'callback','sn=get(MOG(1,1),''string'');');
MOG(2,3)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.02 0.75 0.4 0.05],...
    'backgroundcolor','w',...
	'foregroundcolor','b',...
    'string','Dfinition des coefficients du dnominateur',...
    'fontunits','normalized','fontsize',0.5,'fontweight','bold');
sd='DEN=[0.1,1]'; 
MOG(1,2)=uicontrol(gcf,'style','edit',...
    'unit','normalized',...
	'position',[0.02 0.7 0.5 0.05],...
    'backgroundcolor','y',...
	 'foregroundcolor','b',...
    'string',sd,'fontunits','normalized','fontsize',0.5,'fontweight','bold');
text(0.01,0.65,'G_0(p)','color','b','fontunits','normalized','fontsize',0.03,...
    'fontweight','bold','horizontalalignment','left',...
    'interpreter','Tex',...
    'verticalalignment','middle');

MOG(2,2)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.02 0.55 0.4 0.05],...
    'backgroundcolor','w',...
	 'foregroundcolor','b',...
     'string','Dfinition des coefficients du numrateur',...
     'fontunits','normalized','fontsize',0.5,'fontweight','bold');


sn='NUM=[1]';    
MOG(3,1)=uicontrol(gcf,'style','edit',...
    'unit','normalized',...
	'position',[0.02 0.5 0.5 0.05],'backgroundcolor','y',...
	 'foregroundcolor','b',...
    'string',sn,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
	'callback','sn=get(MOG(3,1),''string'');');
MOG(3,3)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.02 0.45 0.4 0.05],...
    'backgroundcolor','w',...
	 'foregroundcolor','b',...
     'string','Dfinition des coefficients du dnominateur',...
     'fontunits','normalized','fontsize',0.5,'fontweight','bold');
sd='DEN=[1,1]'; 
MOG(3,2)=uicontrol(gcf,'style','edit',...
    'unit','normalized',...
	'position',[0.02 0.4 0.5 0.05],...
    'backgroundcolor','y',...
	 'foregroundcolor','b',...
	'string',sd,'fontunits','normalized','fontsize',0.5,'fontweight','bold');
sltd='retard T (s)';           
MOG(4,3)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.02 0.30 0.1 0.05],...
    'backgroundcolor','y',...
	'foregroundcolor','b','string',sltd,...
    'fontunits','normalized','fontsize',0.5,'fontweight','bold');
std='0.25';    
text(0.155,0.25,'(T limit  5000*T_E)',...
    'color','b','fontunits','normalized','fontsize',0.03,...
    'fontweight','bold','horizontalalignment','left',...
    'verticalalignment','middle','interpreter','Tex');
MOG(1,5)=uicontrol(gcf,'style','edit',...
    'unit','normalized',...
	'position',[0.14 0.30 0.1 0.05],...
    'backgroundcolor','y',...
	'foregroundcolor','b',...
	'string',std,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
	'callback','std=get(MOG(1,5),''string'');Retard=str2num(std);P_smith(9,1)=Retard;');
sf='Fe (Hz)';           
MOG(2,5)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.02 0.2 0.1 0.05],...
    'backgroundcolor','y',...
	'foregroundcolor','b','string',sf,...
    'fontunits','normalized','fontsize',0.5,'fontweight','bold');
sfe=num2str(fe);           
MOG(1,9)=uicontrol(gcf,'style','edit',...
    'unit','normalized',...
	'position',[0.14 0.2 0.21 0.05],...
    'backgroundcolor','y',...
	'foregroundcolor','b',...
	'string',sfe,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
	'callback','sfe=get(MOG(1,9),''string'');fe=str2num(sfe);DEF(1)=1/fe;');

text(0.6,0.85,'ENREGISTREMENT',...
    'color','b','fontunits','normalized','fontsize',0.03,...
    'fontweight','bold','horizontalalignment','left',...
    'verticalalignment','middle','interpreter','Tex')
sve='Ve';
MOG(2,6)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.6 0.65 0.05 0.05],...
	 'foregroundcolor','b','string',sve,'fontunits','normalized','fontsize',0.5,...
     'fontweight','bold');
MOG(1,10)=uicontrol(gcf,'style','checkbox',...
    'unit','normalized',...
	'position',[0.66 0.65 0.05 0.05],...
     'Max',1,'Min',0,...
     'callback','pve=get(MOG(1,10),''Value'');');    
svs='Vs';
MOG(2,7)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.8 0.65 0.05 0.05],...
	'foregroundcolor','b','string',svs,'fontunits','normalized','fontsize',0.5,...
     'fontweight','bold');
MOG(1,11)=uicontrol(gcf,'style','checkbox',...
    'unit','normalized',...
	'position',[0.86 0.65 0.05 0.05],...
     'Max',1,'Min',0,...
     'callback','pvs=get(MOG(1,11),''Value'');');  
se='E';
MOG(2,8)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.6 0.55 0.05 0.05],...
	 'foregroundcolor','b','string',se,'fontunits','normalized','fontsize',0.5,...
     'fontweight','bold');
MOG(1,12)=uicontrol(gcf,'style','checkbox',...
    'unit','normalized',...
	'position',[0.66 0.55 0.05 0.05],...
     'Max',1,'Min',0,...
     'callback','pe=get(MOG(1,12),''Value'');');    
sec='Ec';
MOG(2,9)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.8 0.55 0.05 0.05],...
	 'foregroundcolor','b','string',sec,'fontunits','normalized','fontsize',0.5,...
     'fontweight','bold');
MOG(1,13)=uicontrol(gcf,'style','checkbox',...
    'unit','normalized',...
	'position',[0.86 0.55 0.05 0.05],...
    'Max',1,'Min',0,...
    'callback','pec=get(MOG(1,13),''Value'');');   
sd='Dure (s)';           
MOG(2,10)=uicontrol(gcf,'style','text',...
    'unit','normalized',...
	'position',[0.6 0.45 0.2 0.05],...
    'backgroundcolor','y',...
	'foregroundcolor','b','string',sd,...
    'fontunits','normalized','fontsize',0.5,'fontweight','bold');
text(0.6,0.4,'100 000 points maximum',...
    'fontunits','normalized','fontsize',0.027,'fontweight','bold','color','r')      
sduree='1';           
MOG(1,14)=uicontrol(gcf,'style','edit',...
    'unit','normalized',...
	'position',[0.85 0.45 0.1 0.05],...
    'backgroundcolor','y',...
	'foregroundcolor','b',...
    'string',sduree,'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
	'callback','sduree=get(MOG(1,14),''string'');D=str2num(sduree);DEF(2)=D;');
    
text(0.6,0.35,'SYNCHRONISATION',...
    'color','b','fontunits','normalized','fontsize',0.03,...
    'fontweight','bold','horizontalalignment','left',...
    'verticalalignment','middle')
MOG(1,15)=uicontrol(gcf,'style','checkbox',...
    'unit','normalized',...
	'position',[0.86 0.35 0.05 0.05],...
     'Max',1,'Min',0,...
     'callback','synchro=get(MOG(1,15),''Value'');');   
synchro=get(MOG(1,15),'Value');
DEF(4)=synchro;
sfe=get(MOG(1,9),'string');
fe=str2num(sfe);
te=1/fe;
DEF(1)=te;
pve=get(MOG(1,10),'Value');
pvs=get(MOG(1,11),'Value');
pe=get(MOG(1,12),'Value');
pec=get(MOG(1,13),'Value');
courbes=pve+2*pvs+2^2*pe+2^3*pec;
DEF(7)=courbes;
sd=get(MOG(1,14),'string');
duree=str2num(sd);
N=round(duree/te);
DEF(3)=N;
    
%**************** Bouton "OK" de validation
boutonok=uicontrol(gcf,'style','push',...
    'unit','normalized',...
	'position',[0.8 0.05 0.1 0.05],...
	 'string','OK','foregroundcolor','r',...
     'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
      'callback','[MOG,DEF,P_smith,P_ret]=test_param_smith(MOG,DEF,P_smith,P_ret);');


%*************** bouton "FIN" : sortie du logiciel    
boutonfin=uicontrol(gcf,'style','push',...
    'unit','normalized',...
	'position',[0.1 0.05 0.1 0.05],...
	'string','FIN','foregroundcolor','r',...
    'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
     'callback','fin;liste_logiciels');
 boutonschema=uicontrol(gcf,'style','push',...
     'unit','normalized',...
	'position',[0.5 0.05 0.1 0.05],...
	'string','MONTAGE','foregroundcolor','r',...
    'fontunits','normalized','fontsize',0.5,'fontweight','bold',...
     'callback','schema_anal_smith(DEF)');   
    

Contact us