void LOGGER_init__(LOGGER *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->TRIG,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->MSG,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->LEVEL,LOGLEVEL__INFO,retain)
  __INIT_VAR(data__->TRIG0,__BOOL_LITERAL(FALSE),retain)
}

// Code part
void LOGGER_body__(LOGGER *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables

  if ((__GET_VAR(data__->TRIG,) && !(__GET_VAR(data__->TRIG0,)))) {
    #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
    #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)

   LogMessage(GetFbVar(LEVEL),(char*)GetFbVar(MSG, .body),GetFbVar(MSG, .len));
  
    #undef GetFbVar
    #undef SetFbVar
;
  };
  __SET_VAR(data__->,TRIG0,,__GET_VAR(data__->TRIG,));

  goto __end;

__end:
  return;
} // LOGGER_body__() 





void PYTHON_EVAL_init__(PYTHON_EVAL *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->TRIG,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->CODE,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->ACK,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->RESULT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->STATE,0,retain)
  __INIT_VAR(data__->BUFFER,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->PREBUFFER,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->TRIGM1,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->TRIGGED,__BOOL_LITERAL(FALSE),retain)
}

// Code part
void PYTHON_EVAL_body__(PYTHON_EVAL *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables

  __IL_DEFVAR_T __IL_DEFVAR;
  __IL_DEFVAR_T __IL_DEFVAR_BACK;
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
extern void __PythonEvalFB(int, PYTHON_EVAL*);__PythonEvalFB(0, data__);
  #undef GetFbVar
  #undef SetFbVar
;

  goto __end;

__end:
  return;
} // PYTHON_EVAL_body__() 





void CSV_READ_BY_STRING_init__(CSV_READ_BY_STRING *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_EXTERNAL(BOOL,PYEXT_CSV_UPDATE,data__->PYEXT_CSV_UPDATE,retain)
  __INIT_VAR(data__->ACK,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->RESULT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->FILE_NAME,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->ROW,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->COLUMN,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->OLDCODE,__STRING_LITERAL(0,""),retain)
  PYTHON_EVAL_init__(&data__->PY_EVAL,retain);
  R_TRIG_init__(&data__->R_TRIG0,retain);
  R_TRIG_init__(&data__->R_TRIG1,retain);
  SR_init__(&data__->SR0,retain);
  __INIT_VAR(data__->_TMP_CONCAT7_OUT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->_TMP_NE16_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_SEL18_OUT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->_TMP_OR15_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_LEFT33_OUT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->_TMP_NE34_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_AND39_OUT,__BOOL_LITERAL(FALSE),retain)
  R_TRIG_init__(&data__->R_TRIG2,retain);
}

