LBL logo

Buildings.Fluid.BaseClasses.FlowModels.Examples

Collection of models that illustrate model use and test models

Information

This package contains examples for the use of models that can be found in Buildings.Fluid.BaseClasses.FlowModels.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

NameDescription
Buildings.Fluid.BaseClasses.FlowModels.Examples.InverseFlowFunction InverseFlowFunction Test model for flow function and its inverse
Buildings.Fluid.BaseClasses.FlowModels.Examples.TestFlowFunctions TestFlowFunctions Test model for flow functions

Buildings.Fluid.BaseClasses.FlowModels.Examples.InverseFlowFunction Buildings.Fluid.BaseClasses.FlowModels.Examples.InverseFlowFunction

Test model for flow function and its inverse

Information

This model tests the inverse formulation of the flow functions. The pressure difference dp and dpCalc need to be equal up to the solver tolerance, except for a small neighborhood around the origin. In this neighborhood around the origin, the functions Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_dp and Buildings.Fluid.BaseClasses.FlowModels.basicFlowFunction_m_flow are not invertible.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Realk0.5 
MassFlowRatem_flow_nominal1Nominal flow rate [kg/s]

Modelica definition

model InverseFlowFunction 
  "Test model for flow function and its inverse"
  extends Modelica.Icons.Example;
 Modelica.SIunits.MassFlowRate m_flow;
 Modelica.SIunits.Pressure dp(displayUnit="Pa") "Pressure difference";
 Modelica.SIunits.Pressure dpCalc(displayUnit="Pa") 
    "Pressure difference computed by the flow functions";
 Modelica.SIunits.Pressure deltaDp(displayUnit="Pa") 
    "Pressure difference between input and output to the functions";
 Modelica.SIunits.Time dTime= 2;
 parameter Real k = 0.5;
 parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 1 "Nominal flow rate";
equation 
  dp = (time-0.5)/dTime * 20;
  m_flow=FlowModels.basicFlowFunction_dp(dp=dp, k=k, m_flow_turbulent=m_flow_nominal*0.3);
  dpCalc=FlowModels.basicFlowFunction_m_flow(m_flow=m_flow, k=k, m_flow_turbulent=m_flow_nominal*0.3);
  deltaDp = dp - dpCalc;
end InverseFlowFunction;

Buildings.Fluid.BaseClasses.FlowModels.Examples.TestFlowFunctions Buildings.Fluid.BaseClasses.FlowModels.Examples.TestFlowFunctions

Test model for flow functions

Information

This model test the inverse functions. When translating this model in Dymola 7.2, there should be no numerical solution be required to solve the nonlinear equation system.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Pressurep2101325Boundary condition [Pa]
Booleanfrom_dptrue 
Realk0.5 
MassFlowRatem_flow_nominal1Nominal flow rate [kg/s]

Modelica definition

model TestFlowFunctions "Test model for flow functions"
  extends Modelica.Icons.Example;
 Modelica.SIunits.MassFlowRate m1_flow;
 Modelica.SIunits.MassFlowRate m2_flow;
 Modelica.SIunits.Pressure dp1;
 Modelica.SIunits.Pressure dp2;
 Modelica.SIunits.Pressure p1_nominal=101325;
 Modelica.SIunits.Time dTime= 1;
 Modelica.SIunits.Pressure p1 "Boundary condition";
 parameter Modelica.SIunits.Pressure p2 = 101325 "Boundary condition";
 parameter Boolean from_dp = true;
 parameter Real k = 0.5;
 parameter Modelica.SIunits.MassFlowRate m_flow_nominal = 1 "Nominal flow rate";
equation 
  p1 = p1_nominal + (time-0.5)/dTime * 20;
  m1_flow = m2_flow;
  p2-p1 = dp1 + dp2;
  if from_dp then
  m1_flow=FlowModels.basicFlowFunction_dp(dp=dp1, k=k, m_flow_turbulent=m_flow_nominal*0.3);
  m2_flow=FlowModels.basicFlowFunction_dp(dp=dp2, k=k, m_flow_turbulent=m_flow_nominal*0.3);
  else
  dp1=FlowModels.basicFlowFunction_m_flow(m_flow=m1_flow, k=k, m_flow_turbulent=m_flow_nominal*0.3);
  dp2=FlowModels.basicFlowFunction_m_flow(m_flow=m2_flow, k=k, m_flow_turbulent=m_flow_nominal*0.3);
  end if;
  assert(abs(dp1-dp2) < 1E-5, "Error in implementation.");
end TestFlowFunctions;

Automatically generated Fri Dec 13 11:35:57 2013.