Board index FlightGear Development Aircraft Systems

Fuel pressure and Fuel quantity from Simulink

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

Fuel pressure and Fuel quantity from Simulink

Postby imaginifico » Sun Mar 28, 2021 5:38 pm

Hello guys,
I'm a newbie on the forum.

I'm developing a flight simulator for a two seat helicopter, using Simulink (Matlab2014) for generating the FDM and FlightGear for the Scenery (version 2.8).

All is working well apart from the following fact.

I did not obtain the fuel inputs from Simulink to display on the FG Scenery (particualry fuel pressure and fuel level).

If you check the page https://www.mathworks.com/help/aeroblks ... tgear.html, you can find the following table referred to the Simulink block:



Signal Group 4: Engine/Fuel Inputs
Name Units Type Width Description
num_engines — uint32 1 Number of engines
eng_state — uint32 4 Engine state (off, cranking, running)
rpm rev/min single 4 Engine RPM
fuel_flow gal/hour single 4 Fuel flow
fuel_px psi single 4 Fuel pressure
egt deg F single 4 Exhaust gas temperature
cht deg F single 4 Cylinder head temperature
mp_osi psi single 4 Manifold pressure
tit deg F single 4 Turbine inlet temperature
oil_temp deg F single 4 Oil temperature
oil_px psi single 4 Oil pressure
num_tanks — uint32 1 Number of fuel tanks
fuel_quantity gal single 4 Fuel quantity per tank




The input for fuel pressure and fuel level are respectively fuel_px (psi unit) and fuel quantity (0 to 1 fraction of tank).

In my model I use only 1 tank and I have activated it with the num_tanks variable.

Searching in other aircraft model (R44 helicopter for example) and the wiki, I did find the following properties:

    /calibration/fuel/tank[0]/level-norm for fuel qantity.
    /engines/engine[0]/fuel-pressure-psi for fuel pressure
.

Unfortunately, both of them do not work. I receive no fuel information in FG on my simulated avionics.

To make a check of the Simulink code, I have connected the fuel pressure and fuel quantity signals to the oil pressure input oil_px.

In that case, using the property /engines/engine[0]/oil-pressure-psi for the 2 signals, I can receive them either on my simulated avionics.

I thought that the problem could reside in the property names of the fuel pressure and fuel quantity.

I've looked a bit on the web and the wiki, and appeared that could exist some other property for the same fuel quantites.

I've tried other possible solutions but I did find nothing that worked.

Could someone give me a hint for this issue?

Thanks in advance

All the Best

GF
imaginifico
 
Posts: 12
Joined: Sun Mar 28, 2021 5:08 pm

Re: Fuel pressure and Fuel quantity from Simulink

Postby erik » Sun Mar 28, 2021 9:24 pm

Is this with the latest version of FlightGear in git or with an older version?
I did some work on the net_fdm code recently and might have accidentally introduced a bug.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Re: Fuel pressure and Fuel quantity from Simulink

Postby imaginifico » Sun Mar 28, 2021 10:25 pm

Hi Erik,
it is with 2.8 version of FG. It is one of those compatible with Simulink.
I think that's a bit old version. Not one of the latest.

It's been some years that I use that.

Thanks for help
imaginifico
 
Posts: 12
Joined: Sun Mar 28, 2021 5:08 pm

Re: Fuel pressure and Fuel quantity from Simulink

Postby wkitty42 » Sun Mar 28, 2021 11:53 pm

imaginifico wrote in Sun Mar 28, 2021 10:25 pm:it is with 2.8 version of FG.

please use the entire version number of FG... especially the first four digits...

taking the "2.8" that you wrote above, FG 2.8.0 from August 17 2012 is the closest version to match... you really really should update to the latest for any real support...
"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: Fuel pressure and Fuel quantity from Simulink

Postby imaginifico » Mon Mar 29, 2021 10:54 am

The version is 2.8.0.5.

I have downloaded in 2018.

Thanks

GF
imaginifico
 
Posts: 12
Joined: Sun Mar 28, 2021 5:08 pm

Re: Fuel pressure and Fuel quantity from Simulink

Postby erik » Mon Mar 29, 2021 1:35 pm

There seem to be no difference in the FDM protocol between the latest version in next and version 2.8.0
So technically I see no reason to stay with version 2.8.0 and would opt for version 2020.3.8. instead.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Re: Fuel pressure and Fuel quantity from Simulink

Postby imaginifico » Mon Mar 29, 2021 8:16 pm

Hi Erik,
do You think that the 2020.3.6. version will solve the problem?

Unfortunately, the blocks in MATLAB/Simulink version that I have, supports versions up to 2.12, as written on the "Help" section of MATLAB.

Or am I wrong about that?

Thanks
imaginifico
 
Posts: 12
Joined: Sun Mar 28, 2021 5:08 pm

Re: Fuel pressure and Fuel quantity from Simulink

Postby erik » Mon Mar 29, 2021 8:52 pm

To be honest I have no idea. It depends on the reason why they claim version 2.12 to be the latest version they support.

If anything we should be able to provide a binary generic protocol definition to get MATLAB/Simulink working with later versions, but for that it is important to know why it would not work (anymore).

Update:

I see mathworks used the net_fdm and net_ctrls packets send out by FligthGear:
https://www.mathworks.com/help/aeroblks ... ation.html

Those haven't changed in ages so it should still work with the latest versions of FlightGear

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Re: Fuel pressure and Fuel quantity from Simulink

Postby imaginifico » Thu Apr 01, 2021 2:57 pm

Hi Erik,
unfortunately for the moment I cannot try the more recent version of FG on my PC. I've no access to the admin user. It's not my private PC.

In the neanwhile, I've found this reference on the web:

https://github.com/JSBSim-Team/jsbsim/commit/b42f4238880ae1729acd55894381f74a0fe1ca13

In the script
src/input_output/FGOutputFG.cpp
, starting from row 220 and following,
You can find setting for Piston Engine model.

There the quantities fuel_px and tit are all set to zero and the fuel_quantity property seems to be under a different property category the "consumables".

Do You think that the problem resides in those settings bertween JSBSim and FlightGear.

Could there be some way to change them?

I'm not a programmer and I'd need some instruction.

There is some refernce about that?

Thanks in advance
The best
imaginifico
 
Posts: 12
Joined: Sun Mar 28, 2021 5:08 pm

Re: Fuel pressure and Fuel quantity from Simulink

Postby imaginifico » Sat May 29, 2021 12:17 pm

Hello guys,
finally I've changed the version of the software oj FG and it did work.
I've chosen the version 2.12.

Thanks guys for help.
imaginifico
 
Posts: 12
Joined: Sun Mar 28, 2021 5:08 pm


Return to Systems

Who is online

Users browsing this forum: No registered users and 1 guest