Opened 10 years ago

Closed 7 years ago

#2764 closed defect (fixed)

ModelStructure with wrong dependencies for states and without dependencies for outputs

Reported by: rfranke@… Owned by: Willi Braun
Priority: high Milestone: 1.13.0
Component: FMI Version: trunk
Keywords: Cc:

Description

Using the current nightly build 1.9.1+dev (r21649), the following model

within ;
model DIC "Double Integrator Continuous-time"
  parameter Real p = 1 "gain for input";
  parameter Real y1_start = 1 "start value for first state";
  parameter Real y2_start = 0 "start value for second state";
  input Real u(start = -2);
  output Real y1, y2;
initial equation
  y1 = y1_start;
  y2 = y2_start;
equation
  der(y1) = p*u;
  der(y2) = y1;
end DIC;

can be exported as FMU 2.0 with the omc commands:

    loadFile("DIC.mo");
    translateModelFMU(DIC, version="2.0");

The file modelDescription.xml contains the following ModelStructure:

  <ModelStructure>
    <Outputs>
      <Unknown index="1" dependenciesKind="fixed" />
      <Unknown index="2" dependenciesKind="fixed" />
    </Outputs>
    <Derivatives>
      <Unknown index="3" dependencies="1" dependenciesKind="fixed" />
      <Unknown index="4" dependencies="2" dependenciesKind="fixed" />
    </Derivatives>
    <InitialUnknowns>
    </InitialUnknowns>
  </ModelStructure>

The Outputs section lists dependeciesKind, but is lacking the dependencies (indices). The Derivatives section states wrong dependencies. The expected ModelStructure is:
\partial y / \partial x
\partial y / \partial u

\partial der(x) / \partial x
\partial der(x) / \partial u

  <ModelStructure>
    <Outputs>
      <Unknown index="1" dependencies="1" dependenciesKind="fixed" />
      <Unknown index="2" dependencies="2" dependenciesKind="fixed" />
    </Outputs>
    <Derivatives>
      <Unknown index="3" dependencies="5" dependenciesKind="fixed" />
      <Unknown index="4" dependencies="1" dependenciesKind="fixed" />
    </Derivatives>
    <InitialUnknowns>
    </InitialUnknowns>
  </ModelStructure>

Change History (17)

comment:1 by Lennart Ochel, 10 years ago

Owner: changed from Adeel Asghar to Willi Braun
Status: newassigned

comment:2 by Willi Braun, 10 years ago

Status: assignedaccepted

comment:3 by Willi Braun, 10 years ago

Resolution: fixed
Status: acceptedclosed

fixed in r22294.

comment:4 by Rüdiger Franke, 10 years ago

Resolution: fixed
Status: closedreopened

Now the Derivatives section looks good for the given example! The Outputs section still is wrong though:

  <ModelStructure>
    <Outputs>
      <Unknown index="1" dependencies="5" dependenciesKind="dependent" />
      <Unknown index="2" dependencies="1" dependenciesKind="dependent" />
    </Outputs>
    <Derivatives>
      <Unknown index="3" dependencies="5" dependenciesKind="dependent" />
      <Unknown index="4" dependencies="1" dependenciesKind="dependent" />
    </Derivatives>
    <InitialUnknowns>
    </InitialUnknowns>
  </ModelStructure>

Note: the Outputs section looks good if additional variables are introduced for states, so that state variables differ from outputs.

comment:5 by Willi Braun, 10 years ago

This would mean I need to ignore the output declaration in the model, is this desired?

Since I really haven't found any specification text that a variable can't be a state and a output
at the same time.

comment:6 by Rüdiger Franke, 10 years ago

A variable can generally be state and output. See also Modelica.Blocks.Continuous.Integrator. I had discussed this in the FMI group and was told that FMI has intentionally be defined in a way supporting such models. Such outputs depend on themselves, i.e. output with index 1 depends on state with index 1 and output with index 2 depends on state with index 2.

in reply to:  4 comment:7 by Willi Braun, 10 years ago

Doh, you are of course right the output section is wrong. Somehow I mixed there somewhere states and states derivatives. I'll check that.

Replying to rfranke:

Note: the Outputs section looks good if additional variables are introduced for states, so that state variables differ from outputs.

Now, I also get the idea of that comment.

Last edited 10 years ago by Willi Braun (previous) (diff)

comment:8 by Willi Braun, 10 years ago

Status: reopenedaccepted

comment:9 by Adeel Asghar, 10 years ago

While we are fixing ModelStructure we should include InitialUnknowns & DiscreteStates.

I have added some support for InitialUnknowns in r22421. Also see #2765.

comment:10 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:11 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:12 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:13 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:14 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:15 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:16 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:17 by Willi Braun, 7 years ago

Milestone: 1.12.01.13.0
Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.