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

GSF-12 IndependentActionAdapterManagerBase fixes #356

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

StephenCWills
Copy link
Member

The queue of input measurement keys was unnecessary, because the synchronized operation was copying the reference to a local variable anyway. However, by keeping an old collection of input measurement keys in the queue, the adapter is much more likely to use an old collection of inputs against an updated DataSource leading to mismatches.


If you specify inputs manually by signal ID, InputMeasurementKeys might end up with a measurement key for an inactive measurement. This results in an error:

Failed to initialize adapter OSCILLATIONTEST!44291B81-4467-4A33-BD1A-6C19473BFD99: Cannot use NONE as input to frequency based oscillation detector. One voltage angle input measurement is required. Cannot initialize adapter.

By filtering inactive measurements early, we avoid these types of errors. We also avoid potential desyncs between the base class and the subclass during initialization. It's unlikely that an adapter developer would want an inactive measurement in their adapter, since they can't even query metadata for it from ActiveMeasurements.


The bulk calculation adapter updates its configuration whenever the DataSource is updated. If a child adapter was already initialized in a prior configuration update, the child adapter will be skipped and the adapters collection can no longer be used to reliably determine what the CurrentAdapterIndex is.

As an example, consider the case where ADAPTER1 is at index 0 and ADAPTER2 is at index 1. If you enable ADAPTER2 after the bulk calculator was already initialized, the child adapter for ADAPTER1 would already be initialized. Therefore, initialization of the child adapter for ADAPTER1 would be skipped, and adapters.Count is still 0. When initializing the child adapter for ADAPTER2, the base class informs the subclass that CurrentAdapterIndex is 0 so the subclass mistakenly returns the device ID for ADAPTER1.

@StephenCWills StephenCWills changed the title IndependentActionAdapterManagerBase fixes GSF-12 IndependentActionAdapterManagerBase fixes Jan 21, 2025
Copy link
Member

@ritchiecarroll ritchiecarroll left a comment

Choose a reason for hiding this comment

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

Changes look simple enough, but I have not tested - presume you have - so approving on that condition.

@ritchiecarroll ritchiecarroll merged commit b1c20b7 into master Jan 21, 2025
2 checks passed
@ritchiecarroll ritchiecarroll deleted the adapter-manager-fixes branch January 21, 2025 22:05
@StephenCWills
Copy link
Member Author

Yeah, I couldn't even figure out what the problem was without extensive testing. 😩

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.

2 participants