• 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 [SOLVED] EPR Calculation

the equation are no change.
only result are modified as it render in sim for smooth change purpose.
timer will add/subtract gradually till match with equation result. after value match switch immediately with correct equation.

add note:
I use C++ for gauge, have limit knowledge in XML.
 
Last edited:
The typical method to provide smooth transitions between values is to use what is called a first order lag.
 
Okay, some point blank googling has revealed that first order lag sounds like it's a bit over my head.

new_filtered_value = k * raw_sensor_value + (1 - k) * old_filtered_value

What is the raw sensor value in this situation? How is it different from the old filtered value?

The math involved here is just slightly over what I learned in my degree studies... :oops:
 
Code:
(>L:ENG2 EPR, number)
would be raw sensor value .

But you could also use XMLTools to create arrays and make the proper calculations.
 
Code:
(>L:ENG2 EPR, number)
would be raw sensor value .

But you could also use XMLTools to create arrays and make the proper calculations.

I am also not familiar with XMLTools. Is there a version for FS2004? That is what I am working with.
 
Code:
(>L:ENG2 EPR, number)
would be raw sensor value .
Thank you!

Going further with the first order lag, I am still struggling with how to implement it. I have it set up such that I though it would work but isn't doing anything except causing my mach number if statements to not work.

Here is my code. L:EPR Filtered is the value that I want for EPR after adjusting for mach. I have started with a time constant (k) value of 1 second just for testing.

XML:
<Gauge Name="747 EPR Indicator" Version="1.0">
    <Image Name="EPR.bmp"/>
    <!--Calculation of Delta-->
    <Element>
        <Select>
            <Value>
                (A:AMBIENT PRESSURE,inHg) 29.92 / (>L:Delta, number)
            </Value>
        </Select>
    </Element>
        <!--Calculation of Delta2-->
    <Element>
        <Select>
            <Value>
                (L:Delta, number) (A:AIRSPEED MACH,mach) (A:AIRSPEED MACH,mach) * 0.2 * 1 + 3.5 pow * (>L:Delta2, number)
            </Value>
        </Select>
    </Element>
    <!--Calculation of Corrected Net Thrust-->
    <Element>
        <Select>
            <Value>
                (A:TURB ENG1 JET THRUST,lbs) (L:Delta2, number) / (>L:Corrected Net Thrust ENG1, number)
            </Value>
        </Select>
    </Element>
    <!--Calculation of EPR-->
    <Element>
        <Select>
            <Value Minimum="0" Maximum="2">
                0.000000000000001619 (L:Corrected Net Thrust ENG1, number) 3 pow * 0.00000735459 (L:Corrected Net Thrust ENG1, number) * + 0.996689 + (>L:ENG1 EPR filtered, number) (>L:ENG1 EPR, number)
            </Value>
        </Select>
    </Element>
    <Element>
        <Select>
            <Value>
            (A:AIRSPEED MACH,mach) 0.0 &gt;= 0.1 &lt; &amp;&amp;
            if{ 1 (L:ENG1 EPR, number) * 1 1 - (L:ENG1 EPR filtered, number) * +  (>L:ENG1 EPR filtered, number) }
            (A:AIRSPEED MACH,mach) 0.1 &gt; 0.2 &lt; &amp;&amp;
            if{ 0.0000000000000019001 (L:Corrected Net Thrust ENG1, number) 3 pow * 0.00000901943 (L:Corrected Net Thrust ENG1, number) * + 0.984544 +  (>L:ENG1 EPR, number) }
            </Value>
        </Select>
    </Element>
    <Element>
        <Position X="74" Y="74"/>
            <Image Name="EPR_Needle.bmp">
            <Axis X="54" Y="4"/>
            </Image>
        <Rotate>
            <Value Minimum="0.8" Maximum="2.00">(L:ENG1 EPR filtered, number)</Value>
                <Nonlinearity>
                    <Item Value="0.8" Degrees="20"/>
                    <Item Value="1.0" Degrees="56"/>
                    <Item Value="1.2" Degrees="91"/>
                    <Item Value="1.4" Degrees="127"/>
                    <Item Value="1.6" Degrees="162"/>
                    <Item Value="1.8" Degrees="196"/>
                    <Item Value="2.0" Degrees="231"/>
                </Nonlinearity>
        </Rotate>
    </Element>
    <Element>
    <MaskImage Name="N1_mask.bmp">
        <Axis X="75" Y="75"/>
    </MaskImage>
        <Image Name="N1_Tape.bmp">
        <Axis X="-7" Y="217"/>
        </Image>
        <Shift>
            <Value>
                (L:ENG1 EPR filtered, number) 100 * 10 %
            </Value>
            <Scale Y="24.08333"/>
        </Shift>
    </Element>
        <Element>
    <MaskImage Name="N1_mask.bmp">
        <Axis X="75" Y="75"/>
    </MaskImage>
        <Image Name="N1_Tape_10s.bmp">
        <Axis X="14" Y="284"/>
        </Image>
        <Shift>
            <Value>
                (L:ENG1 EPR filtered, number) 10 * int 10 %
            </Value>
            <Scale Y="24.06667"/>
            <Delay PixelsPerSecond="300"/>
        </Shift>
    </Element>
            <Element>
    <MaskImage Name="N1_mask.bmp">
        <Axis X="75" Y="75"/>
    </MaskImage>
        <Image Name="N1_Tape_100s.bmp">
        <Axis X="35" Y="19"/>
        </Image>
        <Shift>
            <Value>
                (L:ENG1 EPR filtered, number) int
            </Value>
            <Scale Y="24"/>
            <Delay PixelsPerSecond="300"/>
        </Shift>
    </Element>
