Energy balance in Stuttgart: Difference between revisions
(→Rationale: energy balance equations changed to new format) |
(→Calculations: old code archived, new code copied from Energy balance Kuopio) |
||
Line 74: | Line 74: | ||
=== Calculations === | === Calculations === | ||
<rcode | <rcode name="answer" graphics="1"> | ||
library(OpasnetUtils) | |||
library(ggplot2) | |||
N <- 10 | |||
objects.latest("Op_en5141", code_name = "initiate") | |||
balance <- Ovariable("balance", ddata = "Op_en5815.equations") | |||
# | balance@data$Equation <- as.character(levels(balance@data$Equation)[balance@data$Equation]) # Change factor into character. | ||
balance@data$Policy[balance@data$Policy == ""] <- NA # Prepare indices for fillna. This should be part of fillna. | |||
balance@data$CHPcapacity[balance@data$CHPcapacity == ""] <- NA | |||
balance@data <- fillna(balance@data, marginals = 1:2) # Fill empty slots in indices. | |||
nonlinearity <- Ovariable("nonlinearity", ddata = "Op_en5815", subset = "Nonlinearity parameters") | |||
energy.balance <- EvalOutput(energy.balance) | |||
energy.balance@marginal[colnames(energy.balance@output) == "energy.balanceVar"] <- TRUE # This has to be done manually because CheckMarginals does not notice this as a marginal. | |||
energy.balance@marginal[colnames(energy.balance@output) %in% nonlinearity@output$critIndex] <- FALSE # Nonlinear indices are demarginalised because only one of the two equations apply. | |||
oprint(summary(energy.balance)) | |||
energy.balance | ggplot(energy.balance@output, aes_string(x = "energy.balanceVar", y = "energy.balanceResult", fill = "Policy")) + | ||
geom_boxplot() + | |||
theme_grey(base_size = 24) + | |||
theme(axis.text.x = element_text(angle = 90, hjust = 1)) | |||
objects. | # objects.store(energy.balance) | ||
</rcode> | </rcode> | ||
* See [[Energy balance]]. | |||
* [http://en.opasnet.org/en-opwiki/index.php?title=Energy_balance_in_Stuttgart&oldid=30516 Old code available here]. Unfortunately it does not run any more, because input data has been reformatted. | |||
==See also== | ==See also== |
Revision as of 06:35, 18 August 2013
Moderator:nobody (see all) |
This page is a stub. You may improve it into a full page. |
Upload data
|
Question
What are the amounts of energy produced, consumed, imported, and exported in Stuttgart?
Answer
⇤--#: . Rcode for using the ovariable is needed. --Jouni 23:03, 26 February 2013 (EET) (type: truth; paradigms: science: attack)
Rationale
There are several energy transformations that each describe a specific process of energy production or use. Per unit activity, there is a constant amount of different inputs and outputs into and from this process, respectively. These unit processes are used for Stuttgart in such a way that one critical input or output from each relevant energy transformation is listed here; all other inputs and outputs logically follow from the nature of the transformation process.
Data
Obs | Equation | Dummy | Description |
---|---|---|---|
1 | STP renewable energy + STP electricity = STP local heating | 1 | Balance Solar Thermal Pump. In energy balance, inputs and outputs cancel out |
2 | STP electricity = 0.363636364*STP renewable energy | 1 | Fraction STP renewable energy. Amount of electricity is used as comparison for renewable energy. 8/22 Electricity divided by renewable energy |
3 | CHP gas + CHP renewable energy + CHP mineral oil = CHP local heating + CHP electricity + CHP loss | 1 | Balance CHP Plants. In energy balance, inputs and outputs cancel out |
4 | CHP renewable energy + CHP mineral oil = 0.564814815*CHP gas | 1 | Fraction CHP gas. Sum of other fuels is used as comparison for gas. (108+14)/216 Others divided by gas |
5 | CHP gas + CHP mineral oil = 2.12962963*CHP renewable energy | 1 | Sum of other fuels is used as comparison for renewable energy. Fraction CHP renewable energy. (216+14)/108 Others divided by renewable energy |
6 | CHP electricity + CHP loss = 1.770491803*CHP local heating | 1 | Fraction CHP local heating. Sum of other outputs is used as comparison for local heating. (84+132)/122 Others divided by local heating. |
7 | CHP local heating + CHP loss = 3.023809524*CHP electricity | 1 | Fraction CHP electricity. Sum of other outputs is used as comparison for electricity. (122+132)/84 Others divided by electricity |
8 | WWP renewable energy = WWP electricity | 1 | Balance Water, Wind, Photovlotaics. In energy balance, inputs and outputs cancel out |
9 | TPP electricity input + TPP mineral oil + TPP gas = TPP local heating + TPP electricity output + TPP loss | 1 | Balance Thermal Power Plant Pfaffenwald. In energy balance, inputs and outputs cancel out |
10 | TPP mineral oil + TPP gas = 23.33333333*TPP electricity input | 1 | Fraction TPP electricity input. Sum of other fuels is used as comparison for electricity input. (43+167)/9 Others divided by electricity input |
11 | TPP electricity input + TPP gas = 4.093023256*TPP mineral oil | 1 | Fraction TPP mineral oil. Sum of other fuels is used as comparison for mineral oil. (9+167)/43 Others divided by mineral oil |
12 | TPP electricity output + TPP loss = 0.335365854*TPP local heating | 1 | Fraction TPP local heating. Sum of other outputs is used as comparison for local heating. (50+5)/164 Others divided by local heating |
13 | TPP local heating +TPP loss = 3.38*TPP electricity output | 1 | Fraction TPP electricity output. Sum of other outputs is used as comparison for electricity. (164+5)/50 Others divided by electricity |
14 | TPE waste + TPE gas + TPE coal + TPE mineral oil = TPE electricity + TPE district heating + TPE loss | 1 | Balance Thermal Power Plant EVU. In energy balance, inputs and outputs cancel out |
15 | TPE gas + TPE coal + TPE mineral oil = 1.04973357*TPE waste | 1 | Fraction TPE waste. Sum of other fuels is used as comparison for waste. (162+1019+1)/1126 Others divided by waste |
16 | TPE waste + TPE coal + TPE mineral oil = 13.24691358*TPE gas | 1 | Fraction TPE gas. Sum of other fuels is used as comparison for gas. (1126+1019+1)/162 Others divided by gas |
17 | TPE waste + TPE gas + TPE mineral oil = 1.264965653*TPE coal | 1 | Fraction TPE coal. Sum of other fuels is used as comparison for coal. (1126+162+1)/1019 Others divided by coal |
18 | TPE district heating + TPE loss = 5.089709763*TPE electricity | 1 | Fraction TPE electricity. Sum of other outputs is used as comparison for electricity. (1101+828)/379 Others divided by electricity |
19 | TPE electricity + TPE loss + 1.096276113*TPE district heating | 1 | Fraction TPE district heating. Sum of other outputs is used as comparison for district heating. (379 +828)/1101 Others divided by district heating |
20 | Ind gas = Ind electricity + Ind loss | 1 | Balance Industrial Plants. In energy balance, inputs and outputs cancel out |
21 | Ind electricity = 0.533333333*Ind loss | 1 | Fraction Ind loss. Amount of district heating is used as comparison for loss. 8/15 district heating per loss |
22 | STP local heating = 0.245901639*CHP local heating | 1 | Fraction local heating producers. CHP local heating production is used as reference. 30/122 STP local heating divided by CHP local heating |
23 | Ind electricity = 0.095238095*CHP electricity | 1 | Fraction electricity producers 1. 8/84 Ind electricity divided by TPE district heating |
24 | WWP electricity = 0.797619048*CHP electricity | 1 | Fraction electricity producers 2. CHP electricity production is used as reference. 67/84 WWP electricity divided by CHP electricity |
25 | TPP electricity output = 0.595238095*CHP electricity | 1 | Fraction electricity producers 3. CHP electricity production is used as reference. 50/84 TPP electricity divided by CHP electricity |
26 | TPE electricity = 4.511904762*CHP electricity | 1 | Fraction electricity producers 4. CHP electricity production is used as reference. 379/84 TPE electricity divided by CHP electricity |
27 | Loss local heating = 0.041139241*STP local heating + 0.041139241*CHP local heating + 0.041139241*TPP local heating | 1 | Transmission loss local heating. Known loss divided by production. 13/(30+122+164) |
28 | Loss electricity = 0.221088435*CHP electricity + 0.221088435*WWP electricity + 0.221088435*TPP electricity output + 0.221088435*TPE electricity + 0.221088435*Ind electricity | 1 | Transmission loss electricity. Known loss divided by production. 130/(84+67+50+379+8) |
29 | Loss district heating = 0.109900091*TPE district heating | 1 | Transmission loss district heating. Known loss divided by production. 121/1101 |
30 | CES local heating = 0.366666667*STP local heating | 1 | Consumption in the Energy Sector local heating. STP local heating is used as reference. 11/30 |
31 | CES electricity = 1.392857143*CHP electricity | 1 | Consumption in the Energy Sector electricity. CHP electricity is used as reference. 117/84 |
32 | V renewable energy = 0.272727273*STP renewable energy | 1 | Vorketten renewable energy. STP renewable energy is used as reference. 6/22 |
33 | V coal = 0.103042198*TPE coal | 1 | Vorketten coal. TPE coal is used as reference. 105/1019 |
34 | V electricity = 17.79683377*TPE electricity | 1 | Vorketten electricity. TPE electricity is used as reference. 6745/379 |
35 | V gas = 2.027777778*CHP gas | 1 | Vorketten gas. CHP gas is used as reference. 438/216 |
36 | V mineral oil = 12.3255814*TPP mineral oil | 1 | Vorketten mineral oil. TPP mineral oil is used as reference. 530/43 |
37 | Bought electricity + CHP electricity + WWP electricity + TPP electricity output + TPE electricity + Ind electricity = STP electricity + TPP electricity input + Loss electricity + CES electricity + V electricity + Cons Ind electricity + Cons Traffic electricity + Cons Home electricity + Cons Commerce electricity | 1 | Electricity use balance. In energy balance, inputs and outputs cancel out |
38 | STP local heating + CHP local heating + TPP local heating = Loss local heating + CES local heating + Cons Ind local heating + Cons Home local heating + Cons Commerce local heating | 1 | Local heating balance. In energy balance, inputs and outputs cancel out |
39 | Bought district heating + TPE district heating = Loss district heating + Cons Ind district heating + Cons Home district heating + Cons Commerce district heating | 1 | District heating balance. In energy balance, inputs and outputs cancel out |
40 | Cons Ind electricity = 2257 | 1 | Consumed electricity industry |
41 | Cons Traffic electricity = 224 | 1 | Consumed electricity traffic |
42 | Cons Home electricity = 1077 | 1 | Consumed electricity households |
43 | Cons Commerce electricity = 695 | 1 | Consumed electricity commerce |
44 | Cons Ind local heating = 35 | 1 | Consumed local heating industry |
45 | Cons Home local heating = 54 | 1 | Consumed local heating households |
46 | Cons Commerce local heating = 203 | 1 | Consumed local heating commerce |
47 | Cons Ind district heating = 513 | 1 | Consumed districit heating industry |
48 | Cons Home district heating = 35 | 1 | Consumed districit heating households |
49 | Cons Commerce district heating = 851 | 1 | Consumed districit heating commerce |
A data table on an Opasnet page is used to enter the matrix data. This is rather user friendly. As a side effect, the table does not look like a matrix so it might be confusing in the beginning. The matrix is created by using the "Equation" as information about the row of the matrix and "Col" as information about the column of the matrix. "Result" is the actual value, and Description is anything useful for a reader (it is not used in calculations).
Calculations
- See Energy balance.
- Old code available here. Unfortunately it does not run any more, because input data has been reformatted.
See also
- Previous way of presenting energy balances in Stuttgart: consumption, transformations, supply
- About large systems of non-linear equations: BB package in R
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>