Changeset 1953

Show
Ignore:
Timestamp:
12/05/2008 02:11:11 PM (5 weeks ago)
Author:
rfranke
Message:

Pipes: remove replaceable qualifier from pressureDrop and heatTransfer models, avoiding potential conflicts as PressureDrop and HeatTransfer model types are replaceable as well. ... The burden is shifted to the tool to keep parameterizations when the models are replaced.

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

Legend:

Unmodified
Added
Removed
  • Modelica_Fluid/branches/StreamConnector/Modelica_Fluid/Pipes.mo

    r1951 r1953  
    88          redeclare model HeatTransfer=BaseClasses.HeatTransfer.PipeHT_none(nTubes=nTubes)); 
    99 
    10     replaceable PressureDrop pressureDrop( 
     10    PressureDrop pressureDrop( 
    1111            redeclare final package Medium = Medium, 
    1212            final n=1, 
     
    2323            final length=length, 
    2424            final height_ab=height_ab, 
    25             final g=system.g) "Edit pressure drop parameters"  
    26        annotation (editButton=true,Placement(transformation(extent={{-38,-18},{ 
    27               38,18}}, 
    28             rotation=0))); 
     25            final g=system.g) "Pressure drop model"  
     26       annotation (Placement(transformation(extent={{-38,-18},{38,18}},rotation=0))); 
    2927  equation 
    3028    port_a.m_flow = pressureDrop.m_flow[1]*nTubes; 
     
    7371      annotation (Dialog(tab="Initialization", enable=Medium.nXi > 0)); 
    7472 
    75     replaceable HeatTransfer heatTransfer( 
     73    HeatTransfer heatTransfer( 
    7674      redeclare final package Medium = Medium, 
    7775      final n=1, 
    7876      final nTubes=nTubes, 
    79       diameter=4*crossArea/perimeter, 
    80       area=perimeter*length, 
     77      final diameter=4*crossArea/perimeter, 
     78      final area=perimeter*length, 
    8179      final crossArea=crossArea, 
    8280      final length=length, 
     81      final use_fluidHeatPort=true, 
    8382      state={volume.medium.state}, 
    84       m_flow = {0.5*(port_a.m_flow - port_b.m_flow)}/nTubes, 
    85       final useFluidHeatPort=true) "Edit heat transfer parameters"  
    86       annotation (editButton=true, Placement(transformation(extent={{-11,14},{ 
    87               11,36}},                                                                  rotation=0))); 
     83      m_flow = {0.5*(port_a.m_flow - port_b.m_flow)}/nTubes) 
     84      "Heat transfer model"  
     85        annotation (Placement(transformation(extent={{-11,14},{11,36}},rotation=0))); 
    8886 
    8987    StaticPipe staticPipe1( 
     
    223221 
    224222    // Pressure drop model 
    225     replaceable PressureDrop pressureDrop( 
     223    PressureDrop pressureDrop( 
    226224            redeclare final package Medium = Medium, 
    227225            final n=nFlows, 
     
    234232            final m_flow_start=m_flow_start/nTubes, 
    235233            final roughness=roughness, 
    236             diameter=4*crossArea/perimeter, 
     234            final diameter=4*crossArea/perimeter, 
    237235            final length=length, 
    238236            final height_ab=height_ab, 
    239             final g=system.g) "Edit pressure drop parameters"  
    240        annotation (editButton=true,Placement(transformation(extent={{-77,-57},{77, 
    241               -23}}, 
    242             rotation=0))); 
     237            final g=system.g) "Pressure drop model"  
     238       annotation (Placement(transformation(extent={{-77,-57},{77,-23}},rotation=0))); 
    243239 
    244240    // Flow quantities 
     
    256252      annotation (Placement(transformation(extent={{-10,44},{10,64}}), iconTransformation(extent={{-30,44},{32,60}}))); 
    257253 
    258     replaceable HeatTransfer heatTransfer( 
     254    HeatTransfer heatTransfer( 
    259255      redeclare each final package Medium = Medium, 
    260256      final n=n, 
    261257      final nTubes=nTubes, 
    262       diameter=4*crossArea/perimeter, 
    263       area=perimeter*length, 
     258      final diameter=4*crossArea/perimeter, 
     259      final area=perimeter*length, 
    264260      final crossArea=crossArea, 
    265261      final length=length, 
    266262      state=medium.state, 
    267       m_flow = 0.5*(m_flow[1:n]+m_flow[2:n+1])/nTubes) 
    268       "Edit heat transfer parameters"  
    269         annotation (editButton=true, Placement(transformation(extent={{-20,-5},{20,35}},  rotation=0))); 
     263      m_flow = 0.5*(m_flow[1:n]+m_flow[2:n+1])/nTubes) "Heat transfer model"  
     264        annotation (Placement(transformation(extent={{-20,-5},{20,35}},  rotation=0))); 
    270265 
    271266  equation 
     
    496491        constrainedby BaseClasses.PressureDrop.PartialPipePressureDrop 
    497492        "Characteristics of wall friction and gravity"  
    498           annotation(Dialog(group="Pressure drop"), editButton=false, choicesAllMatching=true); 
     493          annotation(Dialog(group="Pressure drop"), choicesAllMatching=true); 
    499494 
    500495      // Heat transfer 
     
    503498        constrainedby 
    504499        Modelica_Fluid.Pipes.BaseClasses.HeatTransfer.PartialPipeHeatTransfer 
    505         "Wall heat transfer model"  
    506         annotation (Dialog(group="Heat transfer"),editButton=false,choicesAllMatching=true); 
     500        "Wall heat transfer"  
     501        annotation (Dialog(group="Heat transfer"),choicesAllMatching=true); 
    507502 
    508503      annotation (defaultComponentName="pipe",Icon(coordinateSystem( 
     
    541536          partial model PartialPipePressureDrop 
    542537        "Base class for pipe wall friction models" 
     538 
    543539            replaceable package Medium =  
    544             Modelica.Media.Interfaces.PartialMedium "fluid medium"; 
    545             parameter Integer n=1 "number of flow segments"; 
     540            Modelica.Media.Interfaces.PartialMedium "fluid medium"  
     541              annotation(Dialog(tab="Internal Interface", enable=false)); 
     542 
    546543            input Medium.ThermodynamicState[n+1] state 
    547544          "states along design flow"; 
     
    549546          "mass flow rates along design flow"; 
    550547 
     548            // Discretization 
     549            parameter Integer n=1 "number of flow segments"  
     550              annotation(Dialog(tab="Internal Interface", enable=false)); 
     551 
    551552            // Mandadory geometry parameters 
    552             parameter SI.Length length "Length of pipe"   annotation(Dialog(group="Geometry")); 
     553            parameter SI.Length length "Length of pipe"  
     554               annotation(Dialog(tab="Internal Interface", enable=false,group="Geometry")); 
    553555            parameter SI.Diameter diameter 
    554           "Hydraulic diameter of pipe (typically 4*crossArea/perimeter)"                                       annotation(Dialog(group="Geometry")); 
     556          "Hydraulic diameter of pipe (typically 4*crossArea/perimeter)"  
     557               annotation(Dialog(tab="Internal Interface", enable=false,group="Geometry")); 
    555558            parameter SI.Length roughness(min=0) 
    556559          "Average height of surface asperities"  
    557                 annotation(Dialog(group="Geometry",enable=WallFriction.use_roughness)); 
     560                annotation(Dialog(tab="Internal Interface", enable=false,group="Geometry",enable=WallFriction.use_roughness)); 
    558561            parameter SI.Length height_ab "Height(state_b) - Height(state_a)"  
    559                 annotation(Dialog(group="Static head")); 
     562                annotation(Dialog(tab="Internal Interface", enable=false,group="Static head")); 
    560563 
    561564            // Additional parameters 
     
    563566            // as a PressureDrop model is intended as sub-component of other models 
    564567            parameter SI.Acceleration g "Constant gravity acceleration"  
    565               annotation(Dialog(group="Static head")); 
     568              annotation(Dialog(tab="Internal Interface", enable=false,group="Static head")); 
    566569            parameter Boolean allowFlowReversal 
    567570          "= true to allow flow reversal, false restricts to design direction (state[1] -> state[n+1])" 
    568               annotation(Dialog(tab="Assumptions"), Evaluate=true); 
     571              annotation(Dialog(tab="Internal Interface", enable=false,group="Assumptions"), Evaluate=true); 
    569572            parameter Modelica_Fluid.Types.Dynamics dynamicsType 
    570573          "Dynamics option, e.g. for models with dynamic momentum balance"  
    571               annotation(Evaluate=true, Dialog(tab = "Assumptions")); 
     574              annotation(Dialog(tab="Internal Interface", enable=false,group = "Assumptions"), Evaluate=true); 
    572575            parameter Modelica_Fluid.Types.Init initType 
    573576          "Initialization option, e.g. for dynamic momentum balance"  
    574               annotation(Evaluate=true, Dialog(tab = "Initialization")); 
     577              annotation(Evaluate=true, Dialog(tab="Internal Interface", enable=false,group = "Initialization")); 
    575578            parameter Medium.AbsolutePressure p_a_start 
    576579          "Start value for p[1] at design inflow"  
    577               annotation(Dialog(tab = "Initialization")); 
     580              annotation(Dialog(tab="Internal Interface", enable=false,group = "Initialization")); 
    578581            parameter Medium.AbsolutePressure p_b_start 
    579582          "Start value for p[n+1] at design outflow"  
    580               annotation(Dialog(tab = "Initialization")); 
     583              annotation(Dialog(tab="Internal Interface", enable=false,group = "Initialization")); 
    581584            parameter Medium.MassFlowRate m_flow_start 
    582585          "Start value of mass flow rate"  
    583               annotation(Dialog(tab = "Initialization")); 
     586              annotation(Dialog(tab="Internal Interface", enable=false,group = "Initialization")); 
    584587 
    585588            // Variables 
     
    789792 
    790793      // Parameters 
    791       replaceable package Medium=Modelica.Media.Interfaces.PartialMedium; 
    792       parameter Integer n=1 "Number of heat transfer segments"; 
    793       parameter Real nTubes "Number of parallel tubes, used for HeatPorts only"; 
    794       parameter SI.Length length "Pipe length"; 
     794      replaceable package Medium=Modelica.Media.Interfaces.PartialMedium  
     795        annotation(Dialog(tab="Internal Interface", enable=false)); 
     796      parameter Integer n=1 "Number of heat transfer segments"  
     797        annotation(Dialog(tab="Internal Interface", enable=false), Evaluate=true); 
     798      parameter Real nTubes "Number of parallel tubes, used for HeatPorts only" 
     799        annotation(Dialog(tab="Internal Interface", enable=false)); 
     800      parameter SI.Length length "Pipe length"  
     801        annotation(Dialog(tab="Internal Interface", enable=false)); 
    795802      parameter SI.Length diameter 
    796           "Hydraulic diameter (typically 4*crossArea/perimeter)"; 
    797       parameter SI.Area crossArea "Cross flow area"; 
    798       parameter SI.Area area "Heat transfer area (typically perimeter*length)"; 
     803          "Hydraulic diameter (typically 4*crossArea/perimeter)"  
     804        annotation(Dialog(tab="Internal Interface", enable=false)); 
     805      parameter SI.Area crossArea "Cross flow area"  
     806        annotation(Dialog(tab="Internal Interface", enable=false)); 
     807      parameter SI.Area area "Heat transfer area (typically perimeter*length)"  
     808        annotation(Dialog(tab="Internal Interface", enable=false)); 
     809      parameter Boolean use_fluidHeatPort=false 
     810          "= true to use fluidHeatPort instead of output Q_flow"  
     811        annotation(Dialog(tab="Internal Interface", enable=false)); 
    799812 
    800813      // Inputs provided to heat transfer model 
     
    810823                rotation=0), iconTransformation(extent={{-20,60},{20,80}}))); 
    811824 
    812       Modelica_Fluid.Interfaces.HeatPorts_b[n] fluidHeatPort if useFluidHeatPort 
     825      Modelica_Fluid.Interfaces.HeatPorts_b[n] fluidHeatPort if use_fluidHeatPort 
    813826          "Thermal port to fluid"  
    814827        annotation (Placement(transformation(extent={{-10,-70},{10,-50}}, 
     
    817830      // Internal variables 
    818831      SI.Temperature[n] T; 
    819       parameter Boolean useFluidHeatPort = false 
    820           "= true to use fluidHeatPort instead of output Q_flow"  
    821         annotation(Dialog(tab="No input", enable=false), Evaluate=true, HideResult=true); 
    822832      Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow[n] 
    823833          prescribedHeatFlow "Needed to connect to conditional connector"  
     
    829839      T = Medium.temperature(state); 
    830840      wallHeatPort.Q_flow = Q_flow*nTubes; 
    831       if useFluidHeatPort then 
     841      if use_fluidHeatPort then 
    832842        prescribedHeatFlow.Q_flow = Q_flow*nTubes; 
    833843      else 
     
    854864Base class for heat transfer models that can be used in distributed pipe models. 
    855865</html>"), 
    856         Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 
    857                 100,100}}), 
     866        Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100}, 
     867                  {100,100}}), 
    858868                        graphics)); 
    859869    end PartialPipeHeatTransfer; 
     
    10701080        state={volume.medium.state}, 
    10711081        m_flow = {0.5*(port_a.m_flow - port_b.m_flow)}, 
    1072         final useFluidHeatPort=true) "Edit heat transfer parameters"  
     1082        final use_fluidHeatPort=true) "Edit heat transfer parameters"  
    10731083        annotation (editButton=true, Placement(transformation(extent={{-20,0},{20,40}},   rotation=0))); 
    10741084 
  • Modelica_Fluid/branches/StreamConnector/Modelica_Fluid/Test/TestOverdeterminedSteadyStateInit.mo

    r1950 r1953  
    8686                        graphics), 
    8787                         Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, 
    88               -100},{100,100}}), graphics={Rectangle(extent={{-100,100},{100,-100}}, 
     88              -100},{100,100}}), graphics={Rectangle(extent={{-100,100},{100,-100}},  
    8989              lineColor={0,0,255}), Text( 
    9090            extent={{-60,60},{60,-60}}, 
     
    155155      diameter=0.03, 
    156156      T_start=Modelica.SIunits.Conversions.from_degC(80), 
    157       redeclare model PressureDrop =  
    158           Modelica_Fluid.Pipes.BaseClasses.PressureDrop.QuadraticTurbulentFlow, 
    159157      initType=Modelica_Fluid.Types.Init.InitialValues, 
    160158      length=2, 
     
    162160          Modelica_Fluid.Pipes.BaseClasses.HeatTransfer.PipeHT_ideal, 
    163161      p_a_start=400000, 
    164       p_b_start=390000)  
     162      p_b_start=390000, 
     163      redeclare model PressureDrop = 
     164          Modelica_Fluid.Pipes.BaseClasses.PressureDrop.QuadraticTurbulentFlow 
     165          (use_nominal=true))  
    165166      annotation (Placement(transformation(extent={{12,-14},{32,6}}, rotation=0))); 
    166167 
     
    171172      diameter=0.05, 
    172173      T_start=Modelica.SIunits.Conversions.from_degC(40), 
    173       redeclare model PressureDrop =  
    174           Modelica_Fluid.Pipes.BaseClasses.PressureDrop.QuadraticTurbulentFlow, 
    175174      initType=Modelica_Fluid.Types.Init.InitialValues, 
    176175      redeclare model HeatTransfer =  
    177176          Modelica_Fluid.Pipes.BaseClasses.HeatTransfer.PipeHT_ideal, 
    178177      p_a_start=110000, 
    179       p_b_start=105000)  
     178      p_b_start=105000, 
     179      redeclare model PressureDrop = 
     180          Modelica_Fluid.Pipes.BaseClasses.PressureDrop.QuadraticTurbulentFlow 
     181          (use_nominal=true))  
    180182      annotation (Placement(transformation(extent={{28,-76},{8,-56}}, rotation= 
    181183              0))); 
  • Modelica_Fluid/branches/StreamConnector/Modelica_Fluid/Volumes.mo

    r1952 r1953  
    332332            lineColor={0,0,0}, 
    333333            textString=DynamicSelect(" ", realString( 
    334                 level, 
    335                 1, 
     334                level,  
     335                1,  
    336336                integer(precision)))), 
    337337          Line(