Board index FlightGear Development Aircraft Systems

Help with fuel system using too much fuel  Topic is solved

Modeling aircraft systems, like electrical stuff, hydraulics, pneumatics? Feel free to ask support.

Help with fuel system using too much fuel

Postby benih » Sat Sep 09, 2017 11:31 pm

Hello,
i am currently trying to modell the fuel system for the c182s but have the problem that the system uses much more fuel than the engine "sucks".
It matches closely the value specified in the external-flow-pps statements.

the model is basicly this:
tank0--+-->fuelSelectorSump->FuelStrainerSump->Pipe ...[2-pumps]...> manifoldTank ...feed...> engine
tank1--+

The flow rates are defined as "5" and fuel flows in the correct order. It stops to flow when target tanks are full and start when they are not full. Fuel selector also works as expected.
What is noticeable is the difference in flow rates when the aux pump is engaged: this fills the manifold at the expected rate and stops when its full. However, for each 0.01 unit it rises, it seems that the chain to the both wing tanks result in a much bigger value sucked out.
This is also true if the engine is running normal.

My assumtion was that i can use arbitary flow rates because jsbsim itself calculates how much fuel needs to be drawn for how long at that rate to transfer the fuel and the switches take care to stop at the right moment. As the tanks are connected via switches and summers, i assumed that this works out.

Currently i am out of ideas, my guess would be that there is a timing problem and the summers and switches need to be synchronized in some way or the other?


The code full code can be viewed here:
- github repo branch: https://github.com/HHS81/c182s/tree/int ... elSelector
- fuel.xml: https://github.com/HHS81/c182s/blob/int ... s/fuel.xml

To reproduce: checkout the aircraft and on the ground open the standard fuel dialog of fgfs ("Fuel and payload settings"). Activate the aux pump (lower left cockpit, near the red battery switches) and observe the filling of the manifold "tank".
Then pull the slider to 0 (empty tank) and repeat, while observing the amount of manifold fill versus the amount reduced in the tanks:
for each 0.05 pounds in manifold fill 12.6 pounds in the wing tanks are removed from EACH tank!

What am i doing wrong here?
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: Help with fuel system using too much fuel

Postby Necolatis » Sat Sep 09, 2017 11:59 pm

I did not read all of it but from a quick glance:

/fdm/jsbsim/propulsion/tank[1]/pct-full LT 100.0

This is not good. This means it will probably overflow by a small amount before it stops. The overflow is 'lost' from the system. The higher the flowrate, the more it can overflow.

For example:

Right tank at 99%
Left tank at 100%

transfer 5% from left to right.

Right tank 100%
Left tank 95%
4% lost

I do the check for 99% or 98% instead of 100% to be sure this don't happen.

I have not before seen <test> nested like that in switches. Are you sure such an inner test without a value will default to 1 and 0?
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2233
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: Help with fuel system using too much fuel

Postby Thorsten » Sun Sep 10, 2017 6:49 am

My assumtion was that i can use arbitary flow rates because jsbsim itself calculates how much fuel needs to be drawn for how long at that rate to transfer the fuel and the switches take care to stop at the right moment.



JSBSim will do nothing of that sort unless you tell it to very explicitly.

External flow rates are what they are, they will interact with the tank only and not care where fuel comes from. Unless you match the numbers, a fuel system can magically generate or waste fuel - you need to explicitly keep tabs on where fuel is supposed to come from and whether a particular transfer is possible, it won't be done for you.

So the scenario you describe suggests you haven't matched the flow numbers.

Edit:

The flow rates are defined as "5" and fuel flows in the correct order.


Actually they aren't....

Code: Select all
       <switch name="fuel/pump-flow-rate-pps">
          (...)
      <test logic="AND" value="0.10">


So yeah, if the pump fills something with 0.1 pps and everything else flows with 5 pps, you're probably losing 49/50 of the fuel you pump...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Help with fuel system using too much fuel

Postby benih » Sun Sep 10, 2017 9:01 am

Thank you very much for the fast replys!
That sounds reaonable.

I thought that by my test for "tank full" the engine would calculate how much is needed.
One thing to consider is also the tank sizes, the sumps are very small compared to the tanks, or isnt that no issue as long as flow numbers match snd are reasonable small?

@Necolatis, regarding the tests, this is how the jsbsim manual says and it works.
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: Help with fuel system using too much fuel

Postby Thorsten » Sun Sep 10, 2017 9:47 am

You actually have the external flow rate properties runtime for each tank. You can print them on-screen and check that whatever you do, the gain terms for one tank equal the loss terms for another tank.

It takes some organization to debug the numbers, but if you have the flow schematics, you can check that values at each node are what you expect them to be. Generally fuel systems in JSBSim don't qualify as particularly nice problems - but they're doable.

And you have a fairly easy one - the Shuttle with OMS to OMS, RCS to RCS and OMS to RCS crossfeeding at both sides is quite a bit more of a mess...

One thing to consider is also the tank sizes, the sumps are very small compared to the tanks, or isnt that no issue as long as flow numbers match snd are reasonable small?


You're evaluating everything 120 times per second - that might give you an indication of the discretization rate - if your flow rate is five pounds per second, then per timestep you're actually transferring 1/120 of that. I would not assume that any of this is an issue unless you insert abnormally large rates (trying to drain a 120 lb tank with a flow rate of 1000 lb/s might lead into issues).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Help with fuel system using too much fuel

