Changeset 1946

Show
Ignore:
Timestamp:
12/04/2008 04:37:53 PM (5 weeks ago)
Author:
rfranke
Message:

Rewrite DistributedPipe using new PressureDrop interface.

Location:
Modelica_Fluid/branches/StreamConnector/Modelica_Fluid
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • Modelica_Fluid/branches/StreamConnector/Modelica_Fluid/Examples/AST_BatchPlant.mo

    r1945 r1946  
    12911291              fillColor={85,170,255}, 
    12921292              fillPattern=FillPattern.Solid), 
    1293             Line(points={{-200,100},{-200,-100},{0,-100},{0,100}}, color={0,0,0}), 
     1293            Line(points={{-200,100},{-200,-100},{0,-100},{0,100}}, color={0,0,0}),  
     1294 
    12941295            Text( 
    12951296              extent={{-198,74},{0,38}}, 
     
    20512052              lineColor={0,0,0}, 
    20522053              textString=DynamicSelect(" ", realString( 
    2053                     level, 
    2054                     1, 
     2054                    level,  
     2055                    1,  
    20552056                    3))), 
    20562057            Line( 
  • Modelica_Fluid/branches/StreamConnector/Modelica_Fluid/Examples/BranchingDistributedPipes.mo

    r1945 r1946  
    66replaceable package Medium=Modelica.Media.Air.DryAirNasa;  // 
    77 
    8  Modelica_Fluid.Pipes.DistributedPipe_Old pipe2( 
    9     redeclare package Medium = Medium, 
    10     use_T_start=true, 
    11     from_dp=true, 
    12     diameter=0.01, 
    13     nNodes=5, 
    14     redeclare package WallFriction =  
    15         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     8 Modelica_Fluid.Pipes.DistributedPipe pipe2( 
     9    redeclare package Medium = Medium, 
     10    use_T_start=true, 
     11    diameter=0.01, 
     12    nNodes=5, 
     13    redeclare model PressureDrop =  
     14        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    1615    m_flow_start=0.1, 
    1716    length=2, 
     
    4241    useTemperatureInput=false)                                      annotation (Placement( 
    4342        transformation(extent={{70,24},{50,44}}, rotation=0))); 
    44   Modelica_Fluid.Pipes.DistributedPipe_Old pipe3( 
    45     redeclare package Medium=Medium, 
    46     length=1, 
    47     use_T_start=true, 
    48     from_dp=true, 
    49     diameter=0.01, 
    50     nNodes=5, 
    51     redeclare package WallFriction =  
    52         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     43  Modelica_Fluid.Pipes.DistributedPipe pipe3( 
     44    redeclare package Medium=Medium, 
     45    length=1, 
     46    use_T_start=true, 
     47    diameter=0.01, 
     48    nNodes=5, 
     49    redeclare model PressureDrop =  
     50        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    5351    m_flow_start=0.1, 
    5452    use_approxPortProperties=true, 
     
    6159          rotation=0))); 
    6260 
    63   Modelica_Fluid.Pipes.DistributedPipe_Old pipe1( 
    64     redeclare package Medium=Medium, 
    65     use_T_start=true, 
    66     from_dp=true, 
    67     diameter=0.01, 
    68     nNodes=5, 
    69     redeclare package WallFriction =  
    70         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     61  Modelica_Fluid.Pipes.DistributedPipe pipe1( 
     62    redeclare package Medium=Medium, 
     63    use_T_start=true, 
     64    diameter=0.01, 
     65    nNodes=5, 
     66    redeclare model PressureDrop =  
     67        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    7168    m_flow_start=0.1, 
    7269    length=0.4, 
     
    9895          rotation=0))); 
    9996 
    100   Modelica_Fluid.Pipes.DistributedPipe_Old pipe4( 
    101     redeclare package Medium=Medium, 
    102     length=1, 
    103     use_T_start=true, 
    104     from_dp=true, 
     97  Modelica_Fluid.Pipes.DistributedPipe pipe4( 
     98    redeclare package Medium=Medium, 
     99    length=1, 
     100    use_T_start=true, 
    105101    diameter=0.01, 
    106102    T_start=360, 
    107103    nNodes=5, 
    108     redeclare package WallFriction =  
    109         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     104    redeclare model PressureDrop =  
     105        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    110106    m_flow_start=0.1, 
    111107    p_b_start=1.0e5, 
     
    121117            0))); 
    122118  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow[ 
    123                                               pipe2.n] heat(each Q_flow=200, 
     119                                              pipe2.nNodes] heat(each Q_flow=200, 
    124120      each alpha=10000)  
    125121    annotation (Placement(transformation(extent={{-60,72},{-40,92}}, rotation=0))); 
    126  Modelica_Fluid.Pipes.DistributedPipe_Old pipe5( 
    127     redeclare package Medium = Medium, 
    128     use_T_start=true, 
    129     from_dp=true, 
    130     diameter=0.01, 
    131     nNodes=5, 
    132     initType=Modelica_Fluid.Types.Init.NoInit, 
    133     redeclare package WallFriction =  
    134         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     122 Modelica_Fluid.Pipes.DistributedPipe pipe5( 
     123    redeclare package Medium = Medium, 
     124    use_T_start=true, 
     125    diameter=0.01, 
     126    nNodes=5, 
     127    initType=Modelica_Fluid.Types.Init.NoInit, 
     128    redeclare model PressureDrop =  
     129        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    135130    m_flow_start=0.1, 
    136131    length=2, 
     
    149144    useTemperatureInput=false)                                      annotation (Placement( 
    150145        transformation(extent={{70,-70},{50,-50}}, rotation=0))); 
    151   Modelica_Fluid.Pipes.DistributedPipe_Old pipe6( 
     146  Modelica_Fluid.Pipes.DistributedPipe pipe6( 
    152147    redeclare package Medium=Medium, 
    153148    T_start=340, 
    154149    length=1, 
    155150    use_T_start=true, 
    156     from_dp=true, 
    157151    p_b_start=1e5, 
    158152    diameter=0.01, 
    159153    nNodes=5, 
    160154    initType=Modelica_Fluid.Types.Init.NoInit, 
    161     redeclare package WallFriction =  
    162         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     155    redeclare model PressureDrop =  
     156        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    163157    m_flow_start=0.1, 
    164158    use_approxPortProperties=true, 
     
    166160            annotation (Placement(transformation(extent={{16,-70},{36,-50}}, 
    167161          rotation=0))); 
    168   Modelica_Fluid.Pipes.DistributedPipe_Old pipe7( 
    169     redeclare package Medium=Medium, 
    170     use_T_start=true, 
    171     from_dp=true, 
     162  Modelica_Fluid.Pipes.DistributedPipe pipe7( 
     163    redeclare package Medium=Medium, 
     164    use_T_start=true, 
    172165    T_start=300, 
    173166    diameter=0.01, 
    174167    nNodes=5, 
    175168    initType=Modelica_Fluid.Types.Init.NoInit, 
    176     redeclare package WallFriction =  
    177         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     169    redeclare model PressureDrop =  
     170        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    178171    m_flow_start=0.1, 
    179172    p_b_start=1.0e5, 
     
    195188                annotation (Placement(transformation(extent={{100,-20},{80,0}}, 
    196189          rotation=0))); 
    197   Modelica_Fluid.Pipes.DistributedPipe_Old pipe8( 
    198     redeclare package Medium=Medium, 
    199     length=1, 
    200     use_T_start=true, 
    201     from_dp=true, 
     190  Modelica_Fluid.Pipes.DistributedPipe pipe8( 
     191    redeclare package Medium=Medium, 
     192    length=1, 
     193    use_T_start=true, 
    202194    diameter=0.01, 
    203195    T_start=360, 
    204196    nNodes=5, 
    205197    initType=Modelica_Fluid.Types.Init.NoInit, 
    206     redeclare package WallFriction =  
    207         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     198    redeclare model PressureDrop =  
     199        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    208200    m_flow_start=0.1, 
    209201    p_b_start=1.0e5, 
     
    214206          rotation=0))); 
    215207  Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow[ 
    216                                               pipe2.n] heat1(each Q_flow=200, 
     208                                              pipe5.nNodes] heat1(each Q_flow=200, 
    217209      each alpha=10000)  
    218210    annotation (Placement(transformation(extent={{-62,-24},{-42,-4}}, rotation= 
  • Modelica_Fluid/branches/StreamConnector/Modelica_Fluid/Pipes.mo

    r1945 r1946  
    2121            final height_ab=height_ab, 
    2222            final g=system.g) "Edit pressure drop parameters"  
    23        annotation (editButton=true,Placement(transformation(extent={{-10,-10},{10,10}}, 
     23       annotation (editButton=true,Placement(transformation(extent={{-38,-18},{ 
     24              38,18}}, 
    2425            rotation=0))); 
    2526  equation 
     
    171172  end LumpedPipe; 
    172173 
     174  model DistributedPipe "Distributed pipe model" 
     175 
     176    import Modelica_Fluid.Types; 
     177    import Modelica_Fluid.Types.ModelStructure; 
     178 
     179    // distributed volume model 
     180    extends Modelica_Fluid.Volumes.BaseClasses.PartialDistributedVolume( 
     181      final n = nNodes, 
     182      Qs_flow=heatTransfer.Q_flow); 
     183 
     184    // extending PartialPipe 
     185    extends Modelica_Fluid.Pipes.BaseClasses.PartialPipe( 
     186      final port_a_exposesState = (modelStructure == ModelStructure.av_b) or (modelStructure == ModelStructure.avb), 
     187      final port_b_exposesState = (modelStructure == ModelStructure.a_vb) or (modelStructure == ModelStructure.avb)); 
     188 
     189    // Discretization 
     190    parameter Integer nNodes(min=1)=1 "Number of discrete flow volumes"; 
     191 
     192    parameter Types.ModelStructure modelStructure=Types.ModelStructure.a_v_b 
     193      "Determines whether flow or volume models are present at the ports"                              annotation(Evaluate=true); 
     194 
     195    parameter Boolean lumpedPressure=false 
     196      "=true to lump all pressure nodes into one"  
     197      annotation(Dialog(tab="Advanced", group="Pressure drop"),Evaluate=true); 
     198    final parameter Integer iLumped=integer(n/2)+1 
     199      "Index of control volume that representative state"                   annotation(Evaluate=true); 
     200    final parameter Integer nFlowsLumped=if modelStructure==Types.ModelStructure.a_v_b then 2 else if (modelStructure==Types.ModelStructure.a_vb or modelStructure==Types.ModelStructure.av_b) then 1 else 0; 
     201    final parameter Integer nFlowsDistributed=if modelStructure==Types.ModelStructure.a_v_b then n+1 else if (modelStructure==Types.ModelStructure.a_vb or modelStructure==Types.ModelStructure.av_b) then n else n-1; 
     202    final parameter Integer nFlows=if lumpedPressure then nFlowsLumped else nFlowsDistributed; 
     203 
     204    // Advanced model options 
     205    parameter Boolean use_approxPortProperties=false 
     206      "=true, port properties for pressure drop correlation are taken from neighboring control volume" 
     207      annotation(Dialog(tab="Advanced", group="Pressure drop"),Evaluate=true); 
     208    Medium.ThermodynamicState state_a "state defined by volume outside port_a"; 
     209    Medium.ThermodynamicState state_b "state defined by volume outside port_b"; 
     210    Medium.ThermodynamicState[nFlows+1] flowState 
     211      "state vector for pressureDrop model"; 
     212 
     213    replaceable PressureDrop pressureDrop( 
     214            redeclare final package Medium = Medium, 
     215            final n=nFlows, 
     216            state=flowState, 
     217            final allowFlowReversal=allowFlowReversal, 
     218            final p_a_start=p_a_start, 
     219            final p_b_start=p_b_start, 
     220            final m_flow_start=m_flow_start, 
     221            final roughness=roughness, 
     222            diameter=4*crossArea/perimeter, 
     223            final length=length, 
     224            final height_ab=height_ab, 
     225            final g=system.g) "Edit pressure drop parameters"  
     226       annotation (editButton=true,Placement(transformation(extent={{-77,-57},{77, 
     227              -23}}, 
     228            rotation=0))); 
     229 
     230    // Flow quantities 
     231    Medium.MassFlowRate[n+1] m_flow(each min=if allowFlowReversal then -Modelica.Constants.inf else  
     232                0, each start=m_flow_start) 
     233      "Mass flow rates of fluid across segment boundaries"; 
     234    Medium.MassFlowRate[n+1, Medium.nXi] mXi_flow 
     235      "Independent mass flow rates across segment boundaries"; 
     236    Medium.EnthalpyFlowRate[n+1] H_flow 
     237      "Enthalpy flow rates of fluid across segment boundaries"; 
     238 
     239    // Wall heat transfer 
     240    Interfaces.HeatPorts_a[nNodes] heatPorts  
     241      annotation (Placement(transformation(extent={{-10,44},{10,64}}), iconTransformation(extent={{-30,44},{32,60}}))); 
     242 
     243    replaceable HeatTransfer heatTransfer( 
     244      redeclare each final package Medium = Medium, 
     245      final n=n, 
     246      diameter=4*crossArea/perimeter, 
     247      area=perimeter*length, 
     248      final crossArea=crossArea, 
     249      final length=length, 
     250      state=medium.state, 
     251      m_flow = 0.5*(m_flow[1:n]+m_flow[2:n+1])) "Edit heat transfer parameters" 
     252              annotation (editButton=true, Placement(transformation(extent={{-20,-5},{20,35}},  rotation=0))); 
     253 
     254  equation 
     255    // Only one connection allowed to a port to avoid unwanted ideal mixing 
     256    assert(cardinality(port_a) <= 1 or (modelStructure == ModelStructure.a_vb) or (modelStructure == ModelStructure.a_v_b)," 
     257port_a exposing volume with selected modelStructure shall at most be connected to one component. 
     258If two or more connections are present, ideal mixing takes 
     259place with these connections which is usually not the intention 
     260of the modeller. Use a Junctions.MultiPort. 
     261"); 
     262    assert(cardinality(port_b) <= 1 or (modelStructure == ModelStructure.av_b) or (modelStructure == ModelStructure.a_v_b)," 
     263port_b exposing volume with selected modelStructure shall at most be connected to one component. 
     264If two or more connections are present, ideal mixing takes 
     265place with these connections which is usually not the intention 
     266of the modeller. Use a Junctions.MultiPort. 
     267"); 
     268 
     269    // Source/sink terms for mass and energy balances 
     270    fluidVolume=fill(V/nNodes, n); 
     271    Ws_flow=zeros(n); 
     272    for i in 1:n loop 
     273      ms_flow[i] = m_flow[i] - m_flow[i + 1]; 
     274      msXi_flow[i, :] = mXi_flow[i, :] - mXi_flow[i + 1, :]; 
     275    end for; 
     276    for i in 1:n loop 
     277      Hs_flow[i] = H_flow[i] - H_flow[i + 1]; 
     278    end for; 
     279 
     280    // Distributed flow quantities, upwind discretization 
     281    for i in 2:n loop 
     282      H_flow[i] = semiLinear(m_flow[i], medium[i - 1].h, medium[i].h); 
     283      mXi_flow[i, :] = semiLinear(m_flow[i], medium[i - 1].Xi, medium[i].Xi); 
     284    end for; 
     285    H_flow[1] = semiLinear(port_a.m_flow, inStream(port_a.h_outflow), medium[1].h); 
     286    H_flow[n + 1] = -semiLinear(port_b.m_flow, inStream(port_b.h_outflow), medium[n].h); 
     287    mXi_flow[1, :] = semiLinear(port_a.m_flow, inStream(port_a.Xi_outflow), medium[1].Xi); 
     288    mXi_flow[n + 1, :] = -semiLinear(port_b.m_flow, inStream(port_b.Xi_outflow), medium[n].Xi); 
     289 
     290    // Boundary conditions 
     291    port_a.h_outflow = medium[1].h; 
     292    port_b.h_outflow = medium[nNodes].h; 
     293    port_a.m_flow    = m_flow[1]; 
     294    port_b.m_flow    = -m_flow[n + 1]; 
     295    port_a.C_outflow = inStream(port_b.C_outflow); 
     296    port_b.C_outflow = inStream(port_a.C_outflow); 
     297 
     298    if use_approxPortProperties and n > 0 then 
     299      state_a = Medium.setState_phX(port_a.p, medium[1].h, medium[1].Xi); 
     300      state_b = Medium.setState_phX(port_b.p, medium[n].h, medium[n].Xi); 
     301    else 
     302      state_a = Medium.setState_phX(port_a.p, inStream(port_a.h_outflow), inStream(port_a.Xi_outflow)); 
     303      state_b = Medium.setState_phX(port_a.p, inStream(port_b.h_outflow), inStream(port_b.Xi_outflow)); 
     304    end if; 
     305 
     306    if lumpedPressure then 
     307      fill(medium[1].p, n-1) = medium[2:n].p; 
     308      if modelStructure == ModelStructure.a_v_b then 
     309        flowState[1] = state_a; 
     310        flowState[2] = medium[iLumped].state; 
     311        flowState[3] = state_b; 
     312      elseif modelStructure == ModelStructure.av_b then 
     313        flowState[1] = medium[iLumped].state; 
     314        flowState[2] = state_b; 
     315      elseif modelStructure == ModelStructure.a_vb then 
     316        flowState[1] = state_a; 
     317        flowState[2] = medium[iLumped].state; 
     318      else // avb 
     319        flowState[1] = medium[iLumped].state; 
     320      end if; 
     321      m_flow[1] = pressureDrop.m_flow[1]; 
     322      m_flow[n+1] = pressureDrop.m_flow[nFlows]; 
     323    else 
     324      if modelStructure == ModelStructure.a_v_b then 
     325        flowState[1] = state_a; 
     326        flowState[2:n+1] = medium[1:n].state; 
     327        flowState[n+2] = state_b; 
     328        //m_flow = pressureDrop.m_flow; 
     329        for i in 1:n+1 loop 
     330          m_flow[i] = pressureDrop.m_flow[i]; 
     331        end for; 
     332      elseif modelStructure == ModelStructure.av_b then 
     333        flowState[1:n] = medium[1:n].state; 
     334        flowState[n+1] = state_b; 
     335        //m_flow[2:n+1] = pressureDrop.m_flow; 
     336        for i in 2:n+1 loop 
     337          m_flow[i] = pressureDrop.m_flow[i-1]; 
     338        end for; 
     339        port_a.p = medium[1].p; 
     340      elseif modelStructure == ModelStructure.a_vb then 
     341        flowState[1] = state_a; 
     342        flowState[2:n+1] = medium[1:n].state; 
     343        //m_flow[1:n] = pressureDrop.m_flow; 
     344        for i in 1:n loop 
     345          m_flow[i] = pressureDrop.m_flow[i]; 
     346        end for; 
     347        port_b.p = medium[n].p; 
     348      else // avb 
     349        flowState[1:n] = medium[1:n].state; 
     350        //m_flow[2:n] = pressureDrop.m_flow[1:n-1]; 
     351        for i in 2:n loop 
     352          m_flow[i] = pressureDrop.m_flow[i-1]; 
     353        end for; 
     354        port_a.p = medium[1].p; 
     355        port_b.p = medium[n].p; 
     356      end if; 
     357    end if; 
     358 
     359    connect(heatPorts, heatTransfer.wallHeatPort)  
     360      annotation (Line(points={{0,54},{0,29}}, color={191,0,0})); 
     361 
     362    annotation (defaultComponentName="pipe", 
     363  Icon(coordinateSystem(preserveAspectRatio=true,  extent={{-100,-100},{100,100}}, 
     364          grid={1,1}), graphics={ 
     365          Ellipse( 
     366            extent={{-72,10},{-52,-10}}, 
     367            lineColor={0,0,0}, 
     368            fillColor={0,0,0}, 
     369            fillPattern=FillPattern.Solid), 
     370          Ellipse( 
     371            extent={{-30,10},{-10,-10}}, 
     372            lineColor={0,0,0}, 
     373            fillColor={0,0,0}, 
     374            fillPattern=FillPattern.Solid), 
     375          Ellipse( 
     376            extent={{10,10},{30,-10}}, 
     377            lineColor={0,0,0}, 
     378            fillColor={0,0,0}, 
     379            fillPattern=FillPattern.Solid), 
     380          Ellipse( 
     381            extent={{50,10},{70,-10}}, 
     382            lineColor={0,0,0}, 
     383            fillColor={0,0,0}, 
     384            fillPattern=FillPattern.Solid)}), 
     385  Diagram(coordinateSystem(preserveAspectRatio=true,  extent={{-100,-100},{100, 
     386              100}}, 
     387          grid={1,1}), 
     388          graphics), 
     389  Documentation(info="<html> 
     390<p>Distributed pipe model based on <a href=\"Modelica:Modelica_Fluid.Pipes.BaseClasses.PartialPipe\">PartialPipe</a>. The total volume is a parameter. Mass and Energy balance are inherited from <a href=\"Modelica:Modelica_Fluid.Volumes.BaseClasses.PartialDistributedVolume\">PartialDistributedVolume</a>.  
     391The additional component <b><tt>HeatTransfer</tt></b> specifies the source term <tt>Qs_flow</tt> in the energy balance. The default component uses a constant coefficient of heat transfer to model convective heat transfer between segment boundary (<tt>heatPorts</tt>) and the bulk flow.  
     392The <tt>HeatTransfer</tt> model is replaceable and can be exchanged with any model extended from <a href=\"Modelica:Modelica_Fluid.Pipes.BaseClasses.HeatTransfer.PartialPipeHeatTransfer\">PartialPipeHeatTransfer</a>.</p> 
     393<p>Pressure drop correlations (algebraic and possibly non-linear flow model) correlate the pressure in the first control volume with the pressure in port_a and the pressures of port_b and the nth control volume, respectively.</p> 
     394<p><b>Momentum balance</b></p> 
     395<p>The momentum balance is determined by the replaceable <b><tt>PressureDrop</tt></b> component.  
     396The default setting is steady-state <a href=\"Modelica:Modelica_Fluid.Pipes.BaseClasses.PressureDrop.QuadraticTurbulentFlow\">QuadraticTurbulentFlow</a>. 
     397The momentum balances are formed across the segment boundaries (staggered grid). The default symmetric model is characterized by half a momentum balance on each end of the flow model resulting in a total of n-1 full and 2 half momentum balances. Connecting two pipes therefore results in an algebraic pressure at the ports. Specifying a good start value for the port pressure is essential in order to solve large systems. Non-symmetric variations are obtained by chosing a different value for the parameter <tt><b>modelStructure</b></tt>. Options include: 
     398<ul> 
     399<li><tt>a_v_b</tt>: default setting with two half momentum balances</li> 
     400<li><tt>av_b</tt>: full momentum balance between nth volume and <tt>port_b</tt>, potential pressure state at <tt>port_a</tt></li> 
     401<li><tt>a_vb</tt>: full momentum balance between first volume and <tt>port_a</tt>, potential pressure state at <tt>port_b</tt></li> 
     402<li><tt>avb</tt>: nNodes-1 momentum balances between first and nth volume, potential pressure states at both ports. It's use should be avoided, since not the entire pipe length is taken into account. 
     403</ul></p> 
     404  
     405<p>The term <tt>dp</tt> contains 
     406<ul> 
     407<li>pressure drop due to friction and other dissipative losses</li> 
     408<li>gravity effects for non-horizontal pipes</li> 
     409</ul> 
     410It does not model changes in pressure resulting from significant variation of flow velocity along the flow path (with the assumption of a constant cross sectional area it must result from fluid density changes, such as in two-phase flow). 
     411  
     412When connecting two components, e.g. two pipes, the momentum balance across the connection point reduces to</p>  
     413<pre>pipe1.port_b.p = pipe2.port_a.p</pre> 
     414<p>This is only true if the flow velocity remains the same on each side of the connection. For any significant change in diameter (and if the resulting effects, such as change in kinetic energy, cannot be neglected) an adapter component should be used. This also allows for taking into account friction losses with respect to the actual geometry of the connection point.</p> 
     415  
     416</html>", 
     417      revisions="<html> 
     418<ul> 
     419<li><i>4 Dec 2008</i> 
     420    by R&uuml;diger Franke:<br> 
     421       Derived model from original DistributedPipe models</li> 
     422<li><i>04 Mar 2006</i> 
     423    by Katrin Pr&ouml;l&szlig;:<br> 
     424       Model added to the Fluid library</li> 
     425</ul> 
     426</html>")); 
     427 
     428  end DistributedPipe; 
    173429 
    174430  model StaticPipe_Old 
  • Modelica_Fluid/branches/StreamConnector/Modelica_Fluid/Test/TestComponents/Pipes/TestDistributedPipe01.mo

    r1945 r1946  
    66//replaceable package Medium=Modelica.Media.Air.DryAirNasa;  // 
    77 
    8  Modelica_Fluid.Pipes.DistributedPipe_Old pipe2( 
    9     redeclare package Medium = Medium, 
    10     use_T_start=true, 
    11     from_dp=true, 
     8 Modelica_Fluid.Pipes.DistributedPipe pipe2( 
     9    redeclare package Medium = Medium, 
     10    use_T_start=true, 
    1211    T_start=280, 
    1312    diameter=0.01, 
    1413    nNodes=5, 
    1514    initType=Modelica_Fluid.Types.Init.NoInit, 
    16     redeclare package WallFriction =  
    17         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     15    redeclare model PressureDrop =  
     16        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    1817    m_flow_start=0.1, 
    1918    p_b_start=1.0e5, 
     
    4039    useTemperatureInput=false)                                      annotation (Placement( 
    4140        transformation(extent={{70,54},{50,74}}, rotation=0))); 
    42   Modelica_Fluid.Pipes.DistributedPipe_Old pipe3( 
     41  Modelica_Fluid.Pipes.DistributedPipe pipe3( 
    4342    redeclare package Medium=Medium, 
    4443    T_start=340, 
    4544    length=1, 
    4645    use_T_start=true, 
    47     from_dp=true, 
    4846    p_b_start=1e5, 
    4947    diameter=0.01, 
    5048    nNodes=5, 
    5149    initType=Modelica_Fluid.Types.Init.NoInit, 
    52     redeclare package WallFriction =  
    53         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     50    redeclare model PressureDrop =  
     51        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    5452    m_flow_start=0.1, 
    5553    use_approxPortProperties=true, 
     
    5856          rotation=0))); 
    5957 
    60   Modelica_Fluid.Pipes.DistributedPipe_Old pipe1( 
    61     redeclare package Medium=Medium, 
    62     use_T_start=true, 
    63     from_dp=true, 
     58  Modelica_Fluid.Pipes.DistributedPipe pipe1( 
     59    redeclare package Medium=Medium, 
     60    use_T_start=true, 
    6461    T_start=300, 
    6562    diameter=0.01, 
    6663    nNodes=5, 
    6764    initType=Modelica_Fluid.Types.Init.NoInit, 
    68     redeclare package WallFriction =  
    69         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     65    redeclare model PressureDrop =  
     66        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    7067    m_flow_start=0.1, 
    7168    p_b_start=1.0e5, 
     
    9491          rotation=0))); 
    9592 
    96   Modelica_Fluid.Pipes.DistributedPipe_Old pipe4( 
    97     redeclare package Medium=Medium, 
    98     length=1, 
    99     use_T_start=true, 
    100     from_dp=true, 
    101     diameter=0.01, 
    102     nNodes=5, 
    103     initType=Modelica_Fluid.Types.Init.NoInit, 
    104     redeclare package WallFriction =  
    105         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     93  Modelica_Fluid.Pipes.DistributedPipe pipe4( 
     94    redeclare package Medium=Medium, 
     95    length=1, 
     96    use_T_start=true, 
     97    diameter=0.01, 
     98    nNodes=5, 
     99    initType=Modelica_Fluid.Types.Init.NoInit, 
     100    redeclare model PressureDrop =  
     101        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    106102    m_flow_start=0.1, 
    107103    heatTransfer(each alpha0=1000), 
     
    136132    annotation (Placement(transformation(extent={{-54,80},{-34,100}}, rotation= 
    137133            0))); 
    138  Modelica_Fluid.Pipes.DistributedPipe_Old pipe5( 
    139     redeclare package Medium = Medium, 
    140     use_T_start=true, 
    141     from_dp=true, 
     134 Modelica_Fluid.Pipes.DistributedPipe pipe5( 
     135    redeclare package Medium = Medium, 
     136    use_T_start=true, 
    142137    T_start=280, 
    143138    diameter=0.01, 
    144139    nNodes=5, 
    145140    initType=Modelica_Fluid.Types.Init.NoInit, 
    146     redeclare package WallFriction =  
    147         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     141    redeclare model PressureDrop =  
     142        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    148143    m_flow_start=0.1, 
    149144    p_b_start=1.0e5, 
     
    161156    useTemperatureInput=false)                                      annotation (Placement( 
    162157        transformation(extent={{68,-2},{48,18}}, rotation=0))); 
    163   Modelica_Fluid.Pipes.DistributedPipe_Old pipe6( 
     158  Modelica_Fluid.Pipes.DistributedPipe pipe6( 
    164159    redeclare package Medium=Medium, 
    165160    T_start=340, 
    166161    length=1, 
    167162    use_T_start=true, 
    168     from_dp=true, 
    169163    p_b_start=1e5, 
    170164    diameter=0.01, 
    171165    nNodes=5, 
    172166    initType=Modelica_Fluid.Types.Init.NoInit, 
    173     redeclare package WallFriction =  
    174         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     167    redeclare model PressureDrop =  
     168        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    175169    m_flow_start=0.1, 
    176170    use_approxPortProperties=true, 
     
    178172            annotation (Placement(transformation(extent={{14,-2},{34,18}}, 
    179173          rotation=0))); 
    180   Modelica_Fluid.Pipes.DistributedPipe_Old pipe7( 
    181     redeclare package Medium=Medium, 
    182     use_T_start=true, 
    183     from_dp=true, 
     174  Modelica_Fluid.Pipes.DistributedPipe pipe7( 
     175    redeclare package Medium=Medium, 
     176    use_T_start=true, 
    184177    T_start=300, 
    185178    diameter=0.01, 
    186179    nNodes=5, 
    187180    initType=Modelica_Fluid.Types.Init.NoInit, 
    188     redeclare package WallFriction =  
    189         Modelica_Fluid.PressureLosses.BaseClasses.WallFriction.Detailed, 
     181    redeclare model PressureDrop =  
     182        Modelica_Fluid.Pipes.BaseClasses.PressureDrop.DetailedFlow(from_dp=true), 
    190183    m_flow_start=0.1, 
    191184    p_b_start=1.0e5,