Skip to content

Commit

Permalink
Merge pull request #281 from darrylmelander/parse_dc_branch
Browse files Browse the repository at this point in the history
Include DC branches when reading GMLC-formatted csv files
  • Loading branch information
bknueven authored May 23, 2022
2 parents b9ae8cd + ae18489 commit 0f65944
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions egret/parsers/rts_gmlc/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,25 +479,20 @@ def _read_branches(base_dir:str, elements:dict, bus_id_to_name:dict) -> None:
branch_df = None

# add the DC branches
# TODO: see issue #229
#if os.path.exists(os.path.join(base_dir,'dc_branch.csv')):
# elements["dc_branch"] = {}
# branch_df = pd.read_csv(os.path.join(base_dir,'dc_branch.csv'))
# for idx,row in branch_df.iterrows():

# # TODO: The fields below don't match what Egrets expects or supports for DC branches.
# # The code below is just a placeholder.
# branch_dict = {
# "from_bus": bus_id_to_name[str(row['From Bus'])],
# "to_bus": bus_id_to_name[str(row['To Bus'])],
# "in_service": True,
# "branch_type": "dc",
# "resistance": float(row['R Line'])
# }

# name = str(row['UID'])
# elements["dc_branch"][name] = branch_dict
# branch_df = None
if os.path.exists(os.path.join(base_dir,'dc_branch.csv')):
elements["dc_branch"] = {}
branch_df = pd.read_csv(os.path.join(base_dir,'dc_branch.csv'))
for idx,row in branch_df.iterrows():
branch_dict = {
"from_bus": bus_id_to_name[str(row['From Bus'])],
"to_bus": bus_id_to_name[str(row['To Bus'])],
"rating_short_term": float(row['MW Load']),
"rating_long_term": float(row['MW Load']),
"rating_emergency": float(row['MW Load'])
}
name = str(row['UID'])
elements["dc_branch"][name] = branch_dict
branch_df = None

def _read_generators(base_dir:str, elements:dict, bus_id_to_name:dict) -> None:
from math import isnan
Expand Down

0 comments on commit 0f65944

Please sign in to comment.