Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Fluid.FMI.BaseClasses.X_w_toX #675

Closed
jmoeckel opened this issue Mar 9, 2017 · 6 comments · Fixed by #683
Closed

Error in Fluid.FMI.BaseClasses.X_w_toX #675

jmoeckel opened this issue Mar 9, 2017 · 6 comments · Fixed by #683

Comments

@jmoeckel
Copy link
Contributor

jmoeckel commented Mar 9, 2017

Applying Dymolas (2017 FD01) checkModel() in non-pedantic mode to Fluid.FMI.BaseClasses.X_w_toX throws following error:

Size mismathc in equation:
X = cat(1, {X_w_internal}, {1-X_w_internal});
@mwetter
Copy link
Contributor

mwetter commented Mar 10, 2017

@jmoeckel : The error is caused because Medium is not assigned. This works:

Advanced.PedanticModelica:=true;
checkModel("Annex60.Fluid.FMI.BaseClasses.X_w_toX(redeclare package Medium = Annex60.Media.Air)");

I will close the issue. Please reopen if you disagree and provide a full log that we can reproduce.

@mwetter mwetter closed this as completed Mar 10, 2017
@thorade
Copy link
Member

thorade commented Mar 10, 2017

We could set Annex60 Air as default type, but keep the constraining type:

block X_w_toX "Conversion from Xi to X"
  extends Modelica.Blocks.Icons.Block;

  replaceable package Medium =
      Annex60.Media.Air constrainedby 
    Modelica.Media.Interfaces.PartialMedium "Medium model within the source"
     annotation (choicesAllMatching=true);

Should I send a PR? As I understand it does not change the behavior, but will eliminate one more code checking warning/error.

@mwetter
Copy link
Contributor

mwetter commented Mar 13, 2017

@thorade We should not use default medium assignments as then it will be harder to spot situations where a medium is not propagated. Could you constrain it to a partial condensing media, or to a media with nXi > 0?

@thorade
Copy link
Member

thorade commented Mar 14, 2017

Air extends from Modelica.Media.Interfaces.PartialCondensingGases but using that as constraining type does not remove the error message. Creating a new partial medium would work, but having too many extends is also confusing.
The following removes the error message, not sure if it has any disadvantages?

block X_w_toX "Conversion from Xi to X"
  extends Modelica.Blocks.Icons.Block;

  replaceable package Medium =
      Modelica.Media.Interfaces.PartialCondensingGases (
     final substanceNames={"water", "air"}) "Medium model within the source"
     annotation (choicesAllMatching=true);

Edit: Yes, there are disadvantages, checking FMI now produces lots of errors.

mwetter added a commit that referenced this issue Mar 17, 2017
@mwetter
Copy link
Contributor

mwetter commented Mar 17, 2017

@thorade : I would not hardwire substanceNames. Would 3c874e8 work?

@mwetter mwetter reopened this Mar 17, 2017
@thorade
Copy link
Member

thorade commented Mar 20, 2017

Yes, that looks good.
Dymolas check does not report any errors or warnigns for Fluid.FMI (both in pedantic and non-pedantic mode).

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

Successfully merging a pull request may close this issue.

3 participants