.Modelica_Requirements.SignalAnalysis.ApproximateDerivativeWithWindow

Information

Syntax

der_u = ApproximateDerivativeWithWindow(u=..., dt=...).y;

Description

Real output y is the approximate derivative of the input u. This is achieved by computing a backwards finite difference quotient:

y = (u - delay(u,dt)) / dt;

where parameter dt is the time increment for the finite difference quotient and delay(u,dt) is the input signal u delayed by dt. The smaller dt, the smaller the appropximation error.

Alternatively, derivatives might be computed with the following blocks: ExactDerivative or ApproximateDerivativeWithFilter. If the input signal is from measurements, it is better to utilize the ApproximateDerivativeWithFilter block to compute the derivative, since the signal noise in the measurement is low pass filtered (and therefore this unwanted effect is considerably removed).

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-11-26T19:26:15Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos