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
|
/* autogenerated from "macros/Sources/CLOCK_c.sci" */
function CLOCK_c() {
CLOCK_c.prototype.define = function CLOCK_c() {
var evtdly = EVTDLY_c("define");
evtdly.graphics.orig = [320,232];
evtdly.graphics.sz = [40,40];
evtdly.graphics.flip = true;
evtdly.graphics.exprs = [["0.1"],["0.1"]];
evtdly.graphics.pein = 6;
evtdly.graphics.peout = 3;
evtdly.model.rpar = [[0.1],[0.1]];
evtdly.model.firing = 0.1;
var output_port = CLKOUT_f("define");
output_port.graphics.orig = [399,162];
output_port.graphics.sz = [20,20];
output_port.graphics.flip = true;
output_port.graphics.exprs = "1";
output_port.graphics.pein = 5;
output_port.model.ipar = 1;
var split = CLKSPLIT_f("define");
split.graphics.orig = [[380.71066],[172]];
split.graphics.pein = 3;
split.graphics.peout = [[5],[6]];
this.gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"CLOCK_c\",sz(1),sz(2));"]);
var diagram = scicos_diagram();
diagram.objs[1-1] = output_port;
diagram.objs[2-1] = evtdly;
diagram.objs[3-1] = scicos_link(xx=[[340],[340],[380.71]],yy=[[226.29],[172],[172]],ct=[5,-1],from=[2,1],to=[4,1]);
diagram.objs[4-1] = split;
diagram.objs[5-1] = scicos_link(xx=[[380.71],[399]],yy=[[172],[172]],ct=[5,-1],from=[4,1],to=[1,1]);
diagram.objs[6-1] = scicos_link(xx=[[380.71],[380.71],[340],[340]],yy=[[172],[302],[302],[277.71]],ct=[5,-1],from=[4,2],to=[2,1]);
this.x = scicos_block();
this.x.gui = "CLOCK_c";
this.x.graphics.sz = [2,2];
this.x.graphics.gr_i = this.gr_i;
this.x.graphics.peout = 0;
this.x.model.sim = "csuper";
this.x.model.evtout = 1;
this.x.model.blocktype = "h";
this.x.model.firing = false;
this.x.model.dep_ut = [false,false];
this.x.model.rpar = diagram;
return new BasicBlock(this.x);
}
CLOCK_c.prototype.details = function CLOCK_c() {
return this.x;
}
CLOCK_c.prototype.get = function CLOCK_c() {
var options = {
dt:["Period",this.dt],
t0:["Initialisation Time",this.t0],
}
return options;
}
CLOCK_c.prototype.set = function CLOCK_c() {
if (typeof(o)=="Block"&&o.gui=="EVTDLY_c") {
var path = i;
break;
}
}
var newpar = list();
this.exprs = xx.graphics.exprs;
this.model = xx.model;
var t0_old = this.model.firing;
var dt_old = this.model.rpar[1-1];
var model_n = this.model;
while (true) {
var ok = true;
this.dt = arguments[0]["dt"];
this.t0 = arguments[0]["t0"];
this.exprs0 = arguments[0]["exprs0"];
if (!ok) {
break;
}
if (this.dt<=0) {
block_parameter_error(msprintf("Wrong values for \'%s\' parameter: %5.1e.","Period",this.dt),"Strictly positive number expected.");
var ok = false;
}
if (ok) {
xx.graphics.exprs = this.exprs0;
this.model.rpar = new ScilabDouble([this.dt],[this.t0]);
this.model.firing = new ScilabDouble([this.t0]);
xx.model = this.model;
break;
}
}
if (!and([t0_old,dt_old]==[this.t0,this.dt])) {
newpar[size(newpar)+1-1] = path;
}
if (t0_old!=this.t0) {
var needcompile = 2;
} else {
var needcompile = 0;
}
var y = needcompile;
var typ = newpar;
return new BasicBlock(this.x);
}
}
|