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

Get averaged congestion via the Scenario object #123

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions powersimdata/output/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_data(self, scenario_id, field_name):

:param str scenario_id: scenario id.
:param str field_name: *'PG'*, *'PF'*, *'LMP'*, *'CONGU'*, *'CONGL'*,
*STORAGE_PG* or *STORAGE_E*.
*'AVERAGED_CONG'*, *'STORAGE_PG'* or *'STORAGE_E'*.
:return: (*pandas.DataFrame*) -- specified field as a data frame.
:raises FileNotFoundError: if file not found on local machine.
:raises ValueError: if second argument is not an allowable field.
Expand Down Expand Up @@ -64,11 +64,12 @@ def _check_field(field_name):
"""Checks field name.

:param str field_name: *'PG'*, *'PF'*, *'PF_DCLINE'*, *'LMP'*, *'CONGU'*,
or *'CONGL'*, *'STORAGE_PG'* or *'STORAGE_E'*.
or *'CONGL'*, '*'AVERAGED_CONG'*', *'STORAGE_PG'* or *'STORAGE_E'*.
:raises ValueError: if not *'PG'*, *'PF'*, *'PF_DCLINE'*, *'LMP'*,
*'CONGU'*, or *'CONGL'*, *'STORAGE_PG'* or *'STORAGE_E'*.
*'CONGU'*, or *'CONGL'*, *'AVERAGED_CONG'*, *'STORAGE_PG'* or
*'STORAGE_E'*.
"""
possible = ['PG', 'PF', 'PF_DCLINE', 'LMP', 'CONGU', 'CONGL', 'STORAGE_PG',
'STORAGE_E']
possible = ['PG', 'PF', 'PF_DCLINE', 'LMP', 'CONGU', 'CONGL',
'AVERAGED_CONG', 'STORAGE_PG', 'STORAGE_E']
if field_name not in possible:
raise ValueError('Only %s data can be loaded' % " | ".join(possible))
11 changes: 11 additions & 0 deletions powersimdata/scenario/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ def get_congl(self):

return congl

def get_averaged_cong(self):
"""Returns averaged CONGL and CONGU.

:return: (*pandas.DataFrame*) -- data frame of averaged congestion with
the branch id as indices an the averaged CONGL and CONGU as columns.
"""
od = OutputData(self._ssh)
mean_cong = od.get_data(self._scenario_info['id'], 'AVERAGED_CONG')

return mean_cong

def get_storage_pg(self):
"""Returns STORAGE_PG data frame.

Expand Down