Skip to content

Commit

Permalink
Merge pull request #407 from lbl-srg/issue388_state
Browse files Browse the repository at this point in the history
Issue388 state
  • Loading branch information
mwetter committed Apr 1, 2015
2 parents 2e4ef6a + 4b444d7 commit 2968e4c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
25 changes: 16 additions & 9 deletions Buildings/Fluid/Interfaces/PartialTwoPortTransport.mo
Expand Up @@ -55,19 +55,19 @@ partial model PartialTwoPortTransport
m_flow_small) if show_T
"Temperature close to port_b, if show_T = true";
protected
Medium.ThermodynamicState state_a "state for medium inflowing through port_a";
Medium.ThermodynamicState state_b "state for medium inflowing through port_b";
equation
// medium states
state_a = Medium.setState_phX(
Medium.ThermodynamicState state_a = Medium.setState_phX(
port_a.p,
inStream(port_a.h_outflow),
inStream(port_a.Xi_outflow));
state_b = Medium.setState_phX(
inStream(port_a.Xi_outflow)) if
show_T or show_V_flow
"State for medium inflowing through port_a";
Medium.ThermodynamicState state_b = Medium.setState_phX(
port_b.p,
inStream(port_b.h_outflow),
inStream(port_b.Xi_outflow));

inStream(port_b.Xi_outflow)) if
show_T or show_V_flow
"State for medium inflowing through port_b";
equation
// Pressure drop in design flow direction
dp = port_a.p - port_b.p;

Expand Down Expand Up @@ -120,6 +120,13 @@ users have not used this global definition to assign parameters.
</html>", revisions="<html>
<ul>
<li>
April 1, 2015, by Michael Wetter:<br/>
Made computation of <code>state_a</code> and <code>state_p</code>
conditional on <code>show_T</code> or <code>show_V_flow</code>.
This avoids computating temperature from enthalpy if temperature is
a state of the medium, and the result is not used.
</li>
<li>
October 21, 2014, by Michael Wetter:<br/>
Revised implementation.
</li>
Expand Down
6 changes: 4 additions & 2 deletions Buildings/Fluid/Interfaces/PrescribedOutletState.mo
Expand Up @@ -33,6 +33,9 @@ protected
cp_default*m_flow_small*0.01
"Small value for deltah used for regularization";

final parameter Boolean dynamic = tau > 1E-10 or tau < -1E-10
"Flag, true if the sensor is a dynamic sensor";

Modelica.SIunits.MassFlowRate m_flow_pos
"Mass flow rate, or zero if reverse flow";

Expand All @@ -50,8 +53,7 @@ protected

Real k(start=1)
"Gain to take flow rate into account for sensor time constant";
final parameter Boolean dynamic = tau > 1E-10 or tau < -1E-10
"Flag, true if the sensor is a dynamic sensor";

Real mNor_flow "Normalized mass flow rate";

initial equation
Expand Down

0 comments on commit 2968e4c

Please sign in to comment.