// Code part
void CSV_READ_BY_STRING_body__(CSV_READ_BY_STRING *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables

  __SET_VAR(data__->,_TMP_CONCAT7_OUT,,CONCAT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)7,
    (STRING)__STRING_LITERAL(10,"CSVRdStr(\""),
    (STRING)__GET_VAR(data__->FILE_NAME,),
    (STRING)__STRING_LITERAL(3,"\",\""),
    (STRING)__GET_VAR(data__->ROW,),
    (STRING)__STRING_LITERAL(3,"\",\""),
    (STRING)__GET_VAR(data__->COLUMN,),
    (STRING)__STRING_LITERAL(2,"\")")));
  __SET_VAR(data__->,_TMP_NE16_OUT,,NE__BOOL__STRING__STRING(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (STRING)__GET_VAR(data__->_TMP_CONCAT7_OUT,),
    (STRING)__GET_VAR(data__->OLDCODE,)));
  __SET_VAR(data__->,_TMP_SEL18_OUT,,SEL__STRING__BOOL__STRING__STRING(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BOOL)__GET_VAR(data__->_TMP_NE16_OUT,),
    (STRING)__GET_VAR(data__->OLDCODE,),
    (STRING)__GET_VAR(data__->_TMP_CONCAT7_OUT,)));
  __SET_VAR(data__->,OLDCODE,,__GET_VAR(data__->_TMP_SEL18_OUT,));
  __SET_VAR(data__->R_TRIG0.,CLK,,__GET_EXTERNAL(data__->PYEXT_CSV_UPDATE,));
  R_TRIG_body__(&data__->R_TRIG0);
  __SET_VAR(data__->,_TMP_OR15_OUT,,OR__BOOL__BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (BOOL)__GET_VAR(data__->R_TRIG0.Q,),
    (BOOL)__GET_VAR(data__->_TMP_NE16_OUT,)));
  __SET_VAR(data__->PY_EVAL.,TRIG,,__GET_VAR(data__->_TMP_OR15_OUT,));
  __SET_VAR(data__->PY_EVAL.,CODE,,__GET_VAR(data__->_TMP_CONCAT7_OUT,));
  PYTHON_EVAL_body__(&data__->PY_EVAL);
  __SET_VAR(data__->R_TRIG1.,CLK,,__GET_VAR(data__->PY_EVAL.ACK,));
  R_TRIG_body__(&data__->R_TRIG1);
  __SET_VAR(data__->,_TMP_LEFT33_OUT,,LEFT__STRING__STRING__SINT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (STRING)__GET_VAR(data__->PY_EVAL.RESULT,),
    (SINT)1));
  __SET_VAR(data__->,_TMP_NE34_OUT,,NE__BOOL__STRING__STRING(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (STRING)__GET_VAR(data__->_TMP_LEFT33_OUT,),
    (STRING)__STRING_LITERAL(1,"#")));
  __SET_VAR(data__->,_TMP_AND39_OUT,,AND__BOOL__BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (BOOL)__GET_VAR(data__->R_TRIG1.Q,),
    (BOOL)__GET_VAR(data__->_TMP_NE34_OUT,)));
  __SET_VAR(data__->R_TRIG2.,CLK,,__GET_VAR(data__->_TMP_OR15_OUT,));
  R_TRIG_body__(&data__->R_TRIG2);
  __SET_VAR(data__->SR0.,S1,,__GET_VAR(data__->_TMP_AND39_OUT,));
  __SET_VAR(data__->SR0.,R,,__GET_VAR(data__->R_TRIG2.Q,));
  SR_body__(&data__->SR0);
  __SET_VAR(data__->,ACK,,__GET_VAR(data__->SR0.Q1,));
  __SET_VAR(data__->,RESULT,,__GET_VAR(data__->PY_EVAL.RESULT,));

  goto __end;

__end:
  return;
} // CSV_READ_BY_STRING_body__() 





void PYTHON_GEAR_init__(PYTHON_GEAR *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->N,0,retain)
  __INIT_VAR(data__->TRIG,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->CODE,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->ACK,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->RESULT,__STRING_LITERAL(0,""),retain)
  PYTHON_EVAL_init__(&data__->PY_EVAL,retain);
  __INIT_VAR(data__->COUNTER,0,retain)
  __INIT_VAR(data__->_TMP_ADD10_OUT,0,retain)
  __INIT_VAR(data__->_TMP_EQ13_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_SEL15_OUT,0,retain)
  __INIT_VAR(data__->_TMP_AND7_OUT,__BOOL_LITERAL(FALSE),retain)
}

// Code part
void PYTHON_GEAR_body__(PYTHON_GEAR *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables

  __SET_VAR(data__->,_TMP_ADD10_OUT,,ADD__UINT__UINT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (UINT)__GET_VAR(data__->COUNTER,),
    (UINT)1));
  __SET_VAR(data__->,_TMP_EQ13_OUT,,EQ__BOOL__UINT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (UINT)__GET_VAR(data__->N,),
    (UINT)__GET_VAR(data__->_TMP_ADD10_OUT,)));
  __SET_VAR(data__->,_TMP_SEL15_OUT,,SEL__UINT__BOOL__UINT__UINT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BOOL)__GET_VAR(data__->_TMP_EQ13_OUT,),
    (UINT)__GET_VAR(data__->_TMP_ADD10_OUT,),
    (UINT)0));
  __SET_VAR(data__->,COUNTER,,__GET_VAR(data__->_TMP_SEL15_OUT,));
  __SET_VAR(data__->,_TMP_AND7_OUT,,AND__BOOL__BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (BOOL)__GET_VAR(data__->_TMP_EQ13_OUT,),
    (BOOL)__GET_VAR(data__->TRIG,)));
  __SET_VAR(data__->PY_EVAL.,TRIG,,__GET_VAR(data__->_TMP_AND7_OUT,));
  __SET_VAR(data__->PY_EVAL.,CODE,,__GET_VAR(data__->CODE,));
  PYTHON_EVAL_body__(&data__->PY_EVAL);
  __SET_VAR(data__->,ACK,,__GET_VAR(data__->PY_EVAL.ACK,));
  __SET_VAR(data__->,RESULT,,__GET_VAR(data__->PY_EVAL.RESULT,));

  goto __end;

