381
edits
m (Wiki links) |
(→Tanks) |
||
Line 8: | Line 8: | ||
== Tanks == | == Tanks == | ||
With >= FG2.4.0 the | With >= FG2.4.0 the properties for mass, volume and density are interconnected and so are those representing the same property with just individual units. Aircraft should only set either mass or volume manually (i.e. on start-up), and NOT try to configure or compute both. | ||
The fuel density has to be defined at start up or it defaults to 755kg/m^3 (Avgas). | |||
Volume is derived from mass and vice versa. The last set property wins. The used formula is | |||
are | mass = volume * density | ||
or it's variation | |||
volume = mass / density | |||
Internally, content(mass), density(mass per volume), capacity(volume) and the unusable fuel(volume) are stored in metric units and the (US-)English units are derived by applying hard-coded conversion factors: | |||
* LBS_PER_KG = 2.20462262 | |||
* KG_PER_LBS = 1.0/LBS_PER_KG | |||
* USGAL_PER_M3 = 1000.0/3.785411784 | |||
* M3_PER_USGAL = 1.0/USGAL_PER_M3 | |||
* IMPGAL_PER_M3 = 1000.0/4.54609 | |||
* M3_PER_IMPGAL = 1.0/IMPGAL_PER_M3 | |||
No property-value can ever become less than zero. Division by zero errors (e.g. if density=0.0) are internally avoided. | |||
The value of the property "unusable-xxx" is constantly compared against "content-xxx" and drives the value of the boolean property "empty". If content is less than usable, empty is true. | |||
The value of the property " | |||
All the individual tanks are summed up to the properties /consumables/fuel/total-fuel-xxx | All the individual tanks are summed up to the properties /consumables/fuel/total-fuel-xxx | ||
=== Aircraft developer's best practice === | |||
To create and initialize the tank properties for you aircraft, define your basic set of properties for each tank in your aircraft's -set.xml: | |||
<syntaxhighlight lang="xml"> | |||
<consumables> | |||
<fuel> | |||
<tank n="0"> | |||
<name type="string">Left Wing</name> | |||
<capacity-gal_us type="double">64.0</capacity-gal_us> | |||
<unusable-gal_us type="double">2.5</unusable-gal_us> | |||
<level-gal_us type="double">50</level-gal_us> | |||
</tank> | |||
<tank n="1"> | |||
<name type="string">Right Wing</name> | |||
<capacity-gal_us type="double">64.0</capacity-gal_us> | |||
<unusable-gal_us type="double">2.5</unusable-gal_us> | |||
<level-gal_us type="double">50</level-gal_us> | |||
</tank> | |||
</fuel> | |||
</consumables> | |||
</syntaxhighlight> | |||
This will initialize and maintain /consumables/fuel/tank[0..1]/* | |||
Alternatively, just define the number of tanks and fill in the values later (e.g. from Nasal): | |||
<syntaxhighlight lang="xml"> | |||
<consumables> | |||
<fuel> | |||
<numtanks>32</numtanks> | |||
</fuel> | |||
</consumables> | |||
</syntaxhighlight> | |||
This will initialize and maintain /consumables/fuel/tank[0..31]/* | |||
Note: if /consumables/fuel/numtanks exist and at least one /consumables/fuel/tank exist, the latter takes precedence over numtanks. | |||
== Instruments == | == Instruments == |