Demos

This document describes the usage of the demo projects that are included with the Vector SIL Kit project and what their expected output and or results are. All demo source code is located in the Git repository in the folder Demos.

Note

All paths on this page are relative to the top level of the pre-built Vector SIL Kit packages.

To build the demos, please refer to Building the Demos.

Building the Demos

This descriptions refers to the package structures as provided within the pre-built Vector SIL Kit releases. It is not directly applicable for building the demos from source.

For building the demos, cmake has to be installed on your system and a corresponding cpp compiler has to be available.

Building the demos from a pre-built Vector SIL Kit is straight forward, just run the following commands from within the “SilKit-Demos” directory:

mkdir build
cd build
cmake ..
cmake --build .

The individual demos are then built into ./SilKit/bin in the root directory of the package.

Note

The distributed Demos, as packaged by CPack, are preconfigured to build against a copy of the SIL Kit binaries in ../SilKit/. This can be overridden by providing your own SilKit CMake target library, before the demos are configured by CMake. Or by changing the find_package(SilKit ... PATHS path/to/SilKit) statement directly in the ./SilKit-Demos/CMakeLists.txt directory.

CAN Demo

Abstract

CAN Reader/Writer with or without network simulator

Source location

./SilKit-Demos/Can

Requirements

Parameters

<ParticipantConfiguration.yaml>

File name of the participant configuration to be used; use DemoCan.silkit.yaml for an example configuration.

<ParticipantName>

The name of the participant within the simulation; must either be CanWriter or CanReader.

[RegistryUri]

The silkit:// URI of the registry to connect to; defaults to silkit://localhost:8500 (optional).

[--async]

If async flag is set, the participant will join the simulation unsynchronized and it will not need the ./SilKit/bin/sil-kit-system-controller to start.

Parameter Example

# Creates a CAN Writer Process with the registry's default URI
./SilKit/bin/SilKitDemoCan ./SilKit-Demos/Can/DemoCan.silkit.yaml CanWriter

System Example

For synchronized execution:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Monitor (optional):
./SilKit/bin/sil-kit-monitor

# CAN Reader:
./SilKit/bin/SilKitDemoCan ./SilKit-Demos/Can/DemoCan.silkit.yaml CanReader

# CAN Writer:
./SilKit/bin/SilKitDemoCan ./SilKit-Demos/Can/DemoCan.silkit.yaml CanWriter

# System Controller:
./SilKit/bin/sil-kit-system-controller CanReader CanWriter

For unsynchronized execution:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# CAN Reader:
./SilKit/bin/SilKitDemoCan ./SilKit-Demos/Can/DemoCan.silkit.yaml CanReader --async

# CAN Writer:
./SilKit/bin/SilKitDemoCan ./SilKit-Demos/Can/DemoCan.silkit.yaml CanWriter --async

Notes

- The writer sends CAN frames at a fixed rate of one frame per simulation step (1ms).
- Both reader and writer sleep for 1 second per quantum to slow down execution.

Ethernet Demo

Abstract

Ethernet Reader / Writer with or without network simulator

Source location

./SilKit-Demos/Ethernet

Requirements

Parameters

<ParticipantConfiguration.yaml>

File name of the participant configuration to be used; use DemoEthernet.silkit.yaml for an example configuration.

<ParticipantName>

The name of the participant within the simulation; must either be EthernetWriter or EthernetReader.

[RegistryUri]

The silkit:// URI of the registry to connect to; defaults to silkit://localhost:8500 (optional).

[--async]

If async flag is set, the participant will join the simulation unsynchronized and it will not need the ./SilKit/bin/sil-kit-system-controller to start.

Parameter Example

# Creates an Ethernet Writer Process with the registry's default URI:
./SilKit/bin/SilKitDemoEthernet ./SilKit-Demos/Ethernet/DemoEthernet.silkit.yaml EthernetWriter

System Example

For synchronized execution:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Monitor (optional):
./SilKit/bin/sil-kit-monitor

# Ethernet Reader:
./SilKit/bin/SilKitDemoEthernet ./SilKit-Demos/Ethernet/DemoEthernet.silkit.yaml EthernetReader

# Ethernet Writer:
./SilKit/bin/SilKitDemoEthernet ./SilKit-Demos/Ethernet/DemoEthernet.silkit.yaml EthernetWriter

# System Controller:
./SilKit/bin/sil-kit-system-controller EthernetReader EthernetWriter

For unsynchronized execution:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Ethernet Reader:
./SilKit/bin/SilKitDemoEthernet ./SilKit-Demos/Ethernet/DemoEthernet.silkit.yaml EthernetReader --async

# Ethernet Writer:
./SilKit/bin/SilKitDemoEthernet ./SilKit-Demos/Ethernet/DemoEthernet.silkit.yaml EthernetWriter --async

Notes

- The writer sends Ethernet frames at a fixed rate of one frame per simulation step (1ms).
- Both reader and writer sleep for 1 second per simulation step to slow down execution.

LIN Demo

Abstract

LIN Master and Slave demo. The master sends and requests messages from a LIN slave.

Source location

./SilKit-Demos/Lin

Requirements

Parameters

<ParticipantConfiguration.yaml>

File name of the participant configuration to be used; use DemoLin.silkit.yaml for an example configuration.

<ParticipantName>

The name of the participant within the simulation; must either be EthernetWriter or EthernetReader.

[RegistryUri]

The silkit:// URI of the registry to connect to; defaults to silkit://localhost:8500 (optional).

[--async]

If async flag is set, the participant will join the simulation unsynchronized and it will not need the ./SilKit/bin/sil-kit-system-controller to start.

Parameter Example

# Creates a LIN Master Process with the registry's default URI:
./SilKit/bin/SilKitDemoLin ./SilKit-Demos/Lin/DemoLin.silkit.yaml LinMaster

System Example

For synchronized execution:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Monitor (optional):
./SilKit/bin/sil-kit-monitor

# LIN Master:
./SilKit/bin/SilKitDemoLin ./SilKit-Demos/Lin/DemoLin.silkit.yaml LinMaster

# LIN Slave:
./SilKit/bin/SilKitDemoLin ./SilKit-Demos/Lin/DemoLin.silkit.yaml LinSlave

# System Controller:
./SilKit/bin/sil-kit-system-controller LinSlave LinMaster

For unsynchronized execution:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# LIN Master:
./SilKit/bin/SilKitDemoLin ./SilKit-Demos/Lin/DemoLin.silkit.yaml LinMaster --async

# LIN Slave:
./SilKit/bin/SilKitDemoLin ./SilKit-Demos/Lin/DemoLin.silkit.yaml LinSlave --async

Notes

Both Master and Slave sleep for a hort duration per simulation step to slow down execution.

FlexRay Demo

Abstract

FlexRay Demo for a FlexRay cluster containing two nodes

Source location

./SilKit-Demos/FlexRay

Requirements

Parameters

<ParticipantConfiguration.yaml>

File name of the participant configuration to be used; use DemoFlexRay.silkit.yaml for an example configuration.

<ParticipantName>

The name of the participant within the simulation; must either be Node0 or Node1.

[RegistryUri]

The silkit:// URI of the registry to connect to; defaults to silkit://localhost:8500 (optional).

Parameter Example

# Creates a FlexRay Process for Node 0 with the registry's default URI:
./SilKit/bin/SilKitDemoFlexRay ./SilKit-Demos/FlexRay/DemoFlexRay.silkit.yaml Node0

System Example

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Network Simulator (assumed to be in PATH, necessary):
sil-kit-network-simulator ./SilKit-Demos/FlexRay/NetworkSimulatorConfig.yaml

# Monitor (optional):
./SilKit/bin/sil-kit-monitor

# Node 0:
./SilKit/bin/SilKitDemoFlexRay ./SilKit-Demos/FlexRay/DemoFlexRay.silkit.yaml Node0

# Node 1:
./SilKit/bin/SilKitDemoFlexRay ./SilKit-Demos/FlexRay/DemoFlexRay.silkit.yaml Node1

# System Controller:
./SilKit/bin/sil-kit-system-controller Node0 Node1 NetworkSimulator

Notes

Starting the FlexRay cycle takes quite some time, which is accurately modeled by the SIL Kit Network Simulator. It takes somewhat between 50 and 100 ms until the first FlexRay messages are transmitted.

Publish/Subscribe Demo

Abstract

Data Message Publish/Subscribe Demo for a set of Publishers/Subscribers

Source location

./SilKit-Demos/PubSub

Requirements

Parameters

<ParticipantConfiguration.yaml>

File name of the participant configuration to be used; use DemoPubSub.silkit.yaml for an example configuration.

<ParticipantName>

The name of the participant within the simulation; must either be Publisher or Subscriber.

[RegistryUri]

The silkit:// URI of the registry to connect to; defaults to silkit://localhost:8500 (optional).

[--async]

If async flag is set, the participant will join the simulation unsynchronized and it will not need the ./SilKit/bin/sil-kit-system-controller to start.

Parameter Example

