Jump to content
The simFlight Network Forums

Setting weather through FSUIPC in FSX


Recommended Posts

Hello,

I want to use FSUIPC to set/modify weather in FSX. For that, I prepare the following C buffer:

sprintf(TxBuffer, "LFMN 260608Z 27015KT 7SM +TSRA BKN055CB 30/17 A2974");

FSUIPC_Write(0xC800, strlen(TxBuffer)+1, (void *)TxBuffer, &dwResult);

FSUIPC_Process(&dwResult);

In a previous post I asked if I did a mistake with such a buffer and Peter answered that I was probably doing a mistake regarding the size of the buffer I wrote, so that I add corrected my code to replace:

FSUIPC_Write(0xC800, strlen(TxBuffer), (void *)TxBuffer, &dwResult);

by:

FSUIPC_Write(0xC800, strlen(TxBuffer)+1, (void *)TxBuffer, &dwResult);

However, this seems not to be enough to change the weather...

I have enabled the logging in FSUIPC menu interface for weather. I see that there is a lot message recorded in the console.

Questions:

1) I'm taking off from LFMN. Should date and hour of the METAR be adjust to the current date and time of the FSX flight ?

2) Do logged weather messages erase/cancel the METAR I try to write ?

3) Is there some options I should select in the FSUIPC dialog box to enable me to write weather ?

Any other suggestion is welcome !!

Thank you.

Paul-Henri

Link to comment
Share on other sites

sprintf(TxBuffer, "LFMN 260608Z 27015KT 7SM +TSRA BKN055CB 30/17 A2974");

FSUIPC_Write(0xC800, strlen(TxBuffer)+1, (void *)TxBuffer, &dwResult);

FSUIPC_Process(&dwResult);

C800 is the offset for the setting the weather in the binary data format as defined in the New Weather Interface documentation. See the ZIP in the FSUIPC SDK. If you want to write METAR strings the offset is clearly defined as being B000.

I have enabled the logging in FSUIPC menu interface for weather. I see that there is a lot message recorded in the console.

The messages go to the log file as well, so you can find where your atttempt was done and analyse the results. That's the point of logging. Just search for the line starting "Setting Metar". For example, I've just sent more or less your METAR but for EGCC and a QNH of 1019 hPA (I think yours works out to 1007 hPA):

796541 Setting Metar: "EGCC 260608Z 27015KT 7SM +TSRA BKN055CB 30/17 Q1019"

796822 Weather Read request (Global set) to area 1: ICAO="GLOB", Req=0

796822 Weather Received (type 1 request, (null)): "GLOB&A0 000000Z 00000KT&D985NG 27020KT&A2001NG 27025KT&A6001NG 100KM&B-448&D3048 2CU057&CU001FNMN000N 6CI393&CI001FNMN000N 15/05 Q1013 @@@ 66 15 270 20 | 197 15 270 25 | "

796822 WX Received in (0 mSecs), WX request type 1, ICAO=GLOB

796822 Results: FS98 Pressure=1019.0 mb

796822 Results: FS98 AmbientWind at PlaneAlt=266: dir 317M, vel 15

796822 Results: FS98 CurrTemp at PlaneAlt=266: 30C

798850 Weather Read request (Nr Station) to area 5: Lat=53.35, Lon=-2.29, Alt=0.0, Req=1

798850 Weather Received (type 5 request, Nearest): "EGCC&A77 260608Z 27015KT&D304NG 11KM&B-1577&D3253 7CB055&CB001FHHR000N 30/17 Q1019 "

...

803155 WX Received in (0 mSecs), WX request type 5, Lat=53.3456, Lon=-2.2919, Alt=0.0m

803155 >Change: Pressure=1019.0 mb

803155 >Change: Surface wind: to alt=1250ft, dir=270T, vel=15.0, gust=0.0, turb=0, shear=0, var=0.0

803155 >Change: Wind layer 1: remainder cleared

803155 >Change: Visibility[0]: range=6.8sm (11008m), from=-4920ft, to=5750ft

803155 >Change: Cloud[0]: type=10, from 5700ft to 35700ft (+/- 0ft), cover=7, turb=3, topshape=0

803155 >Change: Precip=1, base=0ft, rate=4, icing=0

803155 >Change: Temperature[0]: alt=250ft, Day=29.0 C, NightVar=0.0 C, DewPt=16.0 C

803155 >Change: Temperature[1]: remainder cleared

You can see my write to B000 recorded at time 796541, and getting confirmation back that it is set at time 798850, i.e. just over 2 seconds later. The "change" stuff later is the eventual result as placed in the assorted fS98-style offsets. (Cloud type 10 is thunderstorm, or CB, cumulonimbus). To interptet the extra METAR encodings supplied from SimConnect you'll need to refer to the SimConnect SDK.

1) I'm taking off from LFMN. Should date and hour of the METAR be adjust to the current date and time of the FSX flight ?

No, as the SimConnect description states: "this parameter is ignored when setting weather data.".

2) Do logged weather messages erase/cancel the METAR I try to write ?

Of course not! Logging is just a process of writing to a file the details of what is read and written in order to work out what is going on. It wouldbe futile if it changed what was going on!

3) Is there some options I should select in the FSUIPC dialog box to enable me to write weather ?

No. FSUIPC simply sends your METAR string to SimConnect. It is then all up to FSX.

Only the log will show what is going on, so you need to locate the relevant section.

BTW, LFMN is Nice, in France, and the barometric pressure is measured in hectopascals in Europe, so I'm assuming that is a METAR you made up for yourself? Oh, also of course the visibility would be in KM not SM. These things don't matter, but the read back will be metric as you see from my test, above.

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.