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

Maintenance constraints (and for thermal generators) #556

Merged
merged 32 commits into from
Oct 4, 2023

Conversation

cfe316
Copy link
Collaborator

@cfe316 cfe316 commented Oct 2, 2023

This adds the ability to have maintenance constraints for arbitrary generators that have

  • a COMMIT-like quantity
  • a eTotalCap-like quantity
  • a Cap_Size-like quantity

I've implemented this in a very general way:

  • The maintenance variables are given custom names per-resource (with an optional suffix). This potentially allows for more than one component of a complex resource to have maintenance, on different schedules.

  • So far I've "implemented" maintenance variables for THERM generators only.

  • I plan to apply these to fusion core

This adds 4 optional columns to Generators_data.csv:
MAINT, Maintenance_Duration, Maintenance_Frequency_Years and Maintenance_Begin_Cadence.
The first is either 0/1. The others are not read for a given resource unless it has MAINT=1.
The MAINT column as a whole is optional.

  • This outputs a new file called maint_down.csv. This tracks the number of plants (in units of Cap_Size) which are under maintenance in each timestep.

  • I have yet to write documentation for this module.

  • I'd appreciate any critiques on code style, inconsistent or annoying variable names, etc.

  • This should be applied before the general Fusion/Thermal+Storage module Thermal+storage (fusion, maintenance) #546 , which will be edited accordingly.

@cfe316 cfe316 requested review from gmantegna and lbonaldo October 2, 2023 00:08
Copy link
Collaborator

@gmantegna gmantegna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. A couple of comments and requests:

  • Please add documentation to the docs for the new inputs and also the added functionality.
  • Do the maintenance constraints make sense when TDR is used?
  • Confirming that all the units make sense when unit commitment is not integer?
  • How does this play with operating reserves? In the current formulation, can a plant provide operating reserves when it is on maintenance?

src/model/resources/maintenance.jl Outdated Show resolved Hide resolved
@constraint(EP, [t in T], vMDOWN[t] == sum(vMSHUT[controlling_hours(t)]))

