1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FSXA Engine gauge needle animation

Discussion in 'Modeling' started by euroastar350, 13 May 2017.

  1. euroastar350

    euroastar350 Resource contributor

    Joined:
    28 Jul 2010
    Messages:
    626
    Country:
    puertorico
    Hi guys,

    I've been having some issues with a couple of engine needles that work somewhat or not work at all

    1.) Engine cylinder temperature: Should read between 150° min to 250° max, but it pegs along all the way to 300°C which by that time, the engine(s) is overheating. The code for those needles....

    Code:
    <PartInfo>
      <Name>BN2A_needle_cht_01</Name>
        <AnimLength>300</AnimLength>
         <Animation>
          <Parameter>
           <Code>
        (A:ENG CYLINDER HEAD TEMPERATURE:1, farenheit) 2 /
           </Code>
           <Lag>40</Lag>
           </Parameter>
      </Animation>
     </PartInfo>
    2.) Oil temperature: Should read between 60° min to 250° max, but I'm sure that the keyframes I set in 3DS Max aren't properly set. I have them at 0-40-60-80-100-120. Keyframes 0-40 don't have any animation, although this maybe incorrect. The code for those needles....

    Code:
    <PartInfo>
      <Name>BN2A_needle_oil_temp_01</Name>
        <AnimLength>120</AnimLength>
         <Animation>
          <Parameter>
           <Code>
        (A:General Eng1 oil temperature,farenheit)
           </Code>
           </Parameter>
      </Animation>
     </PartInfo>
    3.) Oil pressure: Should read between 60psi to 90psi, but the needles moves to 60. The code for those needles....

    Code:
    <PartInfo>
      <Name>BN2A_needle_oil_pressure_01</Name>
        <AnimLength>120</AnimLength>
         <Animation>
          <Parameter>
           <Code>
        (A:GENERAL ENG OIL PRESSURE:1, psi)
           </Code>
           <Lag>25</Lag>
           </Parameter>
      </Animation>
     </PartInfo>
    4.) Fuel pressure: Should read between 20psi to 40psi with 30psi being the normal setting, but it doesn't get anywhere above the redline. The code for those needles....

    Code:
    <PartInfo>
      <Name>BN2A_needle_fuel_pressure_01</Name>
        <AnimLength>80</AnimLength>
         <Animation>
          <Parameter>
           <Code>
        (A:GENERAL ENG1 FUEL PRESSURE, PSI)
           </Code>
           </Parameter>
      </Animation>
     </PartInfo>
    render_042.jpg

    render_040.jpg

    5.) Carburetor temp: This one isn't animated or coded yet, I'm looking at the best possible way to do this. All 3 carburetor temperatures are read by the same needle, there is a switch/knob in the cockpit that allows to select either carburetor/temperature reading, the same goes for the EGT gauge (which is animated from 0-100) next to it.

    The old FS2004 Trislander model has this function, but in a 2D gauge and I would like to translate it into 3D form. The code from the 2D gauge(s)....

    Code:
    <Gauge Name="ATri_EGT.xml" Version="1.0">
       <Image Name="ATri_EGT_Bg.bmp"/>
       <Element>
          <Position X="100" Y="167"/>
          <Image Name="A_Needle_TypA.bmp" PointsTo="North" >
             <Axis X="2" Y="118"/>
          </Image>
          <Rotate>
             <Value Minimum="-20" Maximum="1020">(L:EngSel, enum) s0 -1 == if{ (A:ENG1 EXHAUST GAS TEMPERATURE,celsius) } els{ l0 1 == if{ (A:ENG2 EXHAUST GAS TEMPERATURE,celsius) } els{ (A:ENG3 EXHAUST GAS TEMPERATURE,celsius) } }</Value>
             <Nonlinearity>
                <Item Value="0" X="24" Y="77"/>
                <Item Value="500" X="99" Y="50"/>
                <Item Value="1000" X="175" Y="77"/>
             </Nonlinearity>
             <Delay DegreesPerSecond="20"/>
          </Rotate>
       </Element>
       <Element>
       <Image Name="ATri_EGT_Fore.bmp" />
       </Element>
    </Gauge>
    Code:
    <Gauge Name="ATri_Carbtemp.xml" Version="1.0">
       <Image Name="ATri_CarbTemp_Bg.bmp"/>
       <Element>
          <Position X="100" Y="167"/>
          <Image Name="A_Needle_TypA.bmp" PointsTo="North" >
             <Axis X="2" Y="118"/>
          </Image>
          <Rotate>
             <Value Minimum="-41" Maximum="41">(L:EngSel, enum) s0 -1 == if{ (A:Recip carburetor temperature:1,celsius) } els{ l0 0 == if{ (A:Recip carburetor temperature:3,celsius) } els{ (A:Recip carburetor temperature:2,celsius) } } </Value>
             <Nonlinearity>
                <Item Value="-40" X="24" Y="77"/>
                <Item Value="0" X="99" Y="50"/>
                <Item Value="40" X="175" Y="77"/>
             </Nonlinearity>
             <Delay DegreesPerSecond="32"/>
          </Rotate>
       </Element>
       <Element>
       <Image Name="ATri_CarbTemp_Fore.bmp" />
       </Element>
    </Gauge>
    
    render_041.jpg

    I know this is quite a handful, but I'm looking at recreating a realistic model of the BN2A MKIII-2 Trislander (with FSX limitations of course). I am also planning on implementing a failure module (RealEngine, custom code, etc), so I would like at least for the needles to function of have correct values/readings before I add this feature. As always, any help is greatly appreciated.
     
  2. kalong

    kalong

    Joined:
    19 Dec 2009
    Messages:
    360
    Country:
    indonesia
    for temperature, you have to deal with air file.
    but if you want to use air file as is. just multiply max value that get from aircraft parameter to get desire value.
    i.e engine cylinder temperature max indication 300°C, desire value 250°C. max desire value = max indication * 0.833

    Code:
           <Code>
        (A:ENG CYLINDER HEAD TEMPERATURE:1, Celsius ) 0.833 *
           </Code>
    just to be note with unit you are using.
    that trick aren't work when want to make certain range of temperature i.e 150 min - 250 max. it must be set in air file.
     
  3. N2056

    N2056

    Joined:
    6 Nov 2006
    Messages:
    589
    Country:
    us-california
  4. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,733
    Country:
    unitedstates
    That "trick" doesn't really translate well into 3d gauge needles.

    Yes, if your range begins with 40 (or any other number), the easiest way set a key at frame 0 and frame 40 with no rotation at all. Only rotate/animate from 40 up to the highest index mark. Let's examine the first CHT and the rest should be easy to fix.

    You posted this:
    Code:
    <PartInfo>
      <Name>BN2A_needle_cht_01</Name>
        <AnimLength>300</AnimLength>
         <Animation>
          <Parameter>
           <Code>
               (A:ENG CYLINDER HEAD TEMPERATURE:1, farenheit) 2 /
           </Code>
           <Lag>40</Lag>
           </Parameter>
      </Animation>
     </PartInfo>
    The first problem is that your gauge is "Celsius" not "farenheit" so I'm not surprised it's 'pegging the needle'.

    The single most important thing to remember is the formula:
    Now there are two different ways to approach this, one of which requires a "bias" value and no "scale" at all.

    Since you've presumably already key-framed this needle with 0 to 100 no movement, and 100 to 300 animated, all you need is a correct "formula" for your needle:
    Code:
    <PartInfo>
      <Name>BN2A_needle_cht_01</Name>
        <AnimLength>300</AnimLength>
         <Animation>
          <Parameter>
           <Code>
                 (A:ENG CYLINDER HEAD TEMPERATURE:1, celsius)
           </Code>
           <Lag>40</Lag>
           </Parameter>
      </Animation>
     </PartInfo>
    The other method would be to ignore the values of 0 to 100 entirely, reducing your total animation length to 200 frames. In that case the forumula would be:
    Code:
    <PartInfo>
      <Name>BN2A_needle_cht_01</Name>
        <AnimLength>200</AnimLength>
         <Animation>
          <Parameter>
           <Code>
               (A:ENG CYLINDER HEAD TEMPERATURE:1, celsius) 100 -
           </Code>
           <Lag>40</Lag>
           </Parameter>
      </Animation>
     </PartInfo>
    Note that the "bias" of 100 - is how we tell it to ignore 0 to 100 by offsetting the reported temp by -100 degrees Celsius.
     
  5. euroastar350

    euroastar350 Resource contributor

    Joined:
    28 Jul 2010
    Messages:
    626
    Country:
    puertorico
    Appreciate the help gents, I got all my primary engine needles working by changing the units to celsius and by adjusting parameters in the "AIR" file to match the real world specifications of the Lycoming O540-E4C5 engine as used in the Islander and Trislander aircraft. Just need need to figure out the best way to code the EGT and carb temperature needles which will complete the engine parameter needles.
     
  6. euroastar350

    euroastar350 Resource contributor

    Joined:
    28 Jul 2010
    Messages:
    626
    Country:
    puertorico
    Another question,

    Does these codes look ok? It's basically the code from the 2D gauge, but used in 3D form for the last 2 remaining needles. I haven't tested them out yet, just need to know if they'll work as is or do I need to modify it.
    Code:
    <PartInfo>
        <Name>needle_voltamp</Name>
        <AnimLength>100</AnimLength>
        <Animation>
          <Parameter>
            <Code>(L:EngSel, enum) s0 -1 == if{ (A:Recip carburetor temperature:1,celsius) } els{ l0 0 == if{ (A:Recip carburetor temperature:3,celsius) } els{ (A:Recip carburetor temperature:2,celsius) } }</Code>
            <Lag>200</Lag>
          </Parameter>
        </Animation>
      </PartInfo>
    Code:
    <PartInfo>
        <Name>needle_voltamp</Name>
        <AnimLength>100</AnimLength>
        <Animation>
          <Parameter>
            <Code>(L:EngSel, enum) s0 -1 == if{ (A:ENG1 EXHAUST GAS TEMPERATURE,celsius) } els{ l0 1 == if{ (A:ENG2 EXHAUST GAS TEMPERATURE,celsius) } els{ (A:ENG3 EXHAUST GAS TEMPERATURE,celsius) } }</Code>
            <Lag>200</Lag>
          </Parameter>
        </Animation>
      </PartInfo>
    What the code basically does, it reads the carb temperature or exhaust gas temperature from all 3 engines on a same needle, but readings from each engine can be selected via an engine selector knob on the panel which is a 3 position knob (E1-E3-E2).

    The needle animation for the EGT is very easy to do, it's the carb temperature which has me stumped. It ranges from -40° to 40°, so I'm not sure what would be the ideal way to animate that particular needle.
    render_041.jpg

    Any input is greatly appreciated.
     
  7. kalong

    kalong

    Joined:
    19 Dec 2009
    Messages:
    360
    Country:
    indonesia
    I take simple way, as I didn't understand much with xml code. sometimes 2D gauge xml aren't work in modeldef.xml take code as simple as it can for animation.
    Code:
    <Code>
    (L:EngSel, enum) 0  ==  if{ (A:ENG1 EXHAUST GAS TEMPERATURE,celsius) }
    (L:EngSel, enum) 1  ==  if{ (A:ENG2 EXHAUST GAS TEMPERATURE,celsius) }
    (L:EngSel, enum) 2  ==  if{ (A:ENG3 EXHAUST GAS TEMPERATURE,celsius) }
    </Code>
     
    euroastar350 likes this.
  8. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,733
    Country:
    unitedstates
    Okay, remember the SIM formula I mentioned above? This is a perfect example of the use of the "bias" parameter value.

    The total animation range is 80 frames. You will need to offset the needle's neutral (0) position by +40 frames such that the needle will point at zero (0) at rest. For example:

    if{ 40 (A:Recip carburetor temperature:1,celsius) + }

    If carb temp = -40c, then -40 + 40 = frame zero (0)
    If carb temp = -10c, then -10 + 40 = frame thirty (30)
    If carb temp = +40c, then +40 + 40 = frame eighty (80)

    Voila! :teacher:
     
    kalong and euroastar350 like this.

Share This Page