Using marginal emission factor for demand side energy flexibility

Dear openmod community,

As my first post here, I would like to outline my current research (idea) that is related to energy systems modeling/analysis. After providing a brief outline of what I plan to do, I’d like to invite you to provide me with feedback on whether you think the topic fits the scope of this forum and on the idea in general.

Personal background
I’m a PhD student in mechanical engineering, and I also have a BSc/MSc in MechE. I’ve been working mostly on life cycle assessment in the past three years, being involved various research projects and assisting in teaching. More recently, I joined the project flexess, in which I will be assessing the environmental impact of demand side energy flexibility.

Central idea
I’d like to develop a methodology, which should ultimately result in a computational tool, to assess the environmental impact of demand side energy flexibility. In this context, I define energy flexibility measures as interventions which result in a change of electricity demand from the grid (e.g. load shifting, energy efficiency, installing on-site renewables, installing battery storage etc.). The marginal emission factor, calculated as demonstrated by Hawkes (2010) (paywalled/only upon request, unfortunately), is to be calculated with a high temporal and spatial resolution and multiplied with the consumer’s electrical load profile to result in the overall environmental impact.

Target audience
The methodology’s/tool’s target audience are energy managers within organizations, e.g. industrial and commercial enterprises. Their role is to ensure the energy supply for their organization in a cost-effective, reliable manner. My assumption is that in the past, their job has been centered more around procuring energy (negotiating contracts with their energy supplier), whereas now they have to include a lot more options (e.g. rooftop-PV, power-purchase-agreements, storage etc.) into the energy portfolio. Also, their organization is under increasing pressure from customers to reduce the environmental impact of their products/services. I’m happy to receive feedback whether that assessment is correct.

Use cases
The methodology could provide decision support in the following use cases:

  • Installing on-site renewable generation capacity
  • Installing energy storage
  • Load-shifting (e.g. smart charging of EVs, how to operate servers, see Google/Tomorrow partnership
  • Energy efficiency measures (reducing overall load)
  • Siting: where to implement energy flexibility measure
  • & more

General procedure
The methodology consists roughly of the following steps:

  • Define goal and use case
  • User input (e.g. load profile(s), location(s), planning horizon)
  • Where load profiles do not exist (yet), generate synthetic load profiles from simulations
  • Calculate marginal emission factor (MEF) from historical energy system data (ENTSO-E) - linear regression of change in emission and change in system load
  • For short term (<24 h) prediction of the MEF: use more advanced statistical methods as demonstrated e.g. by Leerbeck et al. (2020), Huber et al. (2020)
  • Combine MEF with electrical load profile to calculate total environmental impact
  • Calculate environmental impact of equipment etc. to be “offset” (e.g. PV, batteries etc.) using life cycle assessment
  • Combine electricity related impact with secondary impact (equipment) to overall impact


  • Power-plant specific emission factors
  • Not just CO2/global warming potential, but also other environmental impact categories (see. e.g. Siler-Evans et al. (2012), Braeuer et al. 2020
  • Include upstream emissions for fuels
  • Include electricity imports/exports
  • Sub-national spatial resolution
  • Open (based on open data, open code, open documentation etc.)

Differences to “traditional” energy systems modeling/analysis
From what I was able to grasp by looking around this forum, and from the little bit of contact I’ve had with the community at the “Jahrestreffen 2021 des Forschungsnetzwerks Energiesystemanalyse” last week, my scope is a little different than the typical energy systems modeling/analysis approach (please correct me if I’m wrong). I try to avoid using average emission factors, as is frequently done in LCA (except for consequential LCA), for assessing the impacts of electricity consumption. I think the MEF provides a better representation of the dynamics within the electricity system. However, I take the system more or less as a black box, and only describe its behavior using energy system data such as time series of generation and system load. I try to avoid having to implement a complex system model such as PYPSA-EUR, if possible - even if I admire what you can do with it (from what I’ve understood so far). Yet, I’m curious to find out which benefits this may provide, and which model may be best suited for the purpose I described. Since I address decision-makers on the electricity consumer side, not policy-makers or grid operators, my focus is more on assessing the impact within the current electricity system (and the near future, but not 2050). I admit that for decisions that involve the implementation of equipment with a service life of 20 years or more (e.g. photovoltaics), this approach has its limitations.

Your thoughts
I hope I was able to lay out my thoughts clearly. Please do let me know which aspects you’d like me to elaborate on further. This is just a rough outline, I have more details but wanted to keep this first post reasonably short. I’m looking forward to hearing about your thoughts on the goal, scope and approach. Also, I tried to follow the forum guidelines, but please let me know if I missed something.


On a first reading, your quest is, in essence, the interplay between individual actors and the system collectively — with the system likely to display complex behaviours. And navigating the resolution needed to reveal those behaviours and still remain computable will be a challenge. And while PyPSA can be operated stepwise (recursive dynamic), it is usually run with perfect foresight and under intertemporal optimization. In short, you have an interesting task ahead of you. I am rather thinking that adding actors to your model might have merit, to produce some kind of hybrid ABM/network model? In any case, average emissions factors can certainly mask important effects. But storage introduces complications in this regard too. HTH, R.

Hi @robbie.morrison, thank you for your swift reply!

I agree with how you summarized it, what I plan to do is study the interplay between individual actors (consumers/prosumers) and a complex system (electricity supply/distribution), and guide the actors towards environmentally beneficial choices.
I have not done agent based modeling in the past, some of my colleagues have, using AnyLogic (commercial software). Do you (or others) happen to know any open ABM software which you can recommend? When you talk about network modeling, do you refer to models like SciGrid or gridkit? Or something else?


xeona environment

Ten or so years ago I designed, coded, and tested a modeling environment named xeona. The code was never published (GitHub barely existed), nor was the model ever run on real problems. Key aspects:

  • actors who variously made dispatch decisions, offered bids, and formed contracts (and who could potentially negotiate)
  • actors who variously consumed energy‑services or resources
  • an electricity network with fixed‑frequency AC load flow (as per nodal pricing)
  • a gas grid and supercritical carbon‑dioxide network (not indicated in the diagram below)
  • energy markets including the nodal pricing of wholesale electricity
  • various operator dispatch strategies, including arbitrary dispatch stacks (do not scale well)
  • sector‑coupling via contracts, non‑convex tariffs (common in practice)
  • buildings and building services (including HVAC), occupant behaviors

Some limitations:

  • future trajectories are unlikely to be optimal in any sense
  • characterizing agents remains difficult
  • the quantity of data to be assembled and managed

Shown pictorially (the resource flows may form graphs, as can the actors):

Moreover, certain actors could clone a copy of the simulation during runtime to undertake their own private analysis (cute huh?).

I just uploaded the code to zenodo in PDF form for inspection (code licensed GPL‑3.0):

I am not suggesting you use that codebase or even write in C++. But because this design spans agent‑based modeling and operations research, you might not find a suitable supported environment? At the bottom of everything is a structural matrix and goal function to be solved. If I did this exercise again, I would look at Julia. That said, with C++, there was always a solution to any and every coding problem one encountered.

You might also want to look at this recent work which, based on the abstract, shares some broad design similarities:

  • Poletti, Stephen (1 February 2021). “Market power in the New Zealand electricity wholesale market 2010–2016”. Energy Economics. 94: 105078. ISSN 0140-9883. doi:10.1016/j.eneco.2020.105078. Paywalled.

Tobias Wittmann worked on household investment decisions using bounded rationality at the same time xeona was written with the idea of folding those ideas into xeona — although that never happened:

Maybe this article is of interest too:

Historically, xeona was preceded by deeco as discussed the above paper. And before that ecco.

In short, xeona embedded every idea I could assemble into the one model — but on reflection, perhaps some compromise would have been useful? Hope you find some interesting ideas here nonetheless?

And perhaps other live projects might like to comment on the feasibility of extending their models to accommodate some of the more detailed operational features that xeona bundled, particularly around actors? R

1 Like

@robbie.morrison : wow, that modeling environment really does seem to encompass a lot. I will take a look at the references you provided and return with more specific questions and, hopefully, ideas. Thank you for uploading the code, and for providing the references!
As for coding, I have some limited experience with Python, not with C++ or Julia, however.

@robbie.morrison : I now read the paper you linked to (“POLICY-ORIENTED ENERGY SYSTEM MODELING WITH XEONA” - it appears that the link and the DOI didn’t match, so I have one more paper to read still :slight_smile: ). I’ll briefly summarize it (feedback welcome if I got something wrong), and then add my thoughts.


  • xeona is a policy oriented energy system modeling environment
  • It falls under the complex adaptive system paradigm and takes a dynamical networked systems approach
  • It has three layers: the actor, technical and zone layers
  • In the actor layer, commercial interactions take place
  • Actors are agents that do not follow the neo-classical economic paradigm of being perfectly rational actors with complete information, but instead follow bounded rationality behavior (incomplete information, insufficient computational resources etc.). They are grouped by legal entity, examples include market/generator/grid operators or households.
  • The technical layer depicts the resource stocks and flows (generation / transmission / consumption). It is the demand for exergy services, which is modeled in this layer (?), that drives the whole model. In this layer, you will find plant (can be a generator, but also a house). Each plant has at least one actor.
  • The zone layer supplies context information to actors and plant (e.g. ambient temperature, interest rate).
  • Decision making in xeona can be grouped into operational (e.g. unit commitment) and structural decisions (e.g. plant investment). Another way to categorize decisions is to distinguish between low-stakes (bounded rationality, within model) and high-stakes decisions (supplied externally, e.g. from scenario).
  • xeona supports policy decision making from two directions: a) report overall performance (cost, emissions), b) embedding and in-situ testing of policy measures (e.g. feed-in tariffs, taxation etc.)

