modelica-tools / FMUComplianceChecker

FMI Compliance Checker for validation of FMUs 1.0 and 2.0
BSD 3-Clause "New" or "Revised" License
42 stars 31 forks source link

Additional checks for correct model structure in Compliance Checker needed #27

Open modelica-trac-importer opened 6 years ago

modelica-trac-importer commented 6 years ago

Reported by awad.mukbil on 7 Feb 2017 11:53 UTC The compliance checker does not detect errors in the attached FMU (which is, e.g. rejected by Dymola). The attached FMU is an erroneous FMU of bouncingBall.fmu that came with QTronic FMUSDK 2.0.4. The following two errors in the <ModelStructure> element of the modeldescription.xml should be detected:

Error 1: Invalid Derivatives indices in ModelStructure element

According to the FMI version 2.0 standard, page 58, only state derivatives should be listed in <Derivatives>(not states). In this FMU, the <Derivatives> has elements with indices of states [1, 3], instead of state derivatives [2, 4].

Error 2: Invalid InitialUnknowns indices in ModelStructure element

According to the FMI version 2.0 standard, page 60, variable listed should be:

  1. causality = "output" and (initial="approx" or "calculated").
  2. causality = "calculatedParameter".
  3. continuous-time states and all state derivatives (defined with element <Derivatives> from <ModelStructure>) with initial="approx" or "calculated" (not “exact”) In this FMU, the <InitialUnknowns> has elements with indices of states with initial="exact" [1, 3], instead of state derivatives with initial="calculated" [2, 4].

The Compliance Checker should be updated to detect these errors in the modelDescription.xml file. Attached are the FMU and batch of Compliance Checker command to run this FMU and generate log file. CC_ModelStructure.zip


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

modelica-trac-importer commented 6 years ago

Comment by adrian.tirea on 8 Feb 2017 08:40 UTC

  1. My understanding is that "indices" means index not valueReference. Index starts from 1. That is why the value are [2, 4]. Page 58: "Ordered list of all state derivatives, in other words a list of ScalarVariable indices where every corresponding ScalarVariable must be a state derivative."

Page 61 define what is the 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.]"

  1. The same misunderstanding regarding the indices applies here too. We list in the InitialUnknowns the Derivatives.
modelica-trac-importer commented 6 years ago

Comment by cbertsch on 8 Feb 2017 08:51 UTC Adrian, the bouncing ball FMU that is shipped with the FMUSDK is correct and your interpretation is absolutely correct. We created a incorrect version of this FMU intentionally, in order to demonstrate that the FMI Compliance checker does not find such errors.

modelica-trac-importer commented 6 years ago

Comment by adrian.tirea on 8 Feb 2017 08:54 UTC I see. Thank you for explanation!