summaryrefslogtreecommitdiff
path: root/js/Threshold/GENERAL_f.js
blob: 60c2ac11a98789008cb1982265c0f7f127a4e005 (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
/* autogenerated from "macros/Threshold/GENERAL_f.sci" */
function GENERAL_f() {
    GENERAL_f.prototype.define = function GENERAL_f() {
        var rpar = [[0],[0],[0],[0]];
        this.in1 = 1;
        this.out = 1;
        this.model = scicos_model();
        this.model.sim = list(new ScilabString(["zcross"]), new ScilabDouble([1]));
        this.model.nzcross = new ScilabDouble([this.in1]);
        this.model.in = new ScilabDouble([this.in1]);
        this.model.evtout = new ScilabDouble([ones(this.out,1)]);
        this.model.rpar = new ScilabDouble([0],[0],[0],[0]);
        this.model.blocktype = new ScilabString(["z"]);
        this.model.firing = new ScilabDouble([-ones(this.out,1)]);
        this.model.dep_ut = new ScilabBoolean([true,false]);
        this.exprs = [[strcat(sci2exp(this.in1))],[strcat(sci2exp(this.out))]];
        this.gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"GENERAL_f\",sz(1),sz(2));"]);
        this.x = new standard_define(new ScilabDouble([3,2]),this.model,this.exprs,this.gr_i);
        return new BasicBlock(this.x);
    }
    GENERAL_f.prototype.details = function GENERAL_f() {
        return this.x;
    }
    GENERAL_f.prototype.get = function GENERAL_f() {
        var options = {
        in1:["Input size",this.in1],
        out:["Number of event output",this.out],
        }
        return options;
    }
    GENERAL_f.prototype.set = function GENERAL_f() {
        this.in1 = parseFloat(arguments[0]["in1"])
        this.out = parseFloat(arguments[0]["out"])
        this.exprs = arguments[0]["exprs"]
        this.exprs = this.graphics.exprs;
        var rpar = this.model.rpar;
        this.in1 = this.model.in;
        this.out = this.model.evtout;
        var nin = sum(this.in1);
        var nout = sum(this.out);
        [ok,this.in1,this.out,this.exprs] = scicos_getvalue("Set General Zero-Crossing parameters",["Input size","Number of event output"],list("vec",1,"vec",1),this.exprs);
        if (ok) {
            var tmpvar0 = check_io(this.model,this.graphics,this.in1,[],[],ones(this.out,1));
            this.model = tmpvar0[0];
            this.graphics = tmpvar0[1];
            var ok = tmpvar0[2];
            if (ok) {
                var nout1 = this.out;
                var nin1 = this.in1;
                if (nout==nout1&&nin==nin1) {
                    var rp = matrix(rpar,nout,2^(2*nin));
                } else {
                    var rp = -1*ones(nout1,2^(2*nin1));
                }
                var n = size(rp,2)/2;
                var result = x_mdialog("routing matrix",string(1,nout1),string(1,2^(2*nin1)),string(rp.slice().slice()));
                if (result!=[]) {
                    rp.slice(1-1,nout1).slice(1-1,2*n) = evstr(result);
                    this.model.nzcross = new ScilabDouble([this.in1]);
                    this.model.rpar = new ScilabDouble(rp.slice());
                    this.model.firing = new ScilabDouble([-ones(this.out,1)]);
                    this.graphics.exprs = new ScilabDouble([this.exprs]);
                    this.x.graphics = this.graphics;
                    this.x.model = this.model;
                }
            }
        }
        return new BasicBlock(this.x);
    }
}