Energy balance
Moderator:Jouni (see all) 
This page is a stub. You may improve it into a full page. 
Upload data

Question
What is energy balance and how is it modelled?
Answer
Summing up the amount of energy produced and subtracting the amount of energy consumed within a time period gives the energy balance. Since the electricity grid and district heat network lack significant storage mechanics, the balance has to be virtually zero over short periods. When considering the balance of a particular area (e.g. Helsinki), we can make the assumption that electricity can be imported and exported in international markets. The energy in the district heat network, however, has to be produced locally. This sets up the nontrivial problem of optimising production so that there are no significant deficits as well as minimising losses and maximising profits. This problem is solved (to some extent) by market forces in the real world.
In Opasnet, there are two different ways to calculate energy balance. Our most recent energy balance model uses linear programming tools to solve an optimum for the activity of a given set of production units in simulated instances created by the main model. The main model is responsible for the decision making aspects, while the energy balance optimisation only functions as an approximation of real world market mechanics. This version was used in Helsinki energy decision 2015.
The previous version was based on setting up a set of linear equations describing the inputs, outputs, and shares of different energy and plant processes. This approach is less flexible, because it does not use an optimising function and everything must be described as linear (or piecewise linear). However, this approach was successfully used in Energy balance in Kuopio and Energy balance in Suzhou.

Example of energy balance model: District heat flow in Helsinki. The scenarios are from the assessment Helsinki energy decision 2015.

Example of energy balance model: Electric power heat flow in Helsinki. The scenarios are from the assessment Helsinki energy decision 2015.

Example of energy balance model: Incomes and costs of energy production in Helsinki. The scenarios are from the assessment Helsinki energy decision 2015.
This code is an example how the energy balance model is used in a city case. The data comes from Helsinki energy decision 2015.
Rationale
Energy balance with linear programming
The linear programming problem is set up as follows.
For each production unit: let x_{i} be activity of the plant. Lets also have variables y_{j} for deficits and excesses for each type of energy produced.
The objective function is the function we are optimising. Each production unit has a unit profit per activity denoted by a_{i} which is determined by the amount of different input commodities (e.g. coal) per amount of different output commodities (i.e. electricity and heat) and their market prices. Also, lets say we want to make sure that district heat demand is always met when possible and have a large penalty factor for each unit of heat demand not met (1 M€ in the model). In addition, it must be noted that excess district heat becomes wasted so it counts as loss. Let these deficit and excess related losses be denoted by b_{j}. The whole objective function then becomes: sum(x_{i}a_{i}) + sum(y_{j}b_{j}).
The values of variables are constrained by equalities and inequalities: the sum of production of a commodity is equal to its demand minus deficit plus excess, activity is constrained by the maximum capacity and all variables are nonnegative by definition. This can be efficiently solved by computers for each given instance. Production windup and winddown is ignored, since time continuity is not considered. As a consequence fuel limits (e.g. diminishing hydropower capacity) are not modelled completely either.
 Ovariables like EnergyNetworkOptim below are used in Helsinki energy decision 2015. Prices of fuels in heat production are used as direct inputs in the optimising.
There is an alternative way for calculating fuel use. It is based on the idea that for each heating type, there is a constant share of fuels used. For some heating types, this is generic and is shown on this page. For some others, the constant is casespecific and is determined on a casespecific page.
The table below contains connections of heating types and fuel usage in generic situations. There may be casespecific differences, which must be handled separately.
Data updated successfully!
Obs  Heating  Burner  Fuel  Fraction  Description 

1  Wood  Household  Wood  1  
2  Oil  Household  Light oil  1  
3  Gas  Household  Gas  1  
4  Heating oil  Household  Light oil  1  
5  Coal  Household  Coal  1  
6  Other sources  Household  Other sources  1  
7  No energy source  Household  Other sources  1  
8  Geothermal  Grid  Electricity  0.3  Geothermal does not sum up to 1 because more heat is produced than electricity consumed. 
9  Centrifuge, hydroextractor  Grid  Electricity  0.3  Not quite clear what this is but presumably a heat pump. 
10  Solar heater/ collector  Grid  Electricity  0.1  Use only; lifecycle impacts omitted. 
11  Electricity  Grid  Electricity  1  
12  District  Undefined  Heat  1 
Old version with a set of linear equations
 Energy balances are described as input = output on a coarse level (called classes) where the structure is the same or similar to the OECD energy balance tables. If possible, this is described on the Energy balance method level and it is shared by all cities.
 On more detailed (variable level in the matrix), the fraction of each variable of the total class are described separately. Fractions are city specific and they are described on city level in a separate table.
 Based on the fraction table, detailed equations with variables are created. The format will be fraction * class total = variable.
 The last fraction has zero degrees of freedom when the class total is given. However, it must have a variable and thus a row in the fraction table. The result for that variable is an empty cell (which results in NA).
 Unlike in the previous version, all variables are given either as values or equations, and the user interface is not used for BAU. In contrast, user interface or decision table may be used to derive values for alternative scenarios.
 To make this work, the cityspecific fraction data must be defined as ovariable (so that it can be changed with a decision table), and also the energy balance method must be described asa ovariable. How are we going to make the two interplay, as we may want to have several cities?
 Define one city ovariable and evaluate energy balance with that. The ovariable has a generic name. Then, define a new city ovariable with the same name and reevaluate the energy balance ovariable; this must be done so that the two cities are appended rather than replaced.
 city ovariables are appended first into a large fraction table, and then that is used to create the large energy balance matrix. ←#: . This is clearly better. Jouni 17:09, 21 February 2013 (EET) (type: truth; paradigms: science: defence)
 The cityspecific ovariable may have Iter and other indices. A separate matrix is created and solved for each unique combination of indices. This makes it possible to have a very flexible approach.
 We should check if the energy balance matrix (see Matti's Excel) has cityspecific equations. If possible, energy transformations are described as generic equations on the energy balance method.
 Structure of OECD Energy balance tables (data):
 Fuel (given as observation columns in OECD table)
 Activity (row in OECD table)
 Description
 Structure of the generic process table
 Columns for fraction table
 Class
 Item
 Result (fraction)
 Indices as needed
 Example table for making matrices from text format equations. CHPcapacity describes which of the piecewise linear equations should be used. Policy is a decision option that alters the outcome. Dummy is only for compatibility but it is not used.
Data updated successfully!
Obs  CHPcapacity  Policy  Equation  Dummy  Description 

1  Biofuel  CHP renewable = CHP peat  1  Biofuel policy contains half biofuels, half peat  
2  BAU  CHP renewable = 89.24  1  
3  CHP peat + CHP renewable + CHP oil = CHP heat + CHP electricity  1  
4  CHP peat = 9098*CHP oil  1  
5  CHP electricity = 0.689*CHP heat  1  
6  CHP<1000  H heat = 0.08*CHP heat  1  Small heat plants reflect the total heat need  
7  CHP>1000  CHP heat + CHP electricity = 1000  1  But production capacity of CHP may be overwhelmed, decoupling CHP heat and H heat.  
8  H biogas + H oil = H heat  1  
9  H oil = 18.973*H biogas  1  
10  Bought electricity + CHP electricity = Cons electricity  1  
11  CHP heat + H heat = Cons heat  1  
12  Cons electricity = 9001100  1  
13  Cons heat = 9001000  1 
 Example table to describe the details about nonlinear equations.
Data updated successfully!
Obs  critVar  critIndex  rescol  critLocLow  critLocHigh  critValue 

1  Cons heat  CHPcapacity  Result  CHP<1000  CHP>1000  1080 
 This table is fetched if there are no nonlinearities. Therefore, there is no need to copy it to the case study page.
Data updated successfully!
Obs  critVar  critIndex  rescol  critLocLow  critLocHigh  critValue 

1 
 This table is fetched if there are no modelled upstream variables that would affect the equations.
Data updated successfully!
Obs  energybalanceVars  Result 

1 
Stored objects below used by Energy balance in Kuopio.
 Model version that was used to run results for ISEE2013.
How to give uncertain parameters?
 In equations, the content is interpreted only inside solveMatrix. Therefore, the typical approach where all unique index combinations are run one at a time does not work.
 There should be an update in parameter interpretation for terms with one entry only. It can no longer be based on as.numeric, if distributions (=text) is allowed.
 If it starts with [az.] it is a variable name.
 If it starts with [09<\\] it is a parameter value.
 Instead of params[[i]] and [[vars]] vectors, a data.frame will be created with Result as the params column.
 The data.frame is then interpreted with N = N. If parameters are probabilistic, Iter column will appear.
 When all parameters have been interpreted, check if Iter exists.
 If Iter exists, make a for loop for all values of Iter.
 Create a matrix from the parameters and solve.
 Rbind the result to a data.frame with Iter.
 Return the output.
 Old code with an input table with columns Equation, Col, Result, Description: [1]
See also
 A previous model version written by Jouni. It used linear optimising but was not fully developed and was not actually used in any final assessment. [2]
 A new version of energy balance is using optim function. See Energy balance in Helsinki.
 Energiepolitik, bitte wenden! Neue Zürcher Zeitung 27.12.2014 by Giorgio V. Müller
 TIME: Electric Cars Will Change the Way You Power Your Home. How the homes of the future will generate and store their own electricity, turning your house into a minipower plant.
 Energy supply in Europe
 media:Health impacts of energy production.ppt (a lecture that also contains explanation of an energy balance using matrices)
 Energy balance in Kuopio Describes the production and consumption of energy in Kuopio.
 Energy balance in Basel
 Energy balance in Stuttgart Describes the production and consumption of energy in Stuttgart.
 Energy balance in Suzhou Describes the production and consumption of energy in Suzhou.
 A previous method to calculate energy balances. Includes also other pages:
 Energy transformations Describes the inputs and outputs of energy processes. Shows, which other things change when some input or output is changed.
 Market allocation factor
 File:Energy supply in Europe.xls
 Climate change policies in Kuopio Indicates, which items change when a policy changes.
 Energiatase
 Kasvihuonekaasupäästöt/Kuopio
 Päätösanalyysia_ja_riskinhallintaa.ppt
 Urgenche
 http://www.energia.fi/sites/default/files/polttoaineenergian_maarittaminen_taselaskennan_avulla.pdf
 Uusiutuvan energian riskit selvitetään
 Urgenche: Mesap Planet energy model
 OpasnetUtils/Drafts
References