Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue1890 nominal start values #1902

Merged
merged 5 commits into from
Jun 21, 2024
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
10 changes: 8 additions & 2 deletions IBPSA/BoundaryConditions/WeatherData/Bus.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ within IBPSA.BoundaryConditions.WeatherData;
expandable connector Bus "Data bus that stores weather data"
extends Modelica.Icons.SignalBus;

Modelica.Units.SI.Temperature TDryBul "Dry bulb temperature";
Modelica.Units.SI.Temperature TWetBul "Wet bulb temperature";
Modelica.Units.SI.Temperature TDryBul(start=293.15) "Dry bulb temperature";
Modelica.Units.SI.Temperature TWetBul(start=293.15) "Wet bulb temperature";
Modelica.Units.SI.Temperature TDewPoi "Dew point temperature";
Modelica.Units.SI.Temperature TBlaSky "Black-body sky temperature";

Expand Down Expand Up @@ -50,6 +50,12 @@ This component is an expandable connector that is used to implement a bus that c
</html>", revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
September 22, 2023, by Michael Wetter:<br/>
Declared the variables that are on the bus.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1798\">IBPSA, #1798</a>.
Expand Down
15 changes: 12 additions & 3 deletions IBPSA/Fluid/Interfaces/ConservationEquation.mo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ model ConservationEquation "Lumped volume with mass and energy balance"

// Outputs that are needed in models that use this model
Modelica.Blocks.Interfaces.RealOutput hOut(unit="J/kg",
start=hStart)
start=hStart,
nominal=Medium.h_default)
"Leaving specific enthalpy of the component"
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=90,
Expand Down Expand Up @@ -70,7 +71,9 @@ model ConservationEquation "Lumped volume with mass and energy balance"
origin={110,-60})));

Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nPorts](
redeclare each final package Medium = Medium) "Fluid inlets and outlets"
redeclare each final package Medium = Medium,
each h_outflow(nominal=Medium.h_default),
each Xi_outflow(each nominal=0.01)) "Fluid inlets and outlets"
annotation (Placement(transformation(extent={{-40,-10},{40,10}},
origin={0,-100})));

Expand Down Expand Up @@ -427,6 +430,12 @@ IBPSA.Fluid.MixingVolumes.MixingVolume</a>.
</html>", revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
October 24, 2022, by Michael Wetter:<br/>
Conditionally removed assertion that checks for water content as this is
only required if water is added to the medium.<br/>
Expand Down Expand Up @@ -561,7 +570,7 @@ The model requires derivatives of some inputs as listed below:
1 inlet.p
</pre>
when translating
<code>Buildings.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_u</code>
<code>IBPSA.Fluid.FMI.ExportContainers.Examples.FMUs.HeaterCooler_u</code>
with a dynamic energy balance.
</li>
<li>
Expand Down
16 changes: 14 additions & 2 deletions IBPSA/Fluid/Interfaces/PartialTwoPort.mo
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ partial model PartialTwoPort "Partial component with two ports"
Modelica.Fluid.Interfaces.FluidPort_a port_a(
redeclare final package Medium = Medium,
m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0),
h_outflow(start = Medium.h_default, nominal = Medium.h_default))
h_outflow(
start = Medium.h_default,
nominal = Medium.h_default),
Xi_outflow(each nominal=0.01))
"Fluid connector a (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
Modelica.Fluid.Interfaces.FluidPort_b port_b(
redeclare final package Medium = Medium,
m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0),
h_outflow(start = Medium.h_default, nominal = Medium.h_default))
h_outflow(
start = Medium.h_default,
nominal = Medium.h_default),
Xi_outflow(each nominal=0.01))
"Fluid connector b (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{110,-10},{90,10}})));

Expand All @@ -48,6 +54,12 @@ users have not used this global definition to assign parameters.
</html>", revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
January 18, 2019, by Jianjun Hu:<br/>
Limited the media choice.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1050\">#1050</a>.
Expand Down
18 changes: 15 additions & 3 deletions IBPSA/Fluid/MixingVolumes/BaseClasses/PartialMixingVolume.mo
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ model PartialMixingVolume
annotation(Dialog(tab="Assumptions"), Evaluate=true);
parameter Modelica.Units.SI.Volume V "Volume";
Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nPorts](
redeclare each package Medium = Medium) "Fluid inlets and outlets"
redeclare each package Medium = Medium,
each h_outflow(nominal=Medium.h_default),
each Xi_outflow(each nominal=0.01)
) "Fluid inlets and outlets"
annotation (Placement(transformation(extent={{-40,-10},{40,10}},
origin={0,-100})));

