zkv1000 / Nasal / EIS / single-prop.nas /
Newer Older
50 lines | 2.404kb
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
1
displayClass.showEIS = func (groups) {
fix new name of single prop ...
Sébastien MARQUE authored on 2017-04-09
2
    canvas.parsesvg(me.screen, "Aircraft/Instruments-3d/zkv1000/Systems/EIS/single-prop.svg");
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
3
    append(groups.show, 'EIS', 'POWER-pointer');
4
    append(groups.text,
5
            'RPM-text', 'EGT-text', 'CHT-text', 'FUEL-USED-text',
6
            'FUEL-FLOW-text', 'MAN-Hg-text', 'POWER-PERCENT-text',
7
            'RPM-text', 'BUS-V-text', 'BATT-text', 'PSI-text',
8
            'OIL-TEMP-text'
9
        );
10
};
11

            
12
displayClass.updateEIS = func {
13
# displays Engine Informations System
14
    var power = getprop('/controls/engines/engine/throttle') * getprop('/engines/engine/running');
15
    me.screenElements['POWER-pointer']
16
        .setRotation(D2R * 140 * power);
17
    me.screenElements['POWER-PERCENT-text']
18
        .setText(sprintf('% 3u', power * 100));
19
    me.screenElements['RPM-text']
20
        .setText(sprintf(math.round(getprop('/engines/engine/rpm'), 50)));
21
    me.screenElements['MAN-Hg-text']
22
        .setText(sprintf('%.1d', getprop('/engines/engine/mp-inhg')));
23
    me.screenElements['FUEL-FLOW-text']
24
        .setText(sprintf('%.1f', getprop('/engines/engine/fuel-flow-gph')));
25
    if (math.mod(me._eis_count, 10) == 0) {
26
        var psi = getprop('/engines/engine/oil-pressure-psi');
27
        me.screenElements['PSI-text']
28
            .setText(psi == nil ? '--' : sprintf('%u', psi));
29
        me.screenElements['OIL-TEMP-text']
30
            .setText(sprintf('%i', getprop('/engines/engine/oil-temperature-degf')));
31
        var used_fuel = getprop('/instrumentation/zkv1000/eis/fuel-qty-at-start')
32
                      - getprop('/consumables/fuel/tank/level-gal_us')
33
                      - getprop('/consumables/fuel/tank[1]/level-gal_us');
34
        me.screenElements['FUEL-USED-text']
35
            .setText(sprintf('%.1d', used_fuel > 0 ? used_fuel : 0));
36
        me.screenElements['BUS-V-text']
37
            .setText(sprintf('%.1i', getprop('/systems/electrical/outputs/bus')));
38
        me.screenElements['BATT-text']
39
            .setText(sprintf('%+i', getprop('/systems/electrical/amps')));
40
        var cht = getprop('/engines/engine/cht-degf');
41
        me.screenElements['CHT-text']
42
            .setText(cht == nil ? '--' : sprintf('%i', cht));
43
        me.screenElements['EGT-text']
44
            .setText(sprintf('%i', getprop('/engines/engine/egt-degf')));
45
    }
46
    settimer(func me.updateEIS(), 1);
47
    me._eis_count += 1;
48
};
49

            
50
displayClass._eis_count = 0;