Go To Mechanical Simulation Corporation Home Page
Go To Mechanical Simulation Corporation's Facebook Page
Go To Mechanical Simulation Corporation's LinkedIn Page
Go To Mechanical Simulation Corporation's YouTube Page
Search

Connect CarSim to a Simulink model and run it (2013).

The math models in VehicleSim products can be extended several ways:

  1. The VS Math Model can be connected to a model in another simulation environment, such as Simulink.
  2. Equations and and variables can be added using VS Commands.
  3. Variables can be exchanged with custom programs as is done with Simulink.
  4. Variables in the math model can be accessed directly by custom programs that support C/C++ pointers.

This page describes the option for working in external simulation environment.

Simulink, FMI/FMU, LabVIEW, and ASCET

CarSim, TruckSim, and BikeSim models are complete with respect to simulating conventional vehicles in a full range of test and driving conditions. The programs that solve the equations of the math models are called VS Solver programs; they use core equations that describe the basic 3D kinematical and dynamical equations of a vehicle with pneumatic tires and conventional suspension, steering, braking, and powertrain systems.

The VehicleSim architecture is designed so the core vehicle models can be extended to account for advanced electronic controllers, alternative component models (tires, steering, powertrain, etc.), driver control, advanced test procedures, etc. The same architecture also supports the use of our vehicle models in other simulation environments, such as MATLAB/Simulink, LabVIEW, and ETAS ASCET. Read more about compatible software packages.

Import and Export Variables

Communication with other software is accomplished with arrays of import and export variables. The math model equations include effects of variables that are defined in other software and imported as the simulation runs. Output variables are computed by the model and can be sent to other software (exported) during a run. For example, CarSim models have about 400 available import variables and 800 available output variables. More import and export variables are easily defined using the VS Commands DEFINE_IMPORT and DEFINE_OUTPUT.

VehicleSim products connect to Simulink using a wrapper: an S-Function for Simulink that loads the VS Solver DLL and configures it based on settings from the GUI. Click for more detail.

MATLAB/Simulink

Simulink provides a graphical user interface for building math models as block diagrams. The graphical interface is popular for developing dynamical models for many fields, such as electronics, hydraulics, chemistry, and especially, control systems.

The VS browser simplifies the connection VS Math Models and Simulink, as shown in this 6-minute video.

  • Work in the VS Browser (on the main Run Control screen) and use Simulink models the same way you would use the built-in math models. You can use models created by Simulink users even if you have little or no knowledge about how to use Simulink. Just click the Run Now button whenever you want to run a new simulation.
  • Work in Simulink and use our S-function plug-ins the same way you would use other S-functions. You can use our vehicle dynamics models from within Simulink with little knowledge about the VS Browser or our model details. Click the Send to Simulink button to transfer all necessary data to Simulink, and then do your work in Simulink. Besides the normal viewing of results from within Simulink, you can transfer back to the VS Browser at any time to adjust vehicle properties or use VS Visualizer to view the results you generated in Simulink.

Although our vehicle models have hundreds of variables available for import and export, you do not need to handle all of them when including the vehicle model in Simulink. A typical Simulink model will use only a few of the available variables. They are activated by pointing-and-clicking from VS Browser screens that you use to activate specific variables for import and export to and from Simulink.

VehicleSim products support FMU for FMI versions 1.0 and 2.0, flat or structured I/O, self-contained or with shared data, and 32-bit or 64-bit solvers.

Functional Mock-up Interface (FMI)

Functional Mock-up Interface (FMI) is an open standard interface for for linking multiple simulation tools together. FMI supports model exchange and co-simulation of dynamic models (see the web site https://www.fmi-standard.org for details).

A Functional mock-up unit (FMU) is a block that can run in a simulation workspace.

BikeSim, CarSim, and TruckSim can automatically generate a VS FMU as a co-simulation slave for the following options:

  1. FMI versions 1.0 and 2.0.
  2. "Flat" and "Structured" I/O definitions.
  3. Both self-contained FMUs and FMUs that work with external files.
    1. The FMU that uses external data files operates in a similar fashion to a Simulink S-Function, accessing external database files, and generating output files that can be viewed with VS Visualizer.
    2. The self-contained version contains the solvers and all supporting data in the single FMU file. Output files are written in a temporary folder.
  4. Compiled for both 32-bit and 64-bit Windows OS. (Versions for RT opertating systems are currently in development.)

LabVIEW and ETAS ASCET

National Instruments LabVIEW and ETAS ASCET are simulation environments that can also be used to extend our vehicle models. The VS browser GUI supports the same type of simple-click configuration and connection controls that are provided for Simulink.

Fast, Consistent, and Compatible

The core vehicle models are compiled as dynamically linked library (DLL) files that all support the VehicleSim application program interface (VS API). The same DLL is used for stand-alone runs (the core vehicle model running with no external software), or with Simulink, or LabView, or ASCET, or custom programs written in any language that can use DLLs. The DLL always runs at high speed, giving results much faster than real-time on typical PCs. Identical behavior is obtained regardless of the simulation environment, because there is just one DLL used in different contexts.

NI-LabVIEW
ETAS


simulink
This 6-minute video shows how to run a CarSim model with Simulink; this also applies for BikeSim and TruckSim (2015).






The Run Control screen has simple buttons for controlling runs with a Simulink model either from the Run Control screen or from Simulink. Similar options are available for LabVIEW and ASCET.

Create an FMU for use with FMI-compatible software using a single button. The FMU includes all settings for the current Run Control setup.
Select from hundred of variables that can be imported from a Simulink model by pointing and clicking. The browse information is generated automatically for a selected Run Control dataset. Click for more detail.
Contact Us
Subscribe to Newsletter
© 2005-2017 Mechanical Simulation Corporation, All Rights Reserved. CarSim, SuspensionSim, TruckSim, BikeSim, VehSim,
and VehicleSim are registered trademarks of Mechanical Simulation Corporation in the USA and other countries.