Skip to content

Commit 95c24d8

Browse files
committed
fix typos & avoid running SampledData for now
1 parent 2ee5ecd commit 95c24d8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/src/tutorials/input_component.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function MassSpringDamper(; name)
4444
D(x) ~ dx
4545
D(dx) ~ ddx]
4646
47-
ODESystem(eqs, t, [], []; name, systems = [input])
47+
ODESystem(eqs, t; name, systems = [input])
4848
end
4949
5050
function MassSpringDamperSystem(data, time; name)
@@ -122,7 +122,7 @@ function MassSpringDamperSystem(data, time; name)
122122
connect(src.input, clk.output)
123123
]
124124
125-
ODESystem(eqs, t, [], []; name, systems = [src, clk, model])
125+
ODESystem(eqs, t; name, systems = [src, clk, model])
126126
end
127127
128128
function generate_data()
@@ -217,7 +217,7 @@ Additional code could be added to resolve this issue, for example by using a `Re
217217

218218
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()`.
219219

220-
```@example sampled_data_component
220+
```julia
221221
using ModelingToolkit
222222
using ModelingToolkit: t_nounits as t, D_nounits as D
223223
using ModelingToolkitStandardLibrary.Blocks
@@ -246,14 +246,14 @@ time = 0:dt:0.1
246246
data1 = sin.(2 * pi * time * 100)
247247
data2 = cos.(2 * pi * time * 50)
248248

249-
prob = ODEProblem(sys, [], (0, time[end]); tofloat = false, use_union=true)
249+
prob = ODEProblem(sys, [], (0, time[end]); split=false, tofloat = false, use_union=true)
250250
defs = ModelingToolkit.defaults(sys)
251251

252252
function get_prob(data)
253253
defs[s.src.buffer] = Parameter(data, dt)
254254
# ensure p is a uniform type of Vector{Parameter{Float64}} (converting from Vector{Any})
255255
p = Parameter.(ModelingToolkit.varmap_to_vars(defs, parameters(sys); tofloat = false))
256-
remake(prob; p)
256+
remake(prob; p, build_initializeprob=false)
257257
end
258258

259259
prob1 = get_prob(data1)

0 commit comments

Comments
 (0)