Skip to content

Commit 2d55525

Browse files
Merge pull request #382 from SciML/mtk-v10
BREAKING: v10 release
2 parents e3a049e + ab38818 commit 2d55525

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+434
-1025
lines changed

Project.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
1313
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1414

1515
[compat]
16+
ADTypes = "1"
1617
Aqua = "0.8"
1718
ChainRulesCore = "1.24"
1819
ControlSystemsBase = "1.4"
1920
DataFrames = "1.7"
2021
DataInterpolations = "6"
21-
ForwardDiff = "0.10"
2222
DiffEqBase = "6.152"
23+
ForwardDiff = "0.10"
2324
IfElse = "0.1"
2425
LinearAlgebra = "1.10"
25-
Optimization = "4"
26-
ModelingToolkit = "9.47"
26+
ModelingToolkit = "10"
2727
OrdinaryDiffEq = "6.87"
2828
OrdinaryDiffEqDefault = "1.1"
2929
PreallocationTools = "0.4.23"
@@ -35,13 +35,13 @@ Test = "1"
3535
julia = "1.10"
3636

3737
[extras]
38+
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
3839
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3940
ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e"
4041
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
4142
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
4243
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
4344
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
44-
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
4545
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
4646
OrdinaryDiffEqDefault = "50262376-6c5a-4cf5-baba-aaf4f84d72d7"
4747
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
@@ -50,4 +50,4 @@ SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
5050
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5151

5252
[targets]
53-
test = ["Aqua", "LinearAlgebra", "OrdinaryDiffEqDefault", "OrdinaryDiffEq", "Optimization", "SafeTestsets", "Test", "ControlSystemsBase", "DataFrames", "DataInterpolations", "SciMLStructures", "SymbolicIndexingInterface", "ForwardDiff"]
53+
test = ["ADTypes", "Aqua", "LinearAlgebra", "OrdinaryDiffEqDefault", "OrdinaryDiffEq", "SafeTestsets", "Test", "ControlSystemsBase", "DataFrames", "DataInterpolations", "SciMLStructures", "SymbolicIndexingInterface", "ForwardDiff"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ using ModelingToolkit: t_nounits as t
7171
end
7272
end
7373

74-
@mtkbuild sys = RC()
74+
@mtkcompile sys = RC()
7575
prob = ODEProblem(sys, Pair[], (0, 10.0))
7676
sol = solve(prob)
7777

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ DataFrames = "1.7"
1515
DataInterpolations = "6.4, 7, 8"
1616
Documenter = "1"
1717
IfElse = "0.1"
18-
ModelingToolkit = "9"
18+
ModelingToolkit = "10"
1919
OrdinaryDiffEq = "6.31"
2020
Plots = "1.36"

docs/src/API/linear_analysis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ using ModelingToolkitStandardLibrary.Blocks, ModelingToolkit
6161
t = ModelingToolkit.get_iv(P)
6262
eqs = [connect(P.output, :plant_output, C.input) # Connect with an automatically created analysis point called :plant_output
6363
connect(C.output, :plant_input, P.input)]
64-
sys = ODESystem(eqs, t, systems = [P, C], name = :feedback_system)
64+
sys = System(eqs, t, systems = [P, C], name = :feedback_system)
6565
6666
matrices_S = get_sensitivity(sys, :plant_input)[1] # Compute the matrices of a state-space representation of the (input)sensitivity function.
6767
matrices_T = get_comp_sensitivity(sys, :plant_input)[1]

docs/src/connectors/connections.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ end
102102
eqs = [connect(capacitor.p, resistor.p)
103103
connect(resistor.n, ground.g, capacitor.n)]
104104
105-
@named model = ODESystem(eqs, t; systems)
105+
@named model = System(eqs, t; systems)
106106
107-
sys = structural_simplify(model)
107+
sys = mtkcompile(model)
108108
109109
println.(equations(sys))
110110
nothing # hide
@@ -113,7 +113,7 @@ nothing # hide
113113
The solution shows what we would expect, a non-linear dissipation of voltage and related decrease in current flow…
114114

115115
```@example connections
116-
prob = ODEProblem(sys, [1.0], (0, 10.0), [])
116+
prob = ODEProblem(sys, [1.0], (0, 10.0))
117117
sol = solve(prob)
118118
119119
p1 = plot(sol, idxs = [capacitor.v])
@@ -144,9 +144,9 @@ end
144144
eqs = [connect(damping.flange_a, body.flange)
145145
connect(ground.flange, damping.flange_b)]
146146
147-
@named model = ODESystem(eqs, t; systems)
147+
@named model = System(eqs, t; systems)
148148
149-
sys = structural_simplify(model)
149+
sys = mtkcompile(model)
150150
151151
println.(full_equations(sys))
152152
nothing # hide
@@ -156,7 +156,7 @@ As expected, we have a similar solution…
156156

157157
```@example connections
158158
prob = ODEProblem(
159-
sys, [], (0, 10.0), []; initialization_eqs = [sys.body.s ~ 0, sys.body.v ~ 1])
159+
sys, [], (0, 10.0); initialization_eqs = [sys.body.s ~ 0, sys.body.v ~ 1])
160160
sol_v = solve(prob)
161161
162162
p1 = plot(sol_v, idxs = [body.v])
@@ -180,9 +180,9 @@ end
180180
eqs = [connect(damping.flange_a, body.flange)
181181
connect(ground.flange, damping.flange_b)]
182182
183-
@named model = ODESystem(eqs, t; systems)
183+
@named model = System(eqs, t; systems)
184184
185-
sys = structural_simplify(model)
185+
sys = mtkcompile(model)
186186
187187
println.(full_equations(sys))
188188
nothing # hide
@@ -191,7 +191,7 @@ nothing # hide
191191
As can be seen, we get exactly the same result. The only difference here is that we are solving an extra equation, which allows us to plot the body position as well.
192192

