Damage vector for life-cycle analysis: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(→‎Formula: graph improved, coffee table added to output)
(→‎Formula: normalisation added)
Line 63: Line 63:
# Take the damage factor table from this page.
# Take the damage factor table from this page.


damages <- opbase.data("Op_en5902.damagefactors") # Download the data from Opasnet Base.
damagesPerImpact <- opbase.data("Op_en5902.damagefactors") # Download the data from Opasnet Base.
damages <- reshape( # Reshape it into the wide format.
damagesPerImpact <- reshape( # Reshape it into the wide format.
damages[ , colnames(damages) != "Obs"],  
damagesPerImpact[ , colnames(damagesPerImpact) != "Obs"],  
times = "Result",  
times = "Result",  
timevar = "Unique_categories",  
timevar = "Unique_categories",  
Line 71: Line 71:
direction = "wide"
direction = "wide"
)
)
colnames(damages) <- gsub("Result.", "", colnames(damages)) # Remove extra "Result." from colnames.
colnames(damagesPerImpact) <- gsub("Result.", "", colnames(damagesPerImpact)) # Remove extra "Result." from colnames.
rownames(damages) <- damages[[1]] # Make the first column the rownames.
rownames(damagesPerImpact) <- damagesPerImpact[[1]] # Make the first column the rownames.
damages <- damages[ , 2:ncol(damages)] # Remove the first column.
damagesPerImpact <- damagesPerImpact[ , 2:ncol(damagesPerImpact)] # Remove the first column.
damages <- t(as.matrix(damages)) # Turn the data.frame into a matrix and transpose it.
damagesPerImpact <- t(as.matrix(damagesPerImpact)) # Turn the data.frame into a matrix and transpose it.


# Take the impact factor table from the database. Do the same procedures as with damages.
# Take the impact factor table from the database. Do the same procedures as with damagesPerImpact.


data <- opbase.data("Op_en5902")
impactsPerDollar <- opbase.data("Op_en5902")
data <- reshape(
impactsPerDollar <- reshape(
data,  
impactsPerDollar,  
times = "Result",  
times = "Result",  
timevar = "Unique_categories",  
timevar = "Unique_categories",  
Line 86: Line 86:
direction = "wide"
direction = "wide"
)
)
colnames(data) <- gsub("Result.", "", colnames(data))
colnames(impactsPerDollar) <- gsub("Result.", "", colnames(impactsPerDollar))
rownames(data) <- data[[1]]
rownames(impactsPerDollar) <- impactsPerDollar[[1]]
data <- data[ , 2:ncol(data)]
impactsPerDollar <- impactsPerDollar[ , 2:ncol(impactsPerDollar)]
data <- as.matrix(data)
impactsPerDollar <- as.matrix(impactsPerDollar)


# Take the coffee cup activities.
# Take the coffee cup direct requirements.


coffee <- opbase.data("Op_en5902.coffeecupinputs") # Download the data from Opasnet Base.
coffee <- opbase.data("Op_en5902.coffeecupinputs") # Download the data from Opasnet Base.
Line 100: Line 100:
print(xtable(coffee), type = 'html')
print(xtable(coffee), type = 'html')


coffee <- merge(data.frame(Activity = rownames(data)), coffee, all.x = TRUE)
coffee <- merge(data.frame(DirectRequirements = rownames(impactsPerDollar)), coffee, all.x = TRUE)
coffee$Result <- ifelse(is.na(coffee$Result), 0, coffee$Result)
coffee$Result <- ifelse(is.na(coffee$Result), 0, coffee$Result)


data <- data * coffee$Result # Multiply data matrix with activities.
normalisation <- EvalOutput(new("ovariable",
name = "normalisation",
data = tidy(opbase.data("Op_en5904"), objname="normalisation")
))


out <- data %*% damages
normalisation@output
 
impactsPerDollar <- impactsPerDollar * coffee$Result # Multiply data matrix with activities.
 
out <- impactsPerDollar %*% damagesPerImpact


# After matrix operations, turn the output into a data.frame for graphics.
# After matrix operations, turn the output into a data.frame for graphics.
Line 111: Line 118:
out <- as.data.frame(out)
out <- as.data.frame(out)


out$idvars <- rownames(out)
out$directRequirements <- rownames(out)
out <- melt(out, idvars = "idvars")
out <- melt(out, idvars = "directRequirements", variable_name = "damages")
out <- out[out$value >= sum(out$value) * limit , ]
out <- out[out$value >= sum(out$value) * limit , ]
out <- dropall(out)
out <- dropall(out)
# Rename the columns to reflect actual things.
colnames(out)[colnames(out) == "value"] <- "Result"
damages <- EvalOutput(new("ovariable", name = "Damage", data = out))
head(damages@output)
damageFractions <- damages / normalisation * 365
head(damageFractions@output)


cat("Effects smaller than", limit*100, "% of the total effect are not shown.\n")
cat("Effects smaller than", limit*100, "% of the total effect are not shown.\n")


ggplot(out, aes(x = variable, weight = value, fill = idvars)) + geom_bar() +
ggplot(out, aes(x = Damage, weight = Result, fill = directRequirements)) + geom_bar() +
theme_grey(base_size = 24) +
theme_grey(base_size = 24) +
theme(axis.text.x = element_text(angle = 45)) +
theme(axis.text.x = element_text(angle = 45)) +

Revision as of 10:05, 17 January 2013



Question

What are the damages per unit purchased commodity using a life-cycle assessment?

Answer

Rationale

Dependencies

Data

damagefactors(-)
ObsUnique_categoriesHuman healthEcosystem qualityClimate changeResourcesWater consumption
1Carcinogens0.00000280000
2Non-carcinogens0.00000280000
3Respiratory inorganics0.00070000
4Ionizing radiation0.000000000210000
5Ozone layer depletion0.001050000
6Respiratory organics0.000002130000
7Aquatic ecotoxicity00.0000502000
8Terrestrial ecotoxicity00.00791000
9Terrestrial acidification/nutrification01.04000
10Land occupation01.09000
11Aquatic acidification00000
12Aquatic eutrophication00000
13Global warming00100
14Non-renewable energy00010
15Mineral extraction00010
16Water withdrawal00000
17Water consumption00001

Example of coffee cup

coffeecupinputs(Euro)
ObsActivityResult
131131A - Sugar cane mills and refining0.1
2112120 - Dairy cattle and milk production0.2
3311820 - Cookie, cracker, and pasta manufacturing0.5
4311920 - Coffee and tea manufacturing0.2
5221100 - Electric power generation, transmission, and distribution0.1
6322299 - All other converted paper product manufacturing0.04
7335210 - Small electrical appliance manufacturing0
8335221 - Household cooking appliance manufacturing0.01

Formula

What is the smallest fraction of the total effect you want to see?:

+ Show code

See also

Keywords

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>