1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
function syst=analyse(scs_m)
// Analyse le graphique pour rechercher les connections
//given a block-diagram representation of a linear system bloc2exp returns
// its symbolic evaluation. The first element of the list blocd must be the
// string 'blocd'. Each other element of this list (blocd(2),blocd(3),...) is
// itself a list of one the following types :
// Copyright INRIA
// list('transfer','name_of_linear_system')
// list('link','name_of_link',
// [number_of_upstream_box,upstream_box_port],
// [downstream_box_1,downstream_box_1_portnumber],
// [downstream_box_2,downstream_box_2_portnumber],
// ...)
// The strings 'transfer' and 'links' are keywords which indicate the type of
// element in the block diagram.
nx=size(scs_m)
nb=0
syst=list()
corresp=0*ones(nx,1)
links=[]
for k=2:nx
o=scs_m(k)
if o(1)=='Block' then
model=o(3)
if model(1)=='super'|model(1)=='csuper' then
nb=nb+1
syst(nb)=analyse(model)
corresp(k)=nb
else
nb=nb+1
select o(5)
case 'GAIN_f' then
syst(nb)=list('transfer',model)
corresp(k)=nb
case 'ECLAT_f' then
syst(nb)=list('transfer',ones(3,1))
corresp(k)=nb
case 'FILTRE_f' then
syst(nb)=list('transfer',model)
corresp(k)=nb
case 'SOM_f' then
syst(nb)=list('transfer',model)
corresp(k)=nb
case 'FORMEL_f' then
syst(nb)=list('transfer',model)
corresp(k)=nb
case 'IN_f' then
nb=nb-1
case 'OUT_f' then
nb=nb-1
else
message('Non linear systems are not implemented yet')
syst(nb)=list('transfer',o(5))
corresp(k)=nb
end
end
else
links=[links k]
end
end
for k=links
o=scs_m(k)
nb=nb+1
[from,to]=o(8:9)
o1=scs_m(from(1))
o2=scs_m(to(1))
from(1)=corresp(from(1))+1
to(1)=corresp(to(1))+1
if o1(4)=='IN_f' then
syst(nb)=list('link','l'+string(nb),-1,to)
elseif o2(4)=='OUT_f' then
syst(nb)=list('link','l'+string(nb),from,-1)
else
syst(nb)=list('link','l'+string(nb),from,to)
end
end
syst(0)='blocd'
|