fix: reset FixedDelay state at the beginning of each run #289
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #285
The solution detects a change in the delay time and reallocates the data buffer accordingly. This required a bit of refactoring to prevent duplicate calculation of the number of buffer elements and the buffer size.
In the issue I forgot to mention that this situation only comes up when an SDEverywhere model is run more than once. Inputs to subsequent runs can cause a recalculation of the delay time argument to
FIXED DELAY
. Because the buffer is dynamically allocated, it is preserved across model runs. It needs to be reset on subsequent runs even if the buffer size has not changed. The solution handles that too.