summaryrefslogtreecommitdiff
path: root/js/Sources/RAMP.js
blob: ff2a629348a44ba48206a51c7bcd3cac85c0e0de (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/Sources/RAMP.sci" */
function RAMP() {
    RAMP.prototype.define = function RAMP() {
        this.slope = 0;
        this.iout = 0;
        this.stt = 0;
        var rpar = [[this.slope],[this.stt],[this.iout]];
        this.model = scicos_model();
        this.model.sim = list(new ScilabString(["ramp"]), new ScilabDouble([4]));
        this.model.in = new ScilabDouble([]);
        this.model.out = new ScilabDouble([1]);
        this.model.rpar = new ScilabDouble(rpar);
        this.model.blocktype = new ScilabString(["c"]);
        this.model.nmode = new ScilabDouble([1]);
        this.model.nzcross = new ScilabDouble([1]);
        this.model.dep_ut = new ScilabBoolean([false,true]);
        var exprs = [string(rpar)];
        var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"RAMP\",sz(1),sz(2));"]);
        this.x = new standard_define(new ScilabDouble([2,2]),this.model,new ScilabString(exprs),gr_i);
        return new BasicBlock(this.x);
    }
    RAMP.prototype.details = function RAMP() {
        return this.x;
    }
    RAMP.prototype.get = function RAMP() {
        var exprs = this.graphics.exprs;
        this.set_param_popup_title = msprintf("Set %s block parameters","RAMP");
        var options = {
            slope:["Slope",this.slope],
            stt:["Start Time",this.stt],
            iout:["Initial Value",this.iout],
        }
        return options;
    }
    RAMP.prototype.set = function RAMP() {
        var exprs = this.graphics.exprs;
        while (true) {
            var ok = true;
            this.slope = parseFloat(arguments[0]["slope"]);
            this.stt = parseFloat(arguments[0]["stt"]);
            this.iout = parseFloat(arguments[0]["iout"]);
            var exprs = [arguments[0]["slope"], arguments[0]["stt"], arguments[0]["iout"]];
            if (!ok) {
                break;
            }
            if (this.stt<0) {
                block_parameter_error(msprintf("Wrong value for \'Start Time\' parameter: %e.",this.stt),"Null or positive integer expected.");
            } else {
                this.model.rpar = new ScilabDouble([this.slope],[this.stt],[this.iout]);
                this.graphics.exprs = new ScilabDouble([exprs]);
                this.x.graphics = this.graphics;
                this.x.model = this.model;
                break;
            }
        }
        return new BasicBlock(this.x);
    }
    RAMP.prototype.get_popup_title = function RAMP() {
        return this.set_param_popup_title;
    }
    RAMP.prototype.importset = function RAMP() {
        var graphics = this.x.graphics;
        var ary = getData(graphics.exprs);
        this.slope = ary[0];
        this.stt = ary[1];
        this.iout = ary[2];
    }
    RAMP.prototype.getContainer = function RAMP() { return new BasicBlock(this.x); }
}