-
The function
states
is renamed tounknowns
. In a similar vein:unknown_states
is nowsolved_unknowns
.get_states
isget_unknowns
.get_unknown_states
is nowget_solved_unknowns
.
-
The default backend for using units in models is now
DynamicQuantities.jl
instead ofUnitful.jl
. -
ModelingToolkit.jl now exports common definitions of
t
(time independent variable) andD
(the first derivative with respect tot
). Any models made using ModelingToolkit.jl should leverage these common definitions. There are three variants:t
andD
use DynamicQuantities.jl units. This is the default for standard library components.t_unitful
andD_unitful
use Unitful.jl units.t_nounits
andD_nounits
are unitless.
-
ODAEProblem
is deprecated in favor ofODEProblem
. -
Specifying the independent variable for an
ODESystem
is now mandatory. TheODESystem(eqs)
constructor is removed. UseODESystem(eqs,t)
instead. -
Systems must be marked as
complete
before creating*Function
/*FunctionExpr
/*Problem
/*ProblemExpr
. Typically this involved using@mtkbuild
to create the system or callingstructural_simplify
on an existing system. -
All systems will perform parameter splitting by default. Problems created using ModelingToolkit.jl systems will have a custom struct instead of a
Vector
of parameters. The internals of this type are undocumented and subject to change without notice or a breaking release. Parameter values can be queried, updated or manipulated using SciMLStructures.jl or SymbolicIndexingInterface.jl. This also requires that the symbolic type of a parameter match its assigned value. For example,@parameters p
will always use aFloat64
value forp
. To useInt
instead, use@parameters p::Int
. Array-valued parameters must be array symbolics;@parameters p = [1.0, 2.0]
is now invalid and must be changed to@parameters p[1:2] = [1.0, 2.0]
. The index of a parameter in the system is also not guaranteed to be anInt
, and will instead be a custom undocumented type. Parameters that have a default value depending on other parameters are now treated as dependent parameters. Their value cannot be modified directly. Whenever a parameter value is changed, dependent parameter values are recalculated. For example, if@parameters p1 p2 = 3p1
thenp2
can not be modified directly. Ifp1
is changed, thenp2
will be updated accordingly. To restore the old behavior:- Pass the
split = false
keyword tostructural_simplify
. E.g.ss = structural_simplify(sys; split = false)
. - Pass
split = false
to@mtkbuild
. E.g.@mtkbuild sys = ODESystem(...) split = false
.
- Pass the
-
Discrete-time system using
Difference
are unsupported. Instead, use the newClock
-based syntax. -
Automatic scalarization has been removed, meaning that vector variables need to be treated with proper vector equations. For example,
[p[1] => 1.0, p[2] => 2.0]
is no longer allowed in default equations, use[p => [1.0, 2.0]]
instead. Also, array equations like for@variables u[1:2]
haveD(u) ~ A*u
as an array equation. If the scalarized version is desired, usescalarize(u)
. -
Parameter dependencies are now supported. They can be specified using the syntax
(single_parameter => expression_involving_other_parameters)
and aVector
of these can be passed to theparameter_dependencies
keyword argument ofODESystem
,SDESystem
andJumpSystem
. The dependent parameters are updated whenever other parameters are modified, e.g. in callbacks. -
Support for
IfElse.jl
has been dropped.Base.ifelse
can be used instead. -
DAE initialization and the solving for consistent initial conditions has been changed to use a customized initialization solve. This change adds
guess
semantics which are clearly delinated from the behavior of the defaults, wheredefault
(andu0
) is designed to be always satisfied and error if unsatisfiable, whileguess
is an initial guess to the initializer. In previous iterations, initialization with the default (BrownBasicInit
) would treat the initial condition to the algebraic variables as aguess
, and withShampineCollocationInit
would treat all initial conditions as aguess
. To return to the previous behavior, use the keyword argumentinitializealg
in the solve, i.e.solve(prob;initializealg = BrownBasicInit())
.