A YASim Nasal-based engine control system By Ryan Miller (based on Syd Adams's jet/turboprop models) ========================================================== Introduction: ------------- YASim jets and turboprops are not very sophisticated engines. Jets are always on and cannot turn off (except by fuel starvation), and turboprops can be turned on simply by moving the condition lever beyond 0.1%. This Nasal script provides an easy way for casual aircraft modelers to implement a basic jet/turboprop engine control system, and provide a framework for extending the system to meet their aircrafts' needs. How to use: ----------- 1) Copy the nasal script (generic-yasim-engine.nas) to your aircraft directory and reference it in -set.xml. An example: Aircraft/HelloWorld/Nasal/generic-yasim-engine.nas ------------- FOR JETS ONLY ------------- 2) In another script, call the new() functions for each engine. Use the following syntax: var engine = .Jet.new( [, [, [, [, [, [, [, ]]]]]]]) (Arguments in brackets are optional) Where: the module name you added the script under (in the example, it is "engines") engine number in FDM whether or not the engine should be running on startup (boolean 0/1) (default 0) throttle setting % on idle; this is intended to be used to simulate thrust/fuel consumption of the engine at idle power, since YASim cannot do this (default 0.01/1%) maximum N1 % that can be reached using the starter switch (default 5.21, same value in JSBSim jets) at this N1 %, the engine can be fully started by turning off the cutoff switch (default 3) engine spool time in N1 %/sec (default 4) engine start spool time in N1 %/sec (default 2) engine shutdown time in N1 %/sec (default 4) You can then call the following functions in the new object: engine.init() initializes the engine and creates an update loop; should be called AFTER THE FDM IS INITIALIZED (completely optional; you can call update() whenever you want to update the engine) engine.update() update the engine engine.autostart() a simple autostart function; you can use an XML binding like this nasal Some examples: var engine = engines.Jet.new(0, 0, 0.03, 5.21, 3, 5, 1, 6); setlistener("sim/signals/fdm-initialized", func engine.init(), 0, 0); - or - Aircraft/HelloWorld/Nasal/generic-yasim-engine.nas ------------------- FOR TURBOPROPS ONLY ------------------- 2) In another script, call the new() functions for each engine. Use the following syntax: var engine = .Turboprop.new( [, ]); Where: the module name you added the script under (in the example, it is "engines") engine number in FDM minimum condition setting for the engine to turn on (default 0.2) You can then call the following functions in the new object: engine.init() initializes the engine and creates an update loop; should be called AFTER THE FDM IS INITIALIZED (completely optional; you can call update() whenever you want to update the engine) engine.update() update the engine engine.autostart() a simple autostart function; you can use an XML binding like this nasal Some examples: var engine = engines.Turboprop.new(0, 0.4); setlistener("sim/signals/fdm-initialized", func engine.init(), 0, 0); - or - Aircraft/HelloWorld/Nasal/generic-yasim-engine.nas ------------------------- FOR BOTH TYPES OF ENGINES ------------------------- 3) Adapt your FDM, controls, and animations to suit the new control system, refer to the tables below: +-------------------------------------------------------+ |Jet control system | +---------------+---------------------------------------+ |Control |Property | +---------------+---------------------------------------+ |Throttle (user)|/controls/engines/engine/throttle | |Throttle (FDM) |/controls/engines/engine/throttle-lever| |Starter |/controls/engines/engine/starter | |Cutoff |/controls/engines/engine/cutoff | +---------------+---------------------------------------+ |Output |Property | +---------------+---------------------------------------+ |N1 |/engines/engine/rpm | +---------------+---------------------------------------+ +---------------------------------------------------------+ |Turboprop control system | +----------------+----------------------------------------+ |Control |Property | +----------------+----------------------------------------+ |Throttle |/controls/engines/engine/throttle | |Condition (user)|/controls/engines/engine/condition | |Condition (FDM) |/controls/engines/engine/condition-lever| |Starter |/controls/engines/engine/starter | |Cutoff |/controls/engines/engine/cutoff | +----------------+----------------------------------------+ |Output |Property | +----------------+----------------------------------------+ |N2/RPM |/engines/engine/n1 | +----------------+----------------------------------------+