vectorgrp / sil-kit

Vector SIL Kit – Open-Source Library for Connecting Software-in-the-Loop Environments
https://vectorgrp.github.io/sil-kit-docs
MIT License
99 stars 28 forks source link

Use Cases for Lifecycle and Virtual Time Synchronization Services #91

Closed VladislavNeufeld closed 3 weeks ago

VladislavNeufeld commented 1 month ago

Hello,

I'm not sure for what use cases I can use the lifecycle and virtual time synchronization service and would be happy if you could tell me some use cases where it makes sense to use it.

We are planning to use the Silkit as a virtual bus for co-simulation of virtual ECU type 3 networks. The virtual ECUs are integrated as FMUs with Silkit DLLs into the simulator (Silver, VEOS, Matlab/Simulink) and are using silkit services to exchange messages via automotive protocols.

I am wondering whether I can use the Virtual Time Synchronization service in the described use case in order to achieve determinism in my simulation? In our current solution the sender does not now whether the receiver received his message before the next simulation step starts. It might happen that frame event callbacks are processed downstream. This makes it sometimes tough to reproduce error cases.

I'm currently having difficulty imagining how I could integrate the time synchronization service into our current setup. Do I need a SiL tool/simulator which already supports Silkit in order to benefit from time synchronization service? Or could I incorporate another component into my SiL simulation setup which initializes the lifecycle service?

It would be nice if you could provide one real world example of a SiL simulation setup (tools, components) where this service is used and what is the benefit of using it (why not simple communication without lifecycle service). So that I have a better understanding of the capabilities of the Silkit.

Best regards

Vladislav

JoakimRobakowski commented 1 month ago

@VladislavNeufeld Given that you will be working with virtual ECU 'type 3' (which I assume refers to 'level 3'), it opens up a few specific use cases worth mentioning:

Virtual Time Synchronization Consideration: When using SIL Kit to connect different simulation environments, each with varying complexity, the simulation speed can differ significantly. For instance, a complex virtual ECU might run much slower than a restbus simulation in CANoe.

VladislavNeufeld commented 1 month ago

Hello @JoakimRobakowski, thank you for clarification.

And what do I need to do in order to synchronize a complex virtual ECU with the restbus simulation in CANoe using the Silkit? Do I need to implement one additional Silkit component (participant) which has the synchronization code and add it into the simulation in CANoe? So that this component can synchronize the virtual ECU component and the restbus simulation component/test execution engine?

JoakimRobakowski commented 1 month ago

@VladislavNeufeld You are correct; there must be a participant that controls the simulation progress. You can use the sil-kit-system-controller, a utility that is also included in this repository.

There are a couple of SIL Kit Demos that you could use to try out running with and without time synchronization (e.g., CAN Demo), and have a look at the source code of the demo applications how SIL Kit Virtual Time Synchronization can be implemented on the participant side.

If you are using simulation tools where SIL Kit is integrated, like Vector CANoe and Synopsys Silver, the configuration of the SIL Kit participants can often be done directly in the tools, or by a configuration file.

Going back to the CAN Demo: if you would like to set up a CANoe configuration to exchange data with the CAN Demo participants with time synchronization, you could prepare the following things in your CANoe configuration:

PRAVEENFrmBOSCH commented 1 month ago

Hello @JoakimRobakowski, Please share how to achieve below use case, MyConfig :

I am expecting determinism in my simulation as like below in each doStep,

  1. Tick (DoStep)
  2. sendFrames (send frames to Canoe)
  3. Receive Frames (all the periodic frames sent by Canoe should be received) for the same i need help.
JoakimRobakowski commented 1 month ago

Hello @PRAVEENFrmBOSCH, I am not sure what is not working for you, especially when you say that you are receiving the frames in async mode or that determinism is missing. Could you please elaborate more?

JoakimRobakowski commented 1 month ago

Hello @PRAVEENFrmBOSCH, You can also reach me at joakim.robakowski@vector.com :slightly_smiling_face: