0% found this document useful (0 votes)
16 views

ConfigurationDeskUsingDemoProjects

The document provides an overview of demo projects available for ConfigurationDesk 2024-A, including instructions on accessing and utilizing these projects. It contains contact information for dSPACE support and emphasizes the importance of software updates and proprietary information. Additionally, it outlines various tutorial and example demo projects that illustrate different functionalities and communication protocols within the dSPACE software environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

ConfigurationDeskUsingDemoProjects

The document provides an overview of demo projects available for ConfigurationDesk 2024-A, including instructions on accessing and utilizing these projects. It contains contact information for dSPACE support and emphasizes the importance of software updates and proprietary information. Additionally, it outlines various tutorial and example demo projects that illustrate different functionalities and communication protocols within the dSPACE software environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

ConfigurationDesk

Using Demo Projects


For ConfigurationDesk 2024-A (24.1)

Release 2024-A – May 2024


How to Contact dSPACE
Mail: dSPACE GmbH
Rathenaustraße 26
33102 Paderborn
Germany
Tel.: +49 5251 1638-0
E-mail: info@dspace.de
Web: https://www.dspace.com

How to Contact dSPACE Support


If you encounter a problem when using dSPACE products, contact your local dSPACE
representative:
§ Local dSPACE companies and distributors: https://www.dspace.com/go/locations
§ For countries not listed, contact dSPACE GmbH in Paderborn, Germany.
Tel.: +49 5251 1638-941 or e-mail: support@dspace.de

You can also use the support request form: https://www.dspace.com/go/supportrequest. If


you are logged on to mydSPACE, you are automatically identified and do not have to add
your contact details manually.

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.

Software Updates and Patches


dSPACE strongly recommends that you download and install the most recent patches
for your current dSPACE installation. Visit https://www.dspace.com/go/patches for the
software updates and patches themselves and for more information, such as how to
receive an automatic notification when an update or a patch is available for your dSPACE
software.

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.

© 2020 - 2024 by:


dSPACE GmbH
Rathenaustraße 26
33102 Paderborn
Germany

This publication and the contents hereof are subject to change without notice.

AURELION, AUTERA, ConfigurationDesk, ControlDesk, MicroAutoBox, MicroLabBox,


SCALEXIO, SIMPHERA, SYNECT, SystemDesk, TargetLink, and VEOS are registered
trademarks of dSPACE GmbH in the United States or other countries, or both. Other
brand names or product names are trademarks or registered trademarks of their respective
companies or organizations.
Contents

Contents

About This Document 5

Overview and Access 7


Overview of ConfigurationDesk Demo Projects................................................ 7
Accessing ConfigurationDesk Demo Projects and Applications....................... 13

Bus Communication Demos 15


CfgCANMMDemo Project: Implementing CAN Communication............................. 16
Using the CANMMAppl Application.............................................................. 16

CfgLINMMDemo Project: Implementing LIN Communication.................................. 20


Using the LINMMAppl Application.................................................... ............ 20

CfgBasicIODemo Project: Demonstrating Basic I/O


Functionalities 25
Using the DemoSpringMassDamper Application............................................ 25

CfgCustomFMUDemo Project: Getting Started with the


FMI Standard 29
Using the DemoSimpleFIRFilter Application.................................................... 29

CfgUserStorageDemo Project: Using a SCALEXIO SSD 33


Using the UserStorageApplication Application............................................... 33

EDrivesControlDemo Project: Example of Electric Motor


Control Using the DS6121 Multi-I/O Board 37
Introduction to the EDrivesControlDemo Project............................................ 37
Using the PMSM_Demo Application.............................................................. 41
Using the BLDC_Demo Application................................................... ............ 43

EngineControlDemo Project: Controlling an Engine 47


Using the EngineControl Application............................................................. 47

3
May 2024 ConfigurationDesk Using Demo Projects
Contents

MPTurnlampDemo Project: Using a Multimodel, Multi-


Processing-Unit Application 53
Using the Turnlamp Application..................................................................... 53

ModelUsbDemo Project: Accessing USB Mass Storage


Devices From a MicroAutoBox III 57
Using the ModelUsbDemo Application.......................................................... 57

FunctionalSafetyDemo Project: Example of Using


MicroAutoBox III Functional Safety Features 63
Using the FuSaDemoApp Application............................................................ 63

StandardEthernetDemo Project: Implementing Ethernet


Communication 69
Using the TCPAppl Application...................................................................... 69
Using the UDPAppl Application..................................................................... 72

WheelspeedOutDemo Project: Simulating an Active


Wheel Speed Sensor 77
Using the WheelspeedDemoAppl Application................................................ 77
Demo Model of a Wheelspeed Out Interface................................................. 78

4
ConfigurationDesk Using Demo Projects May 2024
About This Document

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.

Symbols dSPACE user documentation uses the following symbols:

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:

%name% Names enclosed in percent signs refer to environment variables for


file and path names.

<> Angle brackets contain wildcard characters or placeholders for variable


file and path names, etc.

5
May 2024 ConfigurationDesk Using Demo Projects
About This Document

Special Windows folders Windows‑based software products use the following special folders:

Common Program Data folder A standard folder for application-specific


program data that is used by all users.
%PROGRAMDATA%\dSPACE\<InstallationGUID>\<ProductName>
or
%PROGRAMDATA%\dSPACE\<ProductName>\<VersionNumber>

Documents folder A standard folder for application‑specific files that are


used by the current user.
%USERPROFILE%\Documents\dSPACE\<ProductName>\<VersionNumber>

Local Program Data folder A standard folder for application-specific


program data that is used by the current user.
%USERPROFILE%\AppData\Local\dSPACE\<InstallationGUID>\
<ProductName>

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.

dSPACE Help (Web) Independently of the software installation, you can


access the Web version of dSPACE Help at https://www.dspace.com/go/help.
To access the Web version, you must have a mydSPACE account.
For more information on the mydSPACE registration process, refer to
https://www.dspace.com/faq?097.

6
ConfigurationDesk Using Demo Projects May 2024
Overview and Access

Overview and Access

Where to go from here Information in this section

Overview of ConfigurationDesk Demo Projects.......................................... 7

Accessing ConfigurationDesk Demo Projects and Applications................. 13

Overview of ConfigurationDesk Demo Projects

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.

Project and Application Description Function Blocks Specific Refer to...


