-
Couldn't load subscription status.
- Fork 3
added: simple TrapezoidalCollocation() transcription method
#234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #234 +/- ##
==========================================
- Coverage 98.68% 97.66% -1.02%
==========================================
Files 26 26
Lines 4324 4375 +51
==========================================
+ Hits 4267 4273 +6
- Misses 57 102 +45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
TrapezoidalMethod() collocationTrapezoidalCollocation() collocation
TrapezoidalCollocation() collocationTrapezoidalCollocation() transcription method
|
I would not bother with the LinModel, ZoH integration for linear systems using the matrix exponential is exact, stiff or not.
This is missing the capability of implicit methods to handle DAEs, explicit methods like RK4 will not handle those. Even if the implementation right now does not support algebraic equations, it should be possible to support with minor effort. Modeling tools like MTK and modelica-based tools often produces DAEs. Since |
|
Good point! The current design should be non-blocking for DAEs. Users can creates two
BTW for my own understanding, about 1. , if we call a stepper that supports DAE, is it sufficient to directly use the nonlinear model in the classic versions of the UKF or EKF ? |
It depends a bit on the nature of the algebraic equations. A UKF can readily use a DAE stepper to propagate the sigma points, but computing the mean of the propagated points may give you a mean point that does not satisfy the algebraic equations. There are multiple different ways in which this can be handled, the simplest of which is to somehow project the mean onto the manifold implied by the algebraic equations. Similarily, both UKF and EKF may get you a point that doesn't satisfy the equations after the Kalman update |
I almost finished the
TapezoidalCollocation()to handle moderately stiff system. Just need to add some tests and possibly some new benchmarks. Compared to aMultipleShootingtranscription on the pendulum example, benchmarks are practically identical as expected, but the closed-loop response are marginally differents. This is also expected since theMultipleShootinguses aRungeKutta(4)to discretize the dynamics, whileTrapezoidalCollocationuses a implicit trapezoidal rule.TapezoidalCollocationonly supportNonLinModel, sinceLinModelobjects currently include no information about the original continuous-time dynamics, when it's constructed from a constinuous LTI system. I'm not sure it is worth the effort refactoringLinModelobjects to support this transcription method, although linear stiff systems do exists (i.e. large gap in the smallest and largest eigenvalues). For such corner cases, there is always the option to construct aNonLinModelwith the continuous state-space matrices i.e.: withf(x,u,d,_) = A*x + Bu*u + Bd*dandsolver != nothing.model.solver, which isRungeKutta(4)by default. For UKF or EKF, the state update function is only called a couple of times per time step, so it's not super expensive to use fixed-step solver and increase super-sampling if the system is stiff. And I don't think adding a new dependency with a root solver is worth the trouble. Neither callingIpoptas a root solver. The implicit trapezoidal method is truly interesting inside an optimization problem, otherwise just use a fixed-step solver with super-sampling if necessary.TrapezoidalCollocationand the stochastic part is transcribed withMultipleShooting.Any comment/concern on these aspects @baggepinnen ?