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
|
function BOUNCE() {
BOUNCE.prototype.define = function BOUNCE() {
this.n = 2;
this.k = 0;
this.ipar = [];
for (var i = 1; i <= this.n; i++) {
for (var j = i + 1; j <= this.n; j++) {
this.ipar[this.k] = [i];
this.k++;
this.ipar[this.k] = [j];
this.k++;
}
}
this.walls = [[0],[5],[0],[5]];
this.x1 = [[2],[2.5]];
this.xd = [[0],[0]];
this.y1 = [[3],[5]];
this.yd = [[0],[0]];
this.g = 9.81;
this.C = 0;
this.rpar1 = ones(this.n, 1);
this.rpar2 = this.rpar1;
this.state = [...math.transpose(this.x1), ...math.transpose(this.xd), ...math.transpose(this.y1), ...math.transpose(this.yd)];
var model = scicos_model();
model.sim = list(new ScilabString(["bounce_ball"]), new ScilabDouble([4]));
model.in = new ScilabDouble();
model.out = new ScilabDouble([this.n], [this.n]);
model.state = new ScilabDouble(...colon_operator(this.state));
model.rpar = new ScilabDouble(...this.rpar1, ...this.rpar2, ...this.walls, [this.g], [this.C]);
model.ipar = new ScilabDouble(...this.ipar);
model.nzcross = new ScilabDouble([this.n * (this.n - 1) / 2 + 4 * this.n]);
model.blocktype = new ScilabString(["c"]);
model.dep_ut = new ScilabBoolean([false, true]);
var exprs = new ScilabString([sci2exp(this.rpar1)], [sci2exp(this.rpar2)], [sci2exp(this.walls)], [sci2exp(this.x1)], [sci2exp(this.xd)], [sci2exp(this.y1)], [sci2exp(this.yd)]);
var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"BOUNCE\",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i);
return new BasicBlock(this.x);
}
BOUNCE.prototype.details = function BOUNCE() {
return this.x;
}
}
|