Hardware Used
BusManagerTutorial: Introduces you to the basic § Bus SCALEXIO: Bus Manager
Several tutorial applications steps of working with the Bus Configuration § DS2672 Bus Tutorial
Manager. § CAN Module
This includes: § LIN
§ Configuring CAN and
LIN communication for
simulation, inspection, and
manipulation purposes.

7
May 2024 ConfigurationDesk Using Demo Projects
Overview and Access

Project and Application Description Function Blocks Specific Refer to...


Hardware Used
§ Working with or without
behavior models.
§ Building real-time
applications and generating
bus simulation containers.
§ Experimenting with
ControlDesk.
CfgMicroAutoBoxIIITutorial: This tutorial shows you § Voltage In MicroAutoBox III ConfigurationDesk
Several tutorial applications the basic configuration steps § Voltage Out Tutorial MicroAutoBox
if you want to use III
MicroAutoBox III hardware in
ConfigurationDesk.
CfgStartingWithExternal The contents of the § Multi Bit In SCALEXIO: ConfigurationDesk
Devices: CfgStartingWithExternalD § Multi Bit Out § DS2680 I/O Tutorial Starting with
Several tutorial applications evices demo project § PWM/PFM In Unit External Devices
demonstrate the typical § Power Switch
workflow for implementing
real-time applications when
you start out with an ECU. The
project starts with creating an
external device interface and
ends with building a real-time
application.
CfgStartingWithSimulink This tutorial shows you the § Voltage In SCALEXIO LabBox: ConfigurationDesk
Tutorial: basic configuration steps in § Voltage Out § DS6201 Digital Tutorial Starting with
Several tutorial applications ConfigurationDesk when you § Multi Bit In I/O Board Simulink
start out with a Simulink® § Multi Bit Out § DS6101 Multi
behavior model. I/O Board

Example demo projects Example demo projects include an implementation


of a ConfigurationDesk application using specific I/O functionality or hardware
resources. Some example demo projects can be used as a basis for your own
implementation.

Project and Application Description Function Blocks Specific Refer to...


Hardware Used
CfgBasicIODemo: The § Voltage In MicroAutoBox III: Using the
DemoSpringMassDamper DemoSpringMassDamper § Voltage Out § DS1513 Multi- DemoSpringMassDam
application illustrates the I/O Board per Application on
simulation of a damped spring- page 25
mass system.
CfgCANMMDemo: The CANMMAppl application § CAN SCALEXIO: Using the
CANMMAppl demonstrates simple CAN § DS2672 Bus CANMMAppl
communication between two Module Application on
CAN controllers using the RTI page 16
CAN MultiMessage Blockset.
CfgCustomFMUDemo: The CfgCustomFMUDemo - SCALEXIO: Using the
DemoSimpleFIRFilter provides a handcoded FMU § DS2680 I/O DemoSimpleFIRFilter
to illustrate an example Unit Application on
of an FMU supported § DS2703 6-Slot page 29
by ConfigurationDesk. The I/O Unit
FMU source code and the

8
ConfigurationDesk Using Demo Projects May 2024
Overview of ConfigurationDesk Demo Projects

Project and Application Description Function Blocks Specific Refer to...


Hardware Used
modelDescription.xml file
contain comments that make
it easier for you to get started
with the FMI standard. The
FMU can serve as a starting
point for integrating custom
C code into ConfigurationDesk
real-time applications without
Simulink®.
CfgFlexRayConfigDemo: The FlexRayConfigAppl § FlexRay SCALEXIO: For the current
FlexRayConfigAppl application serves to § DS2672 Bus dSPACE Release there
demonstrate simple FlexRay Module is no specific
communication. documentation of the
demo project. For
more information on
implementing FlexRay
communication in
ConfigurationDesk,
refer to Basics on
Implementing FlexRay
Communication
(ConfigurationDesk
Real-Time
Implementation
Guide ).
CfgFPGAuartDemo: The demo project Custom function SCALEXIO: Building the Signal
FPGAuartDemo CfgFPGAuartDemo is an blocks: § DS2655 FPGA Chain for UART
example of an FPGA § DemoFPGAuart Base Board Communication Using
application for implementing § DemoFPGAuart an FPGA Board
a configurable UART bus _RS232_UART_ (ConfigurationDesk
communication. It is not 1 – UART_4 UART
necessary to have knowledge Implementation )
§ DemoFPGAuart
about FPGA programming
_RS485_UART_
to use the example or
5 – UART_8
reuse the example in a
§ DemoFPGAuart
ConfigurationDesk project.
_Setup
CfgLINMMDemo: The LINMMAppl application § LIN SCALEXIO: Using the LINMMAppl
LINMMAppl serves to demonstrate simple § DS2672 Bus Application on
LIN communication between Module page 20
two LIN controllers using the
RTI LIN MultiMessage Blockset.
CfgUARTDemo: The UARTAppl application is Custom function SCALEXIO: DS2672 Bus Module:
UARTAppl a simple example of serial block: § DS2672 Bus Example of Simple
communication, prepared for § UART Module UART Serial
your first experience with SCALEXIO Communication Using
custom function blocks. It processing a DS2672 Bus Module
shows hardware: (ConfigurationDesk
§ Basics of custom function § SCALEXIO UART
blocks Processing Unit Implementation )
§ Initializing a UART driver or Processing hardware:
§ Using configuration § DS6001 Example of UART
properties Processor Board Serial Communication

9
May 2024 ConfigurationDesk Using Demo Projects
Overview and Access

Project and Application Description Function Blocks Specific Refer to...