Example in the paper
The following figure is from the paper discussed above:

  • The figure depicts the result from an exemplary application of xeona, where the resulting cost and emissions from installing a fuel cell (FC) for supplying heat and electricity to an apartment complex is compared to other technologies & combinations of technologies (solar collectors, wind turbines, demand reduction)
  • Findings: a) the results depend on parameters of the technologies (e.g. storage volume, collector area) b) results are sensitive to the quality of local integration c) policy formulation can be based on these results to target specific technologies.

My thoughts

  • xeona looks very sophisticated and elaborate, judging not just from this paper, but also the 1200 pages of code
  • It is probably overpowered for my purposes
  • The example discussed in the paper (fuel cell) is basically the exact type of decision I also want to provide support for, just that in my case I would be targeting primarily industry and commerce, and I do not seek to provide information for policy making, but instead help actors on the demand side pick the right technology / place it / size it / operate it.
  • I see the role of the decision support that I plan to provide as coming before a detailed modeling and analysis. The tool I plan to develop could inform the “best” technology, location (if off-site is an option) and technical parameters for their purpose, and then a detailed energy systems model could be used to verify that the technical constraints are not transgressed, inform about the resulting cost etc. “Best” by my definition means “creating the least additional environmental impact / creating the greatest environmental benefits by reducing electricity generation related emissions elsewhere”. Does that seem to make sense?

Hi @MalteSchaefer

I just fixed the faulty download URL (my mistake earlier trying to squish some linkrots). The other paper is this:

  • Morrison, Robbie, Tobias Wittmann, Jan Heise, and Thomas Bruckner (2005). In Kjelstrup, Signe, Johan E Hustad et al (editors). Chapter: Policy‑oriented energy system modeling with ‘xeona’. Trondheim, Norway: Tapir Academic Press. pp 659–668. ISBN 82‑519‑2041‑8. Conference held Norwegian University of Science and Technology (NTNU) on 20–22 June 2005.

What you write is broadly correct. Jan Heise plotted the “flying kites” using Matlab and the originals were in color too. I had an “exergy” phase and that extended to the notion of “exergy‑services”. That said, deeco in particular dealt well with thermal processes and low grade heat. Some of the early investigations used seasonal thermal storage for winter‑time space heating via heat pumps. Nowadays electrification is in vogue and swimming pool sized thermal storage is out.

Demand, preferably for services than outright exergy, comes from the actors representing occupants, factory operators, and so forth. And these actors are entitled to turn down their thermostats if they so wish. There was a building thermal performance module and an air chiller module in xeona. The latter based on this wonderful paper (which Berit Erlach tracked down in a dusty university library basement):

  • Plank, Rudolf (1940). “Zur thermodynamischen Bewertung von Kältemitteln”. Zeitschrift für die gesamte Kälte‑Industrie. 6: 81–84.

