Some CircleSoft Case studies

<-Previous Case

2. CircleSoft's In-flight Fuel Monitoring System

CircleSoft aircraft operations required an unusual combination of fuel tanks gauging, monitoring and fuel management system. The team decided to home roll a system to meet the following requirements:

1. simple system calibration
2. accurate display of fuel quantity
3. warning lights for low fuel levels
4. automation of transfer pumps

The use case diagram at the left illustrates all desired functionality.


All in-flight systems require simplicity in design for reliability. A minimal hardware architecture was adopted as seen in this UML component diagram:

The Atmel TINY 2313 embedded RISC processor was chosen to implement the gauging circuit.  A single chip is required for each of the three tanks gauged.

Analysis reveals a simple state system:

Calibration is performed by pressing and holding the calibrate push button until the fuel warning led blinks amber. the gage is slowly brought up to full and the button is released at full. The calibration algorithm assumes the tank is started empty. A fixed quantity of fuel is then added to the the tank. The calibration button is then pressed again. the fuel warning led turns blinking green. The meter then goes to empty, holds for two seconds and then goes to full. the fuel warning led starts to blink amber again The same quantity of fuel is added to the tank and the calibration button is pressed again. the fuel warning led turns blinking green
this time the gauge goes to empty, pauses for 2 seconds, then goes to half pauses for two seconds and then back to full.

This procedure is repeated until the tank is full each time the fuel gauge pauses and increasing number of times.

Once the tank is full, the calibration button is pressed again and the led blinks red.
Once the led is blinking red the calibration button is pressed once again and the system leaves calibration mode.

The Gauge in Operation

 ; calculated at calibration
N = number of calibration points
tab[N] = calibration table
Gdelta = 256 / N - 1
Gdelta` = 1024 / N - 1
; step 1 get new period
inp = current oscillator period

; step 2 walk the table
i = first table value > inp

; step 3 setup for interpolation
 ; target table range
Cdelta = tab[ i ] - tab[ i - 1]
; shift up to improve accuracy
Cdelta` = Cdelta << 4
; value to interpolate table
Idelta = inp - tab[ i - 1 ] 
; shift up to improve accuracy
Idelta` = Idelta << 4

; step 4 interpolate
; table interpolation value
terp = Cdelta' / Idelta'

; step 5 calculate gage value
Gage = ( ( terp * Gdelta` ) +
              ( Gdelta` * ( i - 1 ) ) ) >> 4


The above algorithm interpolates the gage value which goes from 0 empty to 256 full with a single integer division and no floating point maintains accuracy over 1024 parts during the division. This assumes that the periods for more fuel in the tanks are longer than the period for an empty tank and no adjacent values in the calibration table exceed 4096 in difference. All values are 16 bit except the gage value and i.

<-Previous Case

Next Case->


Recommend this article to a colleague
Recommend this article to a colleague and cc CircleSoft

back to top

Technical Tips
Contact us