# Plant frequire maintenance every (certain number of) year(s)
@constraint(EP, sum(vMSHUT[t]*weights[t] for t in maintenance_begin_hours) >=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this work when you are only modeling one year?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe it's pointless to have weights here.

In general

  • maintenance only works when you are modeling one year
  • if a plant requires maintenance every N years then 1/N of the plants require maintenance.

src/model/resources/thermal/thermal.jl Outdated Show resolved Hide resolved
src/model/resources/thermal/thermal.jl Outdated Show resolved Hide resolved
src/model/resources/thermal/thermal.jl Outdated Show resolved Hide resolved
const MAINTENANCESHUTVARS = "MaintenanceShutVariables"
const HASMAINT = "has_maiNTENANCE"

function get_maintenance(df::DataFrame)::Vector{Int}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide more documentation for these functions.

src/model/resources/maintenance.jl Outdated Show resolved Hide resolved
@cfe316
Copy link
Collaborator Author

cfe316 commented Oct 3, 2023

Do the maintenance constraints make sense when TDR is used?

No, and the code will throw an error. It is required that inputs["REP_PERIOD"]==1.

Confirming that all the units make sense when unit commitment is not integer?

Yes, that should be fine. We interface with vCOMMIT (which is always measured in 'number of plants') and eTotalCap (which is always measured in 'power' (i.e. MW)). It's only vCAP which is sometimes one and sometimes the other.

How does this play with operating reserves? In the current formulation, can a plant provide operating reserves when it is on maintenance?

Operating reserves require vCOMMIT'd units. The maintenance formulation pushes down to limit the maximum vCOMMIT:
@constraint(EP, [t in T], ecap[y] / cap - vcommit[y, t] >= vMDOWN[t])

Still need to do docs. Might to a separate User docs and Developer docs.

@cfe316
Copy link
Collaborator Author

cfe316 commented Oct 3, 2023

Requesting a second review.

Possible todos:

[ ] Mathematical formulation (is there any interest for this?) Any suggestions for variable names in model_notation.md?
[ ] Minimal test case

Please read over maintenance.md; I think it's explained pretty well.

Copy link
Collaborator

@gmantegna gmantegna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor documentation suggestions otherwise looks good.

@@ -388,6 +389,11 @@ This file contains cost and performance parameters for various generators and ot
|PWFU\_Fuel\_Usage\_Zero\_Load\_MMBTU\_per\_h|The fuel usage (MMBTU/h) for the first PWFU segemnt (y-intercept) at zero load.|
|PWFU\_Heat\_Rate\_MMBTU\_per\_MWh\_*i| The slope of fuel usage function of the segment i.|
|PWFU\_Load\_Point\_MW\_*i| The end of segment i (MW).|
|**Maintenance data**|
|MAINT|[0,1], toggles scheduled maintenance formulation.|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggests saying "constraints" instead of "formulation"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to only call it "constraints" because it includes new variables as well.

|MAINT|[0,1], toggles scheduled maintenance formulation.|
|Maintenance\_Duration| Duration of the maintenance period, in number of timesteps. Only used if `MAINT=1`.|
|Maintenance\_Frequency\_Years| (Inverse) frequency of scheduled maintenance, in years. Only used if `MAINT=1`.|
|Maintenance\_Begin\_Cadence| Cadence of timesteps in which scheduled maintenance can begin. Only used if `MAINT=1`.|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear to me what this means. Suggest adding more explanation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you explain it below but would suggest having just a bit more explanation here so it can stand on its own.

docs/src/maintenance.md Outdated Show resolved Hide resolved
- More than a single maintenance period per year (i.e. every three months) is not possible in the current formulation.
- Only full-year cases can be run; there must be only one "representative period".
It would not make sense to model a *month*-long maintenance period when the year is modeled as a series of representative *weeks*, for example.
- Multi-stage has not yet been tested (but please let us know what happens if you test it!).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is appropriate for documentation. Maybe we should ask someone to test this, at least just a quick sanity check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and it seemed to work.

- Multi-stage has not yet been tested (but please let us know what happens if you test it!).

### Interaction with integer unit commitment
If integer unit commitment is on (`UCommit=1`), this module may not produce sensible results.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this paragraph could be worded more clearly. I understand what you're saying after reading it a few times but it's not super clear.

src/model/resources/maintenance.jl Outdated Show resolved Hide resolved
@cfe316 cfe316 marked this pull request as ready for review October 4, 2023 02:45
Copy link
Collaborator

@lbonaldo lbonaldo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and for including all the comments. Looks great to me.

cfe316 added 5 commits October 4, 2023 14:26
Maintenance_Frequency_Years to Maintenance_Cycle_Length_Years

Frequencies have units of inverse-time. This is quantity with units of
time. I have corrected the name.
@cfe316 cfe316 merged commit a1475c7 into GenXProject:develop Oct 4, 2023
1 check passed
lbonaldo pushed a commit to lbonaldo/GenX that referenced this pull request Oct 12, 2023
Add an optional formulation for scheduled maintenance. Plants with this formulation active (so far, limited to thermal-commit plants, THERM=1) need to undergo a certain number of contiguous hours of maintenance every y >= 1 years. During this time they produce no power.

This may be particularly useful in modeling fission plants, which need roughly 4 weeks of maintenance every 18 or 24 months. (Here, 18 would need to be rounded up to 24, as only maintenance cycles which are an integer number of years work with this formulation.)
qluo0320github pushed a commit that referenced this pull request Nov 27, 2023
Add an optional formulation for scheduled maintenance. Plants with this formulation active (so far, limited to thermal-commit plants, THERM=1) need to undergo a certain number of contiguous hours of maintenance every y >= 1 years. During this time they produce no power.

This may be particularly useful in modeling fission plants, which need roughly 4 weeks of maintenance every 18 or 24 months. (Here, 18 would need to be rounded up to 24, as only maintenance cycles which are an integer number of years work with this formulation.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants