JuliaControl / ModelPredictiveControl.jl

An open source model predictive control package for Julia.
https://juliacontrol.github.io/ModelPredictiveControl.jl/stable
MIT License
66 stars 0 forks source link

starting support of continuous `NonLinModel` (RK4 only for now) #38

Closed baggepinnen closed 6 months ago

baggepinnen commented 6 months ago

I'm opening the PR to allow commenting

franckgaga commented 6 months ago

If a solver is provided, is the dynamics automatically interpreted in continuous time then? Or in other words, the way the user communicates whether the dynamics is continuous or discrete time is by the presence of absence of the solver?

Yes exactly! If the user provides a solver, the dynamics are assumed continuous, else discrete. No solver is the default behavior to avoid breaking changes. But, since the package is still in v0.Y.Z, I'm not closed to the idea of introducing a breaking change by defaulting to continuous-time nonlinear model with e.g.: solver=RungeKutta(4). Nonlinear continuous-time model are way more common in practice (e.g. almost all first principle models)

baggepinnen commented 6 months ago

No solver is the default behavior to avoid breaking changes. But, since the package is still in v0.Y.Z

Keep in mind that as long as the major version is 0, every minor release (change of Y above) is considered a breaking release, so this package has already made 17 breaking releases which would have forced anyone depending on this package to update their dependency compat and make new releases.

franckgaga commented 6 months ago

No solver is the default behavior to avoid breaking changes. But, since the package is still in v0.Y.Z

Keep in mind that as long as the major version is 0, every minor release (change of Y above) is considered a breaking release, so this package has already made 17 breaking releases which would have forced anyone depending on this package to update their dependency compat and make new releases.

From https://semver.org/#spec-item-4, it seems that there is no specific rule for breaking releases in major version 0.

I think I will make a breaking change and default to continuous time model, with solver=RungeKutta(4). This is more common in practice and this is the behaviour of most MPC pakage incl. MATLAB toolbox.

baggepinnen commented 6 months ago

From https://semver.org/#spec-item-4, it seems that there is no specific rule for breaking releases in major version 0.

Julia isn't following semver proper, the julia version is detailed here https://pkgdocs.julialang.org/v1/compatibility/#compat-pre-1.0

franckgaga commented 6 months ago

Thanks for the info, I did not know that! I will follow this rule from now on.

I will register a new minor version soon with the breaking change above. I now use the default RK4 solver in the pendulum example of the manual.