7 Calculations | 113
7.2.3.3 Using Enumeration Signals
As the physical value of an enumeration signal is a string, usual mathematical
operations can not be performed directly using the pure enumeration signal as
input signal in formulas. To use the respective decimal value defined by the con-
version formula instead of the string value, the Raw() function is provided. To
compare the physical string values of two different enumeration signals, the func-
tion 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 pos-
itive 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 sig-
nal 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])
7.2.3.4 Applying Calculations to Specific Samples
There are different methods how a calculation can be limited to specific samples.
MDA V8 | User Guide