Jump to content
The mkiv Supra Owners Club

Maths function question


Chris Wilson

Recommended Posts

The Motec data shows no sign of the lat or lon high words ever going to 0. I believe the Motec software has some filtering, but unsure how it works, this is how the GDA shows the track overlay when you use the options in Google Earth to make the line thinner, it's the white lines, showing several laps, obviously, compared to a single lap from the i2 export function.

 

http://www.gatesgarth.com/GDA/zigzag.png

Link to comment
Share on other sites

  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

GEMS have drawn my attention to this in the help file:

 

Transient removal

 

After acquiring your data, you may discover that you had a dodgy connection or a damaged sensor. In the case of poor connections, there could be transients (spikes/clicks) in the data.

A faulty wheel speed sensor is an example where transients may arise. If you wish to generate a distance channel from the data, then you will probably want to remove the transients prior to integrating.

This can be accomplished using the declick function.

 

declick('Wheel Speed', 10, 10)

 

The first parameter to this function indicates the data source to de-click. In this case it is the 'Wheel Speed' channel but it could also be a maths expression.

The second parameter identifies the threshold. This determines how much the sample value must change by since the last sample in order for it to be a candidate for removal. Provided the transient has two edges (both a rising edge and a falling edge, in any order) then it can be removed.

The third parameter limits the number of samples wide that the click may be before the algorithm rejects it as valid data. i.e. if the click is less wide than this value then it will be smoothed over.

 

The smoothing simply linearly interpolates between the good samples either side of the click.

 

Conditional error removal

 

To clean up latitude and longitude data, you can use a number of methods. Its useful if you have a GPS fix / GPS valid channel (which could always be generated using maths to restrict lat/lon to a sensible range). You can then use the declick_if function:

 

declick_if('Latitude Raw', bool('GPS Valid') == false)

 

This is essentially the same as declick, except that you are responsible for the click detection phase.

 

Filtering

 

Another option may be to filter your data. If you have a large DC offset you could use a high-pass filter. If you have lots of spikes or hight frequency noise then you could use a low-pass filter to remove them.

 

The filters in GEMS Data Analysis Pro are linear phase windowed sinc filters. These have a very steep cutoff frequency and also do not adjust the time coherence of data across the frequency range. GEMS Data Analysis Pro automatically removes any time delays that would normally be imposed by these filters.

Link to comment
Share on other sites

Hmm maybe not then. The rates you have look good for the 5Hz receiver. You need to ensure that you're transmitting and sampling at a minimum of double the rate of the data. I think that the zig-zag pattern may be a side effect of the latidude and longitude being sent separately (I'm assuming that they are sent in separate frames; it's been a while since I watched the webinar with the low level details of the way MoTeC uses the CAN frames). It's as if the longitude of one sample is being mixed with the latidude of the previous sample. I can't think of an easy way of getting around this at the moment.

Link to comment
Share on other sites

I think I have sorted it, what do you think of this Andy? The programme was reading data from when the car was stationary at the start of the session and again when it was stopped at the end. The Motec stuff seems clever enough to discard this, the GEMS logs and tries to map it somehow. As the GEMS data was for a whole session rather than a lap from a session, it was having some sort of hissy fit at the start and end. I have clipped the data to remove the stationary periods and it gives this now :) I think a bit of filtering and it's pretty as good as the Motec i2 data? I cannot thank you enough....

Link to comment
Share on other sites

I think a filter to only log GPS data once moving might work? And a slight smoothing filter. Once I get this all set up I will upgrade to a 20 Hz GPS, I have my eye on one that seems to be what Motec use, but without the fancy die cast casing :)

 

Both Motec and GEMS show some drift, usually in a certain direction, so it can look as if you are driving on the grass. You can see the drift as the thing "warms up" the car can be stationary and the numbers in Motec's "View Sensors" page for GPS coordinates slowly drift, then after about 10 minutes seem to pretty much stabilise.

 

It is accurate enough to be potentially quite embarrassing, I'm sure :) Yes, I think I was overtaking a car there, I was trying to get 135 up on the banking, but decided 132 was adequate, road cars can go awfully light and funny when committed to a bend properly over about 125. The Zeus was worry free at 148, that's downforce and low C of G for you.

Link to comment
Share on other sites

Can't thank Andy and Scott enough, this started as a quick question as to how to stitch two 16 bit channels of data together, and ended up looking like Carol Vorderman's nightmare after taking narcotics. I have learnt a lot, and admit OCD stepped in, but it works, and without you guys I'd looking at data in total spacial ignorance. Great work gentlemen, I salute and applaud you :)

Link to comment
Share on other sites

You're welcome Chris. Looking back, two things would have made this very simple:

 

1> If the high word was guaranteed to be signed and the low word guaranteed to be unsigned, the combine channel would be as simple as:

 

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

 

2> If the GDA software had a function that performed rounding towards zero for both positive and negative numbers (like the trunc() function in the C programming language), the rest of the calculation would be a simple as:

 

GPS LAT = (('GPS LAT COMBINE'-trunc('GPS LAT COMBINE'))/0.6)+trunc('GPS LAT COMBINE')

 

Much simpler! Maybe it's worth putting a request into GEMS!

Link to comment
Share on other sites

Funnily enough GEMS have just said this to me on their forum, I think they believe it is, or should be, possible just to use the combine16 function to combine the two 16 bit channels. I get the impression they feel it's a Motec / GEMS data transfer set up issue, but as it works I am am leaving well alone, although I will try changing the LW signing in the logger, and also may put the maths functions in the logger set up, which seems possible, rather than in the data reading software.

 

##############################

 

"Good to see its accurate now. Yes you should change the setup for unsigned. The CAN output info in Motec should have displayed this.

 

IF the data provided is correct, and there is no other scaling to do, then what Motec have said (which i believe was: "The GPS Lat and GPS Long are just split in 2, nothing more challenging that

that.") should apply, which means that using just the combine16 function with a divide by 10000000 should work.

 

For the other outstanding issues, i would again check your setup and the motec output."

 

#########################################

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.