#************ Noise supression of angle signal of stress analysis *************************************************************
# With stress analysis, the resulting angle signal depends on very small deviations of the relations of the input signals
# So, even unavoidable noise noise on the input signals leads to large changes of the angle Phi
# This script creates an additional angle signal, which is set to 0, if the sum of stress signals S1 and S2 is below 0.9 N/mm
# The 3 inputs must be as following: ch1: Sigma1, ch2: Sigma2, ch3: Phi, Stress calculation for rosette done already
#+++++++++++ Rauschunterdrckung des Winkelsignals bei Spannungsanalyse ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Bei der Spannungsanalyse hngt der resultierende Winkel Phi sehr stark von den Verhltnissen der Eingangssignale ab, so
# dass auch unvermeidbares Rauschen zu starken Schwankungen des Winkelsignals fhrt.
# Dieses Skript erzeugt ein zustzliche Winkelsignal, bei dem der Winkel auf 0 gesetzt wird, wenn die Summe der Spannungen 
# S1 + S2 kleiner als 0.9 ist
# Die 3 Eingnge sind fertig berechnete Spannungswerte aus Rosetten-Messung: ch1: Sigma1, ch2: Sigma2, ch3: Phi

# Set the Threshold / Setzen des Schwellwertes
constThreshold= 0.9;

# Average count, e.g. set to DataFreq/2, i.e. 0.5 sec / Mittelwertbildungssummanden, zB auf DataFreq/2 setzen, d.h. 0,5s
constAvgN = 500;

#Rosette: ch1: Sigma1, ch2: Sigma2, ch3: Phi
#x3: Winkel Phi mit Rauschunterdrckung, zB mit GSV-8, Fdata=1000/s: Phi=0, wenn s1+s2 fr >=0,5s lang <0,9 N/mm
x1= abs(ch1)+abs(ch2);
x2=MEAN(x1,constAvgN);
IF(x2>constThreshold){x3=ch3};
ELIF(x2<=constThreshold){x3=0};
ENDIF;