summaryrefslogtreecommitdiff
path: root/js/Linear/CLSS_f.js
blob: 1a78799d4651224dcd643cdb884305b7e8fb3535 (plain)
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
/* autogenerated from "macros/Linear/CLSS_f.sci" */
function CLSS_f() {
    CLSS_f.prototype.define = function CLSS_f() {
        x0 = 0;
        A = -1;
        B = 1;
        C = 1;
        D = 0;
        in1 = 1;
        out = 1;
        model = scicos_model();
        model.sim = list("csslti",1);
        model.in1 = in1;
        model.out = out;
        model.state = x0;
        model.rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]];
        model.blocktype = "c";
        model.dep_ut = [false,true];
        exprs = [[strcat(sci2exp(A))],[strcat(sci2exp(B))],[strcat(sci2exp(C))],[strcat(sci2exp(D))],[strcat(sci2exp(x0))]];
        gr_i = [];
        x = standard_define([4,2],model,exprs,gr_i);
    }
    CLSS_f.prototype.details = function CLSS_f() {
    }
    CLSS_f.prototype.get = function CLSS_f() {
    }
    CLSS_f.prototype.set = function CLSS_f() {
        x = arg1;
        graphics = arg1.graphics;
        exprs = graphics.exprs;
        if (size(exprs,"*")==7) {
        exprs = exprs[[1:4,7]-1];
}
        model = arg1.model;
        while (true) {
        [ok,A,B,C,D,x0,exprs] = scicos_getvalue("Set continuous linear system parameters",[["A matrix"],["B matrix"],["C matrix"],["D matrix"],["Initial state"]],list("mat",[-1,-1],"mat",["size(%1,2)","-1"],"mat",["-1","size(%1,2)"],"mat",[-1,-1],"vec","size(%1,2)"),exprs);
        if (!ok) {
break;
}
        out = size(C,1);
        if (out==0) {
        out = [];
}
        in1 = size(B,2);
        if (in1==0) {
        in1 = [];
}
        [ms,ns] = size(A);
        if (ms!=ns) {
message("A matrix must be square");
        } else {
        [model,graphics,ok] = check_io(model,graphics,in1,out,[],[]);
        if (ok) {
        graphics.exprs = exprs;
        rpar = [[A.slice()],[B.slice()],[C.slice()],[D.slice()]];
        if (D!=[]) {
        if (norm(D,1)!=0) {
        mmm = [true,true];
        } else {
        mmm = [false,true];
}
        if (or(model.dep_ut!=mmm)) {
        model.dep_ut = mmm;
}
        } else {
        model.dep_ut = [false,true];
}
        model.state = x0.slice();
        model.rpar = rpar;
        x.graphics = graphics;
        x.model = model;
break;
}
}
}
    }
}