Merge branch 'emesary' into dev
This commit is contained in:
commit
87dd5f3034
9 changed files with 1413 additions and 1063 deletions
|
@ -616,6 +616,39 @@
|
||||||
</fuel>
|
</fuel>
|
||||||
</consumables>
|
</consumables>
|
||||||
|
|
||||||
|
<ECAM>
|
||||||
|
<Upper>
|
||||||
|
<FlapX type="double">0</FlapX>
|
||||||
|
<FlapY type="double">0</FlapY>
|
||||||
|
<SlatX type="double">0</SlatX>
|
||||||
|
<SlatY type="double">0</SlatY>
|
||||||
|
<FlapXtrans type="double">0</FlapXtrans>
|
||||||
|
<FlapYtrans type="double">0</FlapYtrans>
|
||||||
|
<SlatXtrans type="double">0</SlatXtrans>
|
||||||
|
<SlatYtrans type="double">0</SlatYtrans>
|
||||||
|
</Upper>
|
||||||
|
<msg>
|
||||||
|
<line1 type="string"></line1>
|
||||||
|
<line2 type="string"></line2>
|
||||||
|
<line3 type="string"></line3>
|
||||||
|
<line4 type="string"></line4>
|
||||||
|
<line5 type="string"></line5>
|
||||||
|
<line6 type="string"></line6>
|
||||||
|
<line7 type="string"></line7>
|
||||||
|
<line8 type="string"></line8>
|
||||||
|
</msg>
|
||||||
|
<rightmsg>
|
||||||
|
<line1 type="string"></line1>
|
||||||
|
<line2 type="string"></line2>
|
||||||
|
<line3 type="string"></line3>
|
||||||
|
<line4 type="string"></line4>
|
||||||
|
<line5 type="string"></line5>
|
||||||
|
<line6 type="string"></line6>
|
||||||
|
<line7 type="string"></line7>
|
||||||
|
<line8 type="string"></line8>
|
||||||
|
</rightmsg>
|
||||||
|
</ECAM>
|
||||||
|
|
||||||
<environment>
|
<environment>
|
||||||
<aircraft-effects>
|
<aircraft-effects>
|
||||||
<frost-inch type="double">0</frost-inch>
|
<frost-inch type="double">0</frost-inch>
|
||||||
|
@ -1187,6 +1220,7 @@
|
||||||
</comm>
|
</comm>
|
||||||
<electrical n="0">
|
<electrical n="0">
|
||||||
<bus>
|
<bus>
|
||||||
|
<ac-ess type="double">0</ac-ess>
|
||||||
<dc-1 type="double">0</dc-1>
|
<dc-1 type="double">0</dc-1>
|
||||||
<dc-2 type="double">0</dc-2>
|
<dc-2 type="double">0</dc-2>
|
||||||
</bus>
|
</bus>
|
||||||
|
@ -1459,6 +1493,7 @@
|
||||||
</pneumatics>
|
</pneumatics>
|
||||||
|
|
||||||
<pressurization>
|
<pressurization>
|
||||||
|
<cabinalt-norm type="double">0</cabinalt-norm>
|
||||||
<cabinpsi type="double">14.7</cabinpsi>
|
<cabinpsi type="double">14.7</cabinpsi>
|
||||||
<ditchingpb type="double">14.7</ditchingpb>
|
<ditchingpb type="double">14.7</ditchingpb>
|
||||||
</pressurization>
|
</pressurization>
|
||||||
|
@ -4340,6 +4375,9 @@
|
||||||
</aircraft>
|
</aircraft>
|
||||||
|
|
||||||
<nasal>
|
<nasal>
|
||||||
|
<notifications>
|
||||||
|
<file>Aircraft/A320-family/Nasal/emesary/M_frame_notification.nas</file>
|
||||||
|
</notifications>
|
||||||
<pts>
|
<pts>
|
||||||
<file>Aircraft/A320-family/Nasal/Libraries/property-tree-setup.nas</file>
|
<file>Aircraft/A320-family/Nasal/Libraries/property-tree-setup.nas</file>
|
||||||
</pts>
|
</pts>
|
||||||
|
@ -4447,7 +4485,9 @@
|
||||||
<file>Aircraft/A320-family/Models/Instruments/ND/canvas/ND.nas</file>
|
<file>Aircraft/A320-family/Models/Instruments/ND/canvas/ND.nas</file>
|
||||||
</canvas_nd>
|
</canvas_nd>
|
||||||
<canvas_ecam>
|
<canvas_ecam>
|
||||||
<file>Aircraft/A320-family/Models/Instruments/Upper-ECAM/Upper-ECAM.nas</file>
|
<file>Aircraft/A320-family/Nasal/emesary/exec.nas</file>
|
||||||
|
<!--<file>Aircraft/A320-family/Models/Instruments/Upper-ECAM/Upper-ECAM.nas</file>-->
|
||||||
|
<file>Aircraft/A320-family/Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas</file>
|
||||||
<file>Aircraft/A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM.nas</file>
|
<file>Aircraft/A320-family/Models/Instruments/Lower-ECAM/Lower-ECAM.nas</file>
|
||||||
</canvas_ecam>
|
</canvas_ecam>
|
||||||
<canvas_iesi>
|
<canvas_iesi>
|
||||||
|
|
|
@ -30,6 +30,8 @@ var altimeter_mode = props.globals.getNode("/instrumentation/altimeter[0]/std",
|
||||||
var qnh_hpa = props.globals.getNode("/instrumentation/altimeter/setting-hpa", 1);
|
var qnh_hpa = props.globals.getNode("/instrumentation/altimeter/setting-hpa", 1);
|
||||||
var qnh_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg", 1);
|
var qnh_inhg = props.globals.getNode("/instrumentation/altimeter/setting-inhg", 1);
|
||||||
|
|
||||||
|
var _showIESI = 0;
|
||||||
|
var _fast = 0;
|
||||||
var _IESITime = 0;
|
var _IESITime = 0;
|
||||||
|
|
||||||
var canvas_IESI_base = {
|
var canvas_IESI_base = {
|
||||||
|
@ -68,8 +70,8 @@ var canvas_IESI_base = {
|
||||||
me.AI_horizon_trans = me["AI_horizon"].createTransform();
|
me.AI_horizon_trans = me["AI_horizon"].createTransform();
|
||||||
me.AI_horizon_rot = me["AI_horizon"].createTransform();
|
me.AI_horizon_rot = me["AI_horizon"].createTransform();
|
||||||
|
|
||||||
me._showIESI = 0;
|
_showIESI = 0;
|
||||||
me._fast = 0;
|
_fast = 0;
|
||||||
_IESITime = 0.0;
|
_IESITime = 0.0;
|
||||||
|
|
||||||
me.page = canvas_group;
|
me.page = canvas_group;
|
||||||
|
@ -86,22 +88,22 @@ var canvas_IESI_base = {
|
||||||
# todo 20W power consumption
|
# todo 20W power consumption
|
||||||
if (iesi_reset.getValue() == 1) {
|
if (iesi_reset.getValue() == 1) {
|
||||||
if (iesi_init.getBoolValue() and _IESITime + 90 >= et.getValue()) {
|
if (iesi_init.getBoolValue() and _IESITime + 90 >= et.getValue()) {
|
||||||
me._fast = 1;
|
_fast = 1;
|
||||||
} else {
|
} else {
|
||||||
me._fast = 0;
|
_fast = 0;
|
||||||
}
|
}
|
||||||
iesi_init.setBoolValue(0);
|
iesi_init.setBoolValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systems.ELEC.Bus.dcEss.getValue() >= 25 or (systems.ELEC.Bus.dcHot1.getValue() >= 25 and airspeed.getValue() >= 50 and cur_time >= 5)) {
|
if (systems.ELEC.Bus.dcEss.getValue() >= 25 or (systems.ELEC.Bus.dcHot1.getValue() >= 25 and airspeed.getValue() >= 50 and cur_time >= 5)) {
|
||||||
me._showIESI = 1;
|
_showIESI = 1;
|
||||||
IESI.update();
|
IESI.update();
|
||||||
|
|
||||||
if (aconfig.getValue() != 1 and iesi_init.getValue() != 1) {
|
if (aconfig.getValue() != 1 and iesi_init.getValue() != 1) {
|
||||||
iesi_init.setBoolValue(1);
|
iesi_init.setBoolValue(1);
|
||||||
if (me._fast) {
|
if (_fast) {
|
||||||
_IESITime = cur_time - 80;
|
_IESITime = cur_time - 80;
|
||||||
me._fast = 0;
|
_fast = 0;
|
||||||
} else {
|
} else {
|
||||||
_IESITime = cur_time;
|
_IESITime = cur_time;
|
||||||
}
|
}
|
||||||
|
@ -110,11 +112,11 @@ var canvas_IESI_base = {
|
||||||
_IESITime = cur_time - 87;
|
_IESITime = cur_time - 87;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
me._showIESI = 0;
|
_showIESI = 0;
|
||||||
iesi_init.setBoolValue(0);
|
iesi_init.setBoolValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (me._showIESI and iesi_brt.getValue() > 0.01) {
|
if (_showIESI and iesi_brt.getValue() > 0.01) {
|
||||||
IESI.page.show();
|
IESI.page.show();
|
||||||
} else {
|
} else {
|
||||||
IESI.page.hide();
|
IESI.page.hide();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
1092
Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas
Normal file
1092
Models/Instruments/Upper-ECAM/Upper-ECAM.new.nas
Normal file
File diff suppressed because it is too large
Load diff
|
@ -41,9 +41,9 @@
|
||||||
inkscape:window-height="705"
|
inkscape:window-height="705"
|
||||||
id="namedview371"
|
id="namedview371"
|
||||||
showgrid="true"
|
showgrid="true"
|
||||||
inkscape:zoom="1"
|
inkscape:zoom="0.25"
|
||||||
inkscape:cx="718.57047"
|
inkscape:cx="971.41703"
|
||||||
inkscape:cy="505.8628"
|
inkscape:cy="1420.8195"
|
||||||
inkscape:window-x="-8"
|
inkscape:window-x="-8"
|
||||||
inkscape:window-y="-8"
|
inkscape:window-y="-8"
|
||||||
inkscape:window-maximized="1"
|
inkscape:window-maximized="1"
|
||||||
|
@ -1428,4 +1428,43 @@
|
||||||
width="137.63597"
|
width="137.63597"
|
||||||
id="SlatLine_clip"
|
id="SlatLine_clip"
|
||||||
style="opacity:0.5;fill:none;fill-opacity:1;stroke:none;stroke-width:3.34691048;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
|
style="opacity:0.5;fill:none;fill-opacity:1;stroke:none;stroke-width:3.34691048;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.71383667px;line-height:1.25;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.7928459"
|
||||||
|
x="38.122616"
|
||||||
|
y="47.904297"
|
||||||
|
id="aFloor"
|
||||||
|
transform="scale(0.94595932,1.0571279)"
|
||||||
|
inkscape:label="#text1027"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan1025"
|
||||||
|
x="38.122616"
|
||||||
|
y="47.904297"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:39.99999902px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#c56100;fill-opacity:1;stroke-width:0.7928459">A FLOOR</tspan></text>
|
||||||
|
<text
|
||||||
|
transform="scale(0.97051272,1.0303832)"
|
||||||
|
inkscape:label="#text4314"
|
||||||
|
id="FlxLimTemp"
|
||||||
|
y="122.78025"
|
||||||
|
x="919.25299"
|
||||||
|
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
||||||
|
xml:space="preserve"><tspan
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40.71494293px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#179ab7;fill-opacity:1;"
|
||||||
|
y="122.78025"
|
||||||
|
x="919.25299"
|
||||||
|
id="tspan1029"
|
||||||
|
sodipodi:role="line">00</tspan></text>
|
||||||
|
<text
|
||||||
|
inkscape:label="#text4443"
|
||||||
|
id="FlxLimDegreesC"
|
||||||
|
y="108.14707"
|
||||||
|
x="1061.88"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="scale(0.87983286,1.1365795)"><tspan
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.25978088px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#179ab7;fill-opacity:1"
|
||||||
|
y="108.14707"
|
||||||
|
x="1061.88"
|
||||||
|
id="tspan1033"
|
||||||
|
sodipodi:role="line">°C</tspan></text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 89 KiB |
|
@ -42,8 +42,8 @@
|
||||||
id="namedview371"
|
id="namedview371"
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
inkscape:zoom="0.43942712"
|
inkscape:zoom="0.43942712"
|
||||||
inkscape:cx="180.81625"
|
inkscape:cx="623.25944"
|
||||||
inkscape:cy="433.53356"
|
inkscape:cy="936.15332"
|
||||||
inkscape:window-x="-8"
|
inkscape:window-x="-8"
|
||||||
inkscape:window-y="-8"
|
inkscape:window-y="-8"
|
||||||
inkscape:window-maximized="1"
|
inkscape:window-maximized="1"
|
||||||
|
@ -1755,7 +1755,7 @@
|
||||||
x="650.08069"
|
x="650.08069"
|
||||||
y="575.68427"
|
y="575.68427"
|
||||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.25px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#0dc04b;fill-opacity:1;stroke-width:0.75">A-LOCK</tspan></text>
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.25px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#0dc04b;fill-opacity:1;stroke-width:0.75">A-LOCK</tspan></text>
|
||||||
<path
|
<path
|
||||||
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#0dc04b;stroke-width:5.44862556;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
|
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#0dc04b;stroke-width:5.44862556;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
|
||||||
d="M 555.26245,639.8335 691.24239,597.33411"
|
d="M 555.26245,639.8335 691.24239,597.33411"
|
||||||
id="SlatLine"
|
id="SlatLine"
|
||||||
|
@ -1796,4 +1796,43 @@
|
||||||
width="137.63597"
|
width="137.63597"
|
||||||
id="SlatLine_clip"
|
id="SlatLine_clip"
|
||||||
style="opacity:0.5;fill:none;fill-opacity:1;stroke:none;stroke-width:3.34691048;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
|
style="opacity:0.5;fill:none;fill-opacity:1;stroke:none;stroke-width:3.34691048;stroke-linecap:square;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.71383667px;line-height:1.25;font-family:'Bitstream Vera Sans';-inkscape-font-specification:'Bitstream Vera Sans';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.7928459"
|
||||||
|
x="38.122616"
|
||||||
|
y="47.904297"
|
||||||
|
id="aFloor"
|
||||||
|
transform="scale(0.94595932,1.0571279)"
|
||||||
|
inkscape:label="#text1027"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan1025"
|
||||||
|
x="38.122616"
|
||||||
|
y="47.904297"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:39.99999902px;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#c56100;fill-opacity:1;stroke-width:0.7928459">A FLOOR</tspan></text>
|
||||||
|
<text
|
||||||
|
transform="scale(0.97051272,1.0303832)"
|
||||||
|
inkscape:label="#text4314"
|
||||||
|
id="FlxLimTemp"
|
||||||
|
y="122.78025"
|
||||||
|
x="919.25299"
|
||||||
|
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
||||||
|
xml:space="preserve"><tspan
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:40.71494293px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;text-anchor:middle;fill:#179ab7;fill-opacity:1;"
|
||||||
|
y="122.78025"
|
||||||
|
x="919.25299"
|
||||||
|
id="tspan1029"
|
||||||
|
sodipodi:role="line">00</tspan></text>
|
||||||
|
<text
|
||||||
|
inkscape:label="#text4443"
|
||||||
|
id="FlxLimDegreesC"
|
||||||
|
y="108.14707"
|
||||||
|
x="1061.88"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#179ab7;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="scale(0.87983286,1.1365795)"><tspan
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.25978088px;line-height:1.25;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';fill:#179ab7;fill-opacity:1"
|
||||||
|
y="108.14707"
|
||||||
|
x="1061.88"
|
||||||
|
id="tspan1033"
|
||||||
|
sodipodi:role="line">°C</tspan></text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 112 KiB |
|
@ -247,6 +247,7 @@ var postInit = func() {
|
||||||
var FMGCNodes = {
|
var FMGCNodes = {
|
||||||
costIndex: props.globals.initNode("/FMGC/internal/cost-index", 0, "DOUBLE"),
|
costIndex: props.globals.initNode("/FMGC/internal/cost-index", 0, "DOUBLE"),
|
||||||
flexSet: props.globals.initNode("/FMGC/internal/flex-set", 0, "BOOL"),
|
flexSet: props.globals.initNode("/FMGC/internal/flex-set", 0, "BOOL"),
|
||||||
|
flexTemp: props.globals.initNode("/FMGC/internal/flex", 0, "INT"),
|
||||||
mngSpdAlt: props.globals.getNode("/FMGC/internal/mng-alt-spd"),
|
mngSpdAlt: props.globals.getNode("/FMGC/internal/mng-alt-spd"),
|
||||||
mngMachAlt: props.globals.getNode("/FMGC/internal/mng-alt-mach"),
|
mngMachAlt: props.globals.getNode("/FMGC/internal/mng-alt-mach"),
|
||||||
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
|
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
|
||||||
|
|
98
Nasal/emesary/M_frame_notification.nas
Normal file
98
Nasal/emesary/M_frame_notification.nas
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Title : Emesary based rt exec frame notifications
|
||||||
|
#
|
||||||
|
# File Type : Implementation File
|
||||||
|
#
|
||||||
|
# Description : Uses emesary notifications to permit nasal subsystems to be notified each frame.
|
||||||
|
# : A frame is defined by the timer rate; which is usually the maximum rate as determined by the FPS.
|
||||||
|
# : This is an alternative to the timer based or explicit function calling way of invoking
|
||||||
|
# : aircraft systems.
|
||||||
|
# : It has the advantage of using less timers and remaining modular, as each aircraft subsytem
|
||||||
|
# : can simply register itself with the global transmitter to receive the frame notification.
|
||||||
|
#
|
||||||
|
# Author : Richard Harrison (richard@zaretto.com)
|
||||||
|
#
|
||||||
|
# Creation Date : 4 June 2018
|
||||||
|
#
|
||||||
|
# Version : 1.0
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Richard Harrison Released under GPL V2
|
||||||
|
#
|
||||||
|
#---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
var FrameNotification =
|
||||||
|
{
|
||||||
|
debug: 0,
|
||||||
|
new: func(_rate)
|
||||||
|
{
|
||||||
|
var new_class = emesary.Notification.new("FrameNotification", _rate);
|
||||||
|
new_class.Rate = _rate;
|
||||||
|
new_class.FrameRate = 60;
|
||||||
|
new_class.FrameCount = 0;
|
||||||
|
new_class.ElapsedSeconds = 0;
|
||||||
|
new_class.monitored = {};
|
||||||
|
new_class.properties = {};
|
||||||
|
|
||||||
|
#
|
||||||
|
# embed a recipient within this notification to allow the monitored property
|
||||||
|
# mapping list to be modified.
|
||||||
|
new_class.Recipient = emesary.Recipient.new("FrameNotification");
|
||||||
|
new_class.Recipient.Receive = func(notification)
|
||||||
|
{
|
||||||
|
if (notification.NotificationType == "FrameNotificationAddProperty")
|
||||||
|
{
|
||||||
|
var root_node = props.globals;
|
||||||
|
if (notification.root_node != nil) {
|
||||||
|
root_node = notification.root_node;
|
||||||
|
}
|
||||||
|
if (new_class.properties[notification.property] != nil
|
||||||
|
and new_class.properties[notification.property] != notification.variable)
|
||||||
|
print("[WARNING]: (",notification.module,") FrameNotification: already have variable ",new_class.properties[notification.property]," for ",notification.variable, " referencing property ",notification.property);
|
||||||
|
|
||||||
|
if (new_class.monitored[notification.variable] != nil
|
||||||
|
and new_class.monitored[notification.variable].getPath() != notification.property
|
||||||
|
and new_class.monitored[notification.variable].getPath() != "/"~notification.property)
|
||||||
|
print("[WARNING]: (",notification.module,") FrameNotification: already have variable ",notification.variable,"=",new_class.monitored[notification.variable].getPath(), " using different property ",notification.property);
|
||||||
|
# else if (new_class.monitored[notification.variable] == nil)
|
||||||
|
# print("[INFO]: (",notification.module,") FrameNotification.",notification.variable, " = ",notification.property);
|
||||||
|
|
||||||
|
new_class.monitored[notification.variable] = root_node.getNode(notification.property,1);
|
||||||
|
new_class.properties[notification.property] = notification.variable;
|
||||||
|
|
||||||
|
return emesary.Transmitter.ReceiptStatus_OK;
|
||||||
|
}
|
||||||
|
return emesary.Transmitter.ReceiptStatus_NotProcessed;
|
||||||
|
};
|
||||||
|
new_class.fetchvars = func() {
|
||||||
|
foreach (var mp; keys(new_class.monitored)){
|
||||||
|
if(new_class.monitored[mp] != nil){
|
||||||
|
if (FrameNotification.debug > 1)
|
||||||
|
print(" ",mp, " = ",new_class.monitored[mp].getValue());
|
||||||
|
new_class[mp] = new_class.monitored[mp].getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
emesary.GlobalTransmitter.Register(new_class.Recipient);
|
||||||
|
return new_class;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
var FrameNotificationAddProperty =
|
||||||
|
{
|
||||||
|
new: func(module, variable, property, root_node=nil)
|
||||||
|
{
|
||||||
|
var new_class = emesary.Notification.new("FrameNotificationAddProperty", variable);
|
||||||
|
if (root_node == nil)
|
||||||
|
root_node = props.globals;
|
||||||
|
new_class.module = module ;
|
||||||
|
new_class.variable = variable;
|
||||||
|
new_class.property = property;
|
||||||
|
new_class.root_node = root_node;
|
||||||
|
return new_class;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
#
|
||||||
|
var frameNotification = FrameNotification.new(1);
|
||||||
|
|
71
Nasal/emesary/exec.nas
Normal file
71
Nasal/emesary/exec.nas
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Title : Emesary based real time executive
|
||||||
|
#
|
||||||
|
# File Type : Implementation File
|
||||||
|
#
|
||||||
|
# Description : Uses emesary notifications to permit nasal subsystems to
|
||||||
|
# : be invoked in a controlled manner.
|
||||||
|
#
|
||||||
|
# Author : Richard Harrison (richard@zaretto.com)
|
||||||
|
#
|
||||||
|
# Creation Date : 4 June 2018
|
||||||
|
#
|
||||||
|
# Version : 1.0
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Richard Harrison Released under GPL V2
|
||||||
|
#
|
||||||
|
#---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#
|
||||||
|
# real time exec loop.
|
||||||
|
var frame_inc = 0;
|
||||||
|
var cur_frame_inc = 0.05;
|
||||||
|
var execLoop = func
|
||||||
|
{
|
||||||
|
#
|
||||||
|
notifications.frameNotification.fetchvars();
|
||||||
|
if (notifications.frameNotification.FrameCount >= 4) {
|
||||||
|
notifications.frameNotification.FrameCount = 0;
|
||||||
|
}
|
||||||
|
emesary.GlobalTransmitter.NotifyAll(notifications.frameNotification);
|
||||||
|
#
|
||||||
|
|
||||||
|
notifications.frameNotification.FrameCount = notifications.frameNotification.FrameCount + 1;
|
||||||
|
|
||||||
|
if (notifications.frameNotification.frame_rate < 5) {
|
||||||
|
frame_inc = 0.25;#4 Hz
|
||||||
|
} elsif (notifications.frameNotification.frame_rate < 10) {
|
||||||
|
frame_inc = 0.125;#8 Hz
|
||||||
|
} elsif (notifications.frameNotification.frame_rate < 15) {
|
||||||
|
frame_inc = 0.10;#10 Hz
|
||||||
|
} elsif (notifications.frameNotification.frame_rate < 20) {
|
||||||
|
frame_inc = 0.075;#13.3 Hz
|
||||||
|
} elsif (notifications.frameNotification.frame_rate < 25) {
|
||||||
|
frame_inc = 0.05;#20 Hz
|
||||||
|
} elsif (notifications.frameNotification.frame_rate < 40) {
|
||||||
|
frame_inc = 0.0333;#30 Hz
|
||||||
|
} else {
|
||||||
|
frame_inc = 0.02;#50 Hz
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frame_inc != cur_frame_inc) {
|
||||||
|
cur_frame_inc = frame_inc;
|
||||||
|
}
|
||||||
|
settimer(execLoop, cur_frame_inc);
|
||||||
|
}
|
||||||
|
|
||||||
|
# setup the properties to monitor for this system
|
||||||
|
input = {
|
||||||
|
frame_rate : "/sim/frame-rate",
|
||||||
|
elapsed_seconds : "/sim/time/elapsed-sec",
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var name; keys(input)) {
|
||||||
|
emesary.GlobalTransmitter.NotifyAll(notifications.FrameNotificationAddProperty.new("EXEC", name, input[name]));
|
||||||
|
}
|
||||||
|
emesary.GlobalTransmitter.OverrunDetection(9);
|
||||||
|
|
||||||
|
setlistener("/sim/signals/fdm-initialized", func() {
|
||||||
|
execLoop();
|
||||||
|
}, 0, 0);
|
Loading…
Reference in a new issue