From ef444dbdac3b317d820561e318a4005d00d39083 Mon Sep 17 00:00:00 2001 From: Aiden Swayne Date: Mon, 27 Nov 2023 16:54:23 -0500 Subject: [PATCH] Various changes --- linear_program.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/linear_program.py b/linear_program.py index eef3cad..4b78ab5 100644 --- a/linear_program.py +++ b/linear_program.py @@ -13,7 +13,7 @@ def sumMatrix(matrix): return int(sum(sum(row) for row in matrix)) # solve linear system -def calculate(floors=1, xLength=1, yLength=1): +def calculate(floors=1, xLength=1, yLength=1, lifespan=100): # floors is the number of floors of the building # xLength is the length of the building in square meter tiles # yLength is the width of the building in square meter tiles @@ -39,9 +39,10 @@ def calculate(floors=1, xLength=1, yLength=1): slashPineAcres = cp.Variable(nonneg=True) eucalyptusTreeAcres = cp.Variable(nonneg=True) + cost = 0 # 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 - cost = cp.sum(aluminumColumns)*278 + cost += cp.sum(aluminumColumns)*278 # cost of steel columns from https://web.archive.org/web/20161210125922/http://www.homedepot.com:80/p/Tiger-Brand-8-ft-to-8-ft-4-in-Adjustable-Steel-Building-Support-Column-3-in-O-D-3A-8084/202086528 cost += cp.sum(steelColumns)*64.90 # cost of each square meter tile from https://www.lowes.com/pd/AdvanTech-Flooring-23-32-CAT-PS2-10-Tongue-and-Groove-OSB-Subfloor-Application-as-4-x-8/50126556 @@ -53,7 +54,7 @@ def calculate(floors=1, xLength=1, yLength=1): 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) - #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 + # eucalyptus density is estimated to be similar 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 # asphalt parking lot cost of 2$ per square foot from https://www.miconcrete.org/concrete-parking-lot-and-your-business @@ -68,24 +69,21 @@ def calculate(floors=1, xLength=1, yLength=1): # each aluminum column is 30 pounds, equivalent to 0.0136078, and 0.0136078*11.7 = 0.15921126 # each steel column is 35 pounds, equivalent to 0.0158757, and 0.0158757*2 = 0.0317514 # slash pine carbon absorbtion per acre from https://extension.psu.edu/carbon-accounting-in-forest-management#:~:text=100%2C000%20pounds%20carbon%20per%20acre%20%C3%B7%2045,tons%20of%20CO2%20emissions%20avoided - # 3.69 metric tons times 45 years is 166.05 metric tons in total # 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 # 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. + # absorbing 15.176 metric tons of CO2 per acre per year. # 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) + constraints.append(cp.sum(steelColumns)*0.0317514 + cp.sum(aluminumColumns)*0.15921126 + xLength*yLength*floors*0.0976484582 + ((xLength*yLength*floors)/9)*1.4 - oakTreeAcres*3.8446*lifespan - slashPineAcres*3.69*lifespan - eucalyptusTreeAcres*11.3820*lifespan <= 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 @@ -99,6 +97,9 @@ def calculate(floors=1, xLength=1, yLength=1): constraints.append(aluminumColumns >= 0) constraints.append(steelColumns >= 0) + #constraint to ensure columns can be placed + constraints.append(aluminumColumns + steelColumns >= xLength*yLength) + # constraints to ensure biodiversity amongst the tree species # no tree can be planted twice as much as any other tree constraints.append(oakTreeAcres>=(1/2)*eucalyptusTreeAcres)