You are on page 1of 13

SIMUCAN ™

USER MANUAL

PREPARED BY: EEPod LLC


Revision: 1.02
Release Date: April 3, 2013
Filename: SimCAN User Manual.doc

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

Revision Release Date Change Descriptions


1.00 Nov. 14, 2007 First draft.
1.01 Jan. 4, 2008 Installation note updates.
1.02 April 3, 2013 Added comment about Transform Types -1 (Intel byte
order) and -2 (32-bit single precision floating point).

Copyright EEPod LLC 2007-2013 1


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

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.

1.3 KEY FEATURES


1.3.1 Simple ASCIII Socket Interface
Development / test applications can communicate with SimuCAN™ using simple ASCII command over a socket interface.
For instance, if you have a signal defined for RPM that is named “ENGINE_SPEED”, you can set the engine speed to
Copyright EEPod LLC 2007-2013 2
Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

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.2 Support For Raw or Fully Transformed Engineering Units


Applications can read and write signals in either raw (binary) or fully transformed values. For example, if the raw data for
the signal ENGINE_RPM is in units of 0.25 RPM per bit, the application can send “WRITE RAW ENGINE_SPEED=6000”
to set the engine speed to 1500RPM.

1.3.3 Built-In DBC File Conversion


SimuCAN™ can read native Vector DBC files to create the initial module, message and signal definitions. This can save a
significant amount of setup time if you have existing DBC files. After converting a DBC file, the developer / tester should
look through the list of modules, messages and signals to make sure it is correct.

1.3.4 Accurate Simulation Timing


Due to the fact that the Windows® operating system does not have real-time capabilities, SimuCAN™ uses the built-in
features of the McS1/MyCANIC Vehicle Interface to control the fastest simulated messages. When starting the simulation,
SimuCAN™ analyzes the entire set of simulated messages and then places the fastest ones in the McS1/MyCANIC to
achieve accurate simulation timing.

1.3.5 Module and Message Level Control


SimuCAN™ allows the development / test engineer to control the simulation at either the module or message level. Using
this capability, the application can start or stop entire modules or individual messages. This feature can be very useful for
testing loss of communications or other strategies.

1.3.6 Message Collision Detection


SimuCAN™ has a built-in feature to detect message collisions (same message ID being sent and received) which can occur
when an entire simulation environment is started and you forget to turn off simulation of the messages for the device that is
being developed / tested.

1.3.7 Script Language Processor


SimuCAN™ has a built-in script language processor for performing simple tests. While most development / testing will
require a separate test application, script files can be used to develop or test many simple functions. The script language is
very similar to many batch file languages with simple control statements.

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).

Copyright EEPod LLC 2007-2013 3


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

2 SIMUCAN™ CONFIGURATION FILE FORMAT


With the exception of the VER record type, the fields after the record type are dependent on both the record type and version. All
fields are comma delimited. All records are terminated with a line feed (0x0A) character. All hexadecimal values are preceeded by
“0x”.

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

Copyright EEPod LLC 2007-2013 4


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

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”

2.7 MULTIPLEXED MESSAGES


To support multiplexed CAN IDs (where the same 11-bit ID is used and the first data byte is the multiplex ID), use the upper
bits of the CAN ID to differentiate between the multiplexed messages. These bits will not be used in the transmission of the
message, but will allow for differentiation of which signals belong to which multiplexed message. Then, for each
multiplexed message, define the signal for the first byte with a default value set to the multiplex value.
Format: MSG,<MOD> ,<MSG> ,<MSGID> ,<PERIOD>,<LENGTH>
Example: MSG,”PCM” ,”INFO1”,0x10000120 ,100 ,4
Example: MSG,”PCM” ,”INFO2”,0x20000120 ,100 ,4
Format:
SIG,<NAME>,<DESCRIPTION>,<MSGID>,<TXTYPE>,<BYTE>,<BIT>,<LEN>,<DEF>,<SNA>,<MIN>,<MAX
>,<TRANS>,<MULT>,<OFFSET>,<UNITS>
Example: SIG,”MUX1”,”MUX ID 1” ,0x10000120,0 ,1 ,0 ,8 ,1 ,0xFF ,0
,255 ,0 ,1 ,0 ,””
Example: SIG,”MUX2”,”MUX ID 2” ,0x20000120,0 ,1 ,0 ,8 ,2 ,0xFF ,0
,255 ,0 ,1 ,0 ,””

Copyright EEPod LLC 2007-2013 5


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

3 SIMUCAN™ SOCKET SERVER INTERFACE


When SimuCAN™ is running, it creates a stream socket server on the local machine (IP address 127.0.0.1, port 54321). Any
development or test application can open this socket as a client and communicate with SimuCAN™ using simple ASCII commands.
3.1 COMMAND REFERENCE
There are four basic commands (read, write start and stop) to control the vehicle network simulation. Using these commands
along with the appropriate sub-commands, the development / test engineer can control every aspect of the network simulation.

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).

Copyright EEPod LLC 2007-2013 6


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

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

Copyright EEPod LLC 2007-2013 7


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

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.

Copyright EEPod LLC 2007-2013 8


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

3.2 EXAMPLE TEST PROGRAM


The following code is an example test program written in Borland C++ Builder that demonstrates the simplicity of writing test
applications using the socket server and simple ASCII command strings to read or write signal values. The sample application
below has both a raw text interface where the user can type in any command as well as a few slider bar interfaces that can change
the signal value by sliding the bar. The source code below only has the code for the first slider bar, as the code for each of them is
the similar.

#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();

Copyright EEPod LLC 2007-2013 9


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

while ((GetTickCount() - StartTime) < 500)


{
Count = pStream->Read(Buffer, sizeof(Buffer));
if (Count != 0)
{
SocketResp->SetTextBuf(Buffer);
break;
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SignalScrollChange(TObject *Sender)
{
char SigName[128];
char Value[128];
char Buffer[128];
/* Get the signal name */
SignalName1->GetTextBuf(SigName, sizeof(SigName));
/* Get the signal value from the scroll bar */
sprintf(Value, "%ld", SignalScroll1->Position);
/* Create the entire command string and send to the socket */
sprintf(Buffer, "WRITE SIG %s %s", SigName, Value);
pStream->Write(Buffer, strlen(Buffer) + 1);
SignalValue1->SetTextBuf(Value);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SignalMax1Change(TObject *Sender)
{
char Buffer[128];
/* Set the new maximum limit of the scroll bar value */
SignalMax1->GetTextBuf(Buffer, sizeof(Buffer));
SignalScroll1->Max = strtol(Buffer, NULL, 0);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SignalMin1Change(TObject *Sender)
{
char Buffer[128];
/* Set the new minimum limit of the scroll bar value */
SignalMin1->GetTextBuf(Buffer, sizeof(Buffer));
SignalScroll1->Min = strtol(Buffer, NULL, 0);
}

Copyright EEPod LLC 2007-2013 10


Release Date: April 3, 2013 SimuCAN User Manual Revision: 1.02

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

Copyright EEPod LLC 2007-2013 11

You might also like