Hardware Used
§ Start/stop functions Using Onboard
§ Sending and receiving data UART of SCALEXIO
of a fixed length Processing Hardware
SCALEXIO processing (ConfigurationDesk
hardware components provide UART
a UART channel that you Implementation )
can use to implement
UART serial communication.
You can modify the
UARTAppl application in
the CfgUARTDemo project
for simple UART serial
communication to work with
the UART channels provided by
the processing hardware.
CfgUARTDemo: The Custom function SCALEXIO: Example of
UARTRS232FlowControlAppl UARTRS232FlowControlAppl block: § DS2671 Bus Complex UART
application is a complex § UART RS232 Board Serial Communication
example of serial FlowControl (RS232 FlowControl)
communication, prepared for Using a DS2671
your advanced experience with Bus Board
custom function blocks. It (ConfigurationDesk
shows UART
§ Sending and receiving data Implementation )
of arbitrary length
§ Usage of several hardware
resources
§ Generating events
CfgUserStorageDemo: The UserStorageApplicaton Custom function SCALEXIO: Using the
UserStorageApplication application provides custom blocks: § SCALEXIO UserStorageApplicatio
function block types that let § User Storage Processing Unit n Application on
you use a SCALEXIO SSD. Read with SCALEXIO page 33
§ User Storage SSD
Write
CustomEthernetDemo: Two examples of Ethernet § Ethernet Setup SCALEXIO: Example:
EthernetAppl custom function blocks Custom function § SCALEXIO Implementing a
(Ethernet Send and Ethernet blocks: Processing Custom Function
Receive) are included in § Ethernet Unit – Ethernet Block for Ethernet
the CustomEthernetDemo Receive Adapter Communication
project in your dSPACE § Ethernet Send (ConfigurationDesk
installation. They give Custom I/O Function
you basic information on Implementation
exchanging data via Ethernet. Guide )
EDrivesControlDemo: The PMSM_Demo application § Voltage In SCALEXIO LabBox: Introduction to the
PMSM_Demo shows an example of using § Multi-Channel § DS6121 Multi- EDrivesControlDemo
the DS6121 Multi-I/O Board PWM Out I/O Board Project on page 37
for controlling a permanent § Digital
magnet synchronous motor Incremental
(PMSM) with field-oriented Encoder In
control. In this demo, § Hall Encoder In
sinusoidal phase currents are
generated to control the

10
ConfigurationDesk Using Demo Projects May 2024
Overview of ConfigurationDesk Demo Projects

Project and Application Description Function Blocks Specific Refer to...


Hardware Used
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.
EDrivesControlDemo: The BLDC_Demo application § Voltage In SCALEXIO LabBox: Introduction to the
BLDC_Demo is an example of using the § Block- § DS6121 Multi- EDrivesControlDemo
DS6121 Multi-I/O Board for Commutated I/O Board Project on page 37
controlling a brushless DC PWM Out
motor in block commutation § Digital
mode. Incremental
Encoder In
§ Hall Encoder In
EngineControlDemo: The EngineControl § Engine Control MicroAutoBox III: Using the
EngineControl application serves to Setup § DS1554 Engine EngineControl
demonstrate the control of a § Crank In Control I/O Application on
6-cylinder four-stroke piston § Cam In Module page 47
engine. § Injection Out
§ Ignition Out
§ Knock In
FunctionalSafetyDemo: The FuSaDemoApp § FuSa Setup MicroAutoBox III: Using the
FuSaDemoApp application serves to § FuSa Response § DS1403 FuSaDemoApp
demonstrate I/O functionality Trigger Processor Board Application on
for functional safety in § FuSa Challenge- (FuSa Unit) page 63
combination with the Response
MicroAutoBox III. Monitoring
ModelUsbDemo: The ModelUsbDemo Custom function MicroAutoBox III: Using the
ModelUsbDemo application provides a custom block: § DS1403 ModelUsbDemo
function for accessing data § USB Data Store Processor Board Application on
on a USB mass-storage device page 57
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.
MPTurnlampDemo: The turnlamp application – SCALEXIO: Using the Turnlamp
turnlamp is a multimodel, multi- § Two SCALEXIO Application on
processing-unit application Processing Units page 53
that demonstrates the
simulation of a turn-signal
circuit that can be activated
with a turn-signal lever and
warning lights that can be
switched on and off.

11
May 2024 ConfigurationDesk Using Demo Projects
Overview and Access

Project and Application Description Function Blocks Specific Refer to...


Hardware Used
StandardEthernetDemo: The TCPAppl application § Ethernet Setup MicroAutoBox III: Using the TCPAppl
TCPAppl illustrates how to configure § TCP § DS1403 Application on
TCP communication between § Ethernet Switch Processor Board page 69
a server and client using
standard Ethernet function
blocks in ConfigurationDesk.
StandardEthernetDemo: The UDPAppl application § Ethernet Setup MicroAutoBox III: Using the UDPAppl
UDPAppl illustrates how to configure § UDP Transmit § DS1403 Application on
UDP communication using § UDP Receive Processor Board page 72
standard Ethernet function § Ethernet Switch
blocks in ConfigurationDesk.
WheelspeedOutDemo: The WheelspeedDemoAppl § Wheelspeed SCALEXIO: § Using the
WheelspeedDemoAppl application serves to Out § DS2680 I/O WheelspeedDemoA
demonstrate a signal chain Unit ppl Application on
with a Wheelspeed Out page 77
function block that simulates § Demo Model of
the signals provided by an a Wheelspeed
active wheel speed sensor. Out Interface on
Some characteristics of the page 78
I/O functionality of the
WheelspeedDemoAppl must
be simulated in the behavior
model for maximum flexibility.

Python-based demo projects Python-based demo projects are not available


in ConfigurationDesk right away. You have to execute a Python script first to
work with them.

Project and Application Description Function Blocks Specific Refer to...


Hardware Used
BusManagerBasicsDemo: The Bus Manager Basics § Bus SCALEXIO: Working with the Bus
BusManagerBasicsDemoApplic demo illustrates the basic Configuration § DS2671 Bus Manager Basics Demo
ation steps of using a Python § CAN Board (ConfigurationDesk
Only available automation script to configure § LIN § DS2672 Bus Bus Manager
after executing the bus communication with the Module Implementation
BusManagerBasicsDemo.py Bus Manager and build a real- Guide )
Python script time application.
The demo is based on a simple
example of door and window
mechanisms of a car.
BusManagerSecOCDemo: The Bus Manager SecOC § Bus SCALEXIO: Working with the Bus
BusManagerSecOCDemoAppli demo illustrates the basic Configuration § DS2671 Bus Manager SecOC Demo
cation steps for implementing secure § CAN Board (ConfigurationDesk
Only available onboard communication in a § DS2672 Bus Bus Manager
after executing the real-time application and in Module Implementation
BusManagerSecOCDemo.py bus simulation containers by Guide )
Python script using a Python automation
script.

12
ConfigurationDesk Using Demo Projects May 2024
Accessing ConfigurationDesk Demo Projects and Applications

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

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

Where to go from here Information in this section

CfgCANMMDemo Project: Implementing CAN Communication.... .......... 16

CfgLINMMDemo Project: Implementing LIN Communication................... 20

15
May 2024 ConfigurationDesk Using Demo Projects
Bus Communication Demos

CfgCANMMDemo Project: Implementing CAN Communication

Using the CANMMAppl Application

Use scenario The CANMMAppl application demonstrates simple CAN communication


between two CAN controllers using the RTI CAN MultiMessage Blockset.

Tip

§ The demo is an example of implementing CAN communication in


ConfigurationDesk using the RTI CAN MultiMessage Blockset. For more
general information and instructions, refer to Basics on Implementing
CAN Communication (ConfigurationDesk Real-Time Implementation
Guide ).
§ For more information on the RTI CAN MultiMessage Blockset, refer to
Overview of the RTI CAN MultiMessage Blockset (RTI CAN MultiMessage
Blockset Reference ).
§ Alternatively, you can use the Bus Manager in ConfigurationDesk to
configure and implement CAN communication in ConfigurationDesk.
Refer to ConfigurationDesk Bus Manager Implementation Guide .

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

CAN controllers are hardware components that are located on real-time


hardware. With a SCALEXIO system, access is realized in ConfigurationDesk via
CAN function blocks, i.e., the RTICANMM ControllerSetup blocks cannot directly
access the controllers. They serve as an interface between the real-time hardware
(which is accessed via the CAN function blocks) and the CAN communication
that is modeled in the RTICANMM MainBlocks.
Both controllers send and receive messages. CAN_Chassis_M1 is configured to
simulate ENGINE_CONTROL ECU and CAN_Chassis_M2 simulates the rest of the
ECUs (restbus simulation).

Configuration Port blocks In ConfigurationDesk, each RTICANMM


ControllerSetup block is represented by a Configuration Port block in the signal
chain. Configuration Port blocks are a specific type of model port block that can
be created only by analyzing a Simulink model.

Function blocks and hardware resources The Configuration Port blocks


are mapped to CAN function blocks to which CAN channels of the hardware
topology are assigned.

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

External device interface The external device interface contains a


representation of a CAN bus system.

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.

The S-functions are created. This might take a while.

3. Click OK to close the dialog.

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

19
May 2024 ConfigurationDesk Using Demo Projects
Bus Communication Demos

CfgLINMMDemo Project: Implementing LIN Communication

Using the LINMMAppl Application

Use scenario The LINMMAppl application serves to demonstrate simple LIN communication
between two LIN controllers using the RTI LIN MultiMessage Blockset.

Tip

§ The demo is an example of implementing LIN communication in


ConfigurationDesk using the RTI LIN MultiMessage Blockset. For more
general information and instructions, refer to Basics on Implementing
LIN Communication (ConfigurationDesk Real-Time Implementation
Guide ).
§ For more information on the RTI LIN MultiMessage Blockset, refer to RTI
LIN MultiMessage Blockset Reference .
§ Alternatively, you can use the Bus Manager in ConfigurationDesk to
configure and implement LIN communication in ConfigurationDesk. Refer
to ConfigurationDesk Bus Manager Implementation Guide .

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

The communication is based on a master-slave configuration where the Node5


node is the master node. The database delivered with the demo model consists
of five nodes (Node1-Node5). The RTILINMM MainSetup1 block simulates the
LIN master, i.e., Node5, and the RTILINMM MainSetup2 block simulates the LIN
slaves (Node1 ... Node4).

Configuration Port blocks In ConfigurationDesk, each RTILINMM


ControllerSetup block is represented by a Configuration Port block in the signal
chain. Configuration Port blocks are a specific type of model port block that can
be created only by analyzing a Simulink model.

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

External device interface The external device interface contains a


representation of a LIN bus system.

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.

The S-functions are created. This might take a while.

3. Click OK to close the dialog.

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

23
May 2024 ConfigurationDesk Using Demo Projects
Bus Communication Demos

24
ConfigurationDesk Using Demo Projects May 2024
CfgBasicIODemo Project: Demonstrating Basic I/O Functionalities

CfgBasicIODemo Project: Demonstrating Basic I/O


Functionalities

Using the DemoSpringMassDamper Application

Use scenario The DemoSpringMassDamper application illustrates the simulation of a


damped spring-mass system. The anchor point where the spring is connected
will be deflected by an external force. The resulting signal describes the
deflection of the mass at the other side of the spring.

Features in focus Modeling a damped spring-mass system The demosmd_io Simulink®


model connected to the ConfigurationDesk application simulates a damped
spring-mass system.

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

a = − d/m ⋅ v − C/m ⋅ x − x disp

Variable Description Unit


a Acceleration of the mass m/s2
d Damping coefficient kg/s
m Mass kg
v Velocity of the mass m/s
c Spring constant kg/s2
x Position of the mass m
x disp Excitation m
f Frequency Hz
t Time s
u Amplitude of excitation m

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

Signal chain in ConfigurationDesk In ConfigurationDesk, the x (mass


position) signal is received from the Simulink model via a model port block
that is connected to a Voltage Out function block. The signal ports of the
function block are connected to a Simple Demo Device that represents an ECU.
A Voltage In function block is connected to an outport of the device and to
a model port block that returns the x disp (mass displacement) signal to the
Simulink model.

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 )

Hardware resources The DS1513 Multi-I/O Board of the MicroAutoBox III


is used as an example of dSPACE hardware that provides the required Analog
Out and Analog In channels.

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

If your dSPACE hardware system is different from the example


MicroAutoBox III system in the hardware topology, you have to replace
the hardware topology and 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 ).

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

§ 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_BasicIODemo is located next to the CfgBasicIODemo in the
<Documents folder>\BasicIODemo\ folder. It is also available in a ZIP
archive, which is located in the <ConfigurationDesk installation
folder>\Demos\ConfigurationDesk\BasicIODemo folder. The files in
the Variable Descriptions folder are the build results of the
ConfigurationDesk project.
Refer to:
§ For SCALEXIO: Experimenting with a SCALEXIO System (SCALEXIO –
Hardware and Software Overview ).
§ For MicroAutoBox III: Software for Experimenting with the MicroAutoBox III
(MicroAutoBox III - Hardware and Software Overview )
§ For MicroLabBox II: Software for Experimenting with the MicroLabBox II
(MicroLabBox II - Getting Started )

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

CfgCustomFMUDemo Project: Getting Started with


the FMI Standard

Using the DemoSimpleFIRFilter Application

Use scenario The CfgCustomFMUDemo provides a handcoded FMU to illustrate an example


of an FMU supported by ConfigurationDesk. The FMU source code and the
modelDescription.xml file contain comments that make it easier for you to
get started with the FMI standard. The FMU can serve as a starting point for
integrating custom C code into ConfigurationDesk real-time applications without
Simulink®.

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.

The Model Communication Browser shows the available model port


blocks and the mapping between the SignalGenerator SIC file and the
Simple_FIR_Filter FMU.

