-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
263 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
Example_Systems/SmallNewEngland/ThreeZones_MultiStage/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Small New England: Three Zones Multi-Stage | ||
|
||
**SmallNewEngland** is set of a simplified versions of the more detailed example system RealSystemExample. It is condensed for easy comprehension and quick testing of different components of the GenX. **SmallNewEngland/ThreeZones_MultiStage**, a toy multi-stage example with hourly resolution, contains zones representing Massachusetts, Connecticut, and Maine. The ten represented resources include only natural gas, solar PV, wind, and lithium-ion battery storage. | ||
|
||
To run the model, first navigate to the example directory at `GenX/Example_Systems/SmallNewEngland/ThreeZones_MultiStage`: | ||
|
||
`cd("Example_Systems/SmallNewEngland/ThreeZones_MultiStage")` | ||
|
||
Next, ensure that your settings in `GenX_settings.yml` are correct. The default settings use the solver Gurobi (`Solver: Gurobi`), time domain reduced input data (`TimeDomainReduction: 1`). | ||
|
||
The `multi_stage_settings.yml` file contains settings parameters specific to multi-stage modeling. This example is configured for three model periods (`NumPeriods: 3`) of 10 years in length each (`PeriodLength: 10`). | ||
|
||
Multi-period modeling in GenX requires a separate set of model inputs for each period to be modeled, which are located in the directories `Inputs/Inputs_p$`, where `$` is the number of the model period. Although separate model periods can have different costs and policy parameters, the resources names and types, specified in each `Generators_data.csv` must be identical across model periods. In addition, multi-stage modeling with a single zone requires an additional input file, `Generators_data_multi_stage.csv`, also located in the `Inputs/` directory, which contains fields related to resource lifetimes, capital recovery periods, and endogenous retirements. | ||
|
||
A rate-based carbon cap becomes more stringent across the three model periods and for each zone, declining from of 1,000 gCO<sub>2</sub> per kWh in the first period, 500 gCO<sub>2</sub> per kWh in the second period, and 50 gCO<sub>2</sub> per kWh in the third period, as specified in the `CO2_cap.csv` input files in `Inputs/Inputs_p1`, `Inputs/Inputs_p2`, and `Inputs/Inputs_p3` respectively. | ||
|
||
Once the settings are confirmed, run the model with the `Run_multi_stage.jl` script in the example directory: | ||
|
||
`include("Run_multi_stage.jl")` | ||
|
||
Once the model has completed, results will write to the `Results/` directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using GenX | ||
|
||
run_genx_case!(dirname(@__FILE__)) |
11 changes: 11 additions & 0 deletions
11
Example_Systems/SmallNewEngland/ThreeZones_MultiStage/Settings/cbc_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# CBC Solver Parameters | ||
# Common solver settings | ||
TimeLimit: 110000 # Solution timeout limit. For example, set_optimizer_attribute(model, "seconds", 60.0). | ||
|
||
#CBC-specific solver settings | ||
logLevel: 1 # Set to 1 to enable solution output. For example, set_optimizer_attribute(model, "logLevel", 1). | ||
maxSolutions: -1 # Terminate after this many feasible solutions have been found. For example, set_optimizer_attribute(model, "maxSolutions", 1). | ||
maxNodes: 2000 # Terminate after this many branch-and-bound nodes have been evaluated. For example, set_optimizer_attribute(model, "maxNodes", 1). | ||
allowableGap: 1 # Terminate after optimality gap is less than this value (on an absolute scale). For example, set_optimizer_attribute(model, "allowableGap", 0.05). | ||
ratioGap: 0.01 # Terminate after optimality gap is smaller than this relative fraction. For example, set_optimizer_attribute(model, "allowableGap", 0.05). | ||
threads: 2 # Set the number of threads to use for parallel branch & bound. For example, set_optimizer_attribute(model, "threads", 2) |
14 changes: 14 additions & 0 deletions
14
Example_Systems/SmallNewEngland/ThreeZones_MultiStage/Settings/clp_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Clp Solver parameters https://github.com/jump-dev/Clp.jl | ||
# Common solver settings | ||
Feasib_Tol: 1e-5 # Primal/Dual feasibility tolerance | ||
TimeLimit: -1.0 # Terminate after this many seconds have passed. A negative value means no time limit | ||
Pre_Solve: 0 # Set to 1 to disable presolve | ||
Method: 5 # Solution method: dual simplex (0), primal simplex (1), sprint (2), barrier with crossover (3), barrier without crossover (4), automatic (5) | ||
|
||
#Clp-specific solver settings | ||
DualObjectiveLimit: 1e308 # When using dual simplex (where the objective is monotonically changing), terminate when the objective exceeds this limit | ||
MaximumIterations: 2147483647 # Terminate after performing this number of simplex iterations | ||
LogLevel: 1 # Set to 1, 2, 3, or 4 for increasing output. Set to 0 to disable output | ||
InfeasibleReturn: 0 # Set to 1 to return as soon as the problem is found to be infeasible (by default, an infeasibility proof is computed as well) | ||
Scaling: 3 # 0 -off, 1 equilibrium, 2 geometric, 3 auto, 4 dynamic(later) | ||
Perturbation: 100 # switch on perturbation (50), automatic (100), don't try perturbing (102) |
10 changes: 10 additions & 0 deletions
10
Example_Systems/SmallNewEngland/ThreeZones_MultiStage/Settings/cplex_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# CPLEX Solver Parameters | ||
Feasib_Tol: 1.0e-05 # Constraint (primal) feasibility tolerances. | ||
Optimal_Tol: 1e-5 # Dual feasibility tolerances. | ||
Pre_Solve: 1 # Controls presolve level. | ||
TimeLimit: 110000 # Limits total time solver. | ||
MIPGap: 1e-3 # Relative (p.u. of optimal) mixed integer optimality tolerance for MIP problems (ignored otherwise). | ||
Method: 2 # Algorithm used to solve continuous models (including MIP root relaxation). | ||
BarConvTol: 1.0e-08 # Barrier convergence tolerance (determines when barrier terminates). | ||
NumericFocus: 0 # Numerical precision emphasis. | ||
SolutionType: 2 # Solution type for LP or QP. |
21 changes: 21 additions & 0 deletions
21
Example_Systems/SmallNewEngland/ThreeZones_MultiStage/Settings/genx_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#MacOrWindows: Mac # Set to either "Mac" (also works for Linux) or "Windows" to ensure use of proper file directory separator "\" or "/ | ||
OverwriteResults: 0 # Overwrite existing results in output folder or create a new one; 0 = create new folder; 1 = overwrite existing results | ||
PrintModel: 0 # Write the model formulation as an output; 0 = active; 1 = not active | ||
NetworkExpansion: 1 # Transmission network expansionl; 0 = not active; 1 = active systemwide | ||
Trans_Loss_Segments: 1 # Number of segments used in piecewise linear approximation of transmission losses; 1 = linear, >2 = piecewise quadratic | ||
Reserves: 0 # Regulation (primary) and operating (secondary) reserves; 0 = not active, 1 = active systemwide | ||
EnergyShareRequirement: 0 # Minimum qualifying renewables penetration; 0 = not active; 1 = active systemwide | ||
CapacityReserveMargin: 0 # Number of capacity reserve margin constraints; 0 = not active; 1 = active systemwide | ||
CO2Cap: 2 # CO2 emissions cap; 0 = not active (no CO2 emission limit); 1 = mass-based emission limit constraint; 2 = demand + rate-based emission limit constraint; 3 = generation + rate-based emission limit constraint | ||
StorageLosses: 1 # Energy Share Requirement and CO2 constraints account for energy lost; 0 = not active (DO NOT account for energy lost); 1 = active systemwide (DO account for energy lost) | ||
MinCapReq: 0 # Activate minimum technology carveout constraints; 0 = not active; 1 = active | ||
MaxCapReq: 0 # Activate maximum technology carveout constraints; 0 = not active; 1 = active | ||
ParameterScale: 1 # Turn on parameter scaling wherein demand, capacity and power variables are defined in GW rather than MW. 0 = not active; 1 = active systemwide | ||
WriteShadowPrices: 0 # Write shadow prices of LP or relaxed MILP; 0 = not active; 1 = active | ||
UCommit: 2 # Unit committment of thermal power plants; 0 = not active; 1 = active using integer clestering; 2 = active using linearized clustering | ||
TimeDomainReductionFolder: "TDR_Results" # Directory name where results from time domain reduction will be saved. If results already exist here, these will be used without running time domain reduction script again. | ||
TimeDomainReduction: 1 # Time domain reduce (i.e. cluster) inputs based on Demand_data.csv, Generators_variability.csv, and Fuels_data.csv; 0 = not active (use input data as provided); 0 = active (cluster input data, or use data that has already been clustered) | ||
ModelingToGenerateAlternatives: 0 # Modeling to generate alternatives; 0 = not active; 1 = active. Note: produces a single solution as output | ||
ModelingtoGenerateAlternativeSlack: 0.1 # Slack value as a fraction of least-cost objective in budget constraint used for evaluating alternative model solutions; positive float value | ||
ModelingToGenerateAlternativeIterations: 3 | ||
MultiStage: 1 # 0 = Single-stage GenX, 1 = Multi-stage GenX |
16 changes: 16 additions & 0 deletions
16
Example_Systems/SmallNewEngland/ThreeZones_MultiStage/Settings/gurobi_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Gurobi Solver Parameters | ||
# Common solver settings | ||
Feasib_Tol: 1.0e-05 # Constraint (primal) feasibility tolerances. | ||
Optimal_Tol: 1e-5 # Dual feasibility tolerances. | ||
TimeLimit: 110000 # Limits total time solver. | ||
Pre_Solve: 1 # Controls presolve level. | ||
Method: 4 # Algorithm used to solve continuous models (including MIP root relaxation). | ||
|
||
#Gurobi-specific solver settings | ||
MIPGap: 1e-3 # Relative (p.u. of optimal) mixed integer optimality tolerance for MIP problems (ignored otherwise). | ||
BarConvTol: 1.0e-08 # Barrier convergence tolerance (determines when barrier terminates). | ||
NumericFocus: 0 # Numerical precision emphasis. | ||
Crossover: -1 # Barrier crossver strategy. | ||
PreDual: 0 # Decides whether presolve should pass the primal or dual linear programming problem to the LP optimization algorithm. | ||
AggFill: 10 # Allowed fill during presolve aggregation. | ||
OutputFlag: 0 # Controls Gurobi output.s |
12 changes: 12 additions & 0 deletions
12
Example_Systems/SmallNewEngland/ThreeZones_MultiStage/Settings/highs_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# HiGHS Solver Parameters | ||
# Common solver settings | ||
Feasib_Tol: 1.0e-05 # Primal feasibility tolerance # [type: double, advanced: false, range: [1e-10, inf], default: 1e-07] | ||
Optimal_Tol: 1.0e-05 # Dual feasibility tolerance # [type: double, advanced: false, range: [1e-10, inf], default: 1e-07] | ||
TimeLimit: 1.0e23 # Time limit # [type: double, advanced: false, range: [0, inf], default: inf] | ||
Pre_Solve: choose # Presolve option: "off", "choose" or "on" # [type: string, advanced: false, default: "choose"] | ||
Method: ipm #HiGHS-specific solver settings # Solver option: "simplex", "choose" or "ipm" # [type: string, advanced: false, default: "choose"] | ||
|
||
# run the crossover routine for ipx | ||
# [type: string, advanced: "on", range: {"off", "on"}, default: "off"] | ||
run_crossover: "on" | ||
|
5 changes: 5 additions & 0 deletions
5
Example_Systems/SmallNewEngland/ThreeZones_MultiStage/Settings/multi_stage_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
NumStages: 3 # Number of model investment planning stages | ||
StageLengths: [10,10,10] # Length of each model stage (years) | ||
WACC: 0.045 # Weighted average cost of capital | ||
ConvergenceTolerance: 0.01 # Relative optimality gap used for convergence | ||
Myopic: 0 # If using multi-stage GenX, 1 = myopic, 0 = dual dynamic programming |
150 changes: 150 additions & 0 deletions
150
...Systems/SmallNewEngland/ThreeZones_MultiStage/Settings/time_domain_reduction_settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
##### | ||
# | ||
# TIME DOMAIN REDUCTION SETTINGS | ||
# | ||
# Set parameters here that organize how your full timeseries | ||
# data will be divided into representative period clusters. | ||
# Ensure that time_domain_reduction is set to 1 in GenX_settings.yml | ||
# before running. Run within GenX or use PreCluster.jl to test and | ||
# examine representative period output before proceeding. | ||
# Specify your data input directory as inpath within Run_test.jl | ||
# or PreCluster.jl. | ||
# | ||
##### | ||
|
||
# - TimestepsPerRepPeriod | ||
# Typically 168 timesteps (e.g., hours) per period, this designates | ||
# the length of each representative period. | ||
TimestepsPerRepPeriod: 168 | ||
|
||
# - ClusterMethod | ||
# Either 'kmeans' or 'kmedoids', this designates the method used to cluster | ||
# periods and determine each point's representative period. | ||
ClusterMethod: 'kmeans' | ||
|
||
# - ScalingMethod | ||
# Either 'N' or 'S', this designates directs the module to normalize ([0,1]) | ||
# or standardize (mean 0, variance 1) the input data. | ||
ScalingMethod: "S" | ||
|
||
# - MaxPeriods | ||
# The maximum number of periods - both clustered periods and extreme periods - | ||
# that may be used to represent the input data. If IterativelyAddPeriods is on and the | ||
# error threshold is never met, this will be the total number of periods. | ||
MaxPeriods: 11 | ||
|
||
# - MinPeriods | ||
# The minimum number of periods used to represent the input data. If using | ||
# UseExtremePeriods, this must be at least the number of extreme periods requests. If | ||
# IterativelyAddPeriods if off, this will be the total number of periods. | ||
MinPeriods: 11 | ||
|
||
# - IterativelyAddPeriods | ||
# Either 1 (yes) or 0 (no), this designates whether or not to add periods | ||
# until the error threshold between input data and represented data is met or the maximum | ||
# number of periods is reached. | ||
IterativelyAddPeriods: 0 | ||
|
||
# - IterateMethod | ||
# Either 'cluster' or 'extreme', this designates whether to add clusters to | ||
# the kmeans/kmedoids method or to set aside the worst-fitting periods as a new extreme periods. | ||
# The default option is 'cluster'. | ||
IterateMethod: "cluster" | ||
|
||
# - Threshold | ||
# Iterative period addition will end if the period farthest (Euclidean Distance) | ||
# from its representative period is within this percentage of the total possible error (for normalization) | ||
# or ~95% of the total possible error (for standardization). E.g., for a threshold of 0.01, | ||
# every period must be within 1% of the spread of possible error before the clustering | ||
# iterations will terminate (or until the max number of periods is reached). | ||
Threshold: 0.05 | ||
|
||
# - nReps | ||
# The number of times to repeat each kmeans/kmedoids clustering at the same setting. | ||
nReps: 100 | ||
|
||
# - DemandWeight | ||
# Default 1, this is an optional multiplier on demand columns in order to prioritize | ||
# better fits for demand profiles over resource capacity factor profiles. | ||
DemandWeight: 1 | ||
|
||
# - WeightTotal | ||
# Default 8760, the sum to which the relative weights of representative periods will be scaled. | ||
WeightTotal: 8760 | ||
|
||
# - ClusterFuelPrices | ||
# Either 1 (yes) or 0 (no), this indicates whether or not to use the fuel price | ||
# time series in Fuels_data.csv in the clustering process. If 0, this function will still write | ||
# Fuels_data_clustered.csv with reshaped fuel prices based on the number and size of the | ||
# representative weeks, assuming a constant time series of fuel prices with length equal to the | ||
# number of timesteps in the raw input data. | ||
ClusterFuelPrices: 1 | ||
|
||
# - MultiStageConcatenate | ||
# (Only considered if MultiStage = 1 in genx_settings.yml) | ||
# If 1, this designates that the model should time domain reduce the input data | ||
# of all model stages together. Else if 0, the model will time domain reduce each | ||
# stage separately | ||
MultiStageConcatenate: 0 | ||
|
||
# - UseExtremePeriods | ||
# Either 1 (yes) or 0 (no), this designates whether or not to include | ||
# outliers (by performance or demand/resource extreme) as their own representative periods. | ||
# This setting automatically includes the periods with maximum demand, minimum solar cf and | ||
# minimum wind cf as extreme periods. | ||
UseExtremePeriods: 1 | ||
|
||
# - ExtremePeriods | ||
# Use this to define which periods to be included among the final representative periods | ||
# as "Extreme Periods". | ||
# Select by profile type: demand ("Demand"), solar PV capacity factors ("PV"), and wind capacity factors ("Wind"). | ||
# Select whether to examine these profiles by zone ("Zone") or across the whole system ("System"). | ||
# Select whether to look for absolute max/min at the timestep level ("Absolute") | ||
# or max/min sum across the period ("Integral"). | ||
# Select whether you want the maximum ("Max") or minimum ("Min") (of the prior type) for each profile type. | ||
ExtremePeriods: | ||
Demand: | ||
Zone: | ||
Absolute: | ||
Max: 0 | ||
Min: 0 | ||
Integral: | ||
Max: 0 | ||
Min: 0 | ||
System: | ||
Absolute: | ||
Max: 1 | ||
Min: 0 | ||
Integral: | ||
Max: 0 | ||
Min: 0 | ||
PV: | ||
Zone: | ||
Absolute: | ||
Max: 0 | ||
Min: 0 | ||
Integral: | ||
Max: 0 | ||
Min: 0 | ||
System: | ||
Absolute: | ||
Max: 0 | ||
Min: 0 | ||
Integral: | ||
Max: 0 | ||
Min: 1 | ||
Wind: | ||
Zone: | ||
Absolute: | ||
Max: 0 | ||
Min: 0 | ||
Integral: | ||
Max: 0 | ||
Min: 0 | ||
System: | ||
Absolute: | ||
Max: 0 | ||
Min: 0 | ||
Integral: | ||
Max: 0 | ||
Min: 1 |