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
|
/* autogenerated from "macros/Events/M_freq.sci" */
function M_freq() {
M_freq.prototype.define = function M_freq() {
this.model = scicos_model();
this.model.sim = list(new ScilabString(["m_frequ"]), new ScilabDouble([4]));
this.model.evtout = new ScilabDouble([1],[1],[1]);
this.model.evtin = new ScilabDouble([1]);
this.model.rpar = [];
this.model.opar = list([[1,1,0],[1,1,1],[1,3,2]], new ScilabDouble([1]), new ScilabDouble([0]), new ScilabDouble([0]));
this.model.blocktype = new ScilabString(["d"]);
this.model.firing = [0,-1,-1];
this.model.dep_ut = [false,false];
exprs = [[sci2exp([[1],[2]])],[sci2exp([[0],[0]])]];
gr_i = [];
this.x = standard_define([3,2],this.model,exprs,gr_i);
return new BasicBlock(this.x);
}
M_freq.prototype.details = function M_freq() {
return this.x;
}
M_freq.prototype.get = function M_freq() {
var options = {
frequ:["Sample time",this.frequ],
offset:["Offset",this.offset],
}
return options;
}
M_freq.prototype.set = function M_freq() {
this.frequ = inverse(arguments[0]["frequ"])
this.offset = inverse(arguments[0]["offset"])
this.x = arg1;
graphics = arg1.graphics;
this.model = arg1.model;
exprs = graphics.exprs;
while (true) {
[ok,this.frequ,this.offset,exprs] = scicos_getvalue("Set block parameters",["Sample time","Offset"],list("vec",-1,"vec",-1),exprs);
if (!ok) {
break;
}
this.offset = this.offset.slice();
this.frequ = this.frequ.slice();
if ((size(this.frequ,"*"))!=(size(this.offset,"*"))) {
message("offset and frequency must have the same size");
ok = false;
} else if (or(this.frequ<0)) {
message("Frequency must be a positif number");
ok = false;
} else if (or(abs(this.offset)>this.frequ)) {
message("The |Offset| must be less than the Frequency");
ok = false;
}
if (ok) {
[m,den,off,count,m1,fir,this.frequ,this.offset,ok] = mfrequ_clk(this.frequ,this.offset);
}
if (ok) {
this.model.opar = list(m, new ScilabDouble([double(den)]), new ScilabDouble([off]), new ScilabDouble([count]));
mn = (2^size(m1,"*"))-1;
[this.model,graphics,ok] = set_io(this.model,graphics,list(),list(),1,ones(mn,1));
if (mn>3) {
graphics.sz = [40+(mn-3)*10,40];
} else {
graphics.sz = [50,40];
}
this.model.firing = new ScilabDouble([fir]);
graphics.exprs = exprs;
this.x.graphics = graphics;
this.x.model = this.model;
break;
}
}
return new BasicBlock(this.x);
}
}
|