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
101
102
103
104
105
106
107
108
109
|
/* autogenerated from "macros/Linear/REGISTER.sci" */
function REGISTER() {
REGISTER.prototype.define = function REGISTER() {
this.z0 = zeros(10,1);
this.model = scicos_model();
this.model.sim = list(new ScilabString(["delay4"]), new ScilabDouble([4]));
this.model.in = new ScilabDouble([1]);
this.model.out = new ScilabDouble([1]);
this.model.evtin = new ScilabDouble([1]);
this.model.dstate = new ScilabDouble([this.z0]);
this.model.blocktype = new ScilabString(["d"]);
this.model.dep_ut = new ScilabBoolean([false,false]);
var exprs = strcat(string(this.z0),";");
var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"REGISTER\",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([3,2]),this.model,new ScilabDouble([exprs]),gr_i);
return new BasicBlock(this.x);
}
REGISTER.prototype.details = function REGISTER() {
return this.x;
}
REGISTER.prototype.get = function REGISTER() {
var exprs = this.graphics.exprs;
if (size(exprs,1)==1) {
var exprs = [[exprs],[sci2exp(1)]];
}
this.set_param_popup_title = "Set delay parameters";
var options = {
z0:["Register initial condition",this.z0],
it:["Datatype (1=double 3=int32 ...)",this.it],
}
return options;
}
REGISTER.prototype.set = function REGISTER() {
var exprs = this.graphics.exprs;
if (size(exprs,1)==1) {
var exprs = [[exprs],[sci2exp(1)]];
}
while (true) {
var ok = true;
this.z0 = parseFloat(arguments[0]["z0"]);
this.it = arguments[0]["it"];
var exprs = [arguments[0]["z0"], arguments[0]["it"]];
if (!ok) {
break;
}
if (prod(size(this.z0))<1) {
message("Register length must be at least 1");
throw "user error";
var ok = false;
}
if (this.it==1) {
this.model.sim = list(new ScilabString(["delay4"]), new ScilabDouble([4]));
this.z0 = double(this.z0);
this.model.dstate = new ScilabDouble([this.z0]);
this.model.odstate = list();
} else {
if (this.it==3) {
this.model.sim = list(new ScilabString(["delay4_i32"]), new ScilabDouble([4]));
this.z0 = int32(this.z0);
} else if (this.it==4) {
this.model.sim = list(new ScilabString(["delay4_i16"]), new ScilabDouble([4]));
this.z0 = int16(this.z0);
} else if (this.it==5) {
this.model.sim = list(new ScilabString(["delay4_i8"]), new ScilabDouble([4]));
this.z0 = int8(this.z0);
} else if (this.it==6) {
this.model.sim = list(new ScilabString(["delay4_ui32"]), new ScilabDouble([4]));
this.z0 = uint32(this.z0);
} else if (this.it==7) {
this.model.sim = list(new ScilabString(["delay4_ui16"]), new ScilabDouble([4]));
this.z0 = uint16(this.z0);
} else if (this.it==8) {
this.model.sim = list(new ScilabString(["delay4_ui8"]), new ScilabDouble([4]));
this.z0 = uint8(this.z0);
} else {
message("Datatype is not supported");
throw "user error";
var ok = false;
}
this.model.odstate = list(new ScilabDouble([this.z0]));
this.model.dstate = new ScilabDouble([]);
}
if (ok) {
var in1 = [1,1];
var tmpvar0 = set_io(this.model,this.graphics,list(in1,this.it),list(in1,this.it),1,[]);
this.model = tmpvar0[0];
this.graphics = tmpvar0[1];
var ok = tmpvar0[2];
}
if (ok) {
this.graphics.exprs = new ScilabDouble(exprs);
this.x.graphics = this.graphics;
this.x.model = this.model;
break;
}
}
return new BasicBlock(this.x);
}
REGISTER.prototype.get_popup_title = function REGISTER() {
return this.set_param_popup_title;
}
REGISTER.prototype.importset = function REGISTER() {
var graphics = this.x.graphics;
var ary = getData(graphics.exprs);
this.z0 = ary[0];
this.it = ary[1];
}
REGISTER.prototype.getContainer = function REGISTER() { return new BasicBlock(this.x); }
}
|