zkv1000 / Nasal / infos.nas /
Newer Older
49 lines | 1.94kb
commit initial
Sébastien MARQUE authored on 2017-03-07
1
var wind_opt1 = func () {
2
    if (ias > 50) {
3
        var n = getprop('/environment/wind-from-north-fps') * 0.59248;
4
        var e = getprop('/environment/wind-from-east-fps') * 0.59248;
5
        setprop('/instrumentation/zkv1000/infos/wind-line', n > 0 ?
6
                sprintf('N %i', n)
7
               :sprintf('S %i', -n));
8
        setprop('/instrumentation/zkv1000/infos/wind-line[1]', e > 0 ?
9
                sprintf('E %i', e)
10
               :sprintf('W %i', -e));
11
    }
12
    else {
13
        setprop('/instrumentation/zkv1000/infos/wind-line', 'WIND');
14
        setprop('/instrumentation/zkv1000/infos/wind-line[1]', 'DATA');
15
    }
16
}
17

            
18
var wind_opt2 = func () {
19
    if (ias > 50) {
20
        setprop('/instrumentation/zkv1000/infos/wind-line', sprintf('SPD %i', getprop('/environment/wind-speed-kt')));
21
        setprop('/instrumentation/zkv1000/infos/wind-line[1]', sprintf('DIR %03i', getprop('/environment/wind-from-heading-deg')));
22
    }
23
    else {
24
        setprop('/instrumentation/zkv1000/infos/wind-line', 'WIND');
25
        setprop('/instrumentation/zkv1000/infos/wind-line[1]', 'DATA');
26
    }
27
}
28

            
29
var wind_opt3 = func () {
30
    if (ias > 50) {
31
        var n = getprop('/environment/wind-from-north-fps') * 0.59248;
32
        var e = getprop('/environment/wind-from-north-fps') * 0.59248;
33
        var h = getprop('/orientation/heading-magnetic-deg') * D2R;
34
        var f = e * math.cos(h) - n * math.sin(h);
35
        var x = n * math.cos(h) + e * math.sin(h);
36
        setprop('/instrumentation/zkv1000/infos/wind-line', f > 0 ?
37
                sprintf('HD %i', f)
38
               :sprintf('RR %i', -f));
39
        setprop('/instrumentation/zkv1000/infos/wind-line[1]', x > 0 ?
40
                sprintf('XR %i', x)
41
               :sprintf('XL %i', -x));
42
    }
43
    else {
44
        setprop('/instrumentation/zkv1000/infos/wind-line', 'WIND');
45
        setprop('/instrumentation/zkv1000/infos/wind-line[1]', 'DATA');
46
    }
47
}
48

            
49
var wind_infos = void;