Here’s an overview of the fuel system from the perspective of a user – not a developer, but maybe it helps.
Do you need the API documentation? Try here for a start:
Here's an overview of the fuel handling in JSBSim now.
At load-time the propulsion system (FGPropulsion) reads the configuration file and builds a list of engines and a list of tanks.
Each engine creates a list of feed tanks using the <feed> tag. This list is only created at load-time, but in the future I'd like to see run-time control over this list. The list is owned by each FGEngine and is called SourceTanks. The list is the same size as the number of tanks, and each list item corresponds to a tank. At load-time each list member is set to zero, and when a <feed> tag is encountered the list member corresponding to that tank is set to non-zero. The engine will only feed from tanks that have a non-zero value in SourceTanks. The non-zero value happens to be equal to the tank's priority, but it's only treated as a non-zero in the ConsumeFuel() algorithm. It could just as well be zeroes and ones. This is, in effect, a map of all the tanks, representing which ones are allowed to feed this engine. The trick in making this run-time modifiable will be to decide on a scheme to allow one property to modify this map.
Each tank has a priority value, with 1 being the highest priority. The
default value is 1. The priority is an attribute owned by the tank, and
it's exposed to the property tree, so the priority can be changed at run-time. Since the priority is owned by the tank, this means that all engines will see the same priority from a given tank. Setting the priority to zero is like closing a valve "at the tank". So far this is the only valve you have control over in the fuel system.
The SourceTanks list, belonging to each engine, can be thought of as a set of valves too. Each engine is connected to all tanks, but a valve "at the engine" is closed for each list member with a value of zero.
When refueling is activated (by setting the property "propulsion/refuel" to 1 or true) fuel is added at the same rate to ALL tanks at a total transfer rate of 6000 lbs per minute, hardcoded. This code presently ignores tank priority. It also ignores what fluid is supposed to be in a particular tank, so don't use this with a rocket. The refuel code could use some work.
When dumping fuel (by setting the property "propulsion/fuel_dump" to 1 or
true) fuel is removed from ALL tanks down to any standpipe level previously defined at load-time for each tank. The dump rate is defined at load-time, and is the rate for the entire fuel system. This code ignores tank priority.
If no standpipe is defined, all fuel will be dumped. Default dump rate is zero.
Total fuel quantity is calculated in FGPropulsion::Run() and written to the property "propulsion/total-fuel-lbs".
Fuel temperature is calculated in FGTank::Calculate(), but only for tanks that had an initial temperature defined at load-time.
Fuel quantity is always measured by weight. There is no method in the code for conversion to volume, and there is no tracking of fuel density. FGPiston does provide a gal/hr output, and uses 6.0 lb/gal as the conversion factor.
FlightGear manipulates the JSBSim tank quantities by converting gallons to pounds in JSBSim.cxx, using a conversion factor of 6.6 lb/gal.