You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/index.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ pkg> add ControlSystemsMTK
21
21
22
22
23
23
## From ControlSystems to ModelingToolkit
24
-
Simply calling `ODESystem(sys)` converts a `StateSpace` object from ControlSystems into the corresponding [`ModelingToolkitStandardLibrary.Blocks.StateSpace`](http://mtkstdlib.sciml.ai/dev/API/blocks/#ModelingToolkitStandardLibrary.Blocks.StateSpace). If `sys` is a [named statespace object](https://juliacontrol.github.io/RobustAndOptimalControl.jl/dev/#Named-systems), the names will be retained in the `ODESystem`.
24
+
Simply calling `ODESystem(sys)` converts a `StateSpace` object from ControlSystems into the corresponding [`ModelingToolkitStandardLibrary.Blocks.StateSpace`](http://mtkstdlib.sciml.ai/dev/API/blocks/#ModelingToolkitStandardLibrary.Blocks.StateSpace). If `sys` is a [named statespace object](https://juliacontrol.github.io/RobustAndOptimalControl.jl/dev/#Named-systems), the names of inputs and outputs will be retained in the `ODESystem` as connectors, that is, if `my_input` is an input variable in the named statespace object, `my_input` will be a connector of type `RealInput` in the resulting ODESystem. Names of state variables are currently ignored.
25
25
26
26
### Example:
27
27
@@ -55,6 +55,22 @@ julia> equations(P)
55
55
output₊u(t) ~ x[1](t)
56
56
```
57
57
58
+
To connect `P` to the input and output of `P`, use the connectors `P.input` and `P.output`. If the inputs or outputs are multivariable, there are _additional_ scalar connectors for each input/output variable respectively.
59
+
60
+
### Example with named signals
61
+
The following creates a named statespace system with named inputs `u = :torque` and outputs `y = [:motor_angle, :load_angle]`:
62
+
```@example CONNECT
63
+
using ControlSystemsMTK, ControlSystemsBase, ModelingToolkit, RobustAndOptimalControl
64
+
65
+
P = named_ss(DemoSystems.double_mass_model(outputs = [1,3]), u=:torque, y=[:motor_angle, :load_angle])
66
+
```
67
+
68
+
When we convert this system to an ODESystem, we get a system with connectors `P.torque` and `P.motor_angle`, in addition to the standard connectors `P.input` and `P.output`:
69
+
```@example CONNECT
70
+
@named P_ode = ODESystem(P)
71
+
```
72
+
Here, `P.torque` is equal to `P.input`, so you may choose to connect to either of them. However, since the output is multivariable, the connector `P.output` represents both outputs, while `P.motor_angle` and `P.load_angle` represent the individual scalar outputs.
73
+
58
74
59
75
## From ModelingToolkit to ControlSystems
60
76
An `ODESystem` can be converted to a named statespace object from [RobustAndOptimalControl.jl](https://github.com/JuliaControl/RobustAndOptimalControl.jl) by calling [`named_ss`](@ref)
0 commit comments