Sharing | TSMasterAPI Plugin Import and ECUTEST Co-Simulation Guide

In automotive electronic ECU development and testing, joint simulation has become a key means to improve testing efficiency and ensure system stability. And TSMaster, as a comprehensive tool for automotive electronic simulation and testing, combined with ECUTEST's professional testing capabilities, can realize efficient automated testing. In this article, we will introduce in detail how to import TSMaster API plug-ins and explain the core API interface functions.

Keywords:TSMasterAPI, ECUTEST, API Interface


Currently, TSMaster provides programmable TSMaster software and hardware interfaces for the majority of ecutest users, and the corresponding interface names can be viewed in the ECUTEST software.

Program control TSMaster UI interface to realize SIL simulation interface name: TSOUN: TSMaster SIL Kit; program control TOSUN hardware products to realize SIL simulation interface name: TOSUN: Hardware SIL Kit. as shown in the figure below:

TSMasterAPI插件导入与ECUTEST

1.1 Importing TSMasterAPI

1.1.1 Deploying the plug-in

TOSUN official will provide ECUTEST plug-in environment when installing TSMaster, users can choose whether to install the plug-in or not, the same way as installing C++\Python environment to check the box to install.

TSMasterAPI插件导入与ECUTEST

Meanwhile, if you want to use the plug-in at the first time, you can contact TOSUN sales or technology at the same time to get the plug-in package, and then manually put it into the ECUTEST software, the location of which is shown in the figure below:

TSMasterAPI插件导入与ECUTEST

1.1.2 Workspace Import Plugin

When you create ECUTEST workspace, check “Show workspace settings” -> “Copy tutorial files” -> select “TSMasterAPI” -> ‘OK’, you can see “TSOUN: TSMaster SATURDAY” in the workspace. “TSMasterAPI” -> ‘OK’, then you can see “TSOUN: TSMaster SIL Kit” and “TSOUN: Hardware SIL Kit” in the workspace.

TSMasterAPI插件导入与ECUTEST

1.2 TOSUN: TSMaster SIL Kit

1.2.1 Create test bench configuration

First create “test bench configruation” -> “new create new tool host” -> "Local “; then you can see ”TOSUN: TSMaster SIL Kit" in the tool host window.

Right click “TOSUN: TSMaster SIL Kit” -> “Add tool” -> "TSMaster_project_path In “TSMaster_project_path”, fill in the project path of TSMaster and click save.

(1) Create “test bench configruation”.

TSMasterAPI插件导入与ECUTEST

(2)“Create new tool host”

TSMasterAPI插件导入与ECUTEST

(3)“TOSUN: TSMaster SIL Kit”->“Add tool”

TSMasterAPI插件导入与ECUTEST

(4) “Save”

TSMasterAPI插件导入与ECUTEST

(5) “Start”

TSMasterAPI插件导入与ECUTEST

(6)“Connect tool”

TSMasterAPI插件导入与ECUTEST

(7) Interface call

TSMasterAPI插件导入与ECUTEST

1.3 TOSUN:Hardware SIL Kit

1.3.1 Creating a test bench configuration

First create “test bench configruation” -> “new create new tool host” -> "Local “; then you can see ”TOSUN: Hardware SIL Kit" in the tool host window. Right click “TOSUN: TSMaster SIL Kit” -> “Add tool” -> “TSMaster_App_Name”. Fill in the application name of TSMaster and click Save.

(1) Create “test bench configruation”.

TSMasterAPI插件导入与ECUTEST

(2)“Create new tool host”

TSMasterAPI插件导入与ECUTEST

(3)“TOSUN: TSMaster SIL Kit”->“Add tool”

technical articles 20250701 12 ECUTEST

(4) “Save”

TSMasterAPI插件导入与ECUTEST

(5) “Start”

TSMasterAPI插件导入与ECUTEST

(6)“Connect tool”

technical articles 20250701 14 ECUTEST

(7) Interface call

technical articles 20250701 17 ECUTEST

2.1 TOSUN: TSMaster SIL Kit

2.1.1 start_simulation

Parameter namestart_simulation()
FunctionRPC client startup server TSMaster emulation
call locationAfter creating the rpc client, call
Input parameterNone
Return value==0: function executed successfully
Other values: function execution failed
Typical examplestart_simulation()

2.1.2 simulation_is_running

Parameter namesimulation_is_running()
FunctionReturns whether the server-side TSMaster has emulation enabled or not
call locationAfter creating the rpc client, call
Input parameterNone
Return value==0: function executed successfully
Other values: function execution failed
Typical exampleret =simulation_is_running()
if ret:
print(“Emulation is turned on”)

2.1.3 stop_simulation

Parameter namestop_simulation()
FunctionRPC client stops server side TSMaster emulation
call locationAfter creating the rpc client, call
Input parameterNone
Return value==0: function executed successfully
Other values: function execution failed
Typical examplestop_simulation()

2.1.4 get_sysvar_value

Parameter nameget_sysvar_value(SysvarName:str)->(errorcode, double)
FunctionGetting system variable values
call locationCalled after activating the rpc client
Input parameterSysvarName: System Variable Name
Return value==Ret[0]: error code, ==0 for success, other failures
Ret[1]:Signal value
Typical exampleret,value = get_sysvar_value(‘Var0’)
if ret == 0 and value==100:
Print(“ok”)

2.1.5 set_sysvar_value

Parameter nameget_sysvar_value(SysvarName:str, value:double)->errorcode
FunctionGetting system variable values
call locationCalled after activating the rpc client
Input parameterSysvarName: System Variable Name
Value: Setting value
Return value==0: function executed successfully
Other values: function execution failed
Typical exampleset = set_sysvar_value(‘Var0’ ,100)

2.1.6 get_cansignal_value

Parameter nameget_cansignal_value(cansignalName:str)->(errorcode, double)
FunctionGetting system variable values
call locationCalled after activating the rpc client
Input parametercansignalName: signal address
Return value==Ret[0]: error code, ==0 for success, other failures
Ret[1]:Signal value
Typical exampleret, value = get_cansignal_value( ‘0/CAN_FD_Powertrain/Engine/ABSdata/CarSpeed’)
if ret == 0 and value==100:
Print(“ok”)

2.1.7 set_cansignal_value

Parameter nameset_cansignal_value (cansignal:str, value:double)->errorcode
FunctionSetting system variable values
call locationCalled after activating the rpc client
Input parametercansignalName: signal address
Value: Setting value
Return value==0: function executed successfully
Other values: function execution failed
Typical examplesset_cansignal_value( ‘0/CAN_FD_Powertrain/Engine/ABSdata/CarSpeed, 100)

2.1.8 get_linsignal_value

Parameter nameget_linsignal_value (linsignalName:str)->(errorcode, double)
FunctionGetting system variable values
call locationCalled after activating the rpc client
Input parameterLinsignalName: signal address
Return value==Ret[0]: error code, ==0 for success, other failures
Ret[1]:Signal value
Typical exampleret,value = get_linsignal_value( ‘0/LIN_Powertrain/Engine/ABSdata/CarSpeed)
if ret == 0 and value==100:
Print(“ok”)

2.1.9 set_linsignal_value

Parameter nameset_linsignal_value (linsignal:str, value:double)->errorcode
FunctionSetting system variable values
call locationCalled after activating the rpc client
Input parameterLinsignalName: signal address
Value: Setting value
Return value==0: function executed successfully
Other values: function execution failed
Typical exampleset_linsignal_value( ‘0/LIN_Powertrain/Engine/ABSdata/CarSpeed, 100)

2.1.10 get_frsignal_value

Parameter nameget_frsignal_value (frsignalName:str)->(errorcode, double)
FunctionGetting system variable values
call locationCalled after activating the rpc client
Input parameterfrsignalName: signal address
Return value==Ret[0]: error code, ==0 for success, other failures
Ret[1]:Signal value
Typical exampleret,value = get_frsignal_value( ‘0/FR_Powertrain/Engine/ABSdata/CarSpeed)
if ret == 0 and value==100:
Print(“ok”)

2.1.11 set_frsignal_value

