File: generic_block.sci

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (100 lines) | stat: -rw-r--r-- 2,846 bytes parent folder | download
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
88
89
90
91
92
93
94
95
96
97
98
99
100
function [x,y,typ]=generic_block(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
  model=arg1(3);graphics=arg1(2);label=graphics(4)
  if size(label)==14 then label(9)=[],end //compatiblity
  while %t do
    [ok,junction_name,funtyp,i,o,ci,co,xx,z,rpar,ipar,auto0,depu,dept,lab]=..
	getvalue('Set scifunc_block parameters',..
	['simulation function';
	'function type (0,1,2,..)';
	'input ports sizes';
	'output port sizes';
	'input event ports sizes';
	'output events ports sizes';
	'initial continuous state';
	'initial discrete state';
	'Real parameters vector';
	'Integer parameters vector';	  
	'initial firing vector (<0 for no firing)';
	'direct feedthrough (y or n)';                                       
	'time dependence (y or n)'],..
	 list('str',1,'vec',1,'vec',-1,'vec',-1,'vec',-1,'vec',-1,..
	 'vec',-1,'vec',-1,'vec',-1,'vec',-1,'vec','sum(x7)',..
	 'str',1,'str',1),label)
    if ~ok then break,end
    label=lab
    junction_name=stripblanks(junction_name)
    xx=xx(:);z=z(:);rpar=rpar(:);ipar=int(ipar(:));
    i=int(i(:));
    o=int(o(:));
    ci=int(ci(:));
    co=int(co(:));
    funtyp=int(funtyp)
    if funtyp<0 then message('function type cannot be negative');ok=%f;end
    if [ci;co]<>[] then
      if maxi([ci;co])>1 then message('vector event links not supported');ok=%f;end
    end
    depu=stripblanks(depu);if part(depu,1)=='y' then depu=%t; else depu=%f;end
    dept=stripblanks(dept);if part(dept,1)=='y' then dept=%t; else dept=%f;end
    dep_ut=[depu dept];
    if ok then
      [model,graphics,ok]=check_io(model,graphics,i,o,ci,co)
    end
    if ok then
      // AVERIFIER
      if funtyp==3 then needcompile=4;end
      //
      model(1)=list(junction_name,funtyp);
      model(6)=xx
      model(7)=z
      model(8)=rpar
      model(9)=ipar
//      needcompile=4     AVERIFIER CANEMARCHEQUAVECFORTRAN
//      model(10)=type_
      model(11)=auto0
      model(12)=dep_ut
      x(3)=model
      graphics(4)=label
      x(2)=graphics
      break
    end
  end
  needcompile=resume(needcompile)
case 'define' then
  junction_name='sinblk'
  funtyp=1;
  i=1
  o=1
  ci=[]
  co=[]
  xx=[]
  z=[]
  type_='c'
  rpar=[]
  ipar=[]
  auto0=[];
  depu='y';
  dept='n';
  model=list(list(junction_name,funtyp),i,o,ci,co,xx,z,rpar,ipar,type_,auto0,[depu dept],..
      ' ',list());
  label=[junction_name;sci2exp(funtyp);sci2exp(i);sci2exp(o);sci2exp(ci);sci2exp(co);
	sci2exp(xx);sci2exp(z);
	sci2exp(rpar);sci2exp(ipar);sci2exp(auto0);depu;dept];
  gr_i=['xstringb(orig(1),orig(2),''GENERIC'',sz(1),sz(2),''fill'');']
  x=standard_define([2 2],model,label,gr_i)
end