jd Posted July 10, 2006 Report Posted July 10, 2006 you're probably overflowing the magvar variable i use MagVar = MagVar / 65536 * 360 what is the real magnetic variation where you're at? i'm betting that it is really -20, which will yield a number slightly higher than 360 so you will need a routine to take a heading that is larger than 360, and normalize it to a number between 0 and 359 jd
Paul Henty Posted July 10, 2006 Report Posted July 10, 2006 If I do the final math I get -19.68761 Any ideas? It's correct. It's about -20 degrees from north, which is another way of saying 340 which is what you were looking for. To translate your -20 into 340 just add 360. When you're working with headings this happen alot, sometimes you get negative headings, sometimes over they go over 360. As JD says, you just need to write a function to normalise them. He posted one eariler in this thread, about 12 messages up. It's called norm360. You need to call that everytime you do maths on a heading and you want it in conventional 0-360 notation. Paul
Pete Dowson Posted July 10, 2006 Report Posted July 10, 2006 The Plane Heading is returning .312 while at 340. The MagVar is returning 20. If I do the final math I get -19.68761 Any ideas? Yes, -19.68761 is correct. Think of the degrees round a circle, Counts 0 to 360 clockwise, 0 to -360 anticlockwise. -19.68761 is identical to 340.31239. The problem is only that you are using signed numbers instead of unsigned numbers (the Heading is unsigned), but that's not your fault because VB stupidly doesn't support unsigned arithmetic. Just add 360.0 when you have negative result. This is not rocket science by the way, just elementary junior arithmetic. Regards, Pete
Pete Dowson Posted July 10, 2006 Report Posted July 10, 2006 my vb does unsigned arithmetic :-) Ah .. is that a later version? Last time I looked it didn't. Does it also support 16-bit (short) values too now? Pete
Paul Henty Posted July 10, 2006 Report Posted July 10, 2006 Ah .. is that a later version? Last time I looked it didn't. Does it also support 16-bit (short) values too now? VB has always supported 16-bit integers - they are called 'Integer'. 32-bit integers are called 'Long' in VB. 64-bit integers are not supported. VB6 does not support unsigned 16-bit or 32-bit integers. The 8-bit integer (Byte) is treated as unsigned. VB.NET 2003 added 64-Bit integers and changed the integer naming to the more usual: 16-Bit = Short 32-Bit = Integer 64-Bit = Long VB.NET 2005 finally added support for unsigned Integers: UShort, UInteger and ULong. Paul
grigory Posted May 24, 2017 Report Posted May 24, 2017 Good time.Tell me how to write text output to the simulator Prepar3d, across FSUIPCon DelphiHelp, full codethanks for the help
Pete Dowson Posted May 25, 2017 Report Posted May 25, 2017 You either need the FSUIPC SDK, or Paul Henty's .Net DLL. I recommend the latter. 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