</Gauge>
 
I have decided to abandon the first order lag equation because I realized that it will produce the same problem as a timer: While it will smooth the transition between calculations, it will do so regardless of what the actual mach number is (unless I misunderstood). This means that I will still be getting inaccurate readings at intermediate mach number.

I thought instead of setting each part of the cubic equation as it's own variable, then multiplying those variables by an equation that is a function of mach number, though I haven't yet found an equation that works. If anyone has one, I am all ears...

Here is what I have for that.
I am right now just trying to linearly interpolate between the equations for Mach 0 and Mach 0.1. X=corrected net thrust
Mach 0 = 0.000000000000001619x^3 + 0.00000735459x + 0.996689
Mach 0.1 = 0.0000000000000019001x^3 + 0.00000901943x + 0.984544



XML:
    <!--Set Cubic Variables Initially-->
    <Element>
        <Select>
            <Value>
                0.000000000000001619 (>L:Cubic1, number)
                0.00000735459 (>L:Cubic2, number)
                0.996689 (>L:Cubic3, number)
            </Value>
        </Select>
    <!--Cubic Variation with Mach @ M0.1-->
    </Element>
        <Element>
        <Select>
            <Value>
                (AIRSPEED MACH, mach) 0.1 &lt;=
                if {
                (L:Cubic1, number) (AIRSPEED MACH, mach) <!--some equation here--> (>L:Cubic1 Adjusted, number)
                (L:Cubic2, number) (AIRSPEED MACH, mach) <!--some equation here--> (>L:Cubic2 Adjusted, number)
                (L:Cubic3, number) (AIRSPEED MACH, mach) <!--some equation here--> (>L:Cubic3 Adjusted, number)
                }
            </Value>
        </Select>
    </Element>
    <!--Calculation of EPR-->
    <Element>
        <Select>
            <Value Minimum="0" Maximum="2">
                (L:Cubic1 Adjusted, number) (L:Corrected Net Thrust ENG1, number) 3 pow * (L:Cubic2 Adjusted, number) (L:Corrected Net Thrust ENG1, number) * + (L:Cubic3 Adjusted, number) + (>L:ENG1 EPR, number)
            </Value>
        </Select>
    </Element>
    <Element>
        <Position X="74" Y="74"/>
            <Image Name="EPR_Needle.bmp">
            <Axis X="54" Y="4"/>
            </Image>
        <Rotate>
            <Value Minimum="0.8" Maximum="2.00">(L:ENG1 EPR, number)</Value>
                <Nonlinearity>
                    <Item Value="0.8" Degrees="20"/>
                    <Item Value="1.0" Degrees="56"/>
                    <Item Value="1.2" Degrees="91"/>
                    <Item Value="1.4" Degrees="127"/>
                    <Item Value="1.6" Degrees="162"/>
                    <Item Value="1.8" Degrees="196"/>
                    <Item Value="2.0" Degrees="231"/>
                </Nonlinearity>
        </Rotate>
    </Element>
 
