Nico1854 Posted December 7, 2016 Report Posted December 7, 2016 (edited) Hello, I've spent my afternoon trying to find out how to convert the pressure altitude offset into the same unit result than the altitude (0x0570) Im my .lua file, I have this : lat, lon, alt, pitch, bank, hdgT = ipc.readStruct(0x0560,"3DD", "2SD", "1UD") palt = ipc.readStruct(0x34B0, "2SD") alt = alt * 3.28084 / (65536 * 65536) palt = palt * 3.28084 / (65536 * 65536) but the result does not match. Also, I would like to know what offset to take and how to check when : Engine 1 is "stabilized". I tried with offset 0894 but it seems that the result varies depending on the throttle. I was more looking for a kind of result indicating engine stabilized so I can start engine 2. APU is available (at 100%) No tried yet, I ask before I spend another day to find a maybe easy answer to find here. Thanks in advance for the help Nicholas Edited December 7, 2016 by Nico1854
Pete Dowson Posted December 7, 2016 Report Posted December 7, 2016 28 minutes ago, Nico1854 said: I've spent my afternoon trying to find out how to convert the pressure altitude offset into the same unit result than the altitude (0x0570) Im my .lua file, I have this : lat, lon, alt, pitch, bank, hdgT = ipc.readStruct(0x0560,"3DD", "2SD", "1UD") palt = ipc.readStruct(0x34B0, "2SD") alt = alt * 3.28084 / (65536 * 65536) palt = palt * 3.28084 / (65536 * 65536) but the result does not match. That's not surprising when you are reading 34B0 as a two signed DWORD (32-bit) structure into one variable, and discarding the other. If you refer to the offset list you'll see 34B0 is a double float value (64 bits or 8 bytes) which you'd read using ipc.readDBL. No way can you read just half of it in the wrong format and expect it to be anywhere close! Also it is in metres (as, again, you'd see if you referred to the offsets list). So just multiply by 3,28084 to get feet. 28 minutes ago, Nico1854 said: Also, I would like to know what offset to take and how to check when : Engine 1 is "stabilized". I tried with offset 0894 but it seems that the result varies depending on the throttle. I was more looking for a kind of result indicating engine stabilized so I can start engine 2. A stabilised jet engine is one with more or less the correct N1%. Mostly the Start switch trips automatically from GND back to off just as it reaches around 20% I'd check for something between 18 and 22, then wait another second or two. Pete
Nico1854 Posted December 7, 2016 Author Report Posted December 7, 2016 Thank you very much for your help. I must admit that I do not really understand the offset list in regard of types of offsets even if I tried to via reading the Lua Library guide and the FAQ explaining it. Anyway, I now have the value I wanted, I'm happy. I will now work on the engine starter switch 0892 ipc.readUB (my guess) and APU 0B54 ipc.readSD (again my guess)
Pete Dowson Posted December 7, 2016 Report Posted December 7, 2016 39 minutes ago, Nico1854 said: I will now work on the engine starter switch 0892 ipc.readUB (my guess) and APU 0B54 ipc.readSD (again my guess) Why on Earth are you guessing? UB = Unsigned Byte (i.e. a single byte). There is a column in the offsets list which surely isn't hard to understand. It is headed "Size". The size is in bytes (the offset numbers are actually byte numbers, in hexadecimal). So 0892 is two bytes, or a Word (W). And the names UB, UW and so on are described in the Lua library reference, for each one. So why not simply try to match the one to the other? Surely that is simple enough? If not, why not? In the case of 0892 a UB would actually also work because the value there should never exceed the capacity of that one byte (0-255). 0B54 is listed as a 32-bit float. Why not find the correct read function in the library to match that? It isn't hard, and it certainly is not SD. (Both parts of SD are wrong -- an RPM can't be negative so it isn't signed, and it isn't a DWORD (D) which is a 32-bit integer). Do try looking things up. It takes more time for you to come here posting such questions and for me to see it when they can be so easily answered yourself faster with just a little effort! Pete
Nico1854 Posted December 7, 2016 Author Report Posted December 7, 2016 I did try to understand before coming here to ask for help. I also hoped that coming here could help me to improve and be more autonomus in the future. Your answer are helping me in that way, thank you for them. In fact, I did not match the size with the 8-16-32-bit and that is the main reason I was finding it so hard to understand. My native language is French, I try to do my best in English and that maybe does not help. Anyway, Thanks for your help and hope I will manage alone for my next steps Regards Nicholas
Nico1854 Posted December 7, 2016 Author Report Posted December 7, 2016 (edited) Ok, maybe you are not going to like this but I am trying to understand and I am not arriving to proceed properly. Following your last post, I thought that 0B54 was 32 unsigned but float. So, I first tried with FLT, the result stay at 0 even when in the PMDG 777, the APU Rpm are at 100 %. So, I guess that maybe this PMDG Addon does not use the P3D Apu but an inbuilt solution. Will investigate further to find a solution By the way It would be so much easyer (at least for me) if instead of size column, there would be a nType column in the offset document maybe. Edited December 7, 2016 by Nico1854
Pete Dowson Posted December 7, 2016 Report Posted December 7, 2016 1 hour ago, Nico1854 said: Following your last post, I thought that 0B54 was 32 unsigned but float. So, I first tried with FLT, the result stay at 0 even when in the PMDG 777, the APU Rpm are at 100 %. The PMDG 737NGX and 777X add-ons do NOT use FS systems, and certainly not the default APU. Both of those addons have their own mapped offsets which are documented in other documents into your FSUIPC Documents folder. But you must also set some parameter correctly in a file associated with the addon to make it export those values. I'm afraid I cannot support PMDG aircraft since I do not use them and don't know enough about them. Check the SDK folder in your PMDG folders, maybe there's help there. Else ask in the PMDG forums. 1 hour ago, Nico1854 said: By the way It would be so much easyer (at least for me) if instead of size column, there would be a nType column in the offset document maybe. The offset lists predates things like Lua by many years. Are you volunteering to do all the work? The whole system you are trying to use is aimed more at system implementers and programmers who have at least learned some basic programming. One of the basic things you need to understand in all programming languages is the types of numbers you can have. You only have to tie the number types together. In the case of 0B54 the words "32-bit float" occur in both the description in the offsets list and the description of the ipc.readFLT function. Why not match these up as I suggested? Pete
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