Skip to content

Commit

Permalink
publish release v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
teasit committed Jun 15, 2022
1 parent 4223d3b commit 37a2713
Show file tree
Hide file tree
Showing 77 changed files with 515 additions and 508 deletions.
Binary file modified +tests/BasicTests.mlx
Binary file not shown.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Changelog

- Renaming of library and functions due to trademark issues
- Added example measurement data (de-identified and obscured TTC data)
- Updated FSAE TTC interactive example to use new data
- Updated unit tests
- Convenience changes:
- New: Wrapper for `mftyre.v62.eval()` function. Can now call method `eval()` on `mftyre.v62.Model` objects. Example:
- New: Wrapper for `magicformula.v62.eval()` function. Can now call method `eval()` on `magicformula.v62.Model` objects. Example:

```matlab
model = mftyre.v62.Model();
model = magicformula.v62.Model();
model.importTyrePropertiesFile(file)
[FX, FY] = model.eval(SA, SX, IA, IP, FZ, 0);
```

- New: Can now instantiate `mftyre.v62.Model` directly with TIR file, without having to call `importTyrePropertiesFile()` method. Example:
- New: Can now instantiate `magicformula.v62.Model` directly with TIR file, without having to call `importTyrePropertiesFile()` method. Example:

```matlab
model = mftyre.v62.Model(file);
model = magicformula.v62.Model(file);
[FX, FY] = model.eval(SA, SX, IA, IP, FZ, 0);
```
File renamed without changes.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# MF-Tyre MATLAB Library
# Magic Formula Tyre Library