Just commenting on your XML syntax two posting ago -


Assuming you want both (L:ENG1 EPR filtered, number) and (L:ENG1 EPR, number) to initially have the same value, this line is incorrect:

0.000000000000001619 (L:Corrected Net Thrust ENG1, number) 3 pow * 0.00000735459 (L:Corrected Net Thrust ENG1, number) * + 0.996689 + (>L:ENG1 EPR filtered, number) (>L:ENG1 EPR, number)

Zero will always be stored in (L:ENG1 EPR, number) unless you duplicate the top of the stack before (>L:ENG1 EPR filtered, number), that is

0.000000000000001619 (L:Corrected Net Thrust ENG1, number) 3 pow * 0.00000735459 (L:Corrected Net Thrust ENG1, number) * + 0.996689 + d (>L:ENG1 EPR filtered, number) (>L:ENG1 EPR, number)



As well, this line appears incorrect:


1 (L:ENG1 EPR, number) * 1 1 - (L:ENG1 EPR filtered, number) * + (>L:ENG1 EPR filtered, number)

It boils down to simply

(L:ENG1 EPR, number) (>L:ENG1 EPR filtered, number)


From the stack perspective, it looks like this (for simplicity, assume L:ENG1 EPR=5 and L:ENG1 EPR filtered=9):

In the end, L:ENG1 EPR filtered will equal 5, the value of L:ENG1 EPR



1593888950778.png




If you want to read more about how the stack works in fs XML scripting, I recommend checking out this FSDeveloper wiki

Bob
 

This thread seems to talk about something quite similar to what I was theorizing a few posts ago, about writing to a variable using a nonlinearity table and applying that to the equation. But I cannot think of a solid way to implement this for my panel. How can I write to a variable using both nonlinearity and another variable? E.g. How can I set up a GVar to obtain a value from mach and nonlinearity?
 
SUCCESS!!!!!

I don't know why it didn't occur to me sooner...

I ended up coming up with other cubic equations to modify each variable of the base EPR equation based on mach number. They match nearly perfectly to the charts now!!!

Thank you everyone for the help. Here is the end result for those interested!

XML:
<Gauge Name="747 EPR Indicator" Version="1.0">
    <Image Name="EPR.bmp"/>
    <!--Calculation of Delta-->
    <Element>
        <Select>
            <Value>
                (A:AMBIENT PRESSURE,inHg) 29.92 / (>L:Delta, number)
            </Value>
        </Select>
    </Element>
        <!--Calculation of Delta2-->
    <Element>
        <Select>
            <Value>
                (L:Delta, number) (A:AIRSPEED MACH,mach) (A:AIRSPEED MACH,mach) * 0.2 * 1 + 3.5 pow * (>L:Delta2, number)
            </Value>
        </Select>
    </Element>
    <!--Calculation of Corrected Net Thrust-->
    <Element>
        <Select>
            <Value>
                (A:TURB ENG1 JET THRUST,lbs) (L:Delta2, number) / (>L:Corrected Net Thrust ENG1, number)
            </Value>
        </Select>
    </Element>
