GridData Module

Module containing PowerGAMA GridData class and sub-classes

Grid data and time-dependent profiles

class powergama.GridData.GridData

Class for grid data storage and import

Methods

branchDistances([R]) computes branch distance from node coordinates, resuls in km
branchFromNodeIdx() get node indices for branch FROM node
branchToNodeIdx() get node indices for branch TO node
computePowerFlowMatrices([baseZ]) Compute and return dc power flow matrices B’ and DA
dcBranchFromNodeIdx() get node indices for dc branch FROM node
dcBranchToNodeIdx() get node indices for dc branch TO node
getAllAreas() Return list of areas included in the grid model
getAllGeneratorTypes([sort]) Return list of generator types included in the grid model
getConsumerAreas() List of areas for each consumer
getConsumersPerArea() Returns dictionary with indices of loads within each area
getDcBranches() Returns a list with DC branches in the format [index,from area,to area]
getDcBranchesAtNode(nodeIdx, direction) Indices of all DC branches attached to a particular node
getFlexibleLoadStorageCapacity(consumer_indx) flexible load storage capacity in MWh
getGeneratorAreas() List of areas for each generator
getGeneratorsAtNode(nodeIdx) Indices of all generators attached to a particular node
getGeneratorsPerAreaAndType() Returns dictionary with indices of generators within each area
getGeneratorsPerType() Returns dictionary with indices of generators per type
getGeneratorsWithPumpAtNode(nodeIdx) Indices of all pumps attached to a particular node
getGeneratorsWithPumpByArea() Returns dictionary with indices of generators with pumps within each area
getIdxBranchesWithFlowConstraints() Indices of branches with less than infinite branch capacity
getIdxBranchesWithLength() Indices of branches with specified length
getIdxConsumersWithFlexibleLoad() Indices of all consumers with flexible load
getIdxDcBranchesWithFlowConstraints() Indices of DC branches with less than infinite branch capacity
getIdxGeneratorsWithNonzeroInflow() Indices of all generators with nonzero inflow
getIdxGeneratorsWithPumping() Indices of all generators with pumping capacity
getIdxGeneratorsWithStorage() Indices of all generators with nonzero and non-infinite storage
getIdxNodesWithLoad() Indices of nodes that have load (consumer) attached to them
getInterAreaBranches([area_from, area_to, acdc]) Get indices of branches from and/or to specified area(s)
getLoadsAtNode(nodeIdx) Indices of all loads (consumers) attached to a particular node
getLoadsFlexibleAtNode(nodeIdx) Indices of all flexible nodes attached to a particular node
readGridData(nodes, ac_branches, …[, …]) Read grid data from files into data variables
readProfileData(filename, timerange[, …]) Read profile (timeseries) into numpy arrays
readSipData(nodes, branches, generators, …) Read grid data for investment analysis from files (PowerGIM)
spreadNodeCoordinates([radius, inplace]) Spread nodes with identical coordinates in a small circle with radius r
writeGridDataToFiles(prefix) Save data to new input files
getBranchAreas  
getDcBranchAreas  
numBranches  
numConsumers  
numDcBranches  
numGenerators  
numNodes  
branchDistances(R=6373.0)

computes branch distance from node coordinates, resuls in km

Uses haversine formula

Parameters:
R : radius of the Earth
branchFromNodeIdx()

get node indices for branch FROM node

branchToNodeIdx()

get node indices for branch TO node

computePowerFlowMatrices(baseZ=1)

Compute and return dc power flow matrices B’ and DA

Parameters:
baseZ : float (impedance should already be in pu.)

base value for impedance

Returns:
(Bprime, DA) : compressed sparse row matrix
dcBranchFromNodeIdx()

get node indices for dc branch FROM node

dcBranchToNodeIdx()

get node indices for dc branch TO node

getAllAreas()

Return list of areas included in the grid model

getAllGeneratorTypes(sort='fuelcost')

Return list of generator types included in the grid model

getBranchAreas()
getConsumerAreas()

List of areas for each consumer

getConsumersPerArea()

Returns dictionary with indices of loads within each area

getDcBranchAreas()
getDcBranches()

Returns a list with DC branches in the format [index,from area,to area]

getDcBranchesAtNode(nodeIdx, direction)

Indices of all DC branches attached to a particular node

getFlexibleLoadStorageCapacity(consumer_indx)

flexible load storage capacity in MWh

getGeneratorAreas()

List of areas for each generator

getGeneratorsAtNode(nodeIdx)

Indices of all generators attached to a particular node

getGeneratorsPerAreaAndType()

Returns dictionary with indices of generators within each area

