Skip to content

Commit

Permalink
Corrected wrong use of getInstanceName (#3584)
Browse files Browse the repository at this point in the history
This integrates IBPSA, issue 1814. The use of this function is not allowed inside other functions, and causes OpenModelica to fail during translation
  • Loading branch information
mwetter authored Nov 23, 2023
1 parent 20162c6 commit 4e82105
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ initial equation
kMed=kMed,
muMed=muMed,
cpMed=cpMed,
m_flow_nominal=m_flow_nominal);
m_flow_nominal=m_flow_nominal,
instanceName=getInstanceName());

annotation (
__Dymola_Commands(file=
Expand All @@ -75,6 +76,13 @@ borehole.
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
June 21, 2018, by Massimo Cimmino:<br/>
First implementation.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ initial equation
kMed=kMed,
muMed=muMed,
cpMed=cpMed,
m_flow_nominal=m_flow_nominal);
m_flow_nominal=m_flow_nominal,
instanceName=getInstanceName());

annotation (
__Dymola_Commands(file=
Expand All @@ -79,6 +80,13 @@ capacity location <code>x</code> is then automatically set to zero.
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
June 21, 2018, by Massimo Cimmino:<br/>
First implementation.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ initial equation
kMed=kMed,
muMed=muMed,
cpMed=cpMed,
m_flow_nominal=m_flow_nominal);
m_flow_nominal=m_flow_nominal,
instanceName=getInstanceName());

annotation (
__Dymola_Commands(file=
Expand All @@ -76,6 +77,13 @@ borehole.
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
June 21, 2018, by Massimo Cimmino:<br/>
First implementation.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ initial equation
kMed=kMed,
muMed=muMed,
cpMed=cpMed,
m_flow_nominal=m_flow_nominal);
m_flow_nominal=m_flow_nominal,
instanceName=getInstanceName());

annotation (
__Dymola_Commands(file=
Expand All @@ -81,6 +82,13 @@ capacity location <code>x</code> is then automatically set to zero.
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
June 21, 2018, by Massimo Cimmino:<br/>
First implementation.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ algorithm
i := i + 1;
end while;
end if;
assert(test, "In " + getInstanceName() + ":\n" +
assert(test, "In " + instanceName + ":\n" +
"Maximum number of iterations exceeded. Check the borehole geometry.
The tubes may be too close to the borehole wall.
Input to the function
Expand Down Expand Up @@ -121,6 +121,13 @@ International Journal of Energy Research, 35:312&ndash;320, 2011.</p>
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
February 7, 2022, by Michael Wetter:<br/>
Changed function to be <code>pure</code>.<br/>
This is for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ algorithm
i := i + 1;
end while;
end if;
assert(test, "In " + getInstanceName() + ":\n" +
assert(test, "In " + instanceName + ":\n" +
"Maximum number of iterations exceeded. Check the borehole geometry.
The tubes may be too close to the borehole wall.
Input to the function
Expand Down Expand Up @@ -129,6 +129,13 @@ International Journal of Energy Research, 35:312&ndash;320, 2011.</p>
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
February 7, 2022, by Michael Wetter:<br/>
Changed function to be <code>pure</code>.<br/>
This is for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ partial function partialInternalResistances
input Modelica.Units.SI.SpecificHeatCapacity cpMed
"Specific heat capacity of the fluid";
input Modelica.Units.SI.MassFlowRate m_flow_nominal "Nominal mass flow rate";
input String instanceName="undeclared caller"
"Instance name of the model or block that calls this function";

// Outputs
output Real x "Capacity location";
Expand Down Expand Up @@ -71,6 +73,13 @@ the borehole internal resistances.
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
June 4, 2023, by Michael Wetter:<br/>
Corrected variability.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1762\">IBPSA, #1762</a>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ initial equation
kMed=kMed,
muMed=muMed,
cpMed=cpMed,
m_flow_nominal=m1_flow_nominal);
m_flow_nominal=m1_flow_nominal,
instanceName=getInstanceName());

equation
assert(borFieDat.conDat.borCon == Buildings.Fluid.Geothermal.Borefields.Types.BoreholeConfiguration.SingleUTube,
Expand Down Expand Up @@ -159,6 +160,13 @@ International Journal Of Energy Research, 35:312-320, 2011.
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
March 7, 2022, by Michael Wetter:<br/>
Removed <code>massDynamics</code>.<br/>
This is for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ initial equation
kMed=kMed,
muMed=muMed,
cpMed=cpMed,
m_flow_nominal=m1_flow_nominal);
m_flow_nominal=m1_flow_nominal,
instanceName=getInstanceName());

equation
assert(borFieDat.conDat.borCon == Buildings.Fluid.Geothermal.Borefields.Types.BoreholeConfiguration.DoubleUTubeParallel
Expand Down Expand Up @@ -253,6 +254,13 @@ International Journal Of Energy Research, 35:312-320, 2011.
</html>", revisions="<html>
<ul>
<li>
November 22, 2023, by Michael Wetter:<br/>
Corrected use of <code>getInstanceName()</code> which was called inside a function which
is not allowed.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1814\">IBPSA, #1814</a>.
</li>
<li>
March 7, 2022, by Michael Wetter:<br/>
Removed <code>massDynamics</code>.<br/>
This is for
Expand Down

0 comments on commit 4e82105

Please sign in to comment.