|
1 | 1 | module MTKCasADiDynamicOptExt |
2 | 2 | using ModelingToolkit |
3 | 3 | using CasADi |
4 | | -using DiffEqDevTools, DiffEqBase |
| 4 | +using DiffEqBase |
5 | 5 | using DataInterpolations |
6 | 6 | using UnPack |
7 | | -const MTK = MOdelingToolkit |
| 7 | +const MTK = ModelingToolkit |
8 | 8 |
|
9 | 9 | struct CasADiDynamicOptProblem{uType, tType, isinplace, P, F, K} <: |
10 | 10 | AbstractDynamicOptProblem{uType, tType, isinplace} |
@@ -221,17 +221,22 @@ function add_solve_constraints!(prob, tableau; is_free_t) |
221 | 221 | end |
222 | 222 | end |
223 | 223 |
|
224 | | -is_explicit(tableau) = tableau isa DiffEqDevTools.ExplicitRKTableau |
225 | 224 |
|
226 | 225 | """ |
227 | 226 | solve(prob::CasADiDynamicOptProblem, casadi_solver, ode_solver; plugin_options, solver_options) |
228 | 227 |
|
229 | 228 | `plugin_options` and `solver_options` get propagated to the Opti object in CasADi. |
230 | 229 | """ |
231 | | -function DiffEqBase.solve(prob::CasADiDynamicOptProblem, solver::Union{String, Symbol}, ode_solver::Union{String, Symbol}; plugin_options::Dict = Dict(), solver_options::Dict = Dict(), silent = false) |
| 230 | +function DiffEqBase.solve(prob::CasADiDynamicOptProblem, solver::Union{String, Symbol}, ode_solver::Symbol = :Default; plugin_options::Dict = Dict(), solver_options::Dict = Dict(), silent = false) |
232 | 231 | model = prob.model |
233 | 232 | opti = model.opti |
234 | 233 |
|
| 234 | + if ode_solver == :Default |
| 235 | + tableau = MTK.constructDefault() |
| 236 | + else |
| 237 | + tableau_getter = Symbol(:construct, ode_solver) |
| 238 | + tableau = @eval Main.tableau_getter() |
| 239 | + end |
235 | 240 | solver!(opti, solver, plugin_options, solver_options) |
236 | 241 | add_casadi_solve_constraints!(prob, tableau) |
237 | 242 | solver!(cmodel, "$solver", plugin_options, solver_options) |
|
0 commit comments