Jump to content
The simFlight Network Forums

Writing weather as a Metar string for FSX


Recommended Posts

Hi Pete,

 

I'm adding weather handling to my .NET DLL but I'm having a problem with writing metar strings.

 

To test this I'm reading the current metar, changing the winds and visibility and writing it back.

 

This is the write process I am doing:

 

1. Read the timestamp from C824

2. Write the Command to C800, the ICAO to C808 and the Metar string to B000 in one process call.

3. Read the timestamp again until it's changed (which it does).

 

The weather does change - the altimeter changes indicating a change in pressure, but the new weather is nothing like the metar string I sent; more like it clears the weather. So I suspect the above process may be wrong.  I've tried without writing the command to C800 but then nothing happens at all.

 

Here's the weather log - My metar write is at 114365 (that's coming through as written by my dll)...  At the same timestamp another metar string appears which is completely different. This is more like the weather that actually gets set.

********* FSUIPC4, Version 4.909 by Pete Dowson *********
Running inside FSX on Windows 7
Module base=0D0D0000
User Name="Paul Henty"
User Addr=""
FSUIPC4 Key is provided
WideFS7 Key is provided
      250 System time = 01/08/2013 00:19:49
      266 FLT UNC path = "\\PJHLAPTOP\Users\Paul\Documents\Flight Simulator X Files\"
      312 Trying to connect to SimConnect Acc/SP2 Oct07 ...
      344 FS UNC path = "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\"
      905 LogOptions=00000000 00000001
      905 SIM1 Frictions access gained
      905 Wind smoothing fix is fully installed
      905 G3D.DLL fix attempt installed ok
      905 SimConnect_Open succeeded: waiting to check version okay
      905 Trying to use SimConnect Acc/SP2 Oct07
     5164 Running in "Microsoft Flight Simulator X", Version: 10.0.61472.0 (SimConnect: 10.0.61259.0)
     5164 Initialising SimConnect data requests now
     5164 FSUIPC Menu entry added
     5258 \\PJHLAPTOP\Users\Paul\Documents\Flight Simulator X Files\EGJJ.FLT
     5258 C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\SimObjects\Airplanes\C172\Cessna172SP.AIR
    14680 System time = 01/08/2013 00:20:03, Simulator time = 00:19:55 (22:19Z)
    14680 Aircraft="Cessna Skyhawk 172SP Paint1"
    15679 Starting everything now ...
    17005 Advanced Weather Interface Enabled
   105707 Sim stopped: average frame rate for last 76 secs = 204.6 fps
   111307 LogOptions changed, now 00000000 00000003
   111557 Weather Read request (At Aircrft) to area 4: Lat=49.21, Lon=-2.21, Alt=85.6, Req=2
   111557 Weather Received (type 4 request, Interpolated): "????&A0 011145Z 00000KT&D0NG 100KM&B-448&D3048 2CU057&CU001FNMN000N 6CI393&CI001FNMN000N 14/04 Q1013 "
   111557 WX Received in (0 mSecs), WX request type 4, Lat=49.2070, Lon=-2.2066, Alt=85.6m
   113897 Weather Read request (Nr Station) to area 5: Lat=49.21, Lon=-2.21, Alt=0.0, Req=1
   113897 Weather Received (type 5 request, Nearest): "EGJJ&A84 191859Z 00000KT&D0NG 27019KT&A1917NG 27024KT&A5917NG 100KM&B-532&D3048 2CU054&CU001FNMN000N 6CI391&CI001FNMN000N 15/05 Q1013 @@@ 66 15 270 19 | 197 15 270 24 | "
   113897 WX Received in (0 mSecs), WX request type 5, Lat=49.2070, Lon=-2.2066, Alt=0.0m
   113897 >Change:  Pressure=1013.0 mb
   113897 >Change:  Surface wind: to alt=276ft, dir=0T, vel=0.0, gust=0.0, turb=0, shear=0, var=0.0
   113897 >Change:  Wind layer 1: to alt=19690ft, dir=0T, vel=0.0, gust=0.0, turb=0, shear=0, var=0.0
   113897 >Change:  Wind layer 2: to alt=22690ft, dir=270T, vel=24.0, gust=0.0, turb=0, shear=0, var=0.0
   113897 >Change:  Visibility[0]: range=62.1sm (100005m), from=-1460ft, to=8530ft
   113897 >Change:  Cloud[0]: type=9, from 5700ft to 9700ft (+/- 0ft), cover=2, turb=0, topshape=0
   113897 >Change:                      Precip=0, base=0ft, rate=0, icing=0
   113897 >Change:  Cloud[1]: type=1, from 39300ft to 39500ft (+/- 0ft), cover=6, turb=0, topshape=0
   113897 >Change:                      Precip=0, base=0ft, rate=0, icing=0
   113897 >Change:  Temperature[0]: alt=276ft, Day=14.0 C, NightVar=0.0 C, DewPt=4.0 C
   113897  Results: FS98 Pressure=1013.1 mb
   113897  Results: FS98 Wind0: ground (275ft) to 0ft AGL, dir 0M, vel 0, gust 0, turb 0
   113897  Results: FS98 Wind1: 276ft to 19690ft AMSL, dir=0T, vel 0, gust 0, turb 0
   113897  Results: FS98 Wind2: 19690ft to 22690ft AMSL, dir=270T, vel 24, gust 0, turb 0
   113897  Results: FS98 Vis: range =62sm, (raw value=6214)
   113897  Results: FS98 Cloud1: type=9, from 5700ft to 9700ft (+/- 0ft), cover 2, turb 0, ice 0
   113897  Results: FS98 Cloud2: type=1, from 39300ft to 39500ft (+/- 0ft), cover 6, turb 0, ice 0
   113897  Results: FS98 Temp0: to 276ft, Day 14.0C, NightVar 0.0C
   113897  Results: FS98 CurrTemp at PlaneAlt=279: 14C
   114365 Setting Metar: "EGJJ&A84 191859Z 06015KT&D0NG 06015KT&A1917NG 06015KT&A5917NG 50KM&B-532&D3048 2CU054&CU001FNMN000N 6CI391&CI001FNMN000N 15/05 Q1013 @@@ 66 15 270 19 | 197 15 270 24 | "
   114365 NW_SETEXACT weather command received, ICAO=EGJJ
   114365 >NewSet:  **** New Weather being set: ICAO=EGJJ (Dyn=0)
   114365 >NewSet:  Pressure=0.0, Drift=0.0
   114365 >NewSet:  Visibility[0]: range=0.0sm (0m), from=0ft, to=0ft
   114365 >NewSet:  **** End of New Weather details for ICAO=EGJJ
   114365 Setting Weather: "EGJJ 011145Z 00000KT 0050&B-84&D1 CLR 15/07 Q0000 "
   114427 Weather Mode now = Custom
   116221 Weather Read request (Global set) to area 1: ICAO="GLOB", Req=0
   116221 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 | "
   116221 WX Received in (0 mSecs), WX request type 1, ICAO=GLOB
   116221 >Change:  FS98 Pressure=846.0 mb
   116221 >Change:  FS98 Wind1: 276ft to 19690ft AMSL, dir=0T, vel 0, gust 0, turb 0
   116221 >Change:  FS98 Wind2: 19690ft to 22690ft AMSL, dir=270T, vel 24, gust 0, turb 0
   116221 >Change:  FS98 Vis: range =62sm, (raw value=6214)
   116221 >Change:  FS98 Cloud1: type=9, from 5700ft to 9700ft (+/- 0ft), cover 2, turb 0, ice 0
   116221 >Change:  FS98 Cloud2: type=1, from 39300ft to 39500ft (+/- 0ft), cover 6, turb 0, ice 0
   116221 >Change:  FS98 Temp0: to 276ft, Day 14.0C, NightVar 0.0C
   116221 >Change:  FS98 Dewpoint Control: disabled
   116221 >Change:  FS98 Precip Control: disabled
   116221  Results: FS98 Pressure=846.0 mb
   118561 Weather Read request (Nr Station) to area 5: Lat=49.21, Lon=-2.21, Alt=0.0, Req=1
   118561 Weather Received (type 5 request, Nearest): "EGJJ&A84 011145Z 00000KT&D304NG 0050&B-84&D1 CLR 15/07 Q0846 "
   118561 WX Received in (0 mSecs), WX request type 5, Lat=49.2070, Lon=-2.2066, Alt=0.0m
   123148 LogOptions changed, now 00000000 00000001
   137188 System time = 01/08/2013 00:22:06, Simulator time = 13:45:46 (11:45Z)
   137188 *** FSUIPC log file being closed
