Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new resource type: CCS with solvent storage #795

Open
wants to merge 18 commits into
base: solvent-storage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/PR_checks.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Changelog Enforcer
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
# Enforces update of changelog file on every pull request
Changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dangoslen/changelog-enforcer@v3
with:
changeLogPath: 'CHANGELOG.md'
skipLabels: 'Skip-Changelog, skip changelog'
token: ${{ secrets.GITHUB_TOKEN }}
missingUpdateErrorMessage: >
No update to CHANGELOG.md found! Please add an entry describing
your change and include the pull request tag. Note that we use
the keepachangelog format (https://keepachangelog.com). If your
change doesn’t require a changelog entry, please add the
'Skip-Changelog' or 'skip changelog' label to the pull request.
137 changes: 137 additions & 0 deletions .github/workflows/dev_version_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Dev Version Check and Update

on:
pull_request_review:
types: [submitted]

jobs:
check-version:
if: github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'develop'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}

- name: Set up Julia
uses: julia-actions/setup-julia@latest
with:
version: '1.x'

- uses: julia-actions/cache@v2

- name: Configure Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"

- name: Check and Update Version
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
run: |
# Get PR base branch and export it
export BASE_BRANCH=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO/pulls/$PR_NUMBER" | \
jq -r .base.ref)

julia -e '

# Get base branch directly from environment variable
base_branch = ENV["BASE_BRANCH"]

# First ensure we have the base branch
run(`git fetch origin $(base_branch)`)

function parse_version(version_str)
# Extract M.m.p and optional dev number
base_pattern = r"^(\d+\.\d+\.\d+)(?:-dev\.(\d+))?$"
m = match(base_pattern, version_str)
if isnothing(m)
error("Invalid version format: $version_str")
end

version = m.captures[1]
dev_num = isnothing(m.captures[2]) ? nothing : parse(Int, m.captures[2])
return (version, dev_num)
end

function should_update_version(base_ver_str, current_ver_str)
base_ver, base_dev = parse_version(base_ver_str)
current_ver, current_dev = parse_version(current_ver_str)

# If versions differ, no update needed
if base_ver != current_ver
return false
end

# If base has dev number, we should increment from the base dev number
if !isnothing(base_dev)
return true
end

# If base has no dev number and current has none, add dev.1
if isnothing(base_dev) && isnothing(current_dev)
return true
end

return false
end

function get_new_version(base_ver_str, current_ver_str)
base_ver, base_dev = parse_version(base_ver_str)
current_ver, current_dev = parse_version(current_ver_str)

# If base has a dev number, increment from that
if !isnothing(base_dev)
return "$(base_ver)-dev.$(base_dev + 1)"
end

# If no dev numbers exist, start with dev.1
return "$(current_ver)-dev.1"
end

function check_and_update_version()
# Get the base branch version
base_content = read(pipeline(`git show origin/$(base_branch):Project.toml`), String)
# Get current branch version
current_content = read(joinpath(pwd(), "Project.toml"), String)

# Extract versions using regex
version_pattern = r"version = \"(.*?)\""
base_version = match(version_pattern, base_content).captures[1]
current_version = match(version_pattern, current_content).captures[1]

println("Base version: $base_version")
println("Current version: $current_version")

if should_update_version(base_version, current_version)
println("Version needs updating")

new_version = get_new_version(base_version, current_version)

# Update the file
new_content = replace(current_content,
"version = \"$current_version\"" =>
"version = \"$new_version\"")

write(joinpath(pwd(), "Project.toml"), new_content)

# Commit and push the change
run(`git add $(joinpath(pwd(), "Project.toml"))`)
run(`git commit -m "Bump version to $new_version"`)
run(`git push`)

println("Version updated to $new_version")
else
println("Version already updated")
end
end

check_and_update_version()'
14 changes: 0 additions & 14 deletions .github/workflows/format_suggestions.yml

This file was deleted.

19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.4.2] - 2024-12-23

