Except where otherwise noted, this content is Copyright (c) 2020, RTE and licensed under a CC-BY-4.0 license.

Cost and Prioritization

Welcome to the next tutorial !

We will discover why hadar use cost and how to use it.

Hadar is an adequacy optimizer, like every optimizer it needs cost to determinie the best solution. In hadar, the cost to optimize represent a kind of cost needed to perform network adequacy. Than means Hadar will always try to: - use the cheaper production - use the cheaper path inside network - if hadar can’t match consumption asked, it will turn off cheaper unavailable consumption cost

Production Prioritize

Let’s start an example with a single node, there are 3 types of productions: solar, nuclear, oil. We want to use first all solar, then switch to nuclear and use oil only as last chance. To see production prioritize, we attach a growing consumption to this node.

import numpy as np
import hadar as hd

build study

study = hd.Study(horizon=30)\
            .consumption(name='load',   cost=10**6, quantity=np.arange(30))\
            .production(name='solar',   cost=10,    quantity=10)\
            .production(name='nuclear', cost=100,   quantity=10)\
            .production(name='oil',     cost=1000,  quantity=10)\

# tips: If you give just one element, hadar will extended it according horizon size and scenario size

solve study

optimizer = hd.LPOptimizer()
res = optimizer.solve(study)

instance an aggragator to analyze result

agg = hd.ResultAnalyzer(study=study, result=res)

inject aggregator inside plottting to visualize result

plot = hd.HTMLPlotting(agg=agg)