---
quarto:
  styles:
    body:
      text-align: justify
---
# Economic analysis Tutorial 
This class is given by Du Wen (du.wen@epfl.ch).

## Overview
<p style="text-align: justify">
1. Learn the concepts of the economic analysis.
2. Learn how to estimate the CAPEX by using empirical equations in case studies. 
3. Learn the effect of size and time on the cost estimation.
</p>

## Economic estimation
<p style="text-align: justify">
There are five classes of economic analysis:\
**Class 5**: Order-of-magnitude estimate 
Normally, it requires only a block flow diagram.\
**Class 4**: Study estimate Based on the process flow diagram. Costs from generalized charts.\
**Class 3**: Preliminary estimate Based on PFD. Includes vessel sketches for major equipment, preliminary plot plan, and elevation diagram.\
**Class 2**: Definitive estimate Final PFD, vessel sketches, plot plan, and elevation diagrams, utility balances, and a preliminary piping and instrumentation diagram (P&ID).\
**Class 1**: Detailed estimate Final PFD and P&ID, vessel sketches, utility balances, plot plan and elevation diagrams, and piping isometrics. All diagrams are required to complete the construction of the plant if it is built.\
</p>

| Class | Complete definition | Purpose of estimation | Methodology |
|-|--|-----|-----|
| 5 | 0-2% | Screening or Feasibility | Stochastic or Judgment |
| 4 | 1-15% | Concept Study or Feasibility | Primarily Stochastic |
| 3 | 10-40% | Budget, authorization or Control | Mixed but Primarily Stochastic |
| 2 | 30-70% | Control or Tender | Primarily Deterministic |
| 1 | 50-100% | Check Estimate or Tender | Deterministic |
: Classification of economic analysis{#tbl-1}

## CAPEX estimation
<p style="text-align: justify">
1. Purchase cost estimation (method 1):\
**Hint**: use this empirical equation from the reference (Turton, et al. Analysis, Synthesis, and Design of Chemical Processes). You can find the correlation coefficients in the Appendix. Please be careful about the choice of size parameter S_a and the range of it.
</p>
$$
log_{10}𝐶_𝑃^0=𝐾_1+𝐾_2 log_{10}𝑆_𝑎+𝐾_3 (log_{10}𝑆_𝑎 )^2
$$

<p style="text-align: justify">
2. Purchase cost estimation (method 2):\
**Hint**: this equation has a larger error than method 1. use this equation to scale up or down the cost you find in the references. It is a nonlinear relationship and the effect of time should be considered.
</p>
$$
\frac{{𝐶_𝑃^0}_a}{{𝐶_𝑃^0}_{𝑟𝑒𝑓}}=(\frac{𝑆_𝑎}{𝑆_{𝑟𝑒𝑓}})^𝑛\frac{I_{2022}}{I_{2009}}
$$

<p style="text-align: justify">
3. Bare module cost estimation:\
**Hint**: bare module cost considers the effects of pressure, material, and temperature on the purchase cost. The choice of bare module factor $𝐹_{𝐵𝑀}$, pressure factor $𝐹_𝑃$, material factor $𝐹_𝑀$, and temperature factor $𝐹_T$ is case by case according to the reference (Turton, et al. Analysis, Synthesis, and Design of Chemical Processes).
</p>
$$
𝐶_{𝐵𝑀}=𝐶_𝑃^0𝐹_{𝐵𝑀}=𝐶_𝑃^0(𝐵_1+𝐵_2𝐹_𝑀𝐹_𝑃 )=𝐶_𝑃^0𝐹_{BM}𝐹_P𝐹_T
$$

<p style="text-align: justify">
4. Total module cost estimation:\
**Hint**: consider the contingency and fee costs.
</p>
$$
𝐶_{𝑇𝑀}=1.18\sum_{e=1}^{n} 𝐶_{𝐵𝑀,𝑒}
$$

<p style="text-align: justify">
5. Grass root cost estimation (CAPEX):\
**Hint**: consider the auxiliary facilities costs.
</p>
$$
𝐶𝐴𝑃𝐸𝑋=𝐶_{𝐺𝑅}=𝐶_{𝑇𝑀}+0.5\sum_{e=1}^{n} 𝐶_{𝐵𝑀,𝑒}
$$

<p style="text-align: justify">
6. Annualized CAPEX:\
**Hint**: the annualized CAPEX can be compared with OPEX and annual revenue. It depends on the interest rate $i$ and the lifetime of the system $n$.
</p>
$$
\frac{𝐹_{𝑛, 𝑎𝑛𝑛𝑢𝑎𝑙𝑖𝑧𝑒𝑑}}{𝐶𝐴𝑃𝐸𝑋}=\frac{𝑖(1+𝑖)^𝑛}{(1+𝑖)^𝑛-1} 
$$

## Case study 1 - compressor
<p style="text-align: justify">
The rated power of a centrifugal compressor is 1000 kW. The material is stainless steel. The working pressure is 3 bar. Calculate the bare module cost of the compressor.\
**step 1**: estimate the purchase cost $𝐶_𝑃^0$ according to the rated power and the equipment cost data.\
</p>
```{r url-render, out.width='80%', fig.align='center', fig.cap='Equipment cost data'}
#| label: fig-1
knitr::include_graphics('Figures/Figure 8.1.png')
```
<p style="text-align: justify">
**step 2**: choose the reasonalable bare module cost factor $𝐹_{𝐵𝑀}$, pressure factor $𝐹_𝑃$, material factor $𝐹_𝑀$, and temperature factor $𝐹_T$ if it exists.\
</p>
```{r url-render, out.width='80%', fig.align='center', fig.cap='Pressure factor'}
#| label: fig-2
knitr::include_graphics('Figures/Figure 8.2.png')
```

```{r url-render, out.width='80%', fig.align='center', fig.cap='Equations for bare module cost'}
#| label: fig-3
knitr::include_graphics('Figures/Figure 8.3.png')
```

```{r url-render, out.width='80%', fig.align='center', fig.cap='Identification for the material factor'}
#| label: fig-4
knitr::include_graphics('Figures/Figure 8.4.png')
```

```{r url-render, out.width='80%', fig.align='center', fig.cap='bare module cost factor'}
#| label: fig-5
knitr::include_graphics('Figures/Figure 8.5.png')
```

## Case study 2 - multi-tubular reactor
<p style="text-align: justify">
A multi-tubular reactor mainly has four parts - head, shell, tube, and baffle. In this case study, we will use another estimation method that separately considers each part of the reactor.\
</p>

| Name | Symbol | Value | Unit | Comment |
|--------|--------|--------|--------|--------|
| volumetric flow rate | $m_{fluid}$ | 2370.6 | $m^3/h$ | Aspen |
| reactor heat | $Q_{reactor}$ | 2643 | kW | Aspen |
| reactor temperature  | $t_{reactor}$ | 250| °C | Aspen |
| reactor pressure | $P_{reactor}$ | 50 | bar | Aspen |
| fluid density | $\rho_{fluid}$ | 5.05 | $kg/m^3$ | |
| fluid viscosity | $\mu_{fluid}$ | 1.66E-05 | $Ns/m^2$ | |
| reactor volume | $V_{reactor}$ | 3.835 | $m^3$ | |
| void fraction | $\epsilon$ | 0.98 | - | |
| particle effective diameter |$D_p$ | 0.005 | $m$ | |
| inner diamater | $D_{tube}$ | 0.025 | $m$ | |
| fluid velocity | $v_{fluid}$ | 1 | $m/s$ | |
| tube thickness | $t_{tube}$ | 0.0021 | $m$ | |
| steel density | $\rho_{steel}$ | 8000 | $kg/m^3$ | |
| steel price | $C_{steel}$ | 0.783 | $$/kg$ | |
| number of baffle | $N_{baffle}$ | 3 | - | |
| specific heat | $Cp$ | 2.162 | $kJ/kg°C$ | |
| inlet temperature of HTF | $T_{HTF,in}$ | 220 | $°C$ | |
| outlet temperature of HTF | $T_{HTF,out}$ | 240 | $°C$ | |
| HTF density | $\rho_{HTF}$ | 878.6 | $kg/m^3$ | |
| HTF viscosity | $\mu_{HTF}$ | 3.2E-07 | $Ns/m^2$ | |
| shell thickness | $t_{shell}$ | 0.0021 | $m$ | |
: Given information {#tbl-2}

<p style="text-align: justify">
**step 1**: calculate the length and number of tubes. (The number of tubes must be an integer.)\
</p>

1. Number of tubes $N_{tube}$:\
$$
N_{tube}=\frac{m_{fluid}}{0.25\pi D_{tube}^2v_{fluid}}
$$

2. Length of tubes $L_{tube}$:\
$$
L_{tube}=\frac{V_{reactor}}{0.25\pi D_{tube}^2 N_{tube}}
$$

**step 2**: check the pressure drop in the tube.\
$$
\frac{\Delta P}{L_{tube}}=150\frac{(1-\epsilon)^2}{\epsilon^3}\frac{v_{fluid}\mu_{fluid}}{D_p^2}+1.75\frac{1-\epsilon}{\epsilon^3}\frac{\rho_{fluid}v_{fluid}^2}{D_p}
$$

**step 3**: calculate the cost of tubes.\ 
$$
C_{tube}=\frac{\pi}{4}N_{tube}((D_{tube}+2t_{tube})^2-D_{tube}^2)L_{tube}\rho_{steel} C_{steel}
$$

**step 4**: calculate the shell diameter.\

1. Choose pitch - triangular with one pass.\
```{r url-render, out.width='80%', fig.align='center', fig.cap='Coefficients for the calculation of bundle diameter'}
#| label: fig-6
knitr::include_graphics('Figures/Figure 8.6.png')
```

2. calculate bundle diameter $D_{bundle}$:\
$$
d_0 = D_{tube}+2t_{tube}\\
D_{bundle}=d_0（\frac{N_{tube}}{K_1}）^\frac{1}{n_1}
$$

3. calculate the shell diameter $D_{shell}$:\
$$
D_{shell}=D_{bundle}+0.098
$$

**step 5**: check the pressure drop in the shell.\

1. calculate the cross-sectional area of shell $A_{shell}$:\
$$
A_{shell}=\frac{(p_t-d_0)D_{shell}s_{baffle}}{p_t}\\
p_t=1.25d_0\\
s_{baffle}=\frac{D_{shell}}{N_{baffle}}
$$

2. calculate the mass flow rate of the HTF $m_{HTF}$:\
$$
m_{HTF}=\frac{Q_{reactor}}{Cp(T_{HTF,out}-T_{HTF,in})}
$$

3. calculate the velocity of the HTF $v_{HTF}$:\
$$
v_{HTF}=\frac{m_{HTF}}{A_{shell}\rho_{HTF}}
$$

4. calculate the hydraulic diameter of the shell $D_{shell,eq}$:\
$$
D_{shell,eq}=\frac{1.1}{d_0}(p_t^2-0.917d_0^2)
$$

5. calculate the pressure drop in the shell:\
$$
\Delta P=4\frac{D_{shell}}{D_{shell,eq}}\frac{L_{tube}}{s_{baffle}}\frac{\rho_{HTF}v_{HTF}^2}{2}
$$

**step 6**: calculate the cost of shell.\

1. calculate the weight of shell $S$:\
$$
S=\pi D_{shell}L_{tube}t_{shell}\rho_{steel}
$$

2. calculate the cost using an emperical equation:\
$$
C_{shell}=a+bS^n
$$

**Hint**: it is vertical and made by carbon steel.\
```{r url-render, out.width='80%', fig.align='center', fig.cap='purchase cost data'}
#| label: fig-7
knitr::include_graphics('Figures/Figure 8.7.png')
```

**step 7**: calculate the cost of head.\
$$
C_{head}=\pi D_{shell}^2t_{shell}rho_{steel} C_{steel}
$$

**step 8**: calculate the total cost.\
$$
C_{reactor}=C_{tube}+C_{shell}+C_{head}
$$

You can play with the code to calculate the reactor

```{python}
import numpy as np
import math
# Information from Aspen, need the path from ASPEN, be careful of the unit
volumetric_flow_rate = 2370.644		# m3/h
m_fluid = volumetric_flow_rate/3600	# m3/s, volumetric flow rate
vis_fluid = 1.66E-05				# Ns/m2, viscosity
rho_fluid = 5.05					  # kg/m3, density
reactor_volume = 3.835			# m3
residence_time = 5.8237			# s
reactor_pressure = 50				# bar
reactor_temperature = 250		# °C
mass_catalyst = 118.5				# kg
reactor_heat = 2643					# kW, need to be cooled down
GHSV = 20							      # m3/(kg_cat h)
# catalyst properties
rho_catalyst = 30.9					# kg/m3, catalyst bed density
vf_bed = 0.98						    # void fraction of bed
dp = 0.005				 			    # m, particle effective diameter
# step one: calculate the length and number of tubes
# choose the appropriate diameter and velocity
reactor_volume = mass_catalyst/rho_catalyst	 # m3
dt = 0.025							    # m, inner diamater in industrial fixed bed reactors
v_fluid = 1							    # m/s, velocity based on an industrial multitubular reactor
N_tubes = math.ceil(m_fluid/(v_fluid*0.25*np.pi*dt**2)) 	# number of tubes
L_tubes = reactor_volume/(N_tubes*0.25*np.pi*dt**2)			  # m, length of tubes
# step two: check performance indicators, pressure drop within 10% is necessary
delt_P_tube = (150*(1-vf_bed)**2*vis_fluid*v_fluid/(vf_bed**3*dp**2)+1.75*(1-vf_bed)*rho_fluid*v_fluid**2/(vf_bed**3*dp))*L_tubes	# Pa
# step three: calculate the cost of tubes
delt_t_tube = 0.0021 				# m, thickness
C_steel = 0.783						  # $/kg, price of steel
rho_steel = 8000					  # kg/m3 density of steel
CBM_tubes = N_tubes*0.25*np.pi*((dt+2*delt_t_tube)**2-dt**2)*L_tubes*rho_steel*C_steel	# $
# step four: calculate the diameter of shell
a = 1.25 							      # decide pitch, coefficient for triangular
db = (dt+2*delt_t_tube)*(N_tubes/0.319)**(1/2.142)	# m, bundle diameter
b = 0.098							      # m, shell bundle clearance
ds = db+b 							    # m, shell diameter
N_baffles = 3 						  # number of baffles
s_baffles = ds/N_baffles			  # m, baffle spacing
pitch = a*(dt+2*delt_t_tube)		# m, pitch
A_shell = (pitch-dt-2*delt_t_tube)*ds*s_baffles/pitch	# m2, shell area
# step five: choose heat transfer fluid and calculate heat transfer area
U = 0.14							    # kW/m2K, heat transfer coefficient
t_HTF_in = 220						# °C, inlet temperature
t_HTF_out = 240						# °C, outlet temperature
Cp = 2.162 							  # kJ/kg°C, specific heat (average of two temperature), need to chcek the tabel
m_HTF = reactor_heat/(Cp*(t_HTF_out-t_HTF_in)) # kg/s, mass flow rate of heat transfer fluid
# calculate the pressure drop 
H_shell = m_HTF/A_shell 			# kg/m2.s, flux
rho_HTF = 878.6						    # kg/m3, density (average of two temperature), need to chcek the tabel 
v_HTF = H_shell/rho_HTF    		# m/s, velocity of HTF
dse = 1.1*(pitch**2-0.917*(dt+2*delt_t_tube)**2)/(dt+2*delt_t_tube) # m, shell side equivalent diameter hydraulic diameter
vis_HTF = 3.2E-07					    # Ns/m2, viscosity of heat transfer fluid
Re = H_shell*dse/vis_HTF			# Reynold
c = 0.51 							        # read figure
delt_P_shell = 8*c*(ds/dse)*(N_baffles+1)*(0.5*rho_HTF*v_HTF**2)*0.001 # kPa
delt_t_shell = 0.007				  # m, hemispherical head for high pressure
V_shell_head = np.pi*(ds)**2*delt_t_shell # volume of enclosure
M_head = V_shell_head*rho_steel		  # kg, head weight
M_shell = 2*np.pi*(ds/2)*L_tubes*delt_t_shell*rho_steel # kg, vessel weight
CBM_shell = 10000+29*M_shell**0.85  # $, 2007 CEPCI = 509.7
CBM_head = M_head*C_steel
# calculate the total cost
CBM_reactor = CBM_head+CBM_shell+CBM_tubes	# careful about the year
```