Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion IBPSA/Fluid/Actuators/BaseClasses/PartialTwoWayValve.mo
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ partial model PartialTwoWayValve "Partial model for a two way valve"
parameter Real kFixed(unit="", min=0) = if dpFixed_nominal > Modelica.Constants.eps
then m_flow_nominal / sqrt(dpFixed_nominal) else 0
"Flow coefficient of fixed resistance that may be in series with valve, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2).";
Real kVal(unit="1", min=Modelica.Constants.small)
Real kVal(unit="", min=Modelica.Constants.small)
"Flow coefficient of valve, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2).";
Real k(unit="", min=Modelica.Constants.small)
"Flow coefficient of valve and pipe in series, k=m_flow/sqrt(dp), with unit=(kg.m)^(1/2).";
Expand Down Expand Up @@ -97,6 +97,11 @@ each valve opening characteristics has different parameters.
revisions="<html>
<ul>
<li>
March 31, 2026, by Michael Wetter:<br/>
Corrected unit propagation error that causes Dymola 2026x to not show certain units.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2100\">#2100</a>.
</li>
<li>
January 19, 2026, by Jelger Jansen:<br/>
Added unit 1 to parameter <code>kVal</code> to avoid FMU unit errors.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2074\">#2074</a>.
Expand Down
10 changes: 9 additions & 1 deletion IBPSA/Fluid/Examples/Performance/BaseClasses/Example1.mo
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ partial model Example1 "Example 1 partial model"
annotation (Placement(transformation(extent={{-20,20},{0,40}})));
Modelica.Blocks.Sources.Pulse pulse(period=1000) "Pulse input"
annotation (Placement(transformation(extent={{-60,70},{-40,90}})));
Modelica.Blocks.Math.Gain gain(k=m_flow_nominal) "Gain for m_flow_nominal"
Modelica.Blocks.Math.Gain gain(
k=m_flow_nominal,
u(unit="1"),
y(unit="kg/s")) "Gain for m_flow_nominal"
annotation (Placement(transformation(extent={{0,70},{20,90}})));
IBPSA.Fluid.Actuators.Valves.ThreeWayLinear val(
redeclare package Medium = Medium,
Expand Down Expand Up @@ -109,6 +112,11 @@ and is created to avoid errors in the implementation of the two depending exampl
</html>", revisions="<html>
<ul>
<li>
March 31, 2026, by Michael Wetter:<br/>
Corrected unit propagation error that causes Dymola 2026x to not show certain units.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2100\">#2100</a>.
</li>
<li>
May 8, 2017, by Michael Wetter:<br/>
Updated heater model.<br/>
This is for
Expand Down
11 changes: 9 additions & 2 deletions IBPSA/Fluid/Examples/ResistanceVolumeFlowReversal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ model ResistanceVolumeFlowReversal
annotation (Placement(transformation(extent={{-40,-30},{-20,-10}})));
Modelica.Blocks.Sources.Pulse pulse(period=1000) "Pulse input"
annotation (Placement(transformation(extent={{-80,40},{-60,60}})));
Modelica.Blocks.Math.Gain gain(k=m_flow_nominal) "Gain for m_flow_nominal"
Modelica.Blocks.Math.Gain gain(
k=m_flow_nominal,
u(unit="1"),
y(unit="kg/s")) "Gain for m_flow_nominal"
annotation (Placement(transformation(extent={{-40,40},{-20,60}})));
IBPSA.Fluid.Actuators.Valves.ThreeWayLinear val(
redeclare package Medium = Medium,
Expand Down Expand Up @@ -103,7 +106,6 @@ equation
color={0,127,255}));
connect(senTem[i].port_b, val.port_3) annotation (Line(
points={{10,-70},{0,-70},{0,-30}}, color={0,127,255}));

end for;

