Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello,

I want to write a small program, which generates the radar.bin file, normally generated by fsuipc (version <7) with active sky (ASNwxRadarPath=c:\radar.bin).

Background: I want to generate a random wxr radar image within a home cockpit using FS2020 and Pro-Sim. 

For that, I need to know, how this file is built up ? I guess a matrix of numbers , which corresponds to density of rain ?

Thank you !

 

Posted

The radar image is just a bitmap. The other file contains information used for "other processing or investigation". I am not sure in the format if this file and it doesn't seem to be documented anywhere. Maybe check with ASN.

  • Like 1
Posted
  On 5/8/2023 at 9:48 AM, John Dowson said:

The radar image is just a bitmap. The other file contains information used for "other processing or investigation". I am not sure in the format if this file and it doesn't seem to be documented anywhere. Maybe check with ASN.

Expand  

Hello John,

thank you for your message.

I mean the file, which is created by fsuipc, when you have ASNwxRadarPath=c:\radar.bin set .

I thought, this file (radar.bin) is a matrix or something like that.

 

Kind regards

Posted
  On 5/8/2023 at 11:08 AM, Egyptair said:

I mean the file, which is created by fsuipc, when you have ASNwxRadarPath=c:\radar.bin set .

Expand  

It is created by FSUIPC, but the contents are provided by ASN in a callback as a block of binary data, and FSUIPC just writes the provided data as received. You need to check the ASN documentation to determine the content and structure of this data.

  • Like 1
Posted
  On 5/8/2023 at 11:08 AM, Egyptair said:

I mean the file, which is created by fsuipc, when you have ASNwxRadarPath=c:\radar.bin set .

I thought, this file (radar.bin) is a matrix or something like that.

Expand  

Yes, the Radar.bin file is a copy of the data received from Active Sky -- a matrix of bytes with cloud density as a binary value, and with the current aircraft position being represented by the centre of the base line. The scale is based on the range and settings in the request for the data.

But FSUIPC will also turn this into an BMP Image file on request by a line such as ASNwxRadarBitmapPath=C:\WXradar.bmp.

HiFi Simulations will provide documentation for developers wishing to take advantage of the data. Maybe you can ask them for the information. I don't feel right providing their documentation to you directly (even if I could still find it!)

Pete

 

Posted
  On 5/8/2023 at 1:03 PM, Pete Dowson said:

Yes, the Radar.bin file is a copy of the data received from Active Sky -- a matrix of bytes with cloud density as a binary value, and with the current aircraft position being represented by the centre of the base line. The scale is based on the range and settings in the request for the data.

But FSUIPC will also turn this into an BMP Image file on request by a line such as ASNwxRadarBitmapPath=C:\WXradar.bmp.

HiFi Simulations will provide documentation for developers wishing to take advantage of the data. Maybe you can ask them for the information. I don't feel right providing their documentation to you directly (even if I could still find it!)

Pete

 

Expand  

Hello Pete,

 

thank you for this information. 

Then I will get in touch with them and hope, they can provide me with the information about the file.

Kind regards

Ahmed

Posted
  On 5/8/2023 at 4:09 PM, Egyptair said:

Then I will get in touch with them and hope, they can provide me with the information about the file

Expand  

Not a file, just an in-memory array provided via a callback set up via one of the exported functions of the Active Sky DLL which, like FSUIPC, is also running within P3D. The size and scale of the array is set beforehand by calling other exported functions.

I've really no idea what Active Sky provide on MSFS whereby ProSim gets such data.

Pete

 

 

Posted
  On 5/9/2023 at 10:16 AM, Pete Dowson said:

I've really no idea what Active Sky provide on MSFS whereby ProSim gets such data.

 

Expand  

Hello Pete. Nothing... Active Sky communicates directly with pro-sim without having connection with MSFS. Due to that, the radar image and the clouds in MSFS does not match exactly...it is like having anything on the radar, when there is rain outside...

There are 2 ways, where pro-sim gets it's data for the wxr radar:

