• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Advanced EICAS features

Messages
181
Country
czechrepublic
Hello dear developers,
I am currently working on EICAS:

283873_1899458050017_1348620800_31650170_7751464_n.jpg


I am about to make the 3 bottom left text fields:

ECON ___ NMPP (which should read how many NM can I fly with economic fuel flow and standard cruising speed - so I need to multiple current remaining fuel with some number (constant))

Endurance (time remaining with present fuel flow - so I need to calculate current fuel remaining/current fuel flow)

Initial fuel - fuel ammount at startup - can I get it from FS somehow? I dont see it in list of variables :-(

So, could you please advise me how can i make calculations in XML? I need some <String>%((remaining fuel x number))%</String> and something simmilar for endurance + variable for initial fuel - pls :-)

Danke,
Pavel
 
Hello Pavel,

In the past, these were always created for me by other gauge writers, and were elaborate, based on what was found the fuel flow to be at, which was entered into the calculations. We'll see what the power coders write.




Bill O.
 
Based on the assumption that you want to know range when settled at a cruise speed and endurance when flying for endurance, the calculation should be based on current fuel flow and groundspeed. I used a minimum of 2000 lbs remaining as a safety factor, you can change that to any other number. I also coded so the value was zero if on the ground. It is for a two engined airplane

First range
Code:
<Value>(A:SIM ON GROUND,bool) 0 == if{ (A:FUEL TOTAL QUANTITY WEIGHT,pounds) 2000 - (&gt;L:FUEL AVAILABLE,number) (A:ENG FUEL FLOW PPH:1,pounds per hour) (A:ENG FUEL FLOW PPH:2,pounds per hour) + (&gt;L:FUEL RATE,number) (L:FUEL AVAILABLE,number) (L:FUEL RATE,number) / (A:GPS GROUND SPEED, knots) * (&gt;L:RANGE AT 2000,number) } els{ 0 (&gt;L:RANGE AT 2000,number) }</Value>

Once you have done that, endurance (or time to go) is simply range divided by groundspeed

Code:
<Value>(A:SIM ON GROUND,bool) 0 == if{ (L:RANGE AT 2000,number) (A:GPS GROUND SPEED, knots) /  (&gt;L:ENDURANCE TO 2000,number) } els{ 0 (&gt;L:ENDURANCE TO 2000,number) }</Value>

Initial fuel (assuming full tanks) would be (FUEL TOTAL CAPACITY,GALLONS) times the fuel density, in pounds per gallon.

The range calculation will be pessimistic on initial climb, but will get better and better on cruise as fuel weight reduces and induced drag reduces. It will also improve with increased altitude up to the best cruise altitude for the weight.

Roy
 
What's up with this penchant for putting all the script on one line? It makes it very difficult to parse visually and verify the internal logical structure at a glance... :scratchch

This format makes the logic very clear and easy to follow... :twocents:
Code:
<Value>(A:SIM ON GROUND,bool) 0 == 
  if{ 
    (A:FUEL TOTAL QUANTITY WEIGHT,pounds) 2000 - 
      (&gt;L:FUEL AVAILABLE,number) 
      
    (A:ENG FUEL FLOW PPH:1,pounds per hour) 
    (A:ENG FUEL FLOW PPH:2,pounds per hour) + 
      (&gt;L:FUEL RATE,number)
       
    (L:FUEL AVAILABLE,number) 
    (L:FUEL RATE,number) / 
    (A:GPS GROUND SPEED, knots) * 
      (&gt;L:RANGE AT 2000,number) } 
      
  els{ 0 (&gt;L:RANGE AT 2000,number) }
</Value>


<Value>(A:SIM ON GROUND,bool) 0 == 
  if{ (L:RANGE AT 2000,number) 
    (A:GPS GROUND SPEED, knots) /  
      (&gt;L:ENDURANCE TO 2000,number) } 
  els{ 0 (&gt;L:ENDURANCE TO 2000,number) }
</Value>
 
Last edited:
Bill,
Thank you, it does make it clearer.

