Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include DC branches when reading GMLC-formatted csv files #281

Merged
merged 2 commits into from
May 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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