Skip to content

Add dcline through change table#166

Merged
rouille merged 4 commits intodevelopfrom
add_dcline_via_ct
May 7, 2020
Merged

Add dcline through change table#166
rouille merged 4 commits intodevelopfrom
add_dcline_via_ct

Conversation

@rouille
Copy link
Copy Markdown
Collaborator

@rouille rouille commented May 6, 2020

Purpose

Add HVDC line to existing HVDC lines following method exposed in issue #114

What is the code doing?

Create a new_dcline key in change table via the add_dcline method of the ChangeTable object. The value is a list and each entry in the list contains the information needed to add a new HVDC line to the network. Via the Scaler object, the HVDC lines are appended to the existing dcline data frame of the Grid object.

Where to look

  • powersimdata/input/change_table.py. The method add_dcline has been created.
  • powersimdata/input/tests/test_change_table.py. The add_dcline method of the ChangeTable object is tested.
  • powersimdata/input/scaler.py. Code has been written to append the new HVDC lines to existing dcline data frame of the Grid object.

Time estimate

30 min.

Test

Tests pass, including the newly written:

(v1) [~/REM/PowerSimData] (add_dcline_via_ct) brdo$ pytest . --verbose
================================================================ test session starts =================================================================
platform darwin -- Python 3.6.5, pytest-4.5.0, py-1.8.0, pluggy-0.13.0 -- /Users/brdo/PyEnv/REM/v1/bin/python
cachedir: .pytest_cache
rootdir: /Users/brdo/REM/PowerSimData
collected 113 items                                                                                                                                  

