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: andreas.nicolai@… 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)

pipe.fmu (1.6 MB ) - added by anonymous 5 years ago.
pipe.mo (3.7 KB ) - added by hauke.hirsch@… 5 years ago.
modelica model of the fmu

Download all attachments as: .zip

Change History (11)

by anonymous, 5 years ago

Attachment: pipe.fmu added

comment:1 by Andreas Nicolai <andreas.nicolai@…>, 5 years ago

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)

comment:2 by Lennart Ochel, 5 years ago

Owner: changed from Lennart Ochel to arunkumar palanisamy
Status: newassigned

Thanks for your report.

comment:3 by Francesco Casella, 5 years ago

Milestone: Future1.16.0

comment:4 by arunkumar palanisamy, 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.

by hauke.hirsch@…, 5 years ago

Attachment: pipe.mo added

modelica model of the fmu

comment:5 by anonymous, 5 years ago

Hi, I've just added the corresponding modelica model. The fmu was created with OMEdit v1.13.2.

comment:6 by arunkumar palanisamy, 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:7 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:8 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:9 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.