Fonction d'interfaçage
fr
GENPULSE_f
function [x,y,typ]=GENPULSE_f(job,arg1,arg2)
// Copyright INRIA
x=[];y=[];typ=[];
select job
case 'plot' then
standard_draw(arg1)
case 'getinputs' then
[x,y,typ]=standard_inputs(arg1)
case 'getoutputs' then
[x,y,typ]=standard_outputs(arg1)
case 'getorigin' then
[x,y]=standard_origin(arg1)
case 'set' then
x=arg1;
graphics=arg1.graphics;exprs=graphics.exprs
model=arg1.model;
//if size(exprs,'*')==2 then exprs=exprs(2),end //compatibility
while %t do
[ok,Trise,Tfall,Thigh,Td,Tp,Ahigh,Alow,exprs]=getvalue([
'Set Variable Duty Cycle generator block parameters'],..
['Rise Time';'Fall Time';'Time in High State';'Delay time';..
'Period';'Value at high state';'Value in low state'],..
list('vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1,'vec',1),exprs)
if ~ok then break,end
if Tp > 0 & Tp<(Trise+Tfall+Thigh+Td) then
message('Period value too low')
else
graphics.exprs=exprs
model.dstate=Alow
model.rpar=[Trise;Tfall;Thigh;Td;Tp;Ahigh;Alow]
end
x.graphics=graphics;x.model=model
break
end
case 'define' then
Trise=0
Tfall=0
Thigh=10
Td=0
Tp=0
Ahigh=1
Alow=0
model=scicos_model()
model.sim=list('genpulse',2)
model.out=1
model.evtin=1
model.rpar=[Trise;Tfall;Thigh;Td;Tp;Ahigh;Alow]
model.dstate=Alow
model.blocktype='d'
model.dep_ut=[%f %f]
exprs=[string(Trise);string(Tfall);string(Thigh);string(Td);string(Tp);..
string(Ahigh);string(Alow)];
gr_i=['txt=[''Pulse'';''generator''];';
'xstringb(orig(1),orig(2),txt,sz(1),sz(2),''fill'');']
x=standard_define([3 2],model,exprs,gr_i)
end
endfunction