Hello everyone,

I have managed to get working and test my fuel gauge with te USBServos Software, but a rather large SIOC task is required...

Basically, I want the fuel gauge to display the OVERALL WEIGHT in Pounds of all the fuel in my aircraft.

Unfortunately, no offset is available directly for this (?), so I will have to add many offsets of the tank values in gallons, then times this by offset 0AF4 to get the WEIGHT(?).

Please could somebody give me a SIOC example, or something alnog the lines, of how this is achieved?

2. ## Re: Big SIOC Task

Jack

Is this what you want

Fuel: total quantity weight in pounds (32-bit integer)

If so, then I should check your FSUIPC offset table - try in the region of 123E to 1270

David

3. ## Re: Big SIOC Task

Originally Posted by fordgt40
Jack

Is this what you want

Fuel: total quantity weight in pounds (32-bit integer)

If so, then I should check your FSUIPC offset table - try in the region of 123E to 1270

David
Hi David,

Yes, that's exactly what I'm looking for. Thank you very much!

However, I can't seem to find that particular offset in neither the PM Offsets table or FSUIPC SDK Programmers Manual. Any ideas?

EDIT: Would offset \$126C do the job?

4. ## Re: Big SIOC Task

Hi Jack,

Here an example in kg (but that is easy to change to lbs):

Code:
```// For the Level-D 767
//
//   Total amount of fuel, displayed as xy.z * 1000 kg
//
// Note for other aircaft you have to use otther scaling factors for the
// Left, Center and Right tank.
//
// Nico Kaan

Var 1 name FI_FuelL Link FSUIPC_IN Offset \$0B7C Length 4
{
CALL &CalcTotal
}

Var 2 name FI_FuelC Link FSUIPC_IN Offset \$0B74 Length 4
{
CALL &CalcTotal
}

Var 3 name FI_FuelR Link FSUIPC_IN Offset \$0B94 Length 4
{
CALL &CalcTotal
}

Var 4 name FuelTotal
{
CALL &OutFuelTotal
}

Var 5 name CalcTotal Link SUBRUTINE
{
L0 = &FI_FuelL
L1 = L0 + &FI_FuelR
L2 = DIV L1 45467
L1 = DIV &FI_FuelC 22734
&FuelTotal = L1 + L2
}

Var 6 name OutFuelTotal Link SUBRUTINE
{
&O_FuelTDP = 1
L0 = MOD &FuelTotal 100
L1 = DIV &FuelTotal 100
IF L1 > 0
{
&D_FuelTH = L1
}
ELSE
{
&D_FuelTH = -999999 // blank display
}
&D_FuelT = L0
}

Var 9019 name D_FuelT Link IOCARD_DISPLAY Digit 76 Numbers 2
Var 9020 name D_FuelTH Link IOCARD_DISPLAY Digit 78 Numbers 1```
Nico

5. ## Re: Big SIOC Task

Jack

EDIT: Would offset \$126C do the job?

That is what I would use

David

6. ## Re: Big SIOC Task

Hiya guys,

@Nico, wouldn't it just be easier to use one Offset?

7. ## Re: Big SIOC Task

Originally Posted by Boeing 747 Flyer
Hiya guys,

@Nico, wouldn't it just be easier to use one Offset?
If there is such an offset: yes of course....
This code is from my 767 cockpit, I also display the fuel amounts in the Left, Center and Right tanks.

Nico

8. ## Re: Big SIOC Task

Right, prepare to recoil in horror at this SIOC script... BUT! I have had a go nonetheless. I know I've really mssed the brackets up at the end but I'm posting it here incase someone can note any false calcs or other problems (I AM AWARE THE SIOC SCRIPT ISN'T PERFECT):

Code:
```Var 8666, Link FSUIPC_IN, Offset \$126C, Length 4, Type 1     // Vertical Speed
{
L0 = V8666     // FSUIPC conversion, L0=VS
L0 = ABS L0     // L0 not signed
L2 = L0
IF L0 <= 400     // First sector
{
L1 = L2 * 0.91     // (364 steps/400 values) = 0.91
}
IF L0 <= 1200
{
L1 = L2 * 0.5975     // (478 steps / 800 values) = 0.5975
L1 = L1 + 364    // Add steps of others sectors
}
IF L0 <= 1500     // 3. Sector
{
L1 = L2 * 0.47     // ( 141 / 300) = 0.47
L1 = L1 + 842     // Add steps of others sectors 364 + 478
}
L1 = 983        // Max. position
}
{
&FuelGauge = 0 + L1     // Add to Minimum
}

Var 0555, name FuelGauge, Link USB_SERVOS, Output 2, PosL 0, PosC 492 , PosR 983, Type 2     // Fuel Gauge Servo```
I know it's probably wrong... I just literally ripped it off've my VSI script and modified it, reason being is that both of them are non-linear scales.

9. ## Re: Big SIOC Task

Jack

Firstly, well done for trying!

As a courtesy to those you are seeking help from, it would be nice if the comments were updated to reflect what you are trying to do. Also, you should really try compiling and removing any syntax errors prior to posting, it makes it easier to give advice.

Specific comments are that your brackets controlling the IF functions will not achieve the logic you intend. For example, assuming that L0 has a value of 300 then the line is executed

L1 = L2 * 0.91 // (364 steps/400 values) = 0.91

However, the fllowing line will also be executed (which you do not want)

L1 = L2 * 0.5975 // (478 steps / 800 values) = 0.5975

In both cases the value of L0 passes the code tests, ie it is both less than 400 and less than 1200

You need to look again at your code logic and use of brackets. Nico`s site has some useful info on this
Also not certain that you need TYPE 1 in line 1

David

10. ## Re: Big SIOC Task

Right, one thing I need to know before starting again...

Is there any importance in leaving spaces on the brackets? What I mean is, the Brackets in most people scripts are all spaced out differently... Is this just here so we can associate which bracket goes with which, or is there another importance?

Also, regarding the IF logic - Can I just completely close the brackets around the previous action before the IF, or will I have to completely change the logic behind the values (ie just not the brackets), I see what you mean about => 400 and => 1200 being the same...

Page 1 of 3 123 Last