Mechanical Simulation Corporation: CarSim

Vendor information

Vendor

Web page

Product name

Version

Mechanical Simulation Corporation

https://www.carsim.com

CarSim

CarSim 2019 - 2023

Categories

MDL 🛈

APL 🛈

BAN 🛈

BMA 🛈

SVC 🛈

DGN 🛈

FIU 🛈

EES 🛈

FCT 🛈

DBG 🛈

IMG 🛈

AUDIO 🛈

ENVSIM 🛈

ENVCOM 🛈

✓

Platform

Operating system

Support

Windows

✓

Linux

Ports

Specifics

Basic information on dealing with environmental simulations can be found in section Tab Environment Simulation.

With the CarSim tool connection, tools from the VehicleSim product family can be controlled remotely. This includes:

  • CarSim

  • TruckSim

  • BikeSim

  • SuspensionSim

This documentation refers specifically to CarSim, but can also be applied analogously to the other VehicleSim products, such as TruckSim.

To use CarSim with ecu.test, it is necessary to register the “CarSim.exe” as COM server. To do this, enter the command “{path to CarSim.exe}” /RegServer in a command prompt with administrator rights. Further information is available in the CarSim documentation in section VS COM Interface.

To connect to a running instance of CarSim with ecu.test, CarSim must not be started via the “CarSim.exe” file. Instead, CarSim must be started via the automation interface (COM API). The following code shows this as an example:

import time
import win32com.client

com = win32com.client.Dispatch('CarSim.Application')  # Starts CarSim

alive = True
while alive:  # Infinite loop to keep CarSim open, destroying the COM connection would close CarSim
    try:
        com.GetProgFolder()  # Check if CarSim is alive
    except:
        alive = False

    time.sleep(1)

ecu.test will then automatically connect to the running CarSim instance without any further settings have to be made.

For reading and writing parameters the test steps are to be used preferentially. The modification of parameters with a leading * in the name is not supported by the test steps, since these can only be specified in the CarSim GUI. Instead, the tool jobs ReadValue and WriteValue should be used. A parameter should always be read and written either via the test steps or the tool jobs.

Supported execution modes

The CarSim connector allows the execution of scenarios in different ways. This refers to the used solver / simulator as well as the time mode to be configured in ecu.test. Supported solvers are the CarSim built-in solver and various external solvers.

The CarSim built-in solver provides a blocking execution mode where a scenario is executed from start to end without any pauses. In this mode additional operations, like reading signals etc. are not possible. Therefore execution is not controlled via the test steps Start Simulation and Stop Simulation but by calling the tool job RunMathModel that blocks the test case execution until the scenario end is reached. The blocking execution is only available when using the time mode “real time”. Therefore real time or determine automatically (default) must be selected as time source in the test configuration.

Supported external solvers and corresponding tool jobs:

  • Mathworks Simulink: RunSimulink

  • dSPACE SCALEXIO platform: RunScalexio

  • NI-RT systems: RunNIRT

These tool jobs convert the scenario and transfer it to the respective platform. The simulation must be started separately via the respective platform (e.g. by ControlDesk for the SCALEXIO platform). For these tool jobs, real time or determine automatically (default) must be selected as time source in the test configuration.

The tool jobs also provide the parameter ExecuteBlocking. This is set to True by default. If the parameter is filled with the value False, the respective tool job does not block the test case until the end of the scenario. To ensure the proper operation of the CarSim connection, waiting for the end of the simulation must be done by the user in this case. There are two options for this:

  • Using of the tool job IsSimulationRunning (recommended) The return value of this tool job indicates whether a simulation is still running. Only if the value False is returned the simulation is finished.

  • Using the Wait test step with a high enough value for the wait time, so that the simulation is definitely completed within this time span.

Alternatively to the blocking mode, the CarSim built-in solver offers scenario execution in stepwise simulation mode. For this the ENVSIM port must be selected as time source in the test configuration and the time mode must be set to stepwise or determine automatically. In this execution mode the simulation is always paused and only advanced by using wait test steps (or read test steps with time options). The test steps Start Simulation and Stop Simulation are used to start and stop the scenario. During scenario execution reading signals is possible.

The continuous simulation mode, which is another fundamental time mode offered by ecu.test, is not supported by this connector.

Limitations

The stepwise simulation mode is only supported from CarSim 2017.1.

Writing signal values is not supported.

Only .erd files are supported for recording. The ERD format will be automatically activated by ecu.test.

Name

Available if

Default value

Valid values

Type

Description

VehicleSim Product

CarSim

[CarSim, TruckSim, BikeSim, SuspensionSim]

string

Specific VehicleSim product to use

Timeout for tool call ❲in sec.❳

‘600’

string

Timeout after which a tool call is aborted.

GotoLibrary

Switches to new library in order to read or write a bluelink that else may be ambiguous (because it is used in two libraries with same name).

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

Category

string

Category name of DataSet (e.g. Handling Testing).

DataSet

string

DataSet name (e.g. DLC @ 120 km/h (Quick Start))

Library

‘CarSim Run Control’

[‘CarSim Run Control’, ‘Multiple Moving Objects’]

