using "types"; #Sections of pipe Model StraightLineEqual EQUATIONS # Ec. Bernoulli for smooth pipe without change in diameter. Area constant throughout the pipe. P2_out = P1_in + (g*Rho_Sln*Z1) - (g*Rho_Sln*Z2) - (Rho_Sln*Hf1_2); #J/kg*(kg/m^3) = N/m^2 = Pa # Pipe characteristics ALine = (Pi*D_Line^2)/4; # m VLine = (M_point/Rho_Sln)/ALine; #m/s #Reynolds number for pipe conditions Re = (Rho_Sln*D_Line*VLine)/Mu_Sln; #dimensionless #Decision for Darcy factor value into Bernoullis equation #Laminar flow. if Re<2100 then fD=64/Re; else #Turbulent flow. #Shacham ecuation fD=(-2*log(((Epsilon/D_Line)/3.71)-((5.02/Re)*log(((Epsilon/D_Line)/3.71)+(14.5/Re)))))^(-2); end P1_in = FlowLine_inlet.P_P; M_point = FlowLine_inlet.M_point; Rho_Sln = FlowLine_inlet.Rho_Sln; Mu_Sln = FlowLine_inlet.Mu_Sln; #Total K factor from the pipe. K_Total = (L/D_Line)*fD; #Calculates total head losses in m2/s2 units Hf1_2 = K_Total*((VLine^2)/2); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowLine_outlet.P_P; M_point1 = FlowLine_outlet.M_point; Rho_Sln1 = FlowLine_outlet.Rho_Sln; Mu_Sln1 = FlowLine_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); g as Real (Brief="Gravity constant", Unit='m/s^2'); D_Line as length (Brief="Diameter of Line 1"); #Unit='m' L as length (Brief="length of Line 1"); #Unit='m' Epsilon as Real (Brief="Roughness abs Line 1", Unit='m'); Z1 as length (Brief="height of Line 1"); #Unit='m' Z2 as length (Brief="height of Line 2"); #Unit='m' SET Pi =3.1416; g =9.8*'m/s^2'; VARIABLES in FlowLine_inlet as StreamProcess (Brief="Process Stream"); DeltaP as Real (Brief="losses pressure", Unit='Pa'); P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); M_point as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' #in P_Exit as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); out FlowLine_outlet as StreamProcess (Brief="Process Stream"); P2_out as pressure (Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' #out P_Exit1 as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); ALine as area (Brief = "Flow area of...1"); #Unit='m^2' VLine as velocity (Brief="velocity inside the line 2"); #Unit='m/s' Re as positive (Brief="Reynolds number for this line section 1"); #Dimensionless Hf1_2 as Real (Brief="Total head losses of the line plus fittings", Unit='m^2/s^2'); K_Total as Real (Brief="K factor for the straight lines 1"); fD as positive (Brief="Darcy factor for friction in descending Overflow line", Unit='Pa/Pa',Lower=-0.00001, Upper=5); #Dimensionless end Model StreamProcess VARIABLES P_P as pressure(Brief="discharge pressure of pump", DisplayUnit='Pa');#Unit='atm' M_point as flow_mass(Brief="Mass flow solution"); #kg/s Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' end #Fittings Model ElbowModel45 #*Tips for selecction the elbows characteristics in accordance with algorithm * - if your elbow is standard, you must select in the parameters section: * Standard = 1 * Weld = 0 * Long_R = 0 * * - if your elbow is Long-Radius, you must select in the parameters section: * Standard = 0 * Weld = 0 * Long_R = 1 * * - if your elbow is mitered, you must specify the angle welding in the parameters section: * Standard = 0 * Weld = 45° or 22.5° * Long_R = 0 *# EQUATIONS #Conversion of units of inches at meter D_m = (ID*0.0254*'m'); #Fitting characteristics AFit = (Pi*(D_m^2))/4; V_Fit = (M_point/Rho_Sln)/AFit; #m/s #Reynolds number for fittings conditions Re = (Rho_Sln*D_m*V_Fit)/Mu_Sln; #dimensionless #Selection of K values in agrrement with elbows characteristics if Standard equal 1 then K1 = 500; Kinf = 0.2; else if Long_R equal 1 then K1 = 500; Kinf = 0.15; else if Weld equal 45 then K1 = 500; Kinf = 0.25; else K1 = 500; Kinf = 0.15; end end end P1_in = FlowElbow45_inlet.P_P; M_point = FlowElbow45_inlet.M_point; Rho_Sln = FlowElbow45_inlet.Rho_Sln; Mu_Sln = FlowElbow45_inlet.Mu_Sln; #Equation for determine the K factor of elbow. K_elbow = (K1/Re)+(Kinf*(1 + (1/ID))); #Equation for determine losses in elbows H_f = K_elbow*((V_Fit^2)/2); #Bernoulli Equation P2_out = P1_in - (Rho_Sln*H_f); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowElbow45_outlet.P_P; M_point1 = FlowElbow45_outlet.M_point; Rho_Sln1 = FlowElbow45_outlet.Rho_Sln; Mu_Sln1 = FlowElbow45_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Standard as positive (Brief=" Values of 0 and 1, 0 when there is no, 1 when there is"); Long_R as positive (Brief=" Values of 0 and 1, 0 when there is no, 1 when there is"); Weld as positive (Brief=" angle when the elbow is welded "); SET Pi =3.1416; VARIABLES in FlowElbow45_inlet as StreamProcess (Brief="Process Stream"); M_point as flow_mass(Brief="Mass flow solution"); #kg/s Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); out FlowElbow45_outlet as StreamProcess (Brief="Process Stream"); M_point1 as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); K_elbow as Real (Brief="K Factor elbow"); #Dimensionless D_m as length (Brief="Diameter in meter"); #m ID as Real (Brief="diameter in Inches"); #Inches Re as positive (Brief="Reynolds number"); #Dimensionless K1 as positive (Brief="K1 values of 2K Method"); #Dimensionless Kinf as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless V_Fit as velocity (Brief="Velocity in the fitting"); #m/s AFit as area (Brief = "Flow area"); #Unit='m^2' H_f as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); end Model ElbowModel90 #*Tips for selecction the elbows characteristics in accordance with algorithm * - if your elbow is standard and Screwed, you must select in the parameters section: * Standard = 1 * Screwed = 1 * Weld = 0 * Long_R = 0 * * - if your elbow is standard and welded, you must select in the parameters section: * Standard = 1 * Screwed = 0 * Weld = 0 * Long_R = 0 * * - if your elbow is Long-Radius, you must select in the parameters section: * Standard = 0 * Screwed = 0 * Weld = 0 * Long_R = 1 * * - if your elbow is mitered, you must specify the angle welding in the parameters section: * Standard = 0 * Screwed = 0 * Weld = 90°, 45°, 30°, 22.5° or 18° * Long_R = 1 *# EQUATIONS #Conversion of units of inches at meter D_m = (ID*0.0254*'m'); #Fitting characteristics AFit = (Pi*(D_m^2))/4; V_Fit = (M_point/Rho_Sln)/AFit; #m/s #Reynolds number for fittings conditions Re = (Rho_Sln*D_m*V_Fit)/Mu_Sln; #dimensionless #Selection of K values in agrrement with elbows characteristics if Standard equal 1 then if Screwed equal 1 then K1 = 800; Kinf = 0.4; else K1 = 800; Kinf = 0.25; end else if Long_R equal 1 then K1 = 800; Kinf = 0.2; else if Weld equal 90 then K1 = 1000; Kinf = 1.15; else if Weld equal 45 then K1 = 800; Kinf = 0.35; else if Weld equal 30 then K1 = 800; Kinf = 0.3; else if Weld equal 22.5 then K1 = 800; Kinf = 0.27; else K1 = 800; Kinf = 0.25; end end end end end end P1_in = FlowElbow_inlet.P_P; M_point = FlowElbow_inlet.M_point; Rho_Sln = FlowElbow_inlet.Rho_Sln; Mu_Sln = FlowElbow_inlet.Mu_Sln; #Equation for determine the K factor of elbow. K_elbow = (K1/Re)+(Kinf*(1 + (1/ID))); #Equation for determine losses in elbows H_f = K_elbow*((V_Fit^2)/2); #Bernoulli Equation P2_out = P1_in - (Rho_Sln*H_f); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowElbow_outlet.P_P; M_point1 = FlowElbow_outlet.M_point; Rho_Sln1 = FlowElbow_outlet.Rho_Sln; Mu_Sln1 = FlowElbow_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Standard as positive (Brief=" Values of 0 and 1, 0 when there is no, 1 when there is"); Screwed as positive (Brief=" Values of 0 and 1, 0 when there is no, 1 when there is"); Long_R as positive (Brief=" Values of 0 and 1, 0 when there is no, 1 when there is"); Weld as positive (Brief=" angle when the elbow is welded "); SET Pi =3.1416; VARIABLES in FlowElbow_inlet as StreamProcess (Brief="Process Stream"); M_point as flow_mass(Brief="Mass flow solution"); #kg/s Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); out FlowElbow_outlet as StreamProcess (Brief="Process Stream"); M_point1 as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); K_elbow as Real (Brief="K Factor elbow"); #Dimensionless D_m as length (Brief="Diameter in meter"); #m ID as Real (Brief="diameter in Inches"); #Inches Re as positive (Brief="Reynolds number"); #Dimensionless K1 as positive (Brief="K1 values of 2K Method"); #Dimensionless Kinf as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless V_Fit as velocity (Brief="Velocity in the fitting"); #m/s AFit as area (Brief = "Flow area"); #Unit='m^2' H_f as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); end Model ElbowModel180 #*Tips for selecction the elbows characteristics in accordance with algorithm * - if your elbow is standard and Screwed, you must select in the parameters section: * Standard = 1 * Screwed = 1 * Long_R = 0 * - if your elbow is standard and welded, you must select in the parameters section: * Standard = 1 * Screwed = 0 * Long_R = 0 * - if your elbow is Long-Radius, you must select in the parameters section: * Standard = 0 * Screwed = 0 * Long_R = 1 * *# EQUATIONS #Conversion of units of inches at meter D_m = (ID*0.0254*'m'); #Fitting characteristics AFit = (Pi*(D_m^2))/4; V_Fit = (M_point/Rho_Sln)/AFit; #m/s #Reynolds number for fittings conditions Re = (Rho_Sln*D_m*V_Fit)/Mu_Sln; #dimensionless #Selection of K values in agrrement with elbows characteristics if Standard equal 1 then if Screwed equal 1 then K1 = 1000; Kinf = 0.6; else K1 = 1000; Kinf = 0.35; end else #if Long_R equal 1 #then K1 = 1000; Kinf = 0.3; #end end #Equation for determine the K factor of elbow. K_elbow = (K1/Re)+(Kinf*(1 + (1/ID))); P1_in = FlowElbow180_inlet.P_P; M_point = FlowElbow180_inlet.M_point; Rho_Sln = FlowElbow180_inlet.Rho_Sln; Mu_Sln = FlowElbow180_inlet.Mu_Sln; #Equation for determine losses in elbows H_f = K_elbow*((V_Fit^2)/2); #Bernoulli Equation P2_out = P1_in - (Rho_Sln*H_f); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowElbow180_outlet.P_P; M_point1 = FlowElbow180_outlet.M_point; Rho_Sln1 = FlowElbow180_outlet.Rho_Sln; Mu_Sln1 = FlowElbow180_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Standard as positive (Brief=" Values of 0 and 1, 0 when there is no, 1 when there is"); Long_R as positive (Brief=" Values of 0 and 1, 0 when there is no, 1 when there is"); Screwed as positive (Brief=" angle when the elbow is welded "); SET Pi =3.1416; VARIABLES in FlowElbow180_inlet as StreamProcess (Brief="Process Stream"); M_point as flow_mass(Brief="Mass flow solution"); #kg/s Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); out FlowElbow180_outlet as StreamProcess (Brief="Process Stream"); M_point1 as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); K_elbow as Real (Brief="K Factor elbow"); #Dimensionless D_m as length (Brief="Diameter in meter"); #m ID as Real (Brief="diameter in Inches"); #Inches Re as positive (Brief="Reynolds number"); #Dimensionless K1 as positive (Brief="K1 values of 2K Method"); #Dimensionless Kinf as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless V_Fit as velocity (Brief="Velocity in the fitting"); #m/s AFit as area (Brief = "Flow area"); #Unit='m^2' H_f as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); end Model SuddenChange EQUATIONS # This equation evaluates output pressure of this fitting taken from a Mechanical Energy # Balance taken from point1=fitting input and point 2=fitting output P2_out = P1_in +(g*Rho_Sln*(Z1-Z2)) + (Rho_Sln*alpha1*((V1_in^2)/2)) - (Rho_Sln*alpha2*((V2_out^2)/2)) - (Rho_Sln*Hf1_2); # Point 1 characteristics A1Line = (Pi*D1_in^2)/4; # m V1_in = (M_point/Rho_Sln)/A1Line; #m/s # Point 2 characteristics A2Line = (Pi*D2_out^2)/4; # m V2_out = (M_point/Rho_Sln)/A2Line; #m/s #Reynolds number for point 1 (input) conditions Re1 = (Rho_Sln*D1_in*V1_in)/Mu_Sln; #dimensionless #Decision for alpha value into Bernoullis equation if Re1<2100 then alpha1=2; #Alpha for laminar flow else alpha1=1.01; #Alpha for turbulent flow end #Reynolds number for point 2 (output) conditions Re2 = (Rho_Sln*D2_out*V2_out)/Mu_Sln; #dimensionless #Decision for alpha value into Bernoullis equation if Re2<2100 then alpha2=2; #Alpha for laminar flow else alpha2=1.01; #Alpha for turbulent flow end #Decision between Contraction or Expansion if (D1_in>D2_out) then #factor K for gradual contraction K_Sub = 0.5*((1-((D2_out/D1_in)^2))^2) ; #Contraction losses Hf1_2 = K_Sub*((V2_out^2)/2); else # Calculation of gradual expansion #factor K for expansion contraction K_Sub = ((1-((D2_out/D1_in)^2))^2); #Expansion losses Hf1_2 = K_Sub*((V2_out^2)/2); end P1_in = FlowSudden_inlet.P_P; M_point = FlowSudden_inlet.M_point; Rho_Sln = FlowSudden_inlet.Rho_Sln; Mu_Sln = FlowSudden_inlet.Mu_Sln; M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowSudden_outlet.P_P; M_point1 = FlowSudden_outlet.M_point; Rho_Sln1 = FlowSudden_outlet.Rho_Sln; Mu_Sln1 = FlowSudden_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); g as Real (Brief="Gravity constant", Unit='m/s^2'); D2_out as length (Brief="Diameter of Line 2"); #Unit='m' D1_in as length (Brief="Diameter of line 1"); #Unit='m' Z1 as length (Brief="height of point 1"); #Unit='m' Z2 as length (Brief="height of point 2"); #Unit='m' SET Pi =3.1416; g =9.8*'m/s^2'; VARIABLES in FlowSudden_inlet as StreamProcess (Brief="Process Stream"); P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); M_point as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); out FlowSudden_outlet as StreamProcess (Brief="Process Stream"); P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Re1 as positive(Brief="Reynolds number for this line section 1"); #Dimensionless Re2 as positive(Brief="Reynolds number for this line section 1"); #Dimensionless Hf1_2 as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); K_Sub as Real (Brief="K factor for the straight lines 1"); alpha1 as positive (Brief="speed correction factor 1"); #Dimensionless alpha2 as positive (Brief="speed correction factor 2"); #Dimensionless A1Line as area (Brief = "Flow area of...1"); #Unit='m^2' V1_in as velocity (Brief="velocity inside the line 1"); #Unit='m/s' A2Line as area (Brief = "Flow area of...1"); #Unit='m^2' V2_out as velocity (Brief="velocity inside the line 1"); #Unit='m/s' end Model GradualChange EQUATIONS # This equation evaluates output pressure of this fitting taken from a Mechanical Energy # Balance taken from point1=fitting input and point 2=fitting output P2_out = P1_in +(g*Rho_Sln*(Z1-Z2)) + (Rho_Sln*alpha1*((V1_in^2)/2)) - (Rho_Sln*alpha2*((V2_out^2)/2)) - (Rho_Sln*Hf1_2); # Point 1 characteristics A1Line = (Pi*D1_in^2)/4; # m V1_in = (M_point/Rho_Sln)/A1Line; #m/s # Point 2 characteristics A2Line = (Pi*D2_out^2)/4; # m V2_out = (M_point/Rho_Sln)/A2Line; #m/s #Reynolds number for point 1 (input) conditions Re1 = (Rho_Sln*D1_in*V1_in)/Mu_Sln; #dimensionless #Decision for alpha value into Bernoullis equation if Re1<2100 then alpha1=2; #Alpha for laminar flow else alpha1=1.01; #Alpha for turbulent flow end #Reynolds number for point 2 (output) conditions Re2 = (Rho_Sln*D2_out*V2_out)/Mu_Sln; #dimensionless #Decision for alpha value into Bernoullis equation if Re2<2100 then alpha2=2; #Alpha for laminar flow else alpha2=1.01; #Alpha for turbulent flow end #Decision between Contraction or Expansion if (D1_in>D2_out) then #Cat_1 = Cateto opuesto --- FiitingL = Cateto adyacente Cat_1 = (D1_in/2) - (D2_out/2); Hip_T = sqrt((Cat_1^2) + (FiitingL^2)); #Ang = (asin((Cat_1/Hip_T)))/1.57079632679e-2; if Ang>(45/(2*3.1416))*'rad' and Ang<(180/(2*3.1416))*'rad' then C_g = sqrt(sin(Ang/2)); else C_g = 1.6*sin(Ang/2); end #factor K for gradual contraction K_Gradual = C_g*((1-((D2_out/D1_in)^2))^2); #Contraction losses Hf1_2 = K_Gradual*((V1_in^2)/2); else # Calculation of gradual expansion Cat_1 = (D1_in/2) - (D2_out/2); #Cat_1 = Cateto opuesto --- FiitingL = Cateto adyacente Hip_T = sqrt((Cat_1^2) + (FiitingL^2)); if Ang>(45/(2*3.1416))*'rad' and Ang<(180/(2*3.1416))*'rad' then C_g = 1.0; else C_g = 2.6*sin(Ang/2); end #factor K for expansion contraction K_Gradual = C_g*((1-((D1_in/D2_out)^2))^2); #Expansion losses Hf1_2 = K_Gradual*((V1_in^2)/2); end P1_in = FlowGradChange_inlet.P_P; M_point = FlowGradChange_inlet.M_point; Rho_Sln = FlowGradChange_inlet.Rho_Sln; Mu_Sln = FlowGradChange_inlet.Mu_Sln; M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowGradChange_outlet.P_P; M_point1 = FlowGradChange_outlet.M_point; Rho_Sln1 = FlowGradChange_outlet.Rho_Sln; Mu_Sln1 = FlowGradChange_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); g as Real (Brief="Gravity constant", Unit='m/s^2'); D2_out as length (Brief="Diameter of Line 2"); #Unit='m' D1_in as length (Brief="Diameter of line 1"); #Unit='m' Z1 as length (Brief="height of point 1"); #Unit='m' Z2 as length (Brief="height of point 2"); #Unit='m' FiitingL as length (Brief="Total lenght between input and output areas of fitting"); #Unit='m' Ang as angle (Brief="Contraction angle"); #Rad SET Pi =3.1416; g =9.8*'m/s^2'; VARIABLES in FlowGradChange_inlet as StreamProcess (Brief="Process Stream"); P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); M_point as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' out FlowGradChange_outlet as StreamProcess (Brief="Process Stream"); P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass(Brief="Mass flow of entrace"); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); Cat_1 as Real (Brief="opposite of leg of the triangle", Unit='m'); #m Re1 as positive(Brief="Reynolds number for this line section 1"); #Dimensionless Re2 as positive(Brief="Reynolds number for this line section 1"); #Dimensionless Hf1_2 as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); K_Gradual as Real (Brief="K factor for the straight lines 1"); alpha1 as positive (Brief="speed correction factor 1"); #Dimensionless alpha2 as positive (Brief="speed correction factor 2"); #Dimensionless C_g as Real (Brief="contraction correction factor"); #Dimensionless Hip_T as length (Brief="hypothenuse of the triangle contraction"); #Unit='m' A1Line as area (Brief = "Flow area of...1"); #Unit='m^2' V1_in as velocity (Brief="velocity inside the line 1"); #Unit='m/s' A2Line as area (Brief = "Flow area of...1"); #Unit='m^2' V2_out as velocity (Brief="velocity inside the line 1"); #Unit='m/s' end Model TeeModelThrough EQUATIONS #Bernoulli Equation P2_out = P1_in - (Rho_Sln*H_f); #Equation for Pressure losses in Tee H_f = K_thro*((V_Fit^2)/2); #Factor K equation. K_thro = (K1/Re)+(Kinf*(1 + (1/ID))); #Conversion of units of inches at meter D_m = (ID*0.0254*'m'); #Fitting characteristics AFit = (Pi*(D_m^2))/4; V_Fit = (M_point/Rho_Sln)/AFit; #m/s #Reynolds number for fittings conditions Re = (Rho_Sln*D_m*V_Fit)/Mu_Sln; #dimensionless #Selection of K values in agrrement with elbows characteristics if Screwed equal 1 then K1 = 200; Kinf = 0.1; else if Welded equal 1 then K1 = 150; Kinf = 0.5; else K1 = 100; Kinf = 0; end end P1_in = FlowTee_inlet.P_P; M_point = FlowTee_inlet.M_point; Rho_Sln = FlowTee_inlet.Rho_Sln; Mu_Sln = FlowTee_inlet.Mu_Sln; M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowTee_outlet.P_P; M_point1 = FlowTee_outlet.M_point; Rho_Sln1 = FlowTee_outlet.Rho_Sln; Mu_Sln1 = FlowTee_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Screwed as positive(Brief="Characteristic of Tee, Posible values: 1 or 0"); Welded as positive(Brief="Characteristic of Tee, Posible values: 1 or 0"); SET Pi =3.1416; VARIABLES in FlowTee_inlet as StreamProcess (Brief="Process Stream"); M_point as flow_mass (Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); out FlowTee_outlet as StreamProcess (Brief="Process Stream"); Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' P2_out as pressure (Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass (Brief="Mass flow of entrace"); #Unit='kg/s' K_thro as Real (Brief="K Factor Tee"); #Dimensionless D_m as length (Brief="Diameter in meter"); #m ID as Real (Brief="diameter in Inches"); #Inches Re as positive (Brief="Reynolds number"); #Dimensionless K1 as positive (Brief="K1 values of 2K Method"); #Dimensionless Kinf as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless V_Fit as velocity (Brief="Velocity in the fitting"); #m/s AFit as area (Brief = "Flow area"); #Unit='m^2' H_f as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); end Model TeeModelElbow #*Tips for selecction the Tee characteristics in accordance with algorithm * - if your Tee is Satndard and Screwed, you must select in the parameters section: * Standard = 1 * Screwed = 1 * Welded = 0 * Long_R = 0 * * - if your Tee is Satndard and Welded, you must select in the parameters section: * Standard = 1 * Screwed = 0 * Welded = 1 * Long_R = 0 * * - if your Tee is Long-radius and Screwed, you must select in the parameters section: * Standard = 0 * Screwed = 0 * Welded = 0 * Long_R = 1 * * - if your Tee is stub in type branch, you must select in the parameters section: * Standard = 0 * Screwed = 0 * Welded = 0 * Long_R = 0 *# EQUATIONS #Bernoulli Equation P2_out = P1_in - (Rho_Sln*H_f); #Equation for Pressure losses in Tee H_f = K_TaE*((V_Fit^2)/2); #Factor K equation. K_TaE = (K1/Re)+(Kinf*(1 + (1/ID))); #Conversion of units of inches at meter D_m = (ID*0.0254*'m'); #Fitting characteristics AFit = (Pi*(D_m^2))/4; V_Fit = (M_point/Rho_Sln)/AFit; #m/s #Reynolds number for fittings conditions Re = (Rho_Sln*D_m*V_Fit)/Mu_Sln; #dimensionless P1_in = FlowTeeElbow_inlet.P_P; M_point = FlowTeeElbow_inlet.M_point; Rho_Sln = FlowTeeElbow_inlet.Rho_Sln; Mu_Sln = FlowTeeElbow_inlet.Mu_Sln; #Selection of K values in agrrement with elbows characteristics if Standard equal 1 then if Screwed equal 1 then K1 = 500; Kinf = 0.7; else K1 = 800; Kinf = 0.8; end else if Long_R equal 1 then K1 = 800; Kinf = 0.4; else K1 = 1000; Kinf = 1; end end M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowTeeElbow_outlet.P_P; M_point1 = FlowTeeElbow_outlet.M_point; Rho_Sln1 = FlowTeeElbow_outlet.Rho_Sln; Mu_Sln1 = FlowTeeElbow_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Screwed as positive(Brief="Characteristic of Tee, Posible values: 1 or 0"); Welded as positive(Brief="Characteristic of Tee, Posible values: 1 or 0"); Standard as positive(Brief="Characteristic of Tee, Posible values: 1 or 0"); Long_R as positive(Brief="Characteristic of Tee, Posible values: 1 or 0"); SET Pi =3.1416; VARIABLES in FlowTeeElbow_inlet as StreamProcess (Brief="Process Stream"); M_point as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); out FlowTeeElbow_outlet as StreamProcess (Brief="Process Stream"); P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' K_TaE as Real (Brief="K Factor Tee"); #Dimensionless D_m as length (Brief="Diameter in meter"); #m ID as Real (Brief="diameter in Inches"); #Inches Re as positive (Brief="Reynolds number"); #Dimensionless K1 as positive (Brief="K1 values of 2K Method"); #Dimensionless Kinf as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless V_Fit as velocity (Brief="Velocity in the fitting"); #m/s AFit as area (Brief = "Flow area"); #Unit='m^2' H_f as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); end Model ValveModelGate EQUATIONS #Conversion of units of inches at meter D_m = (ID*0.0254*'m'); #Fitting characteristics AFit = (Pi*(D_m^2))/4; V_Fit = (M_point/Rho_Sln)/AFit; #m/s #Reynolds number for fittings conditions Re = (Rho_Sln*D_m*V_Fit)/Mu_Sln; #dimensionless #Selection of K values in agrrement with elbows characteristics if Beta equal 1 then K1 = 300; Kinf = 0.1; else if Beta equal 0.9 then K1 = 500; Kinf = 0.15; else K1 = 1000; Kinf = 0.25; end end #Bernoulli Equation P2_out = P1_in - (Rho_Sln*H_f); #Factor K equation. K_100 = (K1/Re)+(Kinf*(1 + (1/ID))); #Correction for the valve aperture if Aperture equal 100 then K_valG = 1*K_100; else K_valG = (5e-6*(Aperture^(-3.31)))*K_100; end P1_in = FlowGate_inlet.P_P; M_point = FlowGate_inlet.M_point; Rho_Sln = FlowGate_inlet.Rho_Sln; Mu_Sln = FlowGate_inlet.Mu_Sln; #Equation for Pressure losses in Tee H_f = K_valG*((V_Fit^2)/2); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowGate_outlet.P_P; M_point1 = FlowGate_outlet.M_point; Rho_Sln1 = FlowGate_outlet.Rho_Sln; Mu_Sln1 = FlowGate_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Beta as positive(Brief="Characteristic of valve, Posible values: 1.0, 0.9 or 0.8"); Aperture as positive(Brief="Characteristic of valve, Posible values: 100, 75, 50 or 25"); SET Pi =3.1416; VARIABLES in FlowGate_inlet as StreamProcess (Brief="Process Stream"); M_point as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); out FlowGate_outlet as StreamProcess (Brief="Process Stream"); P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' K_valG as Real (Brief="K Factor valve"); #Dimensionless K_100 as Real (Brief="K Factor valve"); #Dimensionless D_m as length (Brief="Diameter in meter"); #m ID as Real (Brief="diameter in Inches"); #Inches Re as positive (Brief="Reynolds number"); #Dimensionless K1 as positive (Brief="K1 values of 2K Method"); #Dimensionless Kinf as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless V_Fit as velocity (Brief="Velocity in the fitting"); #m/s AFit as area (Brief = "Flow area"); #Unit='m^2' H_f as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); end Model ValveModelGlobe EQUATIONS #Conversion of units of inches at meter D_m = (ID*0.0254*'m'); #Fitting characteristics AFit = (Pi*(D_m^2))/4; V_Fit = (M_point/Rho_Sln)/AFit; #m/s #Reynolds number for fittings conditions Re = (Rho_Sln*D_m*V_Fit)/Mu_Sln; #dimensionless #Selection of K values in agrrement with elbows characteristics if Standard equal 1 then K1 = 1500; Kinf = 4; else if Butterfly equal 1 then K1 = 800; Kinf = 0.25; else if Y_type equal 1 then K1 = 1000; Kinf = 2; else K1 = 1000; Kinf = 2; end end end #Bernoulli Equation P2_out = P1_in - (Rho_Sln*H_f); #Factor K equation. K_100 = (K1/Re)+(Kinf*(1 + (1/ID))); #Correction for the valve aperture if Aperture equal 100 then K_valGl = 1*K_100; else K_valGl = (1061*(Aperture^(-1.51)))*K_100; end P1_in = FlowGlobe_inlet.P_P; M_point = FlowGlobe_inlet.M_point; Rho_Sln = FlowGlobe_inlet.Rho_Sln; Mu_Sln = FlowGlobe_inlet.Mu_Sln; #Equation for Pressure losses in Tee H_f = K_valGl*((V_Fit^2)/2); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowGlobe_outlet.P_P; M_point1 = FlowGlobe_outlet.M_point; Rho_Sln1 = FlowGlobe_outlet.Rho_Sln; Mu_Sln1 = FlowGlobe_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Butterfly as positive(Brief="Characteristic of valve, Posible values: 1 or 0"); Standard as positive(Brief="Characteristic of valve, Posible values: 1 or 0"); Y_type as positive(Brief="Characteristic of valve, Posible values: 1 or 0"); Aperture as positive(Brief="Characteristic of valve, Posible values: 100, 75, 50 or 25"); SET Pi =3.1416; VARIABLES in FlowGlobe_inlet as StreamProcess (Brief="Process Stream"); P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); M_point as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); out FlowGlobe_outlet as StreamProcess (Brief="Process Stream"); P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' K_valGl as Real (Brief="K Factor valve"); #Dimensionless K_100 as Real (Brief="K Factor valve"); #Dimensionless D_m as length (Brief="Diameter in meter"); #m ID as Real (Brief="diameter in Inches"); #Inches Re as positive (Brief="Reynolds number"); #Dimensionless K1 as positive (Brief="K1 values of 2K Method"); #Dimensionless Kinf as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless V_Fit as velocity (Brief="Velocity in the fitting"); #m/s AFit as area (Brief = "Flow area"); #Unit='m^2' H_f as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); end Model ValveModelCheck EQUATIONS #Conversion of units of inches at meter D_m = (ID*0.0254*'m'); #Fitting characteristics AFit = (Pi*(D_m^2))/4; V_Fit = (M_point/Rho_Sln)/AFit; #m/s #Reynolds number for fittings conditions Re = (Rho_Sln*D_m*V_Fit)/Mu_Sln; #dimensionless #Selection of K values in agrrement with elbows characteristics if Lift equal 1 then K1 = 2000; Kinf = 10; else if Swing equal 1 then K1 = 1500; Kinf = 1.5; else K1 = 1000; Kinf = 0.5; end end P1_in = FlowCheck_inlet.P_P; M_point = FlowCheck_inlet.M_point; Rho_Sln = FlowCheck_inlet.Rho_Sln; Mu_Sln = FlowCheck_inlet.Mu_Sln; #Bernoulli Equation P2_out = P1_in - (Rho_Sln*H_f); #Factor K equation. K_valC = (K1/Re)+(Kinf*(1 + (1/ID))); #Equation for Pressure losses in Tee H_f = K_valC*((V_Fit^2)/2); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowCheck_outlet.P_P; M_point1 = FlowCheck_outlet.M_point; Rho_Sln1 = FlowCheck_outlet.Rho_Sln; Mu_Sln1 = FlowCheck_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Swing as positive(Brief="Characteristic of valve, Posible values: 1.0, 0.9 or 0.8"); Lift as positive(Brief="Characteristic of valve, Posible values: 100, 75, 50 or 25"); SET Pi =3.1416; VARIABLES in FlowCheck_inlet as StreamProcess (Brief="Process Stream"); P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); M_point as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); out FlowCheck_outlet as StreamProcess (Brief="Process Stream"); P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' K_valC as Real (Brief="K Factor valve"); #Dimensionless D_m as length (Brief="Diameter in meter"); #m Re as positive (Brief="Reynolds number"); #Dimensionless K1 as positive (Brief="K1 values of 2K Method"); #Dimensionless Kinf as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless V_Fit as velocity (Brief="Velocity in the fitting"); #m/s AFit as area (Brief = "Flow area"); #Unit='m^2' H_f as Real (Brief="Total head losses of the contraction", Unit='m^2/s^2'); ID as Real (Brief="diameter in Inches"); #Inches end #Driving Machines Model ModelPump EQUATIONS P_Suc = FlowPump_inlet.P_P; M_point = FlowPump_inlet.M_point; Rho_Sln = FlowPump_inlet.Rho_Sln; Mu_Sln = FlowPump_inlet.Mu_Sln; #Ec. Bernoulli for determine discharge pressure of pump. P_dis = P_Suc + ((Rho_Sln/M_point)*(Pump_Eff*Pump_Pow)); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P_Suc - P_dis); P_dis = FlowPump_outlet.P_P; M_point1 = FlowPump_outlet.M_point; Rho_Sln1 = FlowPump_outlet.Rho_Sln; Mu_Sln1 = FlowPump_outlet.Mu_Sln; PARAMETERS Pump_Eff as fraction(Brief="Pump eficience as fraction 0 to 1"); Pump_Pow as power(Brief="Pump power in kW"); VARIABLES #Variables externas in FlowPump_inlet as StreamProcess (Brief="Process Stream"); out FlowPump_outlet as StreamProcess (Brief="Process Stream"); #Variables de transicion P_Suc as pressure(Brief="discharge pressure of pump", DisplayUnit='Pa');#Unit='atm' M_point as flow_mass(Brief="Mass flow solution"); #kg/s Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); P_dis as pressure(Brief="discharge pressure of pump", DisplayUnit='Pa');#Unit='atm' M_point1 as flow_mass(Brief="Mass flow solution"); #kg/s Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' end Model PowerPump EQUATIONS P_Suc = FlowPowerPump_inlet.P_P; M_point = FlowPowerPump_inlet.M_point; Rho_Sln = FlowPowerPump_inlet.Rho_Sln; Mu_Sln = FlowPowerPump_inlet.Mu_Sln; #Ec. Bernoulli for determine power pump. Pump_Pow = ((M_point/(Rho_Sln*Pump_Eff))*(P_dis-P_Suc)); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P_Suc - P_dis); P_dis = FlowPowerPump_outlet.P_P; M_point1 = FlowPowerPump_outlet.M_point; Rho_Sln1 = FlowPowerPump_outlet.Rho_Sln; Mu_Sln1 = FlowPowerPump_outlet.Mu_Sln; PARAMETERS Pump_Eff as fraction(Brief="Pump eficience as fraction 0 to 1"); VARIABLES #Variables externas in FlowPowerPump_inlet as StreamProcess (Brief="Process Stream"); out FlowPowerPump_outlet as StreamProcess (Brief="Process Stream"); DeltaP as Real (Brief="pressure at the outlet of the pipe 1", Unit='Pa'); Pump_Pow as power(Brief="Pump power in kW"); P_Suc as pressure(Brief="discharge pressure of pump", DisplayUnit='Pa');#Unit='atm' M_point as flow_mass(Brief="Mass flow solution"); #kg/s Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' P_dis as pressure(Brief="discharge pressure of pump", DisplayUnit='Pa');#Unit='atm' M_point1 as flow_mass(Brief="Mass flow solution"); #kg/s Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP end Model Tank1LModel EQUATIONS P2_out = P1_in + (Rho_Sln*g*(Z1-Z2)) - (Rho_Sln*Alpha*((Vexit^2)/2)) - (Rho_Sln*Hf1_2); V = Area_T*H_Tank; Area_T = (Pi*(Dtank^2))/4; ALine = (Pi*(DLine^2))/4; Vexit = (M_point/Rho_Sln)/ALine; #m/s #Reynolds number for pipe conditions Re = (Rho_Sln*DLine*Vexit)/Mu_Sln; #dimensionless #Decision for alpha value into Bernoullis equation if Re<2100 then Alpha=2; #Alpha for laminar flow else Alpha=1.01; #Alpha for turbulent flow end if incoming equal 1 then Ktank = 0.8; else if straight equal 1 then Ktank = 0.5; else Ktank = 0.2; end end Hf1_2 = Ktank*((Vexit^2)/2); M_point1 = M_point; Rho_Sln1 = Rho_Sln; Mu_Sln1 = Mu_Sln; DeltaP = (P1_in - P2_out); P2_out = FlowTank_outlet.P_P; M_point1 = FlowTank_outlet.M_point; Rho_Sln1 = FlowTank_outlet.Rho_Sln; Mu_Sln1 = FlowTank_outlet.Mu_Sln; PARAMETERS Pi as Real (Brief="Constant PI"); Dtank as length (Brief="Tank Diameter"); #Unit='m' DLine as length (Brief="Tank Diameter"); #Unit='m' g as Real (Brief="Gravity constant", Unit='m/s^2'); H_Tank as length (Brief="Tank Diameter"); #Unit='m' VARIABLES Area_T as area(Brief="Cross section area"); ALine as area(Brief="Cross section area"); V as volume (Brief="The model volume"); Z1 as length (Brief="height of Line 1"); #Unit='m' Z2 as length (Brief="height of Line 2"); #Unit='m' M_point as flow_mass(Brief="mass flow of entrace"); #Unit='m^3/s' Vexit as velocity (Brief="velocity inside the line 2"); #Unit='m/s' Ktank as positive (Brief="Kinfinite values of 2K Method"); #Dimensionless incoming as positive(Brief="Characteristic of exit tank"); straight as positive(Brief="Characteristic of exit tank"); P1_in as pressure (Brief="pressure at the outlet of the pipe 1", DisplayUnit='Pa'); Rho_Sln as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' Mu_Sln as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Hf1_2 as Real (Brief="Total head losses of the line plus fittings", Unit='m^2/s^2'); Alpha as positive (Brief="speed correction factor 1"); #Dimensionless Re as positive(Brief="Reynolds number for this line section 1"); #Dimensionless DeltaP as Real (Brief="losses pressure", Unit='Pa'); out FlowTank_outlet as StreamProcess (Brief="Process Stream"); P2_out as pressure(Brief="pressure at the outlet of the pipe 2", DisplayUnit='Pa'); M_point1 as flow_mass(Brief="Mass flow of entrace", Lower= 0.0005, Upper= 18000); #Unit='kg/s' Mu_Sln1 as viscosity (Brief="Viscosity of the Sln"); #Unit='cP' Rho_Sln1 as dens_mass (Brief="Density of the Sln"); #Unit='kg/m^3' end