<!--Set Cubic Variables Initially-->
     <Element>
        <Select>
            <Value>
                -0.0000000000000059555 (A:AIRSPEED MACH, mach) 3 pow * 0.0000000000000051483 (A:AIRSPEED MACH, mach) * + 0.0000000000000013991 + (>L:Cubic1, number)
                0.00000173061 (A:AIRSPEED MACH, mach) 3 pow * 0.0000101517 (A:AIRSPEED MACH, mach) * + 0.00000794273 + (>L:Cubic2, number)
                -0.24844 (A:AIRSPEED MACH, mach) 3 pow * -0.195957 (A:AIRSPEED MACH, mach) * + 1.00379 + (>L:Cubic3, number)
            </Value>
        </Select>
     </Element>  
    <!--Calculation of EPR-->
    <Element>
        <Select>
            <Value Minimum="0" Maximum="2">
                (L:Cubic1, number) (L:Corrected Net Thrust ENG1, number) 3 pow * (L:Cubic2, number) (L:Corrected Net Thrust ENG1, number) * + (L:Cubic3, number) + (>L:ENG1 EPR, number)
            </Value>
        </Select>
    </Element>
    <Element>
        <Position X="74" Y="74"/>
            <Image Name="EPR_Needle.bmp">
            <Axis X="54" Y="4"/>
            </Image>
        <Rotate>
            <Value Minimum="0.8" Maximum="2.00">(L:ENG1 EPR, number)</Value>
                <Nonlinearity>
                    <Item Value="0.8" Degrees="20"/>
                    <Item Value="1.0" Degrees="56"/>
                    <Item Value="1.2" Degrees="91"/>
                    <Item Value="1.4" Degrees="127"/>
                    <Item Value="1.6" Degrees="162"/>
                    <Item Value="1.8" Degrees="196"/>
                    <Item Value="2.0" Degrees="231"/>
                </Nonlinearity>
        </Rotate>
    </Element>
    <Element>
    <MaskImage Name="N1_mask.bmp">
        <Axis X="75" Y="75"/>
    </MaskImage>
        <Image Name="N1_Tape.bmp">
        <Axis X="-7" Y="217"/>
        </Image>
        <Shift>
            <Value>
                (L:ENG1 EPR, number) 100 * 10 %
            </Value>
            <Scale Y="24.08333"/>
        </Shift>
    </Element>
        <Element>
    <MaskImage Name="N1_mask.bmp">
        <Axis X="75" Y="75"/>
    </MaskImage>
        <Image Name="N1_Tape_10s.bmp">
        <Axis X="14" Y="284"/>
        </Image>
        <Shift>
            <Value>
                (L:ENG1 EPR, number) 10 * int 10 %
            </Value>
            <Scale Y="24.06667"/>
            <Delay PixelsPerSecond="300"/>
        </Shift>
    </Element>
            <Element>
    <MaskImage Name="N1_mask.bmp">
        <Axis X="75" Y="75"/>
    </MaskImage>
        <Image Name="N1_Tape_100s.bmp">
        <Axis X="35" Y="19"/>
        </Image>
        <Shift>
            <Value>
                (L:ENG1 EPR, number) int
            </Value>
            <Scale Y="24"/>
            <Delay PixelsPerSecond="300"/>
        </Shift>
    </Element>
</Gauge>
 
Last edited:
I really should stop marking this one as solved... LOL

I have one more big problem. Something that I am definitely not getting.

My net thrust vs EPR chart and my gauge match very closely. However, I am getting some rather interestingly low results for EPR during cruise. I am very confident in my air file thrust settings and ram drag values but I am willing to accept that I've missed something. Maybe this belongs in the flight dynamics forum at this point...

In any case,
I have net thrust set as follows
Code:
(A:TURB ENG1 JET THRUST,lbs) (L:Delta2, number) / (>L:Corrected Net Thrust ENG1, number)

I have verified that my value for Delta2 is correct via AFSD. However, I am getting net thrust values around 20000 lbs at typical heavy weight cruise settings ~92% N1. This corresponds to an EPR of only slightly more than 1.0!!!

My EPR is around 1.03 when in cruise in this condition. This does correlate exactly to what the net thrust vs EPR graph says but is not really realistic. Typical cruise EPR on the 747 is around 1.35 - 1.42 depending on weight and altitude. This corresponds to somewhere in the ballpark of 34000 lbs of corrected net thrust, which I have even verified through Enginesim (at least, at max thrust)!

What am I missing?
 
Last edited:
These are the charts I am using for corrected net thrust. I am out of ideas for what could be going wrong.

2020-07-05 15_05_18-19730001300.pdf - Brave.png
2020-07-05 15_05_31-19730001300.pdf - Brave.png
 
This one is actually almost truly solved now. Turns out NASA made me a lovely CN1 vs. EPR chart as well, and I found that much easier to work with, so I now have it set against CN1 rather than net thrust.

My only problem is that my L Var for Cubic1 keeps returning zero and I cannot figure out why... I do not have any other references to this LVar anywhere else in my panel.

Is there something wrong with my syntax? I've looked it up and down a dozen times.