string

Library to switch to.

IsSimulationRunning

Returns whether a simulation is currently running.

Parameterization

Return value

Name

Available if

Default value

Valid values

Type

Description

IsSimulationRunning

[False, True]

bool

True if a simulation is currently running. False otherwise.

ReadMixTableCellValue

Reads the value of a table cell.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

Library

‘CarSim Run Control’

[‘CarSim Run Control’, ‘Multiple Moving Objects’]

string

Library from which the value is to be read.

TableColumn

int

Table column for which the cell value is to be read (e.g. 2).

Tip: By holding down the right mouse button on the element in the CarSim interface, the ID of the corresponding data column is displayed.

TableName

string

Name of the table from which the value is to be read (e.g. #MIXTABLE0).

Tip: By holding down the right mouse button on the element in the CarSim interface, the keyword is displayed.

TableRow

int

Table row for which the cell value is to be read (index starting at 0)

ReadValue

Reads the value of a YellowField, MiscYellowField or BlueLink element.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

ElementType

‘MiscYellow’

[‘MiscYellow’, ‘Yellow’, ‘BlueLink’]

string

Type of the element to read.

Keyword

string

Keyword of the element from which a value is to be read (e.g. *TSTART).

Tip: By holding down the right mouse button on the element in the CarSim interface, the keyword is displayed.

Library

‘CarSim Run Control’

[‘CarSim Run Control’, ‘Multiple Moving Objects’]

string

Library in which a value is to be read.

RunMathModel

Starts the simulation in real-time mode.

If blocking parameter is set to True the simulation is stopped after the job is finished and it is not possible to read signals during the simulation run.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

ExecuteBlocking

☑

bool

Specifies whether the simulation is executed blocking or non-blocking.

RunNIRealtime

Starts the simulation in real-time mode in a NI-RT environment.

If blocking parameter is set to True the simulation is stopped after the job is finished and it is not possible to read signals during the simulation run.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

ExecuteBlocking

☑

bool

Specifies whether the simulation is executed blocking or non-blocking.

StartLiveVideo

☐

bool

Start VS Visualizer to display a live video.

RunScalexio

Starts the simulation in real-time mode in a Scalexio environment.

If blocking parameter is set to True the simulation is stopped after the job is finished and it is not possible to read signals during the simulation run.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

ExecuteBlocking

☑

bool

Specifies whether the simulation is executed blocking or non-blocking.

StartLiveVideo

☐

bool

Start VS Visualizer to display a live video.

Starts the simulation in real-time mode in a Simulink environment.

If blocking parameter is set to True the simulation is stopped after the job is finished and it is not possible to read signals during the simulation run.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

ExecuteBlocking

☑

bool

Specifies whether the simulation is executed blocking or non-blocking.

StartLiveVideo

☐

bool

Start VS Visualizer to display a live video.

StartMode

‘Send to Simulink’

[‘Run Now’, ‘Send to Simulink’]

string

Determines the start mode (Run Control).

E.g. directly run the model or send the model to Simulink.

WriteBlueLinkValue

Writes the value of a BlueLink element.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

Category

string

Name of the category of the DataSet for the new link (e.g. Handling Testing).

DataSet

string

Name of the DataSet for the new link (e.g. DLC @ 120 km/h (Quick Start)). If this field is left empty, the link will be deleted.

Keyword

string

Keyword of the element whose value is to be written (e.g. #BlueLink2).

Tip: By holding down the right mouse button on the element in the CarSim interface, the keyword will be displayed.

Library

‘CarSim Run Control’

[‘CarSim Run Control’, ‘Multiple Moving Objects’]

string

Library, that contains the value to write.

NewLibrary

string

Name of the library that contains the DataSet for the new link (e.g. Procedures). If this field is left empty, the link will be deleted.

WriteMixTableCellValue

Sets the value of a table cell.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

Library

‘CarSim Run Control’

[‘CarSim Run Control’, ‘Multiple Moving Objects’]

string

Library, that contains the value to write.

TableColumn

int

Table column for which the cell value is to be set (e.g. 2).

Tip: By holding down the right mouse button on the element in the CarSim interface, the ID of the corresponding data column is displayed.

TableName

string

Name of the table for which the value is to be set (e.g. #MIXTABLE0).

Tip: By holding down the right mouse button on the element in the CarSim interface, the keyword is displayed.

TableRow

int

Table row for which the cell value is to be set (index starting at 0)

Value

string

Value to be set

WriteValue

Writes the value of a YellowField or MiscYellowField element.

Parameterization

Parameter

Name

Available if

Default value

Valid values

Type

Description

ElementType

‘MiscYellow’

[‘MiscYellow’, ‘Yellow’]

string

Type of the element to write.

Keyword

string

Keyword of the element from which a value is to be written (e.g. *TSTART).

Tip: With the right mouse button pressed on the element in the CarSim interface, the keyword is displayed.

Library

‘CarSim Run Control’

[‘CarSim Run Control’, ‘Multiple Moving Objects’]

string

Library, that contains the value to write.

Value

string

Value that is to be written.