Skip to content

Commit

Permalink
Merge branch 'develop' into expression_manip_tests_and_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RuaridhMacd authored Jan 18, 2024
2 parents 735701e + 66ba310 commit 6bb361e
Show file tree
Hide file tree
Showing 110 changed files with 5,260 additions and 737 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
for anyone running non-myopic multistage GenX with asymmetric storage.
- Fix computation of cumulative minimum capacity retirements in multistage GenX (#514)
- Fix access of eELOSSByZone expr before initialization (#541)
- Correctly write unmet reserves (in reg_dn.csv) (#575)
- Correctly scale total reserves column (in reg_dn.csv) (#594)

### Changed
- Use add_to_expression! instead of the += and -= operators for memory performance improvements (#498).
Expand All @@ -61,6 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
"Load" now typically refers only to the transferrence of data from files to memory,
except for a few places such as the common term "value of lost load" which refers to non-served demand (#397).
- `New_Build = -1` in `Generators_data.csv`: instead, use `New_Build = 0` and `Can_Retire = 0`.
- The matrix-style input of the grid for Network.csv is deprecated in favor a column-style input.
Instead of columns z1, z2, ... with entries -1, 0, 1, use two columns: Start_Zone, End_Zone (#591).


## [0.3.6] - 2023-08-01
Expand Down
8 changes: 4 additions & 4 deletions Example_Systems/RealSystemExample/ISONE_Trizone/Network.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
NENGREST,z1,1,1,-1,0,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0
NENG_CT,z2,2,1,0,-1,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0
NENG_ME,z3,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
NENGREST,z1,1,1,2,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0
NENG_CT,z2,2,1,3,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0
NENG_ME,z3,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
NENGREST,z1,1,1,-1,0,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0
NENG_CT,z2,2,1,0,-1,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0
NENG_ME,z3,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
NENGREST,z1,1,1,2,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0
NENG_CT,z2,2,1,3,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0
NENG_ME,z3,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
NENGREST,z1,1,1,-1,0,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0,5900,0.062,30
NENG_CT,z2,2,1,0,-1,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0,4000,0.062,30
NENG_ME,z3,,,,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
NENGREST,z1,1,1,2,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0,5900,0.062,30
NENG_CT,z2,2,1,3,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0,4000,0.062,30
NENG_ME,z3,,,,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
NENGREST,z1,1,1,-1,0,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0,5900,0.062,30
NENG_CT,z2,2,1,0,-1,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0,4000,0.062,30
NENG_ME,z3,,,,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
NENGREST,z1,1,1,2,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0,5900,0.062,30
NENG_CT,z2,2,1,3,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0,4000,0.062,30
NENG_ME,z3,,,,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
NENGREST,z1,1,1,-1,0,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0,5900,0.062,30
NENG_CT,z2,2,1,0,-1,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0,4000,0.062,30
NENG_ME,z3,,,,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
NENGREST,z1,1,1,2,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0,5900,0.062,30
NENG_CT,z2,2,1,3,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0,4000,0.062,30
NENG_ME,z3,,,,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
NENGREST,z1,1,1,-1,0,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0
NENG_CT,z2,2,1,0,-1,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0
NENG_ME,z3,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
NENGREST,z1,1,1,2,2950,NENGREST_to_NENG_CT,123.0584,0.012305837,2950,12060,0.95,0,0
NENG_CT,z2,2,1,3,2000,NENGREST_to_NENG_ME,196.5385,0.019653847,2000,19261,0.95,0,0
NENG_ME,z3,,,,,,,,,,,,
8 changes: 4 additions & 4 deletions Example_Systems/SmallNewEngland/ThreeZones/Network.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
MA,z1,1,1,-1,0,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0
CT,z2,2,1,0,-1,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0
ME,z3,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
MA,z1,1,1,2,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0
CT,z2,2,1,3,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0
ME,z3,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
MA,z1,1,1,-1,0,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0,7000,0.062,30
CT,z2,2,1,0,-1,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0,5000,0.062,30
ME,z3,,,,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
MA,z1,1,1,2,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0,7000,0.062,30
CT,z2,2,1,3,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0,5000,0.062,30
ME,z3,,,,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
MA,z1,1,1,-1,0,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0,7000,0.062,30
CT,z2,2,1,0,-1,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0,5000,0.062,30
ME,z3,,,,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
MA,z1,1,1,2,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0,7000,0.062,30
CT,z2,2,1,3,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0,5000,0.062,30
ME,z3,,,,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
MA,z1,1,1,-1,0,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0,7000,0.062,30
CT,z2,2,1,0,-1,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0,5000,0.062,30
ME,z3,,,,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1,Line_Max_Flow_Possible_MW,WACC,Capital_Recovery_Period
MA,z1,1,1,2,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0,7000,0.062,30
CT,z2,2,1,3,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0,5000,0.062,30
ME,z3,,,,,,,,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
MA,z1,1,1,-1,0,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0
CT,z2,2,1,0,-1,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0
ME,z3,,,,,,,,,,,,,
,Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,transmission_path_name,distance_mile,Line_Loss_Percentage,Line_Max_Reinforcement_MW,Line_Reinforcement_Cost_per_MWyr,DerateCapRes_1,CapRes_1,CapRes_Excl_1
MA,z1,1,1,2,2950,MA_to_CT,123.0584,0.012305837,2950,12060,0.95,0,0
CT,z2,2,1,3,2000,MA_to_ME,196.5385,0.019653847,2000,19261,0.95,0,0
ME,z3,,,,,,,,,,,,
8 changes: 4 additions & 4 deletions Example_Systems/VREStor_Example/Network.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Network_zones,Network_Lines,z1,z2,z3,Line_Max_Flow_MW,Line_Min_Flow_MW,transmission_path_name,Line_Reinforcement_Cost_per_MWyr,Line_Reinforcement_Cost_per_MW,Line_Loss_Percentage,Line_Max_Reinforcement_MW,DerateCapRes_1,CapRes_Excl_1,DerateCapRes_2,CapRes_Excl_2,DerateCapRes_3,CapRes_Excl_3
z1,1.0,1.0,-1.0,0.0,820.0,820.0,EIC_to_TRE,45958.0,948772.0,0.0649,410.0,0.95,0.0,0.95,0.0,0.95,0.0
z2,2.0,1.0,0.0,-1.0,1830.0,1830.0,EIC_to_WECC,71600.0,1478140.0,0.1001,915.0,0.95,0.0,0.95,0.0,0.95,0.0
z3,,,,,,,,,,,,,,,,,
Network_zones,Network_Lines,Start_Zone,End_Zone,Line_Max_Flow_MW,Line_Min_Flow_MW,transmission_path_name,Line_Reinforcement_Cost_per_MWyr,Line_Reinforcement_Cost_per_MW,Line_Loss_Percentage,Line_Max_Reinforcement_MW,DerateCapRes_1,CapRes_Excl_1,DerateCapRes_2,CapRes_Excl_2,DerateCapRes_3,CapRes_Excl_3
z1,1.0,1,2,820.0,820.0,EIC_to_TRE,45958.0,948772.0,0.0649,410.0,0.95,0.0,0.95,0.0,0.95,0.0
z2,2.0,1,3,1830.0,1830.0,EIC_to_WECC,71600.0,1478140.0,0.1001,915.0,0.95,0.0,0.95,0.0,0.95,0.0
z3,,,,,,,,,,,,,,,,
18 changes: 9 additions & 9 deletions docs/src/data_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ This input file contains input parameters related to: 1) definition of model zon
|**Settings-specific Columns**|
|**Multiple zone model**||
|Network\_Lines | Numerical index for each network line. The length of this column is counted but the actual values are not used.|
| z* (Network map) **OR** Origin_Zone, Destination_Zone | See below |
| z* (Network map) **OR** Start_Zone, End_Zone | See below |
|Line\_Max\_Flow\_MW | Existing capacity of the inter-regional transmission line.|
|**NetworkExpansion = 1**||
|Line\_Max\_Reinforcement\_MW |Maximum allowable capacity addition to the existing transmission line.|
Expand All @@ -211,26 +211,26 @@ This input file contains input parameters related to: 1) definition of model zon
There are two interfaces implemented for specifying the network topology itself: a matrix interface and a list interface.
Only one choice is permitted in a given file.

The list interface consists of a column for the lines origin zone and one for the line's destination zone.
The list interface consists of a column for the lines start zone and one for the line's end zone.
Here is a snippet of the Network.csv file for a map with three zones and two lines:
```
Network_Lines, Origin_Zone, Destination_Zone,
1, 1, 2,
2, 1, 3,
Network_Lines, Start_Zone, End_Zone,
1, 1, 2,
2, 1, 3,
```

The matrix interface requires N columns labeled `z1, z2, z3 ... zN`,
and L rows, one for each network line (or interregional path), with a `1` in the column corresponding to the 'origin' zone
and a `-1` in the column corresponding to the 'destination' zone for each line.
and L rows, one for each network line (or interregional path), with a `1` in the column corresponding to the 'start' zone
and a `-1` in the column corresponding to the 'end' zone for each line.
Here is the same network map implemented as a matrix:
```
Network_Lines, z1, z2, z3,
1, 1, -1, 0,
2, 1, 0, -1,
```

Note that in either case, positive flows indicate flow from origin to destination zone;
negative flows indicate flow from destination to origin zone.
Note that in either case, positive flows indicate flow from start to end zone;
negative flows indicate flow from end to start zone.


#### 2.1.3 Demand\_data.csv (Load\_data.csv)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/model_notation.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ $\mathcal{W} \subseteq \mathcal{G}$ | where $\mathcal{W}$ set of hydroelectric g
|$\rho_{y,z,t}^{max,pv}$ | Maximum available generation per unit of installed capacity for the solar PV component of a co-located VRE and storage resource during time step t for technology y in zone z [%]|
|$\rho_{y,z,t}^{max,wind}$ | Maximum available generation per unit of installed capacity for the wind component of a co-located VRE and storage resource during time step t for technology y in zone z [%]|
|$VREIndex_{y,z}$ | Resource bin index for VRE technology $y$ in zone $z$. $VREIndex_{y,z}=1$ for the first bin, and $VREIndex_{y,z}=0$ for remaining bins. Only defined for $y\in \mathcal{VRE}$ |
|$\varphi^{map}_{l,z}$ | Topology of the network, for line l: $\varphi^{map}_{l,z}=1$ for zone $z$ of origin, - 1 for zone $z$ of destination, 0 otherwise. |
|$\varphi^{map}_{l,z}$ | Topology of the network, for line l: $\varphi^{map}_{l,z}=1$ for start zone $z$, - 1 for end zone $z$, 0 otherwise. |
|$\eta_{y,z}^{loss}$ | Self discharge rate per time step per unit of installed capacity for storage technology $y$ in zone $z$ [%]|
|$\eta_{y,z}^{charge}$ | Single-trip efficiency of storage charging/demand deferral for technology $y$ in zone $z$ [%]|
|$\eta_{y,z}^{discharge}$ | Single-trip efficiency of storage (and hydro reservoir) discharging/demand satisfaction for technology $y$ in zone $z$ [%]|
Expand Down
2 changes: 1 addition & 1 deletion src/configure_settings/configure_settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function validate_settings!(settings::Dict{Any,Any})
@warn """The behavior of the TimeDomainReduction and OperationWrapping
settings have changed recently. OperationWrapping has been removed,
and is ignored. The relevant behavior is now controlled by TimeDomainReduction.
Please see the Methods page in the documentation."""
Please see the Methods page in the documentation.""" maxlog=1
end

end
2 changes: 1 addition & 1 deletion src/load_inputs/load_generators_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ While for now, New_Build entries of {1, 0, -1} are still supported,
this format is being deprecated.
Now and going forward, New_Build and Can_Retire should be separate columns,
each with values {0, 1}.
Please see the documentation for additional details."
Please see the documentation for additional details." maxlog=1
end

function resources_which_can_be_retired(df::DataFrame)::Set{Int64}
Expand Down
24 changes: 18 additions & 6 deletions src/load_inputs/load_network_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ end
Loads the network map from a list-style interface
```
..., Network_Lines, Origin_Zone, Destination_Zone, ...
1, 1, 2,
2, 1, 3,
..., Network_Lines, Start_Zone, End_Zone, ...
1, 1, 2,
2, 1, 3,
```
"""
function load_network_map_from_list(network_var::DataFrame, Z, L, list_columns)
Expand All @@ -117,25 +117,26 @@ Loads the network map from a matrix-style interface
2, 1, 0, -1,
```
This is equivalent to the list-style interface where the zone zN with entry +1 is the
starting node of the line and the zone with entry -1 is the ending node of the line.
starting zone of the line and the zone with entry -1 is the ending zone of the line.
"""
function load_network_map_from_matrix(network_var::DataFrame, Z, L)
# Topology of the network source-sink matrix
network_map_matrix_format_deprecation_warning()
col = findall(s -> s == "z1", names(network_var))[1]
mat = Matrix{Float64}(network_var[1:L, col:col+Z-1])
end

function load_network_map(network_var::DataFrame, Z, L)
columns = names(network_var)

list_columns = ["Origin_Zone", "Destination_Zone"]
list_columns = ["Start_Zone", "End_Zone"]
has_network_list = all([c in columns for c in list_columns])

zones_as_strings = ["z" * string(i) for i in 1:Z]
has_network_matrix = all([c in columns for c in zones_as_strings])

instructions = """The transmission network should be specified in the form of a matrix
(with columns z1, z2, ... zN) or in the form of lists (with Start_Node, End_Node),
(with columns z1, z2, ... zN) or in the form of lists (with Start_Zone, End_Zone),
but not both. See the documentation for examples."""

if has_network_list && has_network_matrix
Expand All @@ -148,3 +149,14 @@ function load_network_map(network_var::DataFrame, Z, L)
load_network_map_from_matrix(network_var, Z, L)
end
end

function network_map_matrix_format_deprecation_warning()
@warn """Specifying the network map as a matrix is deprecated as of v0.4
and will be removed in v0.5. Instead, use the more compact list-style format.
..., Network_Lines, Start_Zone, End_Zone, ...
1, 1, 2,
2, 1, 3,
3, 2, 3,
""" maxlog=1
end
Loading

0 comments on commit 6bb361e

Please sign in to comment.