Skip to content

Commit e6188ea

Browse files
committed
update other files
1 parent aba3263 commit e6188ea

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

docs/src/batch_linearization.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ eqs = [D(x) ~ v
2525
y.u ~ x]
2626
2727
28-
@named duffing = ODESystem(eqs, t, systems=[y, u])
28+
@named duffing = System(eqs, t, systems=[y, u])
2929
```
3030

3131
## Batch linearization
@@ -111,13 +111,13 @@ plot(layout=2)
111111
112112
# Simulate each individual controller
113113
for C in Cs
114-
@named Ci = ODESystem(C)
114+
@named Ci = System(C)
115115
eqs = [
116116
closed_loop_eqs
117117
connect(fb.output, Ci.input)
118118
connect(Ci.output, duffing.u)
119119
]
120-
@named closed_loop = ODESystem(eqs, t, systems=[duffing, Ci, fb, ref, F])
120+
@named closed_loop = System(eqs, t, systems=[duffing, Ci, fb, ref, F])
121121
prob = ODEProblem(structural_simplify(closed_loop), [F.xd => 0], (0.0, 8.0))
122122
sol = solve(prob, Rodas5P(), abstol=1e-8, reltol=1e-8)
123123
plot!(sol, idxs=[duffing.y.u, duffing.u.u], layout=2, lab="")
@@ -131,7 +131,7 @@ eqs = [
131131
connect(Cgs.output, duffing.u)
132132
connect(duffing.y, Cgs.scheduling_input) # Don't forget to connect the scheduling variable!
133133
]
134-
@named closed_loop = ODESystem(eqs, t, systems=[duffing, Cgs, fb, ref, F])
134+
@named closed_loop = System(eqs, t, systems=[duffing, Cgs, fb, ref, F])
135135
prob = ODEProblem(structural_simplify(closed_loop), [F.xd => 0], (0.0, 8.0))
136136
sol = solve(prob, Rodas5P(), abstol=1e-8, reltol=1e-8, initializealg=SciMLBase.NoInit())
137137
plot!(sol, idxs=[duffing.y.u, duffing.u.u], l=(2, :red), lab="Gain scheduled")

docs/src/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pkg> add ControlSystemsMTK
2121

2222

2323
## 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 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.
24+
Simply calling `System(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 `System` 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 System. Names of state variables are currently ignored.
2525

2626
### Example:
2727

@@ -41,7 +41,7 @@ D =
4141

4242
Continuous-time state-space model
4343

44-
julia> @named P = ODESystem(P0)
44+
julia> @named P = System(P0)
4545
Model P with 2 equations
4646
States (3):
4747
x[1](t) [defaults to 0.0]
@@ -65,15 +65,15 @@ using ControlSystemsMTK, ControlSystemsBase, ModelingToolkit, RobustAndOptimalCo
6565
P = named_ss(DemoSystems.double_mass_model(outputs = [1,3]), u=:torque, y=[:motor_angle, :load_angle])
6666
```
6767

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`:
68+
When we convert this system to a `System`, we get a system with connectors `P.torque` and `P.motor_angle`, in addition to the standard connectors `P.input` and `P.output`:
6969
```@example CONNECT
70-
@named P_ode = ODESystem(P)
70+
@named P_ode = System(P)
7171
```
7272
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.
7373

7474

7575
## From ModelingToolkit to ControlSystems
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)
76+
A `System` can be converted to a named statespace object from [RobustAndOptimalControl.jl](https://github.com/JuliaControl/RobustAndOptimalControl.jl) by calling [`named_ss`](@ref)
7777

7878
```julia
7979
named_ss(ode_sys, inputs, outputs; op)
@@ -167,9 +167,9 @@ function SystemModel(u=nothing; name=:model)
167167
]
168168
if u !== nothing
169169
push!(eqs, connect(u.output, :u, torque.tau))
170-
return @named model = ODESystem(eqs, t; systems = [sens, torque, inertia1, inertia2, spring, damper, u])
170+
return @named model = System(eqs, t; systems = [sens, torque, inertia1, inertia2, spring, damper, u])
171171
end
172-
ODESystem(eqs, t; systems = [sens, torque, inertia1, inertia2, spring, damper], name)
172+
System(eqs, t; systems = [sens, torque, inertia1, inertia2, spring, damper], name)
173173
end
174174
175175
model = SystemModel() |> complete

src/ControlSystemsMTK.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using RobustAndOptimalControl: NamedStateSpace
33
#=
44
Ideas: All connections handled by ModelingToolkit.
55
Names:
6-
- handled either by named system, or directly in constructor to ODESystem.
6+
- handled either by named system, or directly in constructor to System.
77
Functions:
88
- Give me linear system from [u1, u3] to [qm, a]
99
If the linearization of a full system produces a named system, one could implement getindex for vectors of names and obtain the desired transfer functions.
@@ -20,7 +20,7 @@ using ModelingToolkit, ControlSystemsBase
2020
using ControlSystemsBase: ssdata, AbstractStateSpace, Continuous, nstates, noutputs, ninputs
2121
# using ControlSystemIdentification
2222
using RobustAndOptimalControl, MonteCarloMeasurements
23-
import ModelingToolkit: ODESystem, FnType, Symbolics
23+
import ModelingToolkit: System, FnType, Symbolics
2424
using ModelingToolkit: unknowns, observed, isdifferential
2525
using Symbolics
2626
using Symbolics: jacobian, solve_for
@@ -29,7 +29,7 @@ using UnPack
2929

3030
# using SymbolicControlSystems
3131

32-
export feedback, ODESystem, unknowns, observed, named_ss
32+
export feedback, System, unknowns, observed, named_ss
3333
export batch_ss, trajectory_ss, GainScheduledStateSpace
3434
export build_quadratic_cost_matrix
3535

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ using ControlSystemsMTK
22
using Test
33

44
@testset "ControlSystemsMTK.jl" begin
5-
@testset "ODESystem" begin
6-
@info "Testing ODESystem"
5+
@testset "System" begin
6+
@info "Testing System"
77
include("test_ODESystem.jl")
88
end
99

test/test_batchlin.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ eqs = [D(x) ~ v
1919
y.u ~ x]
2020

2121

22-
@named duffing = ODESystem(eqs, t, systems=[y, u])
22+
@named duffing = System(eqs, t, systems=[y, u])
2323

2424
bounds = getbounds(duffing, unknowns(duffing))
2525
sample_within_bounds((l, u)) = (u - l) * rand() + l
@@ -39,7 +39,7 @@ Ps, ssys = batch_ss(duffing, inputs, outputs , ops)
3939

4040
using DataInterpolations
4141
@named Cgs = GainScheduledStateSpace(Ps, xs, interpolator=LinearInterpolation)
42-
@test Cgs isa ODESystem
42+
@test Cgs isa System
4343
# This is tested better in the docs
4444

4545
## C-code generation
@@ -53,7 +53,7 @@ import ModelingToolkitStandardLibrary.Blocks
5353
@named fb = Blocks.Add(k2=-1)
5454
@named ref = Blocks.Square(frequency=1/6, amplitude=0.5, offset=0.5, start_time=1)
5555
@named F = Blocks.SecondOrder(w=10, d=0.7)
56-
@named C = ODESystem(pid(1,1,0; state_space=true, Tf=0.01))
56+
@named C = System(pid(1,1,0; state_space=true, Tf=0.01))
5757

5858

5959
closed_loop_eqs = [
@@ -64,7 +64,7 @@ closed_loop_eqs = [
6464
ModelingToolkit.connect(C.output, duffing.u)
6565
]
6666

67-
@named closed_loop = ODESystem(closed_loop_eqs, t, systems=[duffing, C, fb, ref, F])
67+
@named closed_loop = System(closed_loop_eqs, t, systems=[duffing, C, fb, ref, F])
6868

6969
ssys = structural_simplify(closed_loop)
7070
prob = ODEProblem(ssys, [F.xd => 0], (0.0, 8.0))

0 commit comments

Comments
 (0)