29
May 2024 ConfigurationDesk Using Demo Projects
CfgCustomFMUDemo Project: Getting Started with the FMI Standard

Commented source code The Simple_FIR_Filter FMU illustrates an


example of an FMU supported by ConfigurationDesk. For FMUs with similar
characteristics, you can derive an own FMU implementation from this example.

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

4. Control the simulation in the ControlDesk experiment. The experiment


contains a plotter connected with FMU input and output signals.

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.

Deriving custom FMUs from Simple_FIR_Filter.fmu You can use the


Simple_FIR_FMU.fmu as a template to create a custom FMU with a
similar functionality. For this purpose, the FMU provides comments in the
modelDescription.xml file and in the SimpleFIR_main.c file that help you
to adapt the FMU to your needs. To access the files, perform the following steps:
1. In the File Explorer, navigate to the following folder:
<Documents folder>\CustomFMUDemo\CfgCustomFMUDemo\Models
2. Rename the SimpleFIR.fmu file to SimpleFIR.zip.
3. Extract SimpleFIR.zip.
4. Locate the modelDescription.xml file and the SimpleFIR_main.c file.
5. Use the provided comments to adapt the files according to your
requirements.

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

CfgUserStorageDemo Project: Using a SCALEXIO


SSD

Using the UserStorageApplication Application

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.

Function Description Specific Properties


Block Type
User Storage Bundles data from the § Filename: The name of the file on the SCALEXIO SSD to which you write.
Write connected Simulink® model § Split files on EOF: Due to limitations of some file systems regarding maximum file
in blocks and writes them to size (FAT32: 4GB), this parameter lets you split the target file into multiple parts
the SCALEXIO SSD. when the maximum file size is reached.
User Storage Reads data from the § Filename: The name of the file on the SCALEXIO SSD from which you read.
Read SCALEXIO SSD and makes it § Wrap behavior: Defines what happens when the end of the file is reached.
available in the application. § Wrap: The read process starts again at the beginning of the file.
§ No wrap: No data is read after the end of the file has been reached.
§ Initial values: The initial values of the custom function block are provided after
the end of the file has been reached.

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

§ The rtio.h custom function file contains developer comments that


provide additional details.
§ For more information and instructions on creating and using custom
function block types in ConfigurationDesk, refer to ConfigurationDesk
Custom I/O Function Implementation Guide .

34
ConfigurationDesk Using Demo Projects May 2024
Using the UserStorageApplication Application

Simulink Model The connected UserStorageDemo_64 Simulink model


contains simple write and read example subsystems that write/read the current
date to/from the ConfigurationDesk application via model port blocks.

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

EDrivesControlDemo Project: Example of Electric


Motor Control Using the DS6121 Multi-I/O Board

Where to go from here Information in this section

Introduction to the EDrivesControlDemo Project...................................... 37

Using the PMSM_Demo Application........................................................ 41

Using the BLDC_Demo Application.......................................................... 43

Introduction to the EDrivesControlDemo Project

Use scenario ConfigurationDesk provides the EDrivesControlDemo project as an example for


electric motor control in combination with the DS6121 Multi-I/O Board. You can
use the demo project as a template for your own electric motor control projects.

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

Simulink ConfigurationDesk External hardware

Processor based model I/O functionality

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

I/O functionality in ConfigurationDesk The function blocks in


ConfigurationDesk have the following purpose:
§ Generating three-phase PWM signals including the inverted phases to control
an electric motor
The PWM signals are output by the DS6121 Multi-I/O Board.
The PWM signals can be generated by a Multi-Channel PWM Out function
block (PMSM_Demo) or a Block-Commutated PWM Out function block
(BLDC_Demo). For more information on the function blocks, refer to the
following topics:
§ Multi-Channel PWM Out (ConfigurationDesk I/O Function Implementation
Guide )
§ Block-Commutated PWM Out (ConfigurationDesk I/O Function
Implementation Guide )
§ Calculation of the rotor position and the velocity of the motor
The calculation of the position and the velocity of the motor is done via a Hall
Encoder In function block and a Digital Incremental Encoder In function
block. For more information on the function blocks, refer to the following
topics:
§ Hall Encoder In (ConfigurationDesk I/O Function Implementation Guide )
§ Digital Incremental Encoder In (ConfigurationDesk I/O Function
Implementation Guide )
§ A/D conversion of the phase currents and the DC link voltage
The A/D conversion of the phase currents and the DC link voltage is done via
Voltage In function blocks.

38
ConfigurationDesk Using Demo Projects May 2024
Introduction to the EDrivesControlDemo Project

For more information on the function block, refer to Voltage In


(ConfigurationDesk I/O Function Implementation Guide ).

Note

As an alternative, the Voltage Signal Capture function block can be


used for this purpose. For more information, refer to Voltage Signal
Capture (ConfigurationDesk I/O Function Implementation Guide ).

§ Triggering the execution of the control algorithm


All A/D conversions for current measurement are triggered synchronously at
the pulse center of the generated PWM signal. After all A/D conversions have
finished, the asynchronous Interrupt task is triggered. This task then triggers
the execution of the control algorithm in Simulink.
Only one of the three Voltage In function blocks for A/D conversion of the
phase currents generates the EndOfConversion event. It is ensured that all
A/D conversions are completed when the event is sent.

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

Speed Current DC link voltage


feedback feedback feedback
Open loop
Speed control Current control

Modulator The modulator resides at the innermost level of the controller


model and converts voltage setpoints to duty cycles. The output of the
modulator is sent to the relevant Data Outport block (PMSM_Demo:
Three_Phase_PWM, BLDC_Demo: Block-Commutated_PWM). The voltage
setpoints can either be user-defined voltage setpoints, or they can be calculated
voltage setpoints received by the current controller.

39
May 2024 ConfigurationDesk Using Demo Projects
EDrivesControlDemo Project: Example of Electric Motor Control Using the DS6121 Multi-I/O Board

Current controller The controller at the next level up is the current


controller. It contains a PI controller that uses the difference between the current
setpoint and the measured current values to calculate a correction value that is
then applied to the modulator. The current setpoint can either be user-defined or
it can be a calculated current setpoint received from the speed controller.

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

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:

Input subsystem The Input subsystem is used to configure encoders and


read encoder output signals as well as phase current and DC link voltage.

Controller subsystem The Controller subsystem contains the control


algorithm.

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.

The sinusoidal-commutated PWM signal is modulated according to its input


signals, i.e., the duty cycle and the frequency. The frequency has a constant
value in this demo application.

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.

