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
|
/* autogenerated from "macros/Linear/CLR.sci" */
function CLR() {
CLR.prototype.define = function CLR() {
x0 = 0;
A = -1;
B = 1;
C = 1;
D = 0;
exprs = [["1"],["1+s"]];
model = scicos_model();
model.sim = list("csslti4",4);
model.in1 = 1;
model.out = 1;
model.state = x0;
model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]];
model.blocktype = "c";
model.dep_ut = [false,true];
gr_i = [];
this.x = standard_define([3,2],model,exprs,gr_i);
return new BasicBlock(this.x);
}
CLR.prototype.details = function CLR() {
return this.x;
}
CLR.prototype.get = function CLR() {
var options = {
num:["Numerator (s)",this.num],
den:["Denominator (s)",this.den],
}
return options;
}
CLR.prototype.set = function CLR() {
this.num = arguments[0]["num"]
this.den = arguments[0]["den"]
this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
x0 = model.state;
rpar = model.rpar;
ns = prod(size(x0));
nin = 1;
nout = 1;
PREVAR_scicos_context = PREVAR_scicos_context;
PREVAR_scicos_context.s = %s;
while (true) {
[ok,this.num,this.den,exprs] = scicos_getvalue("Set continuous SISO transfer parameters",["Numerator (s)","Denominator (s)"],list("pol",1,"pol",1),exprs);
if (!ok) {
break;
}
if (degree(this.num)>degree(this.den)) {
message("Transfer function must be proper or strictly proper.");
ok = false;
}
if (ok) {
H = cont_frm(this.num,this.den);
[A,B,C,D] = H.slice(2-1,5);
graphics.exprs = exprs;
[ns1,ns1] = size(A);
rpar = [[matrix(A,ns1*ns1,1)],[matrix(B,ns1,1)],[matrix(C,ns1,1)],[D]];
if (norm(D,1)!=0) {
mmm = [true,true];
} else {
mmm = [false,true];
}
if (or(model.dep_ut!=mmm)) {
model.dep_ut = mmm;
}
if (ns1<=ns) {
x0 = x0.slice(1-1,ns1);
} else {
x0[ns1-1][1-1] = 0;
}
model.state = x0;
model.rpar = rpar;
this.x.graphics = graphics;
this.x.model = model;
break;
}
}
return new BasicBlock(this.x);
}
}
|