193193
```@example connections
194-
prob = ODEProblem(sys, [], (0, 10.0), [], fully_determined=true)
194+
prob = ODEProblem(sys, [], (0, 10.0), fully_determined=true)
195195
sol_p = solve(prob)
196196
197197
p1 = plot(sol_p, idxs = [body.v])
@@ -275,13 +275,13 @@ function simplify_and_solve(damping, spring, body, ground; initialization_eqs =
275275
eqs = [connect(spring.flange_a, body.flange, damping.flange_a)
276276
connect(spring.flange_b, damping.flange_b, ground.flange)]
277277
278-
@named model = ODESystem(eqs, t; systems = [ground, body, spring, damping])
278+
@named model = System(eqs, t; systems = [ground, body, spring, damping])
279279
280-
sys = structural_simplify(model)
280+
sys = mtkcompile(model)
281281
282282
println.(full_equations(sys))
283283
284-
prob = ODEProblem(sys, [], (0, 10.0), []; initialization_eqs, fully_determined=true)
284+
prob = ODEProblem(sys, [], (0, 10.0); initialization_eqs, fully_determined=true)
285285
sol = solve(prob; abstol = 1e-9, reltol = 1e-9)
286286
287287
return sol

docs/src/connectors/sign_convention.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Here we can see that a positive input force results in an increasing velocity.
8888
connect(mass.flange, force.flange)
8989
end
9090
end
91-
@mtkbuild sys = Model()
91+
@mtkcompile sys = Model()
9292
full_equations(sys)
9393
```
9494

@@ -128,7 +128,7 @@ Here we can see that a positive input current results in an increasing voltage.
128128
connect(capacitor.n, current.p, ground.g)
129129
end
130130
end
131-
@mtkbuild sys = Model()
131+
@mtkcompile sys = Model()
132132
full_equations(sys)
133133
```
134134

@@ -146,7 +146,7 @@ Reversing the pins gives the same result
146146
connect(capacitor.p, current.n, ground.g)
147147
end
148148
end
149-
@mtkbuild sys = Model()
149+
@mtkcompile sys = Model()
150150
full_equations(sys)
151151
```
152152

@@ -184,6 +184,6 @@ A positive input mass flow leads to an increasing pressure (in this case we get
184184
connect(fluid, flow.port)
185185
end
186186
end
187-
@mtkbuild sys = Model()
187+
@mtkcompile sys = Model()
188188
full_equations(sys) |> first
189189
```

docs/src/tutorials/custom_component.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ nothing # hide
109109

110110
## Simulating the Model
111111

112-
`@mtkbuild` builds a structurally simplified `ChaoticAttractor` model.
112+
`@mtkcompile` builds a structurally simplified `ChaoticAttractor` model.
113113
Since the initial voltage of the capacitors was already specified via `v` and the initial current of inductor via `i`, no initial condition is given and an empty pair is supplied.
114114

115115
```@example components
116-
@mtkbuild sys = ChaoticAttractor()
116+
@mtkcompile sys = ChaoticAttractor()
117117
prob = ODEProblem(sys, Pair[], (0, 5e4))
118118
sol = solve(prob; saveat = 1.0)
119119

docs/src/tutorials/dc_motor_pi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Now the model can be simulated. Typical rotational mechanical systems are descri
7676
so that it can be represented as a system of `ODEs` (ordinary differential equations).
7777

7878
```@example dc_motor_pi
79-
sys = structural_simplify(model)
79+
sys = mtkcompile(model)
8080
prob = ODEProblem(sys, [sys.L1.i => 0.0], (0, 6.0))
8181
sol = solve(prob)
8282

docs/src/tutorials/input_component.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function MassSpringDamper(; name)
4343
D(x) ~ dx
4444
D(dx) ~ ddx]
4545
46-
ODESystem(eqs, t; name, systems = [input])
46+
System(eqs, t; name, systems = [input])
4747
end
4848
4949
function MassSpringDamperSystem(data, time; name)
@@ -54,7 +54,7 @@ function MassSpringDamperSystem(data, time; name)
5454
eqs = [connect(clk.output, src.input)
5555
connect(src.output, model.input)]
5656
57-
ODESystem(eqs, t, [], []; name, systems = [src, clk, model])
57+
System(eqs, t, [], []; name, systems = [src, clk, model])
5858
end
5959
6060
function generate_data()
@@ -68,7 +68,7 @@ end
6868
df = generate_data() # example data
6969
7070
@named system = MassSpringDamperSystem(df.data, df.time)
71-
sys = structural_simplify(system)
71+
sys = mtkcompile(system)
7272
prob = ODEProblem(sys, [], (0, df.time[end]))
7373
sol = solve(prob)
7474
plot(sol)
@@ -93,7 +93,7 @@ my_interpolation = LinearInterpolation(df.data, df.time)
9393
connect(src.output, model.input)
9494
end
9595
end;
96-
@mtkbuild sys = MassSpringDamperSystem2()
96+
@mtkcompile sys = MassSpringDamperSystem2()
9797
9898
prob = ODEProblem(sys, [], (0, df.time[end]))
9999
sol = solve(prob, Tsit5())
@@ -134,7 +134,7 @@ function MassSpringDamper(; name)
134134
D(x) ~ dx
135135
D(dx) ~ ddx]
136136
137-
ODESystem(eqs, t, vars, pars; name, systems = [input])
137+
System(eqs, t, vars, pars; name, systems = [input])
138138
end
139139
140140
function MassSpringDamperSystem(data, time; name)
@@ -145,7 +145,7 @@ function MassSpringDamperSystem(data, time; name)
145145
eqs = [connect(model.input, src.output)
146146
connect(clk.output, src.input)]
147147
148-
ODESystem(eqs, t; name, systems = [src, clk, model])
148+
System(eqs, t; name, systems = [src, clk, model])
149149
end
150150
151151
function generate_data()
@@ -159,7 +159,7 @@ end
159159
df = generate_data() # example data
160160
161161
@named system = MassSpringDamperSystem(df.data, df.time)
162-
sys = structural_simplify(system)
162+
sys = mtkcompile(system)
163163
prob = ODEProblem(sys, [], (0, df.time[end]))
164164
sol = solve(prob)
165165
plot(sol)
@@ -213,11 +213,11 @@ function System(; name)
213213
D(x) ~ dx
214214
D(dx) ~ ddx]
215215
216-
ODESystem(eqs, t, vars, pars; name)
216+
System(eqs, t, vars, pars; name)
217217
end
218218
219219
@named system = System()
220-
sys = structural_simplify(system)
220+
sys = mtkcompile(system)
221221
prob = ODEProblem(sys, [], (0, time[end]))
222222
223223
rdata[] = data1
@@ -240,7 +240,7 @@ Additional code could be added to resolve this issue, for example by using a `Re
240240

241241
## `SampledData` Component
242242

243-
To resolve the issues presented above, the `ModelingToolkitStandardLibrary.Blocks.SampledData` component can be used which allows for a resusable `ODESystem` and self contained data which ensures a solution which remains valid for it's lifetime. Now it's possible to also parallelize the call to `solve()`.
243+
To resolve the issues presented above, the `ModelingToolkitStandardLibrary.Blocks.SampledData` component can be used which allows for a resusable `System` and self contained data which ensures a solution which remains valid for it's lifetime. Now it's possible to also parallelize the call to `solve()`.
244244

245245
```julia
246246
using ModelingToolkit
@@ -259,11 +259,11 @@ function System(; name)
259259
D(x) ~ dx
260260
D(dx) ~ ddx]
261261

262-
ODESystem(eqs, t, vars, pars; systems = [src], name)
262+
System(eqs, t, vars, pars; systems = [src], name)
263263
end
264264

265265
@named system = System()
266-
sys = structural_simplify(system, split = false)
266+
sys = mtkcompile(system, split = false)
267267
s = complete(system)
268268

269269
dt = 4e-4

docs/src/tutorials/rc_circuit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using ModelingToolkit: t_nounits as t
3333
end
3434
end
3535
36-
@mtkbuild sys = RC()
36+
@mtkcompile sys = RC()
3737
prob = ODEProblem(sys, Pair[], (0, 10.0))
3838
sol = solve(prob)
3939

0 commit comments

Comments
 (0)