__end:
  return;
} // PYTHON_GEAR_body__() 





static inline BOOL __CSV_RELOAD_MOVE__BOOL__BOOL1(BOOL EN,
  BOOL IN,
  CSV_RELOAD *data__)
{
  BOOL __res;
  BOOL __TMP_ENO = __GET_VAR(data__->_TMP_MOVE12_ENO,);
  __res = MOVE__BOOL__BOOL(EN,
    &__TMP_ENO,
    IN);
  __SET_VAR(,data__->_TMP_MOVE12_ENO,,__TMP_ENO);
  return __res;
}

void CSV_RELOAD_init__(CSV_RELOAD *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_EXTERNAL(BOOL,PYEXT_CSV_UPDATE,data__->PYEXT_CSV_UPDATE,retain)
  __INIT_VAR(data__->ACK,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->RESULT,__STRING_LITERAL(0,""),retain)
  PYTHON_EVAL_init__(&data__->PY_EVAL,retain);
  __INIT_VAR(data__->TRIG,__BOOL_LITERAL(FALSE),retain)
  R_TRIG_init__(&data__->R_TRIG0,retain);
  F_TRIG_init__(&data__->F_TRIG0,retain);
  __INIT_VAR(data__->_TMP_OR11_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_NOT13_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_MOVE12_ENO,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_MOVE12_OUT,__BOOL_LITERAL(FALSE),retain)
}

// Code part
void CSV_RELOAD_body__(CSV_RELOAD *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables

  __SET_VAR(data__->PY_EVAL.,TRIG,,__GET_VAR(data__->TRIG,));
  __SET_VAR(data__->PY_EVAL.,CODE,,__STRING_LITERAL(18,"pyext_csv_reload()"));
  PYTHON_EVAL_body__(&data__->PY_EVAL);
  __SET_VAR(data__->R_TRIG0.,CLK,,__GET_VAR(data__->PY_EVAL.ACK,));
  R_TRIG_body__(&data__->R_TRIG0);
  __SET_VAR(data__->F_TRIG0.,CLK,,__GET_VAR(data__->PY_EVAL.ACK,));
  F_TRIG_body__(&data__->F_TRIG0);
  __SET_VAR(data__->,_TMP_OR11_OUT,,OR__BOOL__BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (BOOL)__GET_VAR(data__->R_TRIG0.Q,),
    (BOOL)__GET_VAR(data__->F_TRIG0.Q,)));
  __SET_VAR(data__->,_TMP_NOT13_OUT,,!(__GET_VAR(data__->R_TRIG0.Q,)));
  __SET_VAR(data__->,_TMP_MOVE12_OUT,,__CSV_RELOAD_MOVE__BOOL__BOOL1(
    (BOOL)__GET_VAR(data__->_TMP_OR11_OUT,),
    (BOOL)__GET_VAR(data__->_TMP_NOT13_OUT,),
    data__));
  if (__GET_VAR(data__->_TMP_MOVE12_ENO,)) {
    __SET_EXTERNAL(data__->,PYEXT_CSV_UPDATE,,__GET_VAR(data__->_TMP_MOVE12_OUT,));
  };
  __SET_VAR(data__->,ACK,,__GET_VAR(data__->PY_EVAL.ACK,));
  __SET_VAR(data__->,RESULT,,__GET_VAR(data__->PY_EVAL.RESULT,));

  goto __end;

__end:
  return;
} // CSV_RELOAD_body__() 





void CSV_READ_BY_INT_init__(CSV_READ_BY_INT *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_EXTERNAL(BOOL,PYEXT_CSV_UPDATE,data__->PYEXT_CSV_UPDATE,retain)
  __INIT_VAR(data__->ACK,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->RESULT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->FILE_NAME,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->ROW,0,retain)
  __INIT_VAR(data__->COLUMN,0,retain)
  __INIT_VAR(data__->OLDCODE,__STRING_LITERAL(0,""),retain)
  PYTHON_EVAL_init__(&data__->PY_EVAL0,retain);
  R_TRIG_init__(&data__->R_TRIG1,retain);
  R_TRIG_init__(&data__->R_TRIG2,retain);
  SR_init__(&data__->SR0,retain);
  __INIT_VAR(data__->_TMP_INT_TO_STRING31_OUT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->_TMP_INT_TO_STRING2_OUT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->_TMP_CONCAT7_OUT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->_TMP_NE16_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_SEL18_OUT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->_TMP_OR15_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_LEFT33_OUT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->_TMP_NE34_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_AND39_OUT,__BOOL_LITERAL(FALSE),retain)
  R_TRIG_init__(&data__->R_TRIG3,retain);
}

