JuliaControl / ControlSystems.jl

A Control Systems Toolbox for Julia
https://juliacontrol.github.io/ControlSystems.jl/stable/
Other
509 stars 85 forks source link

add functions to check controllability/observability using the PHB test #866

Closed baggepinnen closed 1 year ago

baggepinnen commented 1 year ago

See discussion in #865

@franckgaga

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (737a925) 92.72% compared to head (5cbf7ce) 92.72%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #866 +/- ## ======================================= Coverage 92.72% 92.72% ======================================= Files 5 5 Lines 330 330 ======================================= Hits 306 306 Misses 24 24 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

JuliaControlBot commented 1 year ago
This is an automated message. Plots were compared to references. 11/11 images have changed, see differences below. After pulling this PR, please update the reference images by creating a PR to ControlExamplePlots.jl here. Difference Reference Image New Image
:x: 0.047 Reference New
:heavy_check_mark: 0.011 Reference New
:heavy_check_mark: 0.001 Reference New
:heavy_check_mark: 0.001 Reference New
:heavy_check_mark: 0.007 Reference New
:heavy_check_mark: 0.003 Reference New
:heavy_check_mark: 0.0 Reference New
:warning: 0.028 Reference New
:x: 0.06 Reference New
:heavy_check_mark: 0.0 Reference New
:warning: 0.017 Reference New
JuliaControlBot commented 1 year ago
This is an automated message. Plots were compared to references. 11/11 images have changed, see differences below. After pulling this PR, please update the reference images by creating a PR to ControlExamplePlots.jl here. Difference Reference Image New Image
:x: 0.047 Reference New
:heavy_check_mark: 0.011 Reference New
:heavy_check_mark: 0.001 Reference New
:heavy_check_mark: 0.001 Reference New
:heavy_check_mark: 0.007 Reference New
:heavy_check_mark: 0.003 Reference New
:heavy_check_mark: 0.0 Reference New
:warning: 0.028 Reference New
:x: 0.06 Reference New
:heavy_check_mark: 0.0 Reference New
:warning: 0.017 Reference New
JuliaControlBot commented 1 year ago
This is an automated message. Plots were compared to references. 11/11 images have changed, see differences below. After pulling this PR, please update the reference images by creating a PR to ControlExamplePlots.jl here. Difference Reference Image New Image
:x: 0.047 Reference New
:heavy_check_mark: 0.011 Reference New
:heavy_check_mark: 0.001 Reference New
:heavy_check_mark: 0.001 Reference New
:heavy_check_mark: 0.007 Reference New
:heavy_check_mark: 0.003 Reference New
:heavy_check_mark: 0.0 Reference New
:warning: 0.028 Reference New
:x: 0.06 Reference New
:heavy_check_mark: 0.0 Reference New
:warning: 0.017 Reference New
franckgaga commented 1 year ago

good job @baggepinnen! I'll use them in my package :)

andreasvarga commented 1 year ago

I would move the check for square matrix before eigenvalue computation.

andreasvarga commented 1 year ago

In a strict sense, the function controllabiliy checks the reachability of a LTI system. While for continuous-time systems the two notions are equivalent, for discrete-time systems there is a subtle difference between them. In general reachability implies controllability, but the reverse is not true. The controllability property is defined as the ability of a system to drive any state into the origin, while reachability is the ability to drive any state into another arbitrary state, in finite time. For example, discrete-time systems with B = 0 and A nillpotent are controllable! In MATLAB this aspect is handled incorrectly, so there is a chance to address it in a rigourous manner in Julia! The function observability checks the right property!

baggepinnen commented 1 year ago

Thanks for the comment! Is your proposed change to rename the implemented function to reachability, or to change the implementation to distinguish between controllability and reachability for discrete-time systems? If the latter, do you know of a reference that can be used to guide the implementation?

andreasvarga commented 1 year ago

A pertinent discussion of this aspect is, for example, in the book of Kailath (1980), starting with page 95, where also the dual concepts observability and constructibility are discussed. See also the picture on page 100, which illustrates the equivalence of these notions in discrete case if A is nonsingular. I would suggest to keep the function controllability as it is now, but add a remark, that it concerns with “controllability from the origin (also called reachability)”.