The question of whether system constraints derive from ‘above’ via policy or ‘below’ via spending trade‑offs are matters of framing and analytical taste. But the public policy dilemma is how to incentivize socially‑desirable behaviors using socially‑acceptable means. I guess that is central to your project although you frame the core issue as more one of decision support than policy design? This press article also usefully highlights the difference between system and actor incentives — in this case cost‑centric and profit‑centric system views:

In terms of technology, smart systems were not being discussed much when deeco and xeona were designed. But those possibilities are now center stage and you will no doubt have to tackle communication‑rich technologies head on — maybe that traffic requires a fourth layer?

The question of mixing operations and investment decisions will doubtless take careful navigation. Recursive dynamic optimization is necessarily sequential — as is real life. And investment decisions are naturally actor‑specific and not necessarily system optimal. Indeed, delaying investment to capitalize on scarcity is a well worn track.

I was not suggesting that either xeona or C++ would be useful. (I once downloaded and built GENESYS from source, but that took two days of agonizing work.) Just that the ideas embedded might spark something.

Finally, to respond to your definition of “best” — there lies much of the heart of the problem — the alignment of social benefit and individual incentive. Good luck!

Hi @robbie.morrison , thank you again for your detailed response.

Response to previous post
Being still at an early stage in my research career, I wonder how I will look back on work now in a few years, and what phase I will ascribe it to :slight_smile: (referring here to your “exergy-phase”)…

Regarding actor modeling, it will probably be much less detailed in my case - not at the level of individual thermostat adjustment. I will try to lay out a description of the actors in my approach in a bit more detail further down.

Thank you for pointing out the Guardian article. It helped me to better distinguish between the concepts off “cost-oriented” and “profit-oriented”, which I had not clearly separated in my head before. As for my approach, you stated correctly it is more geared towards decision support for individual actors on the consumer side (e.g. energy managers of an industrial or commercial enterprise) than towards policy-makers. However, if applying my approach shows that the solution which is the most beneficial for the environment (assuming I’m able to model this relationship correctly) is not the most profitable for the consumer, then this could result in recommendations for policy-makers.

I cannot say that I have enough insight on deeco or xeona to assess whether a fourth layer for communication makes sense, but it does seem like a reasonable suggestion.

As for your arguments on investment decisions, I want to emphasize that I do not plan to include the financial side, only assess the environmental impact in my approach. This may seem a bit naive, and I am well aware that the primary driver for actors in private business (who I am addressing) is still money. I argue that a lot of research is already focusing on the financial side of energy investments (including actors on the demand side), and hence a variety of methods and tools is already available for decision makers seeking to judge the financial costs and benefits of load shifting, energy efficiency measures, installing rooftop-PV or stationary battery storage (to name a few examples). However, my impression is that not quite as many methods and tools are available for an actor who is interested in assessing the environmental impact of their business (e.g. from the business’s electricity consumption), what they can do to offset this environmental impact in an active manner (beyond just procuring “green electricity”), which decisions are relevant in this context (e.g. siting, sizing), and which decision lead to the lowest environmental impact outcome. Of course, at some point in this process, the financial side will be evaluated as well, and adjustments will most likely be made.