Average frame rate for running time of 95 secs = 196.0 fps
G3D fix: Passes 1119, Null pointers 0, Bad pointers 0, Separate instances 0
Memory managed: 48 Allocs, 48 Freed
********* FSUIPC Log file closed ***********


I'd be grateful for any pointers...

 

Thanks,

 

Paul

Link to comment
Share on other sites

1. Read the timestamp from C824

2. Write the Command to C800, the ICAO to C808 and the Metar string to B000 in one process call.

3. Read the timestamp again until it's changed (which it does).

 

All you need to do for writing METAR strings is write them to B000. If you set a WRITE command in the C800 area it will instigate a New Weather Interface weather write, as you can see from the log -- the weather data is then taken from the FS9-compatible areas of C800-CFFF, which because you've not set them up look like, er, rubbish.

 

I notice that the Offsets documentation for B000-B7FF is a little misleading. Sorry about that -- I'll fix it. It says "For GLOB or ICAO ID, set in C8xx area", which isn't necessary as the station ID is included in the METAR string. There's certainly no need to write a command or check any timestamps. That's all totally related to the NWI part, except for READING a METAR string, which is of course the same action as reading in the NWI (there's no other way of saying which weather you want. FSUIPC gets the string from SimConnect, dumps it in the B800 area and decodes it for the main NWI binary areas.

 

The other thing to notice is tthat the format for Writing METARs is not completely identical to that for Reading them. Blame Microsoft. I think they had different programmers doing the two parts who didn't talk to each other! The only way to suss this out fully is to look at examples.  Use Weatherset2 or ActiveSky or similar, nd do a SimConnect log so you can see the formats being read and written.

 

I think you are only the second person to want to use the FSUIPC4 METAR string method instead of the FS9/FSX compatible NWI methods.

 

Regards

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.