Skip to content

Commit

Permalink
Fix LCOW calculation for hybrid
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuoran29 committed Dec 30, 2021
1 parent ad4ae12 commit 04be715
Show file tree
Hide file tree
Showing 12 changed files with 323 additions and 310 deletions.
19 changes: 9 additions & 10 deletions DesalinationModels/MDB_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,15 @@ def lcow(self):
self.cost_th = self.STEC * (self.fuel_usage * self.coh + (1-self.fuel_usage) * self.sam_coh)
self.OPEX = self.cost_elec + self.cost_th + self.cost_module_re + self.other_OM + self.insurance

CF_factor = (1000*self.int_rate*(1+self.int_rate)**self.yrs) / ((1+self.int_rate)**self.yrs-1) / (self.Prod+0.1)
print('Membrane cost:', self.MD_membrane * self.Area * self.num_modules * CF_factor)
print('Module assembly:', self.MD_module*self.MD_module_capacity*(self.num_modules/self.MD_module_capacity)**0.8*CF_factor)
print('HX_cost:', self.HX_cost * CF_factor)
print('other_cap:', self.other_cap * CF_factor)
print('Elec cost:', self.cost_elec)
print('Thermal cost', self.cost_th)
print('Cost of membrane replacemenet:', self.cost_module_re)
print('other_OM', self.other_OM+self.insurance)

# CF_factor = (1000*self.int_rate*(1+self.int_rate)**self.yrs) / ((1+self.int_rate)**self.yrs-1) / (self.Prod+0.1)
# print('Membrane cost:', self.MD_membrane * self.Area * self.num_modules * CF_factor)
# print('Module assembly:', self.MD_module*self.MD_module_capacity*(self.num_modules/self.MD_module_capacity)**0.8*CF_factor)
# print('HX_cost:', self.HX_cost * CF_factor)
# print('other_cap:', self.other_cap * CF_factor)
# print('Elec cost:', self.cost_elec)
# print('Thermal cost', self.cost_th)
# print('Cost of membrane replacemenet:', self.cost_module_re)
# print('other_OM', self.other_OM+self.insurance)

self.LCOW = self.CAPEX + self.OPEX

Expand Down
4 changes: 2 additions & 2 deletions DesalinationModels/RO_FO.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def simulation(self, elec_gen, thermal_gen, solar_type = "pv", storage = 0 ): #
elec_load = load

grid_percentage = sum(grid)/sum(energy_consumption)*100
fossil_percentage = 1
fossil_percentage = 100
Month = [0,31,59,90,120,151,181,212,243,273,304,334,365]
Monthly_prod = [ sum( prod[Month[i]*24:(Month[i+1]*24)] ) for i in range(12) ]

Expand Down Expand Up @@ -222,7 +222,7 @@ def simulation(self, elec_gen, thermal_gen, solar_type = "pv", storage = 0 ): #
th_energy_consumption = energy_consumption
elec_load = [0]

grid_percentage = 1
grid_percentage = 100
fossil_percentage = sum(fuel)/sum(energy_consumption)*100
Month = [0,31,59,90,120,151,181,212,243,273,304,334,365]
Monthly_prod = [ sum( prod[Month[i]*24:(Month[i+1]*24)] ) for i in range(12) ]
Expand Down
4 changes: 2 additions & 2 deletions DesalinationModels/RO_FO_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ def lcow(self):
self.cost_heat = self.FO_STEC * (self.FO_fuel_usage * self.coh + (1-self.FO_fuel_usage) * self.sam_coh)


self.RO_OPEX = self.cost_elec+self.chem_cost +self.labor_cost + self.membrane_replacement_cost#maintenance and membrane replacement
self.RO_OPEX = self.cost_elec + self.chem_cost +self.labor_cost + self.membrane_replacement_cost#maintenance and membrane replacement
self.FO_OPEX = self.cost_heat + self.FO_labor + self.FO_chem_cost + self.FO_goods_cost

self.insurance_cost = (self.RO_CAPEX + self.FO_CAPEX ) *self.insurance / (self.Prod+0.1)
self.OPEX = self.RO_OPEX + self.FO_OPEX + self.disposal_cost
self.CAPEX = (self.RO_CAPEX + self.FO_CAPEX ) / self.Prod
self.LCOW = self.CAPEX + self.OPEX + self.insurance_cost
self.LCOW = self.CAPEX + self.OPEX + self.insurance_cost
# self.test=(self.total_capex*self.int_rate*(1+self.int_rate)**self.yrs) / ((1+self.int_rate)**self.yrs-1) / self.ann_prod
cost_output = []
cost_output.append({'Name':'Desal Annualized CAPEX','Value':self.CAPEX,'Unit':'$/m3'})
Expand Down
14 changes: 7 additions & 7 deletions DesalinationModels/RO_MDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ def design(self):
def simulation(self, elec_gen, thermal_gen, solar_type = "pv", storage = 0 ): # solar_type = (pv, csp, thermal)
gen = elec_gen
if solar_type == 'pv':
self.elec_load = self.design_output[5]['Value'] # kWh
self.thermal_load = self.design_output[6]['Value']*1000 # kWh
self.elec_load = self.design_output[6]['Value'] # kWh
self.thermal_load = self.design_output[7]['Value']*1000 # kWh
self.max_prod = self.capacity / 24 # m3/h
self.storage_cap = 0 # kWh
self.Fossil_f = 1
Expand Down Expand Up @@ -197,13 +197,13 @@ def simulation(self, elec_gen, thermal_gen, solar_type = "pv", storage = 0 ): #
elec_load = load

