synced plot and video
Run a VS Solver from Visual Basic or the command line interface provided by VS Solver Wrapper. Click for more detail.

VehicleSim SDK

Mechanical Simulation Corporation produces and distributes software tools for simulating and analyzing the dynamic behavior of motor vehicles in response to inputs from steering, braking, throttle, road, and aerodynamics.

The VS SDK is a Software Development Kit. This means that it includes all the tools, libraries, documentation, and example projects necessary to get working on a project with as little configuration possible. With nothing but the contents of the SDK, a valid license for a VehicleSim product, and a development environment for your language of choice you can get to work building and extending various aspects of the simulation architecture.

The VehicleSim SDK is available from the VS SDK part of the Users section of this website.

The VehicleSim SDK includes the following libraries and utilities.

Libraries

VS Solver

The VS Solver library contains the API for the VS Math Model. The VS API is a set of functions that allow for direct interaction with a VS Solver instance. An incredibly powerful tool, it can be used to extend or wrap the solver using several important methods:

  • Adding equations at runtime, through the employment of VS Commands.
  • Exchange of internal and external variables into the simulation.
  • Direct access of variables within the VS Math Model. Operations performed on these variables within the wrapper program can then be integrated with the calculations performed within the VS Math Model.
  • Saving and restoring VS Math Model state.
  • Applying callbacks to the VS Math Model.

VS Vehicle

The VS Vehicle module is a wrapper for the VehicleSim solvers’ native interface (the VS API). It is intended to simplify the integration of VehicleSim solvers into other simulation environments. VS Vehicle provides a high-level interface to the programmer while automatically handling the intricacies of the VS API. VS Vehicle also facilitates simulating multiple vehicle instances, using one or more solvers, within the same simulation environment.

VS Terrain

The VS Terrain Library is a standalone Windows DLL that can be used to generate VS Terrain files. Geometry can be fed in from the source application, attaching friction and rolling resistance values to each triangle face. This data can then be optimized and built to be used directly by the VS Solvers. An example python script is included in the SDK, and the VS Terrain document includes an example written in C.

VS Connect

The VS Connect library is used for the facilitation of communications between external programs and VehicleSim products. The primary use for it is the synchronization of simulations between multiple programs for co-simulation. These programs may be on a single computer or separated by a network.

VS Output

The VS Output library allows an engineer to read, write, and create the same output file formats used within VehicleSim projects.

VS Table

A major component of many VehicleSim simulations is the use of nonlinear relationships represented within a table structure. These relationships are stored in a standard VS Table Format within a table file (.vstb). In order to access and manipulate the data within one of these tables programmatically, the VS Table API can be used. The API allows for creating, editing, and accessing both 1-D and 2-D tables. Although tables can exist through VS Command definitions, if a table is required with very large amounts of data, it is recommended to use the VS Table API.

VS Shared Buffer

The VS Shared Buffer library facilitates interprocess transfer of image data. Utilizing this API, VS Visualizer provides rendered data (color, depth, and surface normal vectors) to the VS Camera Sensor S-function within Simulink. VS Visualizer uses this API to create shared buffers and update them continuously with data. The VS Camera Sensor S-function uses this API to access and read the data which VS Visualizer is sharing.

Utilities

VS Solver Wrapper

In order to facilitate development of applications that interact with and consume the output of a VS Solver, a command-line wrapper has been provided for basic use. This wrapper application loads a VS Solver dll and uses it to perform a simulation, given a valid simulation input.

VS License Manager

Multiple License Managers have been included with the VS SDK for use with a VS Solver. Generally, the licensing is managed by a license manager embedded within an instance of the VS Browser, however the use of the VS SDK does not require this. Once your licensing has been properly configured as described in the Licensing Documentation and with the help of the HostID program also included in the VS SDK, an instance of the license manager must be running before attempting to run the VS Solver.

Example Applications

VehicleSim products include example programs in Python, MATLAB, Visual Basic, and ANSI C that show how to load and run the VS Solver, and possibly use build a custom program to interact with the VS math models.

High Performance Computing

The VehicleSim suite of products is being used on various high performance computing architectures. These architectures can range from a single computer to many thousands of computational nodes hosted on a cloud based system. The VehicleSim SDK ships with command line utilities that make deploying VehicleSim very easy. However, they are not always appropriate for all situations. The SDK ships with example programs to build custom command line tools and provides libraries for interacting with many of our proprietary file formats.

Driving Simulators

CarSim and TruckSim math models are used in over 1400 driving simulators. The vast majority of these were done with the ordinary Windows versions of the products. The makers of the driving simulators combine third-party visualization software and databases with the VS Math Model. Communication with the DLL is handled using the VS API functions.

Motorsport Team Applications

CarSim is in use today by sophisticated top-tier teams to reduce the workload of producing simulations. The VS API makes it possible to run third-party tire models, advanced damper models, detailed aero maps, and alternative engines and transmissions, to name just a few. Complex detailed arrangements can be accommodated, such as highly asymmetric suspensions, preloaded components, third springs, and inerters.

Race engineers extend CarSim to get the fastest available simulation together with all the advanced systems and components unique to their level of competition. CarSim is in use right now to simulate 7 post rigs, conduct optimization studies, study tire wear effects on lap time, examine trade-offs in set ups for mechanical versus aerodynamic grip, and to optimize setup of differentials and control systems.

CarSim engineers have worked with race engineers from NASCAR, Formula 1, ALMS, and IndyCar series who want to add their theories and knowledge to a fast, stable, and proven simulation tool.

timeline
This figure from the API documentation shows the sequence of operations during initialization. Click for full size.
M-File
A MATLAB M-file can be used to run the VS Solver with model extensions. Click for more detail.
C code
A custom C program can install callback functions that will be used by the VS Solver. Click for more detail.
Callback
Callback functions defined in an external C program can be called from within the VS Solver. Click for more detail.
Contact Us