Damage vector for life-cycle analysis: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(→‎Formula: rewritten. Uses ovaMatrixProduct from OpasnetUtils/Drafts)
(→‎Calculations: old code removed)
 
(8 intermediate revisions by the same user not shown)
Line 9: Line 9:
== Answer ==
== Answer ==


There are two parts to this: damage vector and damage factor. For details, see {{resultlink}}.
For an example of an actual LCA, see [[LCA of a coffee cup]].
<rcode name="answer" embed=1>
library(OpasnetUtils)
# [[Damage vector for life-cycle analysis]]. We need impactsPerDollar, damagesPerImpact, and damages.
objects.latest("Op_en5902", code_name = "initiate")
impactsPerDollar <- EvalOutput(impactsPerDollar)
damagesPerImpact <- EvalOutput(damagesPerImpact)
cat("Impacts per dollar\n")
oprint(head(impactsPerDollar@output))
cat("Damages per impact\n")
oprint(head(damagesPerImpact@output))
</rcode>


== Rationale ==
== Rationale ==


Damages are calculated using this formula:


<math>damages_{s,c,d} = \frac{ activity_s * impactsPD_{s,c} * damagesPI_{c,d} * 365}{normalisation_d},</math>


=== Dependencies ===
where
* damages are the damages caused by the activity in meaningful units such as DALYs,
* activity are the direct inputs of an activity (in Euro), such as in [[LCA of a coffee cup]], table Direct inputs of a coffee cup,
* impactsPD or impactsPerDollar are data from the damage vector (size 430*17) in Opasnet Base of this page,
* damagesPI or damagesPerImpact are data from the Damage factors table below,
* normalisation are impacts turned into meaningful units such as in [[Normalisation data for life cycle assessments#Data]]
* the outcome is scaled by 365 to reflect yearly impacts {{attack|#|I'm not sure why, if the activity is in functional units and it is not clear that the activity happens once per day.|--[[User:Jouni|Jouni]] ([[User talk:Jouni|talk]]) 17:30, 29 January 2014 (EET)}}
* s is purchasing sector,
* c is unique category (this is often summed up so that it does not show in the damage variable),
* d is damage index.


=== Data ===
=== Data ===


<t2b name="damagefactors" index="Unique_categories,Damage_categories" locations="Human health,Ecosystem quality,Climate change,Resources,Water consumption" unit = "-">
'''Damage vector
 
The damage vector contains 430 purchasing sectors and 17 unique categories of impact. See {{resultlink}}.
 
'''Damage factors
 
Damage factors are described in the table below.
 
{{attack|#|The units should be explained!|--[[User:Jouni|Jouni]] ([[User talk:Jouni|talk]]) 07:34, 28 December 2013 (EET)}}
 
<t2b name="Damage factors" index="Unique_categories,Damage_categories" locations="Human health,Ecosystem quality,Climate change,Resources,Water consumption" unit = "-">
Carcinogens|0.0000028|0|0|0|0
Carcinogens|0.0000028|0|0|0|0
Non-carcinogens|0.0000028|0|0|0|0
Non-carcinogens|0.0000028|0|0|0|0
Line 38: Line 80:
</t2b>
</t2b>


===Example of coffee cup===
===Calculations===


<t2b name="Coffee cup inputs" index="Purchasing_sector" obs="Result" unit="Euro">
<rcode name="initiate" label="Initiate variables" embed=1>
31131A - Sugar cane mills and refining|0.1
112120 - Dairy cattle and milk production|0.2
311820 - Cookie, cracker, and pasta manufacturing|0.5
311920 - Coffee and tea manufacturing|0.2
221100 - Electric power generation, transmission, and distribution|0.1
322299 - All other converted paper product manufacturing|0.04
335210 - Small electrical appliance manufacturing|0
335221 - Household cooking appliance manufacturing|0.01
</t2b>
 
===Formula===
 
<rcode graphics=1>


library(OpasnetUtils)
library(OpasnetUtils)
library(xtable)
library(ggplot2)
library(reshape2)
objects.latest("Op_en6007", code_name = "answer") # [[OpasnetUtils/Drafts]]. We need ovaMatrixProduct.
limit <- 0.001
show_bins <- 10 # How many different direct inputs to show?


# Create the damage factor table based on data from [[Damage vector for life-cycle analysis]]
# Create the damage factor table based on data from [[Damage vector for life-cycle analysis]]


damagesPerImpact <- opbase.data("Op_en5902.damagefactors")
damagesPerImpact <- opbase.data("Op_en5902.damage_factors")
damagesPerImpact$Obs <- NULL
damagesPerImpact$Obs <- NULL
damagesPerImpact <- Ovariable("damagesPerImpact", damagesPerImpact)
damagesPerImpact <- Ovariable("damagesPerImpact", damagesPerImpact)
Line 75: Line 96:
impactsPerDollar <- Ovariable("impactsPerDollar", data = opbase.data("Op_en5902"))
impactsPerDollar <- Ovariable("impactsPerDollar", data = opbase.data("Op_en5902"))


# Take the direct requirements of an activity (in this case, producing a cup of coffee).
damages <- Ovariable("damages",  
 
dependencies = data.frame(Name = c(
activity <- opbase.data("Op_en5902.coffee_cup_inputs")
"damagesPerImpact",  
activity$Obs <- NULL # Remove the redundant Obs column.
"impactsPerDollar",
 
"activity",
cat("Primary prosesses related to a cup of coffee (in Euro)\n")
"normalisation"
head(activity)
)),
 
formula = function(...) {
# Combine the direct requirements of a coffee cup with a full vector of requirements and fill empty cells with 0.
 
out <- activity * impactsPerDollar * damagesPerImpact # Actual equation.
activity <- merge(
unique(EvalOutput(impactsPerDollar)@output["Purchasing_sector"]),  
activity,
all.x = TRUE
)
 
activity$Result[is.na(activity$Result)] <- 0
 
activity <- Ovariable("activity", data = activity)
 
# Get the normalisation data for different damages and make an ovariable out of it.
 
normalisation <- opbase.data("Op_en5904") # [[Normalisation data for life cycle assessments]]
normalisation$Obs <- NULL
 
head(normalisation)
 
normalisation <- Ovariable("normalisation", data = normalisation)
 
##########################333
 
damagesPerImpact <- EvalOutput(damagesPerImpact, N = 1)
impactsPerDollar <- EvalOutput(impactsPerDollar, N = 1)
activity        <- EvalOutput(activity, N = 1)
normalisation    <- EvalOutput(normalisation, N = 1)
 
#damagesPerImpact2 <- damagesPerImpact@output
#impactsPerDollar2 <- impactsPerDollar@output
#activity2        <- activity@output
#normalisation2    <- normalisation@output
 
#############################33
 
#damagesPerImpact2 <- reshape( # Reshape it into the wide format.
# damagesPerImpact2[ , colnames(damagesPerImpact2) != "Obs"], # Data to be reshaped
# times = "Result", # Column(s) to be reshaped
# timevar = "Unique_categories", # Column identifiers
# idvar = "Damage_categories", # Row identifiers
# direction = "wide" # Reshape from long to wide format
#)
 
#colnames(damagesPerImpact2) <- gsub("Result.", "", colnames(damagesPerImpact2)) # Remove extra "Result." from colnames.
#rownames(damagesPerImpact2) <- damagesPerImpact2[[1]] # Make the first column the rownames.
#damagesPerImpact2[1] <- NULL # Remove the first column.
 
#damagesPerImpact2[1:5, 1:5]
 
#damagesPerImpact2 <- t(as.matrix(damagesPerImpact2)) # Turn the data.frame into a matrix and transpose it.
 
#impactsPerDollar2 <- reshape(
# impactsPerDollar2,  
# times = "Result",
# timevar = "Unique_categories",
# idvar = "Purchasing_sector",
# direction = "wide"
#)
#colnames(impactsPerDollar2) <- gsub("Result.", "", colnames(impactsPerDollar2))
#rownames(impactsPerDollar2) <- impactsPerDollar2[[1]]
#impactsPerDollar2[1] <- NULL
 
#impactsPerDollar2[1:5, 1:5]
 
#impactsPerDollar2 <- as.matrix(impactsPerDollar2)
 
#activity2 <- merge(data.frame(directRequirements2 = rownames(impactsPerDollar2)), activity2, all.x = TRUE)
#activity2$Result[is.na(activity2$Result)] <- 0
 
impactsPerDollar2 <- impactsPerDollar * activity # Multiply data matrix with activities.
 
head(impactsPerDollar@output)
head(damagesPerImpact@output)
 
out <- ovaMatrixProduct(
impactsPerDollar2,
damagesPerImpact,
c("Purchasing_sector", "Unique_categories"),
c("Unique_categories", "Damage_categories")
) # Do a matrix multiplication


# After matrix operations, turn out into a data.frame for graphics.
# out <- CollapseMarginal(
# out,
# cols = "Unique_categories",  
# fun = "sum"
# )


#out <- as.data.frame(out)
# out <- out / normalisation * 365 # Normalise and scale to daily values.


#out$Purchasing_sector <- rownames(out)
return(out)
#out <- melt(out, idvars = "Purchasing_sector", variable_name = "damages") # Reshape into long format
}
 
 
 
# Merge all but show_bins largest bins to 'Other'.
 
sums <- as.data.frame(as.table(tapply(out@output$Result, out@output["Purchasing_sector"], sum)))
limit <- sort(sums$Freq, decreasing = TRUE)[show_bins]
keeps <- sums[sums$Freq > limit , "Purchasing_sector"]
keeps <- levels(keeps)[keeps]
 
levels(out@output$Purchasing_sector) <- ifelse(
levels(out@output$Purchasing_sector) %in% keeps,
levels(out@output$Purchasing_sector),
"Other"
)
)


#out <- dropall(out)
objects.store(damagesPerImpact, impactsPerDollar, damages)
 
cat("Ovariables damagesPerImpact, impactsPerDollar, damages saved.\n")
# Rename the columns to reflect actual things.
 
#colnames(out)[colnames(out) == "value"] <- "Result"
 
 
#damages <- EvalOutput(new("ovariable", name = "damages", data = out)) # Make an ovariable
 
damageFractions <- out / normalisation * 365 # Normalise and scale to daily values.
 
# Plot results on a bar graph.
 
cat("Effects smaller than or equal to ", limit / sum(sums$Freq) * 100, " % of the total effect are not shown.\n")
 
#oprint(damageFractions)
 
ggplot(damageFractions@output, aes(x = Damage, weight = Result, fill = Purchasing_sector)) + geom_bar() +
theme_grey(base_size = 18) +
theme(axis.text.x = element_text(angle = 45)) +
labs(
title = "Life cycle impacts of a cup of coffee",
x = "Damage",
y = "Amount"
)


</rcode>
</rcode>


==See also==
==See also==
* [[LCA of a coffee cup]]
* [[Normalisation data for life cycle assessments]]


==Keywords==
==Keywords==
Line 223: Line 136:


==Related files==
==Related files==
{{mfiles}}<!-- __OBI_TS:1358344392 -->

Latest revision as of 20:37, 29 January 2014



Question

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

Answer

There are two parts to this: damage vector and damage factor. For details, see {{#opasnet_base_link:Op_en5902}} .

For an example of an actual LCA, see LCA of a coffee cup.

+ Show code

Rationale

Damages are calculated using this formula:

Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle damages_{s,c,d} = \frac{ activity_s * impactsPD_{s,c} * damagesPI_{c,d} * 365}{normalisation_d},}

where

  • damages are the damages caused by the activity in meaningful units such as DALYs,
  • activity are the direct inputs of an activity (in Euro), such as in LCA of a coffee cup, table Direct inputs of a coffee cup,
  • impactsPD or impactsPerDollar are data from the damage vector (size 430*17) in Opasnet Base of this page,
  • damagesPI or damagesPerImpact are data from the Damage factors table below,
  • normalisation are impacts turned into meaningful units such as in Normalisation data for life cycle assessments#Data
  • the outcome is scaled by 365 to reflect yearly impacts ⇤--#: . I'm not sure why, if the activity is in functional units and it is not clear that the activity happens once per day. --Jouni (talk) 17:30, 29 January 2014 (EET) (type: truth; paradigms: science: attack)
  • s is purchasing sector,
  • c is unique category (this is often summed up so that it does not show in the damage variable),
  • d is damage index.

Data

Damage vector

The damage vector contains 430 purchasing sectors and 17 unique categories of impact. See {{#opasnet_base_link:Op_en5902}} .

Damage factors

Damage factors are described in the table below.

⇤--#: . The units should be explained! --Jouni (talk) 07:34, 28 December 2013 (EET) (type: truth; paradigms: science: attack)

Damage factors(-)
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

Calculations

+ Show code

See also

Keywords

References


Related files