GenXProject / GenX.jl

GenX: a configurable power system capacity expansion model for studying low-carbon energy futures. More details at : https://genx.mit.edu
https://genxproject.github.io/GenX.jl/
GNU General Public License v2.0
278 stars 121 forks source link

Files appear to be loaded twice #225

Closed cfe316 closed 8 months ago

cfe316 commented 2 years ago

I'm not sure what's happening yet here, but I think that some of the standard example scripts load files twice. This happens when I run SmallNewEngland/OneZone example via include("/path/.../Run.jl"). I'm pasting the log below.

Loading packages
Configuring Settings
Clustering Time Series Data...
Not MultiStage
Reading Input CSV Files
Network.csv Successfully Read!
Load_data.csv Successfully Read!
Fuels_data.csv Successfully Read!
Generators_data.csv Successfully Read!
Generators_variability.csv Successfully Read!
Capacity_reserve_margin.csv Successfully Read!
Minimum_capacity_requirement.csv Successfully Read!
Energy_share_requirement.csv Successfully Read!
CO2_cap.csv Successfully Read!
CSV Files Successfully Read In From /home/jacob/GenX/Example_Systems/SmallNewEngland/OneZone
Configuring Solver
Loading Inputs
Reading Input CSV Files
Network.csv Successfully Read!
Load_data.csv Successfully Read!
Fuels_data.csv Successfully Read!
Generators_data.csv Successfully Read!
Generators_variability.csv Successfully Read!
Capacity_reserve_margin.csv Successfully Read!
Minimum_capacity_requirement.csv Successfully Read!
Energy_share_requirement.csv Successfully Read!
CO2_cap.csv Successfully Read!
CSV Files Successfully Read In From /home/jacob/GenX/Example_Systems/SmallNewEngland/OneZone
Generating the Optimization Model
Discharge Module
Non-served Energy Module
Investment Discharge Module
Unit Commitment Module
Emissions Module (for CO2 Policy modularization
Dispatchable Resources Module
Storage Resources Module
Storage Investment Module
Storage Core Resources Module
Storage Resources with Symmetric Charge/Discharge Capacity Module
Thermal (Unit Commitment) Resources Module
C02 Policies Module
Energy Share Requirement Policies Module
Capacity Reserve Margin Policies Module
Minimum Capacity Requirement Module
Solving Model
[...]
sambuddhac commented 2 years ago

That's strange. About to take a look. Thanks for flagging.

cfe316 commented 2 years ago

I'm on the Dev branch, commit f721763a.

Okay, this doesn't happen when I run the case second time. Maybe it was due to TimeDomainReduction=1?

sambuddhac commented 2 years ago

I can confirm that the issue is because of the TimeDomainReduction. Please turn it off. It should work just fine.

sambuddhac commented 2 years ago

This is the genX_settings.jl for the Dev branch for SmallNewEngland/OneZone:

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: 0 # 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: 1 # Minimum qualifying renewables penetration; 0 = not active; 1 = active systemwide
CapacityReserveMargin: 1 # 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 = load + 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: 1  # Activate minimum technology carveout constraints; 0 = not active; 1 = active
Solver: Clp # Available solvers: Gurobi, CPLEX, Clps
ParameterScale: 1 # Turn on parameter scaling wherein load, capacity and power variables are defined in GW rather than MW. 0 = not active; 1 = active systemwide
WriteShadowPrices: 1 # 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
OperationWrapping: 1 # Sets temporal resolution of the model; 0 = single period to represent the full year, with first-last time step linked; 1 = multiple representative periods
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 Load_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 # Number of MGA iterations with maximization and minimization objective
MethodofMorris: 0 #Flag for turning on the Method of Morris analysis

Actually you can see that the TimeDomainReduction is still at 1. But, here's the log I get:


Loading packages
Configuring Settings
Time Series Data Already Clustered.
Configuring Solver
Loading Inputs
Reading Input CSV Files
Network.csv Successfully Read!
Load_data.csv Successfully Read!
Fuels_data.csv Successfully Read!
Generators_data.csv Successfully Read!
Generators_variability.csv Successfully Read!
Capacity_reserve_margin.csv Successfully Read!
Minimum_capacity_requirement.csv Successfully Read!
Energy_share_requirement.csv Successfully Read!
CO2_cap.csv Successfully Read!
CSV Files Successfully Read In From /Users/sc87/code/GenXProject/GenX/Example_Systems/SmallNewEngland/OneZone
Generating the Optimization Model
Discharge Module
Non-served Energy Module
Investment Discharge Module
Unit Commitment Module
Emissions Module (for CO2 Policy modularization
Dispatchable Resources Module
Storage Resources Module
Storage Investment Module
Storage Core Resources Module
Storage Resources with Symmetric Charge/Discharge Capacity Module
Thermal (Unit Commitment) Resources Module
C02 Policies Module
Energy Share Requirement Policies Module
Capacity Reserve Margin Policies Module
Minimum Capacity Requirement Module
Solving Model
Coin0506I Presolve 35100 (-5569) rows, 16620 (-1871) columns and 144068 (-29595) elements
Clp0006I 0  Obj 2237.1084 Primal inf 389037.23 (3699)
Clp0006I 393  Obj 2238.8942 Primal inf 175837.2 (4157)
Clp0006I 777  Obj 2241.6211 Primal inf 155366.65 (4514)
Clp0006I 1138  Obj 2243.1404 Primal inf 173450.75 (4752)
Clp0006I 1495  Obj 3261.0462 Primal inf 57494.281 (3331)
Clp0006I 1895  Obj 3314.2875 Primal inf 65334.829 (4078)
Clp0006I 2295  Obj 3314.7585 Primal inf 78370.54 (4235)
Clp0006I 2695  Obj 3540.0383 Primal inf 60050.528 (4445)
Clp0006I 3095  Obj 3705.5766 Primal inf 112969.44 (4600)
Clp0006I 3495  Obj 3868.0059 Primal inf 106275.49 (4684)
Clp0006I 3895  Obj 4007.2516 Primal inf 308950.71 (4837)
Clp0006I 4295  Obj 4046.2709 Primal inf 304764.6 (4994)
Clp0006I 4695  Obj 4056.3377 Primal inf 462346.64 (5125)
Clp0006I 5095  Obj 4081.3298 Primal inf 1204428.2 (5268)
Clp0006I 5495  Obj 4122.9909 Primal inf 1436119.7 (5531)
Clp0006I 5895  Obj 4192.326 Primal inf 394280.98 (5802)
Clp0006I 6295  Obj 4295.1548 Primal inf 876913.03 (5963)
Clp0006I 6695  Obj 4427.0507 Primal inf 602202.14 (6064)
Clp0006I 7095  Obj 4505.141 Primal inf 1577551.1 (4294)
Clp0006I 7495  Obj 4744.9846 Primal inf 19499778 (6669)
Clp0006I 7895  Obj 4890.3942 Primal inf 12551588 (6425)
Clp0006I 8295  Obj 4945.2377 Primal inf 7206162.8 (6841)
Clp0006I 8695  Obj 5020.5505 Primal inf 10806545 (6658)
Clp0006I 8999  Obj 5155.6329 Primal inf 405358.58 (5484)
Clp0006I 9017  Obj 5157.8383 Primal inf 394557.72 (5459)
Clp0006I 9400  Obj 7118.0019 Primal inf 916987.94 (7792)
Clp0006I 9800  Obj 7422.8348 Primal inf 163134.87 (5001)
Clp0006I 10200  Obj 7987.0427 Primal inf 207383.1 (6750)
Clp0006I 10600  Obj 8192.8662 Primal inf 405794.83 (7745)
Clp0006I 11000  Obj 8443.7477 Primal inf 329096.62 (5756)
Clp0006I 11400  Obj 8575.5698 Primal inf 701816.27 (8009)
Clp0006I 11800  Obj 8733.1262 Primal inf 586198.09 (7259)
Clp0006I 12200  Obj 8858.2851 Primal inf 104561.35 (4892)
Clp0006I 12600  Obj 8978.4887 Primal inf 106652.13 (5634)
Clp0006I 13000  Obj 9041.4627 Primal inf 99685.738 (5794)
Clp0006I 13400  Obj 9185.7825 Primal inf 66781.735 (3975)
Clp0006I 13800  Obj 9323.6482 Primal inf 118664.03 (4569)
Clp0006I 14200  Obj 9435.5474 Primal inf 640774.26 (4165)
Clp0006I 14600  Obj 9516.5589 Primal inf 223374.92 (3251)
Clp0006I 15000  Obj 9614.0467 Primal inf 1935550.3 (4928)
Clp0006I 15400  Obj 9671.8137 Primal inf 13122.388 (1980)
Clp0006I 15800  Obj 9733.7551 Primal inf 7395.6571 (1212)
Clp0006I 16200  Obj 9767.2716 Primal inf 357926.58 (1628)
Clp0006I 16600  Obj 9786.4498 Primal inf 38.860938 (136)
Clp0006I 16669  Obj 9786.8821
Clp0000I Optimal - objective value 9786.8721
Coin0511I After Postsolve, objective 9786.8721, infeasibilities - dual 0 (0), primal 0 (0)
Clp0032I Optimal objective 9786.872092 - 16669 iterations time 8.122, Presolve 0.07
LP solved for primal
Writing Output
Time elapsed for writing costs is
3.490479208
Time elapsed for writing storage is
0.22043541
Time elapsed for writing nse is
0.851340053
Time elapsed for writing power balance is
0.558539277
Time elapsed for writing emissions is
0.788666135
Time elapsed for writing reliability is
0.480582434
STOR ALL LDS is Int64[]
Time elapsed for writing storage duals is
1.719020714
Time elapsed for writing commitment is
0.036503775
Time elapsed for writing startup is
0.055681918
Time elapsed for writing shutdown is
0.051374887
Time elapsed for writing time weights is
0.157793059
Time elapsed for writing reserve margin is
0.41623381
Time elapsed for writing capacity value is
1.796126012
Time elapsed for writing net revenue is
1.077708004
Wrote outputs to /Users/sc87/code/GenXProject/GenX/Example_Systems/SmallNewEngland/OneZone/Results_1
Time elapsed for writing is
75.431512665

I do not get the configuring solver statement. So, I am suspecting if it has anything to do with the solver. Which solver are you using?

sambuddhac commented 2 years ago

This is a futuristic issue. Will be worked upon later.

sambuddhac commented 2 years ago

This happens every time the TDR_Results folder isn't there at the onset and the TDR script executes.

sambuddhac commented 8 months ago

This seems has been fixed