summaryrefslogtreecommitdiff
path: root/js/Hydraulics/Bache.js
blob: 6b6783965efc0f2a4515bf355b1f298409f5adbe (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* autogenerated from "macros/Hydraulics/Bache.sci" */
function Bache() {
    Bache.prototype.define = function Bache() {
        var in1 = 2;
        var out = 3;
        this.model = scicos_model();
        this.model.in = new ScilabDouble([-transpose([1:in1])]);
        this.model.out = new ScilabDouble([-transpose([1:out])]);
        this.Patm = 1.013e5;
        this.A = 1;
        this.ze1 = 40;
        this.ze2 = 0;
        this.zs1 = 40;
        this.zs2 = 0;
        this.z0 = 30;
        this.T0 = 290;
        this.p_rho = 0;
        this.model.rpar = new ScilabDouble([this.Patm],[this.A],[this.ze1],[this.ze2],[this.zs1],[this.zs2],[this.z0],[this.T0],[this.p_rho]);
        this.model.sim = new ScilabString(["Bache"]);
        this.model.blocktype = new ScilabString(["c"]);
        this.model.dep_ut = new ScilabBoolean([true,false]);
        var mo = modelica();
        mo.model = "Bache";
        mo.inputs = ["Ce1","Ce2"];
        mo.outputs = ["Cs1","Cs2","yNiveau"];
        mo.parameters = list([["Patm"],["A"],["ze1"],["ze2"],["zs1"],["zs2"],["z0"],["T0"],["p_rho"]],[[this.Patm],[this.A],[this.ze1],[this.ze2],[this.zs1],[this.zs2],[this.z0],[this.T0],[this.p_rho]]);
        this.model.equations = new ScilabDouble([mo]);
        this.model.in = new ScilabDouble([ones(size(mo.inputs,"*"),1)]);
        this.model.out = new ScilabDouble([ones(size(mo.outputs,"*"),1)]);
        var exprs = [[string(this.Patm)],[string(this.A)],[string(this.ze1)],[string(this.ze2)],[string(this.zs1)],[string(this.zs2)],[string(this.z0)],[string(this.T0)],[string(this.p_rho)]];
        var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Bache\",sz(1),sz(2));"]);
        this.x = new standard_define(new ScilabDouble([2,2]),this.model,new ScilabDouble(exprs),list(gr_i,0));
        this.x.graphics.in_implicit = [["I"],["I"]];
        this.x.graphics.out_implicit = [["I"],["I"],["E"]];
        return new BasicBlock(this.x);
    }
    Bache.prototype.details = function Bache() {
        return this.x;
    }
    Bache.prototype.get = function Bache() {
        var exprs = this.graphics.exprs;
        this.set_param_popup_title = "Parametres de la bache";
        var options = {
            Patm:["Pression dans le ciel de la bache : Patm (Pa)",this.Patm],
            A:["Section de la bache : A (m2)",this.A],
            ze1:["Altitude du piquage d entrée 1: ze1 (m)",this.ze1],
            ze2:["Altitude du piquage d entrée 2: ze2 (m)",this.ze2],
            zs1:["Altitude du piquage de sortie 1: zs1 (m)",this.zs1],
            zs2:["Altitude du piquage de sortie 2: zs2 (m)",this.zs2],
            z0:["Altitude initiale du fluide : z0 (m)",this.z0],
            T0:["Température initiale du fluide : T0 (K)",this.T0],
            p_rho:["Si >0, masse volumique imposée du fluide : p_rho (kg/m3)",this.p_rho],
        }
        return options;
    }
    Bache.prototype.set = function Bache() {
        var exprs = this.graphics.exprs;
        while (true) {
            var ok = true;
            this.Patm = parseFloat(arguments[0]["Patm"]);
            this.A = parseFloat(arguments[0]["A"]);
            this.ze1 = parseFloat(arguments[0]["ze1"]);
            this.ze2 = parseFloat(arguments[0]["ze2"]);
            this.zs1 = parseFloat(arguments[0]["zs1"]);
            this.zs2 = parseFloat(arguments[0]["zs2"]);
            this.z0 = parseFloat(arguments[0]["z0"]);
            this.T0 = parseFloat(arguments[0]["T0"]);
            this.p_rho = parseFloat(arguments[0]["p_rho"]);
            var exprs = [arguments[0]["Patm"], arguments[0]["A"], arguments[0]["ze1"], arguments[0]["ze2"], arguments[0]["zs1"], arguments[0]["zs2"], arguments[0]["z0"], arguments[0]["T0"], arguments[0]["p_rho"]];
            if (!ok) {
                break;
            }
            this.model.rpar = new ScilabDouble([this.Patm],[this.A],[this.ze1],[this.ze2],[this.zs1],[this.zs2],[this.z0],[this.T0],[this.p_rho]);
            this.model.equations.parameters[2-1] = list(new ScilabDouble([this.Patm]), new ScilabDouble([this.A]), new ScilabDouble([this.ze1]), new ScilabDouble([this.ze2]), new ScilabDouble([this.zs1]), new ScilabDouble([this.zs2]), new ScilabDouble([this.z0]), new ScilabDouble([this.T0]), new ScilabDouble([this.p_rho]));
            this.graphics.exprs = new ScilabDouble([exprs]);
            this.x.graphics = this.graphics;
            this.x.model = this.model;
            break;
        }
        return new BasicBlock(this.x);
    }
    Bache.prototype.get_popup_title = function Bache() {
        return this.set_param_popup_title;
    }
    Bache.prototype.importset = function Bache() {
        var graphics = this.x.graphics;
        var ary = getData(graphics.exprs);
        this.Patm = ary[0];
        this.A = ary[1];
        this.ze1 = ary[2];
        this.ze2 = ary[3];
        this.zs1 = ary[4];
        this.zs2 = ary[5];
        this.z0 = ary[6];
        this.T0 = ary[7];
        this.p_rho = ary[8];
    }
    Bache.prototype.getContainer = function Bache() { return new BasicBlock(this.x); }
}