FUNCTION_BLOCK X2Y2_FBD

ECC
REQ

Upon the occurrence of an event at its REQ input, an instance of this Simple Function Block type computes the value of its OUT variable, followed by an event at its CNF output. The OUT value is computed via the REQ algorithm shown above, which uses the IEC 61131-3 FBD (Function Block Diagram) graphical language to implement the formula

OUT = x2 - y2 = (x + y)*(x - y) .

The external interface and functionality of this FB type are the same as for the X2Y2 type. However, the use of a simple EC state, as shown in the ECC (Execution Control Chart) above, enables the FBDK to generate the much more efficient Java™ runtime implementation shown below, eliminating the memory overhead of internal FB instances and the execution overhead of internal event propagation and ECC state tracking.

public final EventServer REQ = (e) -> {
  alg_REQ();
  CNF.serviceEvent(this);
  }
public void alg_REQ(){
    OUT.value = (float)((X.value +Y.value )*(X.value -Y.value ));
}