PDA

View Full Version : Matlab Question



JT A.
12-22-2011, 07:56 PM
I would like to know if there is a fast way to make Matlab to find a section of raw data from our TTC files (a sweep of slip ratios at a given load & camber angle), then "average out" the hysteresis & asymmetry in the raw data. Basically I want it to create a Fy vs SA curve fit that intersects 0 at 0 slip angle, the curve above & below 0 slip angle is symmetric, and the curve fits an average of the "up-sweep" and "down-sweep" of the Fy values.

I'm doing this to create an MRA non-dimensional tire model. My current method has been very inefficient and slow. I've basically been going into the raw data file, manually finding the section of data I want, telling Matlab which cells to import, splitting the positive and negative SA data into 2 variables, curve fitting each section, averaging the positive SA and negative SA curves, and curve fitting that average until it looks the way I want it to. I am horrible at matlab so I know there has to be a better way than this. If anybody can help it would be greatly appreciated, and I would be glad to share my completed code when finished.

JT A.
12-22-2011, 08:55 PM
To make it more clear what I am looking for...

Can I import the whole raw data file into Matlab as a matrix, then make it search for the segment of data that meets some user-specified criteria (ie: load = 350 +/- 10, camber = 0 +/- .1, slip angle between -12 and 12). Then save that segment of data as a separate matrix that I can work with more easily.

From that point, is there another function that can make the plot symmetric about (0,0), and make a curve fit of the new points?

Adambomb
12-22-2011, 09:43 PM
Have you considered just using the Pacejka model that comes with the TTC data? If you want to work in Matlab that sounds like it would be by far easier. It even comes with scripts to do the exact lookups you're talking about, and you don't even need to do any fitting. I've never messed directly with the raw data myself, but I hear it can be pretty messy.

woodsy96
12-22-2011, 09:47 PM
Look at the data and find the range you want to look at (in numbers, i.e. rows of the matrix between 10500 and 17500). Then use the fit command to fit the plot. This will average out the hysteresis for an increasing and decreasing sweep.

Why do you want the fit to intersect (0,0), and why does it need to be symmetric? From memory the Goodyear tyres at least aren't symmetric, so I wouldn't model them to be symmetric. And most of your operating conditions (hopefully) will be at some negative camber, inducing a y axis offset?

I agree with Adambomb: use the existing Pajecka or MRA models.

BillCobb
12-23-2011, 08:01 AM
You can use slip velocity as a differentiator of sweep data (pun intended). Also, I posted a method to remove the hysteresis using the cross correlation function on the TTC forum. The hysteresis value is an important tire property if you plan to use the tire data in a sim model with a driver controller.

You can fit a spline function to the data and sample it at slip values you prescribe.

Averaging the hysteresis data gives you the wrong answer, though. Tires don't work that way.

exFSAE
12-23-2011, 06:15 PM
Originally posted by BillCobb:
You can use slip velocity as a differentiator of sweep data (pun intended). Also, I posted a method to remove the hysteresis using the cross correlation function on the TTC forum. The hysteresis value is an important tire property if you plan to use the tire data in a sim model with a driver controller.

You can fit a spline function to the data and sample it at slip values you prescribe.

Averaging the hysteresis data gives you the wrong answer, though. Tires don't work that way.

"Wrong" is a bit harsh of a word. Just as "wrong" as a bicycle vehicle model or using a tire model with the exact grip and response values as seen on a flat track.

At the FSAE level I think it best to keep things simple. The fundamentals are generally misunderstood by many, probably better to focus there than chase secondary effects.

For that matter... doing tire data fitting "in house" at this level is just duplicating work that's already been done for you. I would argue it is not the best use of time.

ben
12-27-2011, 01:48 PM
Originally posted by BillCobb:
You can use slip velocity as a differentiator of sweep data (pun intended). Also, I posted a method to remove the hysteresis using the cross correlation function on the TTC forum. The hysteresis value is an important tire property if you plan to use the tire data in a sim model with a driver controller.

You can fit a spline function to the data and sample it at slip values you prescribe.

Averaging the hysteresis data gives you the wrong answer, though. Tires don't work that way.

Sorry Bill, I'm gonna call you on this as exFSAE has.

You are right to say that "tyres don't work that way" but if you want to be like that you can just as easily say "tyres don't work like a Pacejka model, so don't bother at all" particularly of you use a reduced version of Pacejka that you've done here in the past.

I'll invoke Box - "all models are wrong, some models are useful"

Ben

Goost
12-27-2011, 03:41 PM
Without just giving you a direct answer - I have put quite some time into pretty much just what you're trying - I think I can put you on the right track with one line of code:

>> help delaunay

Welcome to big boy MATLAB, haha. Otherwise it's pretty much simple matrix manipulation and curve fitting they teach in COMP 101 to get a model like you want. Newer versions of MATLAB have a curve/surface fitting toolbox that may cut out the middle man if you want something fast but not quite as good.

Also, I'm with woodsy96 about symmetry - there are shift components in Pacejka for a reason.

Send me a PM if you have more specific questions.

BillCobb
12-27-2011, 06:05 PM
You are right to say that "tyres don't work that way" but if you want to be like that you can just as easily say "tyres don't work like a Pacejka model, so don't bother at all" particularly of you use a reduced version of Pacejka that you've done here in the past.

I'll invoke Box - "all models are wrong, some models are useful"

Ben

Project Manager GT Development - Dunlop Motorsport
Alumnus of University of Birmingham
www.ubracing.co.uk (http://www.ubracing.co.uk) and Formula Student Design Judge

OK fine, I accept the change. But, why then average the data? Just feed both + and - slip rate data to the Solvers and let it do the fitting job unabridged? All I was getting at was the use of + sliprate data reduces the dataset size included in the fitting process and the hysteresis value gives you a relaxation approximation. I include Pacejka model options in all my Vehicle Dyanamic sims, even including a 4 term LapSim version which I highly recommend as a first cut.

The solution is much more satisfactory if you fit the data without hysteresis: either remove it or choose the side of the data that's most meaningful to your vehicle program. If Pacejka is your model, then make sure you weight the fitting algorithm to optimize for limit handling fidelity. Otherwise you get a compromised fit which when used in an open or closed loop vehicle simulation may give the wrong readings because the tire comparisons will be out of resolution. You're not going to get all your tires operating at the peak slip, but probably only at the highest curvature region.

If this were a class of high school students learning Matlab I'd be much more gentle. If you are a graduate student in this subject, you just flunked. Probably a good thing I turned down those graduate class asst. professorships, eh?

Crispy
12-27-2011, 08:24 PM
For cornering test, the "ASCII Mixed" data sets have come "SA'd", which is Calspan's hysteresis removal procedure. The "TIRF-SA_procedure" document comes with the data and describes how this is accomplished and what the resulting data looks like.

If you use the non "SA'd" data, make sure you take into account that there is more data in one slip direction than the other (two zero crossings in one direction, only one in the other). If you don't, your fit will not be centered on the loop.

I agree with the others, it is most likely not the best use of your time to fit your own models. Unless of course your goal is to learn how to fit tire models...

JT A.
12-31-2011, 12:56 PM
Thanks for all the help everybody.

Based on the input from this thread, the solution I have come to is:

Use the Calspans hysteresis-corrected data.

Directly curve fit this data, rather than trying to "pre-process" it to make it symmetric & intersect 0.

Split up chunks of the raw data file into separate excel sheets to make it easier to deal with.

This has sped up the process to an acceptable level. I wish I could find all these already made programs that supposedly come with the data. The only ones I can find are from round 3 and the source code is inaccessible.

woodsy96
12-31-2011, 11:37 PM
The tyre data definetely come with the codes you are after. The files you are looking for all called call_mrandim.m (the example file of how to call expand_mrandim) and expand_mrandim.p (?) (which has all of the magic inside it), and a .mat file like Goodyear 20x6.5-13.mat. You can't open the second file, it is proprietry code of Millken research associates- but you can use it's call functions.

However, from memory there was somthing a bit funky with the files from the 3rd round of testing and some of the MRA models didn't work/ did funky things.

All of this is covered in the supporting documents with the files though- and probably on the Tyre Testing Consortium forum as well.

Edward M. Kasprzak
01-02-2012, 06:49 AM
However, from memory there was somthing a bit funky with the files from the 3rd round of testing and some of the MRA models didn't work/ did funky things.

There was a bug in the aligning torque model. To our knowledge, everything else worked well.