Grid Creation¶
This module provides functions for creating and manipulating power system grids.
functions are found in pyflow_acdc.grid_creator
Core Grid Class¶
Creating a Grid¶
import pyflow_acdc as pyf
grid = pyf.Grid()
Create Grid From Data¶
A more detailed description of the function can be found in the CSV files for importing data page.
- Create_grid_from_data(S_base, AC_node_data=None, AC_line_data=None, DC_node_data=None, DC_line_data=None, Converter_data=None, data_in='Real')¶
Creates a new grid from pandas DataFrames containing component data.
Parameter
Type
Description
S_basefloat
Base power in MVA
AC_node_dataDataFrame
AC node pandas, geopandas or csv string
AC_line_dataDataFrame
AC line pandas, geopandas or csv string
DC_node_dataDataFrame
DC node pandas, geopandas or csv string
DC_line_dataDataFrame
DC line pandas, geopandas or csv string
Converter_dataDataFrame
Converter pandas, geopandas or csv string
data_instr
Input data format (‘pu’ or ‘Ohm’ if not assumed in Real values)
Returns
grid, res
Grid and Results objects
Example
grid, results = pyf.Create_grid_from_data(100, ac_nodes_df, ac_lines_df)
Create Grid From Matpower¶
- Create_grid_from_mat(matfile)¶
Creates a grid from a MATPOWER case file.
Load your (.m) matpower case in matlab and save the variable as a .mat file.
- Parameters:
matfile (str) – Path to .mat file
- Returns:
Grid and Results objects
- Return type:
list[Grid, Results]
Example
grid, results = pyf.Create_grid_from_mat("case9.mat")
Create Grid From Turbine Graph¶
- Create_grid_from_turbine_graph(array_graph, Data, S_base=100, cable_types=[], cable_database=None, cable_types_allowed=3, curtailment_allowed=0.05, max_turbines_per_string=None, LCoE=1, trenching_cost=1, MIP_time=None, name=None)¶
Creates a grid from an array graph and turbine metadata, intended for wind farm array studies.
Create Grid From Pickle¶
- Create_grid_from_pickle(path, use_dill=False)¶
Loads a previously serialized grid from a pickle/dill file.
Extend Grid From Data¶
- Extend_grid_from_data(grid, AC_node_data=None, AC_line_data=None, DC_node_data=None, DC_line_data=None, Converter_data=None, data_in='Real')¶
Extends an existing grid with additional components.
Parameter
Type
Description
gridGrid
Existing grid to extend
AC_node_dataDataFrame
AC node pandas, geopandas or csv string
AC_line_dataDataFrame
AC line pandas, geopandas or csv string
DC_node_dataDataFrame
DC node pandas, geopandas or csv string
DC_line_dataDataFrame
DC line pandas, geopandas or csv string
Converter_dataDataFrame
Converter pandas, geopandas or csv string
data_instr
Input data format (‘Real’ or ‘pu’)
Returns
Grid
Extended grid object
Example
pyf.Extend_grid_from_data(grid, new_ac_nodes_df)
Reset All Classes¶
- initialize_pyflowacdc()¶
Resets all component class counters. This function is neeed if you have installed pyflow_acdc directly from pip. Create_grid_from_data and Create_grid_from_mat automatically call this function so you dont need to.
Example
pyf.initialize_pyflowacdc()
Change Base Power¶
under development
- change_S_base(grid, Sbase_new)¶
Changes the power base of a grid.
Parameter
Type
Description
gridGrid
Grid to modify
Sbase_newfloat
New base power in MVA
Returns
Grid
Modified grid
Example
pyf.change_S_base(grid, 100)
Create Sub Grid¶
- create_sub_grid(grid, Area=None, Area_name=None, polygon_coords=None)¶
Creates a sub-grid from a larger grid based on area or coordinates. At the moment only works unidirectionally, initial grid is useless after creation of sub-grid. Sub-grid is created as a new grid object. can be created from Area objects, area object names or polygon coordinates.
Parameter
Type
Description
gridGrid
Original grid
Arealist of Area objects
Area object defining sub-grid
Area_namelist of str
Name of area for sub-grid
polygon_coordspolygon coordinates
Coordinates defining sub-grid boundary
Returns
list[Grid, Results]
Sub-grid and Results objects
Example
subgrid, results = create_sub_grid(grid, Area_name="Zone1")