From a76d852055b857647e0c81a8927a8cd7b8a53f17 Mon Sep 17 00:00:00 2001 From: "Chakrabarti, Sambuddha (Sam)" Date: Wed, 20 Mar 2024 22:32:02 -0400 Subject: [PATCH 1/9] Update README.md With Zenodo badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b52efc7960..17c889ed78 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CI](https://github.com/GenXProject/GenX/actions/workflows/ci.yml/badge.svg)](https://github.com/GenXProject/GenX/actions/workflows/ci.yml) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://genxproject.github.io/GenX.jl/dev) -[![DOI](https://zenodo.org/badge/10814088.svg)](https://zenodo.org/badge/latestdoi/10814088) +[![DOI](https://zenodo.org/badge/368957308.svg)](https://zenodo.org/doi/10.5281/zenodo.10846069) [![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac) ## Overview From af7d1df96d9ac6e678b46d72760a64c618e3eb59 Mon Sep 17 00:00:00 2001 From: Yuheng Zhang <55777837+Betristor@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:39:33 +0800 Subject: [PATCH 2/9] Add ObjScale setting to default_settings() function --- src/configure_settings/configure_settings.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/configure_settings/configure_settings.jl b/src/configure_settings/configure_settings.jl index 5d59a8a91b..8706c20b96 100644 --- a/src/configure_settings/configure_settings.jl +++ b/src/configure_settings/configure_settings.jl @@ -32,6 +32,7 @@ function default_settings() "ResourcePoliciesFolder" => "policy_assignments", "SystemFolder" => "system", "PoliciesFolder" => "policies", + "ObjScale" => 1, ) end @@ -66,7 +67,7 @@ end function validate_settings!(settings::Dict{Any,Any}) # Check for any settings combinations that are not allowed. # If we find any then make a response and issue a note to the user. - + # make WriteOutputs setting lowercase and check for valid value settings["WriteOutputs"] = lowercase(settings["WriteOutputs"]) @assert settings["WriteOutputs"] ∈ ["annual", "full"] @@ -144,7 +145,7 @@ function default_writeoutput() end function configure_writeoutput(output_settings_path::String, settings::Dict) - + writeoutput = default_writeoutput() # don't write files with hourly data if settings["WriteOutputs"] == "annual" From ecea54ce22b96911d51687c957bb5fd2a777f7ee Mon Sep 17 00:00:00 2001 From: Yuheng Zhang <55777837+Betristor@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:40:02 +0800 Subject: [PATCH 3/9] Add objective function scaling in generate_model --- src/model/generate_model.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/model/generate_model.jl b/src/model/generate_model.jl index b834773188..677fc7b03d 100644 --- a/src/model/generate_model.jl +++ b/src/model/generate_model.jl @@ -125,7 +125,7 @@ function generate_model(setup::Dict,inputs::Dict,OPTIMIZER::MOI.OptimizerWithAtt fuel!(EP, inputs, setup) - co2!(EP, inputs) + co2!(EP, inputs) if setup["OperationalReserves"] > 0 operational_reserves!(EP, inputs, setup) @@ -225,7 +225,7 @@ function generate_model(setup::Dict,inputs::Dict,OPTIMIZER::MOI.OptimizerWithAtt end ## Define the objective function - @objective(EP,Min,EP[:eObj]) + @objective(EP,Min, setup["ObjScale"] * EP[:eObj]) ## Power balance constraints # demand = generation + storage discharge - storage charge - demand deferral + deferred demand satisfaction - demand curtailment (NSE) From e6eab255e940795bdaf1bf369871443b77f9e187 Mon Sep 17 00:00:00 2001 From: Yuheng Zhang <55777837+Betristor@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:55:36 +0800 Subject: [PATCH 4/9] Add objective scaler and update changelog --- CHANGELOG.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0fdf495d9..b891691011 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,15 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added +- Add objective scaler (#667) + ## [0.4.0] - 2024-03-18 ### Added - Feature CO2 and fuel module (#536) - Adds a fuel module which enables modeling of fuel usage via (1) a constant heat rate and (2) - piecewise-linear approximation of heat rate curves. - Adds a CO2 module that determines the CO2 emissions based on fuel consumption, CO2 capture + Adds a fuel module which enables modeling of fuel usage via (1) a constant heat rate and (2) + piecewise-linear approximation of heat rate curves. + Adds a CO2 module that determines the CO2 emissions based on fuel consumption, CO2 capture fraction, and whether the feedstock is biomass. -- Enable thermal power plants to burn multiple fuels (#586) +- Enable thermal power plants to burn multiple fuels (#586) - Feature electrolysis basic (#525) Adds hydrogen electrolyzer model which enables the addition of hydrogen electrolyzer demands along with optional clean supply constraints. @@ -25,14 +28,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add PR template (#516) - Validation ensures that resource flags (THERM, HYDRO, LDS etc) are self-consistent (#513). - Maintenance formulation for thermal-commit plants (#556). -- Add new tests for GenX: three-zone, multi-stage, electrolyzer, VRE+storage, +- Add new tests for GenX: three-zone, multi-stage, electrolyzer, VRE+storage, piecewise_fuel+CO2, and TDR (#563 and #578). - Added a DC OPF method (#543) to calculate power flows across all lines - Added write_operating_reserve_price_revenue.jl to compute annual operating reserve and regulation revenue. Added the operating reserve and regulation revenue to net revenue (PR # 611) - Add functions to compute conflicting constraints when model is infeasible if supported by the solver (#624). -- New settings parameter, VirtualChargeDischargeCost to test script and VREStor example case. The PR 608 attempts to - introduce this parameter as cost of virtual charging and discharging to avoid unusual results (#608). +- New settings parameter, VirtualChargeDischargeCost to test script and VREStor example case. The PR 608 attempts to + introduce this parameter as cost of virtual charging and discharging to avoid unusual results (#608). - New settings parameter, StorageVirtualDischarge, to turn storage virtual charging and discharging off if desired by the user (#638). - Add module to retrofit existing resources with new technologies (#600). @@ -73,14 +76,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 This mitigates but does not fully fix (#576). - Expressions of virtual charging and discharging costs in storage_all.jl and vre_stor.jl - The input file `Generators_data.csv` has been split into different files, one for each type of generator. - The new files are: `Thermal.csv`, `Hydro.csv`, `Vre.csv`, `Storage.csv`, `Flex_demand.csv`, `Must_run.csv`, - `Electrolyzer.csv`, and `Vre_stor.csv`. The examples have been updated, and new tests have been added to + The new files are: `Thermal.csv`, `Hydro.csv`, `Vre.csv`, `Storage.csv`, `Flex_demand.csv`, `Must_run.csv`, + `Electrolyzer.csv`, and `Vre_stor.csv`. The examples have been updated, and new tests have been added to check the new data format (#612). -- The settings parameter `Reserves` has been renamed to `OperationalReserves`, `Reserves.csv` to +- The settings parameter `Reserves` has been renamed to `OperationalReserves`, `Reserves.csv` to `Operational_reserves.csv`, and the `.jl` files contain the word `reserves` have been renamed to `operational_reserves` (#641). -- New folder structure for a GenX case. The input files are now organized in the following folders: `settings`, - `policies`, `resources` and `system`. The examples and tests have been updated to reflect this change. +- New folder structure for a GenX case. The input files are now organized in the following folders: `settings`, + `policies`, `resources` and `system`. The examples and tests have been updated to reflect this change. ### Deprecated - The above `load` keys, which generally refer to electrical demand, are being deprecated. @@ -135,7 +138,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed -- The settings key `OperationsWrapping`. Its functionality has now been folded into the +- The settings key `OperationsWrapping`. Its functionality has now been folded into the `TimeDomainReduction` setting. Using the key now will print a gentle warning (#426). ## [0.3.4] - 2023-04-28 From 3b2fd2d9c17eafea4ef1b6f13b89e18e4afd7e2f Mon Sep 17 00:00:00 2001 From: Yuheng Zhang <55777837+Betristor@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:58:19 +0800 Subject: [PATCH 5/9] Fix formatting in objective function documentation --- docs/src/Model_Concept_Overview/objective_function.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/src/Model_Concept_Overview/objective_function.md b/docs/src/Model_Concept_Overview/objective_function.md index 94308431f8..53a8a29ed1 100644 --- a/docs/src/Model_Concept_Overview/objective_function.md +++ b/docs/src/Model_Concept_Overview/objective_function.md @@ -32,7 +32,7 @@ The objective function of GenX minimizes total annual electricity system costs o & \sum_{y \in \mathcal{VS}^{sym,dc} \cup \mathcal{VS}^{asym,dc,dis}} \sum_{z \in \mathcal{Z}} \sum_{t \in \mathcal{T}} \left( \omega_{t}\times\pi^{VOM,dc,dis}_{y,z} \times\eta^{inverter}_{y,z} \times \Theta^{dc}_{y,z,t}\right) + \\ & \sum_{y \in \mathcal{VS}^{sym,dc} \cup \mathcal{VS}^{asym,dc,cha}} \sum_{z \in \mathcal{Z}} \sum_{t \in \mathcal{T}} \left( \omega_{t}\times\pi^{VOM,dc,cha}_{y,z} \times \frac{\Pi^{dc}_{y,z,t}}{\eta^{inverter}_{y,z}}\right) + \\ & \sum_{y \in \mathcal{VS}^{sym,ac} \cup \mathcal{VS}^{asym,ac,dis}} \sum_{z \in \mathcal{Z}} \sum_{t \in \mathcal{T}} \left( \omega_{t}\times\pi^{VOM,ac,dis}_{y,z} \times \Theta^{ac}_{y,z,t}\right) + \\ - & \sum_{y \in \mathcal{VS}^{sym,ac} \cup \mathcal{VS}^{asym,ac,cha}} \sum_{z \in \mathcal{Z}} \sum_{t \in \mathcal{T}} \left( \omega_{t}\times\pi^{VOM,ac,cha}_{y,z} \times \Pi^{ac}_{y,z,t}\right) + & \sum_{y \in \mathcal{VS}^{sym,ac} \cup \mathcal{VS}^{asym,ac,cha}} \sum_{z \in \mathcal{Z}} \sum_{t \in \mathcal{T}} \left( \omega_{t}\times\pi^{VOM,ac,cha}_{y,z} \times \Pi^{ac}_{y,z,t}\right) \end{aligned} ``` @@ -80,7 +80,7 @@ The eighteenth summation represents the variable O&M cost, $\pi^{VOM,wind}_{y,z} The nineteenth summation represents the variable O&M cost, $\pi^{VOM,dc,dis}_{y,z}$, times the energy discharge by storage DC components ($y\in\mathcal{VS}^{sym,dc} \cup \mathcal{VS}^{asym,dc,dis}$) in time step $t$, $\Theta^{dc}_{y,z,t}$, the inverter efficiency, $\eta^{inverter}_{y,z}$, and the weight of each time step $t$, $\omega_t$. The twentieth summation represents the variable O&M cost, $\pi^{VOM,dc,cha}_{y,z}$, times the energy withdrawn by storage DC components ($y\in\mathcal{VS}^{sym,dc} \cup \mathcal{VS}^{asym,dc,cha}$) in time step $t$, $\Pi^{dc}_{y,z,t}$, and the weight of each time step $t$, $\omega_t$, and divided by the inverter efficiency, $\eta^{inverter}_{y,z}$. The twenty-first summation represents the variable O&M cost, $\pi^{VOM,ac,dis}_{y,z}$, times the energy discharge by storage AC components ($y\in\mathcal{VS}^{sym,ac} \cup \mathcal{VS}^{asym,ac,dis}$) in time step $t$, $\Theta^{ac}_{y,z,t}$, and the weight of each time step $t$, $\omega_t$. -The twenty-second summation represents the variable O&M cost, $\pi^{VOM,ac,cha}_{y,z}$, times the energy withdrawn by storage AC components ($y\in\mathcal{VS}^{sym,ac} \cup \mathcal{VS}^{asym,ac,cha}$) in time step $t$, $\Pi^{ac}_{y,z,t}$, and the weight of each time step $t$, $\omega_t$. +The twenty-second summation represents the variable O&M cost, $\pi^{VOM,ac,cha}_{y,z}$, times the energy withdrawn by storage AC components ($y\in\mathcal{VS}^{sym,ac} \cup \mathcal{VS}^{asym,ac,cha}$) in time step $t$, $\Pi^{ac}_{y,z,t}$, and the weight of each time step $t$, $\omega_t$. In summary, the objective function can be understood as the minimization of costs associated with five sets of different decisions: 1. where and how to invest on capacity, @@ -92,3 +92,6 @@ In summary, the objective function can be understood as the minimization of cost Note however that each of these components are considered jointly and the optimization is performed over the whole problem at once as a monolithic co-optimization problem. While the objective function is formulated as a cost minimization problem, it is also equivalent to a social welfare maximization problem, with the bulk of demand treated as inelastic and always served, and the utility of consumption for price-elastic consumers represented as a segment-wise approximation, as per the cost of unserved demand summation above. + +# Objective Scaling +Sometimes the model will be built into an ill form if some objective terms are quite large or small. To alleviate this problem, we could add a scaling factor to scale the objective function during solving while leaving all other expressions untouched. The default ```ObjScale``` is set to 1 which has no effect on objective. If you want to scale the objective, you can set the ```ObjScale``` to an appropriate value in the ```genx_settings.yml```. The objective function will be multiplied by the ```ObjScale``` value during the solving process. \ No newline at end of file From e1e8850ebc5a80be885c450aa6fc2d6c23922fa3 Mon Sep 17 00:00:00 2001 From: "Chakrabarti, Sambuddha (Sam)" Date: Mon, 25 Mar 2024 17:44:21 -0400 Subject: [PATCH 6/9] Update make.jl To render versioned doc pages along with dev and all three digits of the version number --- docs/make.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index dfd0340287..cb516764d9 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -128,6 +128,6 @@ deploydocs(; devbranch = "main", devurl = "dev", push_preview=true, - versions = ["stable" => "v^", "v#.#"], + versions = ["stable" => "v^", "v#.#.#", devurl => devurl], forcepush = false, ) From 4d8a1c7caaed3a0e662ae8e73e26d96603097bb6 Mon Sep 17 00:00:00 2001 From: "Chakrabarti, Sambuddha (Sam)" Date: Mon, 25 Mar 2024 17:46:30 -0400 Subject: [PATCH 7/9] Update README.md With correct URL of doc pages in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 17c889ed78..f4eb78ce22 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ There are two ways to run GenX with either type of solver options (open-source f ## Documentation -Detailed documentation for GenX can be found [here](https://genxproject.github.io/GenX/dev). +Detailed documentation for GenX can be found [here](https://genxproject.github.io/GenX.jl/dev). It includes details of each of GenX's methods, required and optional input files, and outputs. Interested users may also want to browse through [prior publications](https://energy.mit.edu/genx/#publications) that have used GenX to understand the various features of the tool. From 24009e99a6480dd507cbee51ee63f063723faf42 Mon Sep 17 00:00:00 2001 From: "Chakrabarti, Sambuddha (Sam)" Date: Mon, 25 Mar 2024 18:13:01 -0400 Subject: [PATCH 8/9] Update make.jl --- docs/make.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index cb516764d9..eeaa501c5b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -128,6 +128,6 @@ deploydocs(; devbranch = "main", devurl = "dev", push_preview=true, - versions = ["stable" => "v^", "v#.#.#", devurl => devurl], + versions = ["stable" => "v^", "v#.#.#", "dev" => "dev"], forcepush = false, ) From bfa485c48d40a3aa0cf192f2685231987b41f050 Mon Sep 17 00:00:00 2001 From: "Chakrabarti, Sambuddha (Sam)" Date: Wed, 3 Apr 2024 11:41:09 -0400 Subject: [PATCH 9/9] Update CHANGELOG.md With modified scaler definition, mentioning that it addresses problem ill-conditioning --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b891691011..9c90d83dfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added -- Add objective scaler (#667) +- Add objective scaler for addressing problem ill-conditioning (#667) ## [0.4.0] - 2024-03-18