zkv1000 / Nasal / EIS / single-prop.nas /
Newer Older
64 lines | 2.945kb
improve single prop EIS
Sébastien MARQUE authored on 2017-04-20
1
# This is most an example than a really efficient EIS
2
# power % is throttle %
3
# assumes that there are two tanks with equals quantity...
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
4
displayClass.showEIS = func (groups) {
path and relpath to zkv1000 ...
Sébastien MARQUE authored on 2017-04-17
5
    canvas.parsesvg(me.screen, data.zkv1000_reldir ~ 'Systems/EIS/single-prop.svg');
improve single prop EIS
Sébastien MARQUE authored on 2017-04-20
6
    append(groups.show, 'EIS', 'POWER-pointer', 'FUEL-RIGHT-pointer', 'FUEL-LEFT-pointer');
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
7
    append(groups.text,
8
            'RPM-text', 'EGT-text', 'CHT-text', 'FUEL-USED-text',
9
            'FUEL-FLOW-text', 'MAN-Hg-text', 'POWER-PERCENT-text',
10
            'RPM-text', 'BUS-V-text', 'BATT-text', 'PSI-text',
11
            'OIL-TEMP-text'
12
        );
13
};
14

            
15
displayClass.updateEIS = func {
16
# displays Engine Informations System
17
    var power = getprop('/controls/engines/engine/throttle') * getprop('/engines/engine/running');
18
    me.screenElements['POWER-pointer']
19
        .setRotation(D2R * 140 * power);
20
    me.screenElements['POWER-PERCENT-text']
21
        .setText(sprintf('% 3u', power * 100));
22
    me.screenElements['RPM-text']
23
        .setText(sprintf(math.round(getprop('/engines/engine/rpm'), 50)));
24
    me.screenElements['MAN-Hg-text']
25
        .setText(sprintf('%.1d', getprop('/engines/engine/mp-inhg')));
26
    me.screenElements['FUEL-FLOW-text']
27
        .setText(sprintf('%.1f', getprop('/engines/engine/fuel-flow-gph')));
28
    if (math.mod(me._eis_count, 10) == 0) {
29
        var psi = getprop('/engines/engine/oil-pressure-psi');
30
        me.screenElements['PSI-text']
31
            .setText(psi == nil ? '--' : sprintf('%u', psi));
32
        me.screenElements['OIL-TEMP-text']
33
            .setText(sprintf('%i', getprop('/engines/engine/oil-temperature-degf')));
improve single prop EIS
Sébastien MARQUE authored on 2017-04-20
34
        var full = getprop('/instrumentation/zkv1000/eis/fuel-qty-at-start');
35
        var right = getprop('/consumables/fuel/tank/level-gal_us');
36
        var left = getprop('/consumables/fuel/tank[1]/level-gal_us');
37
        var used_fuel = full - (right + left);
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
38
        me.screenElements['FUEL-USED-text']
39
            .setText(sprintf('%.1d', used_fuel > 0 ? used_fuel : 0));
improve single prop EIS
Sébastien MARQUE authored on 2017-04-20
40
        me.screenElements['FUEL-RIGHT-pointer']
41
            .setTranslation(
42
                    0,
43
                    (1 - right / (full/2)) * -80
44
                );
45
        me.screenElements['FUEL-LEFT-pointer']
46
            .setTranslation(
47
                    0,
48
                    (1 - left / (full/2)) * -80
49
                );
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
50
        me.screenElements['BUS-V-text']
51
            .setText(sprintf('%.1i', getprop('/systems/electrical/outputs/bus')));
52
        me.screenElements['BATT-text']
53
            .setText(sprintf('%+i', getprop('/systems/electrical/amps')));
54
        var cht = getprop('/engines/engine/cht-degf');
55
        me.screenElements['CHT-text']
56
            .setText(cht == nil ? '--' : sprintf('%i', cht));
57
        me.screenElements['EGT-text']
58
            .setText(sprintf('%i', getprop('/engines/engine/egt-degf')));
59
    }
improve single prop EIS
Sébastien MARQUE authored on 2017-04-20
60
    settimer(func me.updateEIS(), 0.2);
EIS can be aircraft specific
Sébastien MARQUE authored on 2017-04-04
61
    me._eis_count += 1;
62
};
63

            
64
displayClass._eis_count = 0;