Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Verify that all derivatives have the derivative attribute #21

Closed
modelica-trac-importer opened this issue Feb 8, 2018 · 1 comment
Closed

Comments

@modelica-trac-importer
Copy link

Reported by ottot on 3 Jan 2017 10:39 UTC
From page 54 of the standard (2.0), regarding the derivative attribute:

The state derivatives of an FMU are listed under element
<ModelStructure><Derivatives>. All ScalarVariables listed in this element must have 
attribute derivative

The compliance checker could be enhanced to actually verify that all variables listed in <Derivatives> have the required derivative attribute.


Migrated-From: https://trac.fmi-standard.org/ticket/397

@filip-stenstrom
Copy link
Collaborator

filip-stenstrom commented Aug 5, 2020

This is already fixed in 2.0.4.

Running on an FMU with XML produces error:

[ERROR][FMI2XML] The state derivative 'state_var' does not specify the state variable that it is a derivative of.

Part of XML:

<ModelVariables>
    <!-- idx: 1 -->
    <ScalarVariable name="state_var" valueReference="0">
      <Real/>
    </ScalarVariable>
    <!-- idx: 2 -->
    <ScalarVariable name="der(state_var)" valueReference="1" causality="output" variability="continuous" initial="approx">
      <Real derivative="1" start="1.0"/>
    </ScalarVariable>
</ModelVariables>

<ModelStructure>
  <Derivatives>
    <Unknown index="1"/> <!-- Invalid: referenced variable is not a derivative -->
    <Unknown index="2"/>
  </Derivatives>
</ModelStructure>

Full FMU for replication is attached (no binaries, so run with -x flag).

I found a related issue though: there is no verification that the variable referenced by derivative a valid state variable (variability="continuous", type: Real, ...). I will create a new ticket for this.

Edit: new ticket: #56

check_state_derivatives.fmu.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants