Skip to content
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

fix: reset FixedDelay state at the beginning of each run #289

Merged
merged 2 commits into from
Dec 8, 2022

Conversation

ToddFincannonEI
Copy link
Collaborator

@ToddFincannonEI ToddFincannonEI commented Dec 8, 2022

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.

Copy link
Contributor

@chrispcampbell chrispcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I wish there was an automated test for this but understand that we don't have the infrastructure at the moment to have tests that verify results for multiple run iterations. (I'm planning to add JS-level integration tests that should make that sort of thing possible, but not quite there yet.) Anyway! I'll merge this now.

@chrispcampbell chrispcampbell merged commit b5e03c4 into main Dec 8, 2022
@chrispcampbell chrispcampbell deleted the todd/285-fixed-delay-reset branch December 8, 2022 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reallocate the FIXED DELAY data buffer when delay time changes
2 participants