• 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 Mach Floating Disc Readout; Animation code?

Messages
10,163
Country
us-arizona
Hey all,

On jet Air Speed Indicators, they usually have a slot along the bottom and left that has a disc behind it that has Mach readings. It changes I guess per altitude, rotating slightly.

What animation code would that be that rotates the disc?


Many thanks,


Bill
LHC
 
Ok... I know absolutely nothing about modeling... but I am getting very, very confused when I keep seeing someone ask for code to rotate this or shift that... aren't all physical rotations identical in concept? Isn't the only difference the values and positions?

What am I not 'getting'?
 
Could the Mach Number be derived from an SDK variable:

AIRSPEED MACH - Current mach - Mach - N
 
I think the variable would be based off of AIRSPEED TRUE CALIBRATE... it's very simple to convert a true airspeed to mach. However, my original question still stands... cuz I wanna understand. :)
 
Bill, see this http://www.fsdeveloper.com/forum/threads/airspeed-mach-ring.427903/#post-653499

Basically the Mach scale rotates according to an altitude function. At sea level the non-linearity of the mach and airspeed scales are the same, so no mach scale movement is required. As altitude is increased, the mach scale should rotate counterclockwise such that, for any given Indicated or calibrated airspeed, the mach number read against the needle is lower.
I have used the following code
<!-- ======================= Mach===================== -->
<Element>
<Select>
<Value>(A:INDICATED ALTITUDE, feet) 1000 / -3.75 * 518.7 + sqrt 0.044 * (&gt;L:MACHSHIFT_A,number)</Value>
</Select>
</Element>
<Element>
<Select>
<Value>(A:SIGMA SQRT,number) (L:MACHSHIFT_A,number) * (&gt;L:MACHSHIFT_B,number)</Value>
</Select>
</Element>
<Element>
<Select>
<Value>(L:MACHSHIFT_B,number) 1 - -1.0 * (&gt;L:MACHSHIFT,number)</Value>
</Select>
</Element>

Finally, a 3D gauge needle would be animated by (L:Machshift, number)

The first element has to do with the non-linearity of the function.
In the second element the main driver for the movement is (A:SIGMA SQRT,number) since this is the altitude function that varies Mach for a given IAS.
The third function is administrative, gets movement in the correct direction.
If You have images of the IAS and Mach scales for a real instrument you can use them.

Roy
 
Thanks Roy. I think this is what I need.

Warpd, this isnt for a 3D VC object, its for a 2D XML gauge in FS2004 XML format. (Yep, I am still not making 3D gauges in my VC's. I love having 2D gauges where I can totally change things out easily, no polygons to worry about).
 
Its not all that hard now is it? Besides 3D looks so much better and is better on framerates. You could just control the needles with a L var and drive that L var from a xml gauge if you want to be able to tweak the formula without totally reexporting the model.
 
Well, guess I've never heard the term 'animation' applied to what a 2D gauge does. LOL :)
 
Ok Leone :)
Here is an altimeter gauge with a white disc that creates a curved line. This could easily be converted to read Mach.
In effect you will have two gauges with a mask in between the two.

In the first image there is a curved slot through which appears a curved white line as altitude increases.
The second image is a half moon which turns according to IAS. The third is a mask between the two.
You could therefore create an element which indicates Mach with its accompanying pointer and scale. Seat them on top of your IAS gauge and mask it. A good way is to have two background images with one having an area 0,0,0, cut into it.
1.Do a background with both IAS and MACH scales.
2. A needle that responds to MACH
3. A second background with a 0,0,0 cutout (allowing the mach needle to be visible).
4. IAS needle

So your gauge would have an element measuring MACH (first element) and an element measuring IAS (second element).

The code below contains other stuff but you can see the order of layering.


STANDBY_ALTIMETER.jpg
STANDBY_ALTIMETER_1000.jpg

STANDBY_ALTIMETER_MBS_MASK.jpg

