Skip to content

Commit

Permalink
Merge pull request #1963 from ibpsa/issue1961_ImportStatement
Browse files Browse the repository at this point in the history
Remove import statements
  • Loading branch information
mwetter authored Feb 12, 2025
2 parents 725c9be + a330dd6 commit 0a5b631
Show file tree
Hide file tree
Showing 13 changed files with 217 additions and 160 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
within IBPSA.BoundaryConditions.SolarIrradiation.BaseClasses;
block BrighteningCoefficient "Circumsolar and horizon brightening coefficients"
extends Modelica.Blocks.Icons.Block;
import H = IBPSA.Utilities.Math.Functions.regStep;
Modelica.Blocks.Interfaces.RealInput zen(
quantity="Angle",
unit="rad",
Expand Down Expand Up @@ -42,43 +41,42 @@ protected
Real b7;
Real b8;
equation
b1 = H(
b1 = IBPSA.Utilities.Math.Functions.regStep(
y1=1,
y2=0,
x=1.065 - skyCle,
x_small=d);
b2 = H(
b2 = IBPSA.Utilities.Math.Functions.regStep(
y1=1,
y2=0,
x=1.23 - skyCle,
x_small=d);
b3 = H(
b3 = IBPSA.Utilities.Math.Functions.regStep(
y1=1,
y2=0,
x=1.50 - skyCle,
x_small=d);
b4 = H(
b4 = IBPSA.Utilities.Math.Functions.regStep(
y1=1,
y2=0,
x=1.95 - skyCle,
x_small=d);
b5 = H(
b5 = IBPSA.Utilities.Math.Functions.regStep(
y1=1,
y2=0,
x=2.80 - skyCle,
x_small=d);

b6 = H(
b6 = IBPSA.Utilities.Math.Functions.regStep(
y1=1,
y2=0,
x=4.50 - skyCle,
x_small=d);
b7 = H(
b7 = IBPSA.Utilities.Math.Functions.regStep(
y1=1,
y2=0,
x=6.20 - skyCle,
x_small=d);
b8 = H(
b8 = IBPSA.Utilities.Math.Functions.regStep(
y1=1,
y2=0,
x=skyCle - 6.20,
Expand Down Expand Up @@ -119,6 +117,12 @@ This component computes the circumsolar and horizon brightening coefficients.
</html>", revisions="<html>
<ul>
<li>
February 7, 2025, by Jelger Jansen:<br/>
Removed <code>import</code> statement.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1961\">IBPSA, #1961</a>.
</li>
<li>
April 27, 2018, by Michael Wetter:<br/>
Corrected <code>displayUnit</code>.<br/>
This is for
Expand Down
10 changes: 6 additions & 4 deletions IBPSA/Controls/SetPoints/OccupancySchedule.mo
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ protected
end getOutput;

encapsulated function switchInteger "Switch two Integer arguments"
import Modelica;
extends Modelica.Icons.Function;
input Integer x1 "First argument";
input Integer x2 "Second argument";
output Integer y1 "Output = x2";
Expand All @@ -107,8 +105,6 @@ algorithm
end switchInteger;

encapsulated function switchReal "Switch two Real arguments"
import Modelica;
extends Modelica.Icons.Function;
input Real x1 "First argument";
input Real x2 "Second argument";
output Real y1 "Output = x2";
Expand Down Expand Up @@ -197,6 +193,12 @@ The period always starts at <i>t=0</i> seconds.
</html>", revisions="<html>
<ul>
<li>
February 7, 2025, by Jelger Jansen:<br/>
Removed <code>import</code> statement.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1961\">IBPSA, #1961</a>.
</li>
<li>
March 25, 2021, by Michael Wetter:<br/>
Integrated changes from Buildings for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1454\">IBPSA, #1454</a>.
Expand Down
19 changes: 14 additions & 5 deletions IBPSA/Electrical/PhaseSystems/ThreePhase_d.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package ThreePhase_d "AC system covering only resistive loads with three symmetr

redeclare function phaseVoltages "Return phase to neutral voltages"
extends Modelica.Icons.Function;
input SI.Voltage V "system voltage";
input SI.Angle phi = 0 "phase angle";
output SI.Voltage v[n] "phase to neutral voltages";
input Modelica.Units.SI.Voltage V "system voltage";
input Modelica.Units.SI.Angle phi = 0 "phase angle";
output Modelica.Units.SI.Voltage v[n] "phase to neutral voltages";
algorithm
v := {V}/sqrt(3);
end phaseVoltages;
Expand All @@ -16,8 +16,8 @@ package ThreePhase_d "AC system covering only resistive loads with three symmetr
redeclare function systemVoltage
"Return system voltage as function of phase voltages"
extends Modelica.Icons.Function;
input SI.Voltage v[n];
output SI.Voltage V;
input Modelica.Units.SI.Voltage v[n];
output Modelica.Units.SI.Voltage V;
algorithm
V := sqrt(3)*v[1];
end systemVoltage;
Expand All @@ -33,5 +33,14 @@ package ThreePhase_d "AC system covering only resistive loads with three symmetr
This package declares the functions that are used to implement
the AC three-phase balanced and purely resistive models.
</p>
</html>", revisions="<html>
<ul>
<li>
February 7, 2025, by Jelger Jansen:<br/>
Added <code>Modelica.Units.</code> to relevant types.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1961\">IBPSA, #1961</a>.
</li>
</ul>
</html>"));
end ThreePhase_d;
9 changes: 6 additions & 3 deletions IBPSA/Electrical/PhaseSystems/package.mo
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
within IBPSA.Electrical;
package PhaseSystems "Phase systems used in power connectors"
extends Modelica.Icons.Package;
import Modelica.Units.SI;
import Modelica.Constants.pi;


annotation (Icon(graphics={Line(
points={{-70,-52},{50,-52}},
Expand Down Expand Up @@ -64,6 +61,12 @@ Proc. of the 10th Modelica Conference, Lund, Sweden, March 2014.
</html>", revisions="<html>
<ul>
<li>
February 7, 2025, by Jelger Jansen:<br/>
Removed <code>import</code> statements.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1961\">IBPSA, #1961</a>.
</li>
<li>
May 27, 2014, by Marco Bonvini:<br/>
Created documentation.
</li>
Expand Down
15 changes: 10 additions & 5 deletions IBPSA/Fluid/Actuators/Dampers/MixingBox.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ model MixingBox "Outside air mixing box with interlocked air dampers"
Modelica.Media.Interfaces.PartialMedium "Medium in the component"
annotation (choices(
choice(redeclare package Medium = IBPSA.Media.Air "Moist air")));
import Modelica.Constants;

parameter Boolean allowFlowReversal = true
"= false to simplify equations, assuming, but not enforcing, no flow reversal"
Expand Down Expand Up @@ -83,22 +82,22 @@ model MixingBox "Outside air mixing box with interlocked air dampers"
annotation(Dialog(tab="Damper coefficients"));

Modelica.Fluid.Interfaces.FluidPort_a port_Out(redeclare package Medium =
Medium, m_flow(start=0, min=if allowFlowReversal then -Constants.inf else
Medium, m_flow(start=0, min=if allowFlowReversal then -Modelica.Constants.inf else
0))
"Fluid connector a (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{-110,50},{-90,70}})));
Modelica.Fluid.Interfaces.FluidPort_b port_Exh(redeclare package Medium =
Medium, m_flow(start=0, max=if allowFlowReversal then +Constants.inf else
Medium, m_flow(start=0, max=if allowFlowReversal then +Modelica.Constants.inf else
0))
"Fluid connector b (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{-90,-70},{-110,-50}})));
Modelica.Fluid.Interfaces.FluidPort_a port_Ret(redeclare package Medium =
Medium, m_flow(start=0, min=if allowFlowReversal then -Constants.inf else
Medium, m_flow(start=0, min=if allowFlowReversal then -Modelica.Constants.inf else
0))
"Fluid connector a (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{110,-70},{90,-50}})));
Modelica.Fluid.Interfaces.FluidPort_b port_Sup(redeclare package Medium =
Medium, m_flow(start=0, max=if allowFlowReversal then +Constants.inf else
Medium, m_flow(start=0, max=if allowFlowReversal then +Modelica.Constants.inf else
0))
"Fluid connector b (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{110,50},{90,70}})));
Expand Down Expand Up @@ -298,6 +297,12 @@ defaultComponentName="eco",
Documentation(revisions="<html>
<ul>
<li>
February 7, 2025, by Jelger Jansen:<br/>
Removed <code>import</code> statement.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1961\">IBPSA, #1961</a>.
</li>
<li>
September 21, 2021, by Michael Wetter:<br/>
Corrected typo in comments.<br/>
This is for
Expand Down
15 changes: 10 additions & 5 deletions IBPSA/Fluid/BaseClasses/ActuatorFilter.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
within IBPSA.Fluid.BaseClasses;
block ActuatorFilter
"Filter used for actuators of valves, dampers and movers"
import Modelica.Blocks.Types.Init;
extends Modelica.Blocks.Interfaces.SISO;

constant Integer n=2 "Order of filter";
Expand All @@ -17,7 +16,7 @@ block ActuatorFilter
annotation (Dialog(group="Initialization"));
parameter Real y_start=0.0
"Initial value of output (remaining states are in steady state)"
annotation(Dialog(enable=initType == Init.InitialOutput, group=
annotation(Dialog(enable=initType == Modelica.Blocks.Types.Init.InitialOutput, group=
"Initialization"));

parameter Real u_nominal = 1 "Magnitude of input";
Expand All @@ -37,11 +36,11 @@ protected
Real s[n](start=x_start/u_nom) "Filter states";

initial equation
if initType == Init.SteadyState then
if initType == Modelica.Blocks.Types.Init.SteadyState then
der(s) = zeros(n);
elseif initType == Init.InitialState then
elseif initType == Modelica.Blocks.Types.Init.InitialState then
s = x_start/u_nom;
elseif initType == Init.InitialOutput then
elseif initType == Modelica.Blocks.Types.Init.InitialOutput then
y = y_start;
der(s[1:n - 1]) = zeros(n - 1);
end if;
Expand Down Expand Up @@ -100,6 +99,12 @@ for a discussion.
</html>", revisions="<html>
<ul>
<li>
February 7, 2025, by Jelger Jansen:<br/>
Removed <code>import</code> statement.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1961\">IBPSA, #1961</a>.
</li>
<li>
July 22, 2021, by Michael Wetter:<br/>
First implementation for
<a href=\"https://https://github.com/ibpsa/modelica-ibpsa/issues/1498\">IBPSA, #1498</a>
Expand Down
66 changes: 35 additions & 31 deletions IBPSA/Fluid/HeatExchangers/BaseClasses/PartialEffectivenessNTU.mo
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ model PartialEffectivenessNTU
Q2_flow = -Q1_flow,
mWat1_flow = 0,
mWat2_flow = 0);
import con = IBPSA.Fluid.Types.HeatExchangerConfiguration;
import flo = IBPSA.Fluid.Types.HeatExchangerFlowRegime;

parameter con configuration "Heat exchanger configuration"
parameter IBPSA.Fluid.Types.HeatExchangerConfiguration configuration "Heat exchanger configuration"
annotation (Evaluate=true);

constant Boolean use_dynamicFlowRegime = false
Expand Down Expand Up @@ -85,9 +83,9 @@ protected
"Nominal temperature at port b1";
parameter Modelica.Units.SI.Temperature T_b2_nominal(fixed=false)
"Nominal temperature at port b2";
parameter flo flowRegime_nominal(fixed=false)
parameter IBPSA.Fluid.Types.HeatExchangerFlowRegime flowRegime_nominal(fixed=false)
"Heat exchanger flow regime at nominal flow rates";
flo flowRegime(fixed=false, start=flowRegime_nominal)
IBPSA.Fluid.Types.HeatExchangerFlowRegime flowRegime(fixed=false, start=flowRegime_nominal)
"Heat exchanger flow regime";
initial equation
assert(m1_flow_nominal > Modelica.Constants.eps,
Expand Down Expand Up @@ -131,22 +129,22 @@ initial equation
"\n CMin_flow_nominal = " + String(CMin_flow_nominal) +
"\n CMax_flow_nominal = " + String(CMax_flow_nominal));
// Assign the flow regime for the given heat exchanger configuration and capacity flow rates
if (configuration == con.CrossFlowStream1MixedStream2Unmixed) then
flowRegime_nominal = if (C1_flow_nominal < C2_flow_nominal) then flo.CrossFlowCMinMixedCMaxUnmixed
else flo.CrossFlowCMinUnmixedCMaxMixed;
elseif (configuration == con.CrossFlowStream1UnmixedStream2Mixed) then
flowRegime_nominal = if (C1_flow_nominal < C2_flow_nominal) then flo.CrossFlowCMinUnmixedCMaxMixed
else flo.CrossFlowCMinMixedCMaxUnmixed;
elseif (configuration == con.ParallelFlow) then
flowRegime_nominal = flo.ParallelFlow;
elseif (configuration == con.CounterFlow) then
flowRegime_nominal = flo.CounterFlow;
elseif (configuration == con.CrossFlowUnmixed) then
flowRegime_nominal = flo.CrossFlowUnmixed;
if (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.CrossFlowStream1MixedStream2Unmixed) then
flowRegime_nominal = if (C1_flow_nominal < C2_flow_nominal) then IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowCMinMixedCMaxUnmixed
else IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowCMinUnmixedCMaxMixed;
elseif (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.CrossFlowStream1UnmixedStream2Mixed) then
flowRegime_nominal = if (C1_flow_nominal < C2_flow_nominal) then IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowCMinUnmixedCMaxMixed
else IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowCMinMixedCMaxUnmixed;
elseif (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.ParallelFlow) then
flowRegime_nominal = IBPSA.Fluid.Types.HeatExchangerFlowRegime.ParallelFlow;
elseif (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.CounterFlow) then
flowRegime_nominal = IBPSA.Fluid.Types.HeatExchangerFlowRegime.CounterFlow;
elseif (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.CrossFlowUnmixed) then
flowRegime_nominal = IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowUnmixed;
else
// Invalid flow regime. Assign a value to flowRegime_nominal, and stop with an assert
flowRegime_nominal = flo.CrossFlowUnmixed;
assert(configuration >= con.ParallelFlow and configuration <= con.CrossFlowStream1UnmixedStream2Mixed,
flowRegime_nominal = IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowUnmixed;
assert(configuration >= IBPSA.Fluid.Types.HeatExchangerConfiguration.ParallelFlow and configuration <= IBPSA.Fluid.Types.HeatExchangerConfiguration.CrossFlowStream1UnmixedStream2Mixed,
"Invalid heat exchanger configuration.");
end if;
// The equation sorter of Dymola 7.3 does not guarantee that the above assert is tested prior to the
Expand All @@ -161,19 +159,19 @@ initial equation
equation
// Assign the flow regime for the given heat exchanger configuration and capacity flow rates
if use_dynamicFlowRegime then
if (configuration == con.ParallelFlow) then
flowRegime = if (C1_flow*C2_flow >= 0) then flo.ParallelFlow else flo.CounterFlow;
elseif (configuration == con.CounterFlow) then
flowRegime = if (C1_flow*C2_flow >= 0) then flo.CounterFlow else flo.ParallelFlow;
elseif (configuration == con.CrossFlowUnmixed) then
flowRegime = flo.CrossFlowUnmixed;
elseif (configuration == con.CrossFlowStream1MixedStream2Unmixed) then
flowRegime = if (C1_flow < C2_flow) then flo.CrossFlowCMinMixedCMaxUnmixed
else flo.CrossFlowCMinUnmixedCMaxMixed;
if (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.ParallelFlow) then
flowRegime = if (C1_flow*C2_flow >= 0) then IBPSA.Fluid.Types.HeatExchangerFlowRegime.ParallelFlow else IBPSA.Fluid.Types.HeatExchangerFlowRegime.CounterFlow;
elseif (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.CounterFlow) then
flowRegime = if (C1_flow*C2_flow >= 0) then IBPSA.Fluid.Types.HeatExchangerFlowRegime.CounterFlow else IBPSA.Fluid.Types.HeatExchangerFlowRegime.ParallelFlow;
elseif (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.CrossFlowUnmixed) then
flowRegime = IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowUnmixed;
elseif (configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.CrossFlowStream1MixedStream2Unmixed) then
flowRegime = if (C1_flow < C2_flow) then IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowCMinMixedCMaxUnmixed
else IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowCMinUnmixedCMaxMixed;
else
// have ( configuration == con.CrossFlowStream1UnmixedStream2Mixed)
flowRegime = if (C1_flow < C2_flow) then flo.CrossFlowCMinUnmixedCMaxMixed
else flo.CrossFlowCMinMixedCMaxUnmixed;
// have ( configuration == IBPSA.Fluid.Types.HeatExchangerConfiguration.CrossFlowStream1UnmixedStream2Mixed)
flowRegime = if (C1_flow < C2_flow) then IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowCMinUnmixedCMaxMixed
else IBPSA.Fluid.Types.HeatExchangerFlowRegime.CrossFlowCMinMixedCMaxUnmixed;
end if;
else
flowRegime = flowRegime_nominal;
Expand Down Expand Up @@ -253,6 +251,12 @@ for <code>UA</code>.
</html>", revisions="<html>
<ul>
<li>
February 7, 2025, by Jelger Jansen:<br/>
Removed <code>import</code> statement.
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1961\">IBPSA, #1961</a>.
</li>
<li>
February 3, 2023, by Jianjun Hu:<br/>
Added <code>noEvent()</code> in the assertion function to avoid Optimica to not converge.<br/>
This is for
Expand Down
Loading

0 comments on commit 0a5b631

Please sign in to comment.