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

FSX Wind Direction Help

Messages
52
Country
hongkong
Hi,

I am working on a gauge that shows wind direction. However, there's always some degrees deviated from what is shown on the screen via Shift-Z

1) The script below is what I put on the heading indicator:

<Value>(A:Ambient Wind Direction, radians) (A:PLANE HEADING DEGREES GYRO, radians) -</Value>

2) The followings are the direction in digital format:

<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) 100 div % (A:AMBIENT WIND DIRECTION, degrees) 1000 div % 10 * -</Value>

<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) 10 div % (A:AMBIENT WIND DIRECTION, degrees) 100 div % 10 * -</Value>

<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) div % (A:AMBIENT WIND DIRECTION, degrees) 10 div % 10 * -</Value>

Appreciate for any help and advice given.
 
This is what I use.
The wind indicator arrow is a poly draw .
text returns
W/V , tail and cross winds.
The values accord with the red text.

Cheers
Karol
You will probably need to delete " pi + " (180 degrees) at the end for your purposes

HTML:
	  <Element>
          <Position X="391" Y="7"/>
            <FormattedText X="81" Y="55" Font="Tahoma" FontSize="11" LineSpacing="11" Adjust="Right" Color="#2F912F" Bright="Yes">
              <String>%W/V  %((A:Ambient Wind Direction,degrees) (A:MAGVAR, degrees) - dnor s0 (A:Ambient Wind Velocity,knots) 1 >)%{if}%(l0)%!03d!%{else}---%{end}%\{dplo= } %M/%((A:AMBIENT WIND VELOCITY,knots))%!3d!%\n%H/W   %((A:AIRCRAFT WIND Z, Knots)  /-/)%!4.1f!%\n%X/W   %((A:AIRCRAFT WIND X, Knots))%!4.1f!%</String>
            </FormattedText>
       </Element>

      <Element>
          <Visible>(A:AMBIENT WIND VELOCITY, knots) 1 &gt;</Visible>		
      <Element>
          <Position X="406" Y="48"/>
            <Polygon Color="#2F912F" FillColor="#2F912F" LineWidth="1.5" Bright="Yes">
               <Point X="0" Y="12"/> 
               <Point X="0" Y="0"/> 
               <Point X="3" Y="0"/> 
               <Point X="0" Y="-10"/> 
               <Point X="-2" Y="0"/> 
               <Point X="0" Y="0"/> 
            </Polygon>
           <Rotate>
             <Value>(A:AMBIENT WIND DIRECTION, radians) (A:PLANE HEADING DEGREES GYRO, radians) - (A:GPS MAGVAR, radians) - pi +</Value>
           </Rotate>
      </Element>
      </Element>
 
Last edited:
Hi Karol,

My first problem was solved based on your advice by adding (A:GPS MAGVAR, radians) - to the script. Thank you very much!

Regarding my second question which aims to display the wind direction info in digital format, the followings just come up with a deviated wind heading (xxx).

I believe it requires some magnetic variation adjustment as you suggested. However, I couldn't figure out how to apply the (A:GPS MAGVAR) variables to them.

Do you have any suggestion?

(First Digit)
<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) 100 div % (A:AMBIENT WIND DIRECTION, degrees) 1000 div % 10 * -</Value>

(Second Digit)
<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) 10 div % (A:AMBIENT WIND DIRECTION, degrees) 100 div % 10 * -</Value>

(Last Digit)
<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) div % (A:AMBIENT WIND DIRECTION, degrees) 10 div % 10 * -</Value>

The full scripts are as follows:

<!-- HUNDRED -->
<Element>
<Position X="235" Y="175"/>
<MaskImage Name="C172_HDRPM_HRMask.bmp" ImageSizes="12,15,12,15">
<Axis X="0" Y="-167" />
</MaskImage>
<Image Name="C172_HDRPM_HRBlack.bmp" ImageSizes="9,359,9,359">
</Image>
<Shift>
<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) 100 div % (A:AMBIENT WIND DIRECTION, degrees) 1000 div % 10 * - </Value>
<Scale X="0" Y="-18" />
</Shift>
</Element>

<!-- TEN -->
<Element>
<Position X="245" Y="175"/>
<MaskImage Name="C172_HDRPM_HRMask.bmp" ImageSizes="12,15,12,15">
<Axis X="0" Y="-167" />
</MaskImage>
<Image Name="C172_HDRPM_HRBlack.bmp" ImageSizes="9,359,9,359">
</Image>
<Shift>
<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) 10 div % (A:AMBIENT WIND DIRECTION, degrees) 100 div % 10 * - </Value>
<Scale X="0" Y="-18" />
</Shift>
</Element>

<!-- DIGIT -->
<Element>
<Position X="255" Y="175"/>
<MaskImage Name="C172_HDRPM_HRMask.bmp" ImageSizes="12,15,12,15">
<Axis X="0" Y="-167" />
</MaskImage>
<Image Name="C172_HDRPM_HRBlack.bmp" ImageSizes="9,359,9,359">
</Image>
<Shift>
<Value Minimum="-9" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) div % (A:AMBIENT WIND DIRECTION, degrees) 10 div % 10 * - </Value>
<Scale X="0" Y="-18" />
</Shift>
</Element>

==========

BTW, forget to mention that the scripts are written for Saitek's Flight Instrument Panel (FIP). Many of the XML programming approaches are not supported.

Tom
 
Tom

Not sure if this is applicable to your task.

Possible approach.
Define a Macro ,
locate the Macro near the beginning of the instrument.

HTML:
<Macro Name="WindMag">(A:AMBIENT WIND DIRECTION, degrees) (A:GPS MAGVAR, degrees) -</Macro>

then where ever (A:AMBIENT WIND DIRECTION, degrees) appears in your above code , replace it with @WindMag .

Might be worth a try to see if it works.

Cheers
Karol
 
Last edited:
Thanks for the quick reply, Karol.

Unfortunately, the Saitek FIP doesn't recognize macros. It accepts simple and straightforward XML codes.

Otherwise, things would be a lot easier.

Tom
 
Have tried the one below:

<Value Minimum="0" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) (A:GPS MAGVAR, degrees) - 100 div % (A:AMBIENT WIND DIRECTION, degrees) (A:GPS MAGVAR, degrees) - 1000 div % 10 * - </Value>

By adding (A:GPS MAGVAR, degrees) - to the script, it seems to be working, EXCEPT when the wind direction is close to 360, the resulting value becomes 0.

The answer should be close. Just need to look for the missing piece.
 
I have a relative wind direction gauge which works quite well:-
Code:
<Element>
      <Position X="59" Y="59"/>
      <Image Name="WIND_Needle.bmp" Luminous="Yes" ImageSizes="98,18">
         <Axis X="45" Y="9" PointsTo="East"/>
      </Image>
      <Rotate>
         <Value>(A:Ambient wind direction, radians) (A:Plane heading degrees gyro, radians) - pi 2 / - </Value>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action="Freeze"/>
            <GAUGE_RelativeWind Action="Freeze"/>
         </Failures>
         <Delay DegreesPerSecond="180"/>
      </Rotate>
   </Element>
   <Element>
     <Position X="33" Y="85"/>
     <Text X="65" Y="14" Length="8" Fixed="Yes" Font="Arial" FontHeight="0" FontWeight="500" Charset="Default" Attributes="Normal" Adjust="Center" VerticalAdjust="Center" Multiline="No" Color="#CEC6A5" BackgroundColor="transparent" Bright="Yes" UseTransparency="Yes">
       <String>%((A:AMBIENT WIND DIRECTION,radians) (A:PLANE HEADING DEGREES GYRO,radians) - sin (A:AMBIENT WIND VELOCITY,knots) * )%!3.0f! kts</String>
     <Failures>
         <SYSTEM_ELECTRICAL_PANELS Action="Freeze"/>
   </Failures>
   </Text>
   </Element>
   
   <Mouse>
      <Tooltip>Relative Wind Indicator %((A:AMBIENT WIND DIRECTION,degrees))%!3.0f!°%((A:AMBIENT WIND DIRECTION,radians) (A:PLANE HEADING DEGREES GYRO,radians) - sin (A:AMBIENT WIND VELOCITY,knots) * )%!3.0f!kts</Tooltip>      
   </Mouse>
vololiberista
 
Hi vololiberista,

Thanks for the suggestion. I believe your codes are not written for Saitek's FIP since many of the variables are not recognized by the device.

Also, this line:
<Value>(A:Ambient wind direction, radians) (A:Plane heading degrees gyro, radians) - pi 2 / - </Value>
doesn't work unfortunately.

The one suggested by Karol earlier works:
<Value>(A:Ambient wind direction, radians) (A:Plane heading degrees gyro, radians) - (A:GPS MAGVAR, radians) - </Value>

Currently, I need help to figure out how to display the Wind Direction in digital format correctly.

Following seems to the right approach:
<Value Minimum="0" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) (A:GPS MAGVAR, degrees) - 100 div % (A:AMBIENT WIND DIRECTION, degrees) (A:GPS MAGVAR, degrees) - 1000 div % 10 * - </Value>

Except that I still need some tweaks to make it works without errors.

Thanks again.
 
Tom

Again , not sure if this will work with the Saitek code rules ,
but try ,

HTML:
<Value Minimum="0" Maximum="9">(A:AMBIENT WIND DIRECTION, degrees) (A:GPS MAGVAR, degrees) - d360 100 div % (A:AMBIENT WIND DIRECTION, degrees) (A:GPS MAGVAR, degrees) - d360 1000 div % 10 * - </Value>

the " d360 " is supposed to normalise where values are limited to 360 ,
see below

Refer post #2 at following link ,
http://www.fsdeveloper.com/forum/showthread.php?t=427754

Cheers
karol
 
Last edited:
Hi Karol,

That's what I was thinking when I went to bed last night and planned to do this morning. But again, you nailed it before my actual trials.

Thank you very much !!

BTW, do you know how to calculate the payload on Cessna 172SP?

The command I know was PAYLOAD STATION WEIGHT:index

There are 5 stations on the 172. A macro would make it a lot easier to get the total weight but again Saitek FIP doesn't support it.

Rgds,
 
For totalweight:

(A:Total Weight,pounds) (&gt,L:C172_TotalWeight,pounds)


for payload:

(A:Payload Station Weight:1,pounds)
(A:Payload Station Weight:2,pounds) +
(A:Payload Station Weight:3,pounds) +
(A:Payload Station Weight:4,pounds) +
(A:Payload Station Weight:5,pounds) + (&gt;L:C172_TotalPayload,pounds)

for fuel:

(A:Fuel Total Quantity Weight,pounds) (&gt;L:C172_TotalFuel,pounds)



Edi
 
Hi Edi,

Thank you for the suggestion but your script doesn't recognized by Saitek's FIP.

However, I have got the answer based on your suggestion as follows:

(A:PAYLOAD STATION WEIGHT:1, pound) (A:PAYLOAD STATION WEIGHT:2, pound) + (A:PAYLOAD STATION WEIGHT:3, pound) + (A:PAYLOAD STATION WEIGHT:4, pound) + (A:PAYLOAD STATION WEIGHT:5, pound) +

A bit dumb but it is what it is.

Thank you very much
 
I understand Saitek has its own XML interpreter, which can only process data from standard FS variables and events (A:vars and K:vars). Local and Gauge vars (?) (L,G) are evidently not supported. It seems to lack of a macro parser as well.

Tom
 
Exactly. That makes programming for the FIP a lot more complex and rather repetitious.
 
Last edited:
Back
Top