Repository navigation
Conversation
A setpoint written as an expression of time can name its numbers through
the unit's `constants` (`underflow_Q="Q0 + A*sin(2*pi*t)"` with
`constants={"Q0": 385.0, "A": 75.0}`); each is the plant parameter
"<unit>.<name>", resolved by the expression at every evaluation, so a
sensitivity or a calibration reaches the numbers of a schedule. The ideal
and Takacs clarifiers, the primary clarifier and the setpoint and threshold
splitters take them (`NamedConstantsUnit`), in Python, the catalogue and a
flowsheet file. An expression that reads only constants, not `t`, is
constant in time and keeps the cached recycle maps.
`compile_time_expression` takes `constants=` and returns `f(t, values=None)`;
`time_expression_reads` names what an expression reads; the control law
shares the reserved-name check (`check_constant_names`).
`size_parameters` and `constants` are marked `written_when_set`: left out of
a saved spec and its fingerprint at their defaults, so adding them does not
turn an existing plant's studies stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ault The spec writer deliberately omits a setting such as size_parameters while it holds its default, so the property test now reads such a setting's default when it is absent. Drop the clock leaf's dtype argument: t * time_scale is already a float, so the argument changed nothing a test could see. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…19stlm # Conflicts: # aquakin/plant/catalog.py # aquakin/plant/clarifier.py
…19stlm # Conflicts: # .claude/rules/plant-spec.md
The test now passes a valid port ahead of the bad one, so it checks that the validation goes on past a good entry; it also takes both arcs of that loop's check in one test, which Codecov's per-shard reports need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…19stlm # Conflicts: # .claude/rules/plant-spec.md
ctdegroot
added this pull request to the merge queue
Dec 4, 2026
Any commits made after this event will not be merged.
This branch has not been deployed
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.
Closes #1073
Summary
A setpoint written as an expression of time can now name its numbers, and each named number is a plant parameter:
makes
"clar.Q0"and"clar.A"parameters, so a sensitivity, a Fisher analysis or a calibration reaches the numbers of a schedule. The ideal and Takács clarifiers, the primary clarifier and the setpoint and threshold splitters takeconstants=, in Python and in a flowsheet file (the catalogue, spec reader/writer and validation all read the names).core/time_expr.py:compile_time_expression(..., constants=)reads named constants as inputs (overridable per call, so they trace underjax.grad);time_expression_readsreports whether an expression readstand checks the names;check_constant_namesis shared with the control-law language, which now refuses a reserved constant name with the same message.plant/flow_setpoint.py: constants becomeFlowSetpointslots after the settings; a constant that clashes with a setting's name, or that no expression reads, is refused.NamedConstantsUnitis the mixin the units use.t) no longer disables the cached recycle / flow maps; one that readststill does (owner's decision: keep the maps when safe).Things a reviewer should know
written_when_setfield metadata.constantsandsize_parameters(Unit sizes as opt-in plant parameters #1083) are left out of a saved spec and ofspec_fingerprintwhile at their default. Unit sizes as opt-in plant parameters #1083 (unreleased) had changed every existing plant's fingerprint by writingsize_parameters: false, which would have made every saved study stale; this restores the example projects' fingerprints to their pre-Unit sizes as opt-in plant parameters #1083 values.test_operating_parameters.py::test_each_setting_is_a_named_parameter_seeded_with_its_valuereads the slots through_parameter_setpoints()instead of_flow_setpoints(), since constants are parameter slots but not flow settings.test_spec_properties.py::_round_tripaccepts awritten_when_setsetting being absent at its default.dtype=floaton the expression clock leaf:t * time_scaleis already a float, so it changed nothing (two equivalent mutants).main(Name unit settings in words, fold advanced ones away, and move a model in one step #1091 conflicted incatalog.pyandclarifier.py; both sides' fields kept).constantssits underParameters, notOther Parameters, so it is not anadvancedsetting.Testing
tests/unit tests/uiplustest_operating_parameters,test_setpoint_expressions,test_spec_properties,test_plant_specafter the merge: 3525 passed. Before the merge, the whole fast tier: all passed once the round-trip test was updated.aquakin.core.time_expr244/244 killed;aquakin.plant.control_law149/150 (the recorded survivor).-W) and thedocs/influents.mdexamples passed before the merge.ruff format --check,scripts/check_types.pyclean.slowandvalidationsuites (this needsfull-ci: recycle and plant assembly code changed).Patch coverage
scripts/patch_coverage.py: 100.00% of 131 changed lines (before the merge commit).Rule proposals
spec_fingerprintchanged and every study would have gone stale; no test noticed.spec_fingerprintof each example project underexamples/(rewritten only with the owner's agreement, like the golden numbers).Plant.to_specwrites for an existing plant: a new setting iswritten_when_setor the saved studies go stale.".claude/rules/plant-spec.md, which loads forplant/spec.pyandcatalog.py, the files such a change touches. Nothing it replaces.Generated by Claude Code