Specifying the type of control Via the PMSM_Ctrl_Ctrl_mode_SW


parameter in the script file or in ControlDesk, you can specify the type of control.
Refer to the following table:

PMSM_Ctrl_Ctrl_mode_SW Parameter Value Description


1 Open loop
2 Current control
3 Speed control

Using the BLDC_Demo Application

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:

Input subsystem The Input subsystem is used to configure encoders and


read encoder output signals as well as phase currents and DC link voltage.

43
May 2024 ConfigurationDesk Using Demo Projects
EDrivesControlDemo Project: Example of Electric Motor Control Using the DS6121 Multi-I/O Board

Controller subsystem The Controller subsystem contains the control


algorithm.

Output subsystem The Output subsystem contains the output signals


that are used by the Block-Commutated PWM Out function block in
ConfigurationDesk to generate block-commutated PWM signals.

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.

The block-commutated PWM signal is modulated according to the input signals


and the configuration of the Block-Commutated PWM Out function block.
In the BLDC_Demo application, the function block generates motor-position-
dependent sector signals according to the specified modulation type. The
Block-Commutated PWM Out function block provides different predefined
modulation types. In this demo application, the 2-quadrant bipolar modulation
type is preconfigured. The related signal settings are displayed in the Sector and
Stationary Signals dialog:

44
ConfigurationDesk Using Demo Projects May 2024
Using the BLDC_Demo Application

The following illustration shows the corresponding signal pattern:


0-60° 60-120° 120-180° 180-240° 240-300° 300-360°

A+

A-

B+

B-

C+

C-

For more information on sector and stationary signals, refer to Configuring


Sector and Stationary Signals (Block-Commutated PWM Out) (ConfigurationDesk
I/O Function Implementation Guide ).

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

The Pole pair factor property of the Block-Commutated PWM Out


function block must be 1, because the conversion between electrical
and mechanical angle is performed in the model. For more information,
refer to Block-Commutated PWM Out (ConfigurationDesk I/O Function
Implementation Guide ).

For more information, refer to Introduction to Hall Encoders


(ConfigurationDesk I/O Function Implementation Guide ).
§ The DC link voltage
§ Maximum values for current and mechanical speed

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

The following parameters must be specified according to the Block-


Commutated PWM Out function block configuration in ConfigurationDesk:
§ Indicator vector for determining the direction of the phase currents
The vector is specified via the BLDC_Ctrl_is_dir parameter. In this vector,
the sign of the three phase-currents is provided for the forward rotation for
each sector. The vector is used for the correct current measurement.
§ Sector offset
The BLDC_Ctrl_Sector_Offset parameter lets you specify a value for the
offset angle to be added to the start angle of the first sector. This value must
also be specified in the Sector offset property of the Block-Commutated
PWM Out function block.
The angle of the motor sectors is determined by the number of sectors, which
is fixed to six in the Block-Commutated PWM Out function block. The fixed
angle and the BLDC_Ctrl_Sector_Offset parameter result in fixed values
for the BLDC_Ctrl_Sector_<n>_End parameters that must not be changed.

Specifying the type of control Via the BLDC_Ctrl_Ctrl_mode_SW


parameter in the script file or in ControlDesk, you can specify the type of control.
Refer to the following table:

BLDC_Ctrl_Ctrl_mode_SW Parameter Value Description


1 Open loop
2 Current control
3 Speed control

46
ConfigurationDesk Using Demo Projects May 2024
EngineControlDemo Project: Controlling an Engine

EngineControlDemo Project: Controlling an Engine

Using the EngineControl Application

Use scenario The EngineControl application serves to demonstrate the control of a 6-cylinder
four-stroke piston engine.

Summary of the main characteristics:


§ Evaluating the crankshaft signal: Use of a crankshaft wheel with a tooth width
of 6° and a gap width of 12°.
§ Evaluating a single camshaft signal: Camshaft pulse from 120° to 140°.
§ The length of an engine cycle is 720° (4-stroke engine).
§ Generating 5 ignition and 5 injection pulses for each of the 6 cylinders.
§ Measuring knock signals for each cylinder.

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

§ The Crank In function block measures the crankshaft of the engine


and calculates the current position, speed and rotational direction. The
specification of the crankshaft wheel (number of teeth and gaps, etc.) is based
on wavetable files. The function block also serves as a master APU provider for
the Engine Control Setup and the Cam In function blocks.

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

Assigned hardware resources The assigned MicroAutoBox III hardware


resources offer the required channel types.

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.

Wavetable file generation In addition to the wavetable file used by


the Crank In function block, the demo application provides a number
of different wavetable file examples. It also provides a MATLAB script file
(CrankInWtCreate.m) that lets you generate more wavetable files according
to your requirements. Check the comments in the MATLAB script file for
information.

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

MPTurnlampDemo Project: Using a Multimodel,


Multi-Processing-Unit Application

Using the Turnlamp Application

Use scenario The turnlamp application is a multimodel, multi-processing-unit application that


demonstrates the simulation of a turn-signal circuit that can be activated with a
turn-signal lever and warning lights that can be switched on and off.

Features in focus Model communication The application is connected to two Simulink®


models (masterAppl and slaveAppl) that simulate the behavior of three
ECUs for controlling turn signals depending on a TurnSignalLever and a
WarningLightSwitch.

Model communication between the two models has been configured by


mapping model port blocks from the ConfigurationDesk model interface of both
models in ConfigurationDesk. The configuration of model communication can
best be accessed in the Multiple Models view set.

53
May 2024 ConfigurationDesk Using Demo Projects
MPTurnlampDemo Project: Using a Multimodel, Multi-Processing-Unit Application

For more information on model communication, refer to Setting Up Model


Communication (ConfigurationDesk Real-Time Implementation Guide ).

Multi-processing-unit application The application processes for the two


models are assigned to different processing unit applications so that the real-
time application can be executed on two processing units. You can access the
assignment in the Processing Resource Assignment table.

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

§ You can control the simulation in the ControlDesk experiment.

§ 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

ModelUsbDemo Project: Accessing USB Mass


Storage Devices From a MicroAutoBox III

Using the ModelUsbDemo Application

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

When you use Write at application stop, be aware of the following:


§ If no file with the configured File name exists, it will be written at application stop.
§ If a file with the configured File name exists, it will be overwritten at application stop.

§ Read at start and write at stop


The default value is Read at application start. In the demo application, the value is set to Read at start and write
at stop.

The custom function block has no function ports to connect it to a Simulink


