@gybdev/node-red-e6b 0.0.0-stage → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +255 -2
- package/index.js +9 -0
- package/lib/altitude.js +48 -0
- package/lib/common.js +92 -0
- package/lib/metar.js +337 -0
- package/lib/node-kimenet.js +20 -0
- package/lib/weight-balance.js +311 -0
- package/lib/wind.js +193 -0
- package/nodes/e6b-altitude.html +39 -0
- package/nodes/e6b-altitude.js +15 -0
- package/nodes/e6b-metar.html +39 -0
- package/nodes/e6b-metar.js +15 -0
- package/nodes/e6b-weight-balance.html +41 -0
- package/nodes/e6b-weight-balance.js +15 -0
- package/nodes/e6b-wind.html +51 -0
- package/nodes/e6b-wind.js +15 -0
- package/package.json +43 -4
package/lib/wind.js
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { hiba, biztonsagos, payloadObjektum, vanErtek, szamMezo, pontos } = require('./common');
|
|
4
|
+
|
|
5
|
+
/** Default magnetic declination, degrees east (shared interface, G-01 provisional). */
|
|
6
|
+
const ALAP_DEKLINACIO_DEG = 5.8;
|
|
7
|
+
|
|
8
|
+
const KEPLET =
|
|
9
|
+
'alfa = (szélirány_földrajzi − deklináció) − pályairány_mágneses; ' +
|
|
10
|
+
'ellenszél = V·cos(alfa) (negatív = hátszél); oldalszél = V·sin(alfa) (pozitív = jobbról fúj)';
|
|
11
|
+
|
|
12
|
+
const rad = (d) => (d * Math.PI) / 180;
|
|
13
|
+
|
|
14
|
+
/** Normalise an angle to (-180, 180]. */
|
|
15
|
+
function normal180(d) {
|
|
16
|
+
let a = ((d % 360) + 360) % 360;
|
|
17
|
+
if (a > 180) a -= 360;
|
|
18
|
+
return a;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** "31R" -> 310, "04" -> 40, "9" -> 90. Returns null when not a runway designator. */
|
|
22
|
+
function palyaIrany(palya) {
|
|
23
|
+
const m = /^\s*(\d{1,2})\s*([LRC])?\s*$/i.exec(String(palya));
|
|
24
|
+
if (!m) return null;
|
|
25
|
+
const szam = Number(m[1]);
|
|
26
|
+
if (szam < 1 || szam > 36) return null;
|
|
27
|
+
return szam * 10;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Wind results are rounded up to the next whole knot in absolute value, towards safety (G-01, 2026-11-25):
|
|
32
|
+
* 11.2 -> 12, -7.9 -> -8, 12 -> 12. Floating-point noise is removed first, so an exact 12 stays 12.
|
|
33
|
+
*/
|
|
34
|
+
function felfele(x) {
|
|
35
|
+
const p = pontos(x);
|
|
36
|
+
if (p === null) return null;
|
|
37
|
+
const r = Math.sign(p) * Math.ceil(Math.abs(p));
|
|
38
|
+
return Object.is(r, -0) ? 0 : r;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function komponensek(v, alfa) {
|
|
42
|
+
const ell = v * Math.cos(rad(alfa));
|
|
43
|
+
const old = v * Math.sin(rad(alfa));
|
|
44
|
+
return {
|
|
45
|
+
ellenszel_kt: felfele(ell),
|
|
46
|
+
ellenszel_kt_pontos: pontos(ell),
|
|
47
|
+
oldalszel_kt: felfele(old),
|
|
48
|
+
oldalszel_kt_pontos: pontos(old),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function oldalNeve(oldalszelKerekitett) {
|
|
53
|
+
if (oldalszelKerekitett === null) return null;
|
|
54
|
+
if (oldalszelKerekitett > 0) return 'jobbról';
|
|
55
|
+
if (oldalszelKerekitett < 0) return 'balról';
|
|
56
|
+
return 'nincs';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Head/crosswind components for a runway.
|
|
61
|
+
* @param {object|string} payload { szelirany_deg, szelero_kt, lokes_kt?, valtozo?, palya | palyairany_deg, deklinacio_deg? }
|
|
62
|
+
* @param {{deklinacio_deg?: number}} [beallitas] node configuration (default declination)
|
|
63
|
+
*/
|
|
64
|
+
function szamolSzel(payload, beallitas = {}) {
|
|
65
|
+
return biztonsagos(() => {
|
|
66
|
+
const p = payloadObjektum(payload);
|
|
67
|
+
const figyelmeztetesek = [];
|
|
68
|
+
|
|
69
|
+
const valtozo =
|
|
70
|
+
p.valtozo === true ||
|
|
71
|
+
p.valtozo === 'true' ||
|
|
72
|
+
(typeof p.szelirany_deg === 'string' && p.szelirany_deg.trim().toUpperCase() === 'VRB');
|
|
73
|
+
|
|
74
|
+
const v = szamMezo(p, 'szelero_kt', { nev: 'szélerősség', min: 0, max: 200 });
|
|
75
|
+
const g = szamMezo(p, 'lokes_kt', { nev: 'széllökés', min: 0, max: 250, kotelezo: false });
|
|
76
|
+
if (g !== undefined && g < v) hiba(`A széllökés (${g} kt) nem lehet kisebb az átlagos szélnél (${v} kt).`);
|
|
77
|
+
|
|
78
|
+
let szelirany = null;
|
|
79
|
+
if (!valtozo) {
|
|
80
|
+
szelirany = szamMezo(p, 'szelirany_deg', { nev: 'szélirány', min: 0, max: 360 });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Runway direction: exact magnetic heading wins over the designator.
|
|
84
|
+
let palyairany;
|
|
85
|
+
let palyaForras;
|
|
86
|
+
if (vanErtek(p.palyairany_deg)) {
|
|
87
|
+
palyairany = szamMezo(p, 'palyairany_deg', { nev: 'pályairány', min: 0, max: 360 });
|
|
88
|
+
palyaForras = 'palyairany_deg';
|
|
89
|
+
if (vanErtek(p.palya)) figyelmeztetesek.push('A pontos pályairányt (palyairany_deg) használtam, nem a pályaszámot.');
|
|
90
|
+
} else if (vanErtek(p.palya)) {
|
|
91
|
+
palyairany = palyaIrany(p.palya);
|
|
92
|
+
if (palyairany === null) hiba(`Érvénytelen pályaszám: ${JSON.stringify(p.palya)} (pl. "31R" vagy "04").`);
|
|
93
|
+
palyaForras = 'palya';
|
|
94
|
+
} else {
|
|
95
|
+
hiba('Hiányzó bemenet: a pálya (palya, pl. "31R") vagy a pontos pályairány (palyairany_deg).');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let deklinacio;
|
|
99
|
+
if (vanErtek(p.deklinacio_deg)) {
|
|
100
|
+
deklinacio = szamMezo(p, 'deklinacio_deg', { nev: 'deklináció', min: -30, max: 30 });
|
|
101
|
+
} else if (Number.isFinite(Number(beallitas.deklinacio_deg)) && vanErtek(beallitas.deklinacio_deg)) {
|
|
102
|
+
deklinacio = Number(beallitas.deklinacio_deg);
|
|
103
|
+
} else {
|
|
104
|
+
deklinacio = ALAP_DEKLINACIO_DEG;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const alap = {
|
|
108
|
+
bemenet: {
|
|
109
|
+
szelirany_deg: szelirany,
|
|
110
|
+
szelero_kt: v,
|
|
111
|
+
lokes_kt: g === undefined ? null : g,
|
|
112
|
+
valtozo,
|
|
113
|
+
palyairany_mag_deg: palyairany,
|
|
114
|
+
palyairany_forras: palyaForras,
|
|
115
|
+
deklinacio_deg: deklinacio,
|
|
116
|
+
},
|
|
117
|
+
keplet: KEPLET,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
if (v === 0 && (g === undefined || g === 0)) {
|
|
121
|
+
figyelmeztetesek.push('Szélcsend: nincs ellenszél- és oldalszél-komponens.');
|
|
122
|
+
return {
|
|
123
|
+
...alap,
|
|
124
|
+
szelirany_mag_deg: szelirany === null ? null : pontos(normal360(szelirany - deklinacio)),
|
|
125
|
+
szelszog_deg: null,
|
|
126
|
+
ellenszel_kt: 0,
|
|
127
|
+
ellenszel_kt_pontos: 0,
|
|
128
|
+
oldalszel_kt: 0,
|
|
129
|
+
oldalszel_kt_pontos: 0,
|
|
130
|
+
oldal: 'nincs',
|
|
131
|
+
hatszel: false,
|
|
132
|
+
lokes: null,
|
|
133
|
+
legrosszabb_oldalszel_kt: 0,
|
|
134
|
+
figyelmeztetesek,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (valtozo) {
|
|
139
|
+
figyelmeztetesek.push(
|
|
140
|
+
'Változó irányú szél (VRB): a komponensek nem számolhatók; a legrosszabb eset a teljes szélsebesség oldalszélként.'
|
|
141
|
+
);
|
|
142
|
+
if (g !== undefined) figyelmeztetesek.push(`Széllökés: ${g} kt (a legrosszabb eset lökésben ${g} kt oldalszél).`);
|
|
143
|
+
return {
|
|
144
|
+
...alap,
|
|
145
|
+
szelirany_mag_deg: null,
|
|
146
|
+
szelszog_deg: null,
|
|
147
|
+
ellenszel_kt: null,
|
|
148
|
+
ellenszel_kt_pontos: null,
|
|
149
|
+
oldalszel_kt: null,
|
|
150
|
+
oldalszel_kt_pontos: null,
|
|
151
|
+
oldal: null,
|
|
152
|
+
hatszel: null,
|
|
153
|
+
lokes: g === undefined ? null : { legrosszabb_oldalszel_kt: g },
|
|
154
|
+
legrosszabb_oldalszel_kt: v,
|
|
155
|
+
figyelmeztetesek,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const szeliranyMag = normal360(szelirany - deklinacio);
|
|
160
|
+
const alfa = normal180(szeliranyMag - palyairany);
|
|
161
|
+
const k = komponensek(v, alfa);
|
|
162
|
+
const hatszel = k.ellenszel_kt < 0;
|
|
163
|
+
if (hatszel) figyelmeztetesek.push(`Hátszél: ${-k.ellenszel_kt} kt komponens a pályán.`);
|
|
164
|
+
|
|
165
|
+
let lokes = null;
|
|
166
|
+
if (g !== undefined && g > v) {
|
|
167
|
+
lokes = komponensek(g, alfa);
|
|
168
|
+
lokes.oldal = oldalNeve(lokes.oldalszel_kt);
|
|
169
|
+
lokes.hatszel = lokes.ellenszel_kt < 0;
|
|
170
|
+
figyelmeztetesek.push(
|
|
171
|
+
`Széllökés: ${g} kt; lökésben az oldalszél ${Math.abs(lokes.oldalszel_kt)} kt, az ellenszél ${lokes.ellenszel_kt} kt.`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
...alap,
|
|
177
|
+
szelirany_mag_deg: pontos(szeliranyMag),
|
|
178
|
+
szelszog_deg: pontos(alfa),
|
|
179
|
+
...k,
|
|
180
|
+
oldal: oldalNeve(k.oldalszel_kt),
|
|
181
|
+
hatszel,
|
|
182
|
+
lokes,
|
|
183
|
+
legrosszabb_oldalszel_kt: Math.abs(lokes ? lokes.oldalszel_kt : k.oldalszel_kt),
|
|
184
|
+
figyelmeztetesek,
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function normal360(d) {
|
|
190
|
+
return ((d % 360) + 360) % 360;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
module.exports = { szamolSzel, palyaIrany, normal180, ALAP_DEKLINACIO_DEG, KEPLET };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('e6b-altitude', {
|
|
3
|
+
category: 'E6B',
|
|
4
|
+
color: '#9fc5e8',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' }
|
|
7
|
+
},
|
|
8
|
+
inputs: 1,
|
|
9
|
+
outputs: 1,
|
|
10
|
+
icon: 'font-awesome/fa-plane',
|
|
11
|
+
label: function () {
|
|
12
|
+
return this.name || 'e6b altitude';
|
|
13
|
+
},
|
|
14
|
+
paletteLabel: 'e6b altitude',
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script type="text/html" data-template-name="e6b-altitude">
|
|
19
|
+
<div class="form-row">
|
|
20
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
21
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
|
22
|
+
</div>
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script type="text/html" data-help-name="e6b-altitude">
|
|
26
|
+
<p>Pressure altitude, ISA temperature and deviation, and density altitude.</p>
|
|
27
|
+
<h3>Input</h3>
|
|
28
|
+
<dl class="message-properties">
|
|
29
|
+
<dt>payload <span class="property-type">object</span></dt>
|
|
30
|
+
<dd><code>{ "reptermagassag_ft": 495, "qnh_hpa": 1000, "homerseklet_c": 9 }</code></dd>
|
|
31
|
+
</dl>
|
|
32
|
+
<h3>Output</h3>
|
|
33
|
+
<dl class="message-properties">
|
|
34
|
+
<dt>payload <span class="property-type">object</span></dt>
|
|
35
|
+
<dd>nyomasmagassag_ft, isa_homerseklet_c, isa_elteres_c, surusegmagassag_ft (altitudes rounded to 10 ft),
|
|
36
|
+
each with a <code>_pontos</code> exact value, keplet, figyelmeztetesek.
|
|
37
|
+
On invalid input: <code>{ "hiba": "..." }</code> and <code>msg.error</code> is set.</dd>
|
|
38
|
+
</dl>
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { szamolMagassag } = require('../lib/altitude');
|
|
4
|
+
const { kuld } = require('../lib/node-kimenet');
|
|
5
|
+
|
|
6
|
+
module.exports = function (RED) {
|
|
7
|
+
function E6bAltitudeNode(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
node.on('input', (msg, send, done) => {
|
|
11
|
+
kuld(node, msg, szamolMagassag(msg.payload), send, done);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
RED.nodes.registerType('e6b-altitude', E6bAltitudeNode);
|
|
15
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('e6b-metar', {
|
|
3
|
+
category: 'E6B',
|
|
4
|
+
color: '#9fc5e8',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' }
|
|
7
|
+
},
|
|
8
|
+
inputs: 1,
|
|
9
|
+
outputs: 1,
|
|
10
|
+
icon: 'font-awesome/fa-plane',
|
|
11
|
+
label: function () {
|
|
12
|
+
return this.name || 'e6b metar';
|
|
13
|
+
},
|
|
14
|
+
paletteLabel: 'e6b metar',
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script type="text/html" data-template-name="e6b-metar">
|
|
19
|
+
<div class="form-row">
|
|
20
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
21
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
|
22
|
+
</div>
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script type="text/html" data-help-name="e6b-metar">
|
|
26
|
+
<p>Decodes a raw METAR/SPECI report into structured fields and a short Hungarian summary.</p>
|
|
27
|
+
<h3>Input</h3>
|
|
28
|
+
<dl class="message-properties">
|
|
29
|
+
<dt>payload <span class="property-type">object | string</span></dt>
|
|
30
|
+
<dd><code>{ "raw": "METAR LHBP 191030Z 31012KT 9999 FEW040 15/05 Q1015" }</code>, or the raw text itself.</dd>
|
|
31
|
+
</dl>
|
|
32
|
+
<h3>Output</h3>
|
|
33
|
+
<dl class="message-properties">
|
|
34
|
+
<dt>payload <span class="property-type">object</span></dt>
|
|
35
|
+
<dd>station, time, wind, visibility_m, cavok, rvr, weather, clouds, vertical_visibility_ft, ceiling_ft,
|
|
36
|
+
temp_c, dewpoint_c, spread_c, qnh_hpa, trend, remarks (raw RMK text, never interpreted), osszefoglalo,
|
|
37
|
+
keplet, figyelmeztetesek. On invalid input: <code>{ "hiba": "..." }</code> and <code>msg.error</code> is set.</dd>
|
|
38
|
+
</dl>
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { dekodolMetar } = require('../lib/metar');
|
|
4
|
+
const { kuld } = require('../lib/node-kimenet');
|
|
5
|
+
|
|
6
|
+
module.exports = function (RED) {
|
|
7
|
+
function E6bMetarNode(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
node.on('input', (msg, send, done) => {
|
|
11
|
+
dekodolMetar(msg.payload).then((eredmeny) => kuld(node, msg, eredmeny, send, done), done);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
RED.nodes.registerType('e6b-metar', E6bMetarNode);
|
|
15
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('e6b-weight-balance', {
|
|
3
|
+
category: 'E6B',
|
|
4
|
+
color: '#9fc5e8',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' }
|
|
7
|
+
},
|
|
8
|
+
inputs: 1,
|
|
9
|
+
outputs: 1,
|
|
10
|
+
icon: 'font-awesome/fa-plane',
|
|
11
|
+
label: function () {
|
|
12
|
+
return this.name || 'e6b weight & balance';
|
|
13
|
+
},
|
|
14
|
+
paletteLabel: 'e6b weight & balance',
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script type="text/html" data-template-name="e6b-weight-balance">
|
|
19
|
+
<div class="form-row">
|
|
20
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
21
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
|
22
|
+
</div>
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script type="text/html" data-help-name="e6b-weight-balance">
|
|
26
|
+
<p>Mass and balance: station table, total mass, centre of gravity, MTOW and envelope check.</p>
|
|
27
|
+
<h3>Input</h3>
|
|
28
|
+
<dl class="message-properties">
|
|
29
|
+
<dt>payload <span class="property-type">object</span></dt>
|
|
30
|
+
<dd><code>{ "gep": { ...aircraft data sheet... }, "terheles": { "pilota_kg": 80, "utas_kg": 75,
|
|
31
|
+
"csomagter_kg": 10, "uzemanyag_liter": 60 } }</code>. Other stations of the aircraft (e.g.
|
|
32
|
+
<code>hatso_ules_kg</code>) are optional.</dd>
|
|
33
|
+
</dl>
|
|
34
|
+
<h3>Output</h3>
|
|
35
|
+
<dl class="message-properties">
|
|
36
|
+
<dt>payload <span class="property-type">object</span></dt>
|
|
37
|
+
<dd>tetelek (mass, arm, moment per station), ossztomeg_kg, sulypont_mm (with <code>_pontos</code> values),
|
|
38
|
+
mtow_alatt, mtow_tartalek_kg, burkolon_belul, sulypont_hatarok_mm, legkozelebbi_hatar_mm, uzemanyag_nelkul,
|
|
39
|
+
rendben, keplet, figyelmeztetesek. On invalid input: <code>{ "hiba": "..." }</code> and <code>msg.error</code> is set.</dd>
|
|
40
|
+
</dl>
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { szamolTomegSulypont } = require('../lib/weight-balance');
|
|
4
|
+
const { kuld } = require('../lib/node-kimenet');
|
|
5
|
+
|
|
6
|
+
module.exports = function (RED) {
|
|
7
|
+
function E6bWeightBalanceNode(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
node.on('input', (msg, send, done) => {
|
|
11
|
+
kuld(node, msg, szamolTomegSulypont(msg.payload), send, done);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
RED.nodes.registerType('e6b-weight-balance', E6bWeightBalanceNode);
|
|
15
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('e6b-wind', {
|
|
3
|
+
category: 'E6B',
|
|
4
|
+
color: '#9fc5e8',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: '' },
|
|
7
|
+
deklinacio: { value: 5.8, validate: function (v) { return v === '' || !isNaN(Number(v)); } }
|
|
8
|
+
},
|
|
9
|
+
inputs: 1,
|
|
10
|
+
outputs: 1,
|
|
11
|
+
icon: 'font-awesome/fa-plane',
|
|
12
|
+
label: function () {
|
|
13
|
+
return this.name || 'e6b wind';
|
|
14
|
+
},
|
|
15
|
+
paletteLabel: 'e6b wind',
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script type="text/html" data-template-name="e6b-wind">
|
|
20
|
+
<div class="form-row">
|
|
21
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
22
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
|
23
|
+
</div>
|
|
24
|
+
<div class="form-row">
|
|
25
|
+
<label for="node-input-deklinacio"><i class="fa fa-compass"></i> Declination</label>
|
|
26
|
+
<input type="text" id="node-input-deklinacio" placeholder="5.8 (degrees east)" />
|
|
27
|
+
</div>
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script type="text/html" data-help-name="e6b-wind">
|
|
31
|
+
<p>Headwind and crosswind components for a runway.</p>
|
|
32
|
+
<h3>Input</h3>
|
|
33
|
+
<dl class="message-properties">
|
|
34
|
+
<dt>payload <span class="property-type">object</span></dt>
|
|
35
|
+
<dd><code>{ "szelirany_deg": 340, "szelero_kt": 15, "lokes_kt": 25, "palya": "31R" }</code>.
|
|
36
|
+
Optional: <code>valtozo</code> (VRB), <code>palyairany_deg</code> (exact magnetic heading instead of the
|
|
37
|
+
runway number), <code>deklinacio_deg</code> (east positive; overrides the node setting).</dd>
|
|
38
|
+
</dl>
|
|
39
|
+
<h3>Output</h3>
|
|
40
|
+
<dl class="message-properties">
|
|
41
|
+
<dt>payload <span class="property-type">object</span></dt>
|
|
42
|
+
<dd>ellenszel_kt / oldalszel_kt (rounded to 1 kt) with <code>_pontos</code> exact values, oldal
|
|
43
|
+
(balról / jobbról), hatszel, lokes (gust components), legrosszabb_oldalszel_kt, keplet, figyelmeztetesek.
|
|
44
|
+
On invalid input: <code>{ "hiba": "..." }</code> and <code>msg.error</code> is set.</dd>
|
|
45
|
+
</dl>
|
|
46
|
+
<h3>Properties</h3>
|
|
47
|
+
<dl class="message-properties">
|
|
48
|
+
<dt>Declination <span class="property-type">number</span></dt>
|
|
49
|
+
<dd>Default magnetic declination in degrees, east positive. Empty: 5.8.</dd>
|
|
50
|
+
</dl>
|
|
51
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { szamolSzel } = require('../lib/wind');
|
|
4
|
+
const { kuld } = require('../lib/node-kimenet');
|
|
5
|
+
|
|
6
|
+
module.exports = function (RED) {
|
|
7
|
+
function E6bWindNode(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
node.on('input', (msg, send, done) => {
|
|
11
|
+
kuld(node, msg, szamolSzel(msg.payload, { deklinacio_deg: config.deklinacio }), send, done);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
RED.nodes.registerType('e6b-wind', E6bWindNode);
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gybdev/node-red-e6b",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Deterministic flight-planning calculator nodes for Node-RED: METAR decoding, wind components, pressure/density altitude, mass and balance.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Gyarmati Balázs",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"node-red",
|
|
9
|
+
"aviation",
|
|
10
|
+
"e6b",
|
|
11
|
+
"metar",
|
|
12
|
+
"crosswind",
|
|
13
|
+
"density-altitude",
|
|
14
|
+
"weight-and-balance"
|
|
15
|
+
],
|
|
16
|
+
"main": "index.js",
|
|
17
|
+
"files": [
|
|
18
|
+
"index.js",
|
|
19
|
+
"lib/",
|
|
20
|
+
"nodes/",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "node --test"
|
|
26
|
+
},
|
|
27
|
+
"node-red": {
|
|
28
|
+
"version": ">=4.0.0",
|
|
29
|
+
"nodes": {
|
|
30
|
+
"e6b-metar": "nodes/e6b-metar.js",
|
|
31
|
+
"e6b-wind": "nodes/e6b-wind.js",
|
|
32
|
+
"e6b-altitude": "nodes/e6b-altitude.js",
|
|
33
|
+
"e6b-weight-balance": "nodes/e6b-weight-balance.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"metar-taf-parser": "^9.1.3"
|
|
44
|
+
}
|
|
45
|
+
}
|