Jump to content
The simFlight Network Forums

Problem with wind layer altitudes in NWI LastGlobal 0xC400


Recommended Posts

Hi Pete,

A user of my DLL is having a problem reading back wind layers from 0xC400. I'm getting it too and think it could be a bug in FSUIPC4.

If I create three wind layers and write as Global Weather:

Layer: UpperAlt (metres): Knots
0    : 1000             : 10
1    : 2000             : 20
2    : 3000             : 30

Then read back weather using offset 0xC000 then it comes back fine. Exactly as I've written it.


However if I read back using offset 0xC400 then is comes back like this:

Layer: UpperAlt (metres): Knots
0    : 1000             : 10
1    : 1000             : 20
2    : 2000             : 30

That is, the wind speeds of the layers are correct, but the reported upper altitude is wrong. Layer 0 altitude is duplicated and then the subsequent altitudes are one layer behind.

I've examined the raw bytes from the reads using the FSUIPC Logging and they are different. I can see the duplication in the 0xC400 (LastGlobal) read which makes me think it could be a bug in FSUIPC.

Would you be able to take a look please?

Thanks,

Paul

Link to comment
Share on other sites

Reading the docs again I saw that you can get global weather from 0xCC00 using "GLOB" as the ICAO.

This works fine. I could change my DLL to use this method for getting the global weather rather than 0xC400.

Is the difference that C400 is what was last written and CC00 is the current state of the global weather which could be different because of dynamic weather? If that's the case I'm probably wrong to be using C400 in any case.

Paul

Link to comment
Share on other sites

Quote

That is, the wind speeds of the layers are correct, but the reported upper altitude is wrong. Layer 0 altitude is duplicated and then the subsequent altitudes are one layer behind.

I'd need to see the Extended METAR strings which are being written and read back. Simconnect is extremely quirky in the ayering facilities, but I'm pretty sure the METARs are constructed correctly, and interpreted correctly. It's the strange things which SimConnect does which are difficult to work out. The METARs are logged with Weather LoggingI used to be able to explain all this, and even understand my complex code, but we are talking about stuff which was complicated back in 2005/6, and I was a lot younger then!

Quote

Reading the docs again I saw that you can get global weather from 0xCC00 using "GLOB" as the ICAO.
This works fine. I could change my DLL to use this method for getting the global weather rather than 0xC400.

 

Ah. all I remember is that setting and reading global weather was always a very different business than the station weather, and I think C400 may use the old FS2004 methods. C000 and CC00 definitely are the result of interpreting METAR strings received from SimConnect.and using 'GLOB to write at C800 and 'GLOB' to read at CC00 should be perfectly symmetrical.

As I said, it would be easier to see whats going on from the METAR strings, because that's what it all comes down to in SimConnect.

Pete

 

Link to comment
Share on other sites

Hi Pete,

Here are the lines from the log with the weather logging turned on.


This is my set global weather request with the three wind layers.

362953 WX Received in (0 mSecs), WX request type 1, ICAO=GLOB
   363422 NW_GLOBAL command, setting weather to global mode
   363687 NW_SET weather command received, ICAO=GLOB
   363687 >NewSet:  **** New Weather being set: ICAO=GLOB (Dyn=0)
   363687 >NewSet:  Pressure=1013.0, Drift=2.0
   363687 >NewSet:  Visibility[0]: range=62.1sm (100005m), from=-1460ft, to=8530ft
   363687 >NewSet:  Temperature[0]: alt=0ft, Day=14 C, NightVar=3 C, DewPt=4 C
   363687 >NewSet:  Surface wind: to alt=3280ft AMSL, dir=0T, vel=10.00, gust=0.0, turb=0, shear=0, var=0.0
   363687 >NewSet:  Wind layer 1: to alt=6560ft AMSL, dir=270T, vel=20.0, gust=0.0, turb=0, shear=0, var=0.0
   363687 >NewSet:  Wind layer 2: to alt=9840ft AMSL, dir=0T, vel=30.0, gust=0.0, turb=0, shear=0, var=0.0
   363687 >NewSet:  Cloud[0]: type=9, from 5700ft to 15700ft (+/- 400ft), cover=2, turb=2, topshape=0
   363687 >NewSet:                      Precip=0, base=0ft, rate=0, icing=0
   363687 >NewSet:  Cloud[1]: type=1, from 39300ft to 40940ft (+/- 20ft), cover=6, turb=0, topshape=0
   363687 >NewSet:                      Precip=0, base=0ft, rate=0, icing=0
   363687 >NewSet:  **** End of New Weather details for ICAO=GLOB
   363687 Setting Weather: "GLOB 051136Z 00010KT&D1000NG 27020KT&A1000NG 00030KT&A2000NG 100KM&B-448&D3048 2CU057&CU100FMVN000N 6CI393&CI016FNVN000N 14/04&A0 Q1013 "
   364094 >Change:  Wind layer 1: to alt=6560ft, dir=270T, vel=20.0, gust=0.0, turb=0, shear=0, var=0.0
   364094 >Change:  Wind layer 2: to alt=9560ft, dir=0T, vel=30.0, gust=0.0, turb=0, shear=0, var=0.0
   364094  Results: FS98 Wind1: 3280ft to 6560ft AMSL, dir=270T, vel 20, gust 0, turb 0
   364094  Results: FS98 Wind2: 6560ft to 9560ft AMSL, dir=0T, vel 30, gust 0, turb 0


