Opened 4 years ago

Closed 4 years ago

#6151 closed defect (fixed)

FMI model structure dependencies wrong

Reported by: AnHeuermann Owned by: AnHeuermann
Priority: blocker Milestone: 1.17.0
Component: FMI Version: v1.17.0-dev
Keywords: fmi, modelDescription, dependencies, model structure Cc: arun3688

Description

The indices used to show dependencies in modelDesription.xml for FMI 2.0 are wrong. Some are wrong by one Probably, because the index of variables starts counting at 1 and the valueReference used for FMI starts at 0.
But there are also variables dependent to non-exising valueReferences.

I have an example I'm not sure I'm allowed to share, but I can show the problem with some parts of the modelDescription.xml of it:

<?xml version="1.0" encoding="UTF-8"?>
<fmiModelDescription
[...]
  <ModelVariables>
  [...]
  <!-- Index of variable = "29" -->
  <ScalarVariable
    name="tau"
    valueReference="28"
    causality="output"
    >
    <Real/>
  </ScalarVariable>
  <!-- Index of variable = "30" -->
  <ScalarVariable
    name="v"
    valueReference="29"
    causality="output"
    >
    <Real/>
  </ScalarVariable>
  [...]
  </ModelVariables>
  <ModelStructure>
    <Outputs>
      <Unknown index="29" dependencies="11 32" dependenciesKind="dependent dependent" />
      <Unknown index="30" dependencies="32" dependenciesKind="dependent" />
    </Outputs>
    <InitialUnknowns>
      <Unknown index="29" dependencies="23 31 43 44 92 93 116 118" dependenciesKind="dependent dependent dependent dependent dependent dependent dependent dependent" />
    [...]
    </InitialUnknowns>
  </ModelStructure>
</fmiModelDescription>

We have outputs tau and v with valueReference=28 and valueReference=29.
In the ModelStrucutre Outputs those are refered to index 29 and 30.

And the second problem is displayed by the dependencies of the initial unknown 29 (which should be 28 I guess) to valueReferences 116 118.
But the highest index in the modelDescription is 107.

My guess is that those index are from variables that are not exposed to the modelDescription, e.g. some temp variables or some cse variables.

Change History (10)

comment:1 Changed 4 years ago by AnHeuermann

  • Version set to v1.17.0-dev

comment:2 Changed 4 years ago by AnHeuermann

  • Milestone changed from Future to 1.17.0

comment:3 follow-up: Changed 4 years ago by AnHeuermann

Okay, the first problem is not a problem at all. The FMI Standard 2.0.1 states on page 62:

index: The ScalarVariable index of the Unknown 𝑣_𝑢𝑛𝑘𝑛𝑜𝑤𝑛. [For example, if there are 10
ScalarVariables and index = 3, then the third ScalarVariable is the unknown
defined with this element.]

But the second problem is still valid. A bit of debugging could reveal what variable has value reference 116 and 118.

comment:4 in reply to: ↑ 3 ; follow-up: Changed 4 years ago by casella

  • Priority changed from high to blocker

Replying to AnHeuermann:

But the second problem is still valid. A bit of debugging could reveal what variable has value reference 116 and 118.

Maybe a problem with alias variables?

Anyway, this should be fixed with high priority

comment:5 in reply to: ↑ 4 Changed 4 years ago by Karim.Abdelhak

Replying to casella:

Replying to AnHeuermann:

But the second problem is still valid. A bit of debugging could reveal what variable has value reference 116 and 118.

Maybe a problem with alias variables?

Anyway, this should be fixed with high priority

I don't think it can be alias variables, the dependency analysis should take place after removal of simple equations.

My guess is that it could be auxiliary variables (like $cse), or that array/record sizes are computed incorrectly while generating the index.

comment:6 Changed 4 years ago by AnHeuermann

  • Cc arun3688 added

It turns out that 116 and 118 are constants.

They are not present in the modelDescription. Either we add constants to the modelDescription as variables with causality=parameter and variability=constant or simply remove them from the dependency list.

I'm in favor for the second option. Removing them is simple and fast.
But #5881 wants to have constants inside the FMU modelDescription.
@arun3688 Are you currently working on #5881?

comment:7 Changed 4 years ago by arun3688

@andreas i am not working on #5881 yet

comment:8 Changed 4 years ago by AnHeuermann

Then I'll remove it and add a note to #5881 what to change if anyone want's to include constants to the modelDescription.xml

comment:10 Changed 4 years ago by AnHeuermann

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.