Parameter nameset_frsignal_value (frsignal:str, value:double)->errorcode
FunctionSetting system variable values
call locationCalled after activating the rpc client
Input parameterfrsignalName: signal address
Value: Setting value
Return value==0: function executed successfully
Other values: function execution failed
Typical exampleset_frsignal_value( ‘0/FR_Powertrain/Engine/ABSdata/CarSpeed, 100)

2.2 TOSUN: Hardware SIL Kit

2.2.1 set_hardware_config

Parameter nameset_hardware_config()->error_code
FunctionConfiguring hardware devices for the current program
call locationCalled before connecting, can be left out if not in the case of modifying the channel configuration
Input parameterNone
Return value==0: function executed successfully
Other values: function execution failed
Typical exampleset_hardware_config()

2.2.2 connect

Parameter nameconnect()->error_code
FunctionConnecting Hardware Devices
call locationAfter configuring the hardware channel
Input parameterNone
Return value==0: function executed successfully
Other values: function execution failed
Typical exampleconnect()

2.2.3 disconnect

Parameter namedisconnect()->error_code
FunctionDisconnect hardware devices
call locationAfter configuring the hardware channel
Input parameterNone
Return value==0: function executed successfully
Other values: function execution failed
Typical exampledisconnect()

2.2.4 send_msg

Parameter namesend_msg(AMsg:TLIBCAN|TLIBCANFD|TLIBLIN|TLIBFlexRay)->error_code
FunctionSingle-frame transmitter message
call locationAfter connecting the hardware
Input parameterAMsg: message object
Return value==0: function executed successfully
Other values: function execution failed
Typical exampleAMsg = TLIBCAN(0x123)
send_msg(AMsg)

2.2.5 send_cyclic_can_msg

Parameter namesend_cyclic_can_msg (AMsg:TLIBCAN|TLIBCANFD, ATime)->error_code
FunctionCyclic transmission of CAN/CANFD messages
call locationAfter connecting the hardware
Input parameterAMsg: message object
ATime: period, time in ms 1 means 1ms 100 means 100ms
Return value==0: function executed successfully
Other values: function execution failed
Typical exampleAMsg = TLIBCAN(0x123)
send_cyclic_can_msg(AMsg, 100)

2.2.6 recv_can_msg

Parameter namerecv_can_msg (AChnidx, ACount, IsIncludeTx)->AMsgList
FunctionCyclic transmission of CAN/CANFD messages
call locationAfter connecting the hardware
Input parameterAChnidx: Specified channel for incoming messages
ACount: Maximum number of received messages
IsIncludeTx: Whether or not to include sent messages
Return valueAMsgList: list of received messages
Typical exampleAMsgs = recv_can_msg(0, 100, False)

2.2.7 recv_lin_msg

Parameter namerecv_lin_msg(AChnidx, ACount, IsIncludeTx)->AMsgList
FunctionReceive lin messages
call locationAfter connecting the hardware
Input parameterAChnidx: Specified channel for incoming messages
ACount: Maximum number of received messages
IsIncludeTx: Whether or not to include sent messages
Return valueAMsgList: list of received messages
Typical exampleAMsgs = recv_lin_msg(0, 100, False)send_msg(AMsg)

2.2.8 recv_flexray_msg

Parameter namerecv_flexray_msg(AChnidx, ACount, IsIncludeTx)->AMsgList
FunctionReceive flexray messages
call locationAfter connecting the hardware
Input parameterAChnidx: Specified channel for incoming messages
ACount: Maximum number of received messages
IsIncludeTx: Whether or not to include sent messages
Return valueAMsgList: list of received messages
Typical exampleAMsgs = recv_flexary_msg(0, 100, False)

Which feature of TSMaster are you most interested in? Or what problems have you encountered in practical applications?

Welcome to share your experience or questions in the comment section, any ideas or suggestions can also be comment section message interaction, will have the opportunity to win the TOSUN mystery gift bag Oh ~!

Tip:
1. Software download:
Click on the software download link below to download and install directly, beta version is recommended:

2. Software upgrades:
You can check for upgrades to the latest version within the software, provided that your computer has an Internet connection.

Note: TOSUN Technical Support Email:support@tosunai.cnWe welcome inquiries! (Company and contact information must be indicated)

发表回复

en_USEnglish
×
×

产品入口: 产品添加到购物车

XML 地图