Different (correct) handling of dependencies="" #130
Merged
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.
The standard specifies different behaviour for
dependencies=""
and thedependencies
-Tag not being present at all:(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 emptydependencies
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)