powersimdata/design/tests/test_object_persistence.py::test_create_json_of_target_object PASSED                                                 [  0%]
powersimdata/design/tests/test_object_persistence.py::test_write_read_json_of_target_object PASSED                                             [  1%]
powersimdata/design/tests/test_object_persistence.py::test_write_read_pickle_of_target_object PASSED                                           [  2%]
powersimdata/design/tests/test_resource_target_manager.py::test_expected_cap_factor PASSED                                                     [  3%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_next_capacity PASSED                                                 [  4%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_target PASSED                                                     [  5%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_shortfall_prev_gt_external PASSED                                 [  6%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_shortfall_external_gt_prev PASSED                                 [  7%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_no_shortfall_prev_gt_external PASSED                              [  7%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_no_shortfall_external_gt_prev PASSED                              [  8%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_overgeneration_prev_gt_external PASSED                            [  9%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_overgeneration_external_gt_prev PASSED                            [ 10%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_no_overgeneration_prev_gt_external PASSED                         [ 11%]
powersimdata/design/tests/test_resource_target_manager.py::test_calculate_ce_no_overgeneration_external_gt_prev PASSED                         [ 12%]
powersimdata/design/tests/test_resource_target_manager.py::test_add_resource_solar PASSED                                                      [ 13%]
powersimdata/design/tests/test_resource_target_manager.py::test_cal_prev_solar PASSED                                                          [ 14%]
powersimdata/design/tests/test_resource_target_manager.py::test_cal_prev_pacific PASSED                                                        [ 15%]
powersimdata/design/tests/test_resource_target_manager.py::test_set_allowed_resources PASSED                                                   [ 15%]
powersimdata/design/tests/test_scenario_info.py::TestScenarioInfo::test_get_available_resource PASSED                                          [ 16%]
powersimdata/design/tests/test_scenario_info.py::TestScenarioInfo::test_get_capacity PASSED                                                    [ 17%]
powersimdata/design/tests/test_scenario_info.py::TestScenarioInfo::test_get_capacity_factor PASSED                                             [ 18%]
powersimdata/design/tests/test_scenario_info.py::TestScenarioInfo::test_get_curtailment PASSED                                                 [ 19%]
powersimdata/design/tests/test_scenario_info.py::TestScenarioInfo::test_get_demand PASSED                                                      [ 20%]
powersimdata/design/tests/test_scenario_info.py::TestScenarioInfo::test_get_generation PASSED                                                  [ 21%]
powersimdata/design/tests/test_scenario_info.py::TestScenarioInfo::test_get_no_congest_capacity_factor PASSED                                  [ 22%]
powersimdata/design/tests/test_scenario_info.py::TestScenarioInfo::test_get_profile_resource PASSED                                            [ 23%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy PASSED                                                        [ 23%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy_Atlantic_2 PASSED                                             [ 24%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy_pacific_3 PASSED                                              [ 25%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy_atlantic_4 PASSED                                             [ 26%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy_pacific_external_6 PASSED                                     [ 27%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy_pacific_solar0_7 PASSED                                       [ 28%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy_pacific_solar75_8 PASSED                                      [ 29%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy_pacific_solar100_9 PASSED                                     [ 30%]
powersimdata/design/tests/test_strategies.py::test_independent_capacity_strategy_windcurtail_10 PASSED                                         [ 30%]
powersimdata/design/tests/test_strategies.py::test_collaborative_capacity_strategy PASSED                                                      [ 31%]
powersimdata/design/tests/test_strategies.py::test_collaborative_capacity_strategy_overgeneration PASSED                                       [ 32%]
powersimdata/design/tests/test_strategies.py::test_collaborative_capacity_strategy_collab_curtailment PASSED                                   [ 33%]
powersimdata/design/tests/test_strategies.py::test_adding_addl_curtailment PASSED                                                              [ 34%]
powersimdata/design/tests/test_strategies.py::test_addl_curtailment_key_error PASSED                                                           [ 35%]
powersimdata/design/tests/test_target_manager_input.py::test_can_pass PASSED                                                                   [ 36%]
powersimdata/design/tests/test_target_manager_input.py::test_create_targets_from_dataframe PASSED                                              [ 37%]
powersimdata/design/tests/test_target_manager_input.py::test_populate_strategy_from_dataframe PASSED                                           [ 38%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_branches_connected_to_bus_1 PASSED                          [ 38%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_branches_connected_to_bus_4 PASSED                          [ 39%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_branches_connected_to_bus_5 PASSED                          [ 40%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_capacity_at_bus_1_solar_str PASSED                          [ 41%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_capacity_at_bus_1_solar_tuple PASSED                        [ 42%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_capacity_at_bus_2_wind PASSED                               [ 43%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_capacity_at_bus_7_solar PASSED                              [ 44%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_capacity_at_bus_7_solar_ng PASSED                           [ 45%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_first_degree_branches_101 PASSED                            [ 46%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_first_degree_branches_108 PASSED                            [ 46%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_stub_degree_1 PASSED                                        [ 47%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_stub_degree_5 PASSED                                        [ 48%]
powersimdata/design/tests/test_transmission.py::TestStubTopologyHelpers::test_find_stub_degree_7 PASSED                                        [ 49%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_MW_n_1 PASSED                                             [ 50%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_MW_n_2 PASSED                                             [ 51%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_MW_n_3 PASSED                                             [ 52%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_MWmiles_n_1 PASSED                                        [ 53%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_MWmiles_n_2 PASSED                                        [ 53%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_MWmiles_n_3 PASSED                                        [ 54%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_bad_method PASSED                                         [ 55%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_branch_upgrades_default PASSED                            [ 56%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_branch_upgrades_n_2 PASSED                                [ 57%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_branch_upgrades_n_3 PASSED                                [ 58%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_branch_upgrades_n_4 PASSED                                [ 59%]
powersimdata/design/tests/test_transmission.py::TestIdentifyMesh::test_identify_mesh_branch_upgrades_quantile90 PASSED                         [ 60%]
powersimdata/design/tests/test_transmission.py::TestIncrementBranch::test_increment_branch_scaling_ref_and_ct_and_increment1 PASSED            [ 61%]
powersimdata/design/tests/test_transmission.py::TestIncrementBranch::test_increment_branch_scaling_ref_and_ct_and_increment2 PASSED            [ 61%]
powersimdata/design/tests/test_transmission.py::TestIncrementBranch::test_increment_branch_scaling_ref_and_custom_increment PASSED             [ 62%]
powersimdata/design/tests/test_transmission.py::TestIncrementBranch::test_increment_branch_scaling_ref_and_increment PASSED                    [ 63%]
powersimdata/design/tests/test_transmission.py::TestIncrementBranch::test_increment_branch_scaling_ref_only PASSED                             [ 64%]
powersimdata/design/tests/test_transmission.py::TestScaleRenewableStubs::test_empty_ct_inplace_default PASSED                                  [ 65%]
powersimdata/design/tests/test_transmission.py::TestScaleRenewableStubs::test_empty_ct_inplace_false PASSED                                    [ 66%]
powersimdata/design/tests/test_transmission.py::TestScaleRenewableStubs::test_empty_ct_inplace_true PASSED                                     [ 67%]
powersimdata/design/tests/test_transmission.py::TestScaleRenewableStubs::test_empty_ct_no_fuzz PASSED                                          [ 68%]
powersimdata/design/tests/test_transmission.py::TestScaleRenewableStubs::test_existing_ct_unrelated_branch_id PASSED                           [ 69%]
powersimdata/design/tests/test_transmission.py::TestScaleRenewableStubs::test_existing_ct_zone_id_solar_wind PASSED                            [ 69%]
powersimdata/design/tests/test_transmission.py::TestScaleRenewableStubs::test_existing_ct_zone_id_wind PASSED                                  [ 70%]
powersimdata/input/tests/test_change_table.py::test_add_dcline_argument_type PASSED                                                            [ 71%]
powersimdata/input/tests/test_change_table.py::test_add_dcline_argument_number_of_keys PASSED                                                  [ 72%]
powersimdata/input/tests/test_change_table.py::test_add_dcline_argument_wrong_keys PASSED                                                      [ 73%]
powersimdata/input/tests/test_change_table.py::test_add_dcline_argument_wrong_bus PASSED                                                       [ 74%]
powersimdata/input/tests/test_change_table.py::test_add_dcline_argument_same_buses PASSED                                                      [ 75%]
powersimdata/input/tests/test_change_table.py::test_add_dcline_output PASSED                                                                   [ 76%]
powersimdata/input/tests/test_grid.py::test_interconnect_type PASSED                                                                           [ 76%]
powersimdata/input/tests/test_grid.py::test_interconnect_value PASSED                                                                          [ 77%]
powersimdata/input/tests/test_grid.py::test_interconnect_duplicate_value PASSED                                                                [ 78%]
powersimdata/input/tests/test_grid.py::test_interconnect_usa_is_unique PASSED                                                                  [ 79%]
powersimdata/input/tests/test_grid.py::test_add_column_to_data_frame PASSED                                                                    [ 80%]
powersimdata/input/tests/test_grid.py::test_grid_type PASSED                                                                                   [ 81%]
powersimdata/input/tests/test_grid.py::test_drop_one_interconnect PASSED                                                                       [ 82%]
powersimdata/input/tests/test_grid.py::test_drop_two_interconnect PASSED                                                                       [ 83%]
powersimdata/input/tests/test_grid.py::test_format_gencost_polynomial_only_same_n PASSED                                                       [ 84%]
powersimdata/input/tests/test_grid.py::test_format_gencost_polynomial_only_different_n PASSED                                                  [ 84%]
powersimdata/input/tests/test_grid.py::test_format_gencost_piece_wise_linear_only_same_n PASSED                                                [ 85%]
powersimdata/input/tests/test_grid.py::test_format_gencost_piece_wise_linear_only_different_n PASSED                                           [ 86%]
powersimdata/input/tests/test_grid.py::test_format_gencost_both_model_same_n PASSED                                                            [ 87%]
powersimdata/input/tests/test_grid.py::test_link PASSED                                                                                        [ 88%]
powersimdata/input/tests/test_grid.py::test_deepcopy_works PASSED                                                                              [ 89%]
powersimdata/input/tests/test_grid.py::test_that_fields_are_not_modified PASSED                                                                [ 90%]
powersimdata/tests/test_mocks.py::TestMocks::test_mock_grid_failures PASSED                                                                    [ 91%]
powersimdata/tests/test_mocks.py::TestMocks::test_mock_grid_successes PASSED                                                                   [ 92%]
powersimdata/tests/test_mocks.py::TestMocks::test_mock_hydro_stored_properly PASSED                                                            [ 92%]
powersimdata/tests/test_mocks.py::TestMocks::test_mock_pg_stored_properly PASSED                                                               [ 93%]
powersimdata/tests/test_mocks.py::TestMocks::test_mock_solar_stored_properly PASSED                                                            [ 94%]
powersimdata/tests/test_mocks.py::TestMocks::test_mock_wind_stored_properly PASSED                                                             [ 95%]
powersimdata/utility/tests/test_transfer_data.py::test_setup_server_connection PASSED                                                          [ 96%]
powersimdata/utility/tests/test_transfer_data.py::test_get_scenario_file_from_server_type PASSED                                               [ 97%]
powersimdata/utility/tests/test_transfer_data.py::test_get_scenario_file_from_server_header PASSED                                             [ 98%]
powersimdata/utility/tests/test_transfer_data.py::test_get_execute_file_from_server_type PASSED                                                [ 99%]
powersimdata/utility/tests/test_transfer_data.py::test_get_execute_file_from_server_header PASSED                                              [100%]

================================================================== warnings summary ==================================================================
powersimdata/input/tests/test_grid.py::test_that_fields_are_not_modified
powersimdata/input/tests/test_grid.py::test_that_fields_are_not_modified
  /Users/brdo/REM/PowerSimData/powersimdata/input/grid.py:99: DeprecationWarning: Grid property access is moving to dictionary indexing, i.e. grid['branch'] consistent with REISE.jl
    DeprecationWarning

-- Docs: https://docs.pytest.org/en/latest/warnings.html
====================================================== 113 passed, 2 warnings in 16.14 seconds =======================================================

Using the following script mimicking what is done in the Scaler object I was able to test the methodology for Texas where there is no existing HVDC line (empty dcline data frame in Grid object) and for USA where there are 17 HVDC lines:

#!/usr/bin/python

import pandas as pd
import sys

from powersimdata.input.grid import Grid
from powersimdata.input.change_table import ChangeTable

interconnect = str(sys.argv[1])

g = Grid([interconnect])
print(g.dcline)


ct = ChangeTable([interconnect])

if interconnect == 'USA':
    new_dcline = [
        {'capacity': 2000, 'from_bus_id': 200, 'to_bus_id': 2000},
        {'capacity': 1000, 'from_bus_id': 3001001, 'to_bus_id': 1},
        {'capacity': 8000, 'from_bus_id': 12000, 'to_bus_id': 5996}]
elif interconnect == 'Texas':
    new_dcline = [
        {'capacity': 2000, 'from_bus_id': 3001005, 'to_bus_id': 3008158},
        {'capacity': 1000, 'from_bus_id': 3004123, 'to_bus_id': 3007092}]
else:
    print('Not implemented. Exiting')
    exit(0)

ct.add_dcline(new_dcline)
print(ct.ct)

n_new_dcline = len(ct.ct['new_dcline'])
if g.dcline.empty:
    new_dcline_id = range(0, n_new_dcline)
else:
    max_dcline_id = g.dcline.index.max()
    new_dcline_id = range(max_dcline_id + 1, max_dcline_id + 1 + n_new_dcline)
new_dcline = pd.DataFrame({c: [0] * n_new_dcline
                           for c in g.dcline.columns}, index=new_dcline_id)
print(new_dcline)

for i, entry in enumerate(ct.ct['new_dcline']):
    new_dcline.loc[new_dcline_id[i], ['from_bus_id']] = entry['from_bus_id']
    new_dcline.loc[new_dcline_id[i], ['to_bus_id']] = entry['to_bus_id']
    new_dcline.loc[new_dcline_id[i], ['status']] = 1
    new_dcline.loc[new_dcline_id[i], ['Pf']] = entry['capacity']
    new_dcline.loc[new_dcline_id[i], ['Pt']] = 0.98 * entry['capacity']
    new_dcline.loc[new_dcline_id[i], ['Pmin']] = -1 * entry['capacity']
    new_dcline.loc[new_dcline_id[i], ['Pmax']] = entry['capacity']
    new_dcline.loc[new_dcline_id[i], ['from_interconnect']] = g.bus.loc[entry['from_bus_id']].interconnect
    new_dcline.loc[new_dcline_id[i], ['to_interconnect']] = g.bus.loc[entry['to_bus_id']].interconnect

g.dcline = g.dcline.append(new_dcline)
print(g.dcline)

Output for Texas:

(v1) [~/Desktop] brdo$ python test_add_dcline.py Texas
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
Empty DataFrame
Columns: [from_bus_id, to_bus_id, status, Pf, Pt, Qf, Qt, Vf, Vt, Pmin, Pmax, QminF, QmaxF, QminT, QmaxT, loss0, loss1, muPmin, muPmax, muQminF, muQmaxF, muQminT, muQmaxT, from_interconnect, to_interconnect]
Index: []
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
{'new_dcline': [{'capacity': 2000, 'from_bus_id': 3001005, 'to_bus_id': 3008158}, {'capacity': 1000, 'from_bus_id': 3004123, 'to_bus_id': 3007092}]}
   from_bus_id  to_bus_id  status  Pf  Pt  Qf  Qt  Vf  ...  muPmin  muPmax  muQminF  muQmaxF  muQminT  muQmaxT  from_interconnect  to_interconnect
0            0          0       0   0   0   0   0   0  ...       0       0        0        0        0        0                  0                0
1            0          0       0   0   0   0   0   0  ...       0       0        0        0        0        0                  0                0

[2 rows x 25 columns]
   from_bus_id  to_bus_id  status    Pf      Pt   Qf   Qt   Vf  ...  muPmin  muPmax  muQminF  muQmaxF  muQminT  muQmaxT  from_interconnect  to_interconnect
0      3001005    3008158       1  2000  1960.0  0.0  0.0  0.0  ...       0       0        0        0        0        0              Texas            Texas
1      3004123    3007092       1  1000   980.0  0.0  0.0  0.0  ...       0       0        0        0        0        0              Texas            Texas

[2 rows x 25 columns]

Output for USA:

(v1) [~/Desktop] brdo$ python test_add_dcline.py USA
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
           from_bus_id  to_bus_id  status    Pf       Pt      Qf  ...  muQminF  muQmaxF  muQminT  muQmaxT  from_interconnect  to_interconnect
dcline_id                                                         ...                                                                        
0              2060653      66353       1   500   465.35 -370.36  ...        0        0        0        0            Western          Eastern
1              3008030      61477       1   100    98.45  -97.98  ...        0        0        0        0              Texas          Eastern
2              3007040      61532       1   100    98.45  -94.39  ...        0        0        0        0              Texas          Eastern
3              3008126      61555       1   100    98.45  -99.14  ...        0        0        0        0              Texas          Eastern
4              3002017      61821       1   100    98.45  -98.75  ...        0        0        0        0              Texas          Eastern
5              2080048    3001079       1   100    98.45  -95.98  ...        0        0        0        0            Western            Texas
6              2060761      65421       1   100    98.45  -87.08  ...        0        0        0        0            Western          Eastern
7                68726    2070132       1   100    98.45 -105.23  ...        0        0        0        0            Eastern          Western
8              2077268      69980       1   100    98.45  -98.42  ...        0        0        0        0            Western          Eastern
9              2050383    2028847       1  2400  2300.00    0.00  ...        0        0        0        0            Western          Western
10             2013620    2025332       1  3100  3000.00    0.00  ...        0        0        0        0            Western          Western
11               69748      51390       1  1000   950.00    0.00  ...        0        0        0        0            Eastern          Eastern
12               11613       6132       1   660   630.00    0.00  ...        0        0        0        0            Eastern          Eastern
13                6171       6219       1   660   630.00    0.00  ...        0        0        0        0            Eastern          Eastern
14               69731      49734       1   500   475.00    0.00  ...        0        0        0        0            Eastern          Eastern
15             2021181    2021641       1   400   375.00    0.00  ...        0        0        0        0            Western          Western
16                5423       7280       1   330   300.00    0.00  ...        0        0        0        0            Eastern          Eastern

[17 rows x 25 columns]
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
{'new_dcline': [{'capacity': 2000, 'from_bus_id': 200, 'to_bus_id': 2000}, {'capacity': 1000, 'from_bus_id': 3001001, 'to_bus_id': 1}, {'capacity': 8000, 'from_bus_id': 12000, 'to_bus_id': 5996}]}
    from_bus_id  to_bus_id  status  Pf  Pt  Qf  Qt  Vf  ...  muPmin  muPmax  muQminF  muQmaxF  muQminT  muQmaxT  from_interconnect  to_interconnect
17            0          0       0   0   0   0   0   0  ...       0       0        0        0        0        0                  0                0
18            0          0       0   0   0   0   0   0  ...       0       0        0        0        0        0                  0                0
19            0          0       0   0   0   0   0   0  ...       0       0        0        0        0        0                  0                0

[3 rows x 25 columns]
    from_bus_id  to_bus_id  status    Pf       Pt      Qf      Qt  ...  muPmax  muQminF  muQmaxF  muQminT  muQmaxT  from_interconnect  to_interconnect
0       2060653      66353       1   500   465.35 -370.36 -369.49  ...       0        0        0        0        0            Western          Eastern
1       3008030      61477       1   100    98.45  -97.98 -100.61  ...       0        0        0        0        0              Texas          Eastern
2       3007040      61532       1   100    98.45  -94.39 -101.45  ...       0        0        0        0        0              Texas          Eastern
3       3008126      61555       1   100    98.45  -99.14 -101.29  ...       0        0        0        0        0              Texas          Eastern
4       3002017      61821       1   100    98.45  -98.75 -102.71  ...       0        0        0        0        0              Texas          Eastern
5       2080048    3001079       1   100    98.45  -95.98  -98.46  ...       0        0        0        0        0            Western            Texas
6       2060761      65421       1   100    98.45  -87.08 -101.36  ...       0        0        0        0        0            Western          Eastern
7         68726    2070132       1   100    98.45 -105.23  -99.54  ...       0        0        0        0        0            Eastern          Western
8       2077268      69980       1   100    98.45  -98.42 -101.64  ...       0        0        0        0        0            Western          Eastern
9       2050383    2028847       1  2400  2300.00    0.00    0.00  ...       0        0        0        0        0            Western          Western
10      2013620    2025332       1  3100  3000.00    0.00    0.00  ...       0        0        0        0        0            Western          Western
11        69748      51390       1  1000   950.00    0.00    0.00  ...       0        0        0        0        0            Eastern          Eastern
12        11613       6132       1   660   630.00    0.00    0.00  ...       0        0        0        0        0            Eastern          Eastern
13         6171       6219       1   660   630.00    0.00    0.00  ...       0        0        0        0        0            Eastern          Eastern
14        69731      49734       1   500   475.00    0.00    0.00  ...       0        0        0        0        0            Eastern          Eastern
15      2021181    2021641       1   400   375.00    0.00    0.00  ...       0        0        0        0        0            Western          Western
16         5423       7280       1   330   300.00    0.00    0.00  ...       0        0        0        0        0            Eastern          Eastern
17          200       2000       1  2000  1960.00    0.00    0.00  ...       0        0        0        0        0            Eastern          Eastern
18      3001001          1       1  1000   980.00    0.00    0.00  ...       0        0        0        0        0              Texas          Eastern
19        12000       5996       1  8000  7840.00    0.00    0.00  ...       0        0        0        0        0            Eastern          Eastern

[20 rows x 25 columns]

@rouille rouille added new feature Feature that is currently in progress. grid labels May 6, 2020
@rouille rouille added this to the Spring Board milestone May 6, 2020
@rouille rouille requested review from BainanXia and danielolsen May 6, 2020 16:38
Comment thread powersimdata/input/tests/test_change_table.py
Comment thread powersimdata/input/change_table.py


def test_add_dcline_argument_wrong_bus(capsys):
ct = ChangeTable('Eastern')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This set of tests seems a bit slow, and I think it's due to the bottleneck in spinning up new Grid objects, which has the bottleneck in making the gencost tables. It would be nice if we could either make one Eastern ChangeTable and do a deepcopy on it in each test to speed these up, or perhaps have a special flag we can pass to ChangeTable and Grid to avoid the slow parts of instantiation when we do not need them, but these are nice-to-have ideas and are not required for this PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can be done quickly if we use the same interconnect for each test and use the clear method in each test to make sure that we deal with an empty dictionary.

@danielolsen
Copy link
Copy Markdown
Contributor

This function seems clean and well-tested. After the check on the values passed to capacity for each new DC line, I think it is good to go.

@rouille rouille force-pushed the add_dcline_via_ct branch from c07e3ac to 0dde223 Compare May 6, 2020 22:46
@rouille rouille force-pushed the add_dcline_via_ct branch from 0dde223 to ad1e664 Compare May 6, 2020 22:48
@danielolsen danielolsen self-requested a review May 6, 2020 23:03
Copy link
Copy Markdown
Contributor

@danielolsen danielolsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@rouille rouille force-pushed the add_dcline_via_ct branch from ad1e664 to 9045510 Compare May 7, 2020 03:20
@rouille rouille merged commit 4278d41 into develop May 7, 2020
@rouille rouille deleted the add_dcline_via_ct branch May 7, 2020 21:04
@ahurli ahurli mentioned this pull request Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature Feature that is currently in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants