EasyManua.ls Logo

ETAS MDA V8 - Calculating RMS

Default Icon
153 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
7 Calculations | 112
To extract a bit field from a signal
1. Shift the input signal such that the least significant bit (LEAST_
SIGNIFICANT_BIT) of the bit field that you want to extract is in the 0 pos-
ition.
2. Isolate the NUMBER_OF_BITS of the bit field by applying a bit-wise AND
with a bitmask.
bitfield = (inputsignal >> LEAST_SIGNIFICANT_BIT) & ~(~0
<< NUMBER_OF_BITS)
7.2.3.2 Calculating RMS
For alternating current wave forms (e.g. sine wave) there are several ways of
characterizing the voltage. One is the RMS (root mean square) which is the equi-
valent DC voltage that would have the same heating effect on a resistor. The cal-
culation of RMS involves taking the average voltage over some time range. To
generate a low noise result it is important to align these time ranges with the
cycles of the wave form. This can be achieved by the following calculations.
An example sine wave (use periodic 100 ms raster):
voltage = sin(Master())
Detecting the zero crossings (used to finish the integral):
positive = voltage > 0
windowDetect = positive && !State_Register(positive, !1)
Also provide the detected signal delayed by one sample (used to restart
the integral):
windowDetect2 = State_Register(windowDetect, !1)
Remember start of window on each crossing:
windowStart = Latch(Master(), windowDetect2)
Calculate the RMS since the last zero crossing:
RMSTemp = sqrt(Rolling_Accumulate_Integral(voltage ** 2,
windowStart))
Hold the RMS value from the end of the last window:
RMS = Latch(RMSTemp, windowDetect)
Overall the calculated RMS will be one period delayed.
MDA V8 | User Guide

Table of Contents

Related product manuals