Debian Codegraph @

Aircraft/Generic/Engines/README

raw
1 A YASim Nasal-based engine control system
2 By Ryan Miller (based on Syd Adams's jet/turboprop models)
3 ==========================================================
4
5 Introduction:
6 -------------
7
8 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.
9
10 How to use:
11 -----------
12
13 1) Copy the nasal script (generic-yasim-engine.nas) to your aircraft directory and reference it in -set.xml. An example:
14
15 <nasal>
16 <engines>
17 <file>Aircraft/HelloWorld/Nasal/generic-yasim-engine.nas</file>
18 </engines>
19 </nasal>
20
21 -------------
22 FOR JETS ONLY
23 -------------
24
25 2) In another script, call the new() functions for each engine. Use the following syntax:
26
27 var engine = <module name>.Jet.new(<number> [, <running> [, <idle throttle> [, <max N1 start> [, <N1 start threshold> [, <spool time> [, <start spool time> [, <shutdown time>]]]]]]])
28
29 (Arguments in brackets are optional)
30
31 Where:
32 <module name> the module name you added the script under (in the example, it is "engines")
33 <number> engine number in FDM
34 <running> whether or not the engine should be running on startup (boolean 0/1) (default 0)
35 <idle throttle> 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%)
36 <max N1 start> maximum N1 % that can be reached using the starter switch (default 5.21, same value in JSBSim jets)
37 <N1 start threshold> at this N1 %, the engine can be fully started by turning off the cutoff switch (default 3)
38 <spool time> engine spool time in N1 %/sec (default 4)
39 <start spool time> engine start spool time in N1 %/sec (default 2)
40 <shutdown time> engine shutdown time in N1 %/sec (default 4)
41
42 You can then call the following functions in the new object:
43
44 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)
45 engine.update() update the engine
46 engine.autostart() a simple autostart function; you can use an XML binding like this
47
48 <binding>
49 <command>nasal</command>
50 <script>engine.autostart();</script>
51 </binding>
52
53 Some examples:
54
55 var engine = engines.Jet.new(0, 0, 0.03, 5.21, 3, 5, 1, 6);
56 setlistener("sim/signals/fdm-initialized", func engine.init(), 0, 0);
57
58 - or -
59
60 <nasal>
61 <engines>
62 <file>Aircraft/HelloWorld/Nasal/generic-yasim-engine.nas</file>
63 <script>
64 var engine1 = engines.Jet.new(0, 0, 0.03, 5.21, 3, 5, 1, 6);
65 var engine2 = engines.Jet.new(1, 0, 0.03, 5.21, 3, 5, 1, 6);
66 setlistener("sim/signals/fdm-initialized", func
67 {
68 engine1.init();
69 engine2.init();
70 }, 0, 0);
71 </script>
72 </engines>
73 </nasal>
74
75 -------------------
76 FOR TURBOPROPS ONLY
77 -------------------
78
79 2) In another script, call the new() functions for each engine. Use the following syntax:
80
81 var engine = <module name>.Turboprop.new(<number> [, <min condition>]);
82
83 Where:
84 <module name> the module name you added the script under (in the example, it is "engines")
85 <number> engine number in FDM
86 <min condition> minimum condition setting for the engine to turn on (default 0.2)
87
88 You can then call the following functions in the new object:
89
90 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)
91 engine.update() update the engine
92 engine.autostart() a simple autostart function; you can use an XML binding like this
93
94 <binding>
95 <command>nasal</command>
96 <script>engine.autostart();</script>
97 </binding>
98
99 Some examples:
100
101 var engine = engines.Turboprop.new(0, 0.4);
102 setlistener("sim/signals/fdm-initialized", func engine.init(), 0, 0);
103
104 - or -
105
106 <nasal>
107 <engines>
108 <file>Aircraft/HelloWorld/Nasal/generic-yasim-engine.nas</file>
109 <script>
110 var engine1 = engines.Jet.new(0, 0.4);
111 var engine2 = engines.Jet.new(1, 0.4);
112 setlistener("sim/signals/fdm-initialized", func
113 {
114 engine1.init();
115 engine2.init();
116 }, 0, 0);
117 </script>
118 </engines>
119 </nasal>
120
121 -------------------------
122 FOR BOTH TYPES OF ENGINES
123 -------------------------
124
125 3) Adapt your FDM, controls, and animations to suit the new control system, refer to the tables below:
126
127 +-------------------------------------------------------+
128 |Jet control system |
129 +---------------+---------------------------------------+
130 |Control |Property |
131 +---------------+---------------------------------------+
132 |Throttle (user)|/controls/engines/engine/throttle |
133 |Throttle (FDM) |/controls/engines/engine/throttle-lever|
134 |Starter |/controls/engines/engine/starter |
135 |Cutoff |/controls/engines/engine/cutoff |
136 +---------------+---------------------------------------+
137 |Output |Property |
138 +---------------+---------------------------------------+
139 |N1 |/engines/engine/rpm |
140 +---------------+---------------------------------------+
141
142 +---------------------------------------------------------+
143 |Turboprop control system |
144 +----------------+----------------------------------------+
145 |Control |Property |
146 +----------------+----------------------------------------+
147 |Throttle |/controls/engines/engine/throttle |
148 |Condition (user)|/controls/engines/engine/condition |
149 |Condition (FDM) |/controls/engines/engine/condition-lever|
150 |Starter |/controls/engines/engine/starter |
151 |Cutoff |/controls/engines/engine/cutoff |
152 +----------------+----------------------------------------+
153 |Output |Property |
154 +----------------+----------------------------------------+
155 |N2/RPM |/engines/engine/n1 |
156 +----------------+----------------------------------------+