grid_percentage = sum(grid)/sum(energy_consumption)*100
fossil_percentage = 1
fossil_percentage = 100
Month = [0,31,59,90,120,151,181,212,243,273,304,334,365]
Monthly_prod = [ sum( prod[Month[i]*24:(Month[i+1]*24)] ) for i in range(12) ]

if solar_type == 'thermal':
gen = thermal_gen
self.thermal_load = self.design_output[6]['Value'] * 1000 # kWh
self.thermal_load = self.design_output[7]['Value'] * 1000 # kWh
self.max_prod = self.capacity / 24 # m3/h
self.storage_cap = 0 # kWh
self.Fossil_f = 1
Expand Down Expand Up @@ -238,15 +238,15 @@ def simulation(self, elec_gen, thermal_gen, solar_type = "pv", storage = 0 ): #

elec_load = [0]

grid_percentage = 1
grid_percentage = 100
fossil_percentage = sum(fuel)/sum(energy_consumption)*100
Month = [0,31,59,90,120,151,181,212,243,273,304,334,365]
Monthly_prod = [ sum( prod[Month[i]*24:(Month[i+1]*24)] ) for i in range(12) ]

if solar_type == 'csp':
gen = thermal_gen
self.elec_load = self.design_output[5]['Value']
self.thermal_load = self.design_output[6]['Value'] * 1000 # kWh
self.elec_load = self.design_output[6]['Value']
self.thermal_load = self.design_output[7]['Value'] * 1000 # kWh
self.max_prod = self.capacity / 24 # m3/h
self.storage_cap = 0 # kWh
self.Fossil_f = 1
Expand Down
17 changes: 9 additions & 8 deletions DesalinationModels/RO_MDB_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def __init__(self,
# self.Pflux = Pflux
self.Area = Area
# self.PF_module = self.Pflux * self.Area
self.num_modules = NV*Nel
self.total_area = self.num_modules*self.Area
self.total_area = NV*Nel*self.Area
self.membrane_cost=membrane_cost
self.pressure_vessel_cost=pressure_vessel_cost
self.NV=NV
Expand Down Expand Up @@ -149,7 +148,8 @@ def __init__(self,
self.Pflux = Pflux
self.MDB_Area = MDB_Area
self.PF_module = self.Pflux * self.MDB_Area
self.num_modules = math.ceil(Capacity[0] *1000 / self.PF_module / self.operation_hour)
self.MDB_capacity = MDB_capacity
self.num_modules = math.ceil(MDB_capacity *1000 / self.PF_module / self.operation_hour)
self.HX_eff = HX_eff
self.solar_inlet = solar_inlet
self.solar_outlet = solar_outlet
Expand Down Expand Up @@ -226,20 +226,20 @@ def lcow(self):

# Energy cost
self.cost_elec = (self.SEC + self.MDB_SEC) * (self.grid_usage * self.coe + (1-self.grid_usage) * self.sam_coe)

self.cost_heat = self.MDB_STEC * (self.MDB_fuel_usage * self.coh + (1-self.MDB_fuel_usage) * self.sam_coh)

# RO OM cost
self.RO_OPEX = self.disposal_cost+self.cost_elec+self.chem_cost +self.labor_cost + self.membrane_replacement_cost#maintenance and membrane replacement
# MDB OM cost
self.other_OM = self.MDB_CAPEX *0.018 / self.Prod
self.MDB_OPEX = self.cost_module_re + self.other_OM
self.MDB_OPEX = self.cost_module_re + self.other_OM + self.cost_heat

self.OPEX = self.RO_OPEX + self.MDB_OPEX
self.insurance_cost = (self.RO_CAPEX + self.MDB_CAPEX ) * self.insurance / (self.Prod)
#### ADD disposal cost
self.CAPEX = (self.RO_CAPEX + self.MDB_CAPEX ) / self.Prod
self.LCOW = self.CAPEX + self.OPEX
self.LCOW = self.CAPEX + self.OPEX + self.insurance_cost

# self.test=(self.total_capex*self.int_rate*(1+self.int_rate)**self.yrs) / ((1+self.int_rate)**self.yrs-1) / self.ann_prod
cost_output = []
cost_output.append({'Name':'Desal Annualized CAPEX','Value':self.CAPEX,'Unit':'$/m3'})
Expand All @@ -250,7 +250,8 @@ def lcow(self):
cost_output.append({'Name':'Levelized cost of electricity (from solar field)','Value':self.sam_coe,'Unit':'$/m3'})
cost_output.append({'Name':'Levelized cost of heat (from fossile fuel)','Value':self.coh,'Unit':'$/m3'})
cost_output.append({'Name':'Levelized cost of heat (from solar field)','Value':self.sam_coh,'Unit':'$/m3'})
# cost_output.append({'Name':'Energy cost','Value':self.cost_elec,'Unit':'$/m3'})
cost_output.append({'Name':'Electricity cost','Value':self.cost_elec,'Unit':'$/m3'})
cost_output.append({'Name':'Thermal energy cost','Value':self.cost_heat,'Unit':'$/m3'})

return cost_output

Expand Down
3 changes: 3 additions & 0 deletions DesalinationModels/VAGMD_batch/VAGMD_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ def design(self):
self.num_modules = math.ceil(self.Capacity *1000 / (self.AccVd[-1] / self.t[-1] * 24) )
self.ave_stec = sum(self.STEC)/len(self.STEC)
self.PFlux_avg= sum(self.PFlux) / len(self.PFlux)
print(self.FeedC_r)
print('PFlux:', self.PFlux_avg, len(self.PFlux))
print('STEC', self.STEC[-1])
self.df = self.df.round(decimals = 1)
self.df.to_csv(cfg.sam_results_dir/'MDB_output.csv')
self.P_req = self.STEC[-1] * self.Capacity / 24 # kW
Expand Down
7 changes: 3 additions & 4 deletions SAM_flatJSON/SamBaseClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ def cost(self, desal):

elif desal == 'OARO':
from DesalinationModels.OARO_cost import OARO_cost
print('lcoe', self.lcoe)
self.LCOW = OARO_cost(Capacity = self.desal_values_json['Capacity'], Prod = (self.simu_output[4]['Value']), fuel_usage = self.simu_output[7]['Value'], oaro_area = self.costout['oaro_area'], ro_area = self.costout['ro_area'], yrs = self.cost_values_json['yrs'], int_rate = self.cost_values_json['int_rate'], coe = self.cost_values_json['coe'],
downtime = self.cost_values_json['downtime'],chem_cost = self.cost_values_json['chem_cost'], labor_cost = self.cost_values_json['labor_cost'], rep_rate = self.cost_values_json['rep_rate'], pumpcost = self.costout['pumpcost'], erdcost = self.costout['erdcost'], ro_cost = self.cost_values_json['ro_cost'], oaro_cost = self.cost_values_json['oaro_cost'],
solar_coe = self.cost_values_json['solar_coe'], sec = self.costout['sec'], sam_coe = self.lcoe, practical_inv_factor = self.cost_values_json['practical_inv_factor'], storage_cap = self.OARO.storage_cap )
Expand Down Expand Up @@ -915,7 +914,7 @@ def cost(self, desal):
unit_capex = [self.cost_values_json['unit_capex']]
self.LCOW = RO_MDB_cost(Capacity = Capacity, Prod = self.simu_output[4]['Value'],chem_cost = self.cost_values_json['chem_cost'], labor_cost = self.cost_values_json['labor_cost'],
unit_capex = unit_capex, rep_rate = self.cost_values_json['rep_rate'],
MDB_Area = self.RO_MDB.MDB.Area, Pflux = self.RO_MDB.MDB.PFlux[0], TCO = self.RO_MDB.MDB.TCO[0], TEI = self.RO_MDB.MDB.TEI_r, FFR = self.RO_MDB.MDB.FFR_r,
MDB_Area = self.RO_MDB.MDB.Area, Pflux = self.RO_MDB.MDB.PFlux_avg, TCO = self.RO_MDB.MDB.TCO[0], TEI = self.RO_MDB.MDB.TEI_r, FFR = self.RO_MDB.MDB.FFR_r,
th_module = self.RO_MDB.MDB.ThPower[0],
MD_membrane = self.cost_values_json['MD_membrane'], MD_module = self.cost_values_json['MD_module'],
MD_module_capacity = self.cost_values_json['MD_module_capacity'], HX = self.cost_values_json['HX'],
Expand All @@ -927,8 +926,8 @@ def cost(self, desal):
pump_capacity = self.cost_values_json['pump_capacity'], other = self.cost_values_json['other'],

cost_storage = self.cost_values_json['cost_storage'], insurance = self.cost_values_json['insurance'],
MDB_SEC = self.RO_MDB.MDB.SEEC[-1], MDB_capacity = self.design_output[2]['Value'], MDB_STEC = self.design_output[8]['Value'], disposal_cost = self.cost_values_json['disposal_cost'],
MDB_fuel_usage = self.simu_output[8]['Value'], coe = self.cost_values_json['coe'], solar_coe = self.cost_values_json['solar_coe'], solar_coh = self.cost_values_json['solar_coh'], coh = self.cost_values_json['coh'], sam_coe = self.sam_lcoe, sam_coh = self.sam_lcoh)
MDB_SEC = self.RO_MDB.MDB.SEEC[-1], MDB_capacity = self.design_output[3]['Value'], MDB_STEC = self.design_output[9]['Value'], disposal_cost = self.cost_values_json['disposal_cost'],
grid_usage = self.simu_output[7]['Value'], MDB_fuel_usage = self.simu_output[8]['Value'], coe = self.cost_values_json['coe'], solar_coe = self.cost_values_json['solar_coe'], solar_coh = self.cost_values_json['solar_coh'], coh = self.cost_values_json['coh'], sam_coe = self.sam_lcoe, sam_coh = self.sam_lcoh)
self.cost_output = self.LCOW.lcow()

elif desal == 'Generic':
Expand Down
2 changes: 1 addition & 1 deletion SAM_flatJSON/defaults/RO_MDB.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"TCI_r" : 25,
"FFR_r" : 582.7,
"FeedC_r" : 35,
"V0": 30,
"V0": 50,
"RR": 30,
"j": "c",
"Ttank": 25,
Expand Down
2 changes: 1 addition & 1 deletion SAM_flatJSON/models/inputs/OARO_inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{
"DataType": "SSC_NUMBER",
"Name": "FeedC_r",
"Label": "Feed concentration (Please select 20, 35, 70 or 125 g/L)",
"Label": "Feed concentration (Acceptable values are 20, 35, 70 and 125 g/L)",
"Units": "g/L",
"Require": "*",
"Constraint": "20,35 or 70"
Expand Down
2 changes: 1 addition & 1 deletion SAM_flatJSON/models/inputs/RO_MDB_inputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
"DataType": "SSC_NUMBER",
"Name": "V0",
"Label": "Initial batch volume",
"Units": "m3",
"Units": "L",
"Require": "*",
"Tab": "VAGMD-batch"
},
Expand Down
23 changes: 17 additions & 6 deletions app/apps/parametric_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,18 @@
'Percentage of fossil fuel consumption': 'parametric_desal_simulation_outfile'},
'RO_MDB':{
'Annual water production':'parametric_desal_simulation_outfile',
'Levelized cost of water':'parametric_desal_finance_outfile'},
# 'Total fossil fuel usage':'parametric_desal_simulation_outfile',
# 'Percentage of fossil fuel consumption': 'parametric_desal_simulation_outfile',
# 'Specific thermal power consumption': 'parametric_desal_design_outfile'}
'Levelized cost of water':'parametric_desal_finance_outfile',
'Percentage of grid electricity consumption': 'parametric_desal_simulation_outfile',
'Percentage of external fossil fuel consumption': 'parametric_desal_simulation_outfile',
'SEC-RO (Specific electricity consumption)': 'parametric_desal_design_outfile',
'STEC-MD (Specific thermal power consumption)': 'parametric_desal_design_outfile'},
'RO_FO':{
'Annual water production':'parametric_desal_simulation_outfile',
'Levelized cost of water':'parametric_desal_finance_outfile',}
'Levelized cost of water':'parametric_desal_finance_outfile',
'Percentage of grid electricity consumption': 'parametric_desal_simulation_outfile',
'Percentage of external fossil fuel consumption': 'parametric_desal_simulation_outfile',
'SEC-RO (Specific electricity consumption)': 'parametric_desal_design_outfile',
'STEC-FO (Specific thermal power consumption)': 'parametric_desal_design_outfile'}
}

desal_units = {
Expand All @@ -92,7 +97,13 @@
'Specific thermal power consumption':'kWh(th)/m3',
'Specific energy consumption':'kWh(e)/m3',
'Specific electricity consumption': 'kWh(e)/m3',
'Water production': 'm3'}
'Water production': 'm3',
'SEC-RO (Specific electricity consumption)': 'kWh(e)/m3',
'STEC-MD (Specific thermal power consumption)': 'kWh(th)/m3',
'STEC-FO (Specific thermal power consumption)': 'kWh(th)/m3',
'Percentage of grid electricity consumption':'%',
'Percentage of external fossil fuel consumption':'%'
}

chart_navbar = dbc.NavbarSimple(
children=[dbc.NavItem(dbc.NavLink("Home", href='/home')),
Expand Down
Loading

0 comments on commit 04be715

Please sign in to comment.