1
0
Fork 0
fgdata/Nasal
Richard Harrison a395423f27 Nsasl: Added Exec Scheduler
see also https://wiki.flightgear.org/Nasal_Optimisation#Emesary_real_time_executive

Using a scheduler to manage the invocation of Nasal modules provides a more predictable and efficient way to replace update loops and also optimises property tree access to one access per property per frame by using a hash that contains the property values.

There is a default global object created (emexec.ExecScheduler) that should be used in most circumstances.

Each Nasal object simply has to have an update(notification) method. This will be called on a schedule and the notification will contain any requested property values.

The exec will also adapt the rate to the frame rate; with a maximum of 50hz, but this will drop to as low as 4hz based on the frame rate to optimise workload.

The modules will be called in the order in which they were added; so it is possible to have modules in the right sequence (i.e. an earlier module calculates values that are used by a later module)

A simple example is below. The VSD_device has the update method
------

# list of prooperties to include in the notification hash
var properties_to_monitor = {
                                OrientationHeadingDeg  : "orientation/heading-deg",
                                OrientationPitchDeg    : "orientation/pitch-deg",
                                OrientationRollDeg     : "orientation/roll-deg",
                                GroundspeedKts         : "velocities/groundspeed-kt",
                                radar2_range           : "instrumentation/radar/radar2-range",
                                target_display         : "sim/model/f15/instrumentation/radar-awg-9/hud/target-display",
                                vc_kts                 : "instrumentation/airspeed-indicator/true-speed-kt",
                            };
# create Canvas based device (that has an update method)
VSD = VSD_Device.new(designation, textureImage, notification.Ident, root_node);