After that I get these two blocks repeating in the log until it's closed: (The plane is parked at EGJJ).

   364094 Weather Received (type 5 request, Nearest): "EGJJ&A84 051134Z 00010KT&D1000NG 27030KT&A1916NG 00020KT&A2833NG 100KM&B-532&D3048 2CU054&CU004FMVN000N 6CI390&CI000FNVN000N 14/04 Q1013 @@@ 66 14 270 30 | 96 14 0 20 | "
   364094 WX Received in (0 mSecs), WX request type 5, Lat=49.2070, Lon=-2.2066, Alt=0.0m
   365109 Weather Read request (Global set) to area 1: ICAO="GLOB", Req=0
   365109 Weather Received (type 1 request, (null)): "GLOB&A0 051136Z 00010KT&D1000NG 27020KT&A1000NG 00030KT&A2000NG 100KM&B-448&D3048 2CU057&CU010FMVN000N 6CI393&CI001FNVN000N 14/04 Q1013 @@@ 33 14 270 20 | 66 14 0 30 | "
   365109 WX Received in (0 mSecs), WX request type 1, ICAO=GLOB

For completeness, here are the results of the IPC Reads from the two weather areas: (Just up to the wind layers where you can see the problem in the second one from C400)

281641    0 ReadLocal: Offset=C000, Size=0400
            00 00 00 00 00 00 00 00 47 4C 4F 42 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 51 00 C9 07 50 3F 00 00 28 0A 40 FE
            46 18 00 00 01 00 00 00 00 00 0E 00 00 00 04 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 03 00 00 00 E8 03 0A 00 <- Layer 0
            00 00 00 00 00 00 00 00 00 00 00 00 D0 07 14 00 <- Layer 1
            00 00 00 C0 00 00 00 00 00 00 00 00 62 0B 1E 00 < - Layer 2

   263937    0 ReadLocal: Offset=C400, Size=0400
            00 00 00 00 00 00 00 00 47 4C 4F 42 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 2C BD C8 07 50 3F 20 00 28 0A 40 FE
            46 18 00 00 01 00 00 00 00 00 0E 00 03 00 04 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 03 00 00 00 E8 03 0A 00   <- Layer 0 - OK
            00 00 00 00 00 00 00 00 00 00 00 00 E8 03 14 00   <- Layer 1 - Duplicate E8 03
            00 00 00 C0 00 00 00 00 00 00 00 00 D0 07 1E 00  <- Layer 2 - Altitude from Layer 1 not 2 


Paul

Link to comment
Share on other sites

Okay. The METAR strings are correct. The surface wind doesn't have an altitude specification, but a DEPTH, to quote the spec:

Quote

Format of the extension is &DNNNNTS

where
NNNN is the depth (height) in meters. The default is 1000 feet or 305m.

The upper winds have a BASE altitude, AMSL:

Quote

This repeats the surface wind data but instead of specifying a surface layer depth it specifies a base altitude. The extension format is &ANNNNTS. Note the A for altitude instead of D for depth, and that wind altitudes are above mean sea-level (MSL).

So the METARs are correct, surface to 1000m (assuming ground is close to MSL) then layer 1 base 1000m, layer 2 base 2000m.  Unless you specify a layer above, the depth isn't specifiable. The SDK notes on this are contradictory -- as well as the above it says:

Quote

The altitude of a WINDS ALOFT section specifies the top of the layer in which the given wind data is to apply. The bottom of the layer will be determined by the top of any lower layer, either another WINDS ALOFT entry, or the SURFACE WINDS entry.

which I seem to recall I believed at first and only found out the hard way that the Altitude was, indeed, the base -- though the top altitude seems far more sensible to me!

I have checked the latest P3D SDK documentation too, and it is the same.

I doubt that anyone in L-M can fathom out the intricacies of the FSX/P3D weather system. It was coded by an extremely clever young woman who was on a sort of sabbatical from her PhD studies in the US, and who left soon after it was "finished". Even Dave Denhart, the main SimConnect creator and my main contact in MS/ACES didn't really understand the code and never managed to fix any of the bugs found later. It's very impressive, really, that folks doing professional weather programs like ASN and OpusFSI have done such a good job. I wish I could have done as well trying to provide an FSUIPC interface to it all!

Pete

 

 

  • Upvote 1
Link to comment
Share on other sites

Thanks for the comments.

I've decided that my DLL should really be getting global weather using 'GLOB' from the CC00 area. Even if C400 worked it would probably be the wrong thing as this is just the last weather written, not the current weather.

Since CC00 is returning the correct values my user is happy now.

Paul

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.