SimuCAN User Manual v102
SimuCAN User Manual v102
SimuCAN User Manual v102
USER MANUAL
www.eepod.com
Table Of Contents
REVISION HISTORY .................................................................................................................................................1
1
INTRODUCTION ................................................................................................................................................2
1.1
INSTALLATION .................................................................................................................................................2
1.2
OVERVIEW .......................................................................................................................................................2
1.2.1
Network Hierarchy..................................................................................................................................2
1.2.2
Network Simulation .................................................................................................................................2
1.2.3
Network Control .....................................................................................................................................2
1.3
KEY FEATURES ................................................................................................................................................2
1.3.1
Simple ASCIII Socket Interface ...............................................................................................................2
1.3.2
Support For Raw or Fully Transformed Engineering Units ...................................................................3
1.3.3
Built-In DBC File Conversion ................................................................................................................3
1.3.4
Accurate Simulation Timing ...................................................................................................................3
1.3.5
Module and Message Level Control .......................................................................................................3
1.3.6
Message Collision Detection ..................................................................................................................3
1.3.7
Script Language Processor .....................................................................................................................3
1.3.8
Logging ...................................................................................................................................................3
2
SIMUCAN™ CONFIGURATION FILE FORMAT ........................................................................................4
2.1
VERSION ..........................................................................................................................................................4
2.2
COMMENT ........................................................................................................................................................4
2.3
MODULE ..........................................................................................................................................................4
2.4
MESSAGE .........................................................................................................................................................4
2.5
SIGNAL ............................................................................................................................................................4
2.6
TABLE ..............................................................................................................................................................5
2.7
MULTIPLEXED MESSAGES ...............................................................................................................................5
3
SIMUCAN™ SOCKET SERVER INTERFACE ..............................................................................................6
3.1
COMMAND REFERENCE ...................................................................................................................................6
3.1.1
READ ......................................................................................................................................................6
3.1.2
WRITE .....................................................................................................................................................7
3.1.3
START .....................................................................................................................................................7
3.1.4
STOP .......................................................................................................................................................8
3.1.5
OPEN ......................................................................................................................................................8
3.1.6
CLOSE ....................................................................................................................................................8
3.2
EXAMPLE TEST PROGRAM ...............................................................................................................................9
4
ACRONYMS .......................................................................................................................................................11
EEPod LLC ii
Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02
REVISION HISTORY
1 INTRODUCTION
Thank you for purchasing the SimuCAN™ software. SimuCAN™ is a comprehensive software simulation engine that works with the
McS1 or MyCANIC Vehicle Interface to provide a complete low-cost vehicle network simulation environment. With this software,
the user can exactly describe the operational behavior of the network and then simulate all or part of the network. This architecture
greatly simplifies the testing of electronic control modules under development when the rest of the vehicle control modules are not yet
available. With faster development cycles and the fact that ECU suppliers must develop their modules without the support of other
suppliers, simulation tools are a necessity.
1.1 INSTALLATION
Upon inserting the installation CD, the setup program will run automatically to install the SimuCAN™ software, place a shortcut
on the desktop and install the USB drivers for the security key. SimuCAN™ uses a USB software lock for copyright protection.
The USB software lock is provided with the installation CD.
SimuCAN™ is a single executable file that can be copied from the installation CD to any directory on your PC. It requires that
the J2534 software installation (mcs1install.exe or mycanicinstall.exe) is complete and that the USB software lock driver is
installed. If the software lock is not detected, a popup will notify the user and the simulation capability will be disabled.
First time users may experience a popup security alert for blocking network access (depending on the your security level setting).
Because SimuCAN™ uses a TCP/IP port for control from other programs (like SimuTEST), you need to allow access. This
should only occur the first time you run SimuCAN™.
1.2 OVERVIEW
SimuCAN™ is designed to be a core element of any vehicle electronic development/test environment. One typical use case is
when the development/test engineer defines the behavior of the entire vehicle network and then simulates all of the vehicle
network messages except for the device under test (DUT). A real electronic control module can then be placed on the network
and operated as if it were installed in an actual vehicle. Another typical use case is where there are other real or simulated
modules on the network and the SimuCAN™ socket server interface is connected to a modeling engine (e.g. MathCAD™ or
StateMate™) to exactly simulate the full behavior of an ECU.
1.2.1 Network Hierarchy
Vehicle networks typically consist of several electronic control modules (e.g. powertrain / engine, transmission, ABS, seat
module, door module, SRS, etc.). Each module participates on the CAN network by sending and receiving messages.
Within each CAN message, there are one or more signals (parameters). These signals determine the operational behavior of
each electronic module.
1.2.2 Network Simulation
Within SimuCAN™ you define each module, message and signal. Using this information, SimuCAN™ transmits all of the
simulated messages with the correct timing and behavior as if each of the simulated modules were physically attached to the
CAN network. In addition to transmitting all of the simulated messages, SimuCAN™ receives all of the messages/signal
from the device(s) under test to allow the development / test engineer the ability to read the values.
1.2.3 Network Control
For control of the simulation environment, SimuCAN™ provides a socket interface to allow any test program, script or
modeling engine (e.g. MATLAB, STATEMATE, etc.) to read or write the CAN network signal information for development
or testing. This interface supports reading or writing the signal information using either raw values or transformed values
with the appropriate engineering units.
1500RPM by sending “WRITE SIG ENGINE_SPEED=1500” to the socket. Similarly, to read the same signal, you can send
“READ SIG ENGINE_SPEED” and the response will be “SIG ENGINE_SPEED=1500”.
1.3.8 Logging
SimuCAN™ has a built-in logging function to save all socket communications to a log file for development, debugging and
documentation purposes. Each entry in log is time-stamped with the highest resolution PC timer (accurate to +/-55
milliseconds).
2.1 VERSION
Type: VER
The version record has a single field with an XX.XX version format.
Format: VER,<version>
Example: VER,”01.00”
2.2 COMMENT
Type: CMT
The comment record has a single field that is a string of any length (up to 512 characters). The string must be enclosed in
double quotes.
Format: CMT,<comment>
Example: CMT,”This is a comment”
2.3 MODULE
Type: MOD
The module record has several fields that contain the module name, CAN Network, Diagnostic Request ID and Diagnostic
Response ID. The CAN Network ID must be set to one (1) for the HSCAN network , two (2) for MSCAN and three (3) for
SWCAN.
Format: MOD,<MOD>,<NETID>,<REQID>,<RESPID>
Example: MOD,”PCM”,1 ,0x7E0 ,0x7E8
2.4 MESSAGE
Type: MSG
The message record has several fields that contain the module name, message name, Message ID, periodicity (in
milliseconds) and data length (in bytes).
Format: MSG,<MOD>,<MSG>,<MSGID>,<PERIOD>,<LENGTH>
Example: MSG,”PCM”,”RPM”,0x120 ,100 ,4
2.5 SIGNAL
Type: SIG
The signal record has several fields that contain the Message ID, Signal Name, Signal Description, Signal TX Type, Data
Byte Offset, Data Bit Offset, Bit Length, Default Value, SNA Value, Min, Max, Transform Type, Multiplier, Offset and
Engineering Units. The Signal TX Type can be set to zero (0) for periodic or one (1) for event-driven. The Transform Type
can be set to zero (0) for equations or non-zero for a table ID number. The Transform Type can also be set to -1 (Intel Byte
Order) or -2 (32-bit single precision floating point value). The Data Byte Offset and Data Bit Offset point to the LSB (least
significant bit) of the value.
Format: SIG,<NAME>,<DESCRIPTION>,<MSGID>,<TXTYPE>,<BYTE>,<BIT>,<LEN>,<DEF>,<SNA>
,<MIN>,<MAX>,<TRANS>,<MULT>,<OFFSET>,<UNITS>
Example: SIG,”RPM” ,”Engine RPM” ,0x120 ,0 ,2 ,0 ,16 ,0 ,0xFFFF,0
,15000,0 ,1 ,0 ,”RPM”
2.6 TABLE
Table records are used to transform signals that are not a linear equation. The table ID must be non-zero and the table
records are variable length (depending on the number or values to be transformed) up to 4000 characters for the entire table
entry. Individual description strings are limited to 63 characters maximum.
Type: TBL
Format: TBL,<TABLE ID> ,<VALUE1>,<DESCRIPTION1>,<VALUE2>,<DESCRIPTION2>,…
Example: TBL,1 ,0x01 ,”ON” ,0x00 ,”OFF”
3.1.1 READ
The READ command is used to get the value of signals or entire messages. Signals can be read as raw values or fully
transformed into engineering units. Messages can only be read as raw values.
3.1.1.1 SIG
The READ SIG command is used to get signal values in fully transformed engineering units or table lookup values.
After sending this command, a response will be received on the socket with format: “SIG <SIGNAL
NAME>=<VALUE>”.
Example: READ SIG ENGINE_SPEED
For this command, the response will be of the form: “SIG ENGINE_SPEED=1500”.
3.1.1.2 RAW
The READ RAW command is used to get raw signal values. After sending this command, a response will be received
on the socket with format: “RAW <SIGNAL NAME>=<VALUE>”.
Example: READ RAW ENGINE_SPEED
For this command, the response will be of the form: “RAW ENGINE_SPEED=6000”.
3.1.1.3 MSG
The READ MSG command is used to get raw values of all the message bytes. After sending this command, a response
will be received on the socket with format: “MSG <MESSAGE NAME>=<BYTE1> <BYTE2> …”.
Example: READ MSG RPM_SPD
For this command, the response will be of the form: “MSG RPM_SPD=0x17 0x70 0x00 0x00” (example is a message
with four data bytes).
3.1.2 WRITE
The WRITE command is used to set the value of signals or entire messages. Signals can be written as raw values or
fully transformed into engineering units. Messages can only be written as raw values. No response will be sent back on
the socket for write commands.
3.1.2.1 SIG
The WRITE SIG command is used to set signal values in fully transformed engineering units or table lookup values.
Example: WRITE SIG ENGINE_SPEED=1500
3.1.2.2 RAW
The WRITE RAW command is used to set raw signal values.
Example: WRITE RAW ENGINE_SPEED=6000
3.1.2.3 MSG
The WITE MSG command is used to set raw values of all the message bytes.
Example: WRITE MSG RPM_SPD=0x17 0x70 0x00 0x00 (example is a message with four data bytes)
3.1.3 START
The START command is used to start single messages, all the messages from a single module or all messages for all
modules. Note that if the simulation engine has not been started (e.g. “START SIM”), these commands will only make the
messages ready for simulation.
3.1.3.1 MSG
The START MSG command is used to start the simulation of a single message.
Example: START MSG RPM_SPD
The example above starts simulating the RPM_SPD message.
3.1.3.2 MOD
The START MOD command is used to start the simulation of all messages for a single module.
Example: START MOD PCM
The example above starts simulating all messages transmitted by the PCM module.
3.1.3.3 ALL
The START ALL command is used to start the simulation of all messages for all modules.
Example: START ALL
3.1.3.4 SIM
The START SIM command is used to start the simulation engine.
Example: START SIM
3.1.4 STOP
The STOP command is used to stop single messages, all the messages from a single module or all messages for all modules.
3.1.4.1 MSG
The STOP MSG command is used to stop the simulation of a single message.
Example: STOP MSG RPM_SPD
The example above stops simulating the RPM_SPD message.
3.1.4.2 MOD
The STOP MOD command is used to stop the simulation of all messages for a single module.
Example: STOP MOD PCM
The example above stops simulating all messages transmitted by the PCM module.
3.1.4.3 ALL
The STOP ALL command is used to stop the simulation of all messages for all modules.
Example: STOP ALL
3.1.4.4 SIM
The STOP SIM command is used to stop the simulation engine.
Example: STOP SIM
3.1.5 OPEN
The OPEN command is used to open configuration files.
3.1.5.1 CFG
The OPEN CFG command is used to load a configuration file.
Example: OPEN CFG CANIHSv705.SCF
The example above loads the CANIHSv705.SCF SimuCAN configuration file. Note that if a full file pathname is not
provided, the file must exist in the same directory as the SimuCAN.exe program.
3.1.6 CLOSE
The CLOSE command is used to stop the SimuCAN.exe program
3.1.6.1 SIM
The CLOSE SIM command is used to stop all simulation and exit the SimuCAN.exe program.
Example: CLOSE SIM
The example above will stop all simulation and exit the SimuCAN.exe program.
#include <vcl.h>
#pragma hdrstop
#include "st.h"
#include "stdio.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TWinSocketStream *pStream;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
/* Start the socket stream */
pStream = new TWinSocketStream(ClientSocket1->Socket, 60000);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SendClick(TObject *Sender)
{
char Buffer[128];
unsigned long StartTime;
unsigned long Count;
/* Get the command text and send it to the socket */
SocketText->GetTextBuf(Buffer, sizeof(Buffer));
pStream->Write(Buffer, strlen(Buffer) + 1);
/* If it was a read command, get the response */
if (strncmpi(Buffer, "READ", 4) == 0)
{
StartTime = GetTickCount();
4 ACRONYMS
ABS Anti-lock Braking System
ASCII American Standard Code for Information Interchange
CAN Controller Area Network
DUT Device Under Test
HSCAN High Speed Controller Area Network
IP Internet Protocol
MSCAN Medium Speed Controller Area Network
PC Personal Computer
RPM Revolutions Per Minute
RX Receive
SNA Signal Not Available
SRS Safety Restraint System
SWCAN Single Wire Controller Area Network
TX Transmit