Skip to content

Commit

Permalink
Merge branch 'develop' into docs/update_readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lbonaldo authored Sep 23, 2024
2 parents c009a2b + 2bd646d commit 1adef95
Show file tree
Hide file tree
Showing 39 changed files with 1,658 additions and 384 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added
- Fusion plant optional features for thermal plants (#743).

### 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).

## [0.4.1] - 2024-08-20

### Added
Expand Down
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ pages = OrderedDict(
"Thermal" => [
"Thermal" => "Model_Reference/Resources/thermal.md",
"Thermal Commit" => "Model_Reference/Resources/thermal_commit.md",
"Thermal No Commit" => "Model_Reference/Resources/thermal_no_commit.md"
"Thermal No Commit" => "Model_Reference/Resources/thermal_no_commit.md",
"Scheduled maintenance for Thermal Commit" => "Model_Reference/Resources/maintenance.md",
"Fusion" => "Model_Reference/Resources/fusion.md"
],
"Hydrogen Electrolyzers" => "Model_Reference/Resources/electrolyzers.md",
"Scheduled maintenance for various resources" => "Model_Reference/Resources/maintenance.md",
"Resource types" => "Model_Reference/Resources/resource.md"
],
"Maintenance" => "Model_Reference/maintenance_overview.md",
"Policies" => "Model_Reference/policies.md",
"Solver Configurations" => "Model_Reference/solver_configuration_api.md",
"Inputs Functions" => "Model_Reference/load_inputs.md",
Expand Down
4 changes: 2 additions & 2 deletions docs/src/Model_Concept_Overview/model_notation.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ $\mathcal{W} \subseteq \mathcal{G}$ | where $\mathcal{W}$ set of hydroelectric g
|$\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\]|
|$v_{y,z,t}$ | Commitment state of the generation cluster $y$ in zone $z$ at time $t$|
|$\mathcal{X}_{y,z,t}$ | Number of startup decisions, of the generation cluster $y$ in zone $z$ at time $t$|
|$\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$|
|$\mathcal{Q}_{o,n} \in \mathbb{R}_+$ | Inventory of storage of type $o$ at the beginning of input period $n$ \[MWh]|
|$\Delta\mathcal{Q}_{o,m} \in \mathbb{R}$ | Excess storage inventory built up during representative period $m$ \[MWh]|
Expand Down
287 changes: 287 additions & 0 deletions docs/src/Model_Reference/Resources/fusion.md

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion docs/src/Model_Reference/Resources/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ A constraint ensures that the value of `vMDOWN` in any hour is always more than
Another constraint ensures that the number of plants committed (`vCOMMIT`) at any one time plus the number of plants under maintenance (`vMDOWN`) is less than the total number of plants.

## Developer note: adding maintenance to a resource
The maintenance formulation is applied on a per-resource basis, by calling the function `maintenance_formulation!`.
The maintenance formulation is applied on a per-resource basis, by calling the function [`GenX.maintenance_formulation!`](@ref).
See [`GenX.maintenance_formulation_thermal_commit!`](@ref) for an example of how to apply it to a new resource.

* The resource must have a `eTotalCap`-like quantity and a `cap_size`-like parameter; only the ratio of the two is used.
* The resource must have a `vCOMMIT`-like variable which is proportional to the maximum power output, etc at any given timestep.

The generic maintenance module functions are listed below.