getGeneratorsPerType()

Returns dictionary with indices of generators per type

getGeneratorsWithPumpAtNode(nodeIdx)

Indices of all pumps attached to a particular node

getGeneratorsWithPumpByArea()

Returns dictionary with indices of generators with pumps within each area

getIdxBranchesWithFlowConstraints()

Indices of branches with less than infinite branch capacity

getIdxBranchesWithLength()

Indices of branches with specified length

getIdxConsumersWithFlexibleLoad()

Indices of all consumers with flexible load

getIdxDcBranchesWithFlowConstraints()

Indices of DC branches with less than infinite branch capacity

getIdxGeneratorsWithNonzeroInflow()

Indices of all generators with nonzero inflow

getIdxGeneratorsWithPumping()

Indices of all generators with pumping capacity

getIdxGeneratorsWithStorage()

Indices of all generators with nonzero and non-infinite storage

getIdxNodesWithLoad()

Indices of nodes that have load (consumer) attached to them

getInterAreaBranches(area_from=None, area_to=None, acdc='ac')

Get indices of branches from and/or to specified area(s)

area_from = area from. Use None (default) to leave unspecifie area_to= area to. Use None (default) to leave unspecified acdc = ‘ac’ (default) for ac branches, ‘dc’ for dc branches

getLoadsAtNode(nodeIdx)

Indices of all loads (consumers) attached to a particular node

getLoadsFlexibleAtNode(nodeIdx)

Indices of all flexible nodes attached to a particular node

keys_powergama = {'branch': {'capacity': None, 'node_from': None, 'node_to': None, 'reactance': None, 'resistance': 0}, 'consumer': {'demand_avg': None, 'demand_ref': None, 'flex_basevalue': 0, 'flex_fraction': 0, 'flex_on_off': 0, 'flex_storage': 0, 'flex_storagelevel_init': 0.5, 'flex_storval_filling': '', 'flex_storval_time': '', 'node': None}, 'dcbranch': {'capacity': None, 'node_from': None, 'node_to': None, 'resistance': 0}, 'generator': {'desc': '', 'fuelcost': None, 'inflow_fac': None, 'inflow_ref': None, 'node': None, 'pmax': None, 'pmin': None, 'pump_cap': 0, 'pump_deadband': 0, 'pump_efficiency': 0, 'storage_cap': 0, 'storage_ini': 0, 'storage_price': 0, 'storval_filling_ref': '', 'storval_time_ref': '', 'type': None}, 'node': {'area': None, 'id': None, 'lat': None, 'lon': None}}
keys_sipdata = {'branch': {'capacity': None, 'capacity2': 0, 'cost_scaling': None, 'distance': -1, 'expand': None, 'expand2': None, 'max_newCap': -1, 'node_from': None, 'node_to': None, 'reactance': 0, 'type': None}, 'consumer': {'demand_avg': None, 'demand_ref': None, 'emission_cap': -1, 'node': None}, 'dcbranch': {'capacity': 0, 'node_from': '', 'node_to': '', 'resistance': 0}, 'generator': {'cost_scaling': 1, 'desc': '', 'expand': None, 'expand2': None, 'fuelcost': None, 'fuelcost_ref': None, 'inflow_fac': None, 'inflow_ref': None, 'node': None, 'p_maxNew': -1, 'pavg': 0, 'pmax': None, 'pmax2': 0, 'pmin': None, 'type': None}, 'node': {'area': None, 'cost_scaling': None, 'existing': None, 'id': None, 'lat': None, 'lon': None, 'offshore': None, 'type': None}}
numBranches()
numConsumers()
numDcBranches()
numGenerators()
numNodes()
readGridData(nodes, ac_branches, dc_branches, generators, consumers, remove_extra_columns=False)

Read grid data from files into data variables

readProfileData(filename, timerange, storagevalue_filling=None, storagevalue_time=None, timedelta=1.0)

Read profile (timeseries) into numpy arrays

readSipData(nodes, branches, generators, consumers)

Read grid data for investment analysis from files (PowerGIM)

This is used with the grid investment module (PowerGIM)

time-series data may be used for consumer demand generator inflow (e.g. solar and wind) generator fuelcost (e.g. one generator with fuelcost = power price)

spreadNodeCoordinates(radius=0.01, inplace=False)

Spread nodes with identical coordinates in a small circle with radius r

Parameters:
radius : float

radius in degrees for the size of the spread

inplace : boolean

if true, update GridData object

Returns:
coords : array

lat,lon pandas array for nodes

writeGridDataToFiles(prefix)

Save data to new input files