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/examples/pendulum.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ To start, we load the required packages
5
5
```@example pendulum
6
6
using ModelingToolkit
7
7
using Multibody, JuliaSimCompiler
8
-
using OrdinaryDiffEq # Contains the ODE solver we will use
8
+
using OrdinaryDiffEqRosenbrock # Contains the ODE solver we will use
9
9
using Plots
10
10
```
11
11
We then access the world frame and time variable from the Multibody module
@@ -57,7 +57,7 @@ This results in a simplified model with the minimum required variables and equat
57
57
multibody
58
58
```
59
59
60
-
We are now ready to create an `ODEProblem` and simulate it. We use the `Rodas4` solver from OrdinaryDiffEq.jl, and pass a dictionary for the initial conditions. We specify only initial condition for some variables, for those variables where no initial condition is specified, the default initial condition defined the model will be used.
60
+
We are now ready to create an `ODEProblem` and simulate it. We use the `Rodas4` solver from OrdinaryDiffEqRosenbrock.jl, and pass a dictionary for the initial conditions. We specify only initial condition for some variables, for those variables where no initial condition is specified, the default initial condition defined the model will be used.
61
61
```@example pendulum
62
62
D = Differential(t)
63
63
defs = Dict() # We may specify the initial condition here
@@ -187,7 +187,7 @@ The systems we have modeled so far have all been _planar_ mechanisms. We now ext
187
187
This pendulum, sometimes referred to as a _rotary pendulum_, has two joints, one in the "shoulder", which is typically configured to rotate around the gravitational axis, and one in the "elbow", which is typically configured to rotate around the axis of the upper arm. The upper arm is attached to the shoulder joint, and the lower arm is attached to the elbow joint. The tip of the pendulum is attached to the lower arm.
188
188
189
189
```@example pendulum
190
-
using ModelingToolkit, Multibody, JuliaSimCompiler, OrdinaryDiffEq, Plots
190
+
using ModelingToolkit, Multibody, JuliaSimCompiler, OrdinaryDiffEqRosenbrock, Plots
191
191
import ModelingToolkitStandardLibrary.Mechanical.Rotational.Damper as RDamper
192
192
import Multibody.Rotations
193
193
@@ -326,6 +326,7 @@ We will continue the pendulum theme and design an inverted pendulum on cart. The
326
326
We start by putting the model together and control it in open loop using a simple periodic input signal:
Copy file name to clipboardExpand all lines: docs/src/examples/quad.md
+77-1Lines changed: 77 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ using ModelingToolkitStandardLibrary.Blocks
13
13
using LinearAlgebra
14
14
using Plots
15
15
using JuliaSimCompiler
16
-
using OrdinaryDiffEq
16
+
using OrdinaryDiffEqBDF
17
17
using Test
18
18
t = Multibody.t
19
19
D = Differential(t)
@@ -336,3 +336,79 @@ nothing
336
336
While gain and phase margins appear to be reasonable, we have a large high-frequency gain in the transfer functions from measurement noise to control signal, ``C(s)S(s)``. For a rotor craft where the control signal manipulates the current through motor windings, this may lead to excessive heat generation in the motors if the sensor measurements are noisy.
337
337
338
338
The diskmargin at the plant output is small, luckily, the gain variation appears at the plant input where the diskmargin is significantly larger. The diskmargins are visualized in the figure titled "Stable region for combined gain and phase variation". See [Diskmargin example](https://juliacontrol.github.io/RobustAndOptimalControl.jl/dev/#Diskmargin-example) to learn more about diskmargins.
339
+
340
+
```@example QUAD
341
+
using LowLevelParticleFilters, SeeToDee, StaticArrays
342
+
343
+
Ts = 0.02
344
+
tv = range(0, 7, step=Ts)
345
+
Y = [SVector(i...) .+ 0.01 .* randn.() for i in sol(tv, idxs=outputs)]
346
+
Y0 = [SVector(i...) for i in sol(tv, idxs=outputs)]
347
+
U = [SVector(i...) .+ 0.2 .* randn.() for i in sol(tv, idxs=inputs)]
348
+
X = Matrix(sol(tv, idxs=x_sym))
349
+
##
350
+
351
+
state_parameters = [quad.body.m]
352
+
353
+
function dyn_with_state_parameters(mmodel, inputs, state_parameters)
0 commit comments