Skip to main content

Differentiation and Integration

Infinitesimal calculation (Calculus)

Differentiate "derive"

The derive() function derives the signal curve x(t)x(t) over time.

y=ddtx(t)y = \frac{d}{dt}x(t)

The physical unit of the result is reduced by one time dimension compared to the input function: [y]=[x]s[y] = \frac{[x]}{\rm{s}}.

info

This function is provided if the system is expanded to include equidistant signal curves, thus enabling a signal curve that can be at least linearly interpolated.

note

As the smartCORE generally only writes non-equidistant signal values to a channel if the value has changed, the value between two explicit sampling points must always be assumed to be constant and the information for the last, real sampling interval is missing. Between the interpolation points, the left-hand signal value (0th order hold element) always applies. This results in a staircase-shaped signal curve.

The application of differentiation to non-equidistant signals with a staircase shape is meaningless. The result would be either 00 or ±\pm \infty

Integrate "integrate"

The function integrate() returns the time integral over the input function x

y=0tx(τ)dτy = \int_0^tx(\tau)d\tau

Since x(τ)x(\tau) always at non-equidistant points in time t0,t1,t2,...tnt_0, t_1, t_2, ... t_n, between which the left-hand side function value is assumed to be constant, the integral can also be written as a sum:

y=n=0N1x(tn)(tn+1tn)y = \sum_{n=0}^{N-1}x(t_n)(t_{n+1}-t_n)

The physical unit of the result is extended by one time dimension: [y]=[x]s[y] = [x] \cdot \rm{s}.

note

A trapezoidal integration is provided for equidistant signals in the future.

I1 = integrate(y);
I2 = integrate(y, reset);
I3 = integrate(y, reset, preset);
// Optional configuration for all variants
Ix = integrate(..., { start: <dbl>
, preset: <dbl>
, lower: off|<dbl>
, upper: off|<dbl>
, storage: <str>
});

If a true is supplied via the optional parameter reset, the integral is reset to the value specified with preset (as a parameter or property, default 0.0) and held. Immediately before the reset, a further sample is inserted, with which the last integral value accrued up to that point is output ("true peak").

PropertyValueDescription
start<dbl>First start value for the integral when starting the Math module
preset<dbl>Fixed value for resetting the integral via the reset parameter
loweroff/<dbl>Limits the integral value downwards, if activated. This is required, for example, for the implementation of controller structures or models in which the integration process is limited by a physical limit.
upperoff/<dbl>Limits the integral value upwards, if activated. This is required, for example, for the implementation of controller structures or models in which the integration process is limited by a physical limit.
storage<str>Name of a persistent memory for the internal integral value. After a system restart, integration is continued at the last saved value.
The content of this memory cannot be used anywhere else in smartCORE.

Example:

In Example 1a, the function integrate() is used to calculate the electrical energy from current and voltage time curves.

In Example 10, the function integrate() is used to measure times.

Summing "sumup"

The sumup() function returns the sum of the individual values of the input signal x at the times of a positive edge on the trigger parameter

y=n=0N1x(tn)withtn=time(posedge(trigger))y = \sum_{n=0}^{N-1}x(t_n)\quad\rm{with}\quad t_n=time(posedge(trigger))
S1 = sumup(x, trigger);
S2 = sumup(x, trigger, reset);
// Optional configuration for all variants
Sx = sumup(... , { storage: <str>
});

If a true is supplied via the optional parameter reset, the sum 0.0 is reset and held.

PropertyValueDescription
storage<str>Name of a persistent memory for the internal total value. This continues the total at the last saved value after a system restart.
The contents of this memory cannot be used anywhere else in smartCORE.