# Creates a publisher with the registry's default URI:
./SilKit/bin/SilKitDemoPubSub ./SilKit-Demos/PubSub/DemoPubSub.silkit.yaml Publisher

System Example

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Monitor (optional):
./SilKit/bin/sil-kit-monitor

# Publisher:
./SilKit/bin/SilKitDemoPubSub ./SilKit-Demos/PubSub/DemoPubSub.silkit.yaml Publisher

# Subscriber:
./SilKit/bin/SilKitDemoPubSub ./SilKit-Demos/PubSub/DemoPubSub.silkit.yaml Subscriber

# System Controller:
./SilKit/bin/sil-kit-system-controller Publisher Subscriber

For unsynchronized execution:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Publisher:
./SilKit/bin/SilKitDemoPubSub ./SilKit-Demos/PubSub/DemoPubSub.silkit.yaml Publisher --async

# Subscriber:
./SilKit/bin/SilKitDemoPubSub ./SilKit-Demos/PubSub/DemoPubSub.silkit.yaml Subscriber --async

Notes

The publisher and subscriber show how to serialize/deserialize different kinds of data with the built-in Data Serialization API.

RPC Demo

Abstract

Remote Procedure Call Demo. The client triggers remote procedure calls on the server.

Source location

./SilKit-Demos/Rpc

Requirements

Parameters

<ParticipantConfiguration.yaml>

File name of the participant configuration to be used; use DemoRpc.silkit.yaml for an example configuration.

<ParticipantName>

The name of the participant within the simulation; must either be Server or Client.

[RegistryUri]

The silkit:// URI of the registry to connect to; defaults to silkit://localhost:8500 (optional).

[--async]

If async flag is set, the participant will join the simulation unsynchronized and it will not need the ./SilKit/bin/sil-kit-system-controller to start.

Parameter Example

# Creates an RPC server process with the registry's default URI:
./SilKit/bin/SilKitDemoRpc ./SilKit-Demos/Rpc/DemoRpc.silkit.yaml Server

System Example

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Monitor (optional):
./SilKit/bin/sil-kit-monitor

# Server:
./SilKit/bin/SilKitDemoRpc ./SilKit-Demos/Rpc/DemoRpc.silkit.yaml Server

# Client:
./SilKit/bin/SilKitDemoRpc ./SilKit-Demos/Rpc/DemoRpc.silkit.yaml Client

# System Controller:
./SilKit/bin/sil-kit-system-controller Server Client

For unsynchronized execution:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Server:
./SilKit/bin/SilKitDemoRpc ./SilKit-Demos/Rpc/DemoRpc.silkit.yaml Server --async

# Client:
./SilKit/bin/SilKitDemoRpc ./SilKit-Demos/Rpc/DemoRpc.silkit.yaml Client --async

Notes

Client participant has two RPC clients which call the Add100 and Sort functions on the Server participant’s two RPC servers.

Benchmark Demo

Abstract

Benchmark Demo. Used for evaluating SIL Kit performance of publish/subscribe communication.

Source location

./SilKit-Demos/Benchmark

Requirements

None (The demo starts its own instance of the registry and system controller).

Positional parameters

[numberOfSimulationRuns]

Sets the number of simulation runs to perform.

[simulationDuration]

Sets the virtual simulation duration <S>.

[numberOfParticipants]

Sets the number of simulation participants <N>.

[messageCount]

Sets the number of messages <M> to be send in each simulation step.

[messageSizeInBytes]

Sets the message size <B>.

[registryURi]

The URI of the registry to start.

Optional parameters

--help

Show the help message.

--registry-uri

The URI of the registry to start. Default: silkit://localhost:8500

--message-size

Sets the message size <B> in bytes. Default: 1000

--message-count

Sets the number of messages <M> to be send in each simulation step. Default: 50

--number-participants

Sets the number of simulation participants <N>. Default: 2

--number-simulation-runs

Sets the number of simulation runs to perform. Default: 4

--simulation-duration

Sets the simulation duration <S> (virtual time). Default: 1s

--configuration

Path and filename of the participant configuration YAML file. Default: empty

--write-csv

Path and filename of CSV file with benchmark results. Default: empty

Parameter Example

# Launch the benchmark demo with default arguments but 3 participants and a non default registry URI to avoid collisions:
./SilKit/bin/SilKitDemoBenchmark --number-participants 3 --registry-uri silkit://localhost:8501

# Launch the benchmark demo with positional arguments, a specified configuration file:
./SilKit/bin/SilKitDemoBenchmark 4 1 2 1 10 --configuration ./SilKit-Demos/Benchmark/DemoBenchmarkDomainSocketsOff.silkit.yaml

Notes

