ibpsa / modelica-ibpsa

Modelica library for building and district energy systems developed within IBPSA Project 1
https://ibpsa.github.io/project1
145 stars 84 forks source link

Propagation of ROM parameters leads to Warnings regarding size declaration #1546

Closed FWuellhorst closed 2 years ago

FWuellhorst commented 2 years ago

When using the ReducedOrder model, propagation of the parameter nOrientations leads to the following warnings (on Dymola 2020x) grafik

If I set the parameter directly and don't propagate it, the warnings disappear. Adding Evaluate=true to the declarations does not solve the issue.

The problem seems to be the conditional declaration of additional parameters, e.g.

  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow convHeatSol(
    final alpha=0) if 
    ratioWinConRad > 0 and (ATot > 0 or VAir > 0) and sum(ATransparent) > 0
    "Solar heat considered as convection"
    annotation (Placement(transformation(extent={{-166,114},{-146,134}})));

One solution would be to remove nOrientations and declare the parameters using [:] notation. However, this then raises warnings when checking the OneElement model. Another solution would be to specify booleans, e.g. use_traAreas or similar. What also works is to set nOrientations=size(ATransparent, 1) on the upper-level model. Does anyone know another solution to this issue directly in the OneElement model? I can work with the last solution (specifying the size). But in my opinion, this should not occur in the first place.

I also added a small package to reproduce the warnings.

within ;
package ReproduceWarning
  model ROM
    parameter Integer nOrientations(min=1) "Number of orientations"
      annotation(Dialog(group="Thermal zone"));
    parameter Modelica.SIunits.Area ATransparent[nOrientations] "Vector of areas of transparent (solar radiation transmittend) elements by
    orientations"
      annotation(Dialog(group="Windows"));
    Real y=0 if sum(ATransparent) > 0;
  end ROM;

  model WithoutPropagation
    ReproduceWarning.ROM test(nOrientations=2, ATransparent={2,3})
      annotation (Placement(transformation(extent={{-30,-20},{-10,0}})));
    annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
          coordinateSystem(preserveAspectRatio=false)));
  end WithoutPropagation;

  model WithPropagation
    ReproduceWarning.ROM test(nOrientations=nOrientations, ATransparent={3})
      annotation (Placement(transformation(extent={{-30,-20},{-10,0}})));
    parameter Integer nOrientations=1 "Number of orientations";
    annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
          coordinateSystem(preserveAspectRatio=false)));
  end WithPropagation;
  annotation (uses(Modelica(version="3.2.3")));
end ReproduceWarning;
FWuellhorst commented 2 years ago

While further investigating the issue I found ATransparent to be a redundant parameter. AWin is used instead. ATransparent only occurs in the OneElement model. I also temporarily fixed the issue in the AixLib. However, I still think the underlying issue is the ROM model in the IBPSA. https://github.com/RWTH-EBC/AixLib/issues/1195 and the PR: https://github.com/RWTH-EBC/AixLib/pull/1196/files

@mwetter : Do you have any idea on why these warnings occur or how we can avoid them?

mwetter commented 2 years ago

It looks to me like Dymola gives up when it parses

    Real y=0 if sum(ATransparent) > 0;

For what it is worth, the model looks valid to me and simulates with OpenModelica.

FWuellhorst commented 2 years ago

Thanks! I will still remove ATransparent as it's of no use.

FWuellhorst commented 2 years ago

Nevermind. I did not saw this comment:

ATransparent and AWin are equal. When merging windows and exterior walls, AWin can be set to zero while ATransparent still represents the actual window area for solar radiation calculations.