diff --git a/linear_program.py b/linear_program.py index 8d0d5c3..859caf9 100644 --- a/linear_program.py +++ b/linear_program.py @@ -35,8 +35,9 @@ def calculate(floors=1, xLength=1, yLength=1): steelColumns = cp.Variable((xLength,yLength), integer = True) # create trees - oakTreeAcres = cp.Variable() - slashPineAcres = cp.Variable() + oakTreeAcres = cp.Variable(nonneg=True) + slashPineAcres = cp.Variable(nonneg=True) + eucalyptusTreeAcres = cp.Variable(nonneg=True) # cost calculation (measured in USD) # cost of aluminum columns from https://www.homedepot.com/p/Afco-8-x-7-5-8-Endura-Aluminum-Column-Round-Shaft-Load-Bearing-21-000-lbs-Non-Tapered-Fluted-Gloss-White-EA0808ANFSATUTU/301315907 @@ -47,10 +48,18 @@ def calculate(floors=1, xLength=1, yLength=1): # we buy 3 boards at 54.30, and divide by 2.93392603407 to get the cost per square meter tile cost += 55.5228721203*xLength*yLength*floors # cost of oak tree saplings per acre - # 50 trees per acre at 18.99 from https://sequoiatrees.com/products/valley-oak-medium-tree-seedling?variant=30222711062591¤cy=USD + # 50 trees per acre from the lowest figure from page 1 of https://www.in.gov/dnr/forestry/files/underplantingoak.pdf, + # priced at 18.99 each from https://sequoiatrees.com/products/valley-oak-medium-tree-seedling?variant=30222711062591¤cy=USD cost += 50*18.99*oakTreeAcres # slash pine cost per acre from page 3 of https://web.archive.org/web/20231126224531id_/https://bugwoodcloud.org/bugwood/productivity/pdfs/SeriesPaper5.pdf cost += slashPineAcres*(55+110) + # asphalt parking lot cost of 2$ per square foot from https://www.miconcrete.org/concrete-parking-lot-and-your-business + # 15 square meters are in a parking space and 162 feet is approximately 15 square meters, so the cost is 324 dollars per space. + cost += ((xLength*yLength*floors)/9)*324 + #eucalyptus density is assumed to be identical to oak density at 50 trees per acre from https://www.in.gov/dnr/forestry/files/underplantingoak.pdf + # cost is 8.99 each from https://sequoiatrees.com/products/rainbow-eucalyptus-mini-grow-kit + cost += 50*8.99*eucalyptusTreeAcres + # constraints constraints = [] @@ -64,10 +73,20 @@ def calculate(floors=1, xLength=1, yLength=1): # the carbon emissions of a typical office building per square meter from https://www.environmentenergyleader.com/2007/10/epa-tool-estimates-greenhouse-gas-emissions-of-commercial-buildings/#:~:text=a%20look%20at%20a%20typical%20office%20building%20in%20the%20New%20England%20region%20shows%20that%20the%20building%20contributes%2020%20pounds%20of%20CO2%20per%20square%20foot # 10.7639 square feet in a square meter time 20 pounds per square foot, converting the output to metric tons, gives 0.0976484582 metric tons # oak tree carbon absorbtion per tree from https://www.greenereveryday.co.uk/carbon-offsetting#:~:text=The%204.5%20tons%20of%20C%20in%20the%20Oak%20tree%20has%20required%20the%20sequestration%20of%2016.5%20tons%20of%20CO2.%20Spread%20over%20100%20years - # 16.5 metric tons of CO2 absorbed per oak tree - # 50 oak trees fit on one acre, taking the lowest figure from page 1 of https://www.in.gov/dnr/forestry/files/underplantingoak.pdf - # 16.5*50 is 825 total metric tons absorbed per acre over 100 years - constraints.append(cp.sum(steelColumns)*0.0317514 + cp.sum(aluminumColumns)*0.15921126 + xLength*yLength*floors*0.0976484582 - oakTreeAcres*825 - slashPineAcres*166.05 <= 0) + # oak carbon sequestration per hectare from https://winrock.org/flr-calculator/ + # 1000 hectares (about 2471 acres) absorb about 9500 metric tons of CO2 per year, so + # an acre of oak trees will absorb about 3.8446 metric tons of CO2 per year. + # assuming a 100 year lifespan and consistent carbon sequestration over that time, + # an acre of oak trees will absorb 384.46 metric tons of CO2 over its lifetime. + # eucalyptus carbon sequestration per hectare from https://winrock.org/flr-calculator/ + # the calculations for eucalyptus are similar to oak trees, absorbing 37800 metric tons of CO2 per 100 hectares per year and + # absorbing 15.176 metric tons of CO2 per acre per year and 1138 tons over its lifetime of 75 years. + # the parking lot size of the building is defined to be 1 parking spot per 9 tiles of space, rounded up, + # and with emissions of 52264 metric tons of CO2 over 560000 square meters, so + # the emissions are approximately 0.09333 metric tons per square meter, from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4809014/. + # the size of a parking space is approximately 15 square meters, so the CO2 cost of a parking spot is appoximately + # 1.4 metric tons per parking space. + constraints.append(cp.sum(steelColumns)*0.0317514 + cp.sum(aluminumColumns)*0.15921126 + xLength*yLength*floors*0.0976484582 + ((xLength*yLength*floors)/9)*1.4 - oakTreeAcres*384.46 - slashPineAcres*166.05 - eucalyptusTreeAcres*1138.20 <= 0) # columns supporting each floor # aluminum column support figure from https://www.homedepot.com/p/Afco-8-x-7-5-8-Endura-Aluminum-Column-Round-Shaft-Load-Bearing-21-000-lbs-Non-Tapered-Fluted-Gloss-White-EA0808ANFSATUTU/301315907#:~:text=bearing%20limit%20(lb.)-,21000,-Material @@ -80,8 +99,6 @@ def calculate(floors=1, xLength=1, yLength=1): # nonnegativity constraints.append(aluminumColumns >= 0) constraints.append(steelColumns >= 0) - constraints.append(oakTreeAcres >= 0) - constraints.append(slashPineAcres >= 0) # create and solve problem problem = cp.Problem(cp.Minimize(cost), constraints) @@ -95,6 +112,8 @@ def calculate(floors=1, xLength=1, yLength=1): logs.append("\nCarbon offsets (measured in acres):") logs.append("Oak tree acres: " + str(abs(oakTreeAcres.value))) logs.append("Slash pine acres: " + str(abs(slashPineAcres.value))) + logs.append("Eucalyptus tree acres: " + str(abs(eucalyptusTreeAcres.value))) + logs.append("number of parking spaces needed: " + str(int(xLength*yLength*floors/9))) # get arguments from command line if len(sys.argv) == 4 or len(sys.argv) == 5: