Environment and Computer Laboratory I MATLAB: Life Cycle Assessment and Uncertainty Modelling 1. Mathematical basics of LCA The strength of LCA is that it does not only consider direct emissions induced by a final demand of a product, but also up- and downstream emissions from the supply and disposal chains of that product. Figure 1 shows the simplified supply chain of diesel. If we want to know the total amount of diesel that is needed to produce 1 kg of diesel for final consumption, we will have to translate the graph structure of Figure 1 into the so-called technology matrix A. a1,1 A=( ⋮ ai,1 ai,j: ⋯ a1,j ⋱ ⋮ ) ⋯ ai,j (1) output of the ith product during the jth process (inputs are negative outputs) Figure 1. Simplified supply chain of diesel production. Diesel is needed for the extraction of ore, extracted ore is needed for steel production, and steel is needed for the production of diesel. Thus, we have loops in the supply chain of diesel. Equation 2 describes a solution to solve these loops and to determine the amount of diesel that is needed to produce 1 kg of diesel. s A 1f s: f: A: (2) scaling vector final demand vector technology matrix If we have a final demand of 1 kg diesel, then the scaling vector s will tell us how much of each process output we will use in total (direct and in the supply chain) to produce 1 kg of diesel. The life cycle emissions are calculated in a further step by multiplying s with the so-called intervention or biosphere matrix B. B holds all direct emissions and resource consumption a process generates. -1- Environment and Computer Laboratory I g Bs g: B: inventory results intervention matrix b1,1 B=( ⋮ bm,1 bm,j: (3) ⋯ ⋱ ⋯ b1,j ⋮ ) bm,j (4) mth direct emission of the jth process Inventory vector g holds the results for the total life cycle emissions for the demand of 1 kg diesel (life cycle inventory results). These emissions can be characterized, as it is done for instance for the global warming potential, by multiplying g with the characterization matrix Q: h Qg (5) h: Q: characterization result characterization matrix 2. Calculating LCA with Matlab In this exercise we will calculate the total global warming potential (GWP) induced by the final demand of 1 kg of diesel with the help of Matlab. Download ‘matlab_data.zip’ from the course homepage and save it to the desktop and change the current folder path in Matlab accordingly. The zip-file contains ‘data.mat’, which stores the intervention and characterization matrices B and Q. The technology matrix A is given below. Table 1. Technology matrix A. Diesel [kg] Crude oil [kg] Steel [kg] Electricity [kWh] Ore [kg] Coal [kg] Diesel [kg] Crude oil [kg] Steel [kg] Electricity [kWh] Ore [kg] Coal [kg] 1 -1.07 -0.01 -0.05 0 0 -0.01 1 -0.001 0 0 0 0 0 1 -0.17 -2.4 -0.7 0 -0.17 -0.001 1 0 0 -0.05 0 -0.01 0 1 0 -0.05 0 -0.01 0 0 1 To construct the 6-by-6 matrix A in Matlab, begin with a matrix that contains only zeros. >> A=zeros(6,6); Enter the non-zero values of A into the matrix. Always close your Matlab statement with a semicolon. Otherwise the result of your command will be displayed. Note that the first number in brackets marks the row and the second the column. -2- Environment and Computer Laboratory I >> A(2,1)= -1.07; >> A(3,1)= -0.01; etc. After entering all non-zero values write a Matlab script that calculates the scaling vector s, the inventory results g and the characterization result h. Go to ‘File/New/Script’ and begin your script with: function [s, g, h]=lca(f, A, B, Q) Enter all needed equations (Hint: you will find them all described in section 1), close your function with end and save. Hint: The inversion of matrix A can be solved either by inv(A) (inverse) or A\f (Gaussian elimination). Before you can run the script you need to define a final demand vector f. You can define f similar to A. >> f=zeros(6,1); As you want to calculate the environmental impacts of the demand of 1 kg of diesel, you have to enter: >> f(1,1)=1; Now you can run your script with: >> [s, g, h]=lca(f, A, B, Q); By double clicking you can check out s, g, and h in the variable editor of Matlab. What do you see? How much is needed to produce 1 kg of diesel. 3. Uncertainty modeling There are different ways to calculate uncertainties. We will use Monte Carlo simulation. Thereby, in a first step, we generate a number of samples of the technology matrix A and the intervention matrix B, and then do LCA calculations for each sample. The sample size has thus to be large enough to represent the uncertainties accurately, but also small enough to reduce computational time. To be able to sample A and B, we need their distribution types and the respective uncertainty parameters. For the sake of simplicity we will assume that all non-zero values of A and B are lognormally distributed. The mean of A and B are given by the previous exercise. The squares of the geometric standard deviation are given below. -3- Environment and Computer Laboratory I Table 2. Squares of the geometric standard deviation (SD95) of technology matrix A (Asd95). Diesel [kg] Crude oil [kg] Steel [kg] Electricity [kWh] Ore [kg] Coal [kg] Diesel [kg] Crude oil [kg] Steel [kg] Electricity [kWh] Ore [kg] Coal [kg] 0 1.05 3 1.05 0 0 1.05 0 3 0 0 0 0 0 0 1.05 1.05 1.05 0 1.05 3 0 0 0 1.05 0 3 0 0 0 1.05 0 3 0 0 0 Table 3. Squares of the geometric standard deviation (SD95) of intervention matrix B (Bsd95). CO2 [kg] CH4 [kg] N2O [kg] Diesel [kg] Crude oil [kg] Steel [kg] Electricity [kWh] Ore [kg] Coal [kg] 1.05 1.5 1.5 1.05 1.5 1.5 1.05 1.5 1.5 1.05 1.5 1.5 1.05 1.5 1.5 1.05 1.5 1.5 Translate Table 3 and Table 4 into Matlab matrices Asd95 and Bsd95. Copy ‘lhs.m’, ‘um.m’ and ‘ctv.m’ from ‘matlab_data.zip’ to your Matlab folder. Perform now the sampling with: >> [Asample, Bsample]=lhs(A, Asd95, B, Bsd95, nsample); We use a method called Latin Hypercube to sample A and B. For the sample size ‘nsample’ you can choose any integer value bigger than 0. After sampling A and B we can now do the LCA calculations for each sample. >> [ssample, gsample, hsample]=um(f, Asample, Bsample, Q); As a result you will get the scaling vectors, inventory results and characterization results for each sample. The histogram shows you the distribution of the characterization results. Try to obtain the 5%, 50% and 95% percentiles by entering: >> P=prctile(hsample,[5,50,95]) What do these percentiles look like for the amount of crude oil that is used in the life cycle? Hint: ssample(2,:). 4. Contribution to variance Geisler et al. (2007) state in their article that, ‘the contribution of a single uncertain input parameter to the distribution of the result of an impact category can be calculated according to: -4- Environment and Computer Laboratory I ni −1 2 2 CTVi,j = ri,j ∙ (∑ ri,j ) (6) i=1 where CTVi,j is the contribution to variance of one uncertain input parameter i to the probability distribution of the result of the impact category j (dimensionless), ri,j is the rankorder correlation coefficient between the parameter i and the score of impact category j, and ni is the number of parameters contributing to the variance in the result of impact category j. Contribution to variance measures the influence of an input parameter on the distribution of a result in terms of dispersion as well as in terms of the absolute order of magnitude of the results' values.’ Try to calculate the CTV for A and B: >> [ctvA, ctvB]=ctv(Asample, Bsample, hsample); What parameters of A and B have the highest contributions to the variance? The generated Hinton diagrams give you a visual indication. Can you explain why their contribution is dominant? 5. Uncertainty parameter estimation by means of Pedigree matrix With the help of the pedigree approach we will find a new SD95 value for the input of steel in the diesel production. Table 4. Default uncertainty factors applied in conjunction with the pedigree matrix. Source: Frischknecht et al. (2004). 1 1 1 1 1 1 1 Indicator score Reliability U1 Completeness U2 Temporal correlation U3 Geographical correlation U4 Further technological correlation U5 Sample size U6 2 1.05 1.02 1.03 1.01 1.02 3 1.1 1.05 1.1 1.02 1.2 1.05 2 +ln(U )2 +ln(U )2 +ln(U )2 +ln(U )2 +ln(U )2 2 3 4 5 6 SD95 = e√ln(U1 ) 4 1.2 1.1 1.2 1.5 1.1 5 1.5 1.2 1.5 1.1 2 1.2 (7) The pedigree score is (3,2,3,3,4,2). Calculate the new SD95 value by means of equation 7. Replace the old SD95 value with the new one and calculate again the contribution to variance. Thus you have to sample first and then do the uncertainty modeling (cf. section 3). How does the contribution to variance change? 6. Uncertainty parameter estimation by means of distribution fitting You received CH4 measurement results from a crude oil extraction facility. The data is saved in the variable ‘CH4_measured’ that you also find in the ‘data_LCA.mat’ file. Before -5- Environment and Computer Laboratory I you can estimate the uncertainty parameters for the distribution of the CH4 emissions, you have to check, if the data is lognormally distributed. You do this by a Chi-square goodness-of-fit hypothesis test. The test compares the values in the data vector to a standard normal distribution. The null hypothesis is that the data has a standard normal distribution. The alternative hypothesis is that the data does not have that distribution. The result of the test is 1 if it rejects the null hypothesis at the 5% significance level, and 0 otherwise. As the test is applicable for normal distributions you have to take the logarithm of our measured data to test the hypothesis H for the lognormal distribution. >> H=chi2gof(log(CH4_measured)) If H=0, the data is normally distributed and we can now fit the measured CH4 data to a lognormal distribution and obtain the parameter and . >> param=lognfit(CH4_measured); In a last step, you have to transform and to a form usable for the applied Latin Hypercube sampling method. Therefore you perform two following calculations according to Heijungs and Frischknecht (2005). >> B(2,2)=exp(param(1,1)+0.5*(param(1,2)^2)); >> Bsd95(2,2)=exp(2*param(1,2)); As you now have replaced the old mean and SD95 values of CH4 emissions coming from a crude oil extraction process with the new mean and SD95 values, you are able to calculate again the contribution to variance. Thus, you have to sample first and then do the uncertainty modeling (cf. section 3). How does the contribution to variance change? -6-
© Copyright 2026 Paperzz