Skip to content

Commit

Permalink
kamm circle
Browse files Browse the repository at this point in the history
  • Loading branch information
teasit committed Jan 14, 2024
1 parent 207bb38 commit 3bde821
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 28 deletions.
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/teasit/magic-formula-tyre-library)](https://github.com/teasit/magic-formula-tyre-library/releases/latest)
[![MATLAB Latest Tests Status](https://github.com/teasit/magic-formula-tyre-library/actions/workflows/test-matlab-r2023b.yml/badge.svg?branch=main)](https://github.com/teasit/magic-formula-tyre-library/actions/workflows/test-matlab-r2023b.yml)

![Fitting Example](doc/images/magic_formula_library_socialpreview.png)
![Social-Preview](doc/images/magic_formula_library_socialpreview.png)

```matlab
[FX,FY,MZ,MY,MX] = magicformula(params,__)
Expand Down Expand Up @@ -50,26 +50,27 @@ The data has been de-identified to conform with the FSAE TTC's
[license agreement](https://www.millikenresearch.com/FSAE_TTC_agreement.pdf).

```matlab
folder = 'doc/examples/fsae-ttc-data';
file = fullfile(folder, 'fsaettc_obfuscated.tir');
tyre = MagicFormulaTyre(file);
file = fullfile(folder, 'fsaettc_obscured_testbench_drivebrake.mat');
parser = tydex.parsers.FSAETTC_SI_ISO_Mat();
measurements = parser.run(file);
measurements = measurements([30 40 55 60 70 75]);
measurements = parser.run('doc/examples/ttc/drivebrake.mat');
tyre = MagicFormulaTyre('doc/examples/ttc/obfuscated.tir');
figure(); grid on; hold on
magicformula.plots.compareFxSX(tyre, measurements(2:5))
```

![Model vs. Data Plot](doc/images/magic_formula_library_socialpreview.png)

### Example: Friction Ellipse

Also known as the Kamm-Circle when approximating the tire friction limit as a circle when it actually is an ellipse.

```matlab
tyre = MagicFormulaTyre('doc/examples/ttc/obfuscated.tir');
figure(); grid on; hold on
c = colororder();
for i = 1:numel(measurements)
[SX,SA,FZ,IP,IA,VX,FX] = unpack(measurements(i));
FX_mdl = magicformula(tyre,SX,SA,FZ,IP,IA,VX);
plot(SX, FX_mdl, 'Color', c(i,:), 'LineWidth', 2)
plot(SX, FX, '.', 'Color', c(i,:), 'MarkerSize', 4)
end
xlabel('SX / 1'); ylabel('FX / N')
magicformula.plots.kamm(tyre)
```

![Kamm Plot](doc/images/kamm.png)

Further examples can be found in the [`doc/examples`](./doc/examples) folder.

## Motivation
Expand Down
Binary file modified doc/GettingStarted.mlx
Binary file not shown.
Binary file modified doc/examples/Example_Fitter_FSAETTC.mlx
Binary file not shown.
Binary file added doc/examples/Example_PlotKamm.mlx
Binary file not shown.
Binary file modified doc/examples/Example_PlotWithData.mlx
Binary file not shown.
Binary file added doc/images/kamm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/magic_formula_library_socialpreview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"/>
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
<Info location="kamm.m" type="File"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"/>
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="Example_PlotKamm.mlx" type="File"/>

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info />
<Info/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="test-matlab-r2023b.yml" type="File"/>

This file was deleted.

30 changes: 30 additions & 0 deletions src/+magicformula/+plots/kamm.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function kamm(tyre, options)
arguments
tyre MagicFormulaTyre
options.LimitsSX (1,2) = [-0.1 0.1]
options.LimitsSA (1,2) = [-pi/8 pi/8]
options.SweepLength {mustBeInteger} = 100
options.NumConstant {mustBeInteger} = 25
end

limits = options.LimitsSX;
stepsz = diff(limits)/options.NumConstant;
SX_sweep = linspace(limits(1), limits(2));
SX_const = limits(1):stepsz:limits(2);

limits = options.LimitsSA;
stepsz = diff(limits)/options.NumConstant;
SA_sweep = linspace(limits(1), limits(2));
SA_const = limits(1):stepsz:limits(2);

for i = 1:numel(SA_const)
[FX,FY] = magicformula(tyre,SX_sweep,SA_const(i));
plot(FY, FX, 'k-')
end
for i = 1:numel(SX_const)
[FX,FY] = magicformula(tyre,SX_const(i),SA_sweep);
plot(FY, FX, 'k-')
end
axis equal
xlabel('FY / N'); ylabel('FX / N')
end
4 changes: 2 additions & 2 deletions src/+tydex/+parsers/FSAETTC_SI_ISO_Mat.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
% Steady-state (bin) values are rounded to be more readable.
SteadyStateNumberOfDigits (1,1) double = 2
end
methods (Static)
methods (Static, Access = private)
function [newUnit,factor] = convertUnit(unit)
mustBeA(unit, 'char')
unit = strtrim(unit);
Expand Down Expand Up @@ -171,7 +171,7 @@
end
end
end
methods
methods (Access = private)
function [output,units,vars_SS] = preprocessInputData(obj, input)
mapping = obj.Mapping;
vars = fieldnames(mapping);
Expand Down

0 comments on commit 3bde821

Please sign in to comment.