// Block Type: FC
// Block Name (Original): FC Ttop Motor M31010
// Block Number: 327
// Original Network Languages: LAD, SCL

FUNCTION "FC_Ttop_Motor_M31010" : Void
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1

VAR_INOUT
  Motor : STRUCT
    RCP_Speed_Fix_01 : Int;
    RCP_Speed_Fix_02 : Int;
    RCP_Speed_Fix_03 : Int;
    RCP_Speed_Fix_04 : Int;
    RCP_Speed_Fix_05 : Int;
    RCP_Speed_Sync_01 : Int;
    RCP_Speed_Sync_02 : Int;
    RCP_Speed_Sync_03 : Int;
    RCP_Speed_Sync_04 : Int;
    RCP_Speed_Sync_05 : Int;
    RCP_Timer_01 : Int;
    RCP_Timer_02 : Int;
    RCP_Timer_03 : Int;
    RCP_Timer_04 : Int;
    RCP_Timer_05 : Int;
    RCP_Speed_Fix_01_mBar : Int;
    RCP_Speed_Fix_02_mBar : Int;
    RCP_Speed_Fix_03_mBar : Int;
    RCP_Speed_Fix_04_mBar : Int;
    RCP_Speed_Fix_05_mBar : Int;
    RCP_ACC_Ramp : Int;
    RCP_DEC_Ramp : Int;
    RCP_W044 : Int;
    RCP_W046 : Int;
    RCP_W048 : Int;
    CFG_VFD : Bool;
    CFG_DP : Bool;
    CFG_Analog_Speed : Bool;
    CFG_EN_BWD : Bool;
    CFG_Reverse : Bool;
    CFG_Motor_N_Sel : Bool;
    CFG_PN : Bool;
    CFG_X050_7 : Bool;
    CFG_TH_CTR_Single : Bool;
    CFG_SW_CTR_Single : Bool;
    CFG_TRIP_CTR_Single : Bool;
    CFG_Speed_User : Bool;
    CFG_mBar : Bool;
    CFG_SW_CTR_OnOff : Bool;
    CFG_Plug_CTR_Single : Bool;
    CFG_X051_7 : Bool;
    CFG_Min_Speed_Hz : Int;
    CFG_Max_Speed_Hz : Int;
    CFG_mBar_Type : Byte;
    CFG_B57 : Byte;
    CFG_Max_mBar : Int;
    CFG_EOLO_Zone : Bool;
    CFG_TableTop_Zone : Bool;
    CFG_Pack_Zone : Bool;
    CFG_VIS_Sp_User_Step200 : Bool;
    CFG_X060_4 : Bool;
    CFG_X060_5 : Bool;
    CFG_X060_6 : Bool;
    CFG_X060_7 : Bool;
    CFG_MPrew : Int;
    CFG_MNext : Int;
    CFG_DBExternal1 : Int;
    CFG_DBExternal2 : Int;
    CFG_Vis_Fix_00 : Bool;
    CFG_VIS_Fix_01 : Bool;
    CFG_VIS_Fix_02 : Bool;
    CFG_VIS_Fix_03 : Bool;
    CFG_VIS_Fix_04 : Bool;
    CFG_VIS_Fix_05 : Bool;
    CFG_VIS_Fix_06 : Bool;
    CFG_VIS_Fix_07 : Bool;
    CFG_VIS_Sync_00 : Bool;
    CFG_VIS_Sync_01 : Bool;
    CFG_VIS_Sync_02 : Bool;
    CFG_VIS_Sync_03 : Bool;
    CFG_VIS_Sync_04 : Bool;
    CFG_VIS_Sync_05 : Bool;
    CFG_VIS_Sync_06 : Bool;
    CFG_VIS_Sync_07 : Bool;
    CFG_VIS_Timer_00 : Bool;
    CFG_VIS_Timer_01 : Bool;
    CFG_VIS_Timer_02 : Bool;
    CFG_VIS_Timer_03 : Bool;
    CFG_VIS_Timer_04 : Bool;
    CFG_VIS_Timer_05 : Bool;
    CFG_VIS_Timer_06 : Bool;
    CFG_VIS_Timer_07 : Bool;
    CFG_VIS_SA : Bool;
    CFG_VIS_SB : Bool;
    CFG_VIS_SC : Bool;
    CFG_VIS_SD : Bool;
    CFG_VIS_BA : Bool;
    CFG_VIS_BB : Bool;
    CFG_VIS_EXTA : Bool;
    CFG_VIS_EXTB : Bool;
    CFG_VIS_SW : Bool;
    CFG_VIS_TH : Bool;
    CFG_VIS_TRIP : Bool;
    CFG_VIS_PAW : Bool;
    CFG_VIS_RUN_FWD : Bool;
    CFG_VIS_RUN_BWD : Bool;
    CFG_VIS_Kspeed : Bool;
    CFG_VIS_PLUG : Bool;
    CFG_VIS_PB_Auto : Bool;
    CFG_VIS_PB_Man : Bool;
    CFG_VIS_PB_Jog : Bool;
    CFG_VIS_PB_Stop : Bool;
    CFG_VIS_PB_Reverse : Bool;
    CFG_VIS_PB_sp_05 : Bool;
    CFG_VIS_PB_sp_06 : Bool;
    CFG_VIS_ManSpeed : Bool;
    CFG_VIS_ACT_Torque : Bool;
    CFG_VIS_ACC_Ramp : Bool;
    CFG_VIS_DEC_Ramp : Bool;
    CFG_VIS_X76_3 : Bool;
    CFG_VIS_X76_4 : Bool;
    CFG_VIS_X76_5 : Bool;
    CFG_VIS_X76_6 : Bool;
    CFG_VIS_X76 : Bool;
    CFG_B77 : Byte;
    CFG_W078 : Int;
    CFG_Add_Signal_SA : UInt;
    CFG_Add_Signal_SB : UInt;
    CFG_Add_Signal_SC : UInt;
    CFG_Add_Signal_SD : UInt;
    CFG_Add_Signal_BA : UInt;
    CFG_Add_Signal_BB : UInt;
    CFG_Add_Signal_EXTA : UInt;
    CFG_Add_Signal_EXTB : UInt;
    CFG_Add_Signal_SW : UInt;
    CFG_Add_Signal_TH : UInt;
    CFG_Add_Signal_TRIP : UInt;
    CFG_Add_Signal_PAW : Int;
    CFG_Add_Signal_RUN_FWD : UInt;
    CFG_Add_Signal_RUN_BWD : UInt;
    CFG_Add_Signal_mBar : Int;
    CFG_Add_Signal_PLUG : Int;
    CFG_Add_Signal_SP02 : Int;
    CFG_DB_Machine : Int;
    CFG_DB_NextMotor : Int;
    CFG_W118 : Int;
    CFG_Stop_Empty : Bool;
    CFG_Stop_Full : Bool;
    CFG_Stop_STBY : Bool;
    CFG_Pressurization : Bool;
    CFG_EOLO_Press_Speed : Int;
    Spare_124 : Array[124..145] of Byte;
    CFG_Motor_N : DInt;
    CFG_Phylosopy_N : Int;
    CFG_Motor_HW_IO : "HW_IO";
    CFG_Node_N : Int;
    CFG_Inverter_Type : Int;
    CFG_W158 : Int;
    CFG_Kspeed_User50Hz : Int;
    CFG_Min_Speed_User : Int;
    CFG_Max_Speed_User : Int;
    CFG_W166 : Int;
    CFG_W168 : Int;
    CFG_EN_mBar_FCT : Bool;
    CFG_EN_mBar_FilterALM : Bool;
    CFG_Isteresi_mBar : Int;
    CFG_Gain_Mbar : Int;
    CFG_Max_Speed_FilterALM : Int;
    CFG_W178 : Int;
    CFG_T_Gain : STRUCT
      S : Bool;
      Q : Bool;
      TW : Int;
      ST : Int;
      ACT : Int;
      W008 : Int;
    END_STRUCT;

    CFG_T_FilterALM : STRUCT
      S : Bool;
      Q : Bool;
      TW : Int;
      ST : Int;
      ACT : Int;
      W008 : Int;
    END_STRUCT;

    IN_PB_Start : Bool;
    IN_PB_Stop : Bool;
    IN_PB_Reset : Bool;
    IN_PB_Silence : Bool;
    IN_X200_4 : Bool;
    IN_X200_5 : Bool;
    IN_X200_6 : Bool;
    IN_X200_7 : Bool;
    IN_KG_PowerON : Bool;
    IN_SW_ManAuto : Bool;
    IN_Cycle_ON : Bool;
    IN_X201_3 : Bool;
    IN_X201_4 : Bool;
    IN_X201_5 : Bool;
    IN_X201_6 : Bool;
    IN_X201_7 : Bool;
    IN_SW_HMI_Auto : Bool;
    IN_SW_HMI_Man : Bool;
    IN_SW_HMI_Jog : Bool;
    IN_SW_HMI_Stop : Bool;
    IN_SW_HMI_Reverse : Bool;
    IN_SW_HMI_sp_05 : Bool;
    IN_SW_HMI_sp_06 : Bool;
    IN_SW_HMI_ManSpeed : Bool;
    IN_SW_HMI_sp_08 : Bool;
    IN_SW_HMI_VVFix1 : Bool;
    IN_SW_HMI_VVFix2 : Bool;
    IN_SW_HMI_VVFix3 : Bool;
    IN_SW_HMI_VVFix4 : Bool;
    IN_SW_HMI_VVFix5 : Bool;
    IN_SW_HMI_sp_14 : Bool;
    IN_SW_HMI_sp_15 : Bool;
    IN_HMI_ManSpeed : Int;
    IN_Signal_SA : Bool;
    IN_Signal_SB : Bool;
    IN_Signal_SC : Bool;
    IN_Signal_SD : Bool;
    IN_Signal_BA : Bool;
    IN_Signal_BB : Bool;
    IN_Signal_EXTA : Bool;
    IN_Signal_EXTB : Bool;
    IN_Signal_SW : Bool;
    IN_Signal_TH : Bool;
    IN_Signal_TRIP : Bool;
    IN_Signal_RUN_FWD : Bool;
    IN_Signal_RUN_BWD : Bool;
    IN_Signal_sp_05 : Bool;
    IN_Signal_sp_06 : Bool;
    IN_Signal_PLUG : Bool;
    IN_Signal_sp_08 : Int;
    IN_Signal_PEW_mBar : Int;
    IN_Signal_mBar : Int;
    IN_Motor_DI : "Struct";
    IN_W216 : Int;
    IN_W218 : Int;
    IN_Line_Empty : Bool;
    IN_Line_Full : Bool;
    IN_Line_StandBy : Bool;
    Spare_222 : Array[222..249] of Byte;
    OUT_VFD_Run_FWD : Bool;
    OUT_VFD_Run_BWD : Bool;
    OUT_VFD_Reverse : Bool;
    OUT_VFD_Qstop : Bool;
    OUT_VFD_Reset : Bool;
    OUT_X250_5 : Bool;
    OUT_X250_6 : Bool;
    OUT_EnergySavingON : Bool;
    OUT_VFD_REQ_Speed_Hz : Int;
    OUT_VFD_REQ_Speed_User : Int;
    OUT_VFD_ACT_Sync_Speed : Int;
    OUT_VFD_REQ_Speed_mBar : Int;
    OUT_Motor_DO : "Struct";
    OUT_W262 : Int;
    OUT_W264 : Int;
    OUT_W266 : Int;
    OUT_W268 : Int;
    STATUS_VFD_Run_FWD : Bool;
    STATUS_VFD_Run_BWD : Bool;
    STATUS_VFD_Trip : Bool;
    STATUS_VFD_Warning : Bool;
    STATUS_Ready : Bool;
    STATUS_VFD_Ready : Bool;
    STATUS_VFD_Coasting : Bool;
    STATUS_X270_7 : Bool;
    STATUS_VFD_ACT_Speed_Hz : Int;
    STATUS_VFD_ACT_Speed_Use : Int;
    STATUS_VFD_ACT_Torque : Int;
    STATUS_MainFault_MovigearADV : Byte;
    STATUS_Subfault_MovigearADV : Byte;
    STATUS_W280 : Int;
    STATUS_W282 : Int;
    STATUS_PWR_OFF : Bool;
    STATUS_CYCLE_OFF : Bool;
    STATUS_ALARM : Bool;
    STATUS_AUTO : Bool;
    STATUS_MAN : Bool;
    STATUS_JOG : Bool;
    STATUS_STOP : Bool;
    STATUS_X284_7 : Bool;
    STATUS_X285_0 : Bool;
    STATUS_X285_1 : Bool;
    STATUS_X285_2 : Bool;
    STATUS_X285_3 : Bool;
    STATUS_X285_4 : Bool;
    STATUS_X285_5 : Bool;
    STATUS_X285_6 : Bool;
    STATUS_X285_7 : Bool;
    STATUS_NOTRUN : Bool;
    STATUS_RUN : Bool;
    STATUS_X286_2 : Bool;
    STATUS_X286_3 : Bool;
    STATUS_X286_4 : Bool;
    STATUS_X286_5 : Bool;
    STATUS_X286_6 : Bool;
    STATUS_X286_7 : Bool;
    Spare_288 : Array[288..289] of Byte;
    Alarm_09 : Bool;
    Alarm_10 : Bool;
    Alarm_11 : Bool;
    Alarm_12 : Bool;
    Alarm_13 : Bool;
    Alarm_14 : Bool;
    Alarm_15 : Bool;
    Alarm_16 : Bool;
    Alarm_01 : Bool;
    Alarm_02 : Bool;
    Alarm_03 : Bool;
    Alarm_04 : Bool;
    Alarm_05 : Bool;
    Alarm_06 : Bool;
    Alarm_07 : Bool;
    Alarm_08 : Bool;
    Spare_292 : Array[292..299] of Byte;
    M_Power_ON : Bool;
    M_Cycle_ON_AUTO : Bool;
    M_Cycle_ON_MAN : Bool;
    M_W302 : Int;
    M_W304 : Int;
    M_W306 : Int;
    M_W308 : Int;
    M_Delay_Cycle_ON_Auto : STRUCT
      S : Bool;
      Q : Bool;
      TW : Int;
      ST : Int;
      ACT : Int;
      W008 : Int;
    END_STRUCT;

    Spare_320 : Array[320..349] of Byte;
    REQ_EN_Run : Bool;
    REQ_Start_FWD : Bool;
    REQ_Start_BWD : Bool;
    REQ_QStop : Bool;
    REQ_X350_4 : Bool;
    REQ_X350_5 : Bool;
    REQ_X350_6 : Bool;
    REQ_X350_7 : Bool;
    REQ_X351_0 : Bool;
    REQ_X351_1 : Bool;
    REQ_X351_2 : Bool;
    REQ_X351_3 : Bool;
    REQ_X351_4 : Bool;
    REQ_X351_5 : Bool;
    REQ_X351_6 : Bool;
    REQ_X351_7 : Bool;
    REQ_W352 : Int;
    REQ_Master_Speed_Sync : Int;
    REQ_W356 : Int;
    REQ_Speed_Fix_00_NU : Bool;
    REQ_Speed_Fix_01 : Bool;
    REQ_Speed_Fix_02 : Bool;
    REQ_Speed_Fix_03 : Bool;
    REQ_Speed_Fix_04 : Bool;
    REQ_Speed_Fix_05 : Bool;
    REQ_Speed_Fix_06_NU : Bool;
    REQ_Speed_Fix_07_NU : Bool;
    REQ_Speed_Sync_00_NU : Bool;
    REQ_Speed_Sync_01 : Bool;
    REQ_Speed_Sync_02 : Bool;
    REQ_Speed_Sync_03 : Bool;
    REQ_Speed_Sync_04 : Bool;
    REQ_Speed_Sync_05 : Bool;
    REQ_Speed_Sync_06_NU : Bool;
    REQ_Speed_Sync_07_NU : Bool;
    REQ_T01 : STRUCT
      S : Bool;
      Q : Bool;
      TW : Int;
      ST : Int;
      ACT : Int;
      W008 : Int;
    END_STRUCT;

    REQ_T02 : STRUCT
      S : Bool;
      Q : Bool;
      TW : Int;
      ST : Int;
      ACT : Int;
      W008 : Int;
    END_STRUCT;

    REQ_T03 : STRUCT
      S : Bool;
      Q : Bool;
      TW : Int;
      ST : Int;
      ACT : Int;
      W008 : Int;
    END_STRUCT;

    REQ_T04 : STRUCT
      S : Bool;
      Q : Bool;
      TW : Int;
      ST : Int;
      ACT : Int;
      W008 : Int;
    END_STRUCT;

    REQ_T05 : STRUCT
      S : Bool;
      Q : Bool;
      TW : Int;
      ST : Int;
      ACT : Int;
      W008 : Int;
    END_STRUCT;

  END_STRUCT;

END_VAR

VAR_TEMP
  RetVal : Int;
  MotorNumber : Int;
  DBNumber : Int;
END_VAR

BEGIN

  // Network 1: INIT Configuration (Original Language: SCL)

  // SCL extraction failed: StructuredText node not found.

  // Network 2:  (Original Language: LAD)

  // Network 2 has no logic elements.

  // Network 3: EN run (Original Language: LAD)

  "Motor"."REQ_EN_Run" := "M0.1";

  // Network 4: REQ Auto RUN (Original Language: LAD)

  "Motor"."REQ_Start_FWD" := TRUE;

  // Network 5: Request Speed Fix 01 (Original Language: LAD)

  "Motor"."REQ_Speed_Fix_01" := "M0.1";

  // Network 6: INIT Configuration (Original Language: SCL)

  // SCL extraction failed: StructuredText node not found.

END_FUNCTION