[![View MFTyreLibrary on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://de.mathworks.com/matlabcentral/fileexchange/110955-mftyrelibrary)
[![View on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://de.mathworks.com/matlabcentral/fileexchange/110955-mftyrelibrary)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/teasit/mftyre-matlab-library)](https://github.com/teasit/mftyre-matlab-library/releases/latest)

![Social Preview Image](./doc/images/tyre_icon_socialpreview.png)

```matlab
[Fx,Fy] = mftyre.v62.eval(p,slipangl,longslip,inclangl,inflpres,FZW,tyreSide)
[Fx,Fy] = magicformula.v62.eval(p,slipangl,longslip,inclangl,inflpres,FZW,tyreSide)
```

- Computationally efficient MF-Tyre functions
Expand All @@ -15,7 +15,7 @@
- TIR import/export (Tyre Property File format)
- TYDEX import (Tyre Data Exchange format)

![MF-Tyre Fitting Example](doc/images/mftyrelib_fit_example.png)
![Fitting Example](doc/images/mftyrelib_fit_example.png)

## Requirements

Expand Down
15 changes: 8 additions & 7 deletions MFTyreLibraryToolboxPackager.prj → ToolboxPackager.prj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<deployment-project plugin="plugin.toolbox" plugin-version="1.0">
<configuration build-checksum="2363634414" file="C:\Users\Tom\Documents\mftyre-tool-matlab\src\mftyre-matlab-library\MFTyreLibraryToolboxPackager.prj" location="C:\Users\Tom\Documents\mftyre-tool-matlab\src\mftyre-matlab-library" name="MFTyreLibraryToolboxPackager" target="target.toolbox" target-name="Package Toolbox">
<param.appname>MFTyreLibrary</param.appname>
<configuration build-checksum="502682855" file="C:\Users\Tom\Documents\mftyre-tool-matlab\src\mftyre-matlab-library\ToolboxPackager.prj" location="C:\Users\Tom\Documents\mftyre-tool-matlab\src\mftyre-matlab-library" name="ToolboxPackager" target="target.toolbox" target-name="Package Toolbox">
<param.appname>MagicFormulaTyreLibrary</param.appname>
<param.authnamewatermark>Tom Teasdale</param.authnamewatermark>
<param.email>[email protected]</param.email>
<param.company />
<param.summary>Create and evaluate Magic Formula tyre models suitable for code generation in MATLAB.</param.summary>
<param.summary>MATLAB library for Magic Formula Tyre Modeling</param.summary>
<param.description />
<param.screenshot>${PROJECT_ROOT}\doc\images\MFTyreLibrary_PackageImage.png</param.screenshot>
<param.version>1.1.0</param.version>
<param.output>${PROJECT_ROOT}\MFTyreLibrary.mltbx</param.output>
<param.version>1.1.1</param.version>
<param.output>${PROJECT_ROOT}\MagicFormulaTyreLibrary.mltbx</param.output>
<param.products.name />
<param.products.id />
<param.products.version />
Expand Down Expand Up @@ -51,7 +51,7 @@ tools/</param.exclude.filters>
<param.getting.started.guide>${PROJECT_ROOT}\doc\GettingStarted.mlx</param.getting.started.guide>
<param.matlabpath.excludes />
<param.javaclasspath.excludes />
<param.exported.on.package>true</param.exported.on.package>
<param.exported.on.package>false</param.exported.on.package>
<param.required.addons>
<requiredaddons />
</param.required.addons>
Expand Down Expand Up @@ -88,6 +88,7 @@ tools/</param.exclude.filters>
<param.docs />
<param.matlabpath.excludes />
<param.javaclasspath.excludes />
<param.exported.on.package />
<param.matlab.project.id />
<param.matlab.project.name />
<param.release.current.only />
Expand Down Expand Up @@ -115,7 +116,7 @@ tools/</param.exclude.filters>
<fileset.depfun.excluded />
<fileset.package />
<build-deliverables>
<file location="${PROJECT_ROOT}" name="MFTyreLibrary.mltbx" optional="false">C:\Users\Tom\Documents\mftyre-tool-matlab\src\mftyre-matlab-library\MFTyreLibrary.mltbx</file>
<file location="${PROJECT_ROOT}" name="MagicFormulaTyreLibrary.mltbx" optional="false">C:\Users\Tom\Documents\mftyre-tool-matlab\src\mftyre-matlab-library\MagicFormulaTyreLibrary.mltbx</file>
</build-deliverables>
<workflow />
<matlab>
Expand Down
Binary file modified doc/GettingStarted.mlx
Binary file not shown.
Binary file added doc/examples/Example_Fitter_FSAETTC.mlx
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info location="+magicformula" type="File" />

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

2 changes: 1 addition & 1 deletion resources/project/root/GiiBklLgTxteCEmomM8RCvWT0nQd.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<Info Name="MF-Tyre MATLAB Library" />
<Info Name="Magic Formula Tyre Library" />
2 changes: 1 addition & 1 deletion src/+exceptions/EmptyMeasurement.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classdef EmptyMeasurement < MException
methods
function obj = EmptyMeasurement()
errId = 'MFTyreLibrary:EmptyMeasurement';
errId = 'MagicFormulaTyreLibrary:EmptyMeasurement';
msgtext = sprintf('Error due to empty measurement.');
obj@MException(errId, msgtext)
end
Expand Down
2 changes: 1 addition & 1 deletion src/+exceptions/FitterFailed.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
arguments
fitmode char
end
errId = 'MFTyreLibrary:FitterFailed';
errId = 'MagicFormulaTyreLibrary:FitterFailed';
msgtext = sprintf('Fitter failed to solve fit-mode "%s".', fitmode);
obj@MException(errId, msgtext)
end
Expand Down
2 changes: 1 addition & 1 deletion src/+exceptions/NoMeasurementForFitMode.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
arguments
fitmode char
end
errId = 'MFTyreLibrary:NoMeasurementForFitMode';
errId = 'MagicFormulaTyreLibrary:NoMeasurementForFitMode';
msgtext = sprintf(...
'Measurement has no data for fit-mode "%s".', fitmode);
obj@MException(errId, msgtext)
Expand Down
2 changes: 1 addition & 1 deletion src/+exceptions/UnknownModelParameter.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
arguments
name char
end
errId = 'MFTyreLibrary:UnknownModelParameter';
errId = 'MagicFormulaTyreLibrary:UnknownModelParameter';
msgtext = sprintf('Unknown parameter name "%s".', name);
obj@MException(errId, msgtext)
obj.ParameterName = name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [Fx,mux,Gxa,Bxa,Exa] = Fx(p,slipangl,longslip,inclangl,pressure,Fz)
[Fx0,mux] = mftyre.v62.equations.Fx0(p,longslip,inclangl,pressure,Fz);
[Fx0,mux] = magicformula.v62.equations.Fx0(p,longslip,inclangl,pressure,Fz);

% (4.E1)
FNOMIN = p.FNOMIN.*p.LFZO;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [Fy,muy,Gyk,Byk,Eyk] = Fy(p,slipangl,longslip,inclangl,pressure,Fz)
[Fy0,muy,dfz] = mftyre.v62.equations.Fy0(p,slipangl,inclangl,pressure,Fz);
[Fy0,muy,dfz] = magicformula.v62.equations.Fy0(p,slipangl,inclangl,pressure,Fz);

% (4.E4)
camberspin = sin(inclangl);
Expand Down
File renamed without changes.
File renamed without changes.
71 changes: 36 additions & 35 deletions src/+mftyre/+v62/Fitter.m → src/+magicformula/+v62/Fitter.m
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
classdef Fitter < handle
%MFTYRE.V62.FITTER Fits MF-Tyre models to measurement data.
%FITTER Fits Magic Formula tyre models to measurement data.

properties
%Set the measurements to be used for fitting.
Measurements tydex.Measurement

%Set the initial parameter to be used for fitting.
Parameters mftyre.v62.Parameters
Parameters magicformula.v62.Parameters

%Set the Fit-Modes to execute when using run() method.
FitModes mftyre.v62.FitMode
FitModes magicformula.v62.FitMode

%Solver options. Set max iterations, function evaluations etc.
Options optim.options.SolverOptions = optimoptions('fmincon', ...
'Display', 'iter-detailed')
end
properties (SetAccess = protected)
%Fitted parameter values, updated after each Fit-Mode solve.
ParametersFitted mftyre.v62.Parameters
ParametersFitted magicformula.v62.Parameters

%Input fitmode name, map will return index array for measurements.
FitModeFlags containers.Map
Expand All @@ -26,7 +27,7 @@
%In case the "OutputFcn" property in the Fitter options is used,
%the user can make use of the ActiveFitMode property to print the
%current equation being fitted, for example.
ActiveFitMode mftyre.v62.FitMode
ActiveFitMode magicformula.v62.FitMode
end
properties (Access = private)
end
Expand All @@ -47,9 +48,9 @@
methods
function run(fitter)
%RUN Fits all modes specified in "FitModes" property.
import mftyre.v62.FitMode
import magicformula.v62.FitMode
warning('off', 'MATLAB:nearlySingularMatrix')
fprintf('Starting MF-Tyre fitter...\n')
fprintf('Starting fitter...\n')
fitmodes = fitter.FitModes;
fitter.ParametersFitted = fitter.Parameters;
for i = 1:numel(fitmodes)
Expand All @@ -73,7 +74,7 @@ function run(fitter)
function fitter = Fitter(measurements, parameters)
arguments
measurements tydex.Measurement = tydex.Measurement.empty
parameters mftyre.v62.Parameters = mftyre.v62.Parameters.empty
parameters magicformula.v62.Parameters = magicformula.v62.Parameters.empty
end
fitter.Measurements = measurements;
fitter.Parameters = parameters;
Expand All @@ -83,10 +84,10 @@ function run(fitter)
function x = solve(fitter,fitmode)
%SOLVE Fit model only for one fitmode.
arguments
fitter mftyre.v62.Fitter
fitmode mftyre.v62.FitMode
fitter magicformula.v62.Fitter
fitmode magicformula.v62.FitMode
end
import('mftyre.v62.FitMode')
import('magicformula.v62.FitMode')
fitter.ActiveFitMode = fitmode;

measurements = fitter.Measurements;
Expand Down Expand Up @@ -142,7 +143,7 @@ function qualifyMeasurements(fitter)

numMeas = numel(measurements);

modes = enumeration(mftyre.v62.FitMode.Fy0);
modes = enumeration(magicformula.v62.FitMode.Fy0);
keys = cell(numel(modes),1);
for i = 1:numel(modes)
keys{i} = char(modes(i));
Expand All @@ -156,7 +157,7 @@ function qualifyMeasurements(fitter)
I = strcmp({const.Name},'SLIPANGL');
idx(i) = any(I) && abs(const(I).Value) <= deg2rad(0.3);
end
key = find(strcmp(keys,char(mftyre.v62.FitMode.Fx0)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.Fx0)),1);
vals{key} = find(idx);

% Fy0 + Mz0
Expand All @@ -166,9 +167,9 @@ function qualifyMeasurements(fitter)
I = strcmp({const.Name},'LONGSLIP');
idx(i) = any(I) && abs(const(I).Value) <= 0.005;
end
key = find(strcmp(keys,char(mftyre.v62.FitMode.Fy0)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.Fy0)),1);
vals{key} = find(idx);
key = find(strcmp(keys,char(mftyre.v62.FitMode.Mz0)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.Mz0)),1);
vals{key} = find(idx);

% Mz + Fx + Fy + Fz + Mx + My (Combined Slip)
Expand All @@ -180,17 +181,17 @@ function qualifyMeasurements(fitter)
idx(i) = ~(any(I1) && const(I1).Value == 0) ...
|| (any(I2) && const(I2).Value == 0);
end
key = find(strcmp(keys,char(mftyre.v62.FitMode.Mz)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.Mz)),1);
vals{key} = find(idx);
key = find(strcmp(keys,char(mftyre.v62.FitMode.Fx)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.Fx)),1);
vals{key} = find(idx);
key = find(strcmp(keys,char(mftyre.v62.FitMode.Fy)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.Fy)),1);
vals{key} = find(idx);
key = find(strcmp(keys,char(mftyre.v62.FitMode.Mx)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.Mx)),1);
vals{key} = find(idx);
key = find(strcmp(keys,char(mftyre.v62.FitMode.My)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.My)),1);
vals{key} = find(idx);
key = find(strcmp(keys,char(mftyre.v62.FitMode.Fz)),1);
key = find(strcmp(keys,char(magicformula.v62.FitMode.Fz)),1);
vals{key} = find(idx);

