Skip to content

Refactor get_NSSS_and_parameters to accept components instead of model struct#246

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/update-get-nsss-function
Draft

Refactor get_NSSS_and_parameters to accept components instead of model struct#246
Copilot wants to merge 3 commits intomainfrom
copilot/update-get-nsss-function

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

Refactors get_NSSS_and_parameters and related functions to accept individual components (functions, workspaces, constants, equations) rather than the monolithic model struct, enabling more flexible usage patterns.

Changes

  • get_NSSS_and_parameters: New primary signature accepts components directly with optional model parameter for default solver fallback
  • get_custom_steady_state_buffer!: Now accepts workspaces struct directly
  • evaluate_custom_steady_state_function: Accepts NSSS_custom function and workspaces separately
  • AD rules: Updated rrule and ForwardDiff versions with optional caches_for_pullback/caches_for_derivatives parameters
  • Convenience methods: Model-based signatures call through to component-based implementations

Usage

# Component-based (new)
SS_and_pars, (err, iters) = get_NSSS_and_parameters(
    model.functions, model.workspaces, model.constants, model.equations, 
    parameter_values; model = model
)

# Model-based (convenience wrapper)
SS_and_pars, (err, iters) = get_NSSS_and_parameters(model, parameter_values)

Note: The model keyword argument is required when using the default NSSS_solve (which is a generated function that needs the full struct). Models with custom steady state functions can omit it.

Original prompt

have get_NSSS_and_parameters accept functions, workspaces, and cahces instead of the main model struct. see whihc elements are necessary and replace th emain model struct as an input argument


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 26, 2026 22:17
…stants, and equations as separate arguments

Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Copilot AI changed the title [WIP] Update get_NSSS_and_parameters to accept functions, workspaces, and caches Refactor get_NSSS_and_parameters to accept components instead of model struct Jan 26, 2026
Copilot AI requested a review from thorek1 January 26, 2026 22:25
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.

2 participants