Skip to content

Commit

Permalink
Include DC branches when reading GMLC-formatted csv files
Browse files Browse the repository at this point in the history
  • Loading branch information
darrylmelander committed May 20, 2022
1 parent 8eaf97c commit f05824a
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions egret/parsers/rts_gmlc/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,24 +480,20 @@ def _read_branches(base_dir:str, elements:dict, bus_id_to_name:dict) -> 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 f05824a

Please sign in to comment.