Postby Thorsten » Sun Sep 10, 2017 11:01 am

My assumtion was that i can use arbitary flow rates because jsbsim itself calculates how much fuel needs to be drawn for how long at that rate to transfer the fuel and the switches take care to stop at the right moment.


Afterthought:

I suspect it can't hurt to spell out how this really works.

The external flow rate is a magic device associated with a tank. It can be set to some number. If the number is positive, it means fuel will magically appear from nowhere and will fill the tank. If the tank is full, you can keep the number positive, it won't be set to zero by itself, the tank will not fill more, but the 'magically appearing' fuel will be lost.

Likewise, if the number is negative, you will drain a tank and fuel will magically disappear. If the tank is empty, it won't get any emptier regardless of what the number is.

So JSBSim will not compute any flow rates (you'll have to provide them), nor will it do anything but the most basic sanity check on tank content.

Fuel transfer means that you generate a magic sink in one tank where fuel disappears, and a magic source in the other tank where it appears in the same quantity. JSBSim does not transfer any fuel internally, it just adds to one tank and subtracts from the other whatever you tell it to - so unless you do it right, fuel will appear or disappear. The transfer happens only in your interpretation of the numbers, in reality it's two magic devices which just happen to mimic a transfer.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Help with fuel system using too much fuel

Postby benih » Sun Sep 10, 2017 11:38 am

Thank you for pointing that out so clearly.

But given my system, why doesnt it work?
Lets examine a simpler one with two tanks and the engine:
- as long as t1 has fuel and t2 is not yet full, it should drain with 5pps.
- the outflow is considered t2 inflow (summer adjusting external-flowrate)
- also the sucking rate of the engine is honored in t2's sum.

As i understood, it should behave like this:
- t1 drains 5pps, b3cause t2 is fully empty. At the same time t2 fills with 5pps minus the value of the engine, most notably slower than t1 drains.
- this causes t2 slowly to fill.
- in the 120/sec evaluation cycle there will apear the situation where t2 is full and so the t1 outflow gets set to 0 (t2 flow gets reduced also, only engine suck remains)
- now i expect t1 outflow to osvillate.


=> if i understood you right, the problem is at just this oscillazion point:
- t2 lacks only a minimal ammount of fuel but is not "full"
- this leads to a drain of 5pps for the next evaluation cycle.
- that drains and fills too much, leading to excess drain & fill simultaneously, loosing fuel there - the reason is, that the 5ppm drain for one cycle equals more fuel than is free space in t2
- most of the evaluation cycle this is true, so occurring nearly all of the time.

Am i understanding this correctly?
But what is the solution to fix this?
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: Help with fuel system using too much fuel

Postby Thorsten » Sun Sep 10, 2017 12:11 pm

Am i understanding this correctly?
But what is the solution to fix this?


That's probably what happens, yes.

The solution is to reduce the transfer rate dynamically to zero as t2 gets near-full - which a JSBSim table can easily accomplish.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Help with fuel system using too much fuel

Postby benih » Sun Sep 10, 2017 1:49 pm

Can you please advise how exactly this can be accomplished (ie which compinent do i need? How to configure it?)
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: Help with fuel system using too much fuel

Postby wkitty42 » Sun Sep 10, 2017 3:35 pm

maybe think of having a shutoff valve on a float... as t2 fills, the valve starts closing and reducing the flow rate of the fuel being transferred... so whatever number you are using as your flow rate needs to be reduced as t2 gets fuller... when t2 reaches a certain fill level, the flow rate number has been reduced to zero by the "valve" code... when t2's level falls to a certain level, the valve would open again and allow some fuel to flow in...

in other words, i think you're missing the float valve simulation that adjusts the fuel flow rate into/out of the tank(s)...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9148
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Help with fuel system using too much fuel

Postby benih » Sun Sep 10, 2017 3:59 pm

Yes, i meant the technical implementation, the code. How to define something like that in xml for jsbsim?
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: Help with fuel system using too much fuel

Postby Thorsten » Sun Sep 10, 2017 4:27 pm

It's not rocket science, something like this

Code: Select all
<fcs_function name="systems/fuel/flow-rate-final</fcs_function>
<function>
<table>
                  <independentVar lookup="row">tank/fraction-full</independentVar>
                  <tableData>
                          0.0   5.0
                          0.8   5.0
                          0.9   1.0
                          0.98 0.1
                          1.00 0.0
                  </tableData>
         </table>
</function>
</fcs_function>


(property names made up of course).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Help with fuel system using too much fuel

Postby benih » Sun Sep 10, 2017 4:45 pm

Ah, using a function!
Thank you, i will try that out. Does the system interpolate intermediate values, or how is a key like 0.8646 handled?
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: Help with fuel system using too much fuel

Postby Octal450 » Sun Sep 10, 2017 5:20 pm

Maybe you want to check my fuel system for the PA28?

https://github.com/Octal450/PA28-Warrio ... s/fuel.xml

Engine pulls from tank 2 (counting from 0)

Kind Regards,
Josh
Last edited by Octal450 on Tue Nov 29, 2022 6:35 pm, edited 1 time in total.
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Help with fuel system using too much fuel

Postby Thorsten » Sun Sep 10, 2017 6:24 pm

Does the system interpolate intermediate values, or how is a key like 0.8646 handled?


It interpolates - but may I simply refer you to the JSBSim manual for questions like what the basic tags do?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Next

Return to Systems

Who is online

Users browsing this forum: No registered users and 0 guests