Code:
<Gauge Name="Standby Altimeter" Version="1.0">
   <Image Name="STANDBY_ALTIMETER.bmp" ImageSizes="120,122" Luminous="1"/>
//---------- Flag ----------------
   <Element>
      <Position X="0" Y="0"/>
      <Select>
         <Value>(A:CIRCUIT GENERAL PANEL ON, bool)</Value>
         <Case Value="0">
            <Image Name="STANDBY_ALTIMETER_FLAG.bmp" ImageSizes="120,122" Luminous="1"/>
         </Case>
      </Select>
   </Element>
//---------------------------------------------------
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="STANDBY_ALTIMETER_MASK.bmp" ImageSizes="120,122">
         <Axis X="60" Y="60"/>
      </MaskImage>
      <Image Name="STANDBY_ALTIMETER_1000.bmp" PointsTo="North"  ImageSizes="120,122" Luminous="1">
         <Axis X="60" Y="60"/>
      </Image>
      <Rotate>
         <Value>(A:Indicated Altitude,feet) 1000 /</Value>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
         <Nonlinearity>
            <Item Value="0" X="0" Y="-30"/>
            <Item Value="50" X="1" Y="30"/>
         </Nonlinearity>
      </Rotate>
   </Element>
//---------------------------------------------------
   <Element>
      <Position X="60" Y="60"/>
      <Image Name="STANDBY_ALTIMETER_ARROW.bmp" PointsTo="North"  ImageSizes="9,60" Luminous="1">
         <Axis X="4" Y="59"/>
      </Image>
      <Rotate>
         <Value>(A:Indicated Altitude,feet) 1000 /</Value>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
         <Nonlinearity>
            <Item Value="0" X="60" Y="9"/>
            <Item Value="50" X="61" Y="109"/>
         </Nonlinearity>
      </Rotate>
   </Element>
//---------------------------------------------------
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="STANDBY_ALTIMETER_MBS_MASK.bmp" ImageSizes="120,122">
         <Axis X="40" Y="96"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(A:Kohlsman setting mb,millibar) 1000 / flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="STANDBY_ALTIMETER_MBS_MASK.bmp" ImageSizes="120,122">
         <Axis X="48" Y="96"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(A:Kohlsman setting mb,millibar) 100 / 10 % flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="STANDBY_ALTIMETER_MBS_MASK.bmp" ImageSizes="120,122">
         <Axis X="56" Y="96"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(A:Kohlsman setting mb,millibar) 10 / 10 % flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
   <Element>
      <Position X="0" Y="0"/>
      <MaskImage Name="STANDBY_ALTIMETER_MBS_MASK.bmp" ImageSizes="120,122">
         <Axis X="64" Y="96"/>
      </MaskImage>
      <Image Name="NUMBER_ROLL_5.bmp" ImageSizes="8,119" Luminous="1">
    <Axis X="0" Y="108"/>
      </Image>
      <Shift>
         <Value>(A:Kohlsman setting mb,millibar) 10 % flr</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="0"/>
        <Item Value="10" X="0" Y="108"/>
         </Nonlinearity>
      </Shift>
   </Element>
//---------------------------------------------------
   <Element>
      <Position X="60" Y="60"/>
      <Image Name="NEEDLE_ALT_1.bmp" PointsTo="North" ImageSizes="9,54" Luminous="1">
         <Axis X="4" Y="50"/>
      </Image>
      <Rotate>
         <Value>(A:Indicated Altitude,feet)</Value>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
         <Nonlinearity>
            <Item Value="0" X="60" Y="9"/>
            <Item Value="500" X="60" Y="109"/>
         </Nonlinearity>
      </Rotate>
   </Element>
   <Element>
      <Position X="60" Y="60"/>
      <Image Name="NEEDLE_ALT_2.bmp" PointsTo="North" ImageSizes="9,54" Luminous="1">
         <Axis X="4" Y="50"/>
      </Image>
      <Rotate>
         <Value>(A:Indicated Altitude,feet) 10 /</Value>
         <Failures>
            <SYSTEM_PITOT_STATIC Action="Freeze"/>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
         <Nonlinearity>
            <Item Value="0" X="60" Y="9"/>
            <Item Value="500" X="60" Y="109"/>
         </Nonlinearity>
      </Rotate>
   </Element>
