powersimdata.tests package¶
Submodules¶
powersimdata.tests.mock_analyze module¶
- class powersimdata.tests.mock_analyze.MockAnalyze(grid_attrs=None, congl=None, congu=None, ct=None, demand=None, bus_demand=None, lmp=None, pf=None, pg=None, dcline_pf=None, storage_e=None, storage_pg=None, solar=None, wind=None, hydro=None)[source]¶
Bases:
object
A mock of a powersimdata.scenario.analyze.Analyze object.
- Parameters:
grid_attrs (dict) – fields to be added to grid.
congl (pandas.DataFrame) – dummy congl
congu (pandas.DataFrame) – dummy congu
ct (dict) – dummy ct
demand (pandas.DataFrame) – dummy demand
lmp (pandas.DataFrame) – dummy lmp
pf (pandas.DataFrame) – dummy pf
pg (pandas.DataFrame) – dummy pg
storage_pg (pandas.DataFrame) – dummy storage_pg
solar (pandas.DataFrame) – dummy solar
wind (pandas.DataFrame) – dummy wind
hydro (pandas.DataFrame) – dummy hydro
- exported_methods = ['get_congl', 'get_congu', 'get_ct', 'get_bus_demand', 'get_demand', 'get_grid', 'get_lmp', 'get_pf', 'gt_dcline_pf', 'get_pg', 'get_storage_pg', 'get_storage_e', 'get_solar', 'get_wind', 'get_hydro', 'get_profile']¶
powersimdata.tests.mock_builder module¶
powersimdata.tests.mock_change_table module¶
powersimdata.tests.mock_context module¶
powersimdata.tests.mock_grid module¶
- class powersimdata.tests.mock_grid.MockGrid(grid_attrs=None, model='usa_tamu')[source]¶
Bases:
AbstractGrid
powersimdata.tests.mock_profile_input module¶
- class powersimdata.tests.mock_profile_input.MockProfileInput(grid: Grid, start_time='2016-01-01 00:00:00', end_time=None, periods=24, freq='H', random_seed=6669)[source]¶
Bases:
object
MockInputData is a mock of powersimdata.input.profile_input.ProfileInput that generates random profiles.
Exactly 3 of {start_time, end_time, periods, freq} must be specified. See <https://pandas.pydata.org/docs/reference/api/pandas.date_range.html>.
- Parameters:
grid (powersimdata.input.grid.Grid) – instance of Grid object.
start_time (str) – when profiles begin.
end_time (str) – when profiles end.
periods (int) – number of times in profile.
freq (str) – frequency of times in profile.
random_seed (int) – used to initialize the random generator.
- Raises:
ValueError – raised if field_name specified in get_data() is not specified by this mock
- Returns:
(powersimdata.tests.mock_profile_input.MockProfileInput)
powersimdata.tests.mock_scenario module¶
powersimdata.tests.mock_scenario_info module¶
- class powersimdata.tests.mock_scenario_info.MockScenarioInfo(scenario=None)[source]¶
Bases:
ScenarioInfo
- area_to_loadzone(area, area_type=None)[source]¶
- Map the query area to a list of loadzones. For more info, see
- Parameters:
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(set) – set of loadzones associated to the query area
- get_available_resource(area, area_type=None)[source]¶
- Find the available resources of a specific area in the grid of the
given scenario
- Parameters:
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(list) – a list of available resources in the query area
- get_capacity(gentype, area, area_type=None)[source]¶
- Calculate the total capacity of the query gentype in the query area
of the given scenario
- Parameters:
gentype (str) – type of generator
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(float) – total capacity (in MW) based on the specified parameters
- get_capacity_factor(gentype, area, start_time, end_time, area_type=None)[source]¶
- Calculate the capacity factor of the query gentype in the
query area during the query time range of the given scenario
- Parameters:
gentype (str) – type of generator
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
start_time (str) – start timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
end_time (str) – end timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(float) – capacity factor based on the specified parameters
- Raises:
ZeroDivisionError – if no generator of gentype is found in the area
- get_curtailment(gentype, area, start_time, end_time, area_type=None)[source]¶
- Calculate the curtailment of the query gentype in the query
area during the query time range of the given scenario
- Parameters:
gentype (str) – type of generator
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
start_time (str) – start timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
end_time (str) – end timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(float) – curtailment percentage (rounded up to two decimals) based on the specified parameters
- get_demand(area, start_time, end_time, area_type=None)[source]¶
- Calculate the total demand of the query area during the query time
range of the given scenario
- Parameters:
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
start_time (str) – start timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
end_time (str) – end timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(float) – total demand (in MWh) based on the specified parameters
- get_generation(gentype, area, start_time, end_time, area_type=None)[source]¶
- Calculate the total generation of the query gentype in the query
area during the query time range of the given scenario
- Parameters:
gentype (str) – type of generator
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
start_time (str) – start timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
end_time (str) – end timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(float) – total generation (in MWh) based on the specified parameters
- get_no_congest_capacity_factor(gentype, area, start_time, end_time, area_type=None)[source]¶
- Calculate the no congestion capacity factor of the query gentype
in the query area during the query time range of the given scenario
- Parameters:
gentype (str) – type of generator
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
start_time (str) – start timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
end_time (str) – end timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(float) – no congestion capacity factor based on the specified parameters
- get_profile_resource(gentype, area, start_time, end_time, area_type=None)[source]¶
- Calculate the total resource from profile of the query gentype in
the query area during the query time range of the given scenario
- Parameters:
gentype (str) – type of generator
area (str) – one of: loadzone, state, state abbreviation, interconnect, ‘all’
start_time (str) – start timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
end_time (str) – end timestamp in the format ‘YYYY-MM-DD HH:MM:SS’
area_type (str) – one of: ‘loadzone’, ‘state’, ‘state_abbr’, ‘interconnect’
- Returns:
(float) – total resource from profile (in MWh) based on the specified parameters
- Raises:
ValueError – if the resource type is invalid