function pressureVesselCost_V
import SI = Modelica.SIunits;
import nSI = Modelica.SIunits.Conversions.NonSIunits;
import CN = Modelica.Constants;
import CV = Modelica.SIunits.Conversions;
import FI = SolarTherm.Models.Analysis.Finances;
type Pressure_psi = Real(final quantity = "Pressure", final unit = "psi");
type Density_lb_in = Real(final quantity = "Density", final unit = "lb/in3", min = 0);
type Mass_lb = Real(quantity = "Mass", final unit = "lb", min = 0);
type Length_in = Real(final quantity = "Length", final unit = "in", min = 0);
extends Modelica.Icons.Function;
input Modelica.SIunits.Volume V "Tank volume";
input Real f_bm "Bare module factor for the syngas storage tank";
output Integer n_st "Number of tanks required";
output FI.Money C_cap "Capital cost in AUD";
function volume_d "Tank volume as a function of internal diameter"
extends Modelica.Icons.Function;
input Length_in d1 "Tank internal diameter";
output Modelica.SIunits.Volume V1 "Tank volume";
algorithm
V1 := 19.0*CN.pi*((d1*0.0254)^3)/12.0;
end volume_d;
function diameter_v "Tank internal diameter as a function of volume"
extends Modelica.Icons.Function;
input Modelica.SIunits.Volume V2 "Tank volume";
output Length_in d6 "Tank internal diameter";
algorithm
d6 := 39.3701*(((12.0*V2)/(19.0*CN.pi))^(1.0/3.0));
end diameter_v;
function pressure "Tank internal design gauge pressure as a function of tank operating gauge pressure"
extends Modelica.Icons.Function;
input Pressure_psi p1 "Tank operating gauge pressure";
output Pressure_psi p_des "Tank internal design gauge pressure";
algorithm
p_des := exp(0.60608 + 0.91615*log(p1) + 0.0015655*(log(p1)^2.0));
end pressure;
function thickness "Wall thickness to withstand the internal pressure"
extends Modelica.Icons.Function;
input Pressure_psi p2 "Tank internal design gauge pressure";
input Length_in d2 "Tank internal diameter";
input Pressure_psi s1 "Maximum allowable stress of the shell material at the design temperature";
input Real e1 "Fractional weld efficiency";
output Length_in t1 "Tank thickness";
algorithm
t1 := (p2*d2)/(2.0*s1*e1 - 1.2*p2);
end thickness;
function thickness_min "Minimum thickness allowed at the diameter given"
extends Modelica.Icons.Function;
input Length_in d3 "Tank internal diameter";
output Length_in t2 "Tank minimum thickness";
algorithm
if (d3*0.0833333) > 12.0 then
// i.e. d3 > 12 ft
t2 := 5.0/8.0;
elseif (d3*0.0833333) <= 12.0 and (d3*0.0833333) > 10.0 then
// i.e. 10 < d3 <= 12 ft
t2 := 1.0/2.0;
elseif (d3*0.0833333) <= 10.0 and (d3*0.0833333) > 8.0 then
// i.e. 8 < d3 <= 10 ft
t2 := 7.0/16.0;
elseif (d3*0.0833333) <= 8.0 and (d3*0.0833333) > 6.0 then
// i.e. 6 < d3 <= 8 ft
t2 := 3.0/8.0;
elseif (d3*0.0833333) <= 6.0 and (d3*0.0833333) > 4.0 then
// i.e. 4 < d3 <= 6 ft
t2 := 5.0/16.0;
else
// i.e. 0 < d3 <= 4 ft
t2 := 0.25;
end if;
end thickness_min;
function weight "Weight of the shell and the two 2:1 elliptical heads"
extends Modelica.Icons.Function;
input Length_in d4 "Tank internal diameter";
input Length_in t3 "Tank thickness";
input Length_in l1 "Tank length accounting for the cylinder only";
input Density_lb_in rho1 "Density of the tank material";
output Mass_lb w1 "Tank weight";
algorithm
w1 := CN.pi*(d4 + t3)*(l1 + 0.8*d4)*t3*rho1;
end weight;
function CostEmpty_st "The f.o.b purchase cost of the empty vessel"
extends Modelica.Icons.Function;
input Mass_lb w2 "Tank weight";
input Real uf1 "Update factor";
input Real r_cur1 "The currency rate from AUD to USD";
output FI.Money C_v "The f.o.b purchase cost of the empty vessel in AUD";
algorithm
C_v := exp(8.9552 - 0.2330*log(w2) + 0.04333*(log(w2)^2.0))*uf1/r_cur1;
end CostEmpty_st;
function CostAdd_st "The added cost of the platforms and ladders"
extends Modelica.Icons.Function;
input Length_in d5 "Tank internal diameter";
input Real uf2 "Update factor";
input Real r_cur2 "The currency rate from AUD to USD";
output FI.Money C_pl "The added cost of the platforms and ladders in AUD";
algorithm
C_pl := 2005*(d5^0.20294)*uf2/r_cur2;
end CostAdd_st;
function Cost_st "The total f.o.b. purchase cost of the vessel"
extends Modelica.Icons.Function;
input Real fm1 "Material factor ";
input FI.Money C_v1 "The f.o.b purchase cost of the empty vessel";
input FI.Money C_pl1 "The added cost of the platforms and ladders";
output FI.Money C_st "The f.o.b. purchase cost of the vessel in AUD";
algorithm
C_st := fm1*C_v1 + C_pl1;
end Cost_st;
end pressureVesselCost_V;