Skip to content

Commit 097276b

Browse files
try DAEproblem
1 parent 0a3d9a5 commit 097276b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

benchmarks/DAE/LinearDAE.jmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ rlc_eqs = E_rlc * Dx ~ A_rlc * x + B_rlc .* u(t)
7979
# Problems using constant voltage input
8080
rlc_prob = ODEProblem(rlc_sys, [i_R => 0.0, v_C => 0.0], (0.0, 1e-3))
8181
rlc_static_prob = ODEProblem{false}(rlc_sys, SA[i_R => 0.0, v_C => 0.0], (0.0, 1e-3))
82+
rlc_dae_prob = DAEProblem(rlc_sys, [i_R => 0.0, v_C => 0.0, D(i_R) => 0.0, D(i_L) => 0.0], [], (0.0, 1e-3))
8283
```
8384

8485
## Index-2 DAE: Two Interconnected Rotating Masses
@@ -123,6 +124,7 @@ masses_eqs = E_masses * Dx ~ A_masses * x + B_masses * u(t)
123124
# Problems using torque inputs
124125
masses_prob = ODEProblem(masses_sys, [], (0.0, 1.0))
125126
masses_static_prob = ODEProblem{false}(masses_sys, SA[], (0.0, 1.0))
127+
masses_dae_prob = DAEProblem(masses_sys, [D(θ2) => 0.0, D(ω1) => 0.0], [], (0.0, 1.0))
126128
```
127129

128130
## Index-2 DAE: RL Network
@@ -163,6 +165,7 @@ rl_eqs = E_rl * Dx ~ A_rl * x + B_rl .* u(t)
163165
# Problems using current source input
164166
rl_prob = ODEProblem(rl_sys, [v_L => 1.0], (0.0, 1.0))
165167
rl_static_prob = ODEProblem{false}(rl_sys, SA[v_L => 1.0], (0.0, 1.0))
168+
rl_dae_prob = DAEProblem(rl_sys, [v_L => 1.0, D(v_L) => 0.0, D(i1) => 0.0], [], (0.0, 1.0))
166169
```
167170

168171
## Index-3 DAE: Cart Pendulum
@@ -212,6 +215,7 @@ cart_eqs = E_cart * Dx ~ A_cart * x + B_cart .* u(t)
212215
# Problems using force input
213216
cart_prob = ODEProblem(cart_sys, [dy_cart => 0.0, y_cart => 0.0], (0.0, 1.0))
214217
cart_static_prob = ODEProblem{false}(cart_sys, SA[dy_cart => 0.0, y_cart => 0.0], (0.0, 1.0))
218+
cart_dae_prob = DAEProblem(cart_sys, [dy_cart => 0.0, y_cart => 0.0], [], (0.0, 1.0))
215219
```
216220

217221
## Index-3 DAE: Electric Generator
@@ -254,6 +258,7 @@ gen_eqs = E_gen * Dx ~ A_gen * x + B_gen .* u(t)
254258
# Problems using torque input
255259
gen_prob = ODEProblem(gen_sys, [ω_gen => 1.0], (0.0, 1.0))
256260
gen_static_prob = ODEProblem{false}(gen_sys, SA[ω_gen => 1.0], (0.0, 1.0))
261+
gen_dae_prob = DAEProblem(gen_sys, [ω_gen => 1.0, D(ω_gen) => 0.0], [ω_gen => 0.0], (0.0, 1.0))
257262
```
258263

259264
## Index-3 DAE: Damped Mass-Spring System
@@ -326,6 +331,7 @@ spring_static_prob = ODEProblem{false}(spring_sys, SA[λ_spring => 0.0, v1_sprin
326331
# Generate reference solutions for all systems using robust methods
327332
rlc_ref = solve(rlc_prob, Rodas5P(), abstol=abstol_ref, reltol=reltol_ref)
328333
rlc_static_ref = solve(rlc_static_prob, Rodas5P(), abstol=abstol_ref, reltol=reltol_ref)
334+
rlc_dae_ref = solve(rlc_dae_prob, IDA(), abstol=abstol_ref, reltol=reltol_ref)
329335

330336
masses_ref = solve(masses_prob, Rodas5P(), abstol=abstol_ref, reltol=reltol_ref)
331337
masses_static_ref = solve(masses_static_prob, Rodas5P(), abstol=abstol_ref, reltol=reltol_ref)

0 commit comments

Comments
 (0)