Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add method balance_statespace(::NamedStateSpace) #91

Merged
merged 2 commits into from
May 16, 2023
Merged

Conversation

baggepinnen
Copy link
Member

No description provided.

@B-LIE
Copy link

B-LIE commented May 15, 2023

OK -- should I use RobustAndOptimalControl.jl instead of ControlSystems.jl? Will RobustAndOptimalControl.jl automatically include the entire ControlSystems.jl package?

@baggepinnen
Copy link
Member Author

You only need to import/using the package that owns the function you intend to call. In the case of balance_statespace, the function name is owned by ControlSystemsBase and this is thus the package you need to import to call it.

julia> parentmodule(balance_statespace)
ControlSystemsBase

RobustAndOptimalControl owns the type NamedStateSpace,

julia> parentmodule(NamedStateSpace)
RobustAndOptimalControl

so the implementation of balance_statespace that operates on a named system resides here, but this package does not export the name balance_statespace.

No packages in the JuliaControl org reexport names of any other package, except for a small number of special cases.

@B-LIE
Copy link

B-LIE commented May 15, 2023

Hm. Still doesn't work. Here is my set-up:

> using Pkg
> Pkg.status()

Status `C:\Users\Bernt\.julia\environments\v1.9\Project.toml`
  [a6e380b2] ControlSystems v1.7.2
  [aaaaaaaa] ControlSystemsBase v1.4.4
  [687d7614] ControlSystemsMTK v0.1.12
  [0c46a032] DifferentialEquations v7.7.0
  [31c24e10] Distributions v0.25.91
  [b964fa9f] LaTeXStrings v1.3.0
  [961ee093] ModelingToolkit v8.55.1
  [91a5bcdd] Plots v1.38.11
  [21fd56a4] RobustAndOptimalControl v0.4.24

I have the original "named_ss" linear model linsys, and then I have created an un-named version by ss(linsys.A, linsys.B, linsys.C, linsys.C).

Here are the responses I get when I do balance_statespace:

> balance_statespace(linsys)

MethodError: no method matching NamedStateSpace(::Matrix{Float64}, ::Matrix{Float64}, ::Matrix{Float64}, ::Matrix{Float64}, ::String)

Closest candidates are:
  NamedStateSpace(::Any, ::Any, ::Any, ::Any, !Matched::Number, !Matched::Any, !Matched::Any, !Matched::Any)
   @ RobustAndOptimalControl [C:\Users\Bernt\.julia\packages\RobustAndOptimalControl\tONYG\src\named_systems2.jl:48]
...

If I instead do the same for the un-named version, I get:

> balance_statespace(linsys_unm)

(StateSpace{ControlSystemsBase.Continuous, Float64}
A = 
 -6.537773175952662    0.0                  0.0                    0.0                 -1.32773257545959        0.0
  0.0                 -6.537773175952662    0.0                    0.0                  0.0                    -1.32773257545959
  1.5023204682
...

@baggepinnen
Copy link
Member Author

You are commenting on the pull request that introduces the balance_statespace(::NamedStateSpace) method and this PR is not yet merged, so it's expected that it will fail.

@B-LIE
Copy link

B-LIE commented May 15, 2023

Ah.

@baggepinnen baggepinnen merged commit 381c2a2 into master May 16, 2023
@baggepinnen baggepinnen deleted the balance_named branch May 16, 2023 05:31
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.

2 participants