Chris Wilson Posted August 22, 2011 Share Posted August 22, 2011 My ecu outputs seven decimal place GPS coordinates as two 16 bit channels and the data reading software then combines them using maths to give a degree based GPS coordinate to generate a track map. Below are two samples, one raw data from the ecu as two 16 bit channels, the other the GPS coordinate in degrees after the software has done the maths wizardry. Can anyone work out what it's doing to the raw date to combine them to make the correct coordinate please? I can't.... ECU output: GPS Latitude HW : 8015 GPS Latitude LW : -13983 Maths gives : Coordinate 52.8870988 degrees latitude ######################## ECU output : GPS Longitude HW : -364 GPS Longitude LW : 14387 Maths gives : Coordinate -2.6401195 degrees longitude Thanks! Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 Do you know what HW and LW stand for? Quote Link to comment Share on other sites More sharing options...
Noz Posted August 22, 2011 Share Posted August 22, 2011 Do you know what HW and LW stand for? scott, HW; Window Height LW; Window Length Quote Link to comment Share on other sites More sharing options...
stevie_b Posted August 22, 2011 Share Posted August 22, 2011 KInd of what I was wondering. High something and low something I would guess, but it is just a guess. I also don't know what type of coordinate system those numbers could be in. It must be some kind of recognised system otherwise the software (unless it's by the same manufacturer as the ECU) wouldn't be able to decode it to good ol' degrees. WGS84 gets mentioned quite a lot when talking about GPS, but googling WGS84 didn't help. Edit: I'm clearly out of my league. I'm out. Quote Link to comment Share on other sites More sharing options...
Andy Blyth Posted August 22, 2011 Share Posted August 22, 2011 Hi Chris I would expect that you need to join the high and the low words together to make one 32 bit word. It's probably easier to work in hex or binary when doing this. I would then expect that the least significant bit of this 32 bit word will represent a very small fraction of a degree. You just need to multiply the 32 bit number by this LSB value to get the real world measurement. Be careful with handling negative numbers during the conversion. You may also find that the conversions for longitude and latitude are different as the latitude only needs to encode +/- 90 degrees whereas the longitude needs to handle +/- 180 degrees. If you haven't got an answer tonight, I'll have another look for you. Andy Quote Link to comment Share on other sites More sharing options...
mikeyb10supra Posted August 22, 2011 Share Posted August 22, 2011 You need basic triganometry using Euclidean distances. I have a spreadsheet at work I developed working out store proximities for one of our clients. I will try and dig it out later if i get time and let you know the logistics behind the calculations Quote Link to comment Share on other sites More sharing options...
Chris Wilson Posted August 22, 2011 Author Share Posted August 22, 2011 All I can say is the hardware won't allow transmission of 32 bit data on the serial port, so they somehow split it up into two sets of 16 bit, then rejoin it in the software using maths. The end result is degrees, minutes and seconds to seven decimal places. I am collecting the data from the CAN BUS of the ecu, and logging it in a none Motec data logger. The data logger's software has powerful maths functions, so once I can see how Motec split and rejoin the data streams I should be able to duplicate it in the other software. They also split the GPS time data stream into two 16 bit channels, this may be easier, example below, the time does not take into account British Summer Time offset, by the way. GPS Time HW : 1614 GPS Time LW : -8040 GPS Time (combined) : 105832.600 Actual time was 10.58 AM and 32.600 seconds. Thanks everyone. Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 Now you're talking my language. This is more computing than maths although very much related. Back in a bit Quote Link to comment Share on other sites More sharing options...
Wez Posted August 22, 2011 Share Posted August 22, 2011 I know just the person who would like this question, might be worth a post on the Syvecs forum Chris http://www.syvecs.com/forum/ Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 Right I've figured out that LW = LoWord and HW = HiWord. This is a way of splitting a long number into 2. The trick is getting them back to one number which I thought was easy but it's proving hard as I can't get the figure you're looking for lol. Quote Link to comment Share on other sites More sharing options...
Chris Wilson Posted August 22, 2011 Author Share Posted August 22, 2011 Wez: Done, but I felt a bit cheeky.... Thanks. Quote Link to comment Share on other sites More sharing options...
Chris Wilson Posted August 22, 2011 Author Share Posted August 22, 2011 I have a little packet of gold stars here, keep at it Scott Thanks ! Quote Link to comment Share on other sites More sharing options...
Wez Posted August 22, 2011 Share Posted August 22, 2011 Wez: Done, but I felt a bit cheeky.... Thanks. Just seen it Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 Right I think I've cracked it. Do you have Excel with VBA Chris? Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 There we go mate The Deg, mins & secs box is just me converting after the decimal point. The raw data is in the first box, which will be accurate for time etc. Quote Link to comment Share on other sites More sharing options...
Chris Wilson Posted August 22, 2011 Author Share Posted August 22, 2011 Err, no, sorry mate, I don't. I apppreciate the trouble you have gone to, I have tried to open the file in Open Office, with macros enabled, but it comes up as an empty sheet. On another forum someone posted this: ############################### 8015*2^16 (shift left 16 bits) + -13983 (add on the second word) / 10^7 (7 decimal place fixed point) =52.5 Pretty close! and -364*2^16 (shift left 16 bits) + 14387 (add on the second word) / 10^7 (7 decimal place fixed point) =-2.384 Again pretty close. It's just putting together the 16-bit words. It looks like both words are 2's complement - it doesn't work if you assume it is two halves of a 32-bit 2's complement word. ###################################### Is this similar to your calculations Scott? Cheers. Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 Err, no, sorry mate, I don't. I apppreciate the trouble you have gone to, I have tried to open the file in Open Office, with macros enabled, but it comes up as an empty sheet. On another forum someone posted this: ############################### 8015*2^16 (shift left 16 bits) + -13983 (add on the second word) / 10^7 (7 decimal place fixed point) =52.5 Pretty close! and -364*2^16 (shift left 16 bits) + 14387 (add on the second word) / 10^7 (7 decimal place fixed point) =-2.384 Again pretty close. It's just putting together the 16-bit words. It looks like both words are 2's complement - it doesn't work if you assume it is two halves of a 32-bit 2's complement word. ###################################### Is this similar to your calculations Scott? Cheers. Very similar, yes. Mine is exact though Quote Link to comment Share on other sites More sharing options...
Chris Wilson Posted August 22, 2011 Author Share Posted August 22, 2011 So you come up with the exact same Long and Lat figures as the Motec software's manipulation of the data then? Because although the poster on the other forum says his is "close", it may be in numeric terms fairly close, but in geographic terms it's hundreds of miles out. Not in sunny Shropshire, but somewhere out in the North sea If I posted a screenshot of the maths input page could I impose on you to see if you could write your maths out in a way that could be in-putted to the page? Thanks Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 So you come up with the exact same Long and Lat figures as the Motec software's manipulation of the data then? Because although the poster on the other forum says his is "close", it may be in numeric terms fairly close, but in geographic terms it's hundreds of miles out. Not in sunny Shropshire, but somewhere out in the North sea If I posted a screenshot of the maths input page could I impose on you to see if you could write your maths out in a way that could be in-putted to the page? Thanks Unfortunately I didn't do the maths mate, I made the program do it for me The program is doing exatly what the guy has done, only infinite decimal places etc hence why it is more accurate. I'll try the program here and see what it does. Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 Works fine here mate Quote Link to comment Share on other sites More sharing options...
Chris Wilson Posted August 22, 2011 Author Share Posted August 22, 2011 So it's giving 52.8870988 degrees latitude and -2.6401195 degrees longitude? Where his is giving 52.5 (which is hundreds of miles away, geographically) and 2.384 which is even further out. Thanks Scott! Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 Yup Quote Link to comment Share on other sites More sharing options...
Chris Wilson Posted August 22, 2011 Author Share Posted August 22, 2011 Fantastic, well done! But how do you get from 52.5322593 to 52.8870988333333 ? Thank you very much Scott, you are my hero, once I have worked out how to set up the maths channel that's the coordinates sorted! Quote Link to comment Share on other sites More sharing options...
Scott Posted August 22, 2011 Share Posted August 22, 2011 Fantastic, well done! But how do you get from 52.5322593 to 52.8870988333333 ? Thank you very much Scott, you are my hero, once I have worked out how to set up the maths channel that's the coordinates sorted! Because the first figure is given as a decimal point from 10, rather than minutes and seconds. The 0.5322 etc has to be divided by 0.6 to convert it to minutes & seconds. Quote Link to comment Share on other sites More sharing options...
Chris Wilson Posted August 22, 2011 Author Share Posted August 22, 2011 Got it! Thanks. You have been a really great help!! Right, let's give Scott a break, who is up for trying to create a maths "thing" to do this automagically? Here's a screenshot of the maths feature in the GEMS software. I have called the channel to be created GPS LAT and have started by entering the GPS LAT HW channel, which should automatically enter the raw figures for that channel in as they are read. Screenshot below. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.