Modelica 代码中的警告 "use Modelica.Icons.Package instead"
Warning "use Modelica.Icons.Package instead" in Modelica code
我在 Modelica 代码中遇到警告 use Modelica.Icons.Package instead
。看来我使用了错误的图标,所以该工具选择 use Modelica.Icons.Package instead
.
所以我检查了警告消息中显示的代码,这个组件中没有图标,所以为什么会出现这个警告?
以下截图显示了错误组件的警告信息和Modelica代码。
model HeatTransferTwoPhase "Heat transfer model for two-phase correlations"
replaceable package Medium =
Modelon.Media.PreDefined.TwoPhase.WaterIF97 constrainedby
Modelon.Media.Interfaces.TwoPhaseMedium annotation(Dialog(group="Medium"),choicesAllMatching);
replaceable model HeatTransfer =
ThermalPower.SubComponents.HeatTransfer.Pipes.KcZero constrainedby
ThermalPower.SubComponents.HeatTransfer.Pipes.Interfaces.Tubes annotation(Dialog(group="Heat Transfer model"),choicesAllMatching);
parameter Integer n(min=1) "Total discretization number";
parameter Modelica.SIunits.Area[n] A "Flow cross sectional area";
parameter Modelica.SIunits.Area[n] A_heat
"Heat transfer area (per channel)";
parameter Modelica.SIunits.Length L
"Channel length (total length in case of discretized channel)";
parameter Modelica.SIunits.Length[n] Dhyd "Hydraulic diameter";
parameter Real[n] n_channels(each min=1.0) = fill(1.0, n)
"Number of parallel channels";
parameter Real F_user = 1.0
"user defined enhancement factor for heat transfer"
annotation (Dialog(tab="Advanced"));
parameter Modelica.SIunits.Pressure pcrit = Medium.criticalPressure
"Critical pressure of fluid for boiling correlations";
parameter Boolean TubeOrientationHorizontal=true
"Horizontal tubes: true; vertical tubes: false"
annotation (Dialog(group="Geometry"), Evaluate=true);
parameter Boolean staggeredTubes=false
"Staggered or inline tube arrangement"
annotation (Dialog(group="Geometry"), Evaluate=true);
parameter Integer numberOfTubeRows(min=1)=1 "Number of tube rows" annotation (Dialog(group="Geometry"), Evaluate=true);
input Modelica.SIunits.MassFlowRate m_flow[n] "mass flow" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.Pressure p[n] "Pressure" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.SpecificHeatCapacity cp[n] "specific heat capacity" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.ReynoldsNumber Re[n] "Reynolds number" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.DynamicViscosity eta[n] "dynamic viscosity" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.ThermalConductivity lam[n] "thermal conductivity" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.FroudeNumber Fr[n] "Froude number" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.ReynoldsNumber Re_liq[n]
"Reynolds number, boiling curve" annotation(Dialog(group="Inputs"));
input Medium.PhaseBoundaryProps sat[n] "saturation properties" annotation(Dialog(group="Inputs"));
input Real[n] twoPhaseFraction
"fraction of the overall control volume with two-phase conditions" annotation(Dialog(group="Inputs"));
HeatTransfer heatTransfer(
redeclare package Medium=Medium,
TubeOrientationHorizontal=TubeOrientationHorizontal,
staggeredTubes=staggeredTubes,
numberOfTubeRows=numberOfTubeRows,
n=n,
A=A,
A_heat=A_heat,
L=L,
Dhyd=Dhyd,
F_user=F_user,
m_flow=m_flow,
T=q_fluid.T,
T_wall=q_wall.T,
p=p,
cp=cp,
Re=Re,
eta=eta,
lam=lam,
Fr=Fr,
Re_liq=Re_liq,
sat=sat,
twoPhaseFraction=twoPhaseFraction,
Q_s=q_wall.Q_flow);
Thermal.Interfaces.HeatPort_a q_wall[n]
annotation (Placement(
transformation(extent={{10,88},{-10,108}}, rotation=0),
iconTransformation(extent={{10,88},{-10,108}})));
Thermal.Interfaces.HeatPort_a q_fluid[n] annotation (Placement(
transformation(extent={{10,-112},{-10,-92}},
rotation=0),
iconTransformation(extent={{10,-112},{-10,-92}})));
equation
for i in 1:n loop
q_wall[i].Q_flow+q_fluid[i].Q_flow=0;
q_wall[i].Q_flow = heatTransfer.alpha[i] * n_channels[i] * A_heat[i] * (q_wall[i].T - q_fluid[i].T);
end for;
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
{100,100}}), graphics={ Line(
points={{0,70},{0,40},{-20,30},{20,10},{-20,-10},{20,-30},{0,-40},{0,-70}},
color={255,0,0},
thickness=0.5), Polygon(
points={{-15,-65},{15,-65},{0,-90},{-15,-65}},
lineColor={255,0,0},
fillColor={255,0,0},
fillPattern=FillPattern.Solid),Polygon(
points={{-15,65},{15,65},{0,90},{-15,65}},
lineColor={255,0,0},
fillColor={255,0,0},
fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(
preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics),
Documentation(revisions="<html>
<hr><p><font color=\"#E72614\"><b>Copyright © 2004-2019, MODELON AB</b></font> <font color=\"#AFAFAF\"><br /><br /> The use of this software component is regulated by the licensing conditions for Modelon Libraries. <br /> This copyright notice must, unaltered, accompany all components that are derived from, copied from, <br /> or by other means have their origin from any Modelon Library. </font></p>
</html>",
info="<html>
<h4>Description</h4>
<p>Generic heat transfer model where the heat transfer correlation is replaceable and is compatible with heat-correlations for two-phase correlations.</p>
<h4>Parametrization</h4>
<p>This model is parametrized by it's geometry and operating point. The operating point and flow properties are specified as inputs and can therefore be variables that change with time.</p>
<h4>Assumptions</h4>
<ul>
<li>No heat storage</li>
</ul>
</html>"));
end HeatTransferTwoPhase;
感谢分享。这将在 Modelon 的下一版热功率库中更新。
br
Per-Ola Larsson,Modelon 的 Thermofluid 团队
我在 Modelica 代码中遇到警告 use Modelica.Icons.Package instead
。看来我使用了错误的图标,所以该工具选择 use Modelica.Icons.Package instead
.
所以我检查了警告消息中显示的代码,这个组件中没有图标,所以为什么会出现这个警告?
以下截图显示了错误组件的警告信息和Modelica代码。
model HeatTransferTwoPhase "Heat transfer model for two-phase correlations"
replaceable package Medium =
Modelon.Media.PreDefined.TwoPhase.WaterIF97 constrainedby
Modelon.Media.Interfaces.TwoPhaseMedium annotation(Dialog(group="Medium"),choicesAllMatching);
replaceable model HeatTransfer =
ThermalPower.SubComponents.HeatTransfer.Pipes.KcZero constrainedby
ThermalPower.SubComponents.HeatTransfer.Pipes.Interfaces.Tubes annotation(Dialog(group="Heat Transfer model"),choicesAllMatching);
parameter Integer n(min=1) "Total discretization number";
parameter Modelica.SIunits.Area[n] A "Flow cross sectional area";
parameter Modelica.SIunits.Area[n] A_heat
"Heat transfer area (per channel)";
parameter Modelica.SIunits.Length L
"Channel length (total length in case of discretized channel)";
parameter Modelica.SIunits.Length[n] Dhyd "Hydraulic diameter";
parameter Real[n] n_channels(each min=1.0) = fill(1.0, n)
"Number of parallel channels";
parameter Real F_user = 1.0
"user defined enhancement factor for heat transfer"
annotation (Dialog(tab="Advanced"));
parameter Modelica.SIunits.Pressure pcrit = Medium.criticalPressure
"Critical pressure of fluid for boiling correlations";
parameter Boolean TubeOrientationHorizontal=true
"Horizontal tubes: true; vertical tubes: false"
annotation (Dialog(group="Geometry"), Evaluate=true);
parameter Boolean staggeredTubes=false
"Staggered or inline tube arrangement"
annotation (Dialog(group="Geometry"), Evaluate=true);
parameter Integer numberOfTubeRows(min=1)=1 "Number of tube rows" annotation (Dialog(group="Geometry"), Evaluate=true);
input Modelica.SIunits.MassFlowRate m_flow[n] "mass flow" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.Pressure p[n] "Pressure" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.SpecificHeatCapacity cp[n] "specific heat capacity" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.ReynoldsNumber Re[n] "Reynolds number" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.DynamicViscosity eta[n] "dynamic viscosity" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.ThermalConductivity lam[n] "thermal conductivity" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.FroudeNumber Fr[n] "Froude number" annotation(Dialog(group="Inputs"));
input Modelica.SIunits.ReynoldsNumber Re_liq[n]
"Reynolds number, boiling curve" annotation(Dialog(group="Inputs"));
input Medium.PhaseBoundaryProps sat[n] "saturation properties" annotation(Dialog(group="Inputs"));
input Real[n] twoPhaseFraction
"fraction of the overall control volume with two-phase conditions" annotation(Dialog(group="Inputs"));
HeatTransfer heatTransfer(
redeclare package Medium=Medium,
TubeOrientationHorizontal=TubeOrientationHorizontal,
staggeredTubes=staggeredTubes,
numberOfTubeRows=numberOfTubeRows,
n=n,
A=A,
A_heat=A_heat,
L=L,
Dhyd=Dhyd,
F_user=F_user,
m_flow=m_flow,
T=q_fluid.T,
T_wall=q_wall.T,
p=p,
cp=cp,
Re=Re,
eta=eta,
lam=lam,
Fr=Fr,
Re_liq=Re_liq,
sat=sat,
twoPhaseFraction=twoPhaseFraction,
Q_s=q_wall.Q_flow);
Thermal.Interfaces.HeatPort_a q_wall[n]
annotation (Placement(
transformation(extent={{10,88},{-10,108}}, rotation=0),
iconTransformation(extent={{10,88},{-10,108}})));
Thermal.Interfaces.HeatPort_a q_fluid[n] annotation (Placement(
transformation(extent={{10,-112},{-10,-92}},
rotation=0),
iconTransformation(extent={{10,-112},{-10,-92}})));
equation
for i in 1:n loop
q_wall[i].Q_flow+q_fluid[i].Q_flow=0;
q_wall[i].Q_flow = heatTransfer.alpha[i] * n_channels[i] * A_heat[i] * (q_wall[i].T - q_fluid[i].T);
end for;
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
{100,100}}), graphics={ Line(
points={{0,70},{0,40},{-20,30},{20,10},{-20,-10},{20,-30},{0,-40},{0,-70}},
color={255,0,0},
thickness=0.5), Polygon(
points={{-15,-65},{15,-65},{0,-90},{-15,-65}},
lineColor={255,0,0},
fillColor={255,0,0},
fillPattern=FillPattern.Solid),Polygon(
points={{-15,65},{15,65},{0,90},{-15,65}},
lineColor={255,0,0},
fillColor={255,0,0},
fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(
preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics),
Documentation(revisions="<html>
<hr><p><font color=\"#E72614\"><b>Copyright © 2004-2019, MODELON AB</b></font> <font color=\"#AFAFAF\"><br /><br /> The use of this software component is regulated by the licensing conditions for Modelon Libraries. <br /> This copyright notice must, unaltered, accompany all components that are derived from, copied from, <br /> or by other means have their origin from any Modelon Library. </font></p>
</html>",
info="<html>
<h4>Description</h4>
<p>Generic heat transfer model where the heat transfer correlation is replaceable and is compatible with heat-correlations for two-phase correlations.</p>
<h4>Parametrization</h4>
<p>This model is parametrized by it's geometry and operating point. The operating point and flow properties are specified as inputs and can therefore be variables that change with time.</p>
<h4>Assumptions</h4>
<ul>
<li>No heat storage</li>
</ul>
</html>"));
end HeatTransferTwoPhase;
感谢分享。这将在 Modelon 的下一版热功率库中更新。
br Per-Ola Larsson,Modelon 的 Thermofluid 团队