Local solvers for physical networks
In Engee, a local solver mechanism is used to compute the behaviour of physical networks. In the system model, physical networks connected by directional components such as amplifier links, integrators, etc. are identified. Each physical network is calculated by its own independent solver, and interpolators are installed at its inputs and outputs. The directional part of the model is controlled by the global solver, and the physical networks are treated by it as ordinary directional components without internal state.
Local solvers can significantly increase the speed of model computation without sacrificing much the quality of the solution. Physical models often contain components of different physical nature, and different physical phenomena proceed in them at different rates. Using local solvers, it is possible, for example, to consider the electrical part of the model with a fine step and the mechanical part with a coarse step.
On the other hand, electrical circuits are often described by rigid systems of differential equations, while mechanical models are described by non-rigid ones. This allows complex methods to be used for electrical circuits and simpler methods to be used for mechanical circuits. Also, large rigid models can be split into several parts, each of which will be considered as the same implicit or semi-implicit solver.
The time complexity of decomposing a Jacobi matrix of size NxN is . Let this be exactly operations for simplicity. If we decompose a large model into two parts, the total number of operations for its computation is
,
where is the overhead of interpolators and solver synchronisation. These costs are usually a negligible fraction of the total computation time for an even slightly complex model. Partitioning the original model into two parts computed by local solvers gives at best a fourfold speedup in computation. In practice, the speedup is smaller due to various factors, but local solvers often allow to speed up the calculation significantly.
Engee supports two types of synchronisation of local and global solvers: discrete and continuous.
The first type is especially relevant for real-time computations, such as on the semi-natural RITM modelling complex. The physical network is represented as a discrete stateless atomic component for which a discretisation interval is specified. Two numerical methods are available: the implicit Euler method (`ImplicitEuler') and the trapezoid method (`Trapezoid'). They do not require interpolation of the input signals, and the output signals are discrete by definition.
In addition to the numerical method, a version of the method is selected, either fast (Fast') or robust (`Robust'). If a convergence error occurs, one can switch to the robust version of the algorithm (`Robust') or reduce the sampling step. Sometimes it is useful to reduce the sampling step to a value that is not a multiple of the original value, for example, not from `0.1
to 0.01
, but to 0.03
, in order to bypass the problem spot.
The simplifications used in discrete synchronisation mode may cause the model to be read faster, but the accuracy of the calculation may be insufficient. Then it is possible to reduce the sampling interval in the corresponding window of the solver settings or switch to continuous synchronisation.
When continuous synchronisation is switched on, the global solver starts to treat the physical network as a continuous component with no internal state. Its inputs use an interpolation suitable for the selected solver and its output is a continuous function. The synchronisation interval at which the local and global solvers will exchange information must be set. The local solver can take as many intermediate steps to the next synchronisation point as it needs. This approach improves the accuracy of the computation, but is computationally expensive.
The question of breaking algebraic loops - connections of physical networks through directed components with no internal states - arises. In this case, an error occurs:
To eliminate it, you can use Unit Delay with a small sampling interval:
or an aperiodic link with a suitable time constant:
The list of local Engee solvers is limited to the most useful ones for computing physical models and is a subset of the global solvers. It is useful to smooth the signals entering the physical network using continuous filters or special functions like hyperbolic tangent to approximate discontinuous functions.
If continuous synchronisation is chosen, three types of solvers are available: Fixed-step
, Variable-step
and Inherit global
. The first two are for fixed and variable step, while the third inherits the settings of the global solver. This does not mean that the model will be solved by a single global solver. The local solver will get the same settings as the global solver. The last mode is rarely used in practice, so it is recommended to start with the settings by default: continuous synchronisation, variable step solver, Rodas4
.