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

Different (correct) handling of dependencies="" #130

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

halentin
Copy link
Contributor

@halentin halentin commented Oct 1, 2024

The standard specifies different behaviour for dependencies="" and the dependencies-Tag not being present at all:

If dependencies is not present, it must be assumed that the unknown depends on all knowns. If dependencies is present as empty list, the unknown depends on none of the knowns. Otherwise the unknown depends on the knowns defined by the given value references.

(from FMI3-Standard)

Currently we handle the first and second case identically with modelDescription.modelStructure.continuousStateDerivatives[n].dependencies = nothing. This leads to some very pessimistic handling of dependency-information in the second case. We basically have to assume that every variable that actually depends on nothing depends on everything instead. If a FMU has even one of those, we dont gain any performance from using Sparsity-Information.

I propose to leave the first case as it is (modelStructure.continuousStateDerivatives[n].dependencies = nothing) and using an empty array for the second case (modelStructure.continuousStateDerivatives[n].dependencies = UInt[]). This makes it possible to differentiate the two cases while adding minimal overhead (1 pointer/allocation per empty dependencies and they are not that common as far as i can tell).

This PR contains the behaviour described above, as well as Tests for it.

Note that there are currently no FMI3-Reference-FMUs with dependencies="", so there is currently no Test for this case. I submitted an upstream-Issue: modelica/Reference-FMUs#597 (comment)

@ThummeTo ThummeTo merged commit 7339fea into ThummeTo:main Oct 11, 2024
9 of 10 checks passed
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