• VS paths are used for driver controls, locating trafficvehicles, and defining 3D road properties.
• A VS Math Model supports up to 500 VS Paths.

TruckSim math models simulate the dynamic behavior ofvehicles, including combination vehicles with trailers. TheVehicleSim® (VS) Math Model architecture is used.

: Math Models

TruckSim VS Math Models are built using dynamicallylinked VS Solver library files, available for 13 operating
systems: Windows (32- and 64-bit), Linux, and real-time
platforms used for hardware-in-the loop. The models work
well with other software (Simulink, LabVIEW, FMI, ETASASCET, EPIC Unreal, Custom programs, etc.) forautomation or extensions to the models.

Driver Controls• Driver controls can be handled by built-in controllers, VS
Command equations, or imports from external software.
• The closed-loop driver model (DM) can steer to follow atarget path, which can be changed during the run.
• The DM controller handles forward and reverse speeds.
• Closed-loop Speed Controller (SC) for throttle andbraking based on target speed or acceleration, or path.
• SC path preview uses acceleration limits, curvature of thetarget path, and 3D road geometry (banking, grade,curvature).
• Gear shifting and clutch controls can be handled with shiftschedules and automatic throttle-clutch interactions.
• Closed-loop and open-loop controls can be combined tosimulate ADAS intervention systems.
• Steering wheel control can be by angle or torque.
• Open-loop braking can be pedal force or fluid pressure.

A basic TruckSim model runs more than 10 times faster thanreal time on a typical Windows computer.
Multiple vehicles may be simulated simultaneously using asingle VS Math Model, or by running multiple VS MathModels in parallel using external software such as Simulink.

Vehicle Math Models
Vehicle Configurations• A vehicle has a lead unit with 0 to 31 semitrailers.
• A single-axle lead unit can be combined with a trailer tosimulate an articulated vehicle.
• Each vehicle unit may have one or more suspensions, up
to a limit of 128 suspensions in total for the vehicle.
• The suspensions may be organized in groups as needed tosupport tandem and tridem load sharing.
• Sprung masses may be simple rigid bodies or include
frame rails that account for torsional compliance.
• The lead unit may have a suspended cab.
• Loader arms may be attached to any sprung mass.

3D Road Geometry and Friction• The 3D ground surface includes 3D geometry, friction,
and a tire rolling resistance coefficient.
• The 3D surface may be a set of VS Roads or VS Terrain.
• Up to 200 VS Roads may be built with components:o VS Reference Path for S-L coordinate system.
o Configurable Functions for elevation and friction
using S-L coordinates and variable-width tables.
o Boundaries to connect adjacent VS Roads.
• VS Terrain provides a single mesh-type ground surface,created with VS Scene Builder with several options:o Create interactively by dragging 3D Tiles.
o Import datasets from OpenDRIVE format.
o Import 3D FBX files from other software.
• Road profiles “wander” to follow the vehicle tires,providing high-frequency road roughness inputs. Road
profiles are measured routinely by some road agencies.

Configurable Table Functions• Potentially nonlinear relationships between variables aredefined with VS Configurable Functions that can be:o Constants
o Linear coefficientso Nonlinear tables with several interpolation methods
involving one or two independent variables
o User-defined formulas• Configurable Functions include offset and gain transformparameters for dependent and independent variables.
• There is no built-in limit to the length of tables.

Wind and Aerodynamic Effects• Six aerodynamic forces and moments are applied to thesprung mass of each vehicle unit (lead units and trailers).
• These forces and moments are shaped by ConfigurableFunctions of aerodynamic slip.
• Ambient wind speed and heading can be set with tables,
runtime equations, or imported from other software.

VS Reference Paths• A VS path defines an S-L coordinate system (S = distancealong path, L = lateral distance from path).
• Each path is a sequence of segments, where each segment
may be straight, an arc, a clothoid, or an X-Y table.
1/4

Suspensions• Suspensions can be generic/independent, solid axle, orindependent with virtual steering axis.
o Wheel movement in a generic/independent
suspension depends on jounce on both sides.
o Axle movement in a solid axle suspension depends
on axle jounce and rollo Wheel movement in a virtual steering axis suspension
depends on jounce and steering rack travel.
• Independent and solid-axle suspensions can be either
steered or non-steered.
• All suspensions have full nonlinear kinematical behavior
and can be asymmetric.
• Suspension springs and dampers are nonlinear. Thesprings include hysteresis due to friction.
• All suspensions have lateral and longitudinal compliance;
every wheel has toe and camber compliance.
• All compliances can be represented with linear
coefficients or nonlinear configurable functions.
• Separate forces are included for jounce and rebound stops.
• Suspension roll moments include a nonlinear auxiliaryroll moment and linear coefficient roll damper.

Steering System• The interactions between the suspension, steering, tire,and ground are handled with a multibody model that uses
an inclined kingpin axis, or 2D kinematics tables in thecase of the virtual steering axis suspension.
• Use rack-and-pinion or recirculating ball.
• Steer angle of each road wheel is available as measured ina K&C rig or as rotation about the kingpin axis.
• Control the left wheel, the right wheel, or symmetric.
• The steering system includes detailed options for manualor dynamic power boost, including column assist.
• The steering system includes hysteresis, compliance,inertia, and damping.
• Special equations are used for low-speed conditions tosimulate ground friction steer torque.
• Alternatively, steering can be provided by hydrostatic
control of articulation or by skid steer.

