Opened 5 years ago
Last modified 3 years ago
#5686 assigned defect
Invalid FMU Export: Enumeration without start value and/or invalid combination of "input" and "fixed"
Reported by: | Owned by: | arunkumar palanisamy | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | FMI | Version: | |
Keywords: | Cc: |
Description
Hi all,
I noticed that OpenModelica exports enumeration input values for example as follows:
---
<!-- Index of variable = "523" -->
<ScalarVariable
name="Input.flowDirection"
valueReference="20"
description="Allowed flow direction"
variability="fixed"
causality="input"
<Enumeration declaredType="Modelica.Fluid.Types.PortFlowDirection"/>
</ScalarVariable>
---
Importing such an FMU into a Co-Simulation master fails because the master does not have a valid initial value/selection for the enumeration value.
According to the FMI standard, the combination of "input" and "fixed" is invalid, when no initial value is given (see "Functional Mock-up Interface 2.0", July 25, 2014, Page 48 of 126).
I think this should be fixed by providing an initial value/selection for the enumeration.
Attachments (2)
Change History (11)
by , 5 years ago
comment:1 by , 5 years ago
comment:3 by , 5 years ago
Milestone: | Future → 1.16.0 |
---|
comment:4 by , 5 years ago
@Andreas Nicolai Can you make a small modelica model which reproduces this problem so that it is easier for us to debug it.
comment:5 by , 5 years ago
Hi, I've just added the corresponding modelica model. The fmu was created with OMEdit v1.13.2.
comment:6 by , 5 years ago
The model is still big to debug the problem, Can you make simple modelica model which reporduces the problem , I have created a small modelica model which does not reproduce the problem, Please have a look into this.
type Enum = enumeration(test1,test2,test3); model TypeEnumeration input Enum et; output Enum et1; Enum et2(start=Enum.test2,fixed=true); equation et1 = et.test2; et2 = Enum.test3; end TypeEnumeration;
And generating the fmu, gives me the following
<ModelVariables> <!-- Index of variable = \"1\" --> <ScalarVariable name=\"_D_outputAlias_et1\" valueReference=\"0\" variability=\"discrete\" causality=\"local\" initial=\"calculated\"> <Enumeration declaredType=\"Enum\"/> </ScalarVariable> <!-- Index of variable = \"2\" --> <ScalarVariable name=\"et\" valueReference=\"1\" variability=\"discrete\" causality=\"input\" > <Enumeration declaredType=\"Enum\" start=\"0\"/> </ScalarVariable> <!-- Index of variable = \"3\" --> <ScalarVariable name=\"et1\" valueReference=\"2\" variability=\"discrete\" causality=\"output\" initial=\"exact\"> <Enumeration declaredType=\"Enum\" start=\"2\"/> </ScalarVariable> <!-- Index of variable = \"4\" --> <ScalarVariable name=\"et2\" valueReference=\"3\" variability=\"discrete\" causality=\"local\" initial=\"exact\"> <Enumeration declaredType=\"Enum$et2\" start=\"2\"/> </ScalarVariable> </ModelVariables>
I see that you are using older version of OpenModelica, you should try to generate the fmus with newer version and see if the problem exists, if not can you make a mininimal modelica example which reproduces the problem
comment:8 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
To be concrete: please add a "start" attribute to the Enumeration tag.
(I don't think there must be an "initial"="exact" attribute for the ScalarVariable tag. Actually, I don't think this would be allowed for causality=input)