Skip to content

Use FunctionData get_domain sugar (closes #33)#161

Closed
luke-kiernan wants to merge 1 commit into
mainfrom
issue-33-functiondata-sugar
Closed

Use FunctionData get_domain sugar (closes #33)#161
luke-kiernan wants to merge 1 commit into
mainfrom
issue-33-functiondata-sugar

Conversation

@luke-kiernan

Copy link
Copy Markdown
Collaborator

Closes #33.

Adopts the FunctionData sugar from InfrastructureSystems PR #492:

  • _validate_occ_subtype (ImportExportCost validation) now uses IS.get_domain instead of first(IS.get_x_coords(...)).
  • Clarifies the _onvar_cost comment (the constant term is the cost at zero output, i.e. the y-intercept).

Scope note

The realistic surface for this sugar is narrow. Most get_proportional_term / get_constant_term / get_quadratic_term calls can't use the new helpers because they either (a) build JuMP expressions over variables — the evaluation functor only accepts numbers — or (b) do unit-aware per-axis scaling, where c*fd (which scales y uniformly) doesn't apply since x and y convert by different ratios. The get_domain substitutions here are the clean, behavior-preserving wins.

We considered replacing the two _onvar_cost "cost at zero output" reads with the evaluation functor cost_component(0.0), but kept get_constant_term for efficiency and consistency (it's a plain field read; the functor would compute a·0² + b·0 + c).

Linked with InfrastructureOptimizationModels PR #134.

🤖 Generated with Claude Code

Adopt the FunctionData sugar from InfrastructureSystems PR #492:
- _validate_occ_subtype now uses IS.get_domain instead of
  first(get_x_coords(...)) to check the first breakpoint.
- Clarify the _onvar_cost comment (the constant term is the cost at
  zero output, i.e. the y-intercept).

Linked with the InfrastructureOptimizationModels PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates a couple of FunctionData interactions to use the newer IS.get_domain helper (per InfrastructureSystems PR #492 / issue #33), and clarifies documentation around how _onvar_cost interprets the constant term of a cost curve.

Changes:

  • Replaces first(IS.get_x_coords(fd)) with first(IS.get_domain(fd)) in ImportExportCost validation logic.
  • Clarifies the _onvar_cost comment to explicitly describe the constant term as the y-intercept (cost at zero output).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/static_injector_models/thermal_generation.jl Updates the _onvar_cost comment to clarify interpretation/units of the constant term.
src/common_models/market_bid_plumbing.jl Uses IS.get_domain sugar for validating the first ImportExportCost breakpoint is zero.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown

Performance Results

Version Precompile Time
Main 3.020103032
This Branch 3.000868844
Version Build Time
Main-Build Time Precompile 86.256056949
Main-Build Time Postcompile 1.320925811
This Branch-Build Time Precompile 85.324655926
This Branch-Build Time Postcompile 1.327712579
Version Solve Time
Main-Solve Time Precompile 3460.393972002
Main-Solve Time Postcompile 3431.481168323
This Branch-Solve Time Precompile 2206.32088433
This Branch-Solve Time Postcompile 2173.350314733

@luke-kiernan

Copy link
Copy Markdown
Collaborator Author

Given how minimal the changes are here, the test failures are certainly upstream.

@luke-kiernan

Copy link
Copy Markdown
Collaborator Author

The surface here is so small I think I'll just close without merging. It's supposed to be a quality of life boost, but there's only like 1-2 lines that are actually affected...

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.

Use new IS functionality to streamline FunctionData operations

2 participants