SetMetarData globally

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Locked
michaelwiki
Posts: 10
Joined: Tue Apr 11, 2017 6:05 pm

SetMetarData globally

Post by michaelwiki »

I'm attempting to set global weather data using the PDK's IWeatherSystemV400 interface. In SimConnect there is a function WeatherSetModeGlobal. Is there an equivalent functionality in the PDK? The results of sending the same metar string in SimConnect using :

simConnect.WeatherSetObservation(0, metar);

and PDK using:

m_spWeatherService->SetMetarData(metar, 0);

metar = "GLOB 1234 000000KT&D305NG 28SM OVC106 @@@ 000 -017 000 000"

The results are very different. The simconnect will cover the sky, where the PDK will draw only a few clouds right around the airport. I think I has to so with the global mode but I can't find any way to toggle this.
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: SetMetarData globally

Post by Clifton Crane »

Hello,

Are you using the correct character encoding? The SimConnect function is expecting a multibyte string where as the IWeatherSystemV400 PDK interface is expecting a wide string.

Thanks.
Clifton Crane
Prepar3D® Software Engineer Sr.
michaelwiki
Posts: 10
Joined: Tue Apr 11, 2017 6:05 pm

Re: SetMetarData globally

Post by michaelwiki »

Hi Clifton,

The exact PDK code is:
const WCHAR * metar = newWeather->str().c_str();
hr = m_spWeatherService->SetMetarData(metar, 0);

where str() returns a std::wstring and metar is L"GLOB 1556 000168KT&D305NG 0SM OVC009 @@@ 000 -017 000 099 " from the debugger. Also if I try to pass a non-wide string in, the compiler will not allow it.

I believe that the data is getting in, I see the some clouds generated when I send a commands over the PDK, but the change doesn't seem to be the same as nearly dramatic as SimConnect. For example, the string:

GLOB 1556 000000KT&D305NG 2SM OVC012 @@@ 000 -017 000 000

in SimConnect, reduces visibility, it looks like fog covers the airport, kicks on airport lighting, with OVC cloulds and 2 statue miles of visibility. Its a very nice scene. The same string (in wide format) sent in the PDK doesn't change anything.

Or if I send a command like :
GLOB 1556 000000KT&D305NG 28SM BKN106 @@@ 000 -017 000 000
nothing seems to happen with the PDK, but overtime a few clouds may appear in a group, off in the distance. But with SimConnect the entire sky is covered with cloulds.

Even through these are set in the P3D configuration already I tried:

m_spWeatherService->SetCloudCoverageDensity(CLOUD_COVERAGE_DENSITY_MAX);
m_spWeatherService->SetDetailedClouds(true);
m_spWeatherService->SetCloudDrawDistance(CLOUD_DRAW_DISTANCE_MAX);

As I work with the PDK more, I'm seeing a few areas where SimConnect is better some areas, and the PDK better at others. I may try to interface with SimConnect for the low frequency updates (like weather and setting time), and keep the high frequency updates, like position in the PDK. In fact I didn't see any way to set the time or date in the PDK. Is there any reason not to interface to SimConnent in the same DLL as the PDK?
Clifton Crane
Lockheed Martin
Posts: 1207
Joined: Tue Sep 25, 2012 2:34 pm

Re: SetMetarData globally

Post by Clifton Crane »

Hello,

Thanks for the report. There is no reason that both the PDK and SimConnect couldn't be used in conjunction within the same DLL. There is currently no way to set the weather mode via the WeatherPDK. I'll open a ticket to investigate the differences between the two weather functions.

Thanks.
Clifton Crane
Prepar3D® Software Engineer Sr.
Locked