Using Enumeration Signals
As the physical value of an enumeration signal is a string, usual mathematical operations cannot be performed directly using the pure enumeration signal as input signal in formulas. To use the respective decimal value defined by the conversion formula instead of the string value, the Raw() function is provided. To compare the physical string values of two different enumeration signals, the function ToString() can be used.
-
Obtaining the decimal value of the enumeration signal:
Raw(Enumeration)
-
For checking whether the value of an enumeration signal equals or exceeds a specific limit, the corresponding decimal value as given in the conversion formula of the enumeration signal is used for comparison:
Raw(Enumeration) >= [numeric decimal value]
-
Comparing the strings of two enumerations signals for being equal:
ToString(Enumeration_1) = ToString(Enumeration_2)
-
Counting the number of changes of an enumeration signal. First the positive and the negative edges are detected, then these are counted:
Edges = Gradient(Raw(Enumeration)) != 0
Accumulate_Prefix_Sum(Edges)
-
Detecting the duration how long (in seconds) a Boolean enumeration signal stayed in state True:
Accumulate_Prefix_Integral(Raw(Boolean_Enumeration))
Provided that the enumeration definition is 0 = False, and 1 = True.
-
Detecting the duration how long (in seconds) an enumeration signal stayed in a specific state, the decimal value of this state is detected and then integrated:
Accumulate_Prefix_Integral(Raw(Enumeration)= [Value of state])
See also