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

Price taker model for DISPATCHES, Rehashed #1358

Merged
merged 162 commits into from
Feb 14, 2025
Merged

Conversation

djlaky
Copy link
Contributor

@djlaky djlaky commented Feb 29, 2024

Fixes

Compared to #1201, operational constraints mathematical form was corrected. Unnecessary functions were removed/merged. Additional user flexibility was added for constructing cost objectives.

Summary/Motivation:

Resurrecting #1201 to finish price taker framework in accordance with project milestones.

Framework allows the user to construct price-taker models for design and/or operational optimization considering time-varying market price data.

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

radhakrishnatg and others added 30 commits May 25, 2023 21:46
… functions to add constraints through pyomo blocks
@adam-a-a
Copy link
Contributor

@adowling2 @djlaky - we think this is in a good enough place to merge, and if there are no objections, would like to merge by the next dev call coming up. Please provide any review comments that you might have before the dev call on Thursday. We also plan to follow up with subsequent PRs to make certain refinements, such as adding a tutorial example, adding a clustering method, etc., so if any suggested changes come to mind, please consider whether they should be done in this PR or could be handled in a subsequent PR. Thanks in advance!

@adam-a-a adam-a-a requested a review from andrewlee94 February 11, 2025 19:20
Copy link
Contributor

@MarcusHolly MarcusHolly left a comment

Choose a reason for hiding this comment

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

Two small things to address. Otherwise, it LGTM

# Test that axes were created
assert plt.gca() is not None
# Test that the plot has data
# assert plt.gca().has_data()
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why this test is commented out?

Copy link
Contributor

Choose a reason for hiding this comment

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

It was a simple plot. I could see the data on the plot, but the assertion was failing for some unknown reason.
There isn't anything in the code that breaks it. So, I thought it would just be sufficient to run it for code coverage.
I commented it for now. I will see if I can fix it later.

Copy link
Contributor

@agarciadiego agarciadiego left a comment

Choose a reason for hiding this comment

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

Just a small question otherwise this looks good to me

@lbianchi-lbl lbianchi-lbl added the CI:run-integration triggers_workflow: Integration label Feb 12, 2025
@idaes-build idaes-build removed the CI:run-integration triggers_workflow: Integration label Feb 12, 2025
@ksbeattie ksbeattie enabled auto-merge (squash) February 13, 2025 21:01
@ksbeattie ksbeattie disabled auto-merge February 14, 2025 00:59
@ksbeattie ksbeattie merged commit 90908a3 into IDAES:main Feb 14, 2025
38 checks passed
Copy link
Contributor

@adam-a-a adam-a-a left a comment

Choose a reason for hiding this comment

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

LGTM- dropping my review even though this is merged already. My intention is to potentially cover some of these comments as we move forward with subsequent PRs @radhakrishnatg @MarcusHolly.

Comment on lines +39 to +43
resource based on their respective bid curves. Advanced data analytics (RAVEN) reinterpret the LMP signals and PCM
as stochastic realizations of the LMPs in the form of representative days (or simply the full-year price signals).
In part 2, PRESCIENT uses a variety of input parameters (design capacity, minimum power output, ramp rate, minimum up/down time, marginal cost, no load cost, and startup profile)
to generate data for the market surrogates. Meanwhile, IDAES uses the double loop simulation to integrate detailed
process models (b, ii) into the daily (a, c) and hourly (i, iii) grid operations workflow.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this relevant specifically for the PriceTaker class as implemented in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not really - I've trimmed down the "part 2" section, but still kept the image since I think it helps to get a holistic picture of the general workflow

# Detecting Knee Points in System Behavior
# https://raghavan.usc.edu/papers/kneedle-simplex11.pdf

return len(np.array(x)) + len(np.array(y))
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understand this. This looks like it merely returns the sum of the length of input vars and length of output vars. When glancing at the paper, it appears to be more than that. How does the implementation boil down to this simple sum?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just removed this function in #1579 since I didn't think it was necessary

),
)
CONFIG.declare(
"lmp_data",
Copy link
Contributor

Choose a reason for hiding this comment

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

a little unclear we why would want to have the option to append LMP data to the OperationModel as well as to the Pricetraker. Why not limit to only having LMP data on the Pricetaker?

num_representative_days: Optional[int], default=None
number of clusters or representative periods.
horizon_length: Optional[int], default=None
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason why this isn't taken from the config?


# Perform domain validation (ConfigDict performs the validation)
if self._config.lmp_data is None:
assert len(lmp_data) >= 2 # Do not remove this check!
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this raise an exception?

Comment on lines +273 to +275
return get_optimal_num_clusters(
daily_data, kmin, kmax, method, generate_elbow_plot, self._config.seed
)
Copy link
Contributor

Choose a reason for hiding this comment

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

where does self._config.num_clusters really play a role?

Comment on lines +383 to +384
for attribute in attribute_list:
if not hasattr(blk, attribute):
Copy link
Contributor

Choose a reason for hiding this comment

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

attribute_list isn't used for anything else besides this hasattr check, so I am wondering why it's here. I suppose this might be the place to check for it before proceeding to subsequent code

MarcusHolly added a commit to MarcusHolly/idaes-pse that referenced this pull request Feb 25, 2025
MarcusHolly added a commit to MarcusHolly/idaes-pse that referenced this pull request Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DISPATCHES Priority:Normal Normal Priority Issue or PR WaterTAP
Projects
None yet
Development

Successfully merging this pull request may close these issues.