ConfigurationDeskUsingDemoProjects
ConfigurationDeskUsingDemoProjects
If possible, always provide the serial number of the hardware, the relevant dSPACE License
ID, or the serial number of the CmContainer in your support request.
Important Notice
This publication contains proprietary information that is protected by copyright. All rights
are reserved. The publication may be printed for personal or internal use provided all the
proprietary markings are retained on all printed copies. In all other cases, the publication
must not be copied, photocopied, reproduced, translated, or reduced to any electronic
medium or machine-readable form, in whole or in part, without the prior written consent
of dSPACE GmbH.
This publication and the contents hereof are subject to change without notice.
Contents
3
May 2024 ConfigurationDesk Using Demo Projects
Contents
4
ConfigurationDesk Using Demo Projects May 2024
About This Document
Contents The dSPACE software provides multiple demo projects for ConfigurationDesk.
This document provides descriptions of the demo projects or refers you to
detailed descriptions in other documents.
Symbol Description
Indicates a hazardous situation that, if not avoided,
V DANGER
will result in death or serious injury.
Indicates a hazardous situation that, if not avoided,
V WARNING could result in death or serious injury.
Indicates a hazardous situation that, if not avoided,
V CAUTION could result in minor or moderate injury.
Indicates a hazard that, if not avoided, could result in
NOTICE
property damage.
Indicates important information that you should take
Note
into account to avoid malfunctions.
Indicates tips that can make your work easier.
Tip
Indicates a link that refers to a definition in the
glossary, which you can find at the end of the
document unless stated otherwise.
Follows the document title in a link that refers to
another document.
Naming conventions dSPACE user documentation uses the following naming conventions:
5
May 2024 ConfigurationDesk Using Demo Projects
About This Document
Special Windows folders Windows‑based software products use the following special folders:
Accessing dSPACE Help and After you install and decrypt Windows‑based dSPACE software, the
PDF files documentation for the installed products is available in dSPACE Help and as PDF
files.
dSPACE Help (local) You can open your local installation of dSPACE Help:
§ On its home page via Windows Start Menu
§ On specific content using context-sensitive help via F1
PDF files You can access PDF files via the icon in dSPACE Help. The PDF
opens on the first page.
6
ConfigurationDesk Using Demo Projects May 2024
Overview and Access
Available demo projects The following demo projects and applications are available for you to open after
you first started ConfigurationDesk.
Tip
The hardware topologies in most demo projects represent only one of the
dSPACE hardware systems that provide the required channel types.
Tutorial demo projects The tutorial demo projects are based on different
ConfigurationDesk tutorials that guide you through the basic steps of different
use scenarios. You should only use them while working through the related
tutorial.
7
May 2024 ConfigurationDesk Using Demo Projects
Overview and Access
8
ConfigurationDesk Using Demo Projects May 2024
Overview of ConfigurationDesk Demo Projects
9
May 2024 ConfigurationDesk Using Demo Projects
Overview and Access
10
ConfigurationDesk Using Demo Projects May 2024
Overview of ConfigurationDesk Demo Projects
11
May 2024 ConfigurationDesk Using Demo Projects
Overview and Access
12
ConfigurationDesk Using Demo Projects May 2024
Accessing ConfigurationDesk Demo Projects and Applications
Opening demo projects You can open demo projects like every ConfigurationDesk project, for example,
via File – Open – Open Project and Application. ConfigurationDesk opens
the Project Location Manager, where you open a demo project via context
menu from the list of ConfigurationDesk projects in the default project location.
You can also double-click a specific application to activate it after the project is
opened. If you do not select an application, the first application in the project
will automatically be activated.
Activating applications To activate a different application in an open demo project, right-click the
application in the Project Manager and select Activate Application from the
context menu.
File locations The files of the demo projects are automatically unpacked to the Documents
folder when ConfigurationDesk is first started.
They are also backed up in ZIP archives, which are located in the
<ConfigurationDesk installation folder>\Demos\ConfigurationDesk
folder after you install the dSPACE software.
13
May 2024 ConfigurationDesk Using Demo Projects
Overview and Access
14
ConfigurationDesk Using Demo Projects May 2024
Bus Communication Demos
Description of Bus Manager For a description of the Bus Manager demos, refer to Overview of the Bus
demos Manager Demos (ConfigurationDesk Bus Manager Implementation Guide ).
15
May 2024 ConfigurationDesk Using Demo Projects
Bus Communication Demos
Tip
Features in focus Simulink® model with RTICANMM blocks The connected CANMMDemo
Simulink model uses blocks from the RTI CAN MultiMessage Blockset to model
CAN communication with two CAN controllers.
16
ConfigurationDesk Using Demo Projects May 2024
CfgCANMMDemo Project: Implementing CAN Communication
Some function block settings, such as the baud rate, are derived from the
RTICANMM ControllerSetup blocks. Other hardware-related settings, such as the
transceiver settings, are accessible via properties of the function blocks.
17
May 2024 ConfigurationDesk Using Demo Projects
Bus Communication Demos
Build results Build results are already available in the Project Manager.
Actions and adjustments If you have a dSPACE hardware system that provides the required CAN 1
channel type, you can download the real-time application to it. For this
purpose, the connection state of the ConfigurationDesk application must be
Matching platform connected. The easiest way to achieve this is to register
your hardware platform and replace the hardware topology by scanning the
registered platform. For more information and instructions, refer to Managing
Real-Time Hardware (ConfigurationDesk Real-Time Implementation Guide ).
If your dSPACE hardware system is different from the example system in the
hardware topology, you have to adjust settings such as the hardware resource
assignment. Then, you have to build a new real-time application. Refer to
Building Real-Time Applications (ConfigurationDesk Real-Time Implementation
Guide ).
18
ConfigurationDesk Using Demo Projects May 2024
CfgCANMMDemo Project: Implementing CAN Communication
Note
Before you start the build process, you have to create S-functions for the RTI
CAN MultiMessage blocks.
1. Double-click the RTICANMM GeneralSetup block to open its
configuration dialog.
2. In the dialog, click Options – Create S-Functions for All CAN Blocks.
19
May 2024 ConfigurationDesk Using Demo Projects
Bus Communication Demos
Use scenario The LINMMAppl application serves to demonstrate simple LIN communication
between two LIN controllers using the RTI LIN MultiMessage Blockset.
Tip
Features in focus Simulink® model with RTILINMM blocks The connected LINMMDemo
Simulink model uses blocks from the RTI LIN MultiMessage Blockset to model
LIN communication with two LIN controllers.
LIN controllers are hardware components that are located on real-time hardware.
With a SCALEXIO system, access is realized in ConfigurationDesk via LIN function
blocks, i.e., the RTILINMM ControllerSetup blocks cannot directly access the
controllers. They serve as an interface between the real-time hardware (which is
accessed via the LIN function blocks) and the LIN communication that is modeled
in the RTILINMM MainSetup blocks.
20
ConfigurationDesk Using Demo Projects May 2024
CfgLINMMDemo Project: Implementing LIN Communication
Function blocks and hardware resources The Configuration Port blocks are
mapped to LIN function blocks to which LIN channels of the hardware topology
are assigned.
Most function block settings, such as the baud rate, are derived from the
RTILINMM ControllerSetup blocks.
21
May 2024 ConfigurationDesk Using Demo Projects
Bus Communication Demos
Build results Build results are already available in the Project Manager.
Actions and adjustments If you have a dSPACE hardware system that provides the required LIN 1
channel type, you can download the real-time application to it. For this
purpose, the connection state of the ConfigurationDesk application must be
Matching platform connected. The easiest way to achieve this is to register
your hardware platform and replace the hardware topology by scanning the
registered platform. For more information and instructions, refer to Managing
Real-Time Hardware (ConfigurationDesk Real-Time Implementation Guide ).
If your dSPACE hardware system is different from the example system in the
hardware topology, you have to adjust settings such as the hardware resource
assignment. Then, you have to build a new real-time application. Refer to
Building Real-Time Applications (ConfigurationDesk Real-Time Implementation
Guide ).
22
ConfigurationDesk Using Demo Projects May 2024
CfgLINMMDemo Project: Implementing LIN Communication
Note
Before you start the build process, you have to create S-functions for the RTI
LIN MultiMessage blocks.
1. Double-click the RTILINMM GeneralSetup block to open its
configuration dialog.
2. In the dialog, click Options – Create S-Functions for All LIN Blocks.
23
May 2024 ConfigurationDesk Using Demo Projects
Bus Communication Demos
24
ConfigurationDesk Using Demo Projects May 2024
CfgBasicIODemo Project: Demonstrating Basic I/O Functionalities
The model sends and receives voltage signals to ConfigurationDesk via model
port blocks.
The equation of motion for the center of the mass driven by an external force is:
25
May 2024 ConfigurationDesk Using Demo Projects
CfgBasicIODemo Project: Demonstrating Basic I/O Functionalities
The output of the Integrator 1 block (v) is multiplied with d/m in the Equation
Block. The output x of the Integrator 2 block can be measured on DAC
channel 1. It is added to x disp, and the sum is multiplied with C/m in the
Equation Block. The output of the ADC is the exciting displacement of the
mass: x disp.
In the case of a sine-like excitation, the driving force is:
F = x disp ⋅ Cx disp = u ⋅ cos 2π ⋅ f ⋅ t
The solution of the equation of motion is:
x t = xo ⋅ cos 2π ⋅ f ⋅ t − α
A harmonic oscillation with the original frequency, an amplitude xo, and a phase
α, both depending on the model parameters.
In the case of a square-like excitation, the driving force results from a single
displacement of u, twice in the period T = 1/f:
F =u⋅C
The solution of the equation of motion is:
x t = xo ⋅ exp − d/2m ⋅ t ⋅ cos ω ⋅ t
An exponentially decreasing sine wave with the natural frequency:
ω= C/m − d2 /4m2
26
ConfigurationDesk Using Demo Projects May 2024
Using the DemoSpringMassDamper Application
For more information on the used function block types, refer to:
§ Voltage Out (ConfigurationDesk I/O Function Implementation Guide )
§ Voltage In (ConfigurationDesk I/O Function Implementation Guide )
Build results and wiring information Build results and the calculated wiring
information for an external cable harness are already available in the Project
Manager.
Actions and adjustments § You can change the spring constant, the damping coefficient, and the mass in
the Model Parameters block of the Simulink model.
§ If you have a dSPACE hardware system that provides the required Analog Out
and Analog In channel types, you can download the real-time application
to it. For this purpose, the connection state of the ConfigurationDesk
application must be Matching platform connected. For more information
and instructions, refer to Managing Real-Time Hardware (ConfigurationDesk
Real-Time Implementation Guide ).
For information and instructions on downloading the real-time application to
a matching platform, refer to Loading and Executing Real-Time Applications
(ConfigurationDesk Real-Time Implementation Guide ).
27
May 2024 ConfigurationDesk Using Demo Projects
CfgBasicIODemo Project: Demonstrating Basic I/O Functionalities
Note
§ You can connect external devices to dSPACE hardware using the wiring
information from the calculated external cable harness. Refer to Calculating
an External Cable Harness (ConfigurationDesk Real-Time Implementation
Guide ).
Note
§ Make sure that the device pins and the I/O connector pins of the
dSPACE hardware are connected according to the calculated wiring
information. You can export the wiring information to an XML or
Microsoft Excel™ (XLSX) file.
§ If you apply changes to the configuration that affect the wiring
information, such as changing the hardware resource assignment, you
must recalculate the external cable harness.
Note
If you run the demo without external wiring, it can be used only
with test automation (TA) access in ControlDesk. In the layout,
set Voltage/TA_Switchvalue to Substitute value. When you adjust
Voltage/TA_Replacevalue, the change of mass position will be
simulated and displayed in the plotter and the red Voltage/MDL_Signal
will respond to the changes in a damped curve.
28
ConfigurationDesk Using Demo Projects May 2024
CfgCustomFMUDemo Project: Getting Started with the FMI Standard
Features in focus Handcoded FMU with input signal The application provides the handcoded
Simple_FIR_Filter FMU, which implements a simple finite impulse response
(FIR) filter. The input signal to the FMU is provided by the SignalGenerator
Simulink implementation container (SIC file). Both model implementations are
located in the Models folder.
29
May 2024 ConfigurationDesk Using Demo Projects
CfgCustomFMUDemo Project: Getting Started with the FMI Standard
For more information on working with FMUs, refer to Working with Functional
Mock-up Units (FMU Files) (ConfigurationDesk Real-Time Implementation
Guide ).
Actions and adjustments Trying out the demo application The CfgCustomFMUDemo application
can be executed on a SCALEXIO system. For experimenting, your
ConfigurationDesk installation contains a ControlDesk demo project that is
based on this ConfigurationDesk demo project. The CD_CustomFMUDemo for
ControlDesk is located in the same folder as the CfgCustomFMUDemo:
Documents\dSPACE\ConfigurationDesk\<ConfigurationDesk
version>\CustomFMUDemo.
It is also available in a ZIP archive, which is located in the following folder:
<ConfigurationDesk installation
folder>\Demos\ConfigurationDesk\CustomFMUDemo
To try out the demo application, you have to perform the following steps:
1. Perform a build process. During the build process, ConfigurationDesk creates
the following files:
§ DemoSimpleFIRFilter.rta
§ DemoSimpleFIRFilter.sdf
The files are available in the BuildResults folder.
For more information and instructions, refer to Building Real-Time
Applications (ConfigurationDesk Real-Time Implementation Guide ).
2. Replace the DemoSimpleFIRFilter.sdf file in the ControlDesk experiment
with the newly created DemoSimpleFIRFilter.sdf file.
3. You can now start experimenting in ControlDesk. ControlDesk downloads
the DemoSimpleFIRFilter.rta file to your SCALEXIO system and starts
the simulation.
For more information and instructions, refer to Experimenting with a
SCALEXIO System (SCALEXIO – Hardware and Software Overview ).
30
ConfigurationDesk Using Demo Projects May 2024
Using the DemoSimpleFIRFilter Application
You can change the filter coefficient parameters from the Filter tap
Coefficient Parameters Variable Array to verify its effect on the output
of the FMU.
31
May 2024 ConfigurationDesk Using Demo Projects
CfgCustomFMUDemo Project: Getting Started with the FMI Standard
32
ConfigurationDesk Using Demo Projects May 2024
CfgUserStorageDemo Project: Using a SCALEXIO SSD
Use scenario The UserStorageApplicaton application provides custom function block types
that let you use a SCALEXIO SSD.
Features in focus SCALEXIO SSD The SCALEXIO SSD is an optional feature of the SCALEXIO
Processing Unit. The individual user data on the SSD can be accessed via FTP
(ftp://<SCALEXIO_IP_address>/userstorage1).
For more information on the hardware specifics, refer to Features
of the SCALEXIO Processing Unit (SCALEXIO Hardware Installation and
Configuration ).
Custom function block types Two custom function block types are provided
in the demo application: User Storage Write and User Storage Read.
33
May 2024 ConfigurationDesk Using Demo Projects
CfgUserStorageDemo Project: Using a SCALEXIO SSD
The custom function files are located in the project folder and are also displayed
in the Project Manager.
Note
The signal chain of the application contains only a User Storage Write
function block for the following reasons:
§ You cannot write to and read from the same file simultaneously.
§ Before you can read from the SCALEXIO SSD, data must have been
written to it.
Tip
34
ConfigurationDesk Using Demo Projects May 2024
Using the UserStorageApplication Application
Actions and adjustments § If you have a SCALEXIO system with a SCALEXIO SSD, you can register and
scan the platform to create a matching hardware topology that contains the
SCALEXIO SSD. Refer to Managing Real-Time Hardware (ConfigurationDesk
Real-Time Implementation Guide ).
You can then build, download, and execute the real-time application.
Refer to:
§ Building Real-Time Applications (ConfigurationDesk Real-Time
Implementation Guide )
§ Loading and Executing Real-Time Applications (ConfigurationDesk Real-Time
Implementation Guide ).
§ To work with the data written to the SCALEXIO SSD with a real-time
application using the User Storage Write custom function block type, you
can create, build, download, and execute an additional real-time application
using the User Storage Read custom function block type. You can do so in
the same ConfigurationDesk project or create a new one.
§ You can use the demo as a basis for a more complex use scenario that
writes/reads different data.
35
May 2024 ConfigurationDesk Using Demo Projects
CfgUserStorageDemo Project: Using a SCALEXIO SSD
36
ConfigurationDesk Using Demo Projects May 2024
EDrivesControlDemo Project: Example of Electric Motor Control Using the DS6121 Multi-I/O Board
Demo project overview In the demo applications, the controller is implemented in a Simulink® model.
It controls the generation of the three-phase PWM signal, which is fed into the
PWM channels of the DS6121 Multi-I/O Board. Refer to the following illustration:
37
May 2024 ConfigurationDesk Using Demo Projects
EDrivesControlDemo Project: Example of Electric Motor Control Using the DS6121 Multi-I/O Board
HS
Duty Gate Motor Motor
cycles signals phases
3 6 3
Controller LS Inverter
PWM
Pulse center
trigger DC link
voltage
Voltage In
Motor current
EndOfConversion event 3
Voltage In
3
Hall encoder
signal
Hall Encoder In
Digital incremental
Digital Incremental encoder signals
Encoder In
38
ConfigurationDesk Using Demo Projects May 2024
Introduction to the EDrivesControlDemo Project
Note
Note
The measured analog values are adapted in the Input subsystem of the
controller model.
Control algorithm in Simulink The controller reads the position and speed
values, the phase currents and the DC link voltage. It calculates the values
that are required for the modulation of the PWM signal, such as duty cycle or
frequency, to the function block that generates the PWM signals.
Cascaded controller structure The control algorithms in both demos have a cascaded control architecture with
three levels. Refer to the following illustration:
Calculated Calculated
current voltage
Speed set point set point
Speed Duty
set point controller Current cycles
controller
Current Modulator
set point
Voltage
set points
39
May 2024 ConfigurationDesk Using Demo Projects
EDrivesControlDemo Project: Example of Electric Motor Control Using the DS6121 Multi-I/O Board
Speed controller The speed controller is located at the top level of the
controller model. It contains a PI controller that uses the difference between the
speed setpoint and the measured speed values to calculate a correction value
that is then applied to the current controller.
Demo parameters The controller in the Simulink model contains the Demo Parameters subsystem.
This subsystem contains all the relevant parameters that are loaded from the
MATLAB workspace. You can change the demo parameters in real time in a
ControlDesk application. The parameters are grouped as follows:
§ Setpoints group:
The setpoints are user-defined values for the different controller levels, i.e., the
voltage setpoint and the current setpoint. The Setpoints group also contains
a parameter that is used to specify the control mode such as speed control or
open loop control.
§ Controller Parameters group:
This group contains the controller gains and filter time constants for the speed
controller and the current controller in the demo applications.
§ Setpoint Limits group:
This group contains constants that are used to limit the user-defined input
setpoints, or to saturate the output of the PI controllers.
Initializing the controller The default values of the demo parameters for
initializing the controller are specified via MATLAB script files. In the script files
you can also configure the motor settings and the controller settings. There is a
specific MATLAB script available for each demo application:
§ PMSM_Demo_ini.m
§ BLDC_Demo_ini.m
If you start a ConfigurationDesk build process including a model build process,
the script files are executed automatically. You can specify your own script files
via the PreLoadFcn model callback in the Model Explorer in Simulink.
Demo applications The demo project contains the following ConfigurationDesk applications:
§ PMSM_demo for controlling a permanent magnet synchronous motor
(PMSM) with field-oriented control. Refer to Using the PMSM_Demo
Application on page 41.
§ BLDC_demo for controlling a brushless DC motor (BLDC) in block
commutation mode. Refer to Using the BLDC_Demo Application on page 43.
40
ConfigurationDesk Using Demo Projects May 2024
Using the PMSM_Demo Application
Introduction The PMSM_Demo application shows an example of using the DS6121 Multi-I/O
Board for controlling a permanent magnet synchronous motor (PMSM) with
field-oriented control. In this demo, sinusoidal phase currents are generated to
control the motor. This is called sine commutation. Field-oriented control means
that the coordinate system of the control loop is rotated with the rotor position.
This converts the sinusoidal setpoints for the currents into constant setpoints that
are easier to control.
Controller structure The controller in Simulink® is divided into different subsystems as shown in the
following illustration:
Output subsystem The Output subsystem contains the output signals that
are used by the Multi-Channel PWM Out function block in ConfigurationDesk
to generate sine commutated PWM signals.
41
May 2024 ConfigurationDesk Using Demo Projects
EDrivesControlDemo Project: Example of Electric Motor Control Using the DS6121 Multi-I/O Board
Generation of sinusoidal The sinusoidal-commutated PWM signal for controlling the electric motor
commutated PWM signals is generated by the Multi-Channel PWM Out function block in
ConfigurationDesk.
Initializing the controller You must specify default values for initializing the controller in the
PMSM_Demo_ini.m script file:
PWM period You can specify the PWM period via the T_PWM parameter.
Machine parameters The script file lets you specify the following machine
parameters:
§ Stator inductance and stator resistance
§ The flux induced by the magnet
§ Number of pole pairs
You must specify the PolePairs parameter according to the number of pole
pairs of the motor and the Hall encoder. This value must also be specified for
the Number of Pole Pairs property of the Hall Encoder In function block in
ConfigurationDesk.
For more information, refer to Introduction to Hall Encoders
(ConfigurationDesk I/O Function Implementation Guide ).
§ The DC link voltage
§ Maximum values for currents and the mechanical speed
Controller settings The script file lets you specify the following parameters:
§ Default controller settings, for example, proportional or integral gain
§ Setpoints for the currents and the mechanical velocity
§ The source of the motor position (Hall encoder or incremental encoder)
§ Parameters for the open loop control mode
For the open loop control mode, you must specify the voltage
values (PMSM_Ctrl_v_d_Set and PMSM_Ctrl_v_q_Set), and the
PMSM_Ctrl_fRS_Set parameter, which indicates the rotation frequency of the
motor.
42
ConfigurationDesk Using Demo Projects May 2024
Using the BLDC_Demo Application
§ Field weakening
You can specify the field weakening current via the
Const_Id_Fieldweakening parameter. The SW_Fieldweakening parameter
lets you switch the field weakening on or off.
Introduction The BLDC_Demo application is an example of using the DS6121 Multi-I/O Board
for controlling a brushless DC motor in block commutation mode.
Controller structure The controller in Simulink® is divided into different subsystems as shown in the
following illustration:
43
May 2024 ConfigurationDesk Using Demo Projects
EDrivesControlDemo Project: Example of Electric Motor Control Using the DS6121 Multi-I/O Board
Generation of the block- The block-commutated PWM signal for controlling the electric motor
commutated PWM signal is generated by the Block-Commutated PWM Out function block in
ConfigurationDesk.
44
ConfigurationDesk Using Demo Projects May 2024
Using the BLDC_Demo Application
A+
A-
B+
B-
C+
C-
Initializing the controller You must specify default values for initializing the controller in the
BLDC_Demo_ini.m script file:
PWM period You can specify the PWM period via the T_PWM parameter.
Machine parameters The script file lets you specify the following machine
parameters:
§ Stator inductance and stator resistance
§ The flux induced by the magnet
§ Number of pole pairs
You must specify the PolePairs parameter according to the number of pole
pairs of the motor and the Hall encoder. This value must also be specified
for the Number of Pole Pairs property of the Hall Encoder In function
block in ConfigurationDesk. For more information, refer to Introduction to Hall
Encoders (ConfigurationDesk I/O Function Implementation Guide ).
Note
Controller settings The script file lets you specify the following parameters:
§ Default controller settings, for example, proportional or integral gain
§ The speed setpoint and the current setpoint
§ The source of the motor position (Hall encoder or incremental encoder)
45
May 2024 ConfigurationDesk Using Demo Projects
EDrivesControlDemo Project: Example of Electric Motor Control Using the DS6121 Multi-I/O Board
46
ConfigurationDesk Using Demo Projects May 2024
EngineControlDemo Project: Controlling an Engine
Use scenario The EngineControl application serves to demonstrate the control of a 6-cylinder
four-stroke piston engine.
Features in focus Signal chain for engine control functionality Together, the
ConfigurationDesk engine control I/O functionality and the connected
EngineControl Simulink® model provide the signal chain for engine control:
§ The Engine Control Setup function block specifies basic characteristics of
the engine, such as the number of cylinders. The function block works as
a provider: Other function blocks can use it to obtain information on the
characteristics of the specified engine. It provides, for example, the pulses for
the Injection Out and Ignition Out function blocks.
47
May 2024 ConfigurationDesk Using Demo Projects
EngineControlDemo Project: Controlling an Engine
48
ConfigurationDesk Using Demo Projects May 2024
Using the EngineControl Application
§ The Cam In function block measures the phase shift angle between the
camshaft and the coupled crankshaft.
§ Based on the top dead center angles configured in the Engine Control Setup
block, the Injection Out and Ignition Out function blocks generate injection
and ignition pulses for each cylinder of the engine.
For the runtime configuration of the ignition and injection pulses, a
subsystem is assigned to each cylinder (Update_InjIgn_Cyl[1–6]). Each of these
subsystems is executed once per engine cycle at a given angle before the top
dead center (TDC) of the assigned cylinder.
§ The Knock In function block measures and processes knock sensor signals.
The result is provided to the behavior model and can be used, for example, to
avoid/minimize pre-ignitions caused by improper ignition timing.
§ Within a subsystem executed before the TDC of each cylinder
(Update_Knock_MW), start and end angles of the measurement performed
for each cylinder are configured.
§ The read-out of the knock values is performed within a separate subsystem
(Read_Knock_Data), which is executed immediately after the end of each
cylinder-related measuring process.
For more information on ConfigurationDesk engine control I/O functionality,
refer to Engine Control (ConfigurationDesk I/O Function Implementation
Guide ).
49
May 2024 ConfigurationDesk Using Demo Projects
EngineControlDemo Project: Controlling an Engine
Build results Build results are already available in the Project Manager.
Actions and adjustments You are not required to perform specific actions because the demo illustrates a
finished ConfigurationDesk application.
However, you are free to adjust the configuration and, for example, start a new
build process.
You can also use the demo as a basis for a real use scenario that requires engine
control functionality.
50
ConfigurationDesk Using Demo Projects May 2024
Using the EngineControl Application
51
May 2024 ConfigurationDesk Using Demo Projects
EngineControlDemo Project: Controlling an Engine
52
ConfigurationDesk Using Demo Projects May 2024
MPTurnlampDemo Project: Using a Multimodel, Multi-Processing-Unit Application
53
May 2024 ConfigurationDesk Using Demo Projects
MPTurnlampDemo Project: Using a Multimodel, Multi-Processing-Unit Application
54
ConfigurationDesk Using Demo Projects May 2024
Using the Turnlamp Application
Build results Build results are already available in the Project Manager.
Actions and adjustments § If you have a dSPACE hardware system that provides multiple processing
units, you can download the real-time application to it. For this purpose, the
connection state of the ConfigurationDesk application must be Matching
platform connected. For more information and instructions, refer to
Managing Real-Time Hardware (ConfigurationDesk Real-Time Implementation
Guide ).
The processing units must be connected via IOCNET. Refer to Communication
Network of a SCALEXIO System (SCALEXIO Hardware Installation and
Configuration ).
The processing units must be assigned to the processing unit
applications/application processes of the models. Refer to How to Assign
Processing Units to Processing Unit Applications (ConfigurationDesk Real-Time
Implementation Guide ).
For information and instructions on downloading the real-time application to
a matching platform, refer to Loading and Executing Real-Time Applications
(ConfigurationDesk Real-Time Implementation Guide ).
§ If you downloaded the real-time application to a matching platform, you
can start experimenting in ControlDesk. Your ConfigurationDesk installation
contains a ControlDesk demo project that is based on this ConfigurationDesk
demo project.
The CD_MPTurnlampDemo is located in the same folder as the
MPTurnlampDemo : <Documents folder>\MPTurnlampDemo\. It is also
available in a ZIP archive, which is located in the <ConfigurationDesk
installation folder>\Demos\ConfigurationDesk\MPTurnlampDemo
folder. The files in the Variable Descriptions folder are the build results of
the ConfigurationDesk project.
Refer to Experimenting with a SCALEXIO System (SCALEXIO – Hardware and
Software Overview ).
55
May 2024 ConfigurationDesk Using Demo Projects
MPTurnlampDemo Project: Using a Multimodel, Multi-Processing-Unit Application
§ Use the Turn Signal Lever and the Warning Light Switch to control the
turn signal and the warning lights.
You can, for example, switch the turn-signal lever very quickly from left to
right to provoke errors.
§ Change the Battery Voltage to provoke malfunctions in certain edge cases.
For example, lowering the voltage to ≤ 8.2 V causes the simulated receiver
in the front and rear ECUs to become unstable, thus disturbing the timing of
the generated turn signal.
56
ConfigurationDesk Using Demo Projects May 2024
ModelUsbDemo Project: Accessing USB Mass Storage Devices From a MicroAutoBox III
Use scenario The ModelUsbDemo application provides a custom function for accessing
data on a USB mass-storage device from a real-time application on the
MicroAutoBox III. It also contains a Simulink® model that uses this data at run
time with the help of a Data Store Memory block. This way you can access the
content of large files in real time.
Features in focus Custom function block type The demo application uses a function block of
the custom function block type USB Data Store.
57
May 2024 ConfigurationDesk Using Demo Projects
ModelUsbDemo Project: Accessing USB Mass Storage Devices From a MicroAutoBox III
The custom function files are located in the project folder and are also available
in the Project Manager.
The USB Data Store function block lets you configure the following custom
function-specific properties:
Property Description
File name The name of the file on the USB mass-storage device that should be read and/or written to. The file name can have
any extension. If the file is located in a subdirectory, path components must be separated with a forward slash.
When reading, a file with the configured File name must exist on the connected USB device for the real-time
application to work.
The default value is data_store.bin and matches the file name used in the demo application.
File size The file size in bytes of the file on the USB mass-storage device that should be read and/or written to. When reading,
the file must exist, and it must have the given size. When writing, the resulting file will have the given size.
The default value is 1024 bytes. In the demo application, the configured value 1048576 bytes matches the size of the
demo file (1 MB).
File access Configures when and how the file on the USB mass-storage device is accessed.
The following values are available:
§ Read at application start
§ Write at application stop
Note
58
ConfigurationDesk Using Demo Projects May 2024
Using the ModelUsbDemo Application
Tip
To establish the connection to the data provided by the custom function, the
Simulink model contains a Data Store Memory block with the Data store name
set to USB:
59
May 2024 ConfigurationDesk Using Demo Projects
ModelUsbDemo Project: Accessing USB Mass Storage Devices From a MicroAutoBox III
On the Signal Attributes page of the DataStoreMemory block, the Data type
and Dimensions properties are configured to match the size and data type of
the file on the USB device (here: 1MB = an array of 128 * 1024 entries of the
data type double, which has a size of 8 bytes):
Note
If you read an existing file on your USB device, the data type and array size
(Dimensions) must match the data type of the file's content and the file
size.
60
ConfigurationDesk Using Demo Projects May 2024
Using the ModelUsbDemo Application
The rest of the demo Simulink model contains some simple examples for data
access during run time that are explained in annotations.
Tip
§ You can use the examples together with a prepared file for your USB
device and run the real-time application in a ControlDesk experiment. For
instructions, refer to Actions and adjustments on page 61.
§ The Runtime Increment example illustrates how to use a runnable
function block assigned to an asynchronous task in this context. If you
start the model in Simulink, there will be some warnings because of
potential issues with data integrity. You can ignore them for the given
demo application.
USB port B of the MicroAutoBox III Only the USB port B of the
MicroAutoBox III is connected to the real-time processor of the DS1403
Processor Board. For details and hardware requirements, refer to Accessing USB
Mass Storage Devices with Real-Time Applications (MicroAutoBox III Hardware
Installation and Configuration ).
Actions and adjustments Trying out the demo application To try out the demo application, you must
complete the following steps:
1. Register your MicroAutoBox III platform. For instructions, refer to How
to Register dSPACE Real-Time Hardware (ConfigurationDesk Real-Time
Implementation Guide ).
2. Connect your USB device to the USB port B of the MicroAutoBox III. For
details and hardware requirements, refer to Accessing USB Mass Storage
Devices with Real-Time Applications (MicroAutoBox III Hardware Installation
and Configuration ).
3. Copy the data_store.bin file from the data_store.bin.ZIP container in
the Data subfolder of the project folder to the USB device. The file contains
sample values that match the logic of the demo Simulink model.
Choose one of the following alternatives to copy the file to the USB device:
§ Connect the USB device to your system before connecting it to the
MicroAutoBox III and copy the file to it.
§ Access the USB device via FTP when it is connected to the
MicroAutoBox III and copy the file to the subfolder usb_rt.
4. Load the real-time application to the registered MicroAutoBox III
platform. For instructions, refer to How to Load a Real-Time Application
(ConfigurationDesk Real-Time Implementation Guide ).
5. Optionally: Create a ControlDesk project and experiment to start and
access/visualize the real-time application. Refer to ControlDesk .
The data_store.bin file contains 128 * 1024 double values that are
divided in two halves:
§ The first half contains 16 sections with 4096 identical numbers each. The
numbers are multiples of 1000/4096. The Bank Select subsystem in the
Simulink model calculates the sum of a section.
§ The second half contains zeros, except for the penultimate value, which
is π. The last value is initially zero and is incremented by 0.001 each
61
May 2024 ConfigurationDesk Using Demo Projects
ModelUsbDemo Project: Accessing USB Mass Storage Devices From a MicroAutoBox III
Creating your own application and model You can use the demo
application and model as a basis for your use scenario that reads/writes to a
different file and manipulates the data in different ways.
Note
Make sure that the following conditions are met for your application to
work and to prevent data loss:
§ The File size property of your USB Data Store function block must
match the actual size of the file on your USB device if you read it.
§ On the Signal Attributes page of the Data Store Memory block in your
Simulink model, the Data type and Dimensions properties must be
configured to match the size of the file on your USB device. Beware that
there is no internal cross-check: If the Data Store Memory block is not
configured correctly, the Simulink model may read wrong values from the
file, or the real-time application may simply crash with a segmentation
fault.
§ If you create a new Data Store Memory block in Simulink instead of
copying and adjusting the one from the demo example, you have to set
its parameter StateStorageClass to the value ImportedExternPointer from
the MATLAB Command Window:
set_param('Model/Data Store Memory', 'StateStorageClass',
'ImportedExternPointer')
62
ConfigurationDesk Using Demo Projects May 2024
FunctionalSafetyDemo Project: Example of Using MicroAutoBox III Functional Safety Features
Use scenario The FuSaDemoApp application serves to demonstrate I/O functionality for
functional safety in combination with the MicroAutoBox III.
Features in focus Functional safety with the MicroAutoBox III The MicroAutoBox III FuSa
concept includes a set of functional safety (FuSa) functionalities. These let you
implement elements of functional safety in a prototyping system.
For more basic information, refer to Basics on Using FuSa with the MicroAutoBox
III (ConfigurationDesk I/O Function Implementation Guide ).
FuSa Setup The FuSa Setup function block provides the basic functionality
for implementing functional safety in your system. The function block triggers
basic error responses and lets you enable additional error responses.
You require a FuSa Setup function block that is assigned to the FuSa unit of a
MicroAutoBox III in a ConfigurationDesk application to activate and use the FuSa
functionalities of the MicroAutoBox III.
The FuSa Setup function block triggers error responses according to errors
monitored by different FuSa function blocks that are assigned to it. As
63
May 2024 ConfigurationDesk Using Demo Projects
FunctionalSafetyDemo Project: Example of Using MicroAutoBox III Functional Safety Features
an additional error response, the FuSa Setup function block in the demo
application is configured to trigger an I/O event in the behavior model.
64
ConfigurationDesk Using Demo Projects May 2024
Using the FuSaDemoApp Application
and the behavior model has to return the response value within 0.09 s (Timeout
limit). Because the Error count limit is set to 1, the function block will trigger
the FuSa response at the FuSa Setup function block as soon as more than one
error has occurred. An error is typically either a wrong response or a response
that has been sent too late. The errors need to be consecutive. If a correct
response is given after a single error, the internal error counter is reset to 0.
FuSa Response Trigger The FuSa Response Trigger function block works
as a monitor that can be triggered directly from within the behavior model. In
the demo application, no meaningful logic is connected to the function block in
the Simulink model. The connected value is simply set to 0 so that no error
response is triggered. You can however use ControlDesk to manipulate the
65
May 2024 ConfigurationDesk Using Demo Projects
FunctionalSafetyDemo Project: Example of Using MicroAutoBox III Functional Safety Features
For more information on the FuSa Response Trigger function block, refer
to FuSa Response Trigger (ConfigurationDesk I/O Function Implementation
Guide ).
Build results Build results are already available in the Project Manager.
Actions and adjustments You are not required to perform specific actions because the demo illustrates a
finished ConfigurationDesk application.
However, you are free to adjust the configuration and, for example, start a new
build process.
You can also use the demo as a basis for a real use scenario that requires
functional safety functionality.
If you have a MicroAutoBox III, you can download the real-time application
to it. For this purpose, the connection state of your ConfigurationDesk
application must be Matching platform connected. For more information
and instructions, refer to Managing Real-Time Hardware (ConfigurationDesk
Real-Time Implementation Guide ).
66
ConfigurationDesk Using Demo Projects May 2024
Using the FuSaDemoApp Application
67
May 2024 ConfigurationDesk Using Demo Projects
FunctionalSafetyDemo Project: Example of Using MicroAutoBox III Functional Safety Features
68
ConfigurationDesk Using Demo Projects May 2024
StandardEthernetDemo Project: Implementing Ethernet Communication
Use scenario The TCPAppl application illustrates how to configure TCP communication
between a server and client using standard Ethernet function blocks in
ConfigurationDesk.
69
May 2024 ConfigurationDesk Using Demo Projects
StandardEthernetDemo Project: Implementing Ethernet Communication
Ethernet controller
Ethernet Setup
function block
Data vector
TCP
Transport layer header TCP function block
TCP message
IP Ethernet setup
Internet layer header
function block
TCP/IP packet
MAC
Network layer header
CRC Ethernet controller
Ethernet frame
TCP The TCP function blocks are used to establish a TCP connection to
transmit and receive data via TCP messages.
For more information on configuring the TCP function block, refer to
Configuring the Basic Functionality (UDP Transmit) (ConfigurationDesk I/O
Function Implementation Guide ).
70
ConfigurationDesk Using Demo Projects May 2024
Using the TCPAppl Application
Build results Build results are already available in the Project Manager.
Actions and adjustments You are not required to perform specific actions, because the demo illustrates a
finished ConfigurationDesk application.
71
May 2024 ConfigurationDesk Using Demo Projects
StandardEthernetDemo Project: Implementing Ethernet Communication
However, you are free to adjust the configuration and, for example, start a new
build process.
You can also use the demo as a basis for a real use scenario that requires
Ethernet communication using TCP/IP.
Use scenario The UDPAppl application illustrates how to configure UDP communication using
standard Ethernet function blocks in ConfigurationDesk.
72
ConfigurationDesk Using Demo Projects May 2024
Using the UDPAppl Application
Ethernet controller
Ethernet Setup
function block
Data vector
UDP
Transport layer header UDP function block
UDP datagram
IP Ethernet setup
Internet layer header
function block
UDP/IP packet
MAC
Network layer header
CRC Ethernet controller
Ethernet frame
UDP Transmit The UDP Transmit function block is used to transmit data via
unicast, multicast, and broadcast UDP messages.
The destination socket address is configurable during run time using test
automation in ConfigurationDesk:
§ The Signal Chain/IO Function View/Communication/Ethernet/UDP
Transmit/UDP Transmit (1)/Model Interface/Destination IP
Address/TA_Replacevalue variable lets you specify the IP address.
§ The Signal Chain/IO Function View/Communication/Ethernet/UDP
Transmit/UDP Transmit (1)/Model Interface/Destination
Port/TA_Replacevalue variable lets you specify the socket.
For more information on configuring the UDP Transmit function block, refer
to Configuring the Basic Functionality (UDP Transmit) (ConfigurationDesk I/O
Function Implementation Guide ).
73
May 2024 ConfigurationDesk Using Demo Projects
StandardEthernetDemo Project: Implementing Ethernet Communication
UDP Receive The UDP Receive function blocks receive unicast, multicast,
and broadcast UDP messages. The blocks provide the received data to the
behavior model. The multicast IP address is set to 239.255.255.254.
For more information on configuring the UDP Receive function block, refer
to Configuring the Basic Functionality (UDP Receive) (ConfigurationDesk I/O
Function Implementation Guide ).
74
ConfigurationDesk Using Demo Projects May 2024
Using the UDPAppl Application
Build results Build results are already available in the Project Manager.
The Encode/Decode block dialog lets you select the data type and size to
be converted. All basic numeric data types as well as arrays, matrices, buses,
nested buses, and bus arrays are supported. The following illustration shows the
Decode block dialog.
75
May 2024 ConfigurationDesk Using Demo Projects
StandardEthernetDemo Project: Implementing Ethernet Communication
Actions and adjustments You are not required to perform specific actions, because the demo illustrates a
finished ConfigurationDesk application.
However, you are free to adjust the configuration and, for example, start a new
build process.
You can also use the demo as a basis for a real use scenario that requires
Ethernet communication using UDP/IP.
The Encoding - Decoding page lets you check the coding of the Simulink bus in
the behavior model.
76
ConfigurationDesk Using Demo Projects May 2024
WheelspeedOutDemo Project: Simulating an Active Wheel Speed Sensor
Features in focus Wheelspeed Out I/O functionality The signal chain of the
WheelspeedDemoAppl application contains a Wheelspeed Out function
block.
77
May 2024 ConfigurationDesk Using Demo Projects
WheelspeedOutDemo Project: Simulating an Active Wheel Speed Sensor
Build results Build results are already available in the Project Manager.
Actions and adjustments You are not required to perform specific actions because the demo illustrates a
finished ConfigurationDesk application.
However, you are free to adjust the configuration and, for example, start a new
build process.
You can also use the demo as a basis for a real use scenario that requires active
wheel speed sensor functionality.
Purpose The following characteristics of the wheel speed sensors' data protocol must be
simulated in the behavior model:
§ The logical coding.
The logical coding sets the number of data bits and describes the meaning of
each data bit
78
ConfigurationDesk Using Demo Projects May 2024
Demo Model of a Wheelspeed Out Interface
Overview The illustration shows you the Simulink® demo model together with the
subsystem of the Sensor Simulation model block. The demo simulates a
common wheel speed sensor interface with data protocol.
Description of the model The following table describes the functionality of the Sensor Simulation model
block and its subsystem.
79
May 2024 ConfigurationDesk Using Demo Projects
WheelspeedOutDemo Project: Simulating an Active Wheel Speed Sensor
The DataOut output is a vector with 8 bits with the following logical coding in the demo model:
§ Bit 0 - Bit 2 are status bits. Each bit is set to 0 in the demo.
§ Bit 3 indicates whether the detected direction of rotation is valid. A setting to 1 indicates a valid
detection.
The detected direction is valid if the detection is reliable. The detection is reliable if the following
requirements are all fulfilled:
§ The current speed is below the maximum speed limit.
The maximum speed limit is set to 1600 pitches/s in the demo.
§ The air gap between the wheel and the measuring bridge is below the maximum air gap limit.
Within the Build Custom Sensor Data subsystem model block, the air gap is set to a fixed
value less than the maximum air gap limit.
§ Bit 4 represents the direction of rotation. A setting to 1 indicates wheels rotating clockwise
at positive speed values. The value is inverted if the MountingPosition input of the Sensor
Simulation model block is set to 0.
§ Bit 5 - Bit 7 represent the air gap. Each bit is set to 1 in the demo.
The logical coding is set by the simulated sensor. The DataOut vector size can be reduced or
increased as required. The connected model blocks do not limit the DataOut vector size.
Add Parity This subsystem model block:
§ Adds a parity bit to the DataIn vector.
In the demo, the subsystem model block adds an even parity bit.
80
ConfigurationDesk Using Demo Projects May 2024
Demo Model of a Wheelspeed Out Interface
Simulation of sensors without If you want to simulate an active wheel speed sensor without data protocol,
data protocol you can reduce the Sensor Simulation model block subsystem to the following
model blocks:
§ Calc Frequency model block
§ Map to I/O Function model block
All elements of the DataOut vector must be set to 0.
81
May 2024 ConfigurationDesk Using Demo Projects
WheelspeedOutDemo Project: Simulating an Active Wheel Speed Sensor
82
ConfigurationDesk Using Demo Projects May 2024