-
-
Notifications
You must be signed in to change notification settings - Fork 232
Description
The current implementation of linearize
uses ForwardDiff, which often works fine. However, models with discontinuities and saturation are sometimes better linearized with finite differences, with a relatively large perturbation size, (or even better, with stochastic linearization). It would be nice to allow the user to select exactly how the model is linearized, and if using finite-differences, the perturbation size for each variable. For input variables this would be straightforward to support, but for state variables less so since the state is not always known at the time of the call to linearize
. A two-step approach could be okay, where the user first calls linearize
and obtains the state realization, after which the perturbation sizes can be tuned. Alternatively, one could specify perturbation size for any desired variables, and the initialization system could be used to translate those sizes into whatever state realization is selected.
Another thing that would be nice to support would be to have an option to replace blocks when a model is linearized, e.g., replacing a saturation block with an identity block etc.
I notice that the AutoFiniteDiff
backend from ADTypes has options for relative step size, this could perhaps be good enough in some situations