Skip to content

Commit

Permalink
Final
Browse files Browse the repository at this point in the history
  • Loading branch information
msm-sardar committed Feb 9, 2021
1 parent 9b37063 commit d430ab6
Show file tree
Hide file tree
Showing 42 changed files with 140,070 additions and 1,788 deletions.
20,001 changes: 20,001 additions & 0 deletions ADC.csv

Large diffs are not rendered by default.

20,001 changes: 20,001 additions & 0 deletions ADC_FixElec.csv

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions AbioticDepletion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 6 19:53:03 2020
@author: msmsa
"""

import pandas as pd
from ast import literal_eval
from brightway2 import *

def import_aibiotic_depletion():

Data = pd.read_excel('AbioticDepletion.xlsx')

project = "Compost_use"
projects.set_current(project)
db = Database("biosphere3")

Data['N'] = 0
Data['key'] = None

for i in Data.index:
subset=db.search(Data['Flow2'][i])
for act in subset:
if act.as_dict()['categories'][0] == 'natural resource' and act.as_dict()['name'] == Data['Flow2'][i]:
Data.loc[i,'N'] +=1
Data.loc[i,'key'] = str(act.key)

CF = []
for i in Data.index:
CF.append((literal_eval(Data['key'][i]), Data['Factor2'][i]))

Method(('CML (v4.4, 2015)', 'resources', 'depletion of abiotic resources - elements, ultimate reserves')).register()
Method(('CML (v4.4, 2015)', 'resources', 'depletion of abiotic resources - elements, ultimate reserves')).write(CF)
Binary file added AbioticDepletion.xlsx
Binary file not shown.
20,001 changes: 20,001 additions & 0 deletions Both.csv

Large diffs are not rendered by default.

20,001 changes: 20,001 additions & 0 deletions Both_FixElec.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CommonData_for_Sensitivity_Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self):
self.Land_app = {
'cmpLandDies':{"Name":"Compost application diesel use","amount":0.8,"unit":'L/Mg compost'},

'NO3':{"Name":"Fraction of N content that is emitted as NO3 ","amount":0.20,"unit":None,'list':np.linspace(0.03,0.87,10).tolist()*10},
'NO3':{"Name":"Fraction of N content that is emitted as NO3 ","amount":0.20,"unit":None},

'frac_gw':{"Name":"Fraction of NO3 that is emitted to groundwater","amount":0.50,"unit":None},

Expand Down
36 changes: 21 additions & 15 deletions Compost_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def __init__(self):
#'erLand':{"Name":"Empty return from land application (0=no; 1=yes)","amount":1,"unit":'0/1',"Reference":None},
#'land_payload':{"Name":"Actual payload of truck used to haul soil amendment","amount":7.3,"unit":'Mg',"Reference":None},

'PeatSubFac':{"Name":"Volumetric peat replacement factor","amount":0.9,"unit":None,"Reference":'17',
'uncertainty_type':5,'loc':0.8,'minimum':0.22,'maximum':1},
'PeatSubFac':{"Name":"Volumetric peat replacement factor","amount":1,"unit":None,"Reference":'17',
'uncertainty_type':5,'loc':1,'minimum':0.9,'maximum':1.1},

'densPeat':{"Name":"Density of peat","amount":200,"unit":'kg/m3',"Reference":'17',
'uncertainty_type':3,'loc': 200, 'scale':57},
Expand All @@ -43,9 +43,9 @@ def __init__(self):

### Facility Operation
self.operation = {
'choice_BU':{'Name':'Digestate Beneficial Use (1) or No Beneficial Use (0)','amount':0,'unit':'0/1','Referenc':None},
'choice_BU':{'Name':'Digestate Beneficial Use (1) or No Beneficial Use (0)','amount':1,'unit':'0/1','Referenc':None},
'peatOff':{'Name':'Digestate Beneficial Use offsets Peat (1 - Yes; 0 - No)','amount':1,'unit':'0/1','Referenc':None},
'fertOff':{'Name':'Digestate Beneficial Use offsets Fertilizer (1 - Yes; 0 - No)','amount':0,'unit':'0/1','Referenc':None},
'fertOff':{'Name':'Digestate Beneficial Use offsets Fertilizer (1 - Yes; 0 - No)','amount':1,'unit':'0/1','Referenc':None},
'allocation_ADC':{'Name':'Allocation factor of LF material use to ADC','amount':0.5,'unit':'frac',
'uncertainty_type':4,'minimum':0,'maximum':1}}

Expand All @@ -67,23 +67,23 @@ def __init__(self):
### Initial flow
self.initflow ={'mass':{"Name":"mass","amount":1000},
'C_cont':{"Name":"C_cont","amount":0.30,'uncertainty_type':4,'minimum':0.10,'maximum':0.47},
'N_cont':{"Name":"N_cont","amount":0.015,'uncertainty_type':4,'minimum':0.0051,'maximum':0.028},
'N_cont':{"Name":"N_cont","amount":0.015,'uncertainty_type':4,'minimum':0.007,'maximum':0.028},
'P_cont':{"Name":"P_cont","amount":0.005,'uncertainty_type':4,'minimum':0.0015,'maximum':0.0093},
'K_cont':{"Name":"K_cont","amount":0.01,'uncertainty_type':4,'minimum':0.0007,'maximum':0.023}
}

### Landfill
self.Landfill ={'CH4_Collected':{"Name":"CH4_Collected","amount":60,
'uncertainty_type':3,'loc': 60 ,'scale':4},
'uncertainty_type':3,'loc': 60 ,'scale':4, 'minimum':48.7,'maximum':69.7},

'Frac_oxidized':{"Name":"Frac_oxidized","amount":0.17,
'uncertainty_type':3,'loc': 0.17,'scale':0.03},
'uncertainty_type':3,'loc': 0.17,'scale':0.03, 'minimum':0.105,'maximum':0.279},

'Frac_flared':{"Name":"Frac_flared","amount":0.31,
'uncertainty_type':3,'loc': 0.31 , 'scale':0.12},
'uncertainty_type':3,'loc': 0.31 , 'scale':0.12, 'minimum':0.1,'maximum':0.593},

'percCStor_LF':{"Name":"Percent of carbon in compost remaining after 100 years","amount":90,"unit":'%'
,'uncertainty_type':3,'loc':90,'scale':3},
,'uncertainty_type':3,'loc':90,'scale':3, 'minimum':83.2,'maximum':97.5},

'Elec_eff':{"Name":"Elec_eff in LF","amount":0.30,"unit":None
,'uncertainty_type':4,'minimum':0.20,'maximum':0.37},
Expand All @@ -104,12 +104,18 @@ def __init__(self):

'ADC_thickness':{'Name':'ADC_thickness','amount':22.5,'unit':'cm',
'uncertainty_type':2,'loc': 3.2189, 'scale':0.1150},

'Frac_NH4_GW':{'Name':'Frac_NH4_GW','amount':0.000048,'unit':'fraction',
'uncertainty_type':2,'loc': -9.9466, 'scale':0.2093},

'Frac_NH4_SW':{'Name':'Frac_NH4_SW','amount':0.000087,'unit':'fraction',
'uncertainty_type':2,'loc': -9.3552, 'scale':0.2093},

'Frac_NH4':{'Name':'Frac_NH4','amount':0.00563,'unit':'fraction',
'uncertainty_type':2,'loc': -5.1796, 'scale':0.2093},

'LCRS_eff':{'Name':'LCRS_eff','amount':0.991,'unit':'fraction',
'uncertainty_type':5,'loc': 0.991 ,'minimum':0.971,'maximum':0.999},

'NH4_rmv_eff':{'Name':'NH4_rmv_eff','amount':0.95,'unit':'fraction',
'uncertainty_type':5,'loc': 0.95 ,'minimum':0.89,'maximum':0.98},

'Grid_mix':{'Name':'Grid_mix','amount':1,'unit':'fraction',
'uncertainty_type':1,'loc': 1 ,'minimum':0.7,'maximum':1.35}
}

### Monte_carlo
Expand Down
16 changes: 9 additions & 7 deletions Compost_input_for_Sensitivity_Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self):
### Initial flow
self.initflow ={'mass':{"Name":"mass","amount":1000},
'C_cont':{"Name":"C_cont","amount":0.30},
'N_cont':{"Name":"N_cont","amount":0.015,'list':np.repeat(np.linspace(0.0051,0.028,10),10)},
'N_cont':{"Name":"N_cont","amount":0.015},
'P_cont':{"Name":"P_cont","amount":0.005},
'K_cont':{"Name":"K_cont","amount":0.01}
}
Expand All @@ -82,12 +82,14 @@ def __init__(self):
'DC_thickness':{'Name':'DC_thickness','amount':15,'unit':'cm'},

'ADC_thickness':{'Name':'ADC_thickness','amount':22.5,'unit':'cm'},

'Frac_NH4_GW':{'Name':'Frac_NH4_GW','amount':0.000048,'unit':'fraction'},

'Frac_NH4_SW':{'Name':'Frac_NH4_SW','amount':0.000087,'unit':'fraction'}

}

'Frac_NH4':{'Name':'Frac_NH4','amount':0.00563,'unit':'fraction'},

'LCRS_eff':{'Name':'LCRS_eff','amount':0.991,'unit':'fraction'},

'NH4_rmv_eff':{'Name':'NH4_rmv_eff','amount':0.95,'unit':'fraction'},

'Grid_mix':{'Name':'Grid_mix','amount':1,'unit':'fraction'} }

### Monte_carlo
def setup_MC(self,seed=None):
Expand Down
Binary file modified Compost_use
Binary file not shown.
2 changes: 1 addition & 1 deletion Compost_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def report(self):
Biosphere[y][('biosphere3', '87883a4e-1e3e-4c9d-90c0-f1bea36f8014')]= 0 #Ammonia ('air',)
Biosphere[y][('biosphere3', '20185046-64bb-4c09-a8e7-e8a9e144ca98')]= 0 # Dinitrogen monoxide ('air',)
Biosphere[y][('biosphere3', 'b9291c72-4b1d-4275-8068-4c707dc3ce33')]= 0 #Nitrate ('water', 'ground-')
Biosphere[y][('biosphere3', '7ce56135-2ca5-4fba-ad52-d62a34bfeb35')]= 0 #Nitrate ('water', 'surface water')
Biosphere[y][('biosphere3', '7ce56135-2ca5-4fba-ad52-d62a34bfeb35')]= self.LCI['Nitrate (Surface water)'][y] #Nitrate ('water', 'surface water')

if self.Compost_input.operation['choice_BU']['amount'] == 1 and self.Compost_input.operation['peatOff']['amount'] == 1:
Biosphere[y][('biosphere3', '349b29d1-3e58-4c66-98b9-9d1a076efd2e')]= self.LCI['Carbon dioxide, fossil'][y] # Carbon dioxide, fossil ('air',)
Expand Down
474 changes: 474 additions & 0 deletions Distributions.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit d430ab6

Please sign in to comment.