Aircraft maintenance: Difference between revisions

m (Wiki links)
Line 8: Line 8:


== Tanks ==
== Tanks ==
With >= FG2.4.0 the "level-gal_us" and "level-lbs" properties of tanks
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.
/consumables/fuel/tank[..]/level-gal_us
The fuel density has to be defined at start up or it defaults to 755kg/m^3 (Avgas).
/consumables/fuel/tank[..]/level-lbs
Volume is derived from mass and vice versa. The last set property wins. The used formula is
are connected and computed automatically. Aircraft should only set one of these properties manually (i.e. on start-up), and NOT try to configure both.
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 properties for mass, volume and density are interconnected and so are those representing the same property with just individual units.
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.
Usually, fuel density is set statically, so volume is derived from mass and vice versa. The last set property wins. The used formula is
mass = volume * density
Internally, content, density, capacity and the usable fuel is stored in metric units and the (US-)English units are derived by constant built in 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;
The value of the property "usable-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.


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]/*


''Not sure, there is something about it that results in an issue for some aircraft who try to mess with several properties. Torsten knows more...''
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 ==