// Code part
void CSV_READ_BY_INT_body__(CSV_READ_BY_INT *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables

  __SET_VAR(data__->,_TMP_INT_TO_STRING31_OUT,,INT_TO_STRING(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (INT)__GET_VAR(data__->ROW,)));
  __SET_VAR(data__->,_TMP_INT_TO_STRING2_OUT,,INT_TO_STRING(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (INT)__GET_VAR(data__->COLUMN,)));
  __SET_VAR(data__->,_TMP_CONCAT7_OUT,,CONCAT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)7,
    (STRING)__STRING_LITERAL(10,"CSVRdInt(\""),
    (STRING)__GET_VAR(data__->FILE_NAME,),
    (STRING)__STRING_LITERAL(2,"\","),
    (STRING)__GET_VAR(data__->_TMP_INT_TO_STRING31_OUT,),
    (STRING)__STRING_LITERAL(1,","),
    (STRING)__GET_VAR(data__->_TMP_INT_TO_STRING2_OUT,),
    (STRING)__STRING_LITERAL(1,")")));
  __SET_VAR(data__->,_TMP_NE16_OUT,,NE__BOOL__STRING__STRING(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (STRING)__GET_VAR(data__->_TMP_CONCAT7_OUT,),
    (STRING)__GET_VAR(data__->OLDCODE,)));
  __SET_VAR(data__->,_TMP_SEL18_OUT,,SEL__STRING__BOOL__STRING__STRING(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BOOL)__GET_VAR(data__->_TMP_NE16_OUT,),
    (STRING)__GET_VAR(data__->OLDCODE,),
    (STRING)__GET_VAR(data__->_TMP_CONCAT7_OUT,)));
  __SET_VAR(data__->,OLDCODE,,__GET_VAR(data__->_TMP_SEL18_OUT,));
  __SET_VAR(data__->R_TRIG1.,CLK,,__GET_EXTERNAL(data__->PYEXT_CSV_UPDATE,));
  R_TRIG_body__(&data__->R_TRIG1);
  __SET_VAR(data__->,_TMP_OR15_OUT,,OR__BOOL__BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (BOOL)__GET_VAR(data__->R_TRIG1.Q,),
    (BOOL)__GET_VAR(data__->_TMP_NE16_OUT,)));
  __SET_VAR(data__->PY_EVAL0.,TRIG,,__GET_VAR(data__->_TMP_OR15_OUT,));
  __SET_VAR(data__->PY_EVAL0.,CODE,,__GET_VAR(data__->_TMP_CONCAT7_OUT,));
  PYTHON_EVAL_body__(&data__->PY_EVAL0);
  __SET_VAR(data__->R_TRIG2.,CLK,,__GET_VAR(data__->PY_EVAL0.ACK,));
  R_TRIG_body__(&data__->R_TRIG2);
  __SET_VAR(data__->,_TMP_LEFT33_OUT,,LEFT__STRING__STRING__SINT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (STRING)__GET_VAR(data__->PY_EVAL0.RESULT,),
    (SINT)1));
  __SET_VAR(data__->,_TMP_NE34_OUT,,NE__BOOL__STRING__STRING(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (STRING)__GET_VAR(data__->_TMP_LEFT33_OUT,),
    (STRING)__STRING_LITERAL(1,"#")));
  __SET_VAR(data__->,_TMP_AND39_OUT,,AND__BOOL__BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (BOOL)__GET_VAR(data__->R_TRIG2.Q,),
    (BOOL)__GET_VAR(data__->_TMP_NE34_OUT,)));
  __SET_VAR(data__->R_TRIG3.,CLK,,__GET_VAR(data__->_TMP_OR15_OUT,));
  R_TRIG_body__(&data__->R_TRIG3);
  __SET_VAR(data__->SR0.,S1,,__GET_VAR(data__->_TMP_AND39_OUT,));
  __SET_VAR(data__->SR0.,R,,__GET_VAR(data__->R_TRIG3.Q,));
  SR_body__(&data__->SR0);
  __SET_VAR(data__->,ACK,,__GET_VAR(data__->SR0.Q1,));
  __SET_VAR(data__->,RESULT,,__GET_VAR(data__->PY_EVAL0.RESULT,));

  goto __end;

__end:
  return;
} // CSV_READ_BY_INT_body__() 





void PYTHON_POLL_init__(PYTHON_POLL *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->TRIG,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->CODE,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->ACK,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->RESULT,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->STATE,0,retain)
  __INIT_VAR(data__->BUFFER,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->PREBUFFER,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->TRIGM1,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->TRIGGED,__BOOL_LITERAL(FALSE),retain)
}

// Code part
void PYTHON_POLL_body__(PYTHON_POLL *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables

  __IL_DEFVAR_T __IL_DEFVAR;
  __IL_DEFVAR_T __IL_DEFVAR_BACK;
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)
extern void __PythonEvalFB(int, PYTHON_EVAL*);__PythonEvalFB(1,(PYTHON_EVAL*)(void*)data__);
  #undef GetFbVar
  #undef SetFbVar
;

  goto __end;

__end:
  return;
} // PYTHON_POLL_body__() 





void COUNTERST_init__(COUNTERST *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->RESET,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->OUT1,0,retain)
  __INIT_VAR(data__->OUT0,0,retain)
  __INIT_VAR(data__->CNT0,0,retain)
  __INIT_EXTERNAL(INT,RESETCOUNTERVALUE,data__->RESETCOUNTERVALUE,retain)
  __INIT_EXTERNAL(LREAL,OI_SENSOR_COUNTER,data__->OI_SENSOR_COUNTER,retain)
  __INIT_EXTERNAL(DINT,VFD_RELAY0,data__->VFD_RELAY0,retain)
  __INIT_EXTERNAL(DINT,AIR_VALVE_RELAY0,data__->AIR_VALVE_RELAY0,retain)
  __INIT_EXTERNAL(LINT,MES5_INT_COUNTER_IN,data__->MES5_INT_COUNTER_IN,retain)
  __INIT_EXTERNAL(LINT,MES5_INT_COUNTER_OUT,data__->MES5_INT_COUNTER_OUT,retain)
}

// Code part
void COUNTERST_body__(COUNTERST *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables

  __SET_EXTERNAL(data__->,VFD_RELAY0,,1);
  if ((__GET_EXTERNAL(data__->OI_SENSOR_COUNTER,) == 2.0)) {
    __SET_EXTERNAL(data__->,AIR_VALVE_RELAY0,,1);
    __SET_EXTERNAL(data__->,MES5_INT_COUNTER_IN,,(__GET_EXTERNAL(data__->MES5_INT_COUNTER_IN,) + 1));
    __SET_EXTERNAL(data__->,MES5_INT_COUNTER_OUT,,__GET_EXTERNAL(data__->MES5_INT_COUNTER_IN,));
  };
  if ((((__GET_EXTERNAL(data__->OI_SENSOR_COUNTER,) == 0.0) || (__GET_EXTERNAL(data__->OI_SENSOR_COUNTER,) == 1.0)) || (__GET_EXTERNAL(data__->OI_SENSOR_COUNTER,) == 3.0))) {
    __SET_EXTERNAL(data__->,AIR_VALVE_RELAY0,,0);
  };

  goto __end;

__end:
  return;
} // COUNTERST_body__() 





void PLC_PRG_init__(PLC_PRG *data__, BOOL retain) {
  __INIT_VAR(data__->RESET,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->CNT0,0,retain)
  __INIT_VAR(data__->CNT1,0,retain)
  COUNTERST_init__(&data__->COUNTERST0,retain);
}

// Code part
void PLC_PRG_body__(PLC_PRG *data__) {
  // Initialise TEMP variables

  __SET_VAR(data__->COUNTERST0.,RESET,,__GET_VAR(data__->RESET,));
  COUNTERST_body__(&data__->COUNTERST0);
  __SET_VAR(data__->,CNT1,,__GET_VAR(data__->COUNTERST0.OUT1,));
  __SET_VAR(data__->,CNT0,,__GET_VAR(data__->COUNTERST0.OUT0,));

  goto __end;

__end:
  return;
} // PLC_PRG_body__() 