annotation (experiment(
Expand Down Expand Up @@ -164,6 +166,11 @@ Sizes after manipulation of the nonlinear systems: {1, 9, <b>1</b>}
</html>", revisions="<html>
<ul>
<li>
March 31, 2026, by Michael Wetter:<br/>
Corrected unit propagation error that causes Dymola 2026x to not show certain units.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2100\">#2100</a>.
</li>
<li>
July 18, 2025, by Hongxiang Fu:<br/>
Added two-port temperature sensors to replace <code>vol[:].T</code>
from reference results.<br/>
Expand Down
18 changes: 13 additions & 5 deletions IBPSA/Fluid/FixedResistances/PressureDrop.mo
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ protected
(dp_nominal_pos > Modelica.Constants.eps) and not disableComputeFlowResistance_internal
"Flag to enable/disable computation of flow resistance"
annotation(Evaluate=true);
final parameter Real coeff=
final parameter Real coeM(final unit="kg/(s.Pa)")=
if linearized and computeFlowResistance
then if from_dp then k^2/m_flow_nominal_pos else m_flow_nominal_pos/k^2
else 0
then k^2/m_flow_nominal_pos else 0
"Precomputed coefficient to avoid division by parameter";
final parameter Real coeP(final unit="s.Pa/kg")=
if linearized and computeFlowResistance
then m_flow_nominal_pos/k^2 else 0
"Precomputed coefficient to avoid division by parameter";
initial equation
if computeFlowResistance then
Expand All @@ -37,9 +40,9 @@ equation
if computeFlowResistance then
if linearized then
if from_dp then
m_flow = dp*coeff;
m_flow = dp*coeM;
else
dp = m_flow*coeff;
dp = m_flow*coeP;
end if;
else
if homotopyInitialization then
Expand Down Expand Up @@ -184,6 +187,11 @@ This leads to simpler equations.
</html>", revisions="<html>
<ul>
<li>
March 31, 2026, by Michael Wetter:<br/>
Corrected unit propagation error that causes Dymola 2026x to not show certain units.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2100\">#2100</a>.
</li>
<li>
April 25, 2025, by Fabian Wuelhorst and Michael Wetter:<br/>
Add option to disable <code>computeFlowResistance</code> for extending classes.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2001\">#2001</a>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ model FiniteLineSource_Integrand
parameter Modelica.Units.SI.Height len2=150.0 "Length of receiving borehole";
parameter Modelica.Units.SI.Height burDep2=4.0
"Buried depth of receiving borehole";
Real u "Integration variable";
Real u(unit="1/m") "Integration variable";
Real y "Finite line source integrand";
constant Real con(unit="1/(m.s)") = 1 "Unit conversion factor";

equation
u = time;
u = con*time;
y = IBPSA.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand(
u=u,
dis=dis,
Expand All @@ -37,6 +38,11 @@ finite line source integrand function.
</html>", revisions="<html>
<ul>
<li>
March 31, 2026, by Michael Wetter:<br/>
Corrected unit propagation error that causes Dymola 2026x to not show certain units.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2100\">#2100</a>.
</li>
<li>
July 17, 2018, by Massimo Cimmino:<br/>
First implementation.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ model FiniteLineSource_Integrand_Equivalent
parameter Integer nBor2=3 "Number of receiving lines";
parameter Integer n_dis=2 "Number of unique distances";

Real u "Integration variable";
Real u(unit="1/m") "Integration variable";
Real yRea "Finite line source integrand (Real part)";
Real yMir "Finite line source integrand (Mirror part)";
Real y "Finite line source integrand";
constant Real con(unit="1/(m.s)") = 1 "Unit conversion factor";

equation
u = time;
u = con*time;
yRea =
IBPSA.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand_Equivalent(
u=u,
Expand Down Expand Up @@ -76,6 +77,11 @@ with coordinates (x,y) = {(0,0), (0,7), (7,0)}.
</html>", revisions="<html>
<ul>
<li>
March 31, 2026, by Michael Wetter:<br/>
Corrected unit propagation error that causes Dymola 2026x to not show certain units.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2100\">#2100</a>.
</li>
<li>
June 9, 2022, by Massimo Cimmino:<br/>
First implementation.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ model FiniteLineSource_Integrand_Length
parameter Modelica.Units.SI.Height len1=1.0 "Length of emitting borehole";
parameter Modelica.Units.SI.Height burDep=4.
"Buried depth of emitting borehole";
Real u "Integration variable";
Real u(unit="1/m") "Integration variable";
constant Real con(unit="1/(m.s)") = 1 "Unit conversion factor";

Real logy150 "Logarithm of finite line source integrand";
Real logy75 "Logarithm of finite line source integrand";
Real logy25 "Logarithm of finite line source integrand";
Real logy5 "Logarithm of finite line source integrand";
Real logy1 "Logarithm of finite line source integrand";
equation
u = time;
u = con*time;
logy150 = log10(max(small,
IBPSA.Fluid.Geothermal.Borefields.BaseClasses.HeatTransfer.ThermalResponseFactors.finiteLineSource_Integrand(
u=u,
Expand Down Expand Up @@ -74,6 +76,11 @@ finite line source integrand function.
</html>", revisions="<html>
<ul>
<li>
March 31, 2026, by Michael Wetter:<br/>
Corrected unit propagation error that causes Dymola 2026x to not show certain units.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2100\">#2100</a>.
</li>
<li>
September 15, 2025, by Michael Wetter:<br/>
Changed value of small number that bounds log10.<br/>
This is for
Expand Down
83 changes: 48 additions & 35 deletions IBPSA/Fluid/HeatExchangers/WetCoilEffectivenessNTU.mo
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ model WetCoilEffectivenessNTU
"Dry fraction, 0.3 means condensation occurs at 30% heat exchange length from air inlet";

protected
constant Real kUniConHeaCoo(final unit="1/W") = 1 "Constant for unit conversion";
constant Real kUniConHum(final unit="s/kg") = 1 "Constant for unit conversion";

final parameter Modelica.Units.SI.MassFraction X_w_a2_nominal=w_a2_nominal/(1
+ w_a2_nominal)
"Water mass fraction of inlet air at a rated condition (in kg/kg total air)";
Expand Down Expand Up @@ -122,8 +125,7 @@ protected
final dp_nominal = dp1_nominal,
final m_flow_nominal = m1_flow_nominal,
final energyDynamics = energyDynamics,
final Q_flow_nominal=-1,
u(final unit="W"))
final Q_flow_nominal=-1)
"Heat exchange with water stream"
annotation (Placement(transformation(extent={{60,50},{80,70}})));

Expand All @@ -132,10 +134,9 @@ protected
final mWat_flow_nominal = 1,
final dp_nominal = dp2_nominal,
final m_flow_nominal = m2_flow_nominal,
final energyDynamics = energyDynamics,
u(final unit="kg/s"))
final energyDynamics = energyDynamics)
"Heat and moisture exchange with air stream"
annotation (Placement(transformation(extent={{-60,-70},{-80,-50}})));
annotation (Placement(transformation(extent={{-62,-94},{-82,-74}})));
IBPSA.Fluid.HeatExchangers.BaseClasses.HADryCoil hA(
final UA_nominal = UA_nominal,
final m_flow_nominal_a = m2_flow_nominal,
Expand Down Expand Up @@ -224,7 +225,7 @@ protected

Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea
"Prescribed heat flow"
annotation (Placement(transformation(extent={{20,-90},{0,-70}})));
annotation (Placement(transformation(extent={{18,-100},{-2,-80}})));
Real fra_a1(min=0, max=1) = if allowFlowReversal1
then Modelica.Fluid.Utilities.regStep(
m1_flow,
Expand Down Expand Up @@ -281,6 +282,13 @@ protected
p=Medium2.p_default,
X=Medium2.X_default[1:Medium2.nXi]) "Default state for medium 2";

Modelica.Blocks.Math.Gain uniConHum(
final k=kUniConHum) "Unit conversion for input to humidifier"
annotation (Placement(transformation(extent={{-20,-70},{-40,-50}})));
Modelica.Blocks.Math.Gain uniConHeaCoo(
final k=kUniConHeaCoo)
"Unit conversion for input to heater and cooler model"
annotation (Placement(transformation(extent={{12,70},{32,90}})));
initial equation
assert(m1_flow_nominal > Modelica.Constants.eps,
"m1_flow_nominal must be positive, m1_flow_nominal = " + String(
Expand Down Expand Up @@ -368,36 +376,34 @@ equation
connect(heaCoo.port_b, port_b1) annotation (Line(points={{80,60},{80,60},{100,60}},color={0,127,255},
thickness=1));
connect(heaCooHum_u.port_b, port_b2) annotation (Line(
points={{-80,-60},{-90,-60},{-100,-60}},
points={{-82,-84},{-90,-84},{-90,-60},{-100,-60}},
color={0,127,255},
thickness=1));
connect(hA.hA_1, dryWetCalcs.UAWat) annotation (Line(points={{-49.1,5.7},{-46,
5.7},{-46,36.6667},{-22.8571,36.6667}}, color={0,0,127}));
connect(hA.hA_2, dryWetCalcs.UAAir) annotation (Line(points={{-49.1,-9.7},{
-46,-9.7},{-46,-36},{-46,-36.6667},{-22.8571,-36.6667}},
connect(hA.hA_2, dryWetCalcs.UAAir) annotation (Line(points={{-49.1,-9.7},{-46,
-9.7},{-46,-36},{-46,-36.6667},{-22.8571,-36.6667}},
color={0,0,127}));
connect(cp_a1Exp.y, dryWetCalcs.cpWat) annotation (Line(points={{-29.3,24},{
-22.8571,24},{-22.8571,23.3333}},
color={0,0,127}));
connect(cp_a1Exp.y, dryWetCalcs.cpWat) annotation (Line(points={{-29.3,24},{-22.8571,
24},{-22.8571,23.3333}}, color={0,0,127}));
connect(XWat_a2Exp.y, dryWetCalcs.X_wAirIn) annotation (Line(points={{-29.3,4},
{-22.8571,4},{-22.8571,3.33333}}, color={0,0,127}));
connect(p_a2Exp.y, dryWetCalcs.pAir) annotation (Line(points={{-29.3,-4},{
-22.8571,-4},{-22.8571,-3.33333}},
connect(p_a2Exp.y, dryWetCalcs.pAir) annotation (Line(points={{-29.3,-4},{-22.8571,
-4},{-22.8571,-3.33333}},
color={0,0,127}));
connect(h_a2Exp.y, dryWetCalcs.hAirIn) annotation (Line(points={{-29.3,-12},{
-22,-12},{-22,-10},{-22.8571,-10}},
connect(h_a2Exp.y, dryWetCalcs.hAirIn) annotation (Line(points={{-29.3,-12},{-22,
-12},{-22,-10},{-22.8571,-10}},
color={0,0,127}));
connect(cp_a2Exp.y, dryWetCalcs.cpAir) annotation (Line(points={{-29.3,-24},{
-22.8571,-24},{-22.8571,-23.3333}},
color={0,0,127}));
connect(cp_a2Exp.y, dryWetCalcs.cpAir) annotation (Line(points={{-29.3,-24},{-22.8571,
-24},{-22.8571,-23.3333}}, color={0,0,127}));
connect(TIn_a1Exp.y, hA.T_1) annotation (Line(points={{-83.3,22},{-80,22},{-80,
1.3},{-68.9,1.3}}, color={0,0,127}));
connect(TIn_a1Exp.y, dryWetCalcs.TWatIn) annotation (Line(points={{-83.3,22},
{-50,22},{-50,16.6667},{-22.8571,16.6667}}, color={0,0,127}));
connect(TIn_a1Exp.y, dryWetCalcs.TWatIn) annotation (Line(points={{-83.3,22},{
-50,22},{-50,16.6667},{-22.8571,16.6667}}, color={0,0,127}));
connect(TIn_a2Exp.y, hA.T_2) annotation (Line(points={{-83.3,-2},{-76,-2},{-76,
-5.3},{-68.9,-5.3}}, color={0,0,127}));
connect(TIn_a2Exp.y, dryWetCalcs.TAirIn) annotation (Line(points={{-83.3,-2},
{-76,-2},{-76,-16.6667},{-22.8571,-16.6667}}, color={0,0,127}));
connect(TIn_a2Exp.y, dryWetCalcs.TAirIn) annotation (Line(points={{-83.3,-2},{
-76,-2},{-76,-16.6667},{-22.8571,-16.6667}}, color={0,0,127}));
connect(m_flow_a1Exp.y, hA.m1_flow) annotation (Line(points={{-83.3,36},{-76,36},
{-76,5.7},{-68.9,5.7}}, color={0,0,127}));
connect(m_flow_a1Exp.y, dryWetCalcs.mWat_flow) annotation (Line(points={{-83.3,
Expand All @@ -412,19 +418,21 @@ equation
connect(m_flow_a2Exp.y, dryWetCalcs.mAir_flow) annotation (Line(points={{-83.3,
-30},{-22.8571,-30}}, color={0,0,127}));
connect(port_a2, heaCooHum_u.port_a) annotation (Line(
points={{100,-60},{20,-60},{-60,-60}},
points={{100,-60},{72,-60},{72,-76},{-52,-76},{-52,-84},{-62,-84}},
color={0,127,255},
thickness=1));
connect(preHea.port, heaCooHum_u.heatPort) annotation (Line(points={{0,-80},{-40,
-80},{-40,-66},{-60,-66}}, color={191,0,0}));
connect(dryWetCalcs.QTot_flow, heaCoo.u) annotation (Line(points={{62.8571,
-6.66667},{80,-6.66667},{80,44},{40,44},{40,66},{58,66}},
color={0,0,127}));
connect(dryWetCalcs.mCon_flow, heaCooHum_u.u) annotation (Line(points={{62.8571,
-33.3333},{70,-33.3333},{70,-54},{-59,-54}}, color={0,0,127}));
connect(preHea.Q_flow, dryWetCalcs.QTot_flow) annotation (Line(points={{20,-80},
{44,-80},{80,-80},{80,-6.66667},{62.8571,-6.66667}},
color={0,0,127}));
connect(preHea.port, heaCooHum_u.heatPort) annotation (Line(points={{-2,-90},{
-62,-90}}, color={191,0,0}));
connect(preHea.Q_flow, dryWetCalcs.QTot_flow) annotation (Line(points={{18,-90},
{80,-90},{80,-6.66667},{62.8571,-6.66667}}, color={0,0,127}));
connect(dryWetCalcs.mCon_flow, uniConHum.u) annotation (Line(points={{62.8571,
-33.3333},{70,-33.3333},{70,-60},{-18,-60}}, color={0,0,127}));
connect(uniConHum.y, heaCooHum_u.u) annotation (Line(points={{-41,-60},{-56,-60},
{-56,-78},{-61,-78}}, color={0,0,127}));
connect(dryWetCalcs.QTot_flow, uniConHeaCoo.u) annotation (Line(points={{62.8571,
-6.66667},{80,-6.66667},{80,44},{4,44},{4,80},{10,80}}, color={0,0,127}));
connect(uniConHeaCoo.y, heaCoo.u) annotation (Line(points={{33,80},{48,80},{48,
66},{58,66}}, color={0,0,127}));
annotation (
defaultComponentName="hexWetNtu",
Icon(graphics={
Expand Down Expand Up @@ -522,7 +530,7 @@ equation
fillPattern=FillPattern.Solid,
smooth=Smooth.Bezier)}),
Diagram(graphics={Text(
extent={{44,84},{86,76}},
extent={{-80,70},{-38,62}},
textColor={28,108,200},
textString="Water Side",
textStyle={TextStyle.Italic},
Expand Down Expand Up @@ -650,6 +658,11 @@ Fuzzy identification of systems and its applications to modeling and control.
</html>", revisions="<html>
<ul>
<li>
March 31, 2026, by Michael Wetter:<br/>
Corrected unit propagation error that causes Dymola 2026x to not show certain units.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/2100\">#2100</a>.
</li>
<li>
February 7, 2025, by Jelger Jansen:<br/>
Removed <code>import</code> statement.
This is for
Expand Down
Loading
Loading