# mfeval function

mfeval evaluates Magic Formula 5.2, 6.1 or 6.2 tir files in steady state for series of input variables.

The formulation includes combined force/moment and turn slip calculations.
ISO-W (TYDEX W) Contact-Patch Axis System coordinate system is used in all calculations.
All the units will be SI (N,m,s,rad,kg) ## Syntax

outMF = mfeval( parameterSource, inputsMF, useMode )

## Description

parameterSource refers to a MF-Tyre tyre property file (.TIR) containing all the Magic Formula coefficients or to a structure with all the parameters.

inputsMF = [Fz kappa alpha gamma phit Vx P* omega*], where

• Fz = normal load on the tyre [N]
• kappa = longitudinal slip [dimensionless, -1: locked wheel]
• alpha = side slip angle [rad]
• gamma = inclination angle [rad]
• phit = turn slip [1/m]
• Vx = forward velocity [m/s]
• P* = pressure [Pa]
• omega* = rotational speed [rad/s]

P* and omega* are optional inputs. If they are not included pressure is constant and equal to the inflation pressure on the TIR file and the rotational speed is approximated.

useMode specifies the type of calculation performed:

• 1: combined force/moment calculation
• 2: combined force/moment calculation + turn slip
• +10: revoke alpha_star definition
• +20: include alpha_star definition
• +100: include limit checks
• +200: ignore limit checks
For example:
useMode = 121 implies:
-combined force/moment
-include alpha_star
-include limit checks

For normal situations turn slip may be neglected, meaning that the radius of the path is close to infinity (straight line).
Alpha_star improves the accuracy of the model for very large slip angles and possibly backward running of the wheel.
The limit checks verify that the inputs are inside the stable range of the model.

outMF consists of 30 columns:

1. Fx: longitudinal force
2. Fy: lateral force
3. Fz: normal force
4. Mx: overturning moment
5. My: rolling resistance moment
6. Mz: self aligning moment
7. kappa: longitudinal slip
8. alpha: side slip angle
9. gamma: inclination angle
10. phit: turn slip
11. Vx: longitudinal velocity
12. P: pressure
14. rho: tyre deflection
15. 2a: contact patch length
16. t: pneumatic trail
17. mux: longitudinal friction coefficient
18. muy: lateral friction coefficient
19. omega: rotational speed
21. 2b: contact patch width
22. Mzr: residual torque
23. Cx: longitudinal stiffness
24. Cy: lateral stiffness
25. Cz: vertical stiffness
26. Kya: cornering stiffness
27. sigmax: longitudinal relaxation length
28. sigmay: lateral relaxation length
29. Instantaneous cornering stiffness: dFy/dSA
30. Kxk: slip stiffness

The equations coded in MFeval are published in the book:
Title: Tire and Vehicle Dynamics
Author: Hans Pacejka
Edition: 3, revised
Publisher: Elsevier, 2012
ISBN: 0080970176, 9780080970172
Length: 672 pages

And in the following paper:
Besselink, I. J. M. , Schmeitz, A. J. C. and Pacejka, H. B.(2010) 'An improved Magic Formula/Swift tyre model that can handle inflation pressure changes', Vehicle System Dynamics, 48: 1, 337 — 352
DOI: 10.1080/00423111003748088

## Create mfeval inputs

```% Number of points
nPoints = 200;

% Pure lateral test case
Fz      = ones(nPoints,1).*3000;            % vertical load         (N)
kappa	= ones(nPoints,1).*0;               % longitudinal slip 	(-) (-1 = locked wheel)
alpha	= linspace(-0.3,0.3, nPoints)';     % side slip angle    	(radians)
gamma	= ones(nPoints,1).*0;               % inclination angle 	(radians)
phit 	= ones(nPoints,1).*0;               % turnslip            	(1/m)
Vx   	= ones(nPoints,1).*16;              % forward velocity   	(m/s)

% Create a string with the name of the TIR file
TIRfile = 'MagicFormula61_Parameters.TIR';

% Select a Use Mode
useMode = 111;

% Wrap all inputs in one matrix
inputs = [Fz kappa alpha gamma phit Vx];
```

## Call mfeval solver

```% Store the output from mfeval in a 2D Matrix
output = mfeval(TIRfile, inputs, useMode);
```

## Plot results

```% Extract variables from output MFeval. For more info type "help mfeval"
Fy = output(:,2);
Mz = output(:,6);
Mx = output(:,4);
SA = rad2deg(output(:,8)); % Convert to degrees
t = output(:,16);

figure
subplot(2,2,1)
plot(SA, Fy)
grid on
title('Fy-SA')
xlabel('Slip Angle (deg)')
ylabel('Lateral Force (N)')

subplot(2,2,2)
plot(SA, Mz)
grid on
title('Mz-SA')
xlabel('Slip Angle (deg)')
ylabel('Self aligning moment (Nm)')

subplot(2,2,3)
plot(SA, t)
grid on
title('t-SA')
xlabel('Slip Angle (deg)')
ylabel('pneumatic trail (m)')

subplot(2,2,4)
plot(SA, Mx)
grid on
title('Mx-SA')
xlabel('Slip Angle (deg)')
ylabel('Overturning moment (Nm)')
``` 