Expand Down Expand Up @@ -119,12 +122,15 @@ protected
Modelica.Blocks.Interfaces.RealOutput COut_internal[Medium.nC](each unit="1")
"Internal connector for leaving trace substances of the component";

Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature preTem
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature preTem(
port(T(start=T_start)))
"Port temperature"
annotation (Placement(transformation(extent={{-40,-10},{-60,10}})));
Modelica.Blocks.Sources.RealExpression portT(y=T) "Port temperature"
annotation (Placement(transformation(extent={{-10,-10},{-30,10}})));
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFloSen
Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor heaFloSen(
port_a(T(start=T_start)),
port_b(T(start=T_start)))
"Heat flow sensor"
annotation (Placement(transformation(extent={{-90,-10},{-70,10}})));
equation
Expand Down Expand Up @@ -305,6 +311,12 @@ IBPSA.Fluid.MixingVolumes</a>.
</html>", revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
October 24, 2022, by Michael Wetter:<br/>
Improved conversion from <code>Xi</code> to <code>X</code> so that it also works
with media that have <code>reducedX=true</code>.<br/>
Expand Down
12 changes: 10 additions & 2 deletions IBPSA/Fluid/Movers/BaseClasses/PartialFlowMachine.mo
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ partial model PartialFlowMachine
annotation (Placement(transformation(extent={{100,80},{120,100}}),
iconTransformation(extent={{100,80},{120,100}})));

Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort(
T(start=293.15))
"Heat dissipation to environment"
annotation (Placement(transformation(extent={{-70,-110},{-50,-90}}),
iconTransformation(extent={{-10,-78},{10,-58}})));
Expand Down Expand Up @@ -260,7 +261,8 @@ protected
annotation (Placement(transformation(extent={{50,-90},{70,-70}})));

Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prePow(
final alpha=0)
final alpha=0,
port(T(start=293.15)))
if addPowerToMedium
"Prescribed power (=heat and flow work) flow for dynamic model"
annotation (Placement(transformation(extent={{-14,-104},{-34,-84}})));
Expand Down Expand Up @@ -639,6 +641,12 @@ See discussions in
revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
March 29, 2023, by Hongxiang Fu:<br/>
Removed the gain block that normalised the speed input
because it is no longer needed. This is for
Expand Down
14 changes: 12 additions & 2 deletions IBPSA/Fluid/Sources/BaseClasses/PartialAirSource.mo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ partial model PartialAirSource
each m_flow(max=if flowDirection == Modelica.Fluid.Types.PortFlowDirection.Leaving
then 0 else +Modelica.Constants.inf,
min=if flowDirection == Modelica.Fluid.Types.PortFlowDirection.Entering
then 0 else -Modelica.Constants.inf))
then 0 else -Modelica.Constants.inf),
each h_outflow(nominal=Medium.h_default),
each Xi_outflow(each nominal=0.01))
"Fluid ports"
annotation (Placement(transformation(extent={{90,40},{110,-40}})));

Expand All @@ -26,7 +28,9 @@ protected
"Allowed flow direction" annotation (Evaluate=true, Dialog(tab="Advanced"));
Modelica.Blocks.Interfaces.RealInput p_in_internal(final unit="Pa")
"Needed to connect to conditional connector";
Medium.BaseProperties medium if verifyInputs "Medium in the source";
Medium.BaseProperties medium(
T(start=Medium.T_default)
) if verifyInputs "Medium in the source";
Modelica.Blocks.Interfaces.RealInput Xi_in_internal[Medium.nXi](
each final unit = "kg/kg")
"Needed to connect to conditional connector";
Expand Down Expand Up @@ -80,6 +84,12 @@ IBPSA.Fluid.Sources.BaseClasses.PartialSource</a>.
</html>", revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
January 09, 2023, by Jianjun Hu:<br/>
First implementation, specifically for the moist air source.<br/>
This is for
Expand Down
10 changes: 9 additions & 1 deletion IBPSA/Fluid/Sources/BaseClasses/PartialSource.mo
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ partial model PartialSource
each m_flow(max=if flowDirection == Modelica.Fluid.Types.PortFlowDirection.Leaving
then 0 else +Modelica.Constants.inf,
min=if flowDirection == Modelica.Fluid.Types.PortFlowDirection.Entering
then 0 else -Modelica.Constants.inf))
then 0 else -Modelica.Constants.inf),
each h_outflow(nominal=Medium.h_default),
each Xi_outflow(each nominal=0.01))
"Fluid ports"
annotation (Placement(transformation(extent={{90,40},{110,-40}})));

