Damage vector for life-cycle analysis: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(→‎Formula: small adjustments)
(→‎Calculations: old code removed)
 
(10 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="coffeecupinputs" index="directRequirements" obs="Result" unit="Euro">
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>
<rcode name="initiate" label="Initiate variables" embed=1>


library(OpasnetUtils)
library(OpasnetUtils)
library(xtable)
library(ggplot2)
library(reshape2)


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]]


# Take the damage factor table from this page.
damagesPerImpact <- opbase.data("Op_en5902.damage_factors")
damagesPerImpact$Obs <- NULL
damagesPerImpact <- Ovariable("damagesPerImpact", damagesPerImpact)


damagesPerImpact <- opbase.data("Op_en5902.damagefactors") # Download the data from Opasnet Base.
# Take the impact factor table from the database. Do the same procedures as with damagesPerImpact.
damagesPerImpact <- reshape( # Reshape it into the wide format.
damagesPerImpact[ , colnames(damagesPerImpact) != "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(damagesPerImpact) <- gsub("Result.", "", colnames(damagesPerImpact)) # Remove extra "Result." from colnames.
impactsPerDollar <- Ovariable("impactsPerDollar", data = opbase.data("Op_en5902"))
rownames(damagesPerImpact) <- damagesPerImpact[[1]] # Make the first column the rownames.
damagesPerImpact[1] <- NULL # Remove the first column.


oprint(damagesPerImpact)
damages <- Ovariable("damages",
dependencies = data.frame(Name = c(
"damagesPerImpact",
"impactsPerDollar",
"activity",
"normalisation"
)),
formula = function(...) {
out <- activity * impactsPerDollar * damagesPerImpact # Actual equation.


damagesPerImpact <- t(as.matrix(damagesPerImpact)) # Turn the data.frame into a matrix and transpose it.
# out <- CollapseMarginal(
# out,
# cols = "Unique_categories",
# fun = "sum"
# )


# Take the impact factor table from the database. Do the same procedures as with damagesPerImpact.
# out <- out / normalisation * 365 # Normalise and scale to daily values.


impactsPerDollar <- opbase.data("Op_en5902")
return(out)
impactsPerDollar <- reshape(
}
impactsPerDollar,
times = "Result",
timevar = "Unique_categories",
idvar = "Purchasing_sector",
direction = "wide"
)
)
colnames(impactsPerDollar) <- gsub("Result.", "", colnames(impactsPerDollar))
rownames(impactsPerDollar) <- impactsPerDollar[[1]]
impactsPerDollar[1] <- NULL
#oprint(impactsPerDollar)
impactsPerDollar <- as.matrix(impactsPerDollar)


# Take the coffee cup direct requirements.
objects.store(damagesPerImpact, impactsPerDollar, damages)
 
cat("Ovariables damagesPerImpact, impactsPerDollar, damages saved.\n")
coffee <- opbase.data("Op_en5902.coffeecupinputs") # Download the data from Opasnet Base.
coffee$Obs <- NULL # Remove the redundant Obs column.
 
cat("Primary prosesses related to a cup of coffee (in Euro)\n")
 
oprint(coffee)
# Combine the direct requirements of a coffee cup with a full vector of requirements and fill empty cells with 0.
 
coffee <- merge(data.frame(directRequirements = rownames(impactsPerDollar)), coffee, all.x = TRUE)
coffee$Result[is.na(coffee$Result)] <- 0
 
# Get the normalisation data for different damages and make an ovariable out of it.
 
# temp <- tidy(opbase.data("Op_en5904"), objname="normalisation")
temp <- opbase.data("Op_en5904")
temp$Obs <- NULL
 
normalisation <- EvalOutput(new("ovariable",
name = "normalisation",  
data = temp
))
 
oprint(normalisation@data)
 
impactsPerDollar <- impactsPerDollar * coffee$Result # Multiply data matrix with activities.
 
out <- impactsPerDollar %*% damagesPerImpact # Do a matrix multiplication
 
# After matrix operations, turn out into a data.frame for graphics.
 
out <- as.data.frame(out)
 
out$directRequirements <- rownames(out)
out <- melt(out, idvars = "directRequirements", variable_name = "damages") # Reshape into long format
 
sums <- as.data.frame(as.table(tapply(out$value, out["directRequirements"], sum)))
limit <- sort(sums$Freq, decreasing = TRUE)[show_bins]
keeps <- sums[sums$Freq > limit , "directRequirements"]
 
out$directRequirements <- as.factor(ifelse(out$directRequirements %in% keeps, out$directRequirements, "Other"))
 
#out <- out[out$value >= sum(out$value) * limit , ] # Remove all rows with smaller values than the limit.
out <- dropall(out)
# Alternative approach: very small values of B are merged to "Other" category in A: temp$A  as.factor(ifelse(temp$B <= 6, "Other", temp$A))
 
# 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 <- damages / normalisation * 365 # Normalise and scale to daily values.
 
# Plot results on a bar graph.
 
cat("Effects smaller than", limit*100, "% of the total effect are not shown.\n")
 
#oprint(damageFractions)
 
ggplot(damageFractions@output, aes(x = Damage, weight = Result, fill = directRequirements)) + geom_bar() +
theme_grey(base_size = 24) +
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 180: 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