Plot error using the tireData and tireModel features with a FSAE TTC files

Hi everyone,
I am writing to you here because I have several questions about the tiredata and tire model functions.
I can't plot the curves obtained in the examples :
When I load my file (.dat or .mat, FSAE TTC from Calspan), Matlab recognizes it well and loads the different values.
However, when I use this command for example
plot(tm,"Direction","alpha")
I have the followng error:
(Error using autoplot
All data sets removed due to unrecognized tire test type. Plotting function aborted.
Error in tireData/plot
Error in tireModel/plot)
The second question I have is about the values obtained.
When I import the same file with tireData (Matlab) or External File (Combined Slip Wheel 2DOF), I do not get the same values.
If you have any ideas, I thank you in advance.

17 Comments

Your first question:
If you are seeing that error, the plot function is not able to recognize the type of tire test maneuver is contained in the tireData objects.
Try using the "DataVariableNames" input argument to explicitly specify which data channels to plot.
Your second question:
Can you be more specific? Are you importing a TIR file, or a .MAT file? Which values do not match?
Thanks for your quick reply,
Ok thanks. Strange, because the files come directly from the site https://www.fsaettc.org/. I will try to display the channels with this input.
For the second, I import the .mat (Corner case), and the values like longitudinal and lateral stiffness don't match.
Maybe because of the tire Model ?
Thanks in advance
Tanguy,
It's possible that the TTC data may plot correctly without the additional input arguments if they are properly split. Check out the tireData split method. The generic plot is restricted to specific test manuevers and steady-state conditions.
In any event, using the additional input arguments provides much better control over what's being plotted.
I'd be curious to check your .mat file. Would be you willing to share the file?
Thanks,
Matt
Hello Matt,
Thanks for your feedback ! I'll try this then.
Yes, no problem, you will find it attached.
Thanks in advance,
Tanguy
Hi Tanguy,
I checked the attached .MAT file. It contains tire measurement data, not tire model parameter values. Therefore, it would not be compatible with the "Combined Slip Wheel 2DOF" Simulink tire block.
However, this is exactly the type of data to be supplied to a tireData object in MATLAB. I wrote an example script for some ideas of how you might import and treat this data. Unfortunately, the .MAT file is too large to include as an attachment, so this code won't run successfully in this reply. Attached is the livescript and a PDF so you can see the plots it generates.
This does not demonstrate all the capabilities of the tireData class, or any of the tireModel class. However, I hope this provides a jump start into using your data!
Matt
% load the data into the MATLAB workspace
matdata = load("B2356run17-Corner.mat");
% instantiate an empty tireData object
td = tireData;
% the Fz channel contains negative values, so this indicates the coordinate
% system is SAE. Change the coordinate system prior to moving the data into
% the tireData object. It can then be transformed to other coordinate
% systems (like ISO).
td = coordinateTransform(td,"SAE");
% move the measurement data into the tireData object
td.et = matdata.ET;
td.alpha = deg2rad(matdata.SA);
td.gamma = deg2rad(matdata.IA);
td.kappa = matdata.SL;
td.Fz = matdata.FZ;
td.Fy = matdata.FY;
td.Fx = matdata.FX;
td.Mz = matdata.MZ;
td.Mx = matdata.MX;
td.IP = matdata.P * 1000;
% and so forth for the remaining channels.
% some channels in the file do not have matching property values in the
% tireData object
% Be sure to check the units (matdata.channel.units) vs the tireData object
% property units and make the necessary conversions
% the source property indicates that this data was measured at Calspan
% If you happen to have the .dat files, you can import the data
% directly with a single command and not have to worry about coordinates
% and unit conversions.
% The Calspan .dat files are natively supported.
% https://www.mathworks.com/help/vdynblks/ug/tiredata.html
% If desired, transform to the ISO (z-up) coordinate system
td = coordinateTransform(td,"ISO");
% create a tiled layout plot of the varying steady-state channels
fig = figure;
tiledlayout(fig,3,1);
plot(td,"DataVariableNames",["et","Fz"],"Parent",nexttile)
plot(td,"DataVariableNames",["et","gamma"],"Parent",nexttile)
plot(td,"DataVariableNames",["et","IP"],"Parent",nexttile)
% this data contains varying Fz, IP, and gamma steady-state conditions.
% to split all the steady-state conditions into their own tireData objects,
% use the split method to split the data using the Fz, IP, gamma channels
% as the split criteria
td = split(td,["Fz","gamma","IP"]);
% Since Fz, gamma, and IP are steady-state channels, you can use the mean
% method to flatten those channels to their mean values for each tireData
% object. This is a matter of preference
td = mean(td,["Fz","gamma","IP"]);
% Replot those channels to see the effect
fig = figure;
tiledlayout(fig,3,1);
plot(td,"DataVariableNames",["et","Fz"],"Parent",nexttile)
plot(td,"DataVariableNames",["et","gamma"],"Parent",nexttile)
plot(td,"DataVariableNames",["et","IP"],"Parent",nexttile)
% Plot the tireData array without any other input arguments.
% The plot method recognizes the data type and creates common plot for that
% data type at all the steady-state conditions
plot(td)
% If you desire, you can filter the channels to remove some of the
% measurement noise
td = filter(td,"channels",["Fy","Mz","Mx"],"F",3,"Fs",100);
% Replot the data to see the effect of the filter
plot(td)
% For more control over what is being plotted, supply additional input
% argument to the plot method.
plot(td,"DataVariableNames",["alpha","Fx"],"ColorBy","Fz")
% You can use this data, and other measurement data sets, to fit a new tire
% model. Follow the example shown here:
% https://www.mathworks.com/help/vdynblks/ug/fit-tire-model.html
Hi Matt,
Thanks for your feedback and your example!
This allows me to better understand the use of the TireData class that I am starting to learn.
Following the example https://fr.mathworks.com/help/vdynblks/ug/fit-tire-model.html, I have an error when I try to display my data and that of the model:
Index exceeds array bounds.
Error in tireData/summaryTable
Error in tireModel/fit>dataChecks
Error in tireModel/fit
I think the problem comes from the fit between the model and the data, but I don't really see where it can come from.
Thanks in advance,
Tanguy
Tanguy,
Can you share the command history leading to the error? I am unable to reproduce this.
I am able to fit the "Fy Pure" fit type, and others, using the data you provided.
Matt
Hello Matt,
Thanks for your feedback!
I followed the example on the page you pointed me to, namely: https://fr.mathworks.com/help/vdynblks/ug/fit-tire-model.html
tm = tireModel.new("MF");
tm.Name = "New Fitted Model";
lateral_data = td([td.TestMethod] == "Lateral");
[tm, diffTable] = fit(tm,lateral_data,"Fy Pure",PlotFit=true);
But apparently, I don't get the same result as you, because my "lateral_data" is empty.
I was also wondering if it is possible to import multiple .dat files?
I took your example, and tried with the corresponding .dat file (corner case), and it works fine!
I wonder if it is possible to import 2 files (corner and brake) in the tireData.import function.
Thanks in advance,
Tanguy
Tanguy,
Ah, yes. I'm sorry for the confusion! "TestMethod" is a property of the tireData objects, and in that particular example, it's used to index into the large tireData array to differentiate between the cornering, braking, and combined slip data sets. The Tydex data files that ship with that example have a "TESTMETH" constant value which gets imported. Unless you would assign the value in your data, it would be empty and would not work like the example shows.
To see all the example data, run this command:
openExample('vdynblks/FitATireModelToTireDataExample')
It will change your active MATLAB directory and you'll find a folder called "data_tydex_files". More information about these files is in step 2 of the getting started:
For your other question: Yes, you absolutely can import more than one file at a time. You simply provide a string array of the file paths to the import function. Each file's data will be imported into it's own object. So, if you provide a string array of size 4x1 for four files, a tireData object of size 4x1 will return.
You may also decide to import all the cornering data to it's own variable, and all the braking data to it's own variable, etc.
corneringData = tireData.import("cornering.dat")
brakingData = tireData.import("braking.dat")
Doing it this way may be easier to stay organized for feeding these tireData objects to the tireModel.fit method, or for creating various plots.
Hope this helps!
Matt
Thanks for your answer Matt!
It is indeed clearer for the two .dat files to import, thank you.
I also studied the example you mentioned, and I understand better why my "lateral_data" was empty, thank you!
However, I tried to plot the MF model based on the tire data with the formula :
plot(td,"Model",tm)
I get this result:
I can't match the model behavior with my Normal Force.
And, when I try with "Fy Pure",
fit(tm,td,"Fy Pure",PlotFit=true);
I have several warnings, and a code that runs for a very very long time.
I can't get your Fy Pure mentioned above,
Thanks in advance,
Tanguy
Tanguy,
Is the "tm" variable the default MF6.2 tire model, as returned by tm = tireModel.new("MF62") ?
If so, it's not a surprise it would not match the data.
To "fit" the tire model to your data, use the tireModel.fit method as you showed. For example:
tm = fit(tm, td, "Fy Pure", "PlotFit", true)
This will run optimization to fit the model parameters to match in the data, which does take a while to run. You can adjust the optimization solver settings using the "solver" and "optimoptions" input arguments to reduce the processing time, while balancing optimization error results.
There are several other options for customizing the fit behavior. See the fit doc page:
I imagine you might be seeing warnings about tire dimensions not matching between the model and data, or perhaps the measurement data exceeding the model limits?
You will want to consider assigning some parameters first, like:
  • FNOMIN
  • NOMPRES
  • INFLPRES
As well as the Limits (ALPMAX, ALPMIN, etc) and Dimensions (UNLOADED_RADIUS, WIDTH, etc) parameters. You can try using the "Limits" and "Dimensions" fit types if the data has all the required information, or assign those values manually:
tm.UNLOADED_RADIUS = 0.255 (use the value that applies to your tire)
I hope this helps!
Matt
Hello Matt, thanks for your feedback!
I have indeed managed to get my data curves based on the model, with the command: tm = fit(tm, td, "Fy Pure", "PlotFit", true), thanks a lot ! However, I still have the following warnings :
I also had a question about the model and exporting.
If I export this "tm" tire model, I suppose it will not take into account the longitudinal data.
So, if I want to import my .tir file into the Combined Slip Wheel 2DOF blockset of the GenerateSkidPad example, my tire model will not be complete because I have not taken into account my Brake.mat file?
Thanks in advance
Tanguy,
Those warnings are just that: warnings to alert you about something the fit method encountered that it wants you to be aware of. The fit is likely just fine, and you can verify visually in the plots or by the error calculations that can be returned from the fit method.
For the first warning: I can't help without knowing all the exact tireData you supplied to the fit method. Is it possible that you included longitudinal sweep data? Or were some of the data at steady-state conditions? The Fy Pure fit type expects slip angle sweep data and will alert you if it sees slip angle as a constant value. If the data is steady-state conditions, then it's likely okay and the warning can be ignored (as long as there are adequate steady-state slip angles included).
The last three warnings are fairly trivial; the fit method just wants you to know that some channels necessary for the tire model computations are empty and it will assume certain values. If you'd like, you can manually fill those tireData properties with known values.
As for your second question: when you instantiated the tire model using tireModel.new("MF62"), you instantiated a complete MF6.2 tire model. Therefore, any parameters that you do not manually revise or optimize using the fit method will remain at the default parameter values. In that sense, the tire model is "complete", but it may not adequately represent the tire if it's not fit completely. Depending on your use case, this may be perfectly fine. It will import into the VDBS block and run fine.
By the way, if you're moving tire model parameters in and out of VDBS blocks often, you might consider using the tireModel.set and tireModel.get methods so you don't have to export and import the TIR files.
I hope this helps! Thanks,
Matt
Thanks for the detailed answer.
For the warnings, I used the .mat file that I sent you (Corner).
Thanks for the details with the .set and .get, I will use that!
For the tire model, I want to use it to simulate the behavior of our car, on the skidPad model for example.
From what I understand, if I want to make the tire model more accurate, I have to repeat the process with the longi data, and then fit in Fx Pure for example?
Thanks in advance
I noticed the warning includes index values up to 188. This is far more than the number of tireData objects I created from the example corner .mat file. How did you split your tire data?
Yes, you'll want to continue the fitting for other parameter sets. Using the same cornering data, you could fit "Mz Pure" and "Mx". If you have pure longitudinal data, you can fit "Fx Pure" and others. If you have combined data, you can fit even more.
Review the fit doc page for recommended order in fitting and recommended data sets for each fit type:
I used the two attached files.
I also put the live script file.
Thanks for the advice for the fit, I will try all that.
I also had a question about the tire dimensions.
Using "tm.TireSize" and then doing, [tm, diffTable] = fit(tm, td, "Dimensions"), I have the following warning:
Warning: Unable to set parameter(s) 'UNLOADED_RADIUS', 'WIDTH', 'ASPECT_RATIO', 'RIM_RADIUS', 'RIM_WIDTH'. Input tire data array does not contain any non-empty values.
Thanks in advance,
Tanguy
Tanguy,
Those tire model parameters are not determined by the "TireSize" property, but by the following properties:
UNLOADED_RADIUS = OverallDiameter / 2
WIDTH = SectionWidth / 1000
ASPECT_RATIO = AspectRatio / 100
RIM_RADIUS = RimDiameter / 2 * 0.0254
RIM_WIDTH = RimWidth * 0.0254
You can find this in the fit doc page, under "FitType" argument.
Hope this helps!
Matt

Sign in to comment.

Answers (1)

Many good tidbits are in the comment history! To summarize a few:
Plotting Tire Models
Try using the "DataVariableNames" input argument to explicitly specify which data channels to plot.
Importing FSAE Data
Tire measurement data can be imported from a .MAT file by first loading the data variables and then assigning to a tireData object. Be sure to pay attention to units and coordinate systems!
% load the data into the MATLAB workspace
matdata = load("B2356run17-Corner.mat");
% instantiate an empty tireData object
td = tireData;
% the Fz channel contains negative values, so this indicates the coordinate
% system is SAE. Change the coordinate system prior to moving the data into
% the tireData object. It can then be transformed to other coordinate
% systems (like ISO).
td = coordinateTransform(td,"SAE");
% move the measurement data into the tireData object
td.et = matdata.ET;
td.alpha = deg2rad(matdata.SA);
td.gamma = deg2rad(matdata.IA);
Better yet, if you have the Calspan .DAT files, they are natively supported! Import them directly!
Interacting with VDBS Simulink Blocks
If you're moving tire model parameters in and out of VDBS blocks often, you might consider using the tireModel.set and tireModel.get methods so you don't have to export and import the TIR files.
Want to fit a tire model but don't have measurement data?
Run this command and you'll have access to example measurement data!
openExample('vdynblks/FitATireModelToTireDataExample')

Categories

Products

Release

R2024b

Asked:

on 28 Oct 2024

Answered:

on 10 Dec 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!