model. Instead, it uses a global variable that can be accessed from the Simulink
model to provide the data from the file on the USB device and make it available
for real-time access when the application is running.

58
ConfigurationDesk Using Demo Projects May 2024
Using the ModelUsbDemo Application

Tip

§ The custom function files contain multiple developer comments that


provide additional details.
§ For more information and instructions on creating and using custom
function block types in ConfigurationDesk, refer to ConfigurationDesk
Custom I/O Function Implementation Guide .

Simulink model The demo application provides a Simulink model with an


implementation example.

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

millisecond during run time by the Runtime Increment subsystem in


the Simulink model. The Counter View subsystem in the Simulink
model reads the last two values and provides them for measurement in
ControlDesk.

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

FunctionalSafetyDemo Project: Example of Using


MicroAutoBox III Functional Safety Features

Using the FuSaDemoApp Application

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.

In the connected FunctionalSafetyDemo Simulink® model, the runnable


function block that can be triggered by the I/O event is connected to a Function-
Call Subsystem.

A FuSa Challenge-Response Monitoring and a FuSa Response Trigger


function block are assigned to the FuSa Setup function block as monitors. Each
monitor has a user-defined monitor ID so that the FuSa Setup function block
can identify which monitor detected an error.

FuSa Challenge-Response Monitoring The FuSa Challenge-Response


Monitoring function block works as a monitor based on the challenge and
response principle. This means that value pairs consisting of challenge values and
expected response values are configured. At run time, the challenge response
monitor provides challenge values to the behavior model and expects the
according response values within specified timing constraints.
In the demo application, eight challenge-response pairs are configured. New
challenges are provided to the behavior model every 0.1 s (Challenge period)

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.

For more information on configuring FuSa challenge-response monitoring, refer


to Configuring the Basic Functionality (FuSa Challenge-Response Monitoring)
(ConfigurationDesk I/O Function Implementation Guide ).
In the connected FunctionalSafetyDemo Simulink model, the current challenge
value is doubled and then returned to match the expected response.

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

FuSaTrigger value from an external host PC to demonstrate that this manual


trigger is working correctly.

For more information on the FuSa Response Trigger function block, refer
to FuSa Response Trigger (ConfigurationDesk I/O Function Implementation
Guide ).

Assigned hardware resources The assigned MicroAutoBox III hardware


resources offer the required FuSa Unit and FuSa Challenge-Response Unit
channels.

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

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. Refer to Software for Experimenting with the
MicroAutoBox III (MicroAutoBox III - Hardware and Software Overview ).

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

StandardEthernetDemo Project: Implementing


Ethernet Communication

Where to go from here Information in this section

Using the TCPAppl Application................................................................ 69

Using the UDPAppl Application................................................................ 72

Using the TCPAppl Application

Use scenario The TCPAppl application illustrates how to configure TCP communication
between a server and client using standard Ethernet function blocks in
ConfigurationDesk.

Features in focus Standard Ethernet function blocks ConfigurationDesk provides standard


Ethernet function blocks that let you access and configure the Ethernet
controllers and switches of the platform you are using. TCP and UDP function
blocks can access the configured Ethernet controller for TCP/IP or UDP/IP
Ethernet communication.

69
May 2024 ConfigurationDesk Using Demo Projects
StandardEthernetDemo Project: Implementing Ethernet Communication

The following illustration gives you an overview of the Ethernet implementation


in ConfigurationDesk with standard Ethernet function blocks.

Ethernet controller

Ethernet Setup
function block

UDP Receive UDP Transmit TCP


function block function block function block

TCP/IP implementation in ConfigurationDesk The TCP/IP model is a


conceptual model of how TCP/IP communication works. The following
illustration shows the basic implementation of the TCP/IP model in
ConfigurationDesk.
TCP/IP model ConfigurationDesk

Application layer Data bytes Behavior model

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

Ethernet Setup The Ethernet Setup function block provides access to an


Ethernet controller and specifies the local IP address. Several other function
blocks can use the access at the same time to transport data values.
For more information on configuring the Ethernet Setup function block, refer
to Configuring the Basic Functionality (Ethernet Setup) (ConfigurationDesk I/O
Function Implementation Guide ).

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

Referencing configuration The TCP on Ethernet property shows the


Ethernet Setup function block used to transmit/receive TCP messages. The
referenced Ethernet Setup function block provides the access to the Ethernet
controller and the local IP address.

70
ConfigurationDesk Using Demo Projects May 2024
Using the TCPAppl Application

Ethernet Switch The Ethernet Switch function block configures the


switching of Ethernet traffic of the assigned internal Ethernet switch. In this
demo, the Ethernet switch connects the used Ethernet controllers for direct
communication between the controllers. This configuration eliminates the need
for a bridge with an Ethernet patch cable.

For more information on configuring the internal Ethernet switch, refer to


Configuring the Basic Functionality (Ethernet Switch) (ConfigurationDesk I/O
Function Implementation Guide ).

Assigned hardware resources The assigned MicroAutoBox III hardware


resources offer the required Ethernet controllers.

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.

ControlDesk experiment The TCP ControlDesk experiment lets you send


TCP messages. Before you can send TCP messages, you have to click Connect at
the TCP client to request and establish a TCP connection.

For more information on establishing a TCP/IP connection, refer to Controlling


the TCP/IP Connection (ConfigurationDesk I/O Function Implementation
Guide ).

Using the UDPAppl Application

Use scenario The UDPAppl application illustrates how to configure UDP communication using
standard Ethernet function blocks in ConfigurationDesk.

Features in focus Standard Ethernet function blocks ConfigurationDesk provides standard


Ethernet function blocks that let you access and configure the Ethernet
controllers and switches of the platform you are using. TCP and UDP function
blocks can access the configured Ethernet controller for TCP/IP or UDP/IP
Ethernet communication.

72
ConfigurationDesk Using Demo Projects May 2024
Using the UDPAppl Application

The following illustration gives you an overview of the Ethernet implementation


in ConfigurationDesk with standard Ethernet function blocks.

Ethernet controller

Ethernet Setup
function block

UDP Receive UDP Transmit TCP


function block function block function block

UDP/IP implementation in ConfigurationDesk The UDP/IP model is a


conceptual model of how UDP/IP communication works. The following
illustration shows the basic implementation of the UDP/IP model.
UDP/IP model ConfigurationDesk

Application layer Data bytes Behavior model

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

Ethernet Setup The Ethernet Setup function block provides access to an