//---------------------------------------------------
   <Mouse>
      <Help ID="HELPID_GAUGE_ALTIMETER"/>
      <Tooltip>Altimeter %((A:INDICATED ALTITUDE,FEET))%!d! feet  (%((A:KOHLSMAN SETTING HG, inHg))%!1.2f! inHg)</Tooltip>
      <Area Left="0" Right="120" Top="0" Bottom="122">
         <Help ID="HELPID_GAUGE_KOHLSMAN_KNOB"/>
         <Area Left="0" Right="60">
            <Cursor Type="DownArrow"/>
            <Click Event="KOHLSMAN_DEC" Repeat="Yes"/>
         </Area>
         <Area Left="60" Right="120">
            <Cursor Type="UpArrow"/>
            <Click Event="KOHLSMAN_INC" Repeat="Yes"/>
         </Area>
      </Area>
   </Mouse>
</Gauge>
 
Amazing how you miss errors as you get older! In my post above, I wrote:
"As altitude is increased, the mach scale should rotate counterclockwise such that, for any given Indicated or calibrated airspeed, the mach number read against the needle is lower."
Obviously, "lower" should have been "higher"
Sorry about that
Roy
 
Like Naruto said i would create an L:Var so you do not have to keep exporting to test.

Just use the default Mach to update your custom L:Var.
I am not sure what the Mach default scale is for the animation keys.....but after a few tests you could use this code below
if you create a custom L:Var for your Mach card.

No need for writing you own sliding scale as "Airspeed Mach" already has it...

<Update>
(A:AIRSPEED MACH, mach) (>L:CUSTOM MACH, mach)
</Update>
 
Hi Roy when I evaluate your equation always obtain 1 for (L:MACHSHIFT,number), I dont understand what is wrong for my side...

Code:
<!-- ======================= Mach===================== -->
    <Element>
        <Select>
            <Value>(A:INDICATED ALTITUDE, feet) 1000 / -3.75 * 518.7 + sqrt 0.044 * (>L:MACHSHIFT_A,number)</Value>
        </Select>
    </Element>
    <Element>
        <Select>
            <Value>(A:SIGMA SQRT,number) (L:MACHSHIFT_A,number) * (>L:MACHSHIFT_B,number)</Value>
        </Select>
    </Element>
    <Element>
        <Select>
            <Value>(L:MACHSHIFT_B,number) 1 - -1.0 * (>L:MACHSHIFT,number)</Value>
        </Select>
    </Element>
 
Hi Roy when I evaluate your equation always obtain 1 for (L:MACHSHIFT,number)

Let's try an example.
Indicated altitude = 37,000. Divide by 1000 gives you 37. Multiply by -3.75 and add 518.7 gives 379.95. Take the square root, gives 19.49 and multiply by 0.044, gives 0.857661 which is MACHSHIFT_A.
At 37,000 sigma (relative density) is 0.28525 so SIGMA SQRT is 0.534087. Multiply by MACHSHIFT_A gives 0.458066. Subtract 1.0 and change the sign gives MACHSHIFT = 0.541934.

I think there were at least another two threads on this subject.
Roy
 
OK I discover the problem... it seem that (A:SIGMA SQRT,number) is not valid in fs2004 and always return 0. thx for the example Roy help for debuging the problem....
 
In case you need an equation for sigma in reverse polish:

Code:
<!-- Calculate sigma. Equation source: http://www.aerospaceweb.org/question/atmosphere/q0049.shtml
Sigma = (1.0 - h/145442)^(4.255876) -->
1.0 (A:PLANE ALTITUDE, feet) 145442 / - 4.255876 pow (>L:GENERAL AMB SIGMA, number)
 
Back
Top