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