• 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.

ASI question

Zeiten

Resource contributor
Messages
444
Country
norway
Hi!

Trying to get the 3D ASI in the airplane show the right speed.
The clue is that the needle shall not move until the airspeed is more then 60 knots.
The reading goes all the way to 450 knots.
The part has 450 kf and the needle start moving at kf 60 all the way to kf 450.

I'm no expert in XML coding so have just tried to tweak the standard xml into this:

Code:
<PartInfo>
    <Name>needle_asi</Name>
    <AnimLength>450</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:AIRSPEED INDICATED, kts) 10 /</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_BACKUP_AIRSPEED_KNOTS</TooltipID>
    </MouseRect>
  </PartInfo>

I can see that the standar code reades MPH.
Is kts the right syntax if you want knots to be read instead of mph?

If I try to slew the plane the ASI shows around 100 when the speed is actually around 820! IAS.

And a second question.

Is it enough to just edit the modeldef.xml or do I have to re-tag the part in Max after modeldef is edited?
 
Since your needle should not move until 40 kias, you need to subtract 40 from your <Code> script to offset the keyframes correctly, and reset the <AnimLength> to 410 frames.

40 kias = 40 - 40 = frame 0
100 kias = 100 - 40 = frame 60
450 kias = 450 - 40 = frame 410

And yes, you should ADD this as a new entry in the modeldef.xml file. Never change the "default" scripts!

Code:
<Animation name="My_needle_asi" guid="ec974627-4126-4b2d-927f-c290c7fbbb2a" typeParam2="My_needle_asi" length="410" type="Sim" typeParam="AutoPlay" />

  <PartInfo>
    <Name>My_needle_asi</Name>
    <AnimLength>410</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          40 (A:AIRSPEED INDICATED, knots) -
        </Code>
      </Parameter>
    </Animation>
  </PartInfo>
 
I followed your tip about keeping one modeldef.xml per project.

I just copied from the original modeldef to the one I'm using :)

So kts is not a valid syntax? Knots is?

Cheers :)

EDIT.

I need to be feed by a spoon...

You say -40, but I want it to start at 60 so subtract 60 from the code?

So the kf set in max don't need to be adjusted. 450 kf and the needle starts moving by kf 60 and all the way up to kf 450?
And in the animation manager I set the animation to start at 0 and end at 450 OR 390?

I kinda got your code to work, but it was more offset due to the readings on the gauge starting at 60.

Sorry for some dumb questing..

Thanks :)
 
Last edited:
kts is not a valid syntax? Knots is?

you can find the various measurements in SDK under Simulation Variables.

these are for speed:

meter per second, meters/second, m/s
meter per minute, meters per minute
feet/second
feet/minute, ft/min
kilometer/hour, kilometers/hour, kilometers per hour, kph
knot, knots
mile per hour, miles per hour, mph
mach, machs
 
Last edited:
I followed your tip about keeping one modeldef.xml per project.

I just copied from the original modeldef to the one I'm using :)

<snipped for brevity>

You say -40, but I want it to start at 60 so subtract 60 from the code?

Okay, as long as you do not modify any of the original modeldef.xml file, you'll be fine.

I misread your original post, so that's why I used 40 in my sample script. Look, you have the right idea. Simply change the 40 to 60, and reduce the length of the animation track by -20 to compensate.

Converting a simulator variable into a keyframed animation isn't difficult at all - providing you don't "overthink" things!

Here is what you are aiming to accomplish...

At 60 knots indicated, you want the needle to begin moving. If we subtract 60 from the variable's value, the range 0 to 60 will be discarded (or actually will be negative, which amounts to the same thing).

At 450 knots indicated, you want the needle to point at 450 on the dial. So, 450 - 60 = 390.

So, given the beginning and ending keyframes, we will need to animate the needle from 0 to 390 keyframes!

Because we are keyframing this needle such that 1 knot = 1 frame, it makes it unnecessary to use any scalar value at all, thus making our XML arithmetic simple!
Code:
<Code>(A:AIRSPEED INDICATED, knots) 60 -</Code>
 
