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
|
/* autogenerated from "macros/Misc/scifunc_block.sci" */
function scifunc_block() {
scifunc_block.prototype.define = function scifunc_block() {
in1 = 1;
out = 1;
clkin = [];
clkout = [];
x0 = [];
z0 = [];
typ = "c";
auto = [];
rpar = [];
model = scicos_model();
model.sim = list("scifunc",3);
model.in1 = in1;
model.out = out;
model.evtin = clkin;
model.evtout = clkout;
model.state = x0;
model.dstate = z0;
model.rpar = rpar;
model.ipar = 0;
model.opar = list();
model.blocktype = typ;
model.firing = auto;
model.dep_ut = [true,false];
exprs = list([[sci2exp(in1)],[sci2exp(out)],[sci2exp(clkin)],[sci2exp(clkout)],[strcat(sci2exp(x0))],[strcat(sci2exp(z0))],[strcat(sci2exp(rpar))],[sci2exp(auto)]],list("y1=sin(u1)"," "," ","y1=sin(u1)"," "," "," "));
gr_i = [];
this.x = standard_define([2,2],model,exprs,gr_i);
}
scifunc_block.prototype.details = function scifunc_block() {
return this.x;
}
scifunc_block.prototype.get = function scifunc_block() {
}
scifunc_block.prototype.set = function scifunc_block() {
needcompile = 0;
this.x = arg1;
model = arg1.model;
graphics = arg1.graphics;
exprs = graphics.exprs;
if (size(exprs[1-1],"*")==8) {
exprs[1-1][9-1] = "0";
}
while (true) {
[ok,i,o,ci,co,xx,z,rpar,auto0,deptime,lab] = scicos_getvalue([["Set scifunc_block parameters"],["only regular blocks supported"]],[["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["System parameters vector"],["initial firing vector (<0 for no firing)"],["is block always active (0:no, 1:yes)"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%4)","vec",1),exprs[1-1]);
if (!ok) {
break;
}
exprs[1-1] = lab;
xx = xx.slice();
z = z.slice();
rpar = rpar.slice();
nrp = prod(size(rpar));
i = int(i.slice());
ni = size(i,1);
o = int(o.slice());
no = size(o,1);
ci = int(ci.slice());
nci = size(ci,1);
co = int(co.slice());
nco = size(co,1);
[ok,tt,dep_ut] = genfunc1(exprs[2-1],i,o,nci,nco,size(xx,1),size(z,1),nrp,"c");
dep_ut[2-1] = (1==deptime);
if (!ok) {
break;
}
[model,graphics,ok] = check_io(model,graphics,i,o,ci,co);
if (ok) {
auto = auto0;
model.state = xx;
model.dstate = z;
model.rpar = rpar;
if (model.ipar!=0) {
model.opar = model.ipar;
model.ipar = 0;
}
if (or(model.opar!=tt)) {
needcompile = 4;
}
model.opar = tt;
model.firing = auto;
model.dep_ut = dep_ut;
this.x.model = model;
exprs[2-1] = tt;
graphics.exprs = exprs;
this.x.graphics = graphics;
break;
}
}
needcompile=resume(needcompile)
}
}
|