But of course you are right, just like for financial decisions, the context for the environmental impact assessment changes constantly, and I don’t really know how to deal with that yet. If I assume a marginal emission factor based on the energy system of 2020, the impact assessment will be way off for an investment like a PV module which lasts 20 years or longer. On the other hand, I could use the results from energy systems modeling to describe scenarios 20 years into the future, with the downside of having to get into all the nitty-gritty details of the models, the data, the scenarios and to be able to describe them, understand them, and assess their reliability. Some ideas in that regard are:

  • Calculate the marginal emission factor for fictional future energy system states and hope that the investment decisions are robust (do not change much for the direction the MEF will likely take
  • Use a two-tiered approach for short-term and long-term investment decisions, where I extrapolate the MEF for the short-term decisions (e.g. based on the projected installed capacity per generation type for the next 2-3 years) and ??magic?? for the long-term decisions
  • Additional ideas are welcome!

As for your final remark on the alignment of social benefit and individual incentive: yes, this is a tricky one to solve, and I’m well aware I’m not the first one to make an attempt to address a tiny little aspect of the problem. Like I tried to explain above, I see my contribution as a tool in a long tool-chain involved in decision making, which contributes only to the environmental side of the decision making process. The results will certainly not be the only ones taken into account, but I hope they can help to get a clearer picture of one relevant aspect (environmental impact), and to identify the best / nearly the best solution regarding the energy-related impact of an enterprise that lies within their direct sphere of influence (thank you to Fabian Neumann and Tom Brown for making me aware of the value of exploring near-optimal solutions).

Some more of my own thoughts
I’ll try here to get a bit more specific about the target audience, and the kinds of decisions I want to provide support for. As I explained above, I would like to focus on the environmental impact, and my target audience are energy managers in industrial and commercial enterprises. Under pressure from customers, investors and regulators, they need to find a way how to reduce the environmental impact stemming from the enterprise’s energy demand. While in the past, it may have been enough to argue that their company buys “green” electricity, so carbon-neutral, this is now generally accepted to not be far-reaching enough anymore. So now the energy manager needs to take a more pro-active stance, but she may not be aware of all the technology options that exist, the kinds of decisions that need to be taken, which aspects are important etc.

Starting from this perspective, I’ll briefly summarize the types of decisions at hand, and the inputs and outputs of each of the steps:

  1. Screening: assess impact from current electricity use (accounting)
    Inputs: current load profile, location
    Outputs: environmental impact (temporally resolved)
  2. Assess change in impact resulting from change in electricity use profile (prospective assessment)
    2.1 Shifting: load shifting of electricity demand (classic DSM)
    Inputs: current load profile, alternative load profiles (optional), location
    Outputs: environmental impact (temporally resolved), comparison of alternatives (optional), times during which to reduce/increase electricity demand
    2.2 Selecting: picking the best technology (generation, storage) for a given context
    Inputs: current load profile, location, types of technologies to consider, technology parameters (e.g. energy content, peak power)
    Outputs: environmental impact for each technology
    2.3 Siting: picking the location for a technology for a given context
    Inputs: current load profile, type of technology, technology parameters (e.g. energy content), locations that are potentially considered (all of Germany? specific sites?)
    Outputs: environmental impact per location
    2.4 Sizing: picking the right parameters (e.g. peak power) for a given context
    Inputs: current load profile, location, type of technology
    Outputs: technology parameters with the lowest impact / set of parameters that offset the organization’s impact

For everything labeled as “accounting” (step 1), I would use average emission factors (AEF), as I find this measure appropriate for a backwards-looking, overall assessment of the impact related to energy consumed in the past. Likewise, for everything labeled as “prospective” (step 2), I would use the MEF, which I find more appropriate in this context.

For the Siting step, one could include an option to distinguish between on-site and off-site locations. On-site locations would assume an installation “behind-the-meter”, thus affecting the grid consumption in this location. Off-site placements would not affect the grid consumption in the location where the enterprise has their facilities, but instead would be credited with an avoided impact proportional to the temporally and spatially resolved MEF of where new generation or storage capacity is installed (minus the LCA calculated impact from producing the battery/PV module/etc.).

For the Selecting, Siting and Sizing step, I would assume that the overall environmental footprint of the company (e.g. carbon footprint) or alternatively from its electricity consumption is known, and the goal is to offset this impact through energy technology (= energy efficiency, load shifting, installing new generation or storage capacity). If the impact is not known, then the first step (Screening) can be taken to calculate this value (perhaps make this step mandatory? Not sure yet how to handle this).

Finally, the steps Selecting, Siting and Sizing will probably often be done in combination with one another, so I have to think about in which sequence I want to go through them, which initial parameters I want to assume etc. If anyone has some ideas on how to best approach this, I’m happy to hear them!

Since I typed this post on my rooftop, my brain is slightly fried now (thank you sunshine :slight_smile: ), so I’ll stop here. In a follow-up post some time next week, I’ll go into a bit more detail on the calculations and potential data sources that I have in mind, and the big question marks still remaining.

Until then, I invite anyone to contribute with ideas, criticism, question etc.

Have a great rest of your Sunday!

Text and images licensed under CC BY 4.0Data licensed under CC0 1.0Code licensed under MITSite terms of serviceOpenmod mailing listOpenmod wiki.