Skip to content

Commit

Permalink
Corrected annotation in HeatTransfer data (maint 9.1.x) (#3448)
Browse files Browse the repository at this point in the history
* Corrected annotation in HeatTransfer data (maint 9.1.x)

This avoids a test for equality in the icon, which is not compliant with the Modelica Language Standard. It also improves the icon layout and sets the displayUnit for density

* Replaced color annotation
  • Loading branch information
mwetter committed Jun 26, 2023
1 parent 1bc322a commit a6fa250
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions Buildings/HeatTransfer/Data/BaseClasses.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package BaseClasses "Base classes for package Data"
parameter Modelica.Units.SI.Length x "Material thickness";
parameter Modelica.Units.SI.ThermalConductivity k "Thermal conductivity";
parameter Modelica.Units.SI.SpecificHeatCapacity c "Specific heat capacity";
parameter Modelica.Units.SI.Density d "Mass density";
parameter Modelica.Units.SI.Density d(displayUnit="kg/m3") "Mass density";
parameter Real R(unit="m2.K/W")
"Thermal resistance of a unit area of material";
parameter Integer nStaRef(min=0) = 3
Expand Down Expand Up @@ -48,8 +48,9 @@ package BaseClasses "Base classes for package Data"
defaultComponentPrefixes="parameter",
defaultComponentName="datMat",
Documentation(info="<html>
<p>
Base record for materials that declares the thermal properties.
<br/>
</p>
<p>
The specific heat capacity can be zero, in which case the material
will be modeled as a thermal resistor that does not store energy.
Expand Down Expand Up @@ -100,19 +101,19 @@ First implementation.
</ul>
</html>"), Icon(graphics={
Text(
extent={{-94,44},{-16,12}},
extent={{-98,44},{-2,12}},
textColor={0,0,0},
textString="x=%x"),
Text(
extent={{8,40},{86,8}},
extent={{2,40},{96,8}},
textColor={0,0,0},
textString="k=%k"),
Text(
extent={{-90,-58},{-12,-90}},
extent={{-98,-58},{-4,-90}},
textColor={0,0,0},
textString="R=%R"),
Text(
extent={{-92,-10},{-14,-42}},
extent={{-98,-10},{-4,-42}},
textColor={0,0,0},
textString="U=%U"),
Rectangle(
Expand All @@ -123,31 +124,32 @@ First implementation.
fillPattern=FillPattern.Solid),
Line(points={{-100,-50},{100,-50}}, color={0,0,0}),
Text(
visible=not (c > 0),
extent={{8,-8},{86,-40}},
lineColor={0,0,0},
visible=not (c > 1E-10),
extent={{4,-8},{98,-40}},
textColor={0,0,0},
textString="d=%d"),
Text(
visible=not (c > 0),
extent={{10,-56},{88,-88}},
lineColor={0,0,0},
visible=not (c > 1E-10),
extent={{4,-56},{98,-88}},
textColor={0,0,0},
textString="c=%c")}));
end Material;

record ThermalProperties "Thermal properties of materials with storage"
extends Modelica.Icons.Record;
parameter Modelica.Units.SI.ThermalConductivity k "Thermal conductivity";
parameter Modelica.Units.SI.SpecificHeatCapacity c "Specific heat capacity";
parameter Modelica.Units.SI.Density d "Mass density";
parameter Modelica.Units.SI.Density d(displayUnit="kg/m3") "Mass density";
parameter Boolean steadyState= (c < Modelica.Constants.eps or d < Modelica.Constants.eps)
"Flag, if true, then material is computed using steady-state heat conduction"
annotation(Evaluate=true);
annotation (preferredView="info",
defaultComponentPrefixes="parameter",
defaultComponentName="datThePro",
Documentation(info="<html>
<p>
Base record for materials, used in circular geometry or other configurations, that only declares the thermal properties.
<br/>
</p>
<p>
The specific heat capacity can be zero, in which case the material
will be modeled as a thermal resistor that does not store energy.
Expand All @@ -156,33 +158,35 @@ will be modeled as a thermal resistor that does not store energy.
revisions="<html>
<ul>
<li>
June 25, 2023, by Michael Wetter:<br/>
Removed test for equality in annotation. This is needed for OMEdit
as equality on <code>Real</code> variables are only allowed in functions.
</li>
<li>
March 1, 2016, by Michael Wetter:<br/>
Removed test for equality of <code>Real</code> variables.
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/493\">issue 493</a>.
</li>
<li>
April 2011, by Pierre Vigouroux:<br/>
</li>
<li>
April 12 2011, by Pierre Vigouroux:<br/>
First implementation.
</li>
</ul>
</html>"), Icon(graphics={
Line(points={{-100,-50},{100,-50}}, color={0,0,0}),
Text(
visible=not (c == 0),
extent={{-80,36},{-10,12}},
lineColor={0,0,0},
visible=d > 1E-10,
extent={{-98,-62},{-2,-86}},
textColor={0,0,0},
textString="d=%d"),
Text(
visible=not (c == 0),
extent={{-80,-58},{-6,-88}},
lineColor={0,0,0},
visible=c > 1E-10,
extent={{-98,-8},{-2,-38}},
textColor={0,0,0},
textString="c=%c"),
Text(
extent={{-74,-12},{-14,-36}},
extent={{-98,38},{-2,14}},
textColor={0,0,0},
textString="k=%k"),
Line(points={{-100,0},{100,0}}, color={0,0,0})}));
Expand Down

0 comments on commit a6fa250

Please sign in to comment.