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/tutorials/input_component.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,8 +157,15 @@ plot(sol2)
157
157
The below code shows how to include data using a `Ref` and registered `get_sampled_data` function. This example uses a very basic function which requires non-adaptive solving and sampled data. As can be seen, the data can easily be set and changed before solving.
158
158
159
159
```@example custom_component_external_data
160
+
using ModelingToolkit
161
+
using ModelingToolkit: t_nounits as t, D_nounits as D
162
+
using ModelingToolkitStandardLibrary.Blocks
163
+
using OrdinaryDiffEq
164
+
160
165
const rdata = Ref{Vector{Float64}}()
161
166
167
+
dt = 4e-4
168
+
time = 0:dt:0.1
162
169
# Data Sets
163
170
data1 = sin.(2 * pi * time * 100)
164
171
data2 = cos.(2 * pi * time * 50)
@@ -211,6 +218,11 @@ Additional code could be added to resolve this issue, for example by using a `Re
211
218
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()`.
212
219
213
220
```@example sampled_data_component
221
+
using ModelingToolkit
222
+
using ModelingToolkit: t_nounits as t, D_nounits as D
0 commit comments