components.mo

Download Components.mo

If you can't read please download the document

Upload: radanpetrica

Post on 05-Dec-2015

217 views

Category:

Documents


0 download

DESCRIPTION

Components.mo

TRANSCRIPT

within ;package components model SourceWF "Flowrate source for water/steam flows with temperature as input if it is defined as a parameter and enthalpy as input if it is defined by the connector" extends Icons.Water.SourceW; parameter Modelica.SIunits.MassFlowRate Mdot_0=0 "Mass flowrate if no connector"; parameter Modelica.SIunits.Pressure p=1e5 "Pressure"; parameter Boolean UseT=true "Use temperature as input instead of enthalpy"; parameter Modelica.SIunits.Temperature T_0=298.13 "Temperature if no connector" annotation(Dialog(enable=UseT)); parameter Modelica.SIunits.SpecificEnthalpy h_0=0 "Enthalpy if no connector" annotation(Dialog(enable=not UseT)); Modelica.SIunits.SpecificEnthalpy h "specific enthalpy"; components.FlangeBFluid flange annotation (Placement(transformation(extent={{80,-20},{120, 20}}, rotation=0))); Modelica.Blocks.Interfaces.RealInput in_Mdot annotation (Placement(transformation( origin={-40,60}, extent={{-20,-20},{20,20}}, rotation=270), iconTransformation( extent={{-20,-20},{20,20}}, rotation=270, origin={-60,60}))); Modelica.Blocks.Interfaces.RealInput in_h annotation (Placement(transformation( origin={40,60}, extent={{-20,-20},{20,20}}, rotation=270), iconTransformation( extent={{-20,-20},{20,20}}, rotation=270, origin={60,60}))); Modelica.Blocks.Interfaces.RealInput in_T annotation (Placement(transformation( origin={2,60}, extent={{-20,-20},{20,20}}, rotation=270), iconTransformation( extent={{-20,-20},{20,20}}, rotation=270, origin={-2,60}))); TILMedia.Refrigerant refrigerant(refrigerantName="Refprop.R245FA", inputChoice=TILMedia.Internals.InputChoicesRefrigerant.pT) annotation (Placement(transformation(extent={{-14,-16},{6,4}}))); equation flange.w = -in_Mdot; if cardinality(in_Mdot) == 0 then in_Mdot = Mdot_0 "Flow rate set by parameter"; end if; if cardinality(in_T) == 0 then in_T = T_0 "Temperature set by parameter"; end if; refrigerant.T = in_T; refrigerant.p = p; if UseT then h =refrigerant.h; flange.hBA = h; else flange.hBA = in_h; h=0; end if; if cardinality(in_h) == 0 then in_h = h_0 "Enthalpy set by parameter"; end if; annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics={ Text(extent={{-76,42},{-30,10}}, textString="Mdot"), Text(extent={{40,40},{84,12}}, textString="h"), Text(extent={{-20,40},{18,12}}, textString="T")}), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics)); end SourceWF; model SinkPFluid "Pressure sink for current working fluid" extends Icons.Water.SourceP; parameter Modelica.SIunits.Pressure p0=1.01325e5 "Nominal pressure"; parameter Modelica.SIunits.SpecificEnthalpy h=1e5 "Nominal specific enthalpy"; Modelica.SIunits.Pressure p; Modelica.Blocks.Interfaces.RealInput in_p0 annotation (Placement(transformation( origin={-40,88}, extent={{-20,-20},{20,20}}, rotation=270))); Modelica.Blocks.Interfaces.RealInput in_h annotation (Placement(transformation( origin={40,88}, extent={{-20,-20},{20,20}}, rotation=270))); components.FlangeAFluid flange annotation (Placement(transformation(extent={{-110,0},{ -90,20}}), iconTransformation(extent={{-116,-8},{-84,24}}))); equation flange.p = p; p = in_p0; if cardinality(in_p0)==0 then in_p0 = p0 "Pressure set by parameter"; end if; flange.hAB =in_h; if cardinality(in_h)==0 then in_h = h "Enthalpy set by parameter"; end if; annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics={Text(extent={{-106,92},{-56,50}}, textString= "p0"), Text(extent={{54,94},{112,52}}, textString="h")}), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics), Documentation(info="Modelling optionsIf R is set to zero, the pressure sink is ideal; otherwise, the inlet pressure increases proportionally to the incoming flowrate.If the in_p0 connector is wired, then the source pressure is given by the corresponding signal, otherwise it is fixed to p0.If the in_h connector is wired, then the source pressure is given by the corresponding signal, otherwise it is fixed to h.", revisions="16 Dec 2004 by Francesco Casella: Medium model and standard medium definition added.18 Jun 2004 by Francesco Casella: Removed p0_fix and hfix; the connection of external signals is now detected automatically.1 Oct 2003 by Francesco Casella: First release."), conversion(noneFromVersion="")); end SinkPFluid; connector FlangeAFluid "A-type flange connector for current working fluid" Modelica.SIunits.AbsolutePressure p "Pressure"; flow Modelica.SIunits.MassFlowRate w "Mass flowrate"; output Modelica.SIunits.SpecificEnthalpy hAB "Specific enthalpy of fluid going out"; input Modelica.SIunits.SpecificEnthalpy hBA "Specific enthalpy of entering fluid"; annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Ellipse(extent={{-100,100},{100,-100}}, lineColor={0,127,0})}), Documentation(info=" Must always be connected to a single type-B connector FlangeB.", revisions="16 Dec 2004 by Francesco Casella: Medium model added.1 Oct 2003 by Francesco Casella: First release.")); end FlangeAFluid; connector FlangeBFluid "B-type flange connector for current working fluid" Modelica.SIunits.AbsolutePressure p "Pressure"; flow Modelica.SIunits.MassFlowRate w "Mass flowrate"; input Modelica.SIunits.SpecificEnthalpy hAB "Specific enthalpy of entering fluid"; output Modelica.SIunits.SpecificEnthalpy hBA "Specific enthalpy of fluid going out"; annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Ellipse(extent={{-100,100},{100,-100}}, lineColor={0,127,0}), Ellipse( extent={{-42,44},{44,-40}}, lineColor={0,127,0}, fillColor={255,255,255}, fillPattern=FillPattern.Solid)}), Documentation(info=" Must always be connected to a single type-A connector FlangeA.", revisions="16 Dec 2004 by Francesco Casella: Medium model added.1 Oct 2003 by Francesco Casella: First release.")); end FlangeBFluid; model simple_hx // Inputs-outputs: Modelica.SIunits.Pressure p(start=pstart); Modelica.SIunits.MassFlowRate M_dot_su; Modelica.SIunits.MassFlowRate M_dot_sf; Modelica.SIunits.SpecificHeatCapacity cp_sf; Modelica.SIunits.Temperature T_sf_su; Modelica.SIunits.Density rho_sf_su; // Heat exchanger characteristics: parameter Integer N(min=1)=10 "Number of nodes"; parameter Modelica.SIunits.Area A=2 "Heat exchanger area"; parameter Modelica.SIunits.Volume V=0.005 "Heat exchanger internal volume"; Modelica.SIunits.Volume Vi=V/N; Modelica.SIunits.Area Ai=A/N; parameter Modelica.SIunits.Volume V_sf=0.005 "Heat exchanger internal volume, secondary fluid side"; Modelica.SIunits.Volume Vi_sf=V_sf/N; // Wall variables: parameter Modelica.SIunits.Mass M_wall=2 "Mass"; parameter Modelica.SIunits.SpecificHeatCapacity c_wall=503 "Specific heat capacity of metal"; parameter Modelica.SIunits.Temperature Tstart_wall_left=450 "Wall temperature start value - first node" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature Tstart_wall_right=450 "Wall temperature start value - last node" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature Tstart_wall[N] = linspace(Tstart_wall_left,Tstart_wall_right,N) "Start value of temperature vector (initialized by default)" annotation(Dialog(tab = "Initialization")); Modelica.SIunits.Temperature T_wall[N](start=linspace(Tstart_wall_left,Tstart_wall_right,N)) "Cell temperatures"; // Secondary fluid variables: parameter Modelica.SIunits.Temperature Tstart_sf_left=450 "Secondary fluid temperature start value - first node" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature Tstart_sf_right=310 "Secondary fluid temperature start value - last node" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature Tstart_sf[N] = linspace(Tstart_sf_left,Tstart_sf_right,N) "Start value of temperature vector (initialized by default)" annotation(Dialog(tab = "Initialization")); Modelica.SIunits.Temperature T_sf[N](start=Tstart_sf) "Node temperatures"; Modelica.SIunits.HeatFlux qdot_sf[N] "Average heat flux"; Modelica.SIunits.Temperature Tnode_sf[N+1]; // Working fluid variables: parameter Modelica.SIunits.Pressure pstart=10e5 "Working fluid pressure start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.SpecificEnthalpy hstart_left=1e4 "Inlet working fluid enthalpy start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.SpecificEnthalpy hstart_right=1e4 "Outlet enthalpy start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature Tstart_wf_left=283 "Working fluid temperature start value - first node" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature Tstart_wf_right=310 "Working fluid temperature start value - last node" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature Tstart_wf[N] = linspace(Tstart_wf_left,Tstart_wf_right,N) "Start value of temperature vector (initialized by default)" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.SpecificEnthalpy hstart[N]=linspace( hstart_left, hstart_right, N) "Start value of enthalpy vector (initialized by default)" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.MassFlowRate Mdotnom=0.1; parameter Modelica.SIunits.MassFlowRate Mdotnom_sf=1; Modelica.SIunits.SpecificEnthalpy h[N](start=linspace(hstart_left,hstart_right,N)) "Fluid specific enthalpy at the nodes"; Modelica.SIunits.Temperature T[N](start=Tstart_wf) "Fluid temperature"; Modelica.SIunits.Density rho[N] "Fluid cell density"; Modelica.SIunits.DerDensityByEnthalpy drdh[N] "Derivative of density by enthalpy"; Modelica.SIunits.DerDensityByPressure drdp[N] "Derivative of density by pressure"; Modelica.SIunits.SpecificEnthalpy hnode[N+1] "Enthalpy state variables"; Real dMdt[N] "Time derivative of mass in each cell between two nodes"; Modelica.SIunits.HeatFlux qdot_wf[N] "Average heat flux"; Modelica.SIunits.MassFlowRate Mdot[N+1](each start=Mdotnom, each min=0); // Heat transfer variables: Modelica.SIunits.CoefficientOfHeatTransfer U_wf[N]; Modelica.SIunits.CoefficientOfHeatTransfer U_sf; parameter Modelica.SIunits.CoefficientOfHeatTransfer Unom_l=300 "Constant heat transfer coefficient, liquid zone"; parameter Modelica.SIunits.CoefficientOfHeatTransfer Unom_tp=700 "Constant heat transfer coefficient, two-phase zone"; parameter Modelica.SIunits.CoefficientOfHeatTransfer Unom_v=400 "Constant heat transfer coefficient, vapor zone"; parameter Modelica.SIunits.CoefficientOfHeatTransfer Unom_sf=500 "Constant heat transfer coefficient,secondary fluid"; Real x[N] "Vapor quality"; Modelica.SIunits.SpecificEnthalpy h_l; Modelica.SIunits.SpecificEnthalpy h_v; parameter Boolean Mdotconst=true "Set to yes to assume constant mass flow rate at each node (easier convergence)"; parameter Boolean max_der=true "Set to yes to limit the density derivative during phase transitions"; parameter Boolean average_Tcell=true "Set to yes to impose the cell enthalpy as the average of the surrounding nodes enthalpies"; // parameter Real Xi(min=0,max=1)=0.5 // "=0.5 if h is the average between the surrounding nodes. =0 if h takes the value of the upstream node. =1 if h takes the value of the downstream node"; parameter Boolean steadystate_T_hf=true "if true, sets the derivative of T_hf to zero during Initialization" annotation(Dialog(tab = "Initialization")); parameter Boolean steadystate_h=true "if true, sets the derivative of h (working fluid enthalpy in each cell) to zero during Initialization" annotation(Dialog(tab = "Initialization")); parameter Boolean steadystate_T_wall=true "if true, sets the derivative of T_wall to zero during Initialization" annotation(Dialog(tab = "Initialization")); components.Flange_Cdot flange_Cdot annotation (Placement(transformation( extent={{90,40},{110,60}}), iconTransformation(extent={{90,40},{110, 60}}))); components.Flange_ex_Cdot flange_ex_Cdot annotation (Placement(transformation(extent={{-110,40},{-90,60}}))); components.FlangeAFluid flange_su annotation (Placement(transformation( extent={{-110,-52},{-90,-32}}), iconTransformation(extent={{-110,-52}, {-90,-32}}))); components.FlangeBFluid flange_ex annotation (Placement(transformation( extent={{90,-52},{110,-32}}), iconTransformation(extent={{90,-52},{ 110,-32}}))); TILMedia.Refrigerant refrigerant[N](h(start=hstart),p(each start=pstart),refrigerantName="Refprop.R245FA") annotation (Placement(transformation(extent={{-22,10},{-2,30}}))); equation // Inputs/outputs : p=flange_ex.p; M_dot_su = flange_su.w; flange_su.p=p; flange_su.hAB=hnode[1]; if Mdotconst then flange_ex.w=-M_dot_su+sum(dMdt); else flange_ex.w=-Mdot[N+1]; end if; flange_ex.hBA=hnode[N+1]; M_dot_sf = flange_Cdot.Mdot; cp_sf = flange_Cdot.cp; T_sf_su = flange_Cdot.T; rho_sf_su = flange_Cdot.rho; flange_ex_Cdot.Mdot = M_dot_sf; flange_ex_Cdot.cp = cp_sf; flange_ex_Cdot.T = Tnode_sf[1]; flange_ex_Cdot.rho = rho_sf_su; // Saturation: h_v=TILMedia.FunctionBasedMedia.Refrigerant.dewSpecificEnthalpy_p(p=p,refrigerantName="Refprop.R245FA"); h_l=TILMedia.FunctionBasedMedia.Refrigerant.bubbleSpecificEnthalpy_p(p=p,refrigerantName="Refprop.R245FA"); //T_sf = T_wall + ones(N)*time*0.1; Tnode_sf[N+1] = T_sf_su; //h = hstart; hnode[1] = flange_su.hBA; Mdot[1] = M_dot_su; U_sf = components.functions.U_sf(Unom=Unom_sf,Mdot=M_dot_sf/Mdotnom_sf); //U_sf = 400; for j in 1:N loop //loop for each cell refrigerant[j].p = p; refrigerant[j].h= h[j]; T[j]=refrigerant[j].T; rho[j]=refrigerant[j].d; if max_der then drdp[j]= min(0.01,refrigerant[j].drhodp); drdh[j]=max(-0.01,refrigerant[j].drhodh); else drdp[j]= refrigerant[j].drhodp; drdh[j]=refrigerant[j].drhodh; //refrigerant.drhodh end if; Vi*rho[j]*der(h[j]) + Mdot[j+1]*(hnode[j + 1]- h[j]) - Mdot[j]*(hnode[j] -h[j]) - Vi*der(p) = Ai*qdot_wf[j] "Energy balance"; // Equation 4.8, richter's thesis dMdt[j] = Vi*(drdh[j]*der(h[j]) + drdp[j]*der(p)) "Mass derivative for each volume"; // node quantities if Mdotconst then Mdot[j+1] = Mdot[j]; else dMdt[j]= -Mdot[j+1] + Mdot[j]; end if; if average_Tcell then h[j] = (hnode[j] + hnode[j+1])/2; T_sf[j] = (Tnode_sf[j]+Tnode_sf[j+1])/2; else hnode[j] = h[j]; //!! Needs to be modified in case of flow reversal Tnode_sf[j+1] = T_sf[j]; //!! Needs to be modified in case of flow reversal end if; // h[j] = hnode[j]* (1-Xi) + hnode[j+1]*Xi; // T_sf[j] = Tnode_sf[j]*Xi + Tnode_sf[j+1]*(1-Xi); qdot_wf[j] = U_wf[j] * (T_wall[j] - T[j]); M_wall/(N) * der(T_wall[j]) * c_wall = Ai * (qdot_sf[j] - qdot_wf[j]); qdot_sf[j] = U_sf *( T_sf[j] - T_wall[j]); Vi_sf * cp_sf * rho_sf_su * der(T_sf[j]) = M_dot_sf*cp_sf*(Tnode_sf[j+1] - Tnode_sf[j])-Ai*qdot_sf[j]; x[j] = (h[j] - h_l)/(h_v - h_l); // U_wf[j]=500; U_wf[j] = components.functions.U_hx( Unom_l=Unom_l, Unom_tp=Unom_tp, Unom_v=Unom_v, Mdot=M_dot_su/Mdotnom, x=x[j]); end for; initial equation if steadystate_T_hf then der(T_sf) = zeros(N); end if; if steadystate_h then der(h)=zeros(N); end if; if steadystate_T_wall then der(T_wall)=zeros(N); end if; annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics={ Rectangle( extent={{-100,100},{100,-100}}, lineColor={0,0,0}, fillColor={230,230,230}, fillPattern=FillPattern.Solid, lineThickness=0.5), Line( points={{-100,-44},{-80,-24},{-60,-44},{-40,-24},{-20,-44},{0,-24},{ 20,-44},{40,-24},{60,-44},{80,-24},{100,-44}}, color={0,127,0}, smooth=Smooth.None, thickness=0.5), Line( points={{-100,46},{-80,66},{-60,46},{-40,66},{-20,46},{0,66},{20,46}, {40,66},{60,46},{80,66},{100,46}}, color={255,0,0}, smooth=Smooth.None, thickness=0.5), Text(extent={{-100,-66},{100,-100}},textString= "%name")}), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics)); end simple_hx; model Expander_opendrive "Expander model (oil free, open-drive)" parameter Modelica.SIunits.Volume V_s=0.000148 "Swept volume"; parameter Real epsilon_s=0.7 "Isentropic Efficiency" annotation(Dialog(enable=(exptype=="User defined"))); parameter Real FF_exp=1 "Filling factor" annotation(Dialog(enable=(exptype=="User defined"))); Real epsilon(start=epsilon_start); Real FF(start=FF_start); parameter Real epsilon_start=0.7 "Isentropic Efficiency" annotation(Dialog(tab = "Initialization")); parameter Real FF_start=1 "Filling factor" annotation(Dialog(tab = "Initialization")); parameter functions.ExpanderType exptype = "User defined"; parameter Boolean constPinit=false "if true, sets the evaporating pressure to a constant value at the beginning of the simulation in order to avoid oscillations" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Pressure p_su_start=10e5 "Inlet pressure start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Pressure p_ex_start=3e5 "Inlet pressure start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature T_su_start=423.15 "Inlet temperature start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.SpecificEnthalpy h_su_start=TILMedia.FunctionBasedMedia.Refrigerant.specificEnthalpy_pT(p=p_su_start,T=T_su_start,refrigerantName="Refprop.R245FA") "Inlet specific enthalpy start value" annotation(Dialog(tab = "Initialization")); parameter Boolean constinit=false "if true, sets the efficiencies to a constant value at the beginning of the simulation" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Time t_init=10 "if constinit is true, time during which the efficiencies are set to their start values" annotation(Dialog(tab = "Initialization", enable=constinit)); Real epsilon_bis; Real FF_bis; // Important data to show in results Modelica.SIunits.Power W_dot; Real rpm; Modelica.SIunits.VolumeFlowRate V_dot_su; Modelica.SIunits.MassFlowRate M_dot; Modelica.SIunits.Density rho_su(start=40); Modelica.SIunits.SpecificEnthalpy h_su(start=h_su_start); Modelica.SIunits.SpecificEnthalpy h_ex(start=TILMedia.FunctionBasedMedia.Refrigerant.specificEnthalpy_pT(p=p_ex_start,T=T_su_start,refrigerantName="Refprop.R245FA")); Modelica.SIunits.Pressure p_su(min=1E5,max=28E5,start=p_su_start); Modelica.SIunits.Pressure p_ex(min=1E5,max=10E5,start=p_ex_start); Modelica.SIunits.SpecificEnthalpy h_ex_s; Modelica.SIunits.Frequency N_rot(start=50) "Rotating speed in Hz"; public components.FlangeAFluid flange annotation (Placement(transformation(extent={{-84,44},{ -44,82}}), iconTransformation(extent={{-60,36},{-36,58}}))); components.FlangeBFluid flangeB annotation (Placement(transformation(extent={{42,-80}, {80,-44}}),iconTransformation(extent={{52,-70},{80,-44}}))); Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_elc "Flange of shaft" annotation (Placement(transformation(extent={{64,-8},{100,28}}, rotation=0), iconTransformation(extent={{68,-2},{92,22}}))); TILMedia.Refrigerant vapor_su(refrigerantName="Refprop.R245FA",p(start=p_su_start),T(start=T_su_start)) annotation (Placement(transformation(extent={{-34,-2},{-14,18}}))); TILMedia.Refrigerant vapor_ex(refrigerantName="Refprop.R245FA", inputChoice=TILMedia.Internals.InputChoicesRefrigerant.ps,p(start=p_ex_start),T(start=T_su_start)) annotation (Placement(transformation(extent={{-32,-40},{-12,-20}}))); equation flange.hAB = 1E5; //dummy value for the reversed flow flange.p = vapor_su.p; flange.p=p_su; M_dot = flange.w; h_su = flange.hBA; vapor_su.h=h_su; vapor_su.d = rho_su; N_rot = rpm/60; V_dot_su = FF*V_s * N_rot; V_dot_su = M_dot/rho_su; //Exhaust conditions flangeB.p = p_ex; flangeB.w =- M_dot; flangeB.hBA = h_ex; h_ex = h_su - (h_su - h_ex_s) * epsilon; vapor_ex.p=p_ex; vapor_ex.s=vapor_su.s; vapor_ex.h=h_ex_s; W_dot = M_dot * (h_su - h_ex) "Power generated"; // Mechanical port: der(flange_elc.phi)=2*N_rot*Modelica.Constants.pi; flange_elc.tau=W_dot/(2*N_rot*Modelica.Constants.pi) "Mechanical connection with the eletrical generator"; if ( exptype == "Open-drive expander") then FF_bis= functions.correlation_open_expander_FF( rho= rho_su, log_Nrot=log(rpm)); epsilon_bis = functions.correlation_open_expander_epsilon_s( rho= rho_su, log_rp= log(p_su/p_ex), N_rot= rpm); elseif ( exptype == "Hermetic expander") then FF_bis= functions.correlation_hermetic_scroll_FF( rho= rho_su, rp= p_su/p_ex); epsilon_bis = functions.correlation_hermetic_scroll_epsilon_s( rho= rho_su, rp= p_su/p_ex); else FF_bis = FF_exp; epsilon_bis = epsilon_s; end if; if constinit then FF= FF_start + ( FF_bis - FF_start) * components.functions.weightingfactor(t_init=t_init,length=3,t=time); epsilon = epsilon_start + ( epsilon_bis - epsilon_start)* components.functions.weightingfactor(t_init=t_init,length=3,t=time); else FF = FF_bis; epsilon=epsilon_bis; end if; initial equation if constPinit then p_su=p_su_start; end if; annotation ( Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{ 100,100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics={Text( extent={{-84,-44},{58,-72}}, lineColor={0,0,0}, fillPattern=FillPattern.Solid, fillColor={0,0,0}, textString="%name"),Polygon( points={{-60,40},{-60,-20},{80,-60},{80,80},{-60,40}}, lineColor={0,0,255}, smooth=Smooth.None, fillColor={0,0,255}, fillPattern=FillPattern.Solid)})); end Expander_opendrive; model SensTp "Temperature sensor for working fluid" extends components.Icons.Water.SensThrough; components.FlangeAFluid inlet annotation (Placement(transformation(extent= {{-80,-60},{-40,-20}}, rotation=0))); components.FlangeBFluid outlet annotation (Placement(transformation( extent={{40,-60},{80,-20}}, rotation=0))); Modelica.Blocks.Interfaces.RealOutput T annotation (Placement(transformation(extent={{60,40},{100,80}}, rotation= 0))); Modelica.Blocks.Interfaces.RealOutput p annotation (Placement(transformation(extent={{-60,40},{-100,80}}, rotation= 0))); TILMedia.Refrigerant fluid(refrigerantName="Refprop.R245FA") annotation (Placement(transformation(extent={{-12,2},{8,22}}))); equation inlet.w + outlet.w = 0 "Mass balance"; inlet.p = outlet.p "No pressure drop"; // Set fluid properties fluid.p=inlet.p; fluid.h = inlet.hBA; T = fluid.T; p = fluid.p; // Boundary conditions inlet.hAB = outlet.hAB; inlet.hBA = outlet.hBA; annotation ( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={Text( extent={{-40,84},{38,34}}, lineColor={0,0,0}, textString="p,T"), Line(points={{-60,60},{-40,60}})}), Documentation(info="This component can be inserted in a hydraulic circuit to measure the temperature of the fluid flowing through it.Flow reversal is supported.", revisions="16 Dec 2004 by Francesco Casella: Standard medium definition added.1 Jul 2004 by Francesco Casella: Adapted to Modelica.Media.1 Oct 2003 by Francesco Casella: First release.")); end SensTp; model Valve "Valve with incompressible flow hypothesis for the calculation of the pressure drop" extends components.Icons.Water.Valve; parameter Modelica.SIunits.Area Afull=10e-5; parameter Real Xopen(min=0,max=1)=1 "Valve opening if no external command is connected (0=fully closed; 1=fully open)"; parameter Modelica.SIunits.Pressure DELTAp_0=500 "Pressure drop below which a 3rd order interpolation is used for the computation of the flow rate in order to avoid infinite derivative at 0"; Modelica.SIunits.Area A(start=Afull) "Valve throat area"; parameter Modelica.SIunits.Pressure p_su_start=1e5 "Inlet pressure start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Temperature T_su_start=423.15 "Inlet temperature start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Pressure DELTAp_start=10000 "Start value for the pressure drop" annotation(Dialog(tab = "Initialization")); Modelica.SIunits.Pressure DELTAp(start=DELTAp_start); Modelica.SIunits.Pressure DELTAp_bis(start=DELTAp_start); parameter Modelica.SIunits.MassFlowRate Mdot_start=0.1 "Mass flow rate intial value" annotation(Dialog(tab = "Initialization")); Modelica.SIunits.MassFlowRate Mdot(start=Mdot_start); parameter Modelica.SIunits.Time t_init=10 "if constinit is true, time during which the pressure drop is set to the constant value DELTAp_start" annotation(Dialog(tab = "Initialization", enable=constinit)); parameter Boolean constinit=false "if true, sets the pressure drop to a constant value at the beginning of the simulation in order to avoid oscillations" annotation(Dialog(tab = "Initialization")); Modelica.SIunits.Time t_change=5; Modelica.Blocks.Interfaces.RealInput cmd annotation (Placement(transformation( origin={0,80}, extent={{-20,-20},{20,20}}, rotation=270))); components.FlangeAFluid inlet annotation (Placement(transformation(extent={{-120,-20},{-80,20}}))); components.FlangeBFluid outlet annotation (Placement(transformation(extent={{80,-20},{120,20}}))); TILMedia.Refrigerant supply(refrigerantName="Refprop.R245FA", computeTransportProperties=false, interpolateTransportProperties=false, computeSurfaceTension=false,p(start=p_su_start),T(start=T_su_start)) annotation (Placement(transformation(extent={{-14,0},{6,20}}))); equation inlet.w + outlet.w = 0 "Mass balance"; supply.p=inlet.p; supply.h=inlet.hBA; if constinit then DELTAp = DELTAp_start + (DELTAp_bis - DELTAp_start)*components.functions.weightingfactor(t_init=t_init,length=t_change,t=time); else DELTAp = DELTAp_bis; end if; DELTAp = inlet.p - outlet.p; A = Afull*cmd; if cardinality(cmd)==0 then cmd = Xopen; end if; //Mdot = A*sqrt(max(0,2 * supply.d * DELTAp)) "Valve characteristics"; //DELTAp_bis = (Mdot/A)^2/(2*supply.d); //DELTAp_bis * A^2 = Mdot^2/(2*supply.d); // if A DELTAp_0) then sqrt(DELTAp_bis) else if (DELTAp_bis < -DELTAp_0) then -sqrt(-DELTAp_bis) else sqrt(DELTAp_0)*(DELTAp_bis/DELTAp_0)/4*(5 - (DELTAp_bis/DELTAp_0)^2))); // end if; // Boundary conditions Mdot = inlet.w; inlet.hAB = outlet.hAB; inlet.hBA = outlet.hBA; initial equation annotation ( Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, 100}}), graphics={Text(extent={{-100,-40},{100,-74}}, textString= "%name")}), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics), Documentation(info="This very simple model assumes a non-compressible flow for computing the pressure drop", uses(Modelica(version="3.2")))); end Valve; model pumpWF "Volumetric pump model" // import FlangeAFluid; // import FlangeBFluid; extends components.Icons.Water.Pump; parameter Real X_pp_0 "Pump capacity ratio if no connected"; parameter Modelica.SIunits.VolumeFlowRate V_dot_max=2e-4 "Maximum pump flow rate"; parameter Modelica.SIunits.SpecificEnthalpy hstart=2.22e5 "Fluid specific enthalpy"; parameter Real eta_em=0.9 "Electro-mechanical efficiency of the pump"; // Data not shown in the results Modelica.SIunits.MassFlowRate M_dot(start=0.1) "Mass flow rate"; Modelica.SIunits.SpecificEnthalpy h_su(start=hstart) "Fluid specific enthalpy"; Modelica.SIunits.SpecificEnthalpy h_ex(start=hstart) "Fluid specific enthalpy"; Modelica.SIunits.Pressure p_su "Supply pressure"; Modelica.SIunits.Pressure p_ex "Exhaust pressure"; Modelica.SIunits.Density rho_su "Liquid density"; Modelica.SIunits.Power W_dot "Power Consumption (single pump)"; Real eta "Pump overall effectiveness"; Real eta_in "Pump internal effectiveness"; Modelica.SIunits.VolumeFlowRate V_dot; public components.FlangeAFluid infl annotation (Placement(transformation(extent={{-98,4},{-58, 42}}), iconTransformation(extent={{-98,4},{-58,42}}))); components.FlangeBFluid outfl annotation (Placement(transformation(extent={{36,54},{76, 94}}), iconTransformation(extent={{36,54},{76,94}}))); Modelica.Blocks.Interfaces.RealInput X_pp annotation (Placement( transformation(extent={{-94,52},{-54,92}}), iconTransformation( extent={{-8,-8},{8,8}}, rotation=-90, origin={-42,76}))); TILMedia.Refrigerant inletFluid(refrigerantName="Refprop.R245FA") annotation (Placement(transformation(extent={{-40,4},{-20,24}}))); equation if cardinality(X_pp)==0 then X_pp = X_pp_0; end if; //eta_em = 0.9; eta_in=0.931 - 0.108*log10(X_pp) - 0.204 * log10(X_pp)^2 - 0.05954*log10(X_pp)^3; eta = eta_in * eta_em; p_su = infl.p; M_dot = infl.w; h_su = infl.hBA; M_dot = -outfl.w "Flow rate is negative when leaving a component!"; p_ex = outfl.p; h_ex = outfl.hBA; infl.hAB = outfl.hBA; inletFluid.p = p_su; inletFluid.h = h_su; rho_su =inletFluid.d; //Ancillary equation of the liquid saturation density h_ex = h_su + (p_ex - p_su)/(eta * rho_su); W_dot = M_dot * (h_ex - h_su); V_dot = V_dot_max * min(X_pp,1); M_dot = V_dot * rho_su; annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics)); end pumpWF; model tank Modelica.SIunits.Volume Vl(start=Vtot*level_start); Modelica.SIunits.Volume Vv(start=Vtot*(1-level_start)); parameter Modelica.SIunits.Volume Vtot=0.002 "Volume of the tank"; parameter Modelica.SIunits.Pressure pstart=5e5 "Initial pressure" annotation(Dialog(tab = "Initialisation")); parameter Modelica.SIunits.SpecificEnthalpy hstart=3.82E4 "Key parameter for the determination of the initial pressure" annotation(Dialog(tab = "Initialisation")); parameter Real level_start=0.6 "Initial level" annotation(Dialog(tab = "Initialisation")); parameter Boolean impose_level=true "Set to yes to impose the initial tank level" annotation(Dialog(tab = "Initialisation")); parameter Boolean impose_pressure=false "Set to yes to impose the initial tank pressure" annotation(Dialog(tab = "Initialisation")); Modelica.SIunits.MassFlowRate M_dot_ex; Modelica.SIunits.MassFlowRate M_dot_su; Modelica.SIunits.SpecificEnthalpy h_ex; Modelica.SIunits.SpecificEnthalpy h_su; Modelica.SIunits.Pressure p(start=pstart); Modelica.SIunits.Mass M(start=Vtot*level_start*1000); Modelica.SIunits.Density rhol; Modelica.SIunits.Density rhov; Modelica.SIunits.SpecificEnthalpy hl; Modelica.SIunits.SpecificEnthalpy hv; Modelica.SIunits.SpecificEnthalpy h(start=hstart); Modelica.SIunits.DerDensityByEnthalpy drdh "Derivative of average density by enthalpy"; Modelica.SIunits.DerDensityByPressure drdp "Derivative of average density by pressure"; public components.FlangeBFluid flange_ex annotation (Placement(transformation(extent={{-24,-108},{18,-68}}), iconTransformation(extent={{-24,-108},{18,-68}}))); components.FlangeAFluid flange_su annotation (Placement(transformation(extent={{-24,60},{16,100}}), iconTransformation(extent={{-24,60},{16,100}}))); Modelica.Blocks.Interfaces.RealOutput level annotation (Placement( transformation(extent={{90,36},{128,74}}), iconTransformation(extent={{72,26}, {92,46}}))); TILMedia.Refrigerant fluid( refrigerantName="Refprop.R245FA", computeTransportProperties=false, interpolateTransportProperties=false, computeSurfaceTension=false,p(start=pstart), h(start=hstart)) annotation (Placement(transformation(extent={{-4,2},{16,22}}))); equation flange_su.p = p; flange_su.hBA = h_su; M_dot_su = flange_su.w; flange_ex.p = p; flange_ex.w = -M_dot_ex; flange_su.hAB = hv; flange_ex.hBA = h_ex; Vtot=Vl+Vv; M=Vl*rhol+Vv*rhov; level=Vl/Vtot; h_ex=hl; hv=fluid.sat.hv; hl=fluid.sat.hl; rhov=fluid.sat.dv; rhol=fluid.sat.dl; drdp= fluid.drhodp; drdh=fluid.drhodh; fluid.p=p; fluid.d = M/Vtot; fluid.h=h; Vtot*fluid.d*der(h) = semiLinear(M_dot_su, h_su-h, hv-h)-M_dot_ex*(h_ex-h) + Vtot*der(p) "Energy balance"; M_dot_su - M_dot_ex = Vtot*(drdh*der(h) + drdp*der(p)) "Mass derivative for each volume"; initial equation if impose_level then level=level_start; end if; if impose_pressure then p = pstart; end if; annotation ( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics={ Rectangle( extent={{-76,-16},{72,-88}}, lineColor={0,0,255}, fillPattern=FillPattern.Solid, fillColor={85,170,255}), Rectangle( extent={{-76,76},{72,-88}}, lineColor={0,0,0}, lineThickness=0.5), Line( points={{-42,-24},{40,-24},{32,-24}}, color={0,0,255}, thickness=0.5, smooth=Smooth.None), Line( points={{-24,-32},{24,-32},{16,-32}}, color={0,0,255}, thickness=0.5, smooth=Smooth.None), Line( points={{-14,-40},{12,-40},{4,-40}}, color={0,0,255}, thickness=0.5, smooth=Smooth.None), Line( points={{-4,-48},{4,-48},{-4,-48}}, color={0,0,255}, thickness=0.5, smooth=Smooth.None),Text(extent={{-100,52},{100,18}}, textString= "%name")})); end tank; model SensMdot "Mass Flowrate sensor for working fluid" extends components.Icons.Water.SensThrough; FlangeAFluid inlet annotation (Placement(transformation(extent= {{-80,-60},{-40,-20}}, rotation=0))); FlangeBFluid outlet annotation (Placement(transformation( extent={{40,-60},{80,-20}}, rotation=0))); Modelica.Blocks.Interfaces.RealOutput Mdot annotation (Placement(transformation(extent={{60,40},{100,80}}, rotation= 0))); equation inlet.w + outlet.w = 0 "Mass balance"; // Boundary conditions inlet.p = outlet.p; inlet.hAB = outlet.hAB; inlet.hBA = outlet.hBA; Mdot = inlet.w; annotation ( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics={Text( extent={{-42,86},{40,26}}, lineColor={0,0,0}, textString="M", pattern=LinePattern.Dot, lineThickness=0.5), Line( points={{-4,86},{0,86},{0,88},{-4,88},{-4,86},{-2,88},{0,88}}, color={0,0,0}, thickness=1, smooth=Smooth.None)}), Documentation(info="This component can be inserted in a hydraulic circuit to measure the flowrate of the fluid flowing through it.Flow reversal is supported.", revisions="16 Dec 2004 by Francesco Casella: Standard medium definition added.1 Oct 2003 by Francesco Casella: First release.")); end SensMdot; model SensP "Pressure sensor for working fluid" extends components.Icons.Water.SensThrough; FlangeAFluid inlet annotation (Placement(transformation(extent= {{-80,-60},{-40,-20}}, rotation=0))); FlangeBFluid outlet annotation (Placement(transformation( extent={{40,-60},{80,-20}}, rotation=0))); Modelica.Blocks.Interfaces.RealOutput p annotation (Placement(transformation(extent={{60,40},{100,80}}, rotation= 0))); equation inlet.w + outlet.w = 0 "Mass balance"; // Boundary conditions inlet.p = outlet.p; inlet.hAB = outlet.hAB; inlet.hBA = outlet.hBA; p = inlet.p; annotation ( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, 100}}), graphics={Text( extent={{-38,88},{44,28}}, lineColor={0,0,0}, textString="P")}), Documentation(info="")); end SensP; model FlowSplit "Splits a flow in two" extends components.Icons.Water.FlowSplit; constant Modelica.SIunits.MassFlowRate wzero=1e-9 "Small flowrate to avoid singularity in computing the outlet enthalpy"; FlangeAFluid in1 annotation (Placement(transformation(extent={{-80,-20},{-40,20}}))); FlangeBFluid out2 annotation (Placement(transformation(extent={{40,-58},{80,-20}}))); FlangeBFluid out1 annotation (Placement(transformation(extent={{40,20},{80,60}}))); equation in1.w + out1.w + out2.w = 0 "Mass balance"; out1.p = in1.p; out2.p = in1.p; // Energy balance out1.hBA = in1.hBA; out2.hBA = in1.hBA; in1.hAB = 0; annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics), Documentation(info=""), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics)); end FlowSplit; model FlowJoin "Joins two flows" extends components.Icons.Water.FlowJoin; constant Modelica.SIunits.MassFlowRate wzero=1e-9 "Small flowrate to avoid singularity in computing the outlet enthalpy"; parameter Modelica.SIunits.Pressure pstart=1e5 "Pressure start value" annotation(Dialog(tab = "Initialisation")); FlangeAFluid in1 annotation (Placement(transformation(extent={{-80,20},{-40,60}}))); FlangeAFluid in2 annotation (Placement(transformation(extent={{-80,-60},{-40,-20}}))); FlangeBFluid out annotation (Placement(transformation(extent={{40,-20},{80,20}}))); equation in1.w + in2.w + out.w = 0 "Mass balance"; in1.p = out.p; in2.p = out.p; // Energy balance out.hBA = (in1.hBA*(in1.w + wzero) + in2.hBA*(in2.w + wzero))/(in1.w + 2*wzero + in2.w); in1.hAB =0; in2.hAB = 0; annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics), Documentation(info="This component allows to join two separate flows into one. The model is based on mass and energy balance equations, without any mass or energy buildup, and without any pressure drop between the inlet and the outlets.Modelling options If rev_in1, rev_in2 or rev_out is true, the respective flows reversal is allowed. If at least ona among these parameters is false, it is possible to set checkFlowDirection.If checkFlowDirection is true, when the flow reversal happen where it is not allowed, the error message is showed.", revisions="23 May 2008 by Luca Savoldelli: Allow flows reversal option added.16 Dec 2004 by Francesco Casella: Standard medium definition added.1 Oct 2003 by Francesco Casella: First release."), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics)); end FlowJoin; model ValveLin "Valve assuming a linear dependency between Mdot and DELTAp" extends components.Icons.Water.Valve; parameter Real Xopen(min=0,max=1)=0.4 "Valve opening if no external command is connected (0=fully closed; 1=fully open)"; parameter Modelica.SIunits.Pressure p_su_start=1e5 "Inlet pressure start value" annotation(Dialog(tab = "Initialization")); parameter Modelica.SIunits.Pressure DELTAp_start=10000 "Start value for the pressure drop" annotation(Dialog(tab = "Initialization")); Modelica.SIunits.Pressure DELTAp(start=DELTAp_start); parameter Modelica.SIunits.MassFlowRate Mdot_start=0.1 "Mass flow rate intial value" annotation(Dialog(tab = "Initialization")); Modelica.SIunits.MassFlowRate Mdot(start=Mdot_start); parameter Modelica.SIunits.MassFlowRate Mdot_max=0.1 "maximum flow rate with valve fully open at DELTAp_max"; parameter Modelica.SIunits.Pressure DELTAp_max=20E5; Modelica.Blocks.Interfaces.RealInput cmd annotation (Placement(transformation( origin={0,80}, extent={{-20,-20},{20,20}}, rotation=270))); FlangeAFluid inlet annotation (Placement(transformation(extent={{-120,-20},{-80,20}}))); FlangeBFluid outlet annotation (Placement(transformation(extent={{80,-20},{120,20}}))); equation inlet.w + outlet.w = 0 "Mass balance"; if cardinality(cmd)==0 then cmd = Xopen; end if; DELTAp = inlet.p - outlet.p; Mdot = Mdot_max * cmd * DELTAp/DELTAp_max; // Mdot =0; // Boundary conditions Mdot = inlet.w; inlet.hAB = outlet.hAB; inlet.hBA = outlet.hBA; initial equation annotation ( Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, 100}}), graphics={Text(extent={{-100,-40},{100,-74}}, textString= "%name")}), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics), Documentation(info="This very simple model assumes a non-compressible flow for computing the pressure drop", uses(Modelica(version="3.2")))); end ValveLin; package functions type ExpanderType extends String; annotation(choices( choice="User defined", choice="Open-drive expander", choice="Hermetic expander")); end ExpanderType; function correlation_open_expander_FF input Real log_Nrot; input Real rho; output Real FF; algorithm FF:=8.36779658E+00 - 1.41098700E+00*log_Nrot + 6.19613713E-02*log_Nrot^2 - 5.13791668E-04*(rho) - 5.77341306E-07*(rho)^2; FF := min( 1.592, FF); FF := max( 0.576, FF); annotation (smoothOrder=1); end correlation_open_expander_FF; function correlation_open_expander_epsilon_s input Real N_rot; input Real rho; input Real log_rp; output Real epsilon_s; algorithm epsilon_s :=-2.16329421E+00+6.78008871E-04*N_rot-5.54407717E-07*N_rot^2+8.03956432E-11*N_rot^3-2.24146877E-15*N_rot^4+2.91161840E-03*rho+1.12613000E-06*rho^2+8.49777454E-08*rho^3-4.50090810E-10*rho^4+4.67781024E+00*log_rp-3.55789871E+00*log_rp^2+1.16705018E+00*log_rp^3-1.38101959E-01*log_rp^4+2.37728921E-07*N_rot*rho-3.25174455E-09*N_rot*rho^2+7.85764846E-12*N_rot*rho^3-6.05137025E-04*N_rot*log_rp+4.49229123E-04*N_rot*log_rp^2-9.99328287E-05*N_rot*log_rp^3+3.75965704E-11*N_rot^2*rho+4.39606024E-13*N_rot^2*rho^2-8.61198734E-16*N_rot^2*rho^3+6.95577624E-07*N_rot^2*log_rp-4.20590506E-07*N_rot^2*log_rp^2+8.24820738E-08*N_rot^2*log_rp^3+3.34903471E-15*N_rot^3*rho-7.54325941E-17*N_rot^3*rho^2+8.13185576E-20*N_rot^3*rho^3-9.33650022E-11*N_rot^3*log_rp+5.77554418E-11*N_rot^3*log_rp^2-1.14741098E-11*N_rot^3*log_rp^3+7.45493269E-03*rho*log_rp-5.32817717E-03*rho*log_rp^2+9.48009166E-04*rho*log_rp^3-9.67639285E-05*rho^2*log_rp+5.34409340E-05*rho^2*log_rp^2-8.76813140E-06*rho^2*log_rp^3+2.69821471E-07*rho^3*log_rp-1.37299471E-07*rho^3*log_rp^2+2.18231218E-08*rho^3*log_rp^3; epsilon_s := min( 0.79, epsilon_s); epsilon_s := max( 0, epsilon_s); annotation (smoothOrder=1); end correlation_open_expander_epsilon_s; function correlation_eta_is_pump input Real Xpp; output Real eta_is; algorithm eta_is := 0.931 - 0.11*ln(Xpp) - 0.2*ln(Xpp)^2 - 0.06*ln(Xpp)^3; end correlation_eta_is_pump; function correlation_hermetic_scroll_FF input Real rho; input Real rp; output Real FF; algorithm FF:=7.57680390E-01+1.03377082E-01*log(rho)-9.44421504E-03*log(rho)^2-9.77306474E-04*log(rho)^3+1.21317764E-01*log(rp)-3.37184749E-02*log(rp)^2+2.66140555E-03*log(rp)^3-4.37896534E-02*log(rho)*log(rp)+9.10515577E-03*log(rho)*log(rp)^2+6.54874695E-03*log(rho)^2*log(rp)-1.34144803E-03*log(rho)^2*log(rp)^2; FF := min( 1.2, FF); FF := max( 1, FF); annotation (smoothOrder=1); end correlation_hermetic_scroll_FF; function correlation_hermetic_scroll_epsilon_s input Real rho; input Real rp; output Real epsilon_s; algorithm epsilon_s:= -6.64245265E+01+4.76955293E+01*log(rho)-1.35858904E+01*log(rho)^2+1.77003970E+00*log(rho)^3-1.02953583E-01*log(rho)^4+2.39566357E-03*log(rho)^5+1.13504981E+02*log(rp)-8.33543737E+01*log(rp)^2+2.88988540E+01*log(rp)^3-4.38850733E+00*log(rp)^4+1.91516689E-01*log(rp)^5-7.18843549E+01*log(rho)*log(rp)+4.65090842E+01*log(rho)*log(rp)^2-1.32188184E+01*log(rho)*log(rp)^3+1.35479342E+00*log(rho)*log(rp)^4+1.74244753E+01*log(rho)^2*log(rp)-9.46485860E+00*log(rho)^2*log(rp)^2+1.96681732E+00*log(rho)^2*log(rp)^3-9.18290140E-02*log(rho)^2*log(rp)^4-1.59497299E+00*log(rho)^3*log(rp)+4.72814319E-01*log(rho)^3*log(rp)^2+8.68612468E-02*log(rho)^3*log(rp)^3-4.23519754E-02*log(rho)^3*log(rp)^4+3.27301261E-02*log(rho)^4*log(rp)+2.62330241E-02*log(rho)^4*log(rp)^2-2.60988688E-02*log(rho)^4*log(rp)^3+5.48900609E-03*log(rho)^4*log(rp)^4; epsilon_s:=min(0.65, epsilon_s); epsilon_s:=max(0, epsilon_s); annotation (smoothOrder=1); end correlation_hermetic_scroll_epsilon_s; function U_hx "Returns the heat transfer coefficient depending on the fluid state" input Real Unom_tp; input Real Unom_l; input Real Unom_v; constant Real width=0.1; input Real Mdot; input Real x; output Real y; annotation (smoothOrder=2); algorithm y := smooth(1, noEvent( if x < -width/2 then Unom_l elseif x < width/2 then Unom_l + (Unom_tp - Unom_l) * (1+sin(x*Modelica.Constants.pi/width))/2 elseif x < 1 - width/2 then Unom_tp elseif x < 1 + width/2 then Unom_tp + (Unom_v - Unom_tp) * (1+sin((x-1)*Modelica.Constants.pi/width))/2 else Unom_v)); end U_hx; function U_sf "Returns the secondary fluid heat transfer coefficient" input Real Unom; input Real Mdot; output Real y; annotation (smoothOrder=100); algorithm y :=Unom*Mdot^0.8; end U_sf; function weightingfactor "transition weighting factor for initialization" input Real t_init; input Real length; input Real t; output Real y; annotation (smoothOrder=1); algorithm if t < t_init then y := 0; elseif t < t_init +length then y := (0.5-0.5*cos((t-t_init)*Modelica.Constants.pi/length)); else y:= 1; end if; end weightingfactor; annotation (); end functions; model DELTAT // Calculate the superheating with the temperature and the pressure as inputs Modelica.Blocks.Interfaces.RealInput P "measured pressure" annotation (Placement(transformation(extent={{-110,54}, {-86,78}}, rotation=0), iconTransformation(extent={{-110,54},{-86,78}}))); Modelica.Blocks.Interfaces.RealInput T "measured" annotation (Placement(transformation(extent={{-112, -54},{-88,-30}}, rotation=0))); Modelica.Blocks.Interfaces.RealOutput DELTAT annotation (Placement( transformation(extent={{92,-38},{130,0}}), iconTransformation(extent={{94,20}, {114,40}}))); Modelica.Blocks.Interfaces.RealOutput Tsat annotation (Placement( transformation(extent={{92,20},{130,58}}), iconTransformation(extent={{94,-20}, {114,0}}))); equation Tsat = 273.15 -328.62 -0.361218*P^(1/2) + 35.9736 * P^(1/3) -260.867 * P^(1/4) + 342.702*P^(1/5); DELTAT = T - Tsat; annotation ( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={Rectangle( extent={{-98,90},{102,-78}}, lineColor={0,0,0}, lineThickness=0.5), Text( extent={{-76,50},{92,-32}}, lineColor={0,0,0}, textString="DELTAT ")})); end DELTAT; model Tev_SP // Calculate the superheating with the temperature and the pressure as inputs Modelica.Blocks.Interfaces.RealInput p_cd "measured pressure" annotation (Placement(transformation(extent={{-112,54}, {-88,78}}, rotation=0), iconTransformation(extent={{-112,54},{-88,78}}))); Modelica.Blocks.Interfaces.RealInput Mdot "measured" annotation (Placement(transformation(extent={{-112, -54},{-88,-30}}, rotation=0))); Modelica.Blocks.Interfaces.RealOutput Tev annotation (Placement( transformation(extent={{92,-2},{130,36}}), iconTransformation(extent={{96,2},{ 116,22}}))); Modelica.Blocks.Interfaces.RealInput T_hf_su "measured heat source temperature" annotation (Placement(transformation(extent={{-112,6}, {-88,30}}, rotation=0), iconTransformation(extent={{-112,0},{-88,24}}))); equation //Tev = 273.15 + 100; Tev=273.15+7.75856713E+01+4.93382415E-05*p_cd+2.38081717E+01*log(Mdot)+7.65402193E+00*log(T_hf_su-273.15); annotation ( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={Rectangle( extent={{-98,90},{102,-78}}, lineColor={0,0,0}, lineThickness=0.5), Text( extent={{-76,50},{92,-32}}, lineColor={0,0,0}, textString="Tev_SP ")})); end Tev_SP; model Init "Smooth transition between two values" parameter Real t_init=10; parameter Real length = 3; Modelica.Blocks.Interfaces.RealInput u1 "Connector of Real input signal" annotation (Placement(transformation(extent={{-140,-58},{-100,-18}}, rotation=0))); Modelica.Blocks.Interfaces.RealInput u2 "Connector of Real input signal" annotation (Placement(transformation(extent={{-140,-58},{-100,-18}}, rotation=0), iconTransformation(extent={{-140,20},{-100,60}}))); Modelica.Blocks.Interfaces.RealOutput y "Connector of Real input signal" annotation (Placement(transformation(extent={{100,-20},{140,20}}, rotation=0), iconTransformation(extent={{88,-18},{128,22}}))); equation y =u1 + (u2-u1)*functions.weightingfactor(t_init=t_init,length=length,t=time); annotation ( Icon(coordinateSystem( preserveAspectRatio=true, extent={{-100,-100},{100,100}}, grid={2,2}), graphics={ Polygon( points={{-80,90},{-88,68},{-72,68},{-80,90}}, lineColor={192,192,192}, fillColor={192,192,192}, fillPattern=FillPattern.Solid), Line(points={{-80,-80},{-80,68}}, color={192,192,192}), Line(points={{-90,-70},{68,-70}}, color={192,192,192}), Polygon( points={{90,-70},{68,-62},{68,-78},{90,-70}}, lineColor={192,192,192}, fillColor={192,192,192}, fillPattern=FillPattern.Solid), Rectangle(extent={{-100,100},{100,-100}}, lineColor={0,0,0}), Line( points={{-80,-40},{-28,-40}}, color={0,0,0}, smooth=Smooth.None), Line( points={{20,0},{24,12},{32,24},{42,32},{56,38},{70,40},{68,40}}, color={0,0,0}, smooth=Smooth.Bezier), Line( points={{20,0},{16,-12},{8,-24},{-2,-32},{-16,-38},{-30,-40},{-28,-40}}, color={0,0,0}, smooth=Smooth.Bezier), Line( points={{70,40},{80,40},{84,40},{68,40}}, color={0,0,0}, smooth=Smooth.Bezier), Line( points={{-80,40},{68,40},{76,40}}, color={0,0,0}, smooth=Smooth.None, pattern=LinePattern.Dot), Text( extent={{-28,-90},{46,-70}}, lineColor={0,0,0}, pattern=LinePattern.Dot, textString="Time"), Text( extent={{-70,60},{90,92}}, lineColor={0,0,0}, pattern=LinePattern.Dot, textString="Initialisation")}), Diagram(coordinateSystem( preserveAspectRatio=true, extent={{-100,-100},{100,100}}, grid={2,2}), graphics), Documentation(info="")); end Init; model SensTsf "Temperature sensor for secondary fluid" extends components.Icons.Water.SensThrough; Modelica.Blocks.Interfaces.RealOutput T annotation (Placement(transformation(extent={{60,40},{100,80}}, rotation= 0))); components.Flange_Cdot inlet annotation (Placement(transformation(extent={{-80,-60},{-40,-20}}))); components.Flange_ex_Cdot outlet annotation (Placement(transformation(extent={{40,-60},{80,-20}}))); equation inlet.Mdot = outlet.Mdot; inlet.cp = outlet.cp; inlet.T = outlet.T; inlet.rho = outlet.rho; T = inlet.T; annotation ( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, 100}}), graphics={Text( extent={{-40,88},{42,28}}, lineColor={0,0,0}, textString="T")}), Documentation(info="")); end SensTsf; model Generator "Active power generator" import Modelica.SIunits.Conversions.NonSIunits.*; parameter Real eta=1 "Conversion efficiency"; parameter Modelica.SIunits.MomentOfInertia J=0 "Moment of inertia"; parameter Integer Np=2 "Number of electrical poles"; parameter Modelica.SIunits.Frequency fstart=50 "Start value of the electrical frequency" annotation (Dialog(tab="Initialization")); Modelica.SIunits.Power Pe "Electrical Power"; protected Modelica.SIunits.Power Pm "Mechanical power"; Modelica.SIunits.Power Ploss "Inertial power Loss"; Modelica.SIunits.Torque tau "Torque at shaft"; Modelica.SIunits.AngularVelocity omega_m( start=2*Modelica.Constants.pi*fstart/Np) "Angular velocity of the shaft"; Modelica.SIunits.AngularVelocity omega_e "Angular velocity of the e.m.f. rotating frame"; AngularVelocity_rpm n "Rotational speed"; public Modelica.Mechanics.Rotational.Interfaces.Flange_a shaft annotation (Placement(transformation(extent={{-100,-14},{-72,14}}, rotation=0))); Modelica.Blocks.Interfaces.RealInput f(start=50) "Electrical frequency" annotation (Placement(transformation(extent={{16,16}, {-16,-16}}, rotation=90, origin={4,94}))); equation omega_m = der(shaft.phi) "Mechanical boundary condition"; omega_e = omega_m*Np; f = omega_e/(2*Modelica.Constants.pi) "Electrical frequency"; n = Modelica.SIunits.Conversions.to_rpm(omega_m) "Rotational speed in rpm"; Pm = omega_m*tau; if J>0 then Ploss = J*der(omega_m)*omega_m; else Ploss = 0; end if annotation (Diagram); Pm = Pe/eta + Ploss "Energy balance"; tau = shaft.tau; annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, -100},{100,100}}), graphics={ Rectangle( extent={{-72,6},{-48,-8}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder, fillColor={160,160,164}), Ellipse( extent={{50,-50},{-50,50}}, lineColor={0,0,0}, lineThickness=0.5, fillColor={255,255,255}, fillPattern=FillPattern.Solid), Ellipse( extent={{-34,18},{0,-18}}, pattern=LinePattern.None, lineColor={0,0,0}, lineThickness=0.5), Ellipse( extent={{0,20},{34,-16}}, pattern=LinePattern.None, lineColor={0,0,0}, lineThickness=0.5), Rectangle( extent={{-36,0},{0,-30}}, pattern=LinePattern.None, lineColor={0,0,0}, fillColor={255,255,255}, fillPattern=FillPattern.Solid), Rectangle( extent={{0,26},{34,4}}, pattern=LinePattern.None, lineColor={0,0,0}, fillColor={255,255,255}, fillPattern=FillPattern.Solid), Rectangle( extent={{34,20},{38,2}}, pattern=LinePattern.None, lineColor={0,0,0}, fillColor={255,255,255}, fillPattern=FillPattern.Solid), Text(extent={{-100,-50},{100,-84}}, textString= "%name")}), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100, -100},{100,100}}),graphics), Documentation(info="This model describes the conversion between mechanical power and electrical power in an ideal synchronous generator. The frequency in the electrical connector is the e.m.f. of generator.It is possible to consider the generator inertia in the model, by setting the parameter J > 0. ")); end Generator; model Source_Cdot "Flowrate source for Cdot-type heat source" parameter Modelica.SIunits.MassFlowRate Mdot_0=0 "Mass flowrate if input not connected"; parameter Modelica.SIunits.Temperature T_0=298.13 "Temperature if input not connected"; parameter Modelica.SIunits.SpecificHeatCapacity cp=1000 "Specific Heat capacity"; parameter Modelica.SIunits.Density rho=1000 "Fluid Density"; Modelica.Blocks.Interfaces.RealInput source[2] annotation (Placement(transformation( origin={-40,60}, extent={{-20,-20},{20,20}}, rotation=270), iconTransformation( extent={{-15,-15},{15,15}}, rotation=0, origin={-71,-1}))); components.Flange_ex_Cdot flange annotation (Placement(transformation(extent={{82,-2}, {102,18}}), iconTransformation(extent={{62,-20},{102,18}}))); equation flange.Mdot = source[1]; flange.T = source[2]+273.15; if cardinality(source) == 0 then flange.Mdot = -Mdot_0 "Flow rate set by parameter"; flange.T = T_0; end if; flange.cp = cp; flange.rho = rho; annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100}, {100,100}}), graphics={ Rectangle(extent={{-72,38},{80,-40}}, lineColor={0,0,0}, radius=10), Polygon( points={{-12,-20},{66,0},{-12,20},{34,0},{-12,-20}}, lineColor={255,255,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid), Text(extent={{-100,-44},{100,-72}}, textString="%name"), Text( extent={{-34,36},{34,-6}}, lineColor={0,0,0}, textString="M", lineThickness=1), Text( extent={{-30,-2},{30,-44}}, lineColor={0,0,0}, textString="T"), Line( points={{-2,32},{2,32},{-2,32}}, color={0,0,0}, smooth=Smooth.None, thickness=1)}), Diagram( coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics={Text(extent={{-98,74},{-48,42}}, textString="w0"), Text(extent={{48,74},{98,42}}, textString="h")}), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics)); end Source_Cdot; connector Flange_Cdot "Flange for a Cdot-type heat source" input Modelica.SIunits.MassFlowRate Mdot "Mass flow rate"; input Modelica.SIunits.SpecificHeatCapacity cp "Specific Heat capacity"; input Modelica.SIunits.Density rho "Density of entering fluid"; input Modelica.SIunits.Temperature T "Temperature of entering fluid"; annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Ellipse(extent={{-100,100},{100,-100}}, lineColor={255,0,0})})); end Flange_Cdot; connector Flange_ex_Cdot "B-type flange connector for Cdot-type heat source" output Modelica.SIunits.MassFlowRate Mdot "Mass flow rate"; output Modelica.SIunits.SpecificHeatCapacity cp "Specific Heat capacity"; output Modelica.SIunits.Density rho "Density of the fluid"; output Modelica.SIunits.Temperature T "Temperature of the fluid"; annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Ellipse(extent={{-100,100},{100,-100}}, lineColor={255,0,0}), Ellipse( extent={{-42,44},{44,-40}}, lineColor={255,0,0}, fillColor={255,255,255}, fillPattern=FillPattern.Solid)})); end Flange_ex_Cdot; model PID "ISA PID controller with anti-windup" parameter Real Kp "Proportional gain (normalised units)"; parameter Modelica.SIunits.Time Ti "Integral time"; parameter Modelica.SIunits.Time Td=0 "Derivative time"; parameter Real Nd = 1 "Derivative action up to Nd / Td rad/s"; parameter Real Ni = 1 "Ni*Ti is the time constant of anti-windup compensation"; parameter Real b = 1 "Setpoint weight on proportional action"; parameter Real c = 0 "Setpoint weight on derivative action"; parameter Real PVmin "Minimum value of process variable for scaling"; parameter Real PVmax "Maximum value of process variable for scaling"; parameter Real CSmin "Minimum value of control signal for scaling"; parameter Real CSmax "Maximum value of control signal for scaling"; parameter Real PVstart = 0.5 "Start value of PV (scaled)"; parameter Real CSstart = 0.5 "Start value of CS (scaled)"; parameter Boolean steadyStateInit = false; Real P "Proportional action / Kp"; Real I(start = CSstart/Kp) "Integral action / Kp"; Real D "Derivative action / Kp"; Real Dx(start = c*PVstart - PVstart) "State of approximated derivator"; Real PVs "Process variable scaled in per unit"; Real SPs "Setpoint variable scaled in per unit"; Real CSs(start = CSstart) "Control signal scaled in per unit"; Real CSbs(start = CSstart) "Control signal scaled in per unit before saturation"; Real track "Tracking signal for anti-windup integral action"; Modelica.Blocks.Interfaces.RealInput PV "Process variable signal" annotation (Placement(transformation(extent={{-112,-52},{ -88,-28}}, rotation=0))); Modelica.Blocks.Interfaces.RealOutput CS "Control signal" annotation (Placement(transformation(extent={{94,-12},{118,12}}, rotation=0))); Modelica.Blocks.Interfaces.RealInput SP "Set point signal" annotation (Placement(transformation(extent={{-112,28},{-88, 52}}, rotation=0))); equation // Scaling SPs=(SP-PVmin)/(PVmax-PVmin); PVs=(PV-PVmin)/(PVmax-PVmin); CS = CSmin + CSs*(CSmax-CSmin); // Controller actions P = b*SPs - PVs; if Ti>0 then Ti*der(I) = SPs - PVs + track; else I = 0; end if; if Td > 0 then Td/Nd*der(Dx) + Dx = c*SPs - PVs "State equation of approximated derivator"; D = Nd*((c*SPs - PVs) - Dx) "Output equation of approximated derivator"; else Dx = 0; D = 0; end if; CSbs = Kp*(P+I+D) "Control signal before saturation"; CSs = smooth(0, if CSbs > 1 then 1 else if CSbs < 0 then 0 else CSbs) "Saturated control signal"; track = (CSs-CSbs)/(Kp*Ni); initial equation if steadyStateInit then if Ti > 0 then der(I) = 0; end if; if Td > 0 then D = 0; end if; end if; annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Rectangle( extent={{-100,100},{100,-100}}, lineColor={0,0,0}, fillColor={240,240,240}, fillPattern=FillPattern.Solid), Text( extent={{-54,40},{52,-34}}, lineColor={0,0,0}, textString="PID"), Text( extent={{-110,-108},{110,-142}}, lineColor={0,0,255}, lineThickness=0.5, textString="%name")}), Documentation(revisions="10 Dec 2008 by FrancescoCasella: First release.")); end PID; package Icons "Icons for the ORC components, copied from the ThermoPower library" extends Modelica.Icons.Library; package Water "Icons for component using water/steam as working fluid" extends Modelica.Icons.Library; partial model SourceP annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Ellipse(extent={{-80,80},{80,-80}}, lineColor={0,0,0}), Text( extent={{-20,34},{28,-26}}, lineColor={255,255,255}, textString="P"), Text(extent={{-100,-78},{100,-106}}, textString="%name")})); end SourceP; partial model SourceW annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Rectangle(extent={{-80,40},{80,-40}}, lineColor={0,0,0}), Polygon( points={{-12,-20},{66,0},{-12,20},{34,0},{-12,-20}}, lineColor={255,255,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid), Text(extent={{-100,-52},{100,-80}}, textString="%name")})); end SourceW; partial model Tube annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Rectangle( extent={{-80,40},{80,-40}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder)}), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics)); end Tube; partial model Mixer annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Ellipse(extent={{80,80},{-80,-80}}, lineColor={0,0,0}), Text(extent={{-100,-84},{100,-110}}, textString="%name")}), Diagram(graphics)); end Mixer; partial model Tank annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Rectangle( extent={{-60,60},{60,-80}}, lineColor={0,0,0}, fillColor={0,0,0}, fillPattern=FillPattern.Solid), Rectangle( extent={{-54,60},{54,12}}, lineColor={255,255,255}, fillColor={255,255,255}, fillPattern=FillPattern.Solid), Rectangle(extent={{-54,12},{54,-72}}, lineColor={0,0,255})})); end Tank; partial model Valve annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Line( points={{0,40},{0,0}}, color={0,0,0}, thickness=0.5), Polygon( points={{-80,40},{-80,-40},{0,0},{-80,40}}, lineColor={0,0,0}, lineThickness=0.5), Polygon( points={{80,40},{0,0},{80,-40},{80,40}}, lineColor={0,0,0}, lineThickness=0.5), Rectangle( extent={{-20,60},{20,40}}, lineColor={0,0,0}, fillColor={0,0,0}, fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics)); end Valve; model FlowJoin annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Polygon(points={{-40, 60},{0,20},{40,20},{40,-20},{0,-20},{-40,-60},{-40,-20},{-20, 0},{-40,20},{-40,60}}, lineColor={0,0,0})})); end FlowJoin; model FlowSplit annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Polygon(points={{40, 60},{0,20},{-40,20},{-40,-20},{0,-20},{40,-60},{40,-20},{22, 0},{40,20},{40,60}}, lineColor={0,0,0})})); end FlowSplit; model SensThrough annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Rectangle(extent={{-40,-20},{40,-60}}, lineColor={0,0,0}), Line(points={{0,20},{0,-20}}, color={0,0,0}), Ellipse(extent={{-40,100},{40,20}}, lineColor={0,0,0}), Line(points={{40,60},{60,60}}), Text(extent={{-100,-76},{100,-100}}, textString="%name")})); end SensThrough; model SensP annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Line(points={{0,20},{0,-20}}, color={0,0,0}), Ellipse(extent={{-40,100},{40,20}}, lineColor={0,0,0}), Line(points={{40,60},{60,60}}), Text(extent={{-100,-52},{100,-86}}, textString="%name")})); end SensP; model Drum annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Ellipse( extent={{-80,80},{80,-80}}, lineColor={128,128,128}, fillColor={128,128,128}, fillPattern=FillPattern.Solid), Polygon(points={{-60,0},{-60,-6},{-58,-16},{-52,-30},{-44,-42},{-38, -46},{-32,-50},{-22,-56},{-16,-58},{-8,-60},{-6,-60},{0,-60}, {6,-60},{12,-58},{22,-56},{30,-52},{36,-48},{42,-42},{48,-36}, {52,-28},{58,-18},{60,-8},{60,0},{-60,0}}, lineColor={128, 128,128}), Polygon( points={{-60,0},{-58,16},{-50,34},{-36,48},{-26,54},{-16,58},{-6, 60},{0,60},{10,60},{20,56},{30,52},{36,48},{46,40},{52,30}, {56,22},{58,14},{60,6},{60,0},{-60,0}}, lineColor={128,128,128}, fillColor={159,191,223}, fillPattern=FillPattern.Solid)})); end Drum; partial model Pump annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Polygon( points={{-40,-24},{-60,-60},{60,-60},{40,-24},{-40,-24}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={0,0,191}, fillPattern=FillPattern.Solid), Ellipse( extent={{-60,80},{60,-40}}, lineColor={0,0,0}, fillPattern=FillPattern.Sphere), Polygon( points={{-30,52},{-30,-8},{48,20},{-30,52}}, lineColor={0,0,0}, pattern=LinePattern.None, fillPattern=FillPattern.HorizontalCylinder, fillColor={255,255,255}), Text(extent={{-100,-64},{100,-90}}, textString="%name")})); end Pump; partial model Accumulator annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Rectangle( extent={{-60,80},{60,-40}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={128,128,128}, fillPattern=FillPattern.Solid), Ellipse( extent={{-60,100},{60,60}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={128,128,128}, fillPattern=FillPattern.Solid), Ellipse( extent={{-60,-20},{60,-60}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={128,128,128}, fillPattern=FillPattern.Solid), Ellipse( extent={{-52,94},{52,64}}, lineColor={0,0,191}, pattern=LinePattern.None, fillColor={159,159,223}, fillPattern=FillPattern.Solid), Rectangle( extent={{-52,22},{52,-40}}, lineColor={0,0,191}, fillColor={0,0,191}, fillPattern=FillPattern.Solid), Rectangle( extent={{-52,80},{52,20}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={159,159,223}, fillPattern=FillPattern.Solid), Ellipse( extent={{-52,-24},{52,-54}}, lineColor={0,0,191}, pattern=LinePattern.None, fillColor={0,0,191}, fillPattern=FillPattern.Solid), Rectangle( extent={{-4,-58},{4,-86}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={128,128,128}, fillPattern=FillPattern.Solid), Rectangle( extent={{-26,-86},{26,-94}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={128,128,128}, fillPattern=FillPattern.Solid), Text(extent={{-62,-100},{64,-122}}, textString="%name"), Polygon( points={{-74,86},{-60,72},{-54,78},{-68,92},{-74,86}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={128,128,128}, fillPattern=FillPattern.Solid)}), Diagram(coordinateSystem(preserveAspectRatio= false, extent={{-100,-100},{100,100}}), graphics)); end Accumulator; partial model PumpMech annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Rectangle( extent={{54,28},{80,12}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder, fillColor={160,160,164}), Polygon( points={{-40,-24},{-60,-60},{60,-60},{40,-24},{-40,-24}}, lineColor={0,0,255}, pattern=LinePattern.None, fillColor={0,0,191}, fillPattern=FillPattern.Solid), Ellipse( extent={{-60,80},{60,-40}}, lineColor={0,0,0}, fillPattern=FillPattern.Sphere), Polygon( points={{-30,52},{-30,-8},{48,20},{-30,52}}, lineColor={0,0,0}, pattern=LinePattern.None, fillPattern=FillPattern.HorizontalCylinder, fillColor={255,255,255}), Text(extent={{-100,-64},{100,-90}}, textString="%name")})); end PumpMech; partial model PressDrop annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Rectangle( extent={{-80,40},{80,-40}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder), Polygon( points={{-80,40},{-42,40},{-20,12},{20,12},{40,40},{80,40},{80, -40},{40,-40},{20,-12},{-20,-12},{-40,-40},{-80,-40},{-80, 40}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder, fillColor={0,0,255})}), Diagram( coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{ 100,100}}), graphics)); end PressDrop; partial model SteamTurbineUnit annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Line( points={{14,20},{14,42},{38,42},{38,20}}, color={0,0,0}, thickness=0.5), Rectangle( extent={{-100,8},{100,-8}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder, fillColor={160,160,164}), Polygon( points={{-14,48},{-14,-48},{14,-20},{14,20},{-14,48}}, lineColor={0,0,0}, lineThickness=0.5, fillColor={0,0,255}, fillPattern=FillPattern.Solid), Polygon( points={{38,20},{38,-20},{66,-46},{66,48},{38,20}}, lineColor={0,0,0}, lineThickness=0.5, fillColor={0,0,255}, fillPattern=FillPattern.Solid), Polygon( points={{-66,20},{-66,-20},{-40,-44},{-40,48},{-66,20}}, lineColor={0,0,0}, lineThickness=0.5, fillColor={0,0,255}, fillPattern=FillPattern.Solid), Line( points={{-100,70},{-100,70},{-66,70},{-66,20}}, color={0,0,0}, thickness=0.5), Line( points={{-40,46},{-40,70},{26,70},{26,42}}, color={0,0,0}, thickness=0.5), Line( points={{-14,-46},{-14,-70},{66,-70},{66,-46}}, color={0,0,0}, thickness=0.5), Line( points={{66,-70},{100,-70}}, color={0,0,255}, thickness=0.5)}), Diagram(graphics)); end SteamTurbineUnit; partial model Header annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={ Ellipse( extent={{-80,80},{80,-80}}, lineColor={95,95,95}, fillColor={95,95,95}, fillPattern=FillPattern.Solid), Ellipse(extent={{70,70},{-70,-70}}, lineColor={95,95,95}), Text(extent={{-100,-84},{100,-110}}, textString="%name")}), Diagram(graphics)); end Header; end Water; partial model HeatFlow annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Rectangle( extent={{-80,20},{80,-20}}, lineColor={0,0,0}, fillColor={255,255,255}, fillPattern=FillPattern.Forward)})); end HeatFlow; partial model MetalWall annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,100}}), graphics={Rectangle( extent={{-80,20},{80,-20}}, lineColor={0,0,0}, fillColor={128,128,128}, fillPattern=FillPattern.Solid)})); end MetalWall; package Gas "Icons for component using water/steam as working fluid" extends Modelica.Icons.Library; partial model SourceP annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{ -100,-100},{100,100}}), graphics={ Ellipse( extent={{-80,80},{80,-80}}, lineColor={128,128,128}, fillColor={159,159,223}, fillPattern=FillPattern.Solid), Text( extent={{-20,34},{28,-26}}, lineColor={255,255,255}, textString="P"), Text(extent={{-100,-78},{100,-106}}, textString="%name")})); end SourceP; partial model SourceW annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{ -100,-100},{100,100}}), graphics={ Rectangle( extent={{-80,40},{80,-40}}, lineColor={128,128,128}, fillColor={159,159,223}, fillPattern=FillPattern.Solid), Polygon( points={{-12,-20},{66,0},{-12,20},{34,0},{-12,-20}}, lineColor={128,128,128}, fillColor={0,0,0}, fillPattern=FillPattern.Solid), Text(extent={{-100,-52},{100,-80}}, textString="%name")})); end SourceW; partial model Tube annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{ -100,-100},{100,100}}), graphics={Rectangle( extent={{-80,40},{80,-40}}, lineColor={0,0,0}, fillPattern=FillPattern.HorizontalCylinder, fillColor={159,159,223})}), Diagram(graphics)); end Tube; partial model Mixer annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{ -100,-100},{100,100}}), graphics={Ellipse( extent={{80,80},{-80,-80}}, lineColor={128,128,128}, fillColor={159,159,223}, fillPattern=FillPattern.Solid), Text(extent={{-100,-84},{100,-110}}, textString="%name")}), Diagram(graphics)); end Mixer; partial model Valve annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{ -100,-100},{100,100}}), graphics={ Line( points={{0,40},{0,0}}, color={0,0,0}, thickness=0.5), Polygon( points={{-80,40},{-80,-40},{0,0},{-80,40}}, lineColor={128,128,128}, lineThickness=0.5, fillColor={159,159,223}, fillPattern=FillPattern.Solid), Polygon( points={{80,40},{0,0},{80,-40},{80,40}}, lineColor={128,128,128}, lineThickness=0.5, fillColor={159,159,223}, fillPattern=FillPattern.Solid), Rectangle( extent={{-20,60},{20,40}}, lineColor={0,0,0}, fillColor={0,0,0}, fillPattern=FillPattern.Solid)}), Diagram(graphics)); end Valve; model FlowJoin annotation (Diagram(graphics), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Polygon( points={{-40,60},{0,20},{40,20},{40,-20},{0,-20},{-40,-60},{-40, -20},{-20,0},{-40,20},{-40,60}}, lineColor={128,128,128}, fillColor={159,159,223}, fillPattern=FillPattern.Solid)})); end FlowJoin; model FlowSplit annotation (Diagram(graphics), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={Polygon( points={{40,60},{0,20},{-40,20},{-40,-20},{0,-20},{40,-60},{40, -20},{22,0},{40,20},{40,60}}, lineColor={128,128,128}, fillColor={159,159,223}, fillPattern=FillPattern.Solid)})); end FlowSplit; model SensThrough annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{ -100,-100},{100,100}}), graphics={ Rectangle( extent={{-40,-20},{40,-60}}, lineColor={128,128,128}, fillColor={159,159,223}, fillPattern=FillPattern.Solid), Line(points={{0,20},{0,-20}}, color={0,0,0}), Ellipse(extent={{-40,100},{40,20}}, lineColor={0,0,0}), Line(points={{40,60},{60,60}}), Text(extent={{-100,-76},{100,-100}}, textString="%name")})); end SensThrough; model SensP annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{ -100,-100},{100,100}}), graphics={ Line(points={{0,20},{0,-20}}, color={0,0,0}), Ellipse(extent={{-40,100},{40,20}}, lineCo