Jump to content
The simFlight Network Forums

What is the architecture of the weather radar file (eg radar.bin) generated by fsuipc ?


Recommended Posts

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 !

 

Link to comment
Share on other sites

1 hour ago, 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.

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

Link to comment
Share on other sites

1 hour ago, Egyptair said:

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

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
Link to comment
Share on other sites

1 hour ago, 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.

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

 

Link to comment
Share on other sites

3 hours ago, 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

 

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

Link to comment
Share on other sites

18 hours ago, Egyptair said:

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

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

 

 

Link to comment
Share on other sites

On 5/9/2023 at 12:16 PM, Pete Dowson said:

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

 

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

Link to comment
Share on other sites

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

25 minutes ago, 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.

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

27 minutes ago, Egyptair said:

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

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

Link to comment
Share on other sites

17 minutes ago, John Dowson said:

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

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

17 minutes ago, 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.

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... 

17 minutes ago, John Dowson said:

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

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).

17 minutes ago, 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

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

17 minutes ago, 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

Kind regards

Ahmed

Link to comment
Share on other sites

5 minutes ago, 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.

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

Link to comment
Share on other sites

2 hours ago, 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:

Thank you very much John. I will use that !

Kind regards

 

Ahmed

2 hours ago, 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

 

Link to comment
Share on other sites

7 hours ago, 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

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");
Link to comment
Share on other sites

14 hours ago, Egyptair said:

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

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

 

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.