Jump to content
The mkiv Supra Owners Club

Maths function question


Chris Wilson

Recommended Posts

On a side note, that GEMS software looks great. I wish my ECU had a CAN output so I could use one of their loggers! I have to do it by hand with .csv files.

 

The loggers came with some old PCMCIA memory cards, and they all had on data logs from factory WRC cars, very interesting stuff, they were logging DOZENS and DOZENS of things, all very sophisticated stuff, specially yaw angles and the 4WD control strategies. So GEMS does have a very good pedigree, but 95% of users are rally people.

Link to comment
Share on other sites

  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

Did you get the Autronics? GDA Pro will import CSV files. Motec i2 pro will only import files from 3 other ecus / loggers, unless you buy a 10K licence to do what you will with it :(

 

If you send me a smallish csv file I'll try importing it and see how it manages. GDA is very similar to i2. To be honest i2 is better, GDA will crash if you do funny things, i2 is solid as a rock.

 

I went for an Adaptronics e1280s. It's not common at all, but amazingly versatile. Perfect for a tinkerer like myself. If only it had a CAN interface!

 

Thanks Chris, I've attached a trivial logfile I recorded a while ago. It's not from a running engine, it's from a test I was running while trying to debug the triggering settings (hence the oscillating engine speed that should be 6000 RPM solid).

Link to comment
Share on other sites

I went for an Adaptronics e1280s. It's not common at all, but amazingly versatile. Perfect for a tinkerer like myself. If only it had a CAN interface!

 

Thanks Chris, I've attached a trivial logfile I recorded a while ago. It's not from a running engine, it's from a test I was running while trying to debug the triggering settings (hence the oscillating engine speed that should be 6000 RPM solid).

 

That was painless, I haven't set any scaling, but it works fine. These loggers will also take a serial input... I think mine need a firmware upgrade for that to be "state of the art"

Link to comment
Share on other sites

That was painless, I haven't set any scaling, but it works fine. These loggers will also take a serial input... I think mine need a firmware upgrade for that to be "state of the art"

 

Thanks for that Chris! It looks like it's exactly what I've been looking for. If you don't mind me asking, what's the damage on the pro version of the software? I can't find it on their website.

Link to comment
Share on other sites

Retail price list attached, I can get trade on this, but the discount is not exactly mind blowing, but happy to pass it all on, least I can possibly do if you fancy it :)

 

This is the logger I am using : http://www.gems.co.uk/?content=pages&id=da99l2-data-logger

 

£240 + VAT is not bad at all. I was expecting about 10x that! I may very well go for that software once I get the ECU up and running and ready for dyno tuning. Probably xmas at the earliest at the rate I'm going though!

Link to comment
Share on other sites

Interesting. I wonder if it's the way the floor function is handling negative numbers. What do you get for floor(-2.3840563)?

 

I'm pretty sure this will give -3 rather than -2. You need to use the ceil() function when the number is negative to round up towards 0. The following should use floor() or ceil() appropriately.

 

if(((combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)>=0),(((combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)-(floor(combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)))/0.6)+(floor(combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)),(((combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)-(ceil(combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)))/0.6)+(ceil(combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)))

Link to comment
Share on other sites

I'm pretty sure this will give -3 rather than -2. You need to use the ceil() function when the number is negative to round up towards 0. The following should use floor() or ceil() appropriately.

 

if(((combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)>=0),(((combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)-(floor(combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)))/0.6)+(floor(combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)),(((combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)-(ceil(combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)))/0.6)+(ceil(combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000)))

 

 

*loody hell, that's looking complicated :) Sadly, it seems to have been a step backwards, see attached. I am bog eyed now, God knows how you feel :) Shall we re charge and have a break? The wife thinks I am after some bint on line ;) REALLY grateful to Scott and yourself for all the effort, I think it is crackable, Motec made it sound so easy... :

 

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

You just need to place the high word to the left of the Low word, without

any multiplication, division or anything.

 

You can then put the decimal place at the 7th number in from the right.

 

Example:

 

The GPS Lat and GPS Long are just split in 2, nothing more challenging than

that.

 

GPS LON HW is the High word component.

GPS LON LW is the Low Word component.

 

Eg

 

144.9688203

Is

HW is 0101011001101000

 

LW is 0111110010001011

 

Put them together

 

 

01010110011010000111110010001011

= 1449688203

 

Divide by

10000000

 

Gives you

 

144.9688203

 

This is the GPS Long value.

 

 

 

Jamie Augustine

 

MoTeC Research Centre

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

*loody hell, that's looking complicated :) Sadly, it seems to have been a step backwards, see attached. I am bog eyed now, God knows how you feel :) Shall we re charge and have a break? The wife thinks I am after some bint on line ;) REALLY grateful to Scott and yourself for all the effort, I think it is crackable, Motec made it sound so easy...

 

Yes it's getting a bit silly now! :-)

 

It would be much easier to understand if it were split into intermediate steps instead of cutting and pasting the same function several times over. I'll have another crack tomorrow.

Link to comment
Share on other sites

It becomes much easier to read if it's spilt into two steps. First, I'd create a channel called something like GPS_LAT_COMBINE. This would be the first step of converting the two 16 bit numbers into a 32 bit number:

 

GPS LAT COMBINE = combine16(if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW'),'GPS LAT LW')/10000000

 

Then the calc for GPS LAT becomes:

if(('GPS LAT COMBINE'>=0),((('GPS LAT COMBINE'-floor('GPS LAT COMBINE'))/0.6)+(floor('GPS LAT COMBINE'))),((('GPS LAT COMBINE'-ceil('GPS LAT COMBINE'))/0.6)+(ceil('GPS LAT COMBINE'))))

 

You'd have to create a similar intermediate channel for longitude.

Link to comment
Share on other sites

Much easier to read, but the maths seem to have failed, see the comparison below please Andy, thanks.

 

Hi Chris

 

There's a couple of things I've noticed in your results:

 

1: The new combined channels seem to have less precision than necessary. There's only 2 decimal places (52.53) when you need 6-7 places (52.5322745). Is there a way in the GDA software to add more decimal places to GPS LAT COMBINE and GPS LON COMBINE?

 

2: Even when I try the calc with 52.53, I get a different answer for the actual latitiude. Did you copy the new formula from post 43 or from the notification email? I made a mistake in the original post with the position of the parentheses which will give the wrong result. The formula now in post 43 should be correct.

Link to comment
Share on other sites

I can add more decimal places, up to 10 I think, I'll add 7 Andy. I copied from the edited post, I am pretty sure, but will try again in a minute. Someone else mentioned signed and unsigned data. When I set up the logger I have the option to put each channel as signed or unsigned. I have tried both and the data, even to seven decimal places, appears the same, The data we have been manipulating is all from a setup with all channels signed I think. Doesn't signing remove some data? Not really sure about this, but surely the sign "symbol" must display integers somehow? Does it matter.... ? :)

Link to comment
Share on other sites

It does matter! The function if('GPS LAT HW'>32767,('GPS LAT HW'-65536),'GPS LAT HW') within the COMBINE channels accounts for the fact that the high word has been logged as an unsigned rather than a signed.

 

If you wanted to change it to be correct, you could set the high word to be signed, the low word to be unsigned and then change the COMBINE channels to be along the lines of:

 

GPS LAT COMBINE = ((('GPS LAT HW'*65536)+'GPS LAT LW')/10000000)

 

With the channels set up this way, the HW should show the same value in GDA and i2. The LW will show the same value if it is 32767 or lower, otherwise it will be negative in i2 and positive in GDA. This is not a problem however.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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. You might also be interested in our Guidelines, Privacy Policy and Terms of Use.