1. Direct connection with Active Sky 

2. Indirect connection with Active Sky via FSUIPC and the created radar.bin

The problem is: When using FSUIPC as primary connection mode with pro-sim/MSFS2020, then pro-sim does not display any wxr radar. When using Simconnect as primary connection mode, then the communication works and the wxr radar is displayed.

As due to hardware many users use fsuipc connection mode as primary mode, they cannot have a wxr radar image.

That's where I want to step in: Using method no 2 via the radar.bin file to get us w wxr radar image.

 

Kind regards

Ahmed

Posted

I am slightly confused by this as there is no Active Sky for MSFS - as far as I am aware...

  On 5/10/2023 at 11:08 AM, Egyptair said:

The problem is: When using FSUIPC as primary connection mode with pro-sim/MSFS2020, then pro-sim does not display any wxr radar.

Expand  

This makes sense, as there is no radar data (bin or jpg) produced by FSUIPC7, as there is no ActivceSky for MSFS.

  On 5/10/2023 at 11:08 AM, Egyptair said:

When using Simconnect as primary connection mode, then the communication works and the wxr radar is displayed.

Expand  

And is this radar image correct? Does the data/image come from ASN or MSFS? There is no way to get weather radar data via simconnect. There is a WebAssemply API that is provided that allows weather data radar images to be created and used in glass cockpits - the MapView API - maybe ProSim is using this? See https://docs.flightsimulator.com/html/Programming_Tools/WASM/MapView_API/MapView_API.htm

I did look into this API to see if it could be used to generate a radar weather jpg (but not a radar.bin file - that is ASN specific) via the FSUIPC WASM, but it was not obvious that this could be done easily as the API looks more like like something to be used by aircraft developers. I may spend more time looking into this API to see if it can be used by FSUIPC at some point in the future.

John

Posted
  On 5/10/2023 at 11:46 AM, John Dowson said:

I am slightly confused by this as there is no Active Sky for MSFS - as far as I am aware...

Expand  

Correct, it is Active Sky for P3DV5, which provides the data for the wxr radar image.

  On 5/10/2023 at 11:46 AM, John Dowson said:

This makes sense, as there is no radar data (bin or jpg) produced by FSUIPC7, as there is no ActivceSky for MSFS.

Expand  

Correct. Neither simconnect nor FSUIPC7 transmits the data for the wxr radar image, it is a direct connection between Active Sky and pro-sim via a port set in pro-sim.

That makes me wonder, why simconnect connection mode works and FSUIPC not... 

  On 5/10/2023 at 11:46 AM, John Dowson said:

And is this radar image correct? Does the data/image come from ASN or MSFS?

Expand  

The data comes from ASN. Because of this, the data is not exactly matching MSFS clouds, but comes pretty close. Everything works (range, tilt, intensity).

  On 5/10/2023 at 11:46 AM, John Dowson said:

There is no way to get weather radar data via simconnect. There is a WebAssemply API that is provided that allows weather data radar images to be created and used in glass cockpits - the MapView API - maybe ProSim is using this? See https://docs.flightsimulator.com/html/Programming_Tools/WASM/MapView_API/MapView_API.htm

Expand  

Corrrect, simconnect has nothing to do with it. Pro-Sim uses the direct connection to ASN

  On 5/10/2023 at 11:46 AM, John Dowson said:

I did look into this API to see if it could be used to generate a radar weather jpg (but not a radar.bin file - that is ASN specific) via the FSUIPC WASM, but it was not obvious that this could be done easily as the API looks more like like something to be used by aircraft developers. I may spend more time looking into this API to see if it can be used by FSUIPC at some point in the future.

John

Expand  

Kind regards

Ahmed

Posted

What I am trying is to have a small app. which does exactly the same, as the part in FSUIPC 6 (or lower) : Request wxr radar image data from active sky and save the matrix in a radar.bin file.

Posted
  On 5/10/2023 at 12:13 PM, Egyptair said:

