Opened 10 years ago
Closed 10 years ago
#3205 closed defect (fixed)
Wrong causality in FMI 2 export
Reported by: | Rüdiger Franke | Owned by: | Adeel Asghar |
---|---|---|---|
Priority: | high | Milestone: | 1.9.2 |
Component: | FMI | Version: | trunk |
Keywords: | Cc: |
Description
The following model combines an input and an output in one connector:
package ConnectorIO connector IO input Real u; output Real y; end IO; model Test IO io; equation io.y = 2*io.u + 1; end Test; end ConnectorIO;
When exporting ConnectorIO.Test as FMU 2.0, the model description contains the right ModelStructure, listing io.y in the Outputs section. The ModelVariables declare io.y with causality local though, which is wrong:
<ModelVariables> <!-- Index of variable = "1" --> <ScalarVariable name="io.u" valueReference="0" variability="continuous" causality="input" initial="approx"> <Real/> </ScalarVariable> <!-- Index of variable = "2" --> <ScalarVariable name="io.y" valueReference="1" variability="continuous" causality="local" initial="calculated"> <Real/> </ScalarVariable> </ModelVariables> <ModelStructure> <Outputs> <Unknown index="2" dependencies="1" dependenciesKind="dependent" /> </Outputs> <Derivatives> </Derivatives> <InitialUnknowns> </InitialUnknowns> </ModelStructure>
Note:
See TracTickets
for help on using tickets.
Here is a patch that seems to solve the problem. It appears that the frontend already filters out internal outputs of nested components. This is why the check for DAE.CREF_IDENT might not be needed in SimCodeUtil.getCausality. Can someone check if this is true?
Compiler/SimCode/SimCodeUtil.mo
DAE.CREF_IDENT(), varDirection = DAE.OUTPUT()), _) then SimCodeVar.OUTPUT();