SGE Simulink Library – User Manual
www.sge-ing.de – Version 1.62.67 (2022-07-24 22:21)
1 Introduction
The Simulink Library SGE extends Mathworks Simulink and Stateflow with powerful interfaces and functions that communicate with ETAS INCA software and CAN bus networks.
By combining the extensive functions and intuitive operation of Mathworks Simulink and Stateflow with these interfaces, online functionalities, automation and control tasks that interact with ECUs and CAN bus networks can be implemented conveniently and quickly.
Various ETAS INCA features are supported, such as
Read measured values and calibration parameters
Modify calibration parameters
Determination and switching of the ECU active memory page
Start, stop and pause data acquisition
Activate calibration scenarios
Additionally signals can be received and transmitted in CAN bus networks.
This manual gives information about the topics regarding the SGE Simulink Library only. The SGE Simulink Library is part of the SGE Circus. For help topics regarding general features please refer to the corresponding documentation accessible using the links below.
1.1 SGE Circus user manualThe SGE Circus documentation makes available general information regarding data loading procedure, input handling, preferences, history and other topics concerning all tools. |
1.2 SGE CalcGuide user manualThe SGE CalcGuide is a tool to implement calculation routines by creating graphical flow chart diagrams - included with all tools. |
1.3 SGE Circus videos (external)Videos and tutorials are available on the internet. |
|
For information regarding the version dependent software changes please refer to the Release notes accessible using the corresponding menu item inside the SGE Circus.
2 Installation / Usage
For installation, the compressed file of the SGE Simulink Library is unpacked into a directory that is included in the search path of MATLAB. Alternatively, the path to the files must be added to the MATLAB path. Use the “Set path” toolbar entry or the “pathtool” command to edit the MATLAB path. Then, after updating (F5), the library is displayed in the Simulink Library Browser.
3 Activation / Licensing
You need a proper license file to run most of the blocks of the SGE Simulink Library. If you did not receive a license file yet please remove all portable hard drives and network interfaces from the computer to allow proper detection of the license id. When running blocks of the library you will receive a welcome message that enables to request a license.
4 Help / Support
A detailed help specific for each block is available when pressing the “Help” button in the block parameters dialog. The block parameters dialog is available by double clicking onto a block with the mouse.
If you need assistance regarding the installation or handling of the SGE Simulink Library or if you experience any problems do not hesitate to contact our support by sending us an email to support@sge-ing.de . A set of introduction documents and examples is available using the SGE Circus “?” menu item.
5 Supported hardware / software
The library supports interfaces to the following hardware and software versions:
5.1 MATLAB/ Simulink
Release R2013b (8.2) or newer
5.2 CAN hardware interfaces
ETAS ES581.3
Intrepid ValueCAN3
5.3 Calibration software
ETAS INCA 7.x with “Toolserver” activated in the INCA user options
6 Data acquisition
In order to develop and test a simulation reliably, there is a comfortable way for measurement data acquisition. Simulink Signal logging feature allows you to select signals whose data is captured during simulation and stored in the workspace at the end of simulation. This data can then be automatically saved to a file that can be opened by the SGE Circus as a measurement data file.
6.1 Configuration
Proceed as follows to set up the signal acquisition:
Assign an signal name and activate signal logging for the signals to acquire.
Configure to automatically save the data to the workspace at the end of the simulation. Use “logsout” as variable name. In older Simulink version you additionally need to select the format “Dataset”.
Configure to automatically save the data to a file at the end of the simulation. The models StopFcn callback from the Model Properties can be used to achieve this. The function “logsout2mat” (included in the SGE Simulink library) performs the necessary tasks. The measurement files are created in the current MATLAB working directory. At the end of each simulation, a new file with a unique name is created. Custom file names can be passed to the “logsout2mat” as a string parameter.
Example: logsout2mat([datestr(now,'yyyy-mm-dd_HH-MM-SS') '_CustomLogFile.mat']);
As the following illustrations show, the Bouncing Ball Example from Simulink can be evaluated in this way with all the powerful capabilities of the SGE DataArtist.
6.2 Time axis consideration
The saved files contain the Simulink simulation time as time axis. This is determined by the settings regarding the solver and does not correspond to the actual time when using the "Realtime slowdown" block.
In order to evaluate the measurement files related the current time, the "Realtime slowdown" block offers the possibility to make the current time available as an output. This signal can also be acquired and then used to display the measurement data related the current time X-axis (xy display).
7 Block reference
The following section describes the function and parameters of all blocks of the SGE Simulink Library.
7.1 Common
7.1.1 Realtime slowdown
This block slows down the simulation to realtime and provides an output for the current simulation timestep and time.
Block parameters:
Simulation time output
When enabled the block provides an output that serves the current simulation time.
Simulation timestep output
When enabled the block provides an output that serves the current simulation timestep.
7.2 ETAS INCA
7.2.1 ECU working page active
This block reads the working page state from ETAS INCA via COM interface.
The output returns the active ECU page using the following definition:
0: Working page is active
1: Working page is not active
-1: Unknown / error
Block parameters:
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
7.2.2 Set ECU active page
This block enables to set the active ECU page in ETAS INCA via COM interface.
Use the input to activate the page corresponding to the following definition:
0: Reference page
1: Working page
Block parameters:
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Skip unchanged state
When enabled the active page is only set in ETAS INCA when the blocks input value changed since the previous run. This option can be used to increase performance.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for automatic.
7.2.3 Get INCA values
This block supports to read numeric values from ETAS INCA via COM interface.
The elements must be measurement or calibration elements. Measurement elements to read will be added to the current experiment automatically. To read single elements of an array you need to append the array index (e.g. _[0]).
To retrieve values from INCA inside a callback use the following code. In this example the numeric value "VarData" of the experiment element "VarName" is retrieved:
Inca = SGEIncaBridge();
VarData = Inca.GetValue('VarName');
Block parameters:
INCA element names
Specify the elements (calibration values, measurement values) as a space separated list of element names. In case a name contains spaces it must be enclosed in "".
Example: eng_speed "throttle pos" temp_[1] CAL_PAR1
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Test values
Test values can be returned when INCA, the ECU or additional measurement hardware is not present. Set to {} to actually retrieve values from ETAS INCA. Otherwise define a cell array of values to return. For mixed mode elements of the cell array may be empty. In this case empty elements are read from INCA and not empty elements are returned directly.
Examples:
: Read all values from INCA
{1,2,3} : Use test values for all three outputs.
{1,[],3}: Read output 2 from INCA and use test values for outputs 1 and 3.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
7.2.4 Set INCA values
This block supports to write numeric calibration values to ETAS INCA via COM interface.
The elements must be calibration elements. Writing to measurement elements is only supported if this feature is activated in the INCA options.
To write values to INCA inside a callback use the following code. In this example the numeric value "VarData" is written to the experiment element named "VarName":
Inca = IncaBridge();
Inca.SetValue('VarName',VarData);
Block parameters:
INCA element names
Specify the elements to calibrate (calibration values, measurement values) as a space separated list of element names. In case a name contains spaces it must be enclosed in "".
Example: MIN_OFFSET1 "THRS LIMIT"
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Skip unchanged values
When enabled values will only be send to ETAS INCA when their value changed since the previous run. This option can be used to increase performance.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
7.2.5 Get INCA online state
This block reads the acquisition state from ETAS INCA via COM interface.
The output returns the data acquisition state using the following definition:
0: Measurement and recording stopped.
1: Measurement is running.
2: Measurement and recording is running.
-1: Unknown / error
Block parameters:
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
7.2.6 Start INCA recording
This block starts the recording of ETAS INCA via COM interface. Use this block inside a triggered or enabled subsystem to start recording depending or an external signal or condition.
Block parameters:
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Measure file comment
Enter a string to write to the measure file as a comment.
Skip if recording is already running
Use this option to avoid warnings when the recording is already running.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
7.2.7 Stop INCA recording
This block stops the recording of ETAS INCA and saves a measurement file via COM interface. Use this block inside a triggered or enabled subsystem to pause recording depending or an external signal or condition.
Block parameters:
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Measure filename
Enter the desired measurement filename.
Skip if recording is not running
Use this option to avoid warnings when the recording is not running.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
7.2.8 Pause INCA recording
This block pauses the recording of ETAS INCA via COM interface. Use this block inside a triggered or enabled subsystem to stop recording depending or an external signal or condition.
Block parameters:
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Skip if recording is not running
Use this option to avoid warnings when the recording is not running.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
7.2.9 Activate Scenario
This block activates an existing calibration scenario in ETAS INCA via COM interface. Use this block inside a triggered or enabled subsystem to activate scenarios depending or an external signal or condition.
Block parameters:
Scenario name
The name of the scenario to activate. The scenario must already exist in the current ETAS INCA experiment.
INCA device name
Leave empty to use the default device or enter the exact name of the INCA device to use.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for automatic.
7.3 CAN Bus
7.3.1 Get CAN values
This block supports to read values from a CAN bus using an ETAS ES581 or Intrepid ValueCAN3 adapter.
Block parameters:
CAN signal names
Specify the signals to read as a space separated list of names. In case a name contains spaces it must be enclosed in "".
Example: eng_speed "throttle pos" temperature
DBC filename
Enter the name of the *.dbc file to use.
Baudrate
Enter the baud rate of the CAN bus.
Device number
Enter the number of the ETAS ES581.3 to use (in case multiple are connected to the computer).
Device port
Choose the port of the ETAS ES581.3 to use.
Buffer mode
Choose the mode to values from the CAN device buffer.
one value: Receive one message from buffer. Outport data will remain unchanged no message is in buffer.
wait for one value: Receive one message. Wait until all signals were received (with timeout). Values not received before timeout will remain unchanged.
entire buffer: Receive all messages from buffer.
Timeout
Timeout value in milliseconds only relevant for Mode "wait for one message".
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
7.3.2 Send CAN values
This block supports to send values to a CAN bus using an ETAS ES581.3 or Intrepid ValueCAN3 adapter.
Block parameters:
CAN signal names
Specify the signals to send as a space separated list of names. In case a name contains spaces it must be enclosed in "".
Example: eng_speed "throttle pos" temperature
DBC filename
Enter the name of the *.dbc file to use.
Baudrate
Enter the baud rate of the CAN bus.
Device number
Enter the number of the ETAS ES581.3 to use (in case multiple are connected to the computer).
Device port
Choose the port of the ETAS ES581.3 to use.
Skip unchanged values
When enabled values will only be send to CAN bus when their value changed since the previous run. This option can be used to increase performance.
Throw error in case of failure
Enable this option to stop the simulation in case of failure by throwing an error. Otherwise simulation may proceed after displaying a message.
Sample time
Set to a scalar numeric value > 0 or -1 for inherited.
8 General information
Duplication, processing, distribution or any form of commercialization of the documents content beyond the scope of the copyright law shall require the prior written consent of the SGE Ingenieur GmbH. All trade and product names given in this document may also be legally protected even without special labeling (e.g. as a trademark).
MATLAB, Simulink and Stateflow are registered trademarks of The MathWorks Inc., Natick, MA, USA.
INCA is a registered trademark of ETAS GmbH, Stuttgart.
The SGE Circus includes Third Party Software. For details please refer to the → SGE Circus documentation.
SGE Ingenieur GmbH – www.sge-ing.de
Copyright 2011-