### Added
- Fusion plant optional features for thermal plants (#743).
- Support for reusing the same Gurobi environment for multiple solves when
number of concurrent Gurobi uses is limited (#783).
- Additional long-duration storage constraints to bound state of charge in
non-representative periods (#781).
- New version of `add_similar_to_expression!` to support arrays of `Number`s. (#798)
- New settings flag `LDSAdditionalConstraints` to provide flexibility in
activating new long-duration storage constraints (#781). Can be set in the GenX
settings file (PR #801).

### Changed
- The `charge.csv` and `storage.csv` files now include only resources with
charge and storage variables (#760 and #763).
- Deduplicated docs on optimized scheduled maintenance for thermal resources (#745).
- Removed the `CapRes_*` columns from `Network.csv` since they were not being used (#784).

### Fixed
- Add constraint to ensure that electricity charged from the grid cannot exceed
the charging capacity of the storage component in VRE_STOR (#770).
- Update `getproperty` function for vectors of resources to ensure compatibility
with Julia v1.11 (#785).
- Fixed cost calculation in `write_costs.jl` when no resources are present in
a zone. (#796)
- Added `eTotalCMaxCapSlack` to calculation of `cUnmetPolicyPenalty` in
`write_costs.jl` (#806).

## [0.4.1] - 2024-08-20

Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ authors:
given-names: "Qingyu"
orcid: "https://orcid.org/0000-0003-2692-5135"
title: "GenX"
version: 0.4.1
version: 0.4.2
doi: 10.5281/zenodo.10846070
date-released: 2024-04-26
url: "https://github.com/GenXProject/GenX.jl"
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GenX"
uuid = "5d317b1e-30ec-4ed6-a8ce-8d2d88d7cfac"
authors = ["Bonaldo, Luca", "Chakrabarti, Sambuddha", "Cheng, Fangwei", "Ding, Yifu", "Jenkins, Jesse D.", "Luo, Qian", "Macdonald, Ruaridh", "Mallapragada, Dharik", "Manocha, Aneesha", "Mantegna, Gabe ", "Morris, Jack", "Patankar, Neha", "Pecci, Filippo", "Schwartz, Aaron", "Schwartz, Jacob", "Schivley, Greg", "Sepulveda, Nestor", "Xu, Qingyu", "Zhou, Justin"]
version = "0.4.1-dev.9"
version = "0.4.2-dev.1"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ that incorporates several state-of-the-art practices in electricity system plann
The model was [originally developed](https://energy.mit.edu/publication/enhanced-decision-support-changing-electricity-landscape/) by
[Jesse D. Jenkins](https://mae.princeton.edu/people/faculty/jenkins) and
[Nestor A. Sepulveda](https://energy.mit.edu/profile/nestor-sepulveda/) at the Massachusetts Institute of Technology and is now jointly maintained by
[a team of contributors](https://github.com/GenXProject/GenX#genx-team) at the Princeton University ZERO Lab (led by Jenkins), MIT (led by [Ruaridh MacDonald](https://energy.mit.edu/profile/ruaridh-macdonald/)), and NYU (led by [Dharik Mallapragada](https://engineering.nyu.edu/faculty/dharik-mallapragada)).
[a team of contributors](https://github.com/GenXProject/GenX#genx-team) at the Princeton University ZERO Lab (led by Jenkins), MIT (led by [Ruaridh MacDonald](https://energy.mit.edu/profile/ruaridh-macdonald/)), NYU (led by [Dharik Mallapragada](https://engineering.nyu.edu/faculty/dharik-mallapragada)), and Binghamton University (led by [Neha Patankar](https://www.binghamton.edu/ssie/people/profile.html?id=npatankar)).

GenX is a constrained linear or mixed integer linear optimization model that determines the portfolio of electricity generation,
storage, transmission, and demand-side resource investments and operational decisions to meet electricity demand in one or more future planning years at lowest cost,
Expand All @@ -40,7 +40,7 @@ The 'main' branch is the current master branch of GenX. The various subdirectori

## Requirements

GenX (v0.4.1) runs on Julia v1.6 through v1.9, with a minimum version of the package JuMP v1.1.1. Julia v1.10 is also supported. However, we recently noticed a decline in performance with Julia v1.10, which is currently under investigation. Therefore, **we recommend using Julia v1.9**, particularly for very large cases.
GenX (v0.4.2) runs on Julia v1.6 through v1.9, with a minimum version of the package JuMP v1.1.1. Julia v1.10 and v1.11 are also supported. However, we recently noticed a decline in performance with Julia v1.10, which is currently under investigation. Therefore, **we recommend using Julia v1.9**, particularly for very large cases.
We recommend the users to either stick to a particular version of Julia to run GenX. If however, the users decide to switch between versions, it's very important to delete the old `Manifest.toml` file and do a fresh build of GenX when switching between Julia versions.

There is also an older version of GenX, which is also currently maintained and runs on Julia 1.3.x and 1.4.x series.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/Model_Concept_Overview/model_notation.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ $\mathcal{W} \subseteq \mathcal{G}$ | where $\mathcal{W}$ set of hydroelectric g
|$r^{ac,cha}_{y,z,t} \in \mathbb{R}_+$ | Upward spinning reserves contribution \[MW\] for the storage AC charge component from technology $y$ in zone $z$ at time $t$ - only applicable for co-located VRE and storage resources with a storage AC charge component, $y \in \mathcal{VS}^{sym,ac} \cup y \in \mathcal{VS}^{asym,ac,cha}$ |
|$\alpha^{Contingency,Aux}_{y,z} \in \{0,1\}$ | Binary variable that is set to be 1 if the total installed capacity $\Delta^{\text{total}}_{y,z} > 0$ for any generator $y \in \mathcal{UC}$ and zone $z$, and can be 0 otherwise |
|$\Phi_{l,t} \in \mathbb{R}_+$ | Power flow in line $l$ at time step $t$ \[MWh\]|
|$\theta_{z,t} \in \mathbb{R}$ | Volta phase angle in zone $z$ at time step $t$ \[radian\]|
|$\theta_{z,t} \in \mathbb{R}$ | Voltage phase angle in zone $z$ at time step $t$ \[radian\]|
|$\nu_{y,z,t}$ | Commitment state of the generation cluster $y$ in zone $z$ at time $t$|
|$\chi_{y,z,t}$ | Number of startup decisions, of the generation cluster $y$ in zone $z$ at time $t$|
|$\zeta_{y,z,t}$ | Number of shutdown decisions, of the generation cluster $y$ in zone $z$ at time $t$|
Expand Down
2 changes: 1 addition & 1 deletion docs/src/Tutorials/Tutorial_1_configuring_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GenX is easy to customize to fit a variety of problems. In this tutorial, we sho
There are 21 settings available to edit in GenX, found in the file `genx_settings.yml`. These settings are described at the [Model settings parameters
](@ref) page of the documentation. The file is located in the `settings` folder in the working directory. To change the location of the file, edit the `settings_path` variable in `Run.jl` within your directory.

Most settings are set as either 0 or 1, which correspond to whether or not to include a specific feature. For example, to use `TimeDomainReduction`, you would set its parameter to 0 within `genx_settings.yml`. If you would like to run GenX without it, you would set its parameter to 1.
Most settings are set as either 0 or 1, which correspond to whether or not to include a specific feature. For example, to use `TimeDomainReduction`, you would set its parameter to 1 within `genx_settings.yml`. If you would like to run GenX without it, you would set its parameter to 0.

Other settings, such as `CO2Cap`, have more options corresponding to integers, while some settings such as `ModelingtoGenerateAlternativeSlack` take a numerical input directly (in this case, the slack value). Two settings, `Solver` and `TimeDomainReductionFolder` take in text as input. To learn more about different solvers, read [here](https://github.com/GenXProject/GenX.jl/blob/main/docs/src/User_Guide/solver_configuration.md). For `TimeDomainReductionFolder`, specify the name of the directory you wish to see the results in. For a more comprehensive description of the input options, see the documentation linked above.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/Tutorials/Tutorial_4_model_generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ end

# Model constraints, variables, expression related to reservoir hydropower resources with long duration storage
if inputs["REP_PERIOD"] > 1 && !isempty(inputs["STOR_HYDRO_LONG_DURATION"])
GenX.hydro_inter_period_linkage!(EP, inputs)
GenX.hydro_inter_period_linkage!(EP, inputs, setup)
end

# Model constraints, variables, expression related to demand flexibility resources
Expand Down
Loading
Loading