fitModeFlagsMap = containers.Map(keys,vals);
Expand All @@ -202,16 +203,16 @@ function qualifyMeasurements(fitter)
%COSTFUN Summed squares cost function for fmincon solver.
arguments
x double
params mftyre.v62.Parameters
params magicformula.v62.Parameters
mfinputs double
testdata double
fitmode mftyre.v62.FitMode
fitmode magicformula.v62.FitMode
end
import('mftyre.v62.FitMode')
import('mftyre.v62.equations.Fx0')
import('mftyre.v62.equations.Fy0')
import('mftyre.v62.equations.Fx')
import('mftyre.v62.equations.Fy')
import('magicformula.v62.FitMode')
import('magicformula.v62.equations.Fx0')
import('magicformula.v62.equations.Fy0')
import('magicformula.v62.equations.Fx')
import('magicformula.v62.equations.Fy')

params = appendFitted(params,x,fitmode);
params = struct(params);
Expand Down Expand Up @@ -260,12 +261,12 @@ function qualifyMeasurements(fitter)
%CONSTRAINTS Constraints for fmincon solver.
arguments
x double
params mftyre.v62.Parameters
fitmode mftyre.v62.FitMode
params magicformula.v62.Parameters
fitmode magicformula.v62.FitMode
mfinputs double
end
c = []; ceq = [];
import('mftyre.v62.FitMode')
import('magicformula.v62.FitMode')
params = appendFitted(params,x,fitmode);
params = struct(params);
longslip = mfinputs(:,2);
Expand All @@ -275,19 +276,19 @@ function qualifyMeasurements(fitter)
Fz = mfinputs(:,1);
switch fitmode
case FitMode.Fx0
[~,~,Cx,Dx,Ex] = mftyre.v62.equations.Fx0(params,...
[~,~,Cx,Dx,Ex] = magicformula.v62.equations.Fx0(params,...
longslip,inclangl,pressure,Fz);
c = [-Cx+eps;-Dx+eps;Ex-1];
case FitMode.Fy0
[~,~,~,Cy,Ey] = mftyre.v62.equations.Fy0(params,...
[~,~,~,Cy,Ey] = magicformula.v62.equations.Fy0(params,...
slipangl,inclangl,pressure,Fz);
c = [-Cy+eps;Ey-1];
case FitMode.Fx
[~,~,Gxa,Bxa,Exa] = mftyre.v62.equations.Fx(params,...
[~,~,Gxa,Bxa,Exa] = magicformula.v62.equations.Fx(params,...
slipangl,longslip,inclangl,pressure,Fz);
c = [-Gxa+eps;-Bxa+eps;Exa-1];
case FitMode.Fy
[~,~,Gyk,Byk,Eyk] = mftyre.v62.equations.Fy(params,...
[~,~,Gyk,Byk,Eyk] = magicformula.v62.equations.Fy(params,...
slipangl,longslip,inclangl,pressure,Fz);
c = [-Gyk+eps;-Byk+eps;Eyk-1];
case FitMode.Mz0
Expand Down
6 changes: 3 additions & 3 deletions src/+mftyre/+v62/Model.m → src/+magicformula/+v62/Model.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
classdef Model < mftyre.Model
classdef Model < magicformula.Model
properties
Parameters mftyre.v62.Parameters = mftyre.v62.Parameters()
Parameters magicformula.v62.Parameters = magicformula.v62.Parameters()
Description string
File char
Version
Expand Down Expand Up @@ -34,7 +34,7 @@
function [Fx,Fy,mux,muy] = eval(mdl,slipangl,longslip,inclangl,...
pressure,tyreNormF,tyreSide)
params = struct(mdl.Parameters);
[Fx,Fy,mux,muy] = mftyre.v62.eval(params,...
[Fx,Fy,mux,muy] = magicformula.v62.eval(params,...
slipangl,longslip,inclangl,pressure,tyreNormF,tyreSide);
end
function value = get.Version(mdl)
Expand Down
File renamed without changes.
Loading

0 comments on commit 37a2713

Please sign in to comment.