Last edited:
Thanks for the good explanation, but still no go :/

The needle starts moving as soon as the airplane gain speed.

Animated the needle so

KF 0 = 60 Knots
KF 60 = 120 Knots
KF 80 = 140 Knots
KF 100 = 160 Knots
KF 120 = 180 Knots
and so on all the way up to KF 390 where the needle stand at 450 knots.

How about I go the other way?
KF 0 = 0 Knots
KF 20 = 0 Knots
KF 40 = 0 Knots
KF 60 = 60 Knots
KF 80 = 80 Knots
etc up to kf 450 = 450 knots
and just skip the subtraction in the code?
just use
Code:
<Code>(A:AIRSPEED INDICATED, knots)
?

And is it enough to set kf every 20 or do I need to kf every knots?

And one more thing.

In the first code you wrote
Code:
 40 (A:AIRSPEED INDICATED, knots) -

and in the second one
Code:
(A:AIRSPEED INDICATED, knots) 60 -

The 40 and 60 I understand, but why did you change the place? Or have it absolutely nothing to say?

Cheers
 
In the first code you wrote
Code:
 40 (A:AIRSPEED INDICATED, knots) -

and in the second one
Code:
(A:AIRSPEED INDICATED, knots) 60 -

The 40 and 60 I understand, but why did you change the place? Or have it absolutely nothing to say?

Cheers
Actually, it does make a difference! I made a mistake when I posted the first example...

...it should have been:

Code:
(A:AIRSPEED INDICATED, knots) 40 -

:o Oops...

We need to have the first x numbers returned as negative, since there are no "negative keyframes" they will of course be ignored.

As for where you should set keys... every major mark should receive a key. The correct procedure for setting keyframes is:

  1. Move slider to first frame index to animate (100 knots?)
  2. Turn on the "Animate" (GMax) or "Autokey" (Max)
  3. Rotate needle to desired index (Local, Pivot Point), note that keys are set automatically
  4. Move slider to next frame index you need to set a key
  5. Rotate needle to desired index (note that key is set automatically)
  6. Repeat for every frame/index you need to animate, ending with last frame (at 450 kias).
  7. Turn off the "Animate" button.
 
Last edited:
Bill,
As you pointed out negative keyframe values are ignored and you want to have that happen until 60 knots and above.

But surely
Code:
60 (A:AIRSPEED INDICATED, knots) -
will give you positive 60 at zero airspeed, decreasing to zero at 60 and negative at higher speeds.

I think your second one was right.

Roy
 
Bill,
As you pointed out negative keyframe values are ignored and you want to have that happen until 60 knots and above.

But surely
Code:
60 (A:AIRSPEED INDICATED, knots) -
will give you positive 60 at zero airspeed, decreasing to zero at 60 and negative at higher speeds.

I think your second one was right.

Roy
Thanks, Roy. The biggest problem I'm having in my old age is the tendency when questioned about something I've said to begin having "self-doubts" and then loosing the thread of logic I'd been following...

I've edited my previous reply to reflect a return to logic! ;)
 
Thanks, it finally worked! Needle start moving at 60 IAS all the way up to 450 IAS and the indication is dead in!

Must say I really enjoy this forum.
You guys help out as good as you can. Doesn't matter if its a pro thats having trouble or a noob like me :)
 
Keyframe 0 = 0 Knots
Keyframe 450 = 450 Knots


Code:
<PartInfo>
    <Name>needle_asi</Name>
    <AnimLength>450</AnimLength>
    <Animation>
      <Parameter>
        <Code>
                 (A:AIRSPEED INDICATED, kts) 60 &gt;
                  if{ (A:AIRSPEED INDICATED, kts) } els { 0 }
 	     <Lag>100</Lag>
         </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_BACKUP_AIRSPEED_KNOTS</TooltipID>
    </MouseRect>
  </PartInfo>

Reaches the speed 60 knots, moves the needle from 0 to 60.
Under 60 knots it moves the needle from 60 to 0.

More than 60 knots, they operate as a normal ASI.
 
Back
Top