This benchmark demo produces timings of a configurable simulation setup. <N> participants exchange <M> of <B> bytes per simulation step with a fixed simulation step size of 1ms and run for <S> seconds (virtual time).

This simulation run is repeated <K> times and averages over all runs are calculated. Results for average runtime, speedup (virtual time/runtime), throughput (data size/runtime), message rate (count/runtime) including the standard deviation are printed.

The demo uses publish/subscribe controllers with the same topic for the message exchange, so each participant broadcasts the messages to all other participants. The configuration file DemoBenchmarkDomainSocketsOff.silkit.yaml can be used to disable domain socket usage for more realistic timings of TCP/IP traffic. With DemoBenchmarkTCPNagleOff.silkit.yaml, Nagle’s algorithm and domain sockets are switched off.

The demo can be wrapped in helper scripts to run parameter scans, e.g., for performance analysis regarding different message sizes. See .\SilKit-Demos\Benchmark\msg-size-scaling\Readme.md and .\SilKit-Demos\Benchmark\performance-diff\Readme.md for further information.

Latency Demo

Abstract

Latency Demo. Used for evaluating SIL Kit performance of publish/subscribe communication.

Source location

./SilKit-Demos/Benchmark

Requirements

Positional parameters

[messageCount]

Sets the number of messages to be send in each simulation step.

[messageSizeInBytes]

Sets the message size.

[registryURi]

The URI of the registry to start.

Optional parameters

--help

Show the help message.

--isReceiver

This process is the receiving counterpart of the latency measurement. Default: false

--registry-uri

The URI of the registry to start. Default: silkit://localhost:8500

--message-size

Sets the message size. Default: 1000

--message-count

Sets the number of messages to be send in each simulation step. Default: 1000

--configuration

Path and filename of the participant configuration YAML file. Default: empty

--write-csv

Path and filename of csv file with benchmark results. Default: empty

Parameter Example

# Launch the two LatencyDemo instances with positional arguments and a specified configuration file:
./SilKit/bin/SilKitDemoLatency 100 1000
./SilKit/bin/SilKitDemoLatency 100 1000 --isReceiver

# Launch the LatencyDemo with positional arguments and a specified configuration file:
./SilKit/bin/SilKitDemoLatency 100 1000 --configuration ./SilKit-Demos/Benchmark/DemoBenchmarkDomainSocketsOff.silkit.yaml

Notes

This latency demo produces timings of a configurable simulation setup. Two participants exchange <M> messages of <B> bytes without time synchronization.

The demo uses publish/subscribe controllers performing a message roundtrip (ping-pong) to calculate latency and throughput timings.

Note that the two participants must use the same parameters for valid measurement and one participant must use the --isReceiver flag.

Network Simulator Demo

Abstract

Demo usage of the Network Simulation API

Source location

./SilKit-Demos/NetworkSimulator

Requirements

Parameters

<ParticipantConfiguration.yaml>

File name of the participant configuration to be used; use DemoNetSim.silkit.yaml for an example configuration.

<ParticipantName>

The name of the participant within the simulation.

[RegistryUri]

The silkit:// URI of the registry to connect to; defaults to silkit://localhost:8500 (optional).

Parameter Example

# Start the Network Simulator Demo with the given config and participant name
./SilKit/bin/SilKitDemoNetSim ./SilKit-Demos/NetworkSimulator/DemoNetSim.silkit.silkit.yaml NetworkSimulator

System Example

Interplay with CAN Demo:

# Registry (if not already running):
./SilKit/bin/sil-kit-registry

# Monitor (optional):
./SilKit/bin/sil-kit-monitor

# CAN Reader:
./SilKit/bin/SilKitDemoCan ./SilKit-Demos/Can/DemoCan.silkit.yaml CanReader

# CAN Writer:
./SilKit/bin/SilKitDemoCan ./SilKit-Demos/Can/DemoCan.silkit.yaml CanWriter

# System Controller:
./SilKit/bin/sil-kit-system-controller CanReader CanWriter NetworkSimulator

# Network Simulator Demo:
./SilKit/bin/SilKitDemoNetSim ./SilKit-Demos/NetworkSimulator/DemoNetSim.silkit.silkit.yaml NetworkSimulator

Notes

  • The CAN Reader and Writer configure their controller on the network “CAN1”, which is simulated by the network simulator demo.

  • In the simple bus logic of the network simulation demo (see Demos\NetworkSimulator\src\Can\MySimulatedCanController.cpp), the acknowledgement (CanFrameTransmitEvent) is sent directly to the CAN Writer. The frame itself (CanFrameEvent) is sent with a delay of 2ms.