Statistics#

Statistic functions which can be called within a pypsa.Network via n.statistics.func. For example n.statistics.capex().

Statistic methods#

capex([comps, aggregate_groups, ...])

Calculate the capital expenditure of the network in given currency.

installed_capex([comps, aggregate_groups, ...])

Calculate the capital expenditure of already built components of the network in given currency.

expanded_capex([comps, aggregate_groups, ...])

Calculate the capex of expanded capacities of the network components in currency.

optimal_capacity([comps, aggregate_groups, ...])

Calculate the optimal capacity of the network components in MW.

installed_capacity([comps, ...])

Calculate the installed capacity of the network components in MW.

expanded_capacity([comps, aggregate_groups, ...])

Calculate the expanded capacity of the network components in MW.

opex([comps, aggregate_time, ...])

Calculate the operational expenditure in the network in given currency.

supply([comps, aggregate_time, ...])

Calculate the supply of components in the network.

withdrawal([comps, aggregate_time, ...])

Calculate the withdrawal of components in the network.

transmission([comps, aggregate_time, ...])

Calculate the transmission of branch components in the network.

energy_balance([comps, aggregate_time, ...])

Calculate the energy balance of components in the network.

curtailment([comps, aggregate_time, ...])

Calculate the curtailment of components in the network in MWh.

capacity_factor([comps, aggregate_time, ...])

Calculate the capacity factor of components in the network.

revenue([comps, aggregate_time, ...])

Calculate the revenue of components in the network in given currency.

market_value([comps, aggregate_time, ...])

Calculate the market value of components in the network in given currency/MWh or currency/unit_{bus_carrier} where unit_{bus_carrier} is the unit of the bus carrier.

Statistic groupers#

Groupers can be used via the groupby argument in the statistic methods.

groupers = n.statistics.groupers
n.statistics.capex(groupby=groupers.carrier)
# or simply
n.statistics.capex(groupby='carrier')

All default groupers are defined in the pypsa.statistics.grouping.Groupers class and currently included are, grouping by ..

Custom groupers can be registered on module level via pypsa.statistics.groupers.add_grouper. The key will be used as identifier in the groupby argument.

Groupers can also be used to create multiindexed groupers. For example, to group by bus and carrier:

groupers = n.statistics.groupers
n.statistics.capex(groupby=groupers['bus', 'carrier'])
# or simply
n.statistics.capex(groupby=['bus', 'carrier'])

add_grouper(name, func)

Add a custom grouper to groupers on module level.

list_groupers()

List all available groupers which are avaliable on the module level.

carrier(n, c[, nice_names])

Grouper method to group by the carrier of the components.

bus_carrier(n, c[, port, nice_names])

Grouper method to group by the carrier of the attached bus of a component.

name(n, c)

Grouper method to group by the name of components.

bus(n, c[, port])

Grouper method to group by the attached bus of the components.

country(n, c[, port])

Grouper method to group by the country of the components corresponding bus.

unit(n, c[, port])

Grouper method to group by the unit of the components corresponding bus.