```@docs
GenX.maintenance_formulation!
Expand Down
96 changes: 0 additions & 96 deletions docs/src/Model_Reference/maintenance_overview.md

This file was deleted.

1 change: 0 additions & 1 deletion src/GenX.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export write_outputs
export cluster_inputs
export mga
export morris
export simple_operation
export choose_output_dir

# Multi-stage methods
Expand Down
4 changes: 2 additions & 2 deletions src/configure_settings/configure_settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function default_writeoutput()
"WriteESRPrices" => true,
"WriteESRRevenue" => true,
"WriteFuelConsumption" => true,
"WriteFusion" => true,
"WriteHourlyMatchingPrices" => true,
"WriteHydrogenPrices" => true,
"WriteMaintenance" => true,
Expand Down Expand Up @@ -155,7 +156,6 @@ function configure_writeoutput(output_settings_path::String, settings::Dict)
writeoutput["WriteStorage"] = false
writeoutput["WriteStorageDual"] = false
writeoutput["WriteTimeWeights"] = false
writeoutput["WriteCommit"] = false
writeoutput["WriteCapacityValue"] = false
writeoutput["WriteReserveMargin"] = false
writeoutput["WriteReserveMarginWithWeights"] = false
Expand Down Expand Up @@ -214,4 +214,4 @@ function validate_multistage_settings!(settings::Dict{Any, Any})
@warn msg
settings["WriteIntermittentOutputs"] = 0
end
end
end
55 changes: 48 additions & 7 deletions src/load_inputs/load_resources_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,46 @@ function check_maintenance_applicability(r::AbstractResource)
return ErrorMsg.(error_strings)
end

function check_fusion_applicability(setup::Dict, r::AbstractResource)
applicable_resources = Thermal

not_set = default_zero
value = get(r, :fusion, not_set)

error_strings = String[]

if value == not_set
# not FUSION so the rest is not applicable
return ErrorMsg.(error_strings)
end

if !isa(r, applicable_resources) && value > 0
e = string("Resource ", resource_name(r), " has :fusion = ", value, ".\n",
"This setting is valid only for resources where the type is \n",
"one of $applicable_resources. \n"
)
push!(error_strings, e)
end

model = get(r, :model, not_set)
if model == 2
e = string("Resource ", resource_name(r), " has :fusion = ", value, ".\n",
"This is valid only for resources with unit commitment (:model = 1);\n",
"this has :model = 2.")
push!(error_strings, e)
end

if setup["UCommit"] == 0
e = string("Resource ", resource_name(r), " has :fusion = ", value, ".\n",
"Use of the fusion module requires the setting UCommit > 0.\n",
"Contact the fusion module maintainers (Jacob Schwartz) if you are interested\n",
"in running a fusion case without unit commitment.")
push!(error_strings, e)
end

return ErrorMsg.(error_strings)
end

function check_retrofit_resource(r::AbstractResource)
error_strings = String[]

Expand Down Expand Up @@ -463,10 +503,11 @@ function check_qualified_hydrogen_supply(r::AbstractResource)
return WarnMsg.(warning_strings)
end

function check_resource(r::AbstractResource)
function check_resource(setup::Dict, r::AbstractResource)
e = []
e = [e; check_LDS_applicability(r)]
e = [e; check_maintenance_applicability(r)]
e = [e; check_fusion_applicability(setup, r)]
e = [e; check_mustrun_reserve_contribution(r)]
e = [e; check_retrofit_resource(r)]
e = [e; check_qualified_hydrogen_supply(r)]
Expand All @@ -491,15 +532,15 @@ function check_retrofit_id(rs::Vector{T}) where {T <: AbstractResource}
end

@doc raw"""
check_resource(resources::Vector{T})::Vector{String} where T <: AbstractResource
check_resource(setup::Dict, resources::Vector{T})::Vector{String} where T <: AbstractResource
Validate the consistency of a vector of GenX resources
Reports any errors/warnings as a vector of messages.
"""
function check_resource(resources::Vector{T}) where {T <: AbstractResource}
function check_resource(setup::Dict, resources::Vector{T}) where {T <: AbstractResource}
e = []
for r in resources
e = [e; check_resource(r)]
e = [e; check_resource(setup, r)]
end
e = [e; check_retrofit_id(resources)]
return e
Expand All @@ -526,8 +567,8 @@ function announce_errors_and_halt(e::Vector)
return nothing
end

function validate_resources(resources::Vector{T}) where {T <: AbstractResource}
e = check_resource(resources)
function validate_resources(setup::Dict, resources::Vector{T}) where {T <: AbstractResource}
e = check_resource(setup, resources)
if length(e) > 0
announce_errors_and_halt(e)
end
Expand Down Expand Up @@ -555,7 +596,7 @@ function create_resource_array(setup::Dict, resources_path::AbstractString)
# load each resource type, scale data and return array of resources
resources = create_resource_array(resources_path, resources_info, scale_factor)
# validate input before returning resources
validate_resources(resources)
validate_resources(setup, resources)
return resources
end

Expand Down
Loading

0 comments on commit 1adef95

Please sign in to comment.