Brake System• Brake control can be set with pedal force (with or withoutboost) or master cylinder pressure.
• The control input pressure from the master cylinder is
proportioned for each wheel-end brake actuator.
• Brake torque is modeled as a nonlinear function ofactuator pressure and optional thermal effects.
• The brake system can use a built-in ABS controller orconnect with external programs such as Simulink.

• Special equations handle wheel lockup to obtain thecorrect reaction torque and avoid numerical instability.

Tires• TruckSim includes several installed tire models:o A fully nonlinear and asymmetric table-based modelo An extended model (more tables for camber effects)o A terramechanics-based (soft soil) model (64-bitWindows, single tires only)o MF-Tyre from Siemens• TruckSim supports external models (license required):o MF-Swift from Siemens
o FTire from COSIN
o TameTire from Michelin• User-defined tire models can connect with VS STI.
• External tire models can apply forces at either the groundcontact point or the wheel center.
• Variable friction conditions are handled using similarity,to maintain both linear and limit properties of the tire.
• Transient effects of rolling are included using relaxation
length. Relaxation lengths can be constant or defined as
nonlinear functions of vertical force and slip.
• Special equations are used at low speeds.
• Tire contact can be handled with one to four points.
• Dual tires are available for all wheels.

Powertrain• TruckSim has detailed powertrain models for various
drive settings (4x2, 4x4, etc.) with up to five drive axles.
• The powertrain can drive axles for any vehicle unit or pairof consecutive units.
• The powertrain supports internal combustion (IC),electric motor + battery, and hybrid (IC + electric motor+ battery + planetary gear).
• The hybrid and EV powertrain models support battery
regeneration.
• Electrified axles are supported with either one or twomotors per axle.
• IC engine torque is defined with a 2D Configurable
Function based on RPM and throttle.
• The engine feeds torque to the transmission either througha hydraulic torque converter or a mechanical clutch.
• The transmission converts torque and speed based on thecurrent gear selection, with spin inertias and efficiencies
that depend on the gear selection.
• Supports continuously variable transmissions (CVT).
• The transfer case unit and differential models are similar.
All have four model options: (1) always locked, (2)viscous coupling, (3) coupling applied using a clutch© Mechanical Simulation Corporation. Last revision December 2023.

2/4

• Input files for TruckSim follow a simple keyword-basedformat called the Parsfile. TruckSim can recognize
thousands of keywords when processing input files.
• Each input line can optionally specify alternate units for aparameter.
• Values can be assigned directly to model parameters withnumbers, numerical expressions (e.g., 1/16), or symbolic
algebraic expressions involving other model variables.
• Parsfiles support the INCLUDE capability, allowing
advanced applications such as design of experiments(DOE), sensitivity, and customized automation methods.

(controlled externally or with built-in logic), (4) yaw
control differential system having two clutches. Torquedistribution is controlled left and right, or front and rear.
• Each transfer case has a torque bias for non-lockedoptions.
• Twin-clutch is an alternative to an axle differential.
• Torsional compliance of the driveline is included.
• Fuel consumption is defined with a 2D table.
• TruckSim supports external models from GT Suite.

Sensors and Traffic• The models include several kinds of virtual sensors that
detect various types of vehicle motion, including
acceleration, speed, and jerk.
• Up to 200 moving objects can be added that are updated
automatically to convert simple path-based commands
into full 3D geometry.
• Motion of an object can be constant, set by specifyingspeed, controlled by acceleration (simple physics), setwith algebraic equations, or imported via importvariables.
• The objects can be recycled for extensive runs, to reappear
after they go out of view.
• Objects that move based on speed or acceleration support
off-tracking, for realistic low-speed traffic turns.
• Objects used to represent traffic vehicles support brakelights and reverse lights.
• Objects may be rectangular, circular, segment (e.g.,signs), or polygonal.
• Segment objects have a limited viewing angle, to mimic
signs and signals with limited visibility.
• Up to 99 ADAS range and detection sensors can be
included that detect the moving objects. An optional
license is needed for sensors (but not for objects).
• Each detection includes 24 variables that can be exported
to external controllers (e.g., ADAS).
• Objects can block each other (occlusion). The sensor
detection variables respond only to the portion of theobject that is within the field of view.
• Detection sensors can be placed on the vehicle or movingobjects (to detect and simulate collisions).
• Objects may be attached to vehicle sprung masses tosupport ADAS simulations with multiple vehicles orprovide details of collisions with pedestrians.

VS Math Model Input and Outputs
Input Data Files• TruckSim reads all input from text files that are normallygenerated automatically by the Browser/GUI. These files
can also be made externally for advanced applications.