Ethernet controller and specifies the local IP address. Several other function
blocks can use the access at the same time to transport data values.
For more information on configuring the Ethernet Setup function block, refer
to Configuring the Basic Functionality (Ethernet Setup) (ConfigurationDesk I/O
Function Implementation Guide ).

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

Referencing configuration The UDP on Ethernet property shows the


Ethernet Setup function block used to transmit/receive UDP messages. The
referenced Ethernet Setup function block provides the access to the Ethernet
controller and the local IP address.

Ethernet Switch The Ethernet Switch function block configures the


switching of Ethernet traffic of the assigned internal Ethernet switch. In this
demo, the Ethernet switch connects the used Ethernet controllers for direct
communication between the controllers. This configuration eliminates the need
for a bridge with an Ethernet patch cable.

For more information on configuring the internal Ethernet switch, refer to


Configuring the Basic Functionality (Ethernet Switch) (ConfigurationDesk I/O
Function Implementation Guide ).

Assigned hardware resources The assigned MicroAutoBox III hardware


resources offer the required Ethernet controllers.

74
ConfigurationDesk Using Demo Projects May 2024
Using the UDPAppl Application

Build results Build results are already available in the Project Manager.

Encoding/decoding in the behavior model The UDP protocol uses byte


arrays to exchange data values. To exchange values of data structures or
other data types via a UDP connection, the UDP demo model provides
Encode/Decode blocks to convert the data to several byte values and vice versa.
For example: A 64-bit integer value is converted to eight byte values that are
packed to one data vector. The following illustration shows an example.

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.

ControlDesk experiment The UDP ControlDesk experiment lets you select


different destination IP addresses for the UDP Transmit (1) function block
(Transmit 1) on the UDP page.

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

WheelspeedOutDemo Project: Simulating an Active


Wheel Speed Sensor

Where to go from here Information in this section

Using the WheelspeedDemoAppl Application.......................................... 77

Demo Model of a Wheelspeed Out Interface........................................... 78

Using the WheelspeedDemoAppl Application

Use scenario The WheelspeedDemoAppl application serves to demonstrate a signal chain


with a Wheelspeed Out function block that simulates the signals provided by
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.

For information on the Wheelspeed Out function block, refer to Wheelspeed


Out (ConfigurationDesk I/O Function Implementation Guide ).

Simulink® model For information on the connected Simulink® behavior


model, refer to Demo Model of a Wheelspeed Out Interface on page 78.

77
May 2024 ConfigurationDesk Using Demo Projects
WheelspeedOutDemo Project: Simulating an Active Wheel Speed Sensor

Assigned hardware resources The assigned SCALEXIO hardware resources


offer the required Analog Out channel type.

External device interface The external device interface contains a device


whose ports are mapped to the signal ports of the function blocks.

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.

Demo Model of a Wheelspeed Out Interface

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

§ The physical coding.


The physical coding describes how each data bit is physically transmitted to the
external device via data pulses. For details, refer to Encoding the Data Protocol
with the Wheelspeed Out Function Block (ConfigurationDesk I/O Function
Implementation Guide ).
§ The reduction of the data protocol if the time between two speed pulses is less
than the time needed to transmit all the data pulses. This might be the case if
the wheel rotates very fast. For details, refer to Notes on the Data Protocol
for Fast Rotating Wheels (ConfigurationDesk I/O Function Implementation
Guide ).
§ The specification of a gap to separate the speed and data output.
Whether you need to specify a gap depends on the wheel speed sensor that is
simulated.

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.

Model Block Description


Sensor Simulation This model block:
§ Scales the Speed input value from revolution per minute (RPM) to pitches per second (Pitches/s)
of the Speed output.
§ Builds the data protocol of the Data output.
The Speed, MountingPosition, and PolePairs inputs are the basis for the data protocol.
To detect the direction of rotation, the orientation of the mounted sensor must be clear. You
can specify this with the MountingPosition setting. This setting indicates whether positive speed

79
May 2024 ConfigurationDesk Using Demo Projects
WheelspeedOutDemo Project: Simulating an Active Wheel Speed Sensor

Model Block Description


values represent wheels rotating clockwise or anticlockwise. A setting to 1 indicates wheels rotating
clockwise at positive speed values. The number of PolePairs depends on the simulated magnetically
encoded wheel/ferromagnetic wheel.
Calc Signal Frequency This subsystem model block:
§ Scales the Speed input value from revolution per minute (RPM) to pitches per second (Pitches/s)
of the Speed output.
§ Sets the Direction output value. A setting to 1 indicates negative speed values.

Build Custom Sensor This subsystem model block:


Data § Sets the first 8 bits of the logical coding.

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.

Manchester Coding This subsystem model block:


§ Transforms the logical coded DataIn vector to the physical Manchester coding.
For details, refer to Encoding the Data Protocol with the Wheelspeed Out Function Block
(ConfigurationDesk I/O Function Implementation Guide ).
Reduce Data Protocol This subsystem model block:
§ Reduces the data protocol for fast rotating wheels.
The Speed and Cutoff Table inputs are the basis for the reduction.
The Cutoff Table is a look-up table with cutoff speed values (see Specific Cutoff Revolutions).
More or fewer bits of the data protocol are cut according to the Speed input value.
Specific Cutoff This subsystem model block:
Revolutions § Provides a look-up table for the Reduce Data Protocol block.

Add Gap This subsystem model block:


§ Adds a gap before and after the data protocol.
This gap separates the data output and the speed output when they are combined in one serial
protocol by the Wheelspeed Out function block in ConfigurationDesk.

80
ConfigurationDesk Using Demo Projects May 2024
Demo Model of a Wheelspeed Out Interface

Model Block Description


Map to I/O Function This subsystem model block:
§ Maps the DataIn vector size to the Data inport vector size of the Wheelspeed Out function
block in ConfigurationDesk.
Notation of the DataOut vector:
§ All 64 data pulses of the data protocol are written in a vector with 8 elements. For example:
{90;103;255;0;0;0;0;0}.
§ The decimal number of an element is a binary number with 8 digits, each of which stands for a
pulse. For example:
{90;...}decimal = {01011010;...}binary.
A 1 represents the pulse level that is specified by the Data pulse current property. A 0 represents
the pulse level that is specified by the Quiescent current property. The least significant digit
represents the first output pulse, the most significant digit represents the last output pulse.
§ The first element represents the first 8 output pulses, the second element the next 8 pulses, etc.
in the decimal notation.
§ There must be 8 vector elements, unused data pulses must be set to 0.

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

You might also like