Context
Following up on https://github.com/orgs/pathsim/discussions/195, this is
where the python-control integration for pathsim lives, split into two
phases.
Phase 1 — linear bridge (in progress)
Once pathsim/pathsim#237 is merged, this phase is straightforward:
Simulation.linearize_system(..., as_block=False) returns a
LinearizationResult (A,B,C,D,state_labels,input_labels,output_labels)
whose labels already match control.StateSpace's states=/inputs=/
outputs= kwargs — verified against real python-control in
tests/evals/test_linearize_system_python_control.py. So
to_control_statespace(sim, inputs, outputs, t=None) is just a thin
wrapper building a control.StateSpace from that result, no adapter code
needed. Unlocks control.margin, control.root_locus, control.bode_plot,
etc. on any pathsim Simulation immediately.
Phase 2 — nonlinear bridge (later)
Wrap an entire pathsim Simulation as a control.NonlinearIOSystem
(updfcn/outfcn), enabling full nonlinear simulation/operating-point
analysis through python-control's own tooling. Harder: needs adapting the
DAG-order algebraic-loop-resolution logic in pathsim core's
utils/linearization.py (assemble_linear_system) to work with nonlinear
per-block functions instead of Jacobians.
Context
Following up on https://github.com/orgs/pathsim/discussions/195, this is
where the python-control integration for pathsim lives, split into two
phases.
Phase 1 — linear bridge (in progress)
Once pathsim/pathsim#237 is merged, this phase is straightforward:
Simulation.linearize_system(..., as_block=False)returns aLinearizationResult(A,B,C,D,state_labels,input_labels,output_labels)whose labels already match
control.StateSpace'sstates=/inputs=/outputs=kwargs — verified against realpython-controlintests/evals/test_linearize_system_python_control.py. Soto_control_statespace(sim, inputs, outputs, t=None)is just a thinwrapper building a
control.StateSpacefrom that result, no adapter codeneeded. Unlocks
control.margin,control.root_locus,control.bode_plot,etc. on any pathsim
Simulationimmediately.Phase 2 — nonlinear bridge (later)
Wrap an entire pathsim
Simulationas acontrol.NonlinearIOSystem(
updfcn/outfcn), enabling full nonlinear simulation/operating-pointanalysis through python-control's own tooling. Harder: needs adapting the
DAG-order algebraic-loop-resolution logic in pathsim core's
utils/linearization.py(assemble_linear_system) to work with nonlinearper-block functions instead of Jacobians.