What I am trying is to have a small app. which does exactly the same, as the part in FSUIPC 6 (or lower) : Request wxr radar image data from active sky and save the matrix in a radar.bin file.

Expand  

Then you need to load the AS_connect dll, get the addresses of the functions/variables you want to use, and then use them to generate the  radar/bin file:

...
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_v5.dll");
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_64.dll");
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_v6.dll");
if (hBtstrpDLL)
{	// Get pointer to its exported "ASN running" BOOL
	BYTE *(FSAPI *ASNIsRunning)(void) = (BYTE *(FSAPI *)(void))GetProcAddress(hBtstrpDLL, "isActive");
	if (ASNIsRunning)
...
	pAmbientIcing = (BYTE *) GetProcAddress(hBtstrpDLL, "AmbientIcing");
	pWshLat = (float *) GetProcAddress(hBtstrpDLL, "WshLat");
	pWshLon = (float *) GetProcAddress(hBtstrpDLL, "WshLon");
	pWshRange = (float *) GetProcAddress(hBtstrpDLL, "WshRange");
	pWshMinAlt = (float *) GetProcAddress(hBtstrpDLL, "WshMinAlt");
	pWshMaxAlt = (float *) GetProcAddress(hBtstrpDLL, "WshMaxAlt");
	*((FARPROC *) &pSetRdrParams) = GetProcAddress(hBtstrpDLL, "SetRdrParams");

	pAmbientTurbulence = (float *)GetProcAddress(hBtstrpDLL, "AmbientTurbulence");
	pExportedPrecipType = (BYTE *)GetProcAddress(hBtstrpDLL, "ExportedPrecipType");
	pExportedPrecipRate = (BYTE *)GetProcAddress(hBtstrpDLL, "ExportedPrecipRate");
	pExportedAmbientVisibility = (float *)GetProcAddress(hBtstrpDLL, "ExportedAmbientVisibility");
	pInCloud = (BYTE *)GetProcAddress(hBtstrpDLL, "InCloud");
...

Exact details on how to use the dll functions should be provided/available from ActiveSky.

John

Posted
  On 5/10/2023 at 12:24 PM, John Dowson said:

Then you need to load the AS_connect dll, get the addresses of the functions/variables you want to use, and then use them to generate the  radar/bin file:

Expand  

Thank you very much John. I will use that !

Kind regards

 

Ahmed

  On 5/10/2023 at 12:24 PM, John Dowson said:
...
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_v5.dll");
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_64.dll");
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_v6.dll");
if (hBtstrpDLL)
{	// Get pointer to its exported "ASN running" BOOL
	BYTE *(FSAPI *ASNIsRunning)(void) = (BYTE *(FSAPI *)(void))GetProcAddress(hBtstrpDLL, "isActive");
	if (ASNIsRunning)
...
	pAmbientIcing = (BYTE *) GetProcAddress(hBtstrpDLL, "AmbientIcing");
	pWshLat = (float *) GetProcAddress(hBtstrpDLL, "WshLat");
	pWshLon = (float *) GetProcAddress(hBtstrpDLL, "WshLon");
	pWshRange = (float *) GetProcAddress(hBtstrpDLL, "WshRange");
	pWshMinAlt = (float *) GetProcAddress(hBtstrpDLL, "WshMinAlt");
	pWshMaxAlt = (float *) GetProcAddress(hBtstrpDLL, "WshMaxAlt");
	*((FARPROC *) &pSetRdrParams) = GetProcAddress(hBtstrpDLL, "SetRdrParams");

	pAmbientTurbulence = (float *)GetProcAddress(hBtstrpDLL, "AmbientTurbulence");
	pExportedPrecipType = (BYTE *)GetProcAddress(hBtstrpDLL, "ExportedPrecipType");
	pExportedPrecipRate = (BYTE *)GetProcAddress(hBtstrpDLL, "ExportedPrecipRate");
	pExportedAmbientVisibility = (float *)GetProcAddress(hBtstrpDLL, "ExportedAmbientVisibility");
	pInCloud = (BYTE *)GetProcAddress(hBtstrpDLL, "InCloud");
...

Exact details on how to use the dll functions should be provided/available from ActiveSky.

John

Expand  

 

Posted
  On 5/10/2023 at 12:24 PM, John Dowson said:

Then you need to load the AS_connect dll, get the addresses of the functions/variables you want to use, and then use them to generate the  radar/bin file:

...
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_v5.dll");
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_64.dll");
if (!hBtstrpDLL) hBtstrpDLL = LoadLibrary("as_connect_v6.dll");
if (hBtstrpDLL)
{	// Get pointer to its exported "ASN running" BOOL
	BYTE *(FSAPI *ASNIsRunning)(void) = (BYTE *(FSAPI *)(void))GetProcAddress(hBtstrpDLL, "isActive");
	if (ASNIsRunning)
...
	pAmbientIcing = (BYTE *) GetProcAddress(hBtstrpDLL, "AmbientIcing");
	pWshLat = (float *) GetProcAddress(hBtstrpDLL, "WshLat");
	pWshLon = (float *) GetProcAddress(hBtstrpDLL, "WshLon");
	pWshRange = (float *) GetProcAddress(hBtstrpDLL, "WshRange");
	pWshMinAlt = (float *) GetProcAddress(hBtstrpDLL, "WshMinAlt");
	pWshMaxAlt = (float *) GetProcAddress(hBtstrpDLL, "WshMaxAlt");
	*((FARPROC *) &pSetRdrParams) = GetProcAddress(hBtstrpDLL, "SetRdrParams");

	pAmbientTurbulence = (float *)GetProcAddress(hBtstrpDLL, "AmbientTurbulence");
	pExportedPrecipType = (BYTE *)GetProcAddress(hBtstrpDLL, "ExportedPrecipType");
	pExportedPrecipRate = (BYTE *)GetProcAddress(hBtstrpDLL, "ExportedPrecipRate");
	pExportedAmbientVisibility = (float *)GetProcAddress(hBtstrpDLL, "ExportedAmbientVisibility");
	pInCloud = (BYTE *)GetProcAddress(hBtstrpDLL, "InCloud");
...

Exact details on how to use the dll functions should be provided/available from ActiveSky.

John

Expand  

John, as far as I have understood, the result of these 5 variables are written into the bin file:

pAmbientTurbulence = (float *)GetProcAddress(hBtstrpDLL, "AmbientTurbulence");
	pExportedPrecipType = (BYTE *)GetProcAddress(hBtstrpDLL, "ExportedPrecipType");
	pExportedPrecipRate = (BYTE *)GetProcAddress(hBtstrpDLL, "ExportedPrecipRate");
	pExportedAmbientVisibility = (float *)GetProcAddress(hBtstrpDLL, "ExportedAmbientVisibility");
	pInCloud = (BYTE *)GetProcAddress(hBtstrpDLL, "InCloud");
Posted
  On 5/10/2023 at 8:06 PM, Egyptair said:

John, as far as I have understood, the result of these 5 variables are written into the bin file:

Expand  

No, they aren't related to the radar image. As I have said several times, the Radar.bin file is just an array of cloud vapour density values. These other values are just made available via FSUIPC's offset memory.

As I said elsewhere, the radar data is provided by a Call Back for the DLL, set by a parameter for the SetRdrarams function, which has this definition:

void (*pSetRdrParams)(long aircraftHeading, long range1, float tilt1,
    long range2, float tilt2, RadarDataComplete callBack, void *pContext, long optionsFlag) = 0;

The CallBack function is defined like this:

typedef void (CALLBACK *RadarDataComplete)(long rdrSmallDimSize, void* rdrData, void* pContext);

However, the Active Sky DLL is meant to be run inside P3D (like FSUIPC). I wouldn't have thought it worked outside. But surely you should have all the information you need in any case -- didn't you say you had the AS API?

Pete

 

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.