XML:
     <Element>
        <Select>
            <Value>
            -0.0000000001961 (A:AIRSPEED MACH, mach) 5 pow * 0.00000000024128 (A:AIRSPEED MACH, mach) 4 pow * + -0.0000000000082209 (A:AIRSPEED MACH, mach) 1.4 pow * + 0.000000000055721 + (>L:Cubic1, number)
            -0.0320577 (A:AIRSPEED MACH, mach) 3.2 pow * 0.0554161 (A:AIRSPEED MACH, mach) 4 pow * + 0.00549811 (A:AIRSPEED MACH, mach) 1.4 pow * + 0.00115658 + (>L:Cubic2, number)
            -2.36424 (A:AIRSPEED MACH, mach) 5 pow * 3.19723 (A:AIRSPEED MACH, mach) 4 pow * + -1.30061 (A:AIRSPEED MACH, mach) 2 pow * + 0.968908 + (>L:Cubic3, number)
            </Value>
        </Select>
     </Element>    
    <!--Calculation of EPR-->
    <Element>
        <Select>
            <Value Minimum="0" Maximum="2">
                (L:Cubic1, number) (A:TURB ENG1 CORRECTED N1, percent) 5 pow * (L:Cubic2, number) (A:TURB ENG1 CORRECTED N1, percent) * + (L:Cubic3, number) + (>L:ENG1 EPR, number)
            </Value>
        </Select>
    </Element>
 
My only problem is that my L Var for Cubic1 keeps returning zero and I cannot figure out why


Looks like it's going to be a very small number. How are you displaying (L:Cubic1, number), what format? An easy way to check is to display it as a string and you will see the value in exponential form. Something like this:

XML:
<Element>
 <Position X="10" Y="225"/>
 <FormattedText X="100" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="navy"  BackgroundColor="gainsboro" Bright="Yes">     
  <String>%((L:Cubic1, number))%!s!</String>
 </FormattedText>
</Element>


If (A:AIRSPEED MACH, mach) = 1.1, then (L:Cubic1, number) displayed as a string is 8.3764e-011

Bob
 
Looks like it's going to be a very small number. How are you displaying (L:Cubic1, number), what format? An easy way to check is to display it as a string and you will see the value in exponential form. Something like this:

XML:
<Element>
<Position X="10" Y="225"/>
<FormattedText X="100" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="navy"  BackgroundColor="gainsboro" Bright="Yes"> 
  <String>%((L:Cubic1, number))%!s!</String>
</FormattedText>
</Element>


If (A:AIRSPEED MACH, mach) = 1.1, then (L:Cubic1, number) displayed as a string is 8.3764e-011

Bob

Bob,

The string element is precisely what I've done to see the values. The best I've done is to get a value of 0.0000000001 to show, but this isn't correct. Most of the time is shows 0.
 
Last edited:
An update: I fixed the variable! I am not sure what went wrong but I re-graphed the values and calculated a new curve. Turns out I was way off in my original calculation. Not sure what happened but all is well now and I think this topic can finally be marked solved for good.

Here is the final code result. I am so excited to have working EPR finally!

XML:
<!--Set Cubic Variables Against Mach Number-->
     <Element>
        <Select>
            <Value>
            -0.0374573 (A:AIRSPEED MACH, mach) 3.2 pow * 0.0291998 (A:AIRSPEED MACH, mach) 4 pow * + 0.00843657 (A:AIRSPEED MACH, mach) 1.4 pow * + 0.00128739 + (>L:Cubic2, number)
            -2.36424 (A:AIRSPEED MACH, mach) 5 pow * 3.19723 (A:AIRSPEED MACH, mach) 4 pow * + -1.30061 (A:AIRSPEED MACH, mach) 2 pow * + 0.968908 + (>L:Cubic3, number)
            0.00000000028274 (A:AIRSPEED MACH, mach) 3.2 pow * -0.00000000021458 (A:AIRSPEED MACH, mach) 4 pow * + -0.000000000047409 (A:AIRSPEED MACH, mach) 1.4 pow * + 0.000000000056522 + (>L:Cubic1, number)
            </Value>
        </Select>
     </Element>   
    <!--Calculation of EPR-->
    <Element>
        <Select>
            <Value Minimum="0" Maximum="2">
                (L:Cubic1, number) (A:TURB ENG1 CORRECTED N1, percent) 5 pow * (L:Cubic2, number) (A:TURB ENG1 CORRECTED N1, percent) * + (L:Cubic3, number) + (>L:ENG1 EPR, number)
            </Value>
        </Select>
    </Element>
 
Back
Top