Sorry to resurrect an old topic. I just want to register my findings.
I use DEDataVector
a lot. In my case, solutions like extending the state with dummy variables would not be feasible, and that’s why:
The main project here using this framework is a satellite simulator. In this case, we use DiscreteCallback
to simulate the full attitude control software. We have more than 2,000 parameters, including variables that are boolean, integers, etc. The idea is that we modeled all the embedded software functionality as precisely as we can. Thus, we have a workspace, which is <: DEDataVector
, containing the continuous variables and a lot of other structures like sensors
, actuators
, controller
, etc. that models the embedded software.
Since DEDataVector
was marked as deprecated, I was searching for a possible replacement. Right now, ModelingToolkit seems to have some issues that will not allow me to migrate everything to it [1-3]. DEDataVector
is working fine as long as you follow the instructions in the documentation and perform a full cache update. I tried with many solvers.
Thinking into the future, if DEDataArrays
is really removed from the ecosystem (I might have problems internally way before this happens since this package is marked as deprecated), then I found one solution that seems to work for me. In the parameters, I pass two variables (w::Workspace, vw::Vector{Workspace})
. The first one is the latest set of variables updated by the onboard software, and the latter is a vector containing the history of the workspace. Hence, instead of updating the cache at the end of the callback, I push a copy of w
into vw
, leading to a value for every t
in my tstops
. I did not see any modification in the solution, and it is way faster, probably due to reduced allocation. The only downside is that the plotting of discrete variables is not as nice as we get using DEDataArrays
, which really shows that discrete behavior.
[1] https://github.com/SciML/ModelingToolkit.jl/issues/1194
[2] https://github.com/SciML/ModelingToolkit.jl/issues/1196
[3] https://github.com/SciML/ModelingToolkit.jl/issues/1203