# register with the exec;
# - ident
# - proprties to include in notification hash
# - object (with an .update(notification) method
# - rate (4 = 1/4)
emexec.ExecModule.register("F15-VSD", properties_to_monitor, VSD, 4);
2022-04-04 17:23:12 +02:00
..
Autopush Autopush: Improve handeling on speedup 2020-11-02 12:26:47 +00:00
canvas ProperyElement: remove dependency on aircraft.nas 2022-03-06 10:59:06 +00:00
console Replace printlog by logprint 2020-04-21 09:07:20 +02:00
debug move globals.Hash to std.Hash 2020-07-08 15:31:23 +01:00
FailureMgr Fix failure manager warning 2019-12-11 17:53:35 +01:00
input_helpers Replace printlog by logprint 2020-04-21 09:07:20 +02:00
jetways Nasal: use ‘quiet’ flag when loading jetways.xml 2020-10-25 19:56:40 +00:00
jetways_edit Fix elevation bug for jetways 2015-10-11 22:32:25 +02:00
local_weather Local weather: change unknown landcover message to use logprint 2021-10-18 15:31:19 +02:00
modules Add argument validation in canvas_efis/eicas-message-sys.nas 2021-12-04 14:50:01 +01:00
performance_monitor Change the performance monitor to use the font as specified in the style (rather than hardcoding it) 2018-09-02 11:53:32 +02:00
std move min and max from std/Vector.nas (class file) to std.nas 2020-07-30 10:48:27 +01:00
towing [Nasal]Add possibility to recognise drag robots for glider towing 2019-08-31 10:20:15 +02:00
tutorial Checklist/Tutorial: Auto view direction to marker 2020-10-31 16:00:51 +00:00
addons.nas Nasal loadpriority; remove nasal-dir-initialized listeners; 2020-06-03 21:57:14 +01:00
aircraft.nas Nasal: optimises properties in lp filter 2022-04-03 18:30:17 +02:00
aurora.nas reset executable bit for nasal script 2017-07-18 10:57:13 +02:00
bits.nas Add a license exception to single owner (Melchoir Franz and myself) that clarifies that merely calling Nasal functions from third party aircraft does not invoce the derived-work clause of the GPL. Signed of by Melchoir. 2020-06-05 11:31:57 +02:00
checklist.nas Configurable auto-gen of tutorials from checklists 2020-06-27 15:20:02 +01:00
contrail.nas Add a license exception to single owner (Melchoir Franz and myself) that clarifies that merely calling Nasal functions from third party aircraft does not invoce the derived-work clause of the GPL. Signed of by the authors 2020-08-12 14:40:44 +02:00
controls.nas Controls: Added trim to position for rudder and aileron 2022-03-02 14:16:18 +01:00
debug.nas Nasal/debug.nas: backtrace(): reinstate mechanism to truncate long filenames. 2021-08-29 21:09:12 +01:00
dynamic_view.nas Add a license exception to single owner (Melchoir Franz and myself) that clarifies that merely calling Nasal functions from third party aircraft does not invoce the derived-work clause of the GPL. Signed of by Melchoir. 2020-06-05 11:31:57 +02:00
earthview.nas Implement Earthview tiles loading based on visibility in spherical geometry 2020-03-23 23:47:31 +01:00
emesary.nas Emesary: Improve error messages 2020-12-17 22:42:42 +00:00
emesary_mp_bridge.nas Make sure notifications don't stay in the outgoing MP emesary property, which could lead pilots just connecting to MP to get a past notification. 2020-10-19 00:40:05 +02:00
emexec.nas Nsasl: Added Exec Scheduler 2022-04-04 17:23:12 +02:00
environment.nas Nasal loadpriority; remove nasal-dir-initialized listeners; 2020-06-03 21:57:14 +01:00
events.nas Bugfixes and improvements to the Failure Manager 2014-12-21 12:39:52 +01:00
frame_utils.nas Nasal PartitionProcessor added time limiter 2020-10-25 20:02:41 +01:00
fuel.nas #705: add sanity checks to fuel tank update 2012-04-22 15:19:20 +02:00
geo.nas Marker-pins FGData changes 2022-01-27 12:11:24 +00:00
glide_slope_tunnel.nas Fix glide slope tunnel altitude offset by moving it to correct runway touchdown zone. 2018-11-06 16:14:59 +01:00
globals.nas Nasal/globals.nas: setlistener(): call die() if callback is not a function. 2021-08-26 23:24:46 +01:00
gui.nas Add a VR Options dialog 2021-09-01 20:36:24 +01:00
io.nas Nasal: use ‘quiet’ flag when loading jetways.xml 2020-10-25 19:56:40 +00:00
joystick.nas Controls: Added trim to position for rudder and aileron 2022-03-02 14:16:18 +01:00
lag_adjust.nas Nasal loadpriority; remove nasal-dir-initialized listeners; 2020-06-03 21:57:14 +01:00
loadpriority.xml Marker-pins FGData changes 2022-01-27 12:11:24 +00:00
local_weather_auto_init.nas Move AW auto-start detection outside AW namespace to avoid duplicate AW start issue when de-selected in launcher and selected in-sim 2018-10-06 09:41:22 +03:00
markerpins.nas Marker-pins FGData changes 2022-01-27 12:11:24 +00:00
material.nas Fix #1310 - typo in material.nas 2014-01-19 15:52:38 -06:00
math.nas add approx_eq to math.nas and is_regular_file io.nas 2020-04-16 16:19:29 +01:00
modules.nas Modules.nas: add return values to some methods. 2020-09-03 17:51:16 +01:00
mp_broadcast.nas Replace printlog by logprint 2020-04-21 09:07:20 +02:00
multikey.nas Add a license exception to single owner (Melchoir Franz and myself) that clarifies that merely calling Nasal functions from third party aircraft does not invoce the derived-work clause of the GPL. Signed of by Melchoir. 2020-06-05 11:31:57 +02:00
multiplayer.nas Multiplayer pilot list fixes 2022-03-17 19:27:13 +01:00
notifications.nas Emesary(MP) : Use correct ID for ArmamentNotification 2020-10-23 17:46:40 +02:00
orbital_target.nas Add a license exception to single owner Nasal libraries which clarifies that merely calling Nasal functions from third party aircraft does not invoke the derived-work clause of the GPL. Signed off by Thorsten 2020-06-08 15:07:10 +02:00
prop_key_handler.nas Nasal/prop_key_handler.nas: fixed couple of issues in search ('?') code. 2019-08-31 14:14:18 +01:00
props.nas Fix props.condition 2020-11-19 18:44:00 +00:00
props.nut props.nas: add isValidPropName and makeValidPropName; add props.nut 2020-06-08 19:52:48 +01:00
README.txt add Nasal loadable module support (modules.nas) 2020-01-26 18:13:08 +01:00
redout.nas Tentative fix for accelerometers using YaSim properties in JSBSim or optionally generated properties 2016-11-23 15:34:04 +02:00
route_manager.nas Add a license exception to single owner Nasal libraries which clarifies that merely calling Nasal functions from third party aircraft does not invoke the derived-work clause of the GPL. Signed off by the authors. 2020-06-09 16:05:10 +02:00
scenery.nas Nasal loadpriority; remove nasal-dir-initialized listeners; 2020-06-03 21:57:14 +01:00
screen.nas Add option to move chat to the left and align left. 2021-01-13 22:43:12 +01:00
screenshot.nas Add a copyright header and 2022-02-10 15:00:15 +01:00
seaport.nas Nasal loadpriority; remove nasal-dir-initialized listeners; 2020-06-03 21:57:14 +01:00
std.nas move min and max from std/Vector.nas (class file) to std.nas 2020-07-30 10:48:27 +01:00
std.nut move globals.Hash to std.Hash 2020-07-08 15:31:23 +01:00
string.nas Nasal loadpriority; remove nasal-dir-initialized listeners; 2020-06-03 21:57:14 +01:00
tanker.nas Nasal loadpriority; remove nasal-dir-initialized listeners; 2020-06-03 21:57:14 +01:00
test_emesary.nut Added Emesary MP bridge unit tests 2020-08-01 16:44:02 +02:00
test_frame_utils.nut Added tests for Nasal frame utils 2021-06-05 16:18:04 +02:00
test_math.nut Add sample test file to Nasal/ 2020-05-06 15:41:18 +01:00
track_target.nas Tomaskom writes: 2015-05-28 10:29:38 -05:00
video.nas remove the infamous "A" console message 2016-04-24 11:12:18 +02:00
view.nas Nasal/view.nas: Allow view to be changed by setting /sim/current-view/view-number-raw. 2021-06-02 17:07:06 +01:00
volcano.nas Use logprint in more places 2020-06-28 07:27:29 +01:00
weather_scenario.nas Nasal loadpriority; remove nasal-dir-initialized listeners; 2020-06-03 21:57:14 +01:00
windsock.nas Add a license exception to single owner (Melchoir Franz and myself) that clarifies that merely calling Nasal functions from third party aircraft does not invoce the derived-work clause of the GPL. Signed of by Melchoir. 2020-06-05 11:31:57 +02:00

FGDATA/Nasal/ contains nasal core modules (*.nas).
All .nas files in this directory will be loaded automatically while Flightgear starts.

The first level sub-directories will be scanned for .nas files and this files will be 
also loaded while Flightgear starts unless disabled in defaults.xml.