Output Variables• TruckSim generates from 600 to thousands of built-in
output variables, depending on whether there are trailers,sensors, traffic vehicles, etc.
• A subset of the available outputs can be specified at runtime, to control the size and organization of output files.
• Writing to file can be enabled and disabled during the run,to save only interesting results from long simulations.
• TruckSim provides a GUI for browsing the lists ofavailable variables, sorting by several categories.
• All variables are described in documentation files in bothtext and spreadsheet format.
• Output files may be written in several binary forms (32bit and 64-bit) or CSV (text) spreadsheet format.
• Output variables are used for several purposes:
o Make plots that show vehicle behavior.
o Motion information for video visualization.
o Input to other post-processing software.
o Export to other software during the simulation.

VS Commands and Python
VS Solvers include the VS Command scripting language forcustomizing the model and its operation. VS Commands aresupported in all versions, including real-time systems.
• VS Commands can add new equations at several
locations in the sequence of simulation calculations.
• VS Commands can add new parameters, output variables,and state variables as needed to extend the model.
• VS Commands can add new differential equations.
• VS Commands can add new functions to simplify otherformulas or series of equations.
• VS Commands can define new units.
• VS Events monitor custom formulas to trigger the readingof a new Parsfile to change values, modes, etc. This isused to script complicated procedures.
• The Windows and Linux versions provide embedded
Python in support of full programming options.

3/4

Working with Simulink® and External Software• The TruckSim VS Math Model is made with functions
from a dynamic library file.
o The TruckSim GUI runs VS Math Models directly.
o TruckSim includes MATLAB/Simulink S-Functions.
o TruckSim works with LabVIEW.
o TruckSim can generate functional mockup units(FMU) to run under the functional mockup interface(FMI).
• MATLAB, Visual Basic (VB), and other languages canoperate the Browser/GUI using Windows COM.
• TruckSim has a LINEARIZE command to generatelinearized A, B, C, and D matrices for use in MATLAB.
• The VS SDK (software development kit) is available forWindows and Linux. It includes numerous application
program interfaces (APIs):o The VS Solver API is used to build and interact withVS Math Models from C/C++ and languages that canload a DLL file (Python, MATLAB, VB, etc.).
o The STI API helps connect external tire models.
o The Shared Camera Buffer API accesses 3D
information from VS Visualizer cameras.
o VS Output API helps read and write output VS files.
o VS Table API supports Configurable Functions.
o VS Terrain API works with VS Terrain files.
o VS Connect enables co-simulation between EPIC
Unreal and Simulink.

Import Variables• Calculations from external models and measurementsfrom hardware-in-the-loop (HIL) can be imported into
TruckSim. These include most forces and moments, fluidpressures, controls, ground geometry under each tire, etc.
• The vehicle models can import values for hundreds ofbuilt-in variables.
• Most of the import variables can be combined with nativeinternal variables with one of three modes:
1. replace the native variable,
2. add to the native variable, or
3. multiply with the native variable.
• TruckSim provides a browser for activating importvariables from the lists of all those that are available.
• New import variables can be defined with VS Commandsto pass through data from other software. E.g., variablesfrom Simulink can be passed through to the animator.

Export Variables• All variables available for writing to output files are alsoavailable for export to Simulink or other external code.

• Variables are exported only if activated at runtime, as
needed to be compatible with the external model.

Working with the EPIC Unreal Engine• The VehicleSim Dynamics plugin for Unreal Engine
includes the VS Solvers for TruckSim and TruckSim,
allowing the vehicle models to operate within the Unrealenvironment.
• The VS Connect library is used to connect an Epic Unreal
simulation with a simultaneous Simulink simulation, withboth working with the TruckSim VS Solver.

Multibody Model Specifications
State Variables and Degrees of Freedom
TruckSim has ordinary differential equations (ODEs) for thedynamics of multibody systems, including rigid bodies,
fluids, tires, controllers, and other dynamic parts. Additional
state variables are used to define the state of the model forfeatures such as friction, clutch slipping, controllers, etc.
• The number of ODEs and state variables depends on
many options available in the model. The VS Solver isused to generate a list of all state variables for any given
simulation setup.
• A basic 2-axle TruckSim model has 89 ODEs and a totalof 296 state variables.

Equation Form
• The equations of motion are derived from first principles
for 3D motions of multiple connected rigid bodies, using
Kane’s equations for the multibody dynamics andconstraints.
• The equations of motion are ODEs that are not stiff.
• The built-in VS library provides six methods for solving
the ODE’s (Adams-Bashforth, Adams-Moulton, RungeKutta, and Euler methods).
• All methods run at a fixed time step and may be used forreal-time HIL applications.
• The algorithms work well with measured and sampled
data sources, even when there are discontinuities.
• The VS Solvers are compiled with extensive
optimizations for efficient use either alone or with othersoftware (e.g., Simulink, LabVIEW).

Initialization and Restarts• TruckSim supports many initialization options, fromautomatic to detailed specification of any state variable.
• The complete state of the vehicle model is saved at theend of each run, to support continuation of advancedautomation and optimization methods.
• The state of the model can be saved during a run and fully
restored during the run, in support of advanced
optimization methods and repetitive test sequences.

© Mechanical Simulation Corporation. Last revision December 2023.

4/4