Expand Down Expand Up @@ -87,6 +89,12 @@ IBPSA.Fluid.Sources.BaseClasses.PartialAirSource</a>.
</html>", revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
April 1, 2021, by Michael Wetter:<br/>
Corrected misplaced <code>each</code> and added missing instance comment.<br/>
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1462\">IBPSA, #1462</a>.
Expand Down
13 changes: 11 additions & 2 deletions IBPSA/Media/Air.mo
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,18 @@ package Air
Modelica.Media.Interfaces.Types.Temperature T(
stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default)
"Temperature of medium";
Modelica.Media.Interfaces.Types.MassFraction[2] X(start=reference_X)
Modelica.Media.Interfaces.Types.MassFraction[2] X(
start=reference_X,
nominal={0.01, 1})
"Mass fractions (= (component mass)/total mass m_i/m)";
Modelica.Media.Interfaces.Types.SpecificInternalEnergy u
"Specific internal energy of medium";
Modelica.Media.Interfaces.Types.SpecificHeatCapacity R_s
"Gas constant (of mixture if applicable)";
Modelica.Media.Interfaces.Types.MolarMass MM
"Molar mass (of mixture or single fluid)";
ThermodynamicState state
ThermodynamicState state(
X(nominal={0.01, 1}))
"Thermodynamic state record for optional functions";

Modelica.Units.NonSI.Temperature_degC T_degC=
Expand Down Expand Up @@ -1057,6 +1060,12 @@ if <i>T=0</i> &deg;C and no water vapor is present.
</html>", revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
September 9, 2022, by Michael Wetter:<br/>
Set nominal attribute for <code>BaseProperties.Xi</code>.<br/>
This is for
Expand Down
13 changes: 10 additions & 3 deletions IBPSA/Media/Water.mo
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package Water "Package with model for liquid water with constant density"
final parameter Boolean standardOrderComponents=true
"If true, and reducedX = true, the last element of X will be computed from the other ones";
Modelica.Units.SI.Density d=d_const "Density of medium";
Temperature T(stateSelect=
if preferredMediumStates then StateSelect.prefer else StateSelect.default)
Temperature T(
start=293.15,
stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default)
"Temperature of medium";
InputAbsolutePressure p "Absolute pressure of medium";
InputMassFraction[nXi] Xi=fill(0, 0)
Expand Down Expand Up @@ -174,6 +175,12 @@ There are no phase changes.
</html>", revisions="<html>
<ul>
<li>
June 18, 2024, by Michael Wetter:<br/>
Added <code>start</code> and <code>nominal</code> attributes
to avoid warnings in OpenModelica due to conflicting values.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1890\">IBPSA, #1890</a>.
</li>
<li>
September 28, 2020, by Michael Wetter:<br/>
Reformulated <code>BaseProperties</code> to avoid event-triggering assertions.<br/>
This is for
Expand Down Expand Up @@ -251,7 +258,7 @@ to fail with the error message
<li>
October 15, 2014, by Michael Wetter:<br/>
Reimplemented media based on
<a href=\"https://github.com/ibpsa/modelica-ibpsa/blob/446aa83720884052476ad6d6d4f90a6a29bb8ec9/IBPSA/Media/Water.mo\">446aa83</a>.
<a href=\"https://github.com/ibpsa/modelica-ibpsa/blob/446aa83720884052476ad6d6d4f90a6a29bb8ec9/Annex60/Media/Water.mo\">446aa83</a>.
</li>
<li>
November 15, 2013, by Michael Wetter:<br/>
Expand Down
Loading
Loading