Skip to content

Default loop-opened signals in trajectory_ss to their trajectory values - #86

Open
baggepinnen wants to merge 2 commits into
masterfrom
fbc/trajectory-loop-opening-defaults
Open

Default loop-opened signals in trajectory_ss to their trajectory values#86
baggepinnen wants to merge 2 commits into
masterfrom
fbc/trajectory-loop-opening-defaults

Conversation

@baggepinnen

Copy link
Copy Markdown
Member

Opening a loop during linearization turns the opened signal into a parameter whose value must be supplied in the operating point. The batch-linearization tutorial previously held these signals at 0, which linearizes at the wrong point for systems nonlinear in the opened signal — visible in the tutorial as identical controller linearizations along the entire trajectory in the "Loop open at v and y" plot, even though the scheduling input varies.

trajectory_ss now defaults each opened signal to its own value in the loop-closed solution at every time point: the opened signal is mapped to itself as a symbolic operating-point value, which ModelingToolkit.LinearizationOpPoint resolves from the solution. Since the connection still holds in the loop-closed solution, this equals the value of the driving signal, and the linearization is performed around the trajectory also for the opened signals. User-supplied op entries take precedence, so any signal can still be held at a fixed value, e.g. op = Dict(sys.opened_signal => 0).

Tutorial changes: the explicit op = Dict(… => 0) workarounds are removed from all trajectory_ss calls, and opening at v and y now coincides with opening at u (both schedule along the trajectory), verified by a new freqresp test. The controller linearizations with the scheduling loop opened now genuinely vary along the trajectory.

Depends on SciML/ModelingToolkit.jl#4894 (symbolic loop-opening op values resolved from the solution). CI will stay red until that PR merges, since [sources] pins ModelingToolkit to master. The ModelingToolkit compat bound should be bumped to the version containing that fix before release.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SWPXe76HwiugWWyLP7BYrL

baggepinnen and others added 2 commits August 6, 2026 12:00
Opening a loop turns the opened signal into a parameter whose value must be
supplied in the operating point. Previously the tutorial held these at 0,
which linearizes at the wrong point for systems nonlinear in the opened
signal — visible as identical controller linearizations along the whole
trajectory in the batch-linearization tutorial.

trajectory_ss now maps each opened signal to itself as a symbolic operating-
point value, which ModelingToolkit.LinearizationOpPoint resolves from the
loop-closed solution at each time point (requires the corresponding MTK
support for symbolic op values). User-supplied op entries take precedence.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWPXe76HwiugWWyLP7BYrL
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.

1 participant