FUNCTION_BLOCK Basic0T

Hover on a highlighted element
to pop up its description (if any).

ECC
ALGORITHM INIT IN ST :
  QO := QI;
  RESULT := "INIT";
END_ALGORITHM

ALGORITHM REQ IN ST :
  QO := QI;
  RESULT := "REQ";
END_ALGORITHM

The operation of an instance of this Basic Function Block type is defined by the Execution Control Chart (ECC) and algorithms shown above.

The primary purpose of this FB type is to serve as a basis for comparison of the efficiency of event handling in the generated and compiled Java™ code using a full ECC vs. using Simple EC States as in the FBTypes Basic1T and Simple2T. This comparison is done in terms of the total number of Event Handling Lines Of Code (EHLOC), executable EHLOC, and size of the compiled Java class file as shown below. Executable EHLOCs are highlighted in orange and non-executable EHLOCs are highlighted in yellow .

FB type Total EHLOC Executable EHLOC .class file size
Basic0T 25 15 2192
public class Basic0T extends fb.rt.FBInstance {
/** The index (0) of state START. */
public static final int INDEX_START = 0;
/** The index (1) of state INIT. */
public static final int INDEX_INIT = 1;
/** The index (2) of state REQ. */
public static final int INDEX_REQ = 2;
/** Initialization Confirm */
public final EventOutput INITO = new EventOutput();
/** Execution Confirmation */
public final EventOutput CNF = new EventOutput();
/** Initialization Request */
public final EventServer INIT = (e) -> service_INIT();
/** Normal Execution Request */
public final EventServer REQ = (e) -> service_REQ();
/** Input event qualifier */
  public BOOL QI = new BOOL();
/** Output event qualifier */
  public final BOOL QO = new BOOL();
/** VAR RESULT:WSTRING */
  public final WSTRING RESULT = new WSTRING();
/** The default constructor. */
public Basic0T(){
    super();
  }
protected synchronized void service_INIT(){
  if(eccState == INDEX_START){
    state_INIT();
  }
}
protected synchronized void service_REQ(){
  if(eccState == INDEX_START){
    state_REQ();
  }
}
/** The actions to take upon entering state START. */
void state_START(){
   eccState = INDEX_START;
}
/** The actions to take upon entering state INIT. */
void state_INIT(){
   eccState = INDEX_INIT;
   alg_INIT();
   INITO.serviceEvent(this);
   state_START();
}
/** The actions to take upon entering state REQ. */
void state_REQ(){
   eccState = INDEX_REQ;
   alg_REQ();
   CNF.serviceEvent(this);
   state_START();
}
  /** ALGORITHM INIT IN ST*/
public void alg_INIT(){
QO.value = QI.value;
RESULT.value = "INIT";}
  /** ALGORITHM REQ IN ST*/
public void alg_REQ(){
QO.value = QI.value;
RESULT.value = "REQ";}
}