FUNCTION_BLOCK SAW_TRI

ECC
ALGORITHM REQ IN Java :
OUT.value = (IN.value < 50)?
  100 - 2 * Math.abs(IN.value - 25) :
  2 * Math.abs(IN.value - 75);
END_ALGORITHM

An instance of this Function Block type converts a sawtooth waveform in the range {0..100} to a triangular waveform of the same frequency and the same signal range, i.e., amplitude and offset of 50 units. Its operation is modeled by the Execution Control Chart (ECC) and algorithm shown above.

See the WAVEFORMS system configuration for an example of the use of instances of this and other waveform generation FB types.