.Modelica_Requirements.SignalAnalysis.ApproximateDerivativeWithFilter

Information

Syntax

der_u = ApproximateDerivativeWithFilter(u=..., f_cut=..., order=2).y;

Description

Real output y is the approximate derivative of the input u. This is achieved by first filtering the input with a low pass critical damping filter and then differentiating the filter output analytically (with the effect that some combinations of filter states are used as approximate derivative). This block requires to define two parameters: f_cut the cut-off frequency of the filter in Hz and order the order of the filter (default of order=2). The larger the cut-off frequency, the smaller the approximation error. On the other hand, if the input signal is from measurements, then the cut-off frequency should be not too large to remove unwanted signal noise by the filter. The order of the filter defines the "steepness" of the frequency response and therefore a larger order reduces the effect of frequencies in the input that are above f_cut.

Alternatively, derivatives might be computed with the following blocks: ExactDerivative or ApproximateDerivativeWithWindow.

Example

This block is demonstrated with the following example:

that compares different ways to compute a derivative. Simulation results in:

simulation result

Note, the approximate derivatives have a large error at the start of the simulation, because no information about the derivative of the signal is known. For this reason, the ApproximateDerivativeWithFilter block starts, for example, with steady-state (so zero derivative), and then needs some time until the approximation of the derivative is fine.


Generated at 2024-09-20T18:25:48Z by OpenModelicaOpenModelica 1.23.1 using GenerateDoc.mos