-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New queueless VILLAS interface / improve real-time performance #316
Conversation
@n-eiling this reduces the latency by removing the intermediate queue, hoping that the sync call to villas returns very quickly and does not block dpsim for too long? It seems like a good idea if you do not only care about real-time in the simulation but also across the interface. |
Yes there are some, but not for the reason you are thinking. Some nodes have internal queues as the underlying libraries have callback based APIs or work in a background thread which require a queue to exchange samples with the main VILLASnode thread.
I agree here. I think both use cases are valid. But most people probably will use DPsim with the non hard real-time VILLASndoe node-types which use syscalls / network I/O anyway. In that cases, I would still recommend to use the queue-based interface @n-eiling Does your new interface also support non-blocking operation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a first pass of review. But I think also @m-mirz or @dinkelbachjan should have a closer look.
The FpgaExample uses no queue, no VILLAS path and consequently is purely single-threaded. To achieve time steps in the microsecond range, even simple synchronization primitives create too much delay - even polling would create jitter. |
I changed the clang format file so it enforces @stv0g comment style. If this does not work for you I would prefer that we fix the clang format file in a separate PR, because this gets really messy here. |
cb78369
to
992cbcd
Compare
Quality Gate passedIssues Measures |
I don't think the CI errors are caused by this PR. The tests are missing |
The original villas interface was not real-time capable because of the queue it uses. This commit creates an interface for villas interfaces, moves the old implementation to InterfaceQueued and adds a new queueless, threadless implementation InterfaceQueueless. Signed-off-by: Niklas Eiling <[email protected]>
The DP_Ph1_VoltageSource always calculates a sinusoidal signal, even if we only want to set a DC value. This commit adds a DC generator for the model so it can be significantly faster if we do not need the sinusoidal signal. Signed-off-by: Niklas Eiling <[email protected]>
Signed-off-by: Niklas Eiling <[email protected]>
Speeds up simulation by several orders of magnitude Signed-off-by: Niklas Eiling <[email protected]>
Signed-off-by: Niklas Eiling <[email protected]>
Signed-off-by: Niklas Eiling <[email protected]>
Signed-off-by: Niklas Eiling <[email protected]>
Signed-off-by: Niklas Eiling <[email protected]>
…rface Signed-off-by: Niklas Eiling <[email protected]>
…ed and not always when the frequency is 0. This should avoid any regressions. Signed-off-by: Niklas Eiling <[email protected]>
Signed-off-by: Niklas Eiling <[email protected]>
@stv0g I think that the critical points are taken care of. Would you agree to merge? |
Quality Gate passedIssues Measures |
@stv0g ping :) |
@stv0g ping! |
@stv0g pong! |
@m-mirz can you just merge it without steffens approval? I addressed the most important points of his review and the remaining points are not really critical. I have quite a bit of changes depending on this that have been waiting for this PR for months now. |
I think the important issues are addressed and we should move forward with this.
villas interface: improve real-time capability
The original villas interface was not real-time capable because of the queue it uses. This commit creates an interface for villas interfaces, moves the old implementation to InterfaceQueued and adds a new queueless, threadless implementation InterfaceQueueless.
models: Add DC voltage source
The DP_Ph1_VoltageSource always calculates a sinusoidal signal, even if we only want to set a DC value. This commit adds a DC generator for the model so it can be significantly faster if we do not need the sinusoidal signal.
FpgaExample: use new villas interface and make logging optional.