jollylaus Posted August 10, 2017 Report Share Posted August 10, 2017 Hi Pete Is it / would it be possible to allocate FSUPIC offsets in order to interface with some of the AS weather information contained in their as_btstrp.dll ? This would allow us cockpit builders to implement through LUA/Sioc scripts extra functions like vibration generation for in flight turbulences, or weather controlled external strobe lights, which would become active in precipitation/cloud conditions only. Michael (‘Polarisfly’) has already applied such nice features in his home cockpit ( http://b737sim.blogspot.de/ ) by using an specific dll to access AS data. However I can’t get this dll run on my system, so I think the more clever solution would be to have that possibility through FSUIPC offsets. The following parameters listed in the Active Sky Application Programming Interface (API) document are required to achieve the above features: - AmbientIcing - AmbientTurbulence - InCloud - ExportedPrecipType - ExportedPrecipRate - ExportedAmbientVisibility Thanks and regards, Johannes Link to comment Share on other sites More sharing options...
Pete Dowson Posted August 10, 2017 Report Share Posted August 10, 2017 34 minutes ago, jollylaus said: The following parameters listed in the Active Sky Application Programming Interface (API) document are required to achieve the above features: - AmbientIcing - AmbientTurbulence - InCloud - ExportedPrecipType - ExportedPrecipRate - ExportedAmbientVisibility The ambient icing value is alreadyavailable in any case, at offset 8601. Please see the Offsets Reference section in the ASN WX Radar facilities document in your FSUIPC documents folder. That does actually list all the values I am currently aware of. The others aren't mentioned in my documentation. Mind you, I've not see an API document since ASN, so I assume there have been additions since AS16? I don't have a quick source for the API document for it (or ASP4 for that matter). Assuming I had the information I would presumably be able to add the others somewhere in the offsets, but I won't have time for the next few weeks I'm afraid. It would be middle of September. If you have the documentation, by all means send me a copy. it would be quicer than me asking HiFi. You can send it to petedowson@btconnect.com. I'll peruse it and let you know. If okay I'd put it on my list, but, just in case, you'd need to remind me mid-September. (I make so many lists). Pete Link to comment Share on other sites More sharing options...
jollylaus Posted August 10, 2017 Author Report Share Posted August 10, 2017 Pete, I have sent to you a mail with the API document. BR, Johannes Link to comment Share on other sites More sharing options...
Pete Dowson Posted August 10, 2017 Report Share Posted August 10, 2017 4 hours ago, jollylaus said: I have sent to you a mail with the API document. Yes, thank you. Is your interest more FSUIPC5, or FSUIPC4? it's just that I'm working more often on FSUIPC5 these days, of course, and don't expct to be updating FSUIPC4 so mch. Pete Link to comment Share on other sites More sharing options...
jollylaus Posted August 11, 2017 Author Report Share Posted August 11, 2017 Hi Pete, I'm not surprised by your question. Today I'm still on P3D V3 & FSUIPC 4. I will for shure migrate to P3D V4 / FSUIPC 5 in the future, but for many reasons this will need to go along with big soft & hardware changes to my current HC, and hence will not happen in short term (also pending on ProSim 737 V2 availability). I fully understand that you don't want to invest time in V4 anymore, so if you offer to consider my request for V5 it is absolutely fine for me. Thanks a lot for taking up my suggestion, Johannes Link to comment Share on other sites More sharing options...
Pete Dowson Posted August 16, 2017 Report Share Posted August 16, 2017 I've added the new Active Sky weather values to both FSUIPC 4 and 5. They are included in FSUIPC 4.971 and FSUIPC 5.112, both just released. The offsets are documented in the included Changes document, and actually follow on from those listed in the ASN Wx Radar document already installed in the FSUIPC Documents folder. Pete Link to comment Share on other sites More sharing options...
jollylaus Posted August 16, 2017 Author Report Share Posted August 16, 2017 Pete, you're great ! Many thanks. Johannes Link to comment Share on other sites More sharing options...
jollylaus Posted October 31, 2017 Author Report Share Posted October 31, 2017 Hi Pete, I struggle to read the Ambient Visibility Offset in meters. I'm using a SIOC script to read, interprete, and process this offset. In the end I want to have it assigned to a SIOC variable in meters. If I understand correctly the Ambient Visibility is a 32 bit floating type, i.e. length 8, and hence to be devided by 65536 * 65536. If I code it it like this in SIOC, it reads zero only. What am I doing wrong here ? Thanks in advance, Johannes Link to comment Share on other sites More sharing options...
Pete Dowson Posted October 31, 2017 Report Share Posted October 31, 2017 28 minutes ago, jollylaus said: If I understand correctly the Ambient Visibility is a 32 bit floating type, i.e. length 8, and hence to be devided by 65536 * 65536. If it is a 32-bit floating point number, it needs no handling whatsoever. You have to treat it just as a 32 bit floating point number! You are thinking of an integer, with fractions built into its value. And in any case 65536 * 65536 is over the maximum value a 32-bit value can take, so dividing it into any 32-bit value will give zero. In fact if your "SIOC" is using 32-bit integers in any case, 65536*65536 is already zero, so you should get an error using it as a divisor. So treat floating point numbers as floating point numbers. They are NOT integers. They have a sign bit, and exponent and a mantissa. 3 parts within the 32-bits. Look up "floating point" if you don't understand. Intel processors support two formats of floating point: 64-bit and 32-bit. In C/C++ 64-bit ones are called "double" and 32-bit ones "float". I don't know anything about SIOC, and other langiuages have different names for them. Pete Link to comment Share on other sites More sharing options...
jollylaus Posted October 31, 2017 Author Report Share Posted October 31, 2017 Pete, Thanks for the answer. SIOC is the script that goes along with Opencockpits panels. Amongst other features it interfaces to the SIM through FSUIPC. To declare a SIOC variable, which shall read/write FSUIPC offsets, you need to specify the offset, and its related size (they call it length) as specified in your Offset Status document. Regarding the Active Sky ambient visibility parameter, if it's a 32 bit floating point, the size/length of that offset (0x863C) should in my mind be 4. Can you confirm this ? I made the following small test: I have set manually in AS a visibility of 5000. - Using a LUA script I can directly retrieve that value in Offset 0x863C without further post-processing (as you said above) I use the following variable declaration: AmbVis = math.floor(ipc.readFLT(0x863C)) - The corresponding SIOC Variable declaration like this: var 6015, name Amb_Vis, LINK FSUIPC_IN, Offset $863C, length 4 (using length 4 if my a.m. assumption is correct). What SIOC reads out of 0x863C in decimal and binary format is the following : A totally different and inconclusive value compared to the LUA reading, so there is apparently something different/wrong here. The high number has lead me to the assumption that I need to 'postprocess' the value, but you correctly explained me that this is stupid. So in a nutshell my remaining question is if the size of offset 0x863C is 4 ? Many thanks, Johannes Link to comment Share on other sites More sharing options...
Luke Kolin Posted October 31, 2017 Report Share Posted October 31, 2017 Keep in mind that you can encode both an int and a float in 32-bits. It looks like with SIOC you're taking a 32-bit floating point number from the offset and reading it like it is an integer. Cheers! Luke Link to comment Share on other sites More sharing options...
Pete Dowson Posted October 31, 2017 Report Share Posted October 31, 2017 7 hours ago, jollylaus said: Regarding the Active Sky ambient visibility parameter, if it's a 32 bit floating point, the size/length of that offset (0x863C) should in my mind be 4. Can you confirm this ? Yes, of course. One byte is 8 bits. 8 x 4 is 32. 7 hours ago, jollylaus said: - Using a LUA script I can directly retrieve that value in Offset 0x863C without further post-processing (as you said above) I use the following variable declaration: AmbVis = math.floor(ipc.readFLT(0x863C)) Correct. You re reading it there as a float, a 32-bit floating point number. That's what you need to get SIOC to do, if it can. 7 hours ago, jollylaus said: - The corresponding SIOC Variable declaration like this: var 6015, name Amb_Vis, LINK FSUIPC_IN, Offset $863C, length 4 (using length 4 if my a.m. assumption is correct) Yes, length 4 is correct, but it is evidently reading it as an INT, not a float. 7 hours ago, jollylaus said: So in a nutshell my remaining question is if the size of offset 0x863C is 4 ? Yes, again. Exactly as I originally said. But it isn't the legth you have wrong, it's the type of number. I see Luke has also answered saying the same. And yes, in case you ask for a 4th time, even though I answered it in my previous response before you asked another 3 times, a float it 32 bits = 4 bytes. (A double is 64-bits = 8 bytes). One byte is 8 bits! Pete Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now