Support <rateRule> on constant=false parameters (promote to state) - #33
Merged
Conversation
SimBiology emits an abstract non-physical state (e.g. a dimensionless niche fraction) as a parameter with ConstantValue=false plus a rate rule, rather than as a species. The generator only parsed <assignmentRule>, so a <rateRule> targeting a parameter was silently dropped: the parameter stayed frozen at its initial value with no derivative emitted, and any downstream coupling to it evaluated against a constant. _parse_rate_rules promotes each such parameter to an amount-tracked pseudo-species (state slot + SP_ enum + initial value) and injects one synthetic production reaction whose rate law IS the rate-rule expression (d(var)/dt = expr). The existing stoichiometry -> ydot -> Jacobian -> RHS machinery then evolves it like any other state, with no special-casing downstream. Rate rules whose target is a species (already a state) are left to the normal reaction path. Verified on a PDAC model whose TLA niche fraction is the model's only rateRule: the state now integrates and its H_CXCL13-driven formation + decay are wired into both the RHS and the analytical Jacobian.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds codegen support for SBML
<rateRule>onconstant=falseparameters by promoting them to integrated state variables. The PDAC model depends on this (its SBML has a rateRule on a constant=false parameter), butrequirements.txtpinsqsp-codegen@main, which lacks it — so this needs to land onmainfor fresh PDAC codegen builds (local + HPC) to be correct.