QSS uses numerical differentiation (ND) for state variable and event indicator second and third derivatives and for event indicator first derivatives when directional derivatives are not working/selected. ND creates a number of serious obstacles for QSS:
ND significantly complicates the QSS code and requires an inefficient FMU call sequence.
Many models are sensitive the the ND time step, currently requiring user experimentation.
Efficient QSS simulation depends on maximally batching FMU calls, which requires using a uniform ND time step for all variables, but this step may be a poor choice for some variables.
A poor choice of ND time step can inject derivative noise into a QSS simulation, and this noise forces excessive requantizations and thus slow performance. For some models there is no ND time step that avoids such noise for some variables.
ND issues increase with higher order solvers so QSS3 with ND doesn't work well for many models where it would be superior with clean derivatives.
The code complexity and overhead for ND makes implementing QSS4 or higher order QSS methods very challenging and the ND noise would most likely render such solvers unusable.
Longer term, an automatic differentiation (AD) capability (that exploits sparsity) would be very desirable for QSS performance and code clarity. The current OCT directional derivative support does not appear to be exploiting sparsity and so was found to be much too inefficient for QSS, but with more recent QSS development that exploits more batching and binning even this directional derivative support may be useful for state variable second derivatives.
The current/potential action items related to the ND issues are:
A QSS automatic ND time step selection capability/option is under development with the hope that this will be robust enough to be the default behavior and remove this burden from users of production QSS
Reevaluate the use of directional derivatives for state variable second derivatives with QSS FMU call batching and binning
OCT development of faster sparsity-exploiting directional derivative support or full AD support if/when practical
QSS uses numerical differentiation (ND) for state variable and event indicator second and third derivatives and for event indicator first derivatives when directional derivatives are not working/selected. ND creates a number of serious obstacles for QSS:
Longer term, an automatic differentiation (AD) capability (that exploits sparsity) would be very desirable for QSS performance and code clarity. The current OCT directional derivative support does not appear to be exploiting sparsity and so was found to be much too inefficient for QSS, but with more recent QSS development that exploits more batching and binning even this directional derivative support may be useful for state variable second derivatives.
The current/potential action items related to the ND issues are: