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

Fix eELOSSByZone expr: access before initialization #569

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated README with new instructions for running GenX through Julia REPL terminal (#492)
- Fix factor of 0.5 when writing out transmission losses. (#480)
- Fix summation error when a set of hours is empty (in thermal_commit.jl).
- Fix access to eELOSSByZone expr before initialization (#541)

### Changed

Expand Down
5 changes: 4 additions & 1 deletion src/model/generate_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@
# Initialize Objective Function Expression
@expression(EP, eObj, 0)


#@expression(EP, :eCO2Cap[cap=1:inputs["NCO2Cap"]], 0)
@expression(EP, eGenerationByZone[z=1:Z, t=1:T], 0)

# Initialize energy losses related to technologies
@expression(EP, eELOSSByZone[z=1:Z], 0)

Check warning on line 100 in src/model/generate_model.jl

View check run for this annotation

Codecov / codecov/patch

src/model/generate_model.jl#L100

Added line #L100 was not covered by tests

# Initialize Capacity Reserve Margin Expression
if setup["CapacityReserveMargin"] > 0
@expression(EP, eCapResMarBalance[res=1:inputs["NCapacityReserveMargin"], t=1:T], 0)
Expand Down
7 changes: 3 additions & 4 deletions src/model/resources/storage/storage_all.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@
[y in STOR_ALL, t=1:T], EP[:vP][y,t] <= EP[:vS][y, hoursbefore(hours_per_subperiod,t,1)]*dfGen[y,:Eff_Down]
end)
end
#From co2 Policy module
@expression(EP, eELOSSByZone[z=1:Z],
sum(EP[:eELOSS][y] for y in intersect(STOR_ALL, dfGen[dfGen[!,:Zone].==z,:R_ID]))
)
# From co2 Policy module
expr = @expression(EP, [z=1:Z], sum(EP[:eELOSS][y] for y in intersect(STOR_ALL, dfGen[dfGen[!,:Zone].==z,:R_ID])))
EP[:eELOSSByZone] += expr

Check warning on line 98 in src/model/resources/storage/storage_all.jl

View check run for this annotation

Codecov / codecov/patch

src/model/resources/storage/storage_all.jl#L97-L98

Added lines #L97 - L98 were not covered by tests
end

function storage_all_reserves!(EP::Model, inputs::Dict)
Expand Down
Loading