Put it down to my blankaphobia or fear of white spaces.

Roy
 
Wow, thank you guys for so detailed reply... but if I insert Bills code to my gauge

Code:
<Element>
	<Position X="130" Y="650"/>
	<Text X="80" Y="28" Bright="Yes" Length="4" Font="Arial" Color="white" Adjust="Right" VerticalAdjust="Center">
	<String>%

<Value>(A:SIM ON GROUND,bool) 0 == 
  if{ 
    (A:FUEL TOTAL QUANTITY WEIGHT,pounds) 2000 - 
      (&gt;L:FUEL AVAILABLE,number) 
      
    (A:ENG FUEL FLOW PPH:1,pounds per hour) 
    (A:ENG FUEL FLOW PPH:2,pounds per hour) + 
      (&gt;L:FUEL RATE,number)
       
    (L:FUEL AVAILABLE,number) 
    (L:FUEL RATE,number) / 
    (A:GPS GROUND SPEED, knots) * 
      (&gt;L:RANGE AT 2000,number) } 
      
  els{ 0 (&gt;L:RANGE AT 2000,number) }
</Value>

	%!4d!</String>
	</Text>
	</Element>

compile to CAB and load in FS9 - everything in FS starts blinking, all animations are moving (perpetum mobile) and there is no text displayed on my EICAS... I guess I am doing something terribly bad :eek:
 
Take off the Value tags in the string. They shouldn't be there, and you should have some final brackets for completeness. You also needed to actually display the variable at the end if you're going to arrange the code like that:

Code:
<Element>
	<Position X="130" Y="650"/>
	<Text X="80" Y="28" Bright="Yes" Length="4" Font="Arial" Color="white" Adjust="Right" VerticalAdjust="Center">
	<String>%( (A:SIM ON GROUND,bool) 0 == 
  if{ 
    (A:FUEL TOTAL QUANTITY WEIGHT,pounds) 2000 - 
      (&gt;L:FUEL AVAILABLE,number) 
      
    (A:ENG FUEL FLOW PPH:1,pounds per hour) 
    (A:ENG FUEL FLOW PPH:2,pounds per hour) + 
      (&gt;L:FUEL RATE,number)
       
    (L:FUEL AVAILABLE,number) 
    (L:FUEL RATE,number) / 
    (A:GPS GROUND SPEED, knots) * 
      (&gt;L:RANGE AT 2000,number) } 
      
  els{ 0 (&gt;L:RANGE AT 2000,number) } (L:RANGE AT 2000,number)
	)%!4d!</String>
	</Text>
	</Element>
 
Last edited:
Thank you for fast reply. The displayed number on EICAS now works fine (I will never get used to those brackets...), but the problem with flashing FS still remains - when I load airplane with this gauge, whole FS flashes, my animated buttons in VC move chaotically, clouds flash, textures in VC... everything. I have recorded short video with this bug (http://www.youtube.com/watch?v=ivb4d8-2WPg - should be viewable for everyone)

But it has one more problem - now I am a little bit unsure what "NMPP" means - everyone here takes it as "range with actual fuel flow and groundspeed", but I expected it to be "Nautical mile per (one) pound", so some quite small number (what else could NMPP mean?)... what do you think? Yes, I will certainly ask a question to aircraft manufacturer (who cooperates pretty well with me), but it will take a veeery long time to receive some suitable answer from them (as usually)...

Pavel
 
Last edited:
Hmmm. Are you positive it's that gauge? Looks like something is seriously depriving the FS core of execution time, or there's a memory leak.

Try replacing it with this. This is a more optimised and simplified version:

Code:
<Element>
	<Position X="130" Y="650"/>
	<Text X="80" Y="28" Bright="Yes" Length="4" Font="Arial" Color="white" Adjust="Right" VerticalAdjust="Center">
	<String>%( (A:SIM ON GROUND,bool) 0 == 
  if{ 
    (A:FUEL TOTAL QUANTITY WEIGHT,pounds) 2000 - 
      
    (A:ENG FUEL FLOW PPH:1,pounds per hour) 
    (A:ENG FUEL FLOW PPH:2,pounds per hour) + 
      (&gt;L:FUEL RATE,number)
       / 
    (A:GPS GROUND SPEED, knots) * 
     }   
  els{ 0 }
	)%!4d!</String>
	</Text>
	</Element>
 
Pavel,
As you said, NMPP, most probably stands for Nautical Miles Per Pound of fuel which is sometimes known as Specific Range. It is usually expressed as True Airspeed in nautical miles per hour divided by Fuel Flow in pounds per hour.

However, since you have groundspeed, and you want NMPP to see how far you can fly, I would suggest just dividing groundspeed by fuel flow.

Roy
 
I tried the modifed verion of this element - FS is ok, but it returns "0".

Roy is describing it exactly - so I tried my own specific range code, but it also returns only "0" - I am again doing something bad... I added some decimal numbers, because I expect the result to be less than 1 NM per 1 pound of fuel - but still I am getting "0.00" :-(

Code:
<Element>
	<Position X="130" Y="650"/>
	<Text X="80" Y="28" Bright="Yes" Length="6" Font="Arial" Color="white" Adjust="Right" VerticalAdjust="Center">
	<String>%( (A:SIM ON GROUND,bool) 0 == 
  if{ 
	(A:ENG FUEL FLOW PPH:1,pounds per hour) 
    	(A:ENG FUEL FLOW PPH:2,pounds per hour) +
		(&gt;L:FUEL RATE,number)


	(A:GPS GROUND SPEED, knots)
    	(L: FUEL RATE, number) /
     }   
  els{ 0 }
	)%!3.2f!</String>
	</Text>
	</Element>
 
Btw how with the initial fuel? Roy says how to calculate it for initially full tanks - but what if I takeoff with half empty tanks? I guess it could be easier calculated as

used fuel + actual remaining fuel, but I dont know how to get used fuel (some A variable for it? I dont see any) :-(
 
Pavel,
If your tanks were not full initially, there is no way to calculate initial fuel. You could not use "FUEL USED" because, at the start of a flight you have not used any. You would have to enter the fuel you have at start up in some kind of initiation routine, so that value would stay the same during the flight.

Something like:
Code:
<Element>
	<Select>
	<Value>(L:Fuel_Init,bool) 0 == 
if{ 
(A:FUEL TOTAL QUANTITY WEIGHT,pounds) (&gt;L:INITIAL_FUEL,pounds) 
1 (&gt;L:Fuel_init) 
}
</Value>
	</Select>
</Element>

On start (L:fuel_init,bool) would be zero, you would write the total fuel weight into (L:INITIAL_FUEL,pounds) for display. (L:fuel_init,bool) is then set to 1, so this code will not be run again.

On the post before your last, I think there may be lurking blank spaces or lack thereof. Check that there is one space between { and ( as well as between ) and}

Roy

Darned if I know how to get tabs to work. Help please
 
Last edited:
Roy, thank you for your hint, I tried to do it thisway:

<!-- calculation initial fuel -->
<Element>
<Select>
<Value>(L:Fuel_Init,bool) 0 ==
if{
(A:FUEL TOTAL QUANTITY WEIGHT,pounds) (&gt;L:INITIAL_FUEL,pounds)
1 (&gt;L:Fuel_init)
}
</Value>
</Select>
</Element>

<!-- text initial fuel --><Element>
<Position X="150" Y="772"/>
<Text X="80" Y="28" Bright="Yes" Length="4" Font="Arial" Color="white" Adjust="Right" VerticalAdjust="Center">
<String>%(L:INITIAL_FUEL,pounds)%!4d!</String>
</Text>
</Element>

And result? It returns number which is ca. 17 LB more than my actual remaining fuel

Code:
<!-- text REM --><Element>
	<Position X="950" Y="775"/>
	<Text X="80" Y="28" Bright="Yes" Length="4" Font="Arial" Color="white" Adjust="Left" VerticalAdjust="Center">
	<String>%(
	(A:FUEL TANK LEFT MAIN QUANTITY, Gallons)
	(A:FUEL TANK RIGHT MAIN QUANTITY, Gallons) +
 	6.67 *)%!4d!</String>
	</Text>
	</Element>

The problem is, that both those numbers are decreasing as I am burning the fuel... so my initial fuel is still less and less :-D I understand your idea how you ment it, but it seems that I need some code more to ensure this part of script to run only once... Shouldnt be there some "else"? If bool = 0 -> write to my L:var and set bool 1 is ok, but I guess there should be some "else do nothing", dont you think so? I tried to add els { 1 (&gt;L:Fuel_init) } but no change

Pavel

////////////////////////////////////////

Ad. NMPP - still returns "0" - I am lost :-( And because of that I can not make the endurance working also
 
Last edited:
My fault! missed the last bool. This should work
Code:
<Element>
	<Select>
	<Value>(L:Fuel_Init,bool) 0 == 
if{ 
(A:FUEL TOTAL QUANTITY WEIGHT,pounds) (&gt;L:INITIAL_FUEL,pounds) 
1 (&gt;L:Fuel_init,[COLOR="Red"]bool)[/COLOR] }
</Value>
	</Select>
</Element>

Roy
 
Okay, thank you, it works great! And using it I also managed to do FUEL USED text :-)

Now only NMPP (and when done -> Endurance) left, I am still experimenting
 
I've got it!

Code:
<!-- text NMPP --><Element>
	<Position X="130" Y="650"/>
	<Text X="80" Y="28" Bright="Yes" Length="6" Font="Arial" Color="white" Adjust="Right" VerticalAdjust="Center">
	<String>%(
	(A:Eng fuel flow GPH:1, gallons per hour) 
	(A:Eng fuel flow GPH:2, gallons per hour) + 
	(A:Eng fuel flow GPH:3, gallons per hour) + 
	(A:Eng fuel flow GPH:4, gallons per hour) + 
	60 / 
	(A:FUEL TOTAL QUANTITY, gallon) r / 
	60 / 
	(A:GPS Ground Speed, knot) *
	(A:FUEL TOTAL QUANTITY WEIGHT,pounds) /
	)%!6.2f!</String>
	</Text>
	</Element>

<!-- text endurance --><Element>
	<Position X="160" Y="715"/>
	<Text X="80" Y="28" Bright="Yes" Length="5" Font="Arial" Color="white" Adjust="Right" VerticalAdjust="Center">
	<String>%(
	(A:Eng fuel flow GPH:1, gallons per hour)
	(A:Eng fuel flow GPH:2, gallons per hour) + 
	(A:Eng fuel flow GPH:3, gallons per hour) + 
	(A:Eng fuel flow GPH:4, gallons per hour) + 
	60 / 
	(A:FUEL TOTAL QUANTITY, gallon) r / 60 

	div)%!02d!:%(
	(A:Eng fuel flow GPH:1, gallons per hour) 
	(A:Eng fuel flow GPH:2, gallons per hour) + 
	(A:Eng fuel flow GPH:3, gallons per hour) + 
	(A:Eng fuel flow GPH:4, gallons per hour) + 
	60 / 
	(A:FUEL TOTAL QUANTITY, gallon) r / 60 
	%)%!02d!</String>
	</Text>
	</Element>

Some code was taken from some freeware gauge which I found and I only modifed it a little bit to fit my gauge... works!

Pavel
 
Hmm, not so easy... could somebody tell me how can I do a conditional code which will allow the endurance to be calculated only if at least one engine is running? Because now if I shut engines down (in air or on ground), the endurance runs up into some infinite numbers :mad:
 
Simplest thing would be to use a <Visible> line to only allow the endurance string to appear when an engine is running.

The other way is to set up an if{ els{ statement that tests for an engine running. If yes, then display the endurance. If not, display 0.

Hope this helps,
 
Back
Top