summaryrefslogtreecommitdiff
path: root/js/Sources/RAMP.js
blob: 8090618ac22554f3f69be3a77d1e1e63241b04f2 (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
/* autogenerated from "macros/Sources/RAMP.sci" */
function RAMP() {
    RAMP.prototype.define = function RAMP() {
        this.slope = 0;
        this.iout = 0;
        this.stt = 0;
        rpar = [[this.slope],[this.stt],[this.iout]];
        this.model = scicos_model();
        this.model.sim = list(new ScilabString(["ramp"]), new ScilabDouble([4]));
        this.model.in1 = [];
        this.model.out = new ScilabDouble([1]);
        this.model.rpar = rpar;
        this.model.blocktype = new ScilabString(["c"]);
        this.model.nmode = new ScilabDouble([1]);
        this.model.nzcross = new ScilabDouble([1]);
        this.model.dep_ut = [false,true];
        exprs = [string(rpar)];
        gr_i = [];
        this.x = standard_define([2,2],this.model,exprs,gr_i);
        return new BasicBlock(this.x);
    }
    RAMP.prototype.details = function RAMP() {
        return this.x;
    }
    RAMP.prototype.get = function RAMP() {
        var options = {
            slope:["Slope",this.slope],
            stt:["Start Time",this.stt],
            iout:["Initial Value",this.iout],
        }
        return options;
    }
    RAMP.prototype.set = function RAMP() {
        this.slope = parseFloat(arguments[0]["slope"])
        this.stt = parseFloat(arguments[0]["stt"])
        this.iout = parseFloat(arguments[0]["iout"])
        this.x = arg1;
        graphics = arg1.graphics;
        exprs = graphics.exprs;
        this.model = arg1.model;
        while (true) {
            [ok,this.slope,this.stt,this.iout,exprs] = scicos_getvalue([[msprintf("Set %s block parameters","RAMP")],[" "],["Ramp function"],[" "]],["Slope","Start Time","Initial Value"],list("vec",1,"vec",1,"vec",1),exprs);
            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 = [[this.slope],[this.stt],[this.iout]];
                graphics.exprs = exprs;
                this.x.graphics = graphics;
                this.x.model = this.model;
                break;
            }
        }
        return new BasicBlock(this.x);
    }
}