FB_BA_MotCtl

FB_BA_MotCtl 1:

The template is used to control and regulate a speed-controlled motor.

It mainly consists of a BO and AO object for controlling the motor (frequency converter), a BI object for displaying a fault and a PID controller for speed control. The function block PlantLock collects all safety-relevant faults. The enables and modulation commands are transmitted to the template via the command structure stCmd.

FB_BA_MotCtl 2:

The initialization of the template takes place within the method FB_Init.

Block diagram

FB_BA_MotCtl 3:

Syntax

FUNCTION_BLOCK FB_BA_MotCtl EXTENDS FB_BA_View
VAR_INPUT
  fIn            : REAL;
  stCmd          : ST_BA_Mdlt;
END_VAR
VAR_OUTPUT
  bCmd           : BOOL;
  fMdlt          : REAL;
  bDst           : BOOL;
  eActivePrio    : E_BA_Priority;
END_VAR
VAR_INPUT CONSTANT
  Dst            : FB_BA_BI_Raw;
  Cmd            : FB_BA_BO_Raw;
  Mdlt           : FB_BA_AO_Raw;
  Sp             : FB_BA_AV_Op;
  Ctrl           : FB_BA_Loop;
  PlantLock      : FB_BA_PlantLock;
END_VAR
VAR
  bPrioSfty      : BOOL;
  bPrioCrit      : BOOL;
  PrioSwiVal     : FB_BA_PrioSwi_UDI04;
  MuxCmd         : FB_BA_MMUX_B04;
  MuxMdlt        : FB_BA_MMUX_R04;
  fMax           : REAL;
  fMin           : REAL;
END_VAR

FB_BA_MotCtl 4: Inputs

Name

Type

Description

fIn

REAL

The actual value for the controller Ctrl is connected to the input.

stCmd

ST_BA_Mdlt

The enables and modulation commands are transmitted to the template via the command structure stCmd. The command with the highest priority determines the switching command at the binary output object Cmd and the control command at the analog output object Mdlt.

FB_BA_MotCtl 5: Outputs

Name

Type

Description

bCmd

BOOL

Output of the switch value.

fMdlt

REAL

Current value of the analog output object.

bDst

BOOL

The variable is an evaluation of the lock priorities "Safety" and "Critical" of the project structure and indicates a triggered event.

eActivePrio

E_BA_Priority

Display of the active priority.

FB_BA_MotCtl 6: Inputs CONSTANT

Name

Type

Description

Dst

FB_BA_BI_Raw

Binary input object is used to process a fault.

Cmd

FB_BA_BO_Raw

The binary output object is used to output a switching command and transmit it to the I/O level.

Mdlt

FB_BA_AO_Raw

Current value of the analog output object.

Sp

FB_BA_AV_Op

Entering the setpoint for the PID controller Ctrl.

Ctrl

FB_BA_Loop

PID controller.

PlantLock

FB_BA_PlantLock

The function block PlantLock collects all safety-relevant faults at this level of the project structure and triggers switching commands in the template accordingly.

Variables

Name

Type

Description

bPrioSfty

BOOL

The variable is an evaluation of the "Safety" lock priority of the project structure.

bPrioCrit

BOOL

The variable is an evaluation of the "Critical" lock priority of the project structure.

bPrioSwiVal

FB_BA_PrioSwi_UDI04

The priority switch PrioSwiVal uses the command structure stCmd to determine the modulation command for the multiplexers MuxCmd and MuxMdlt.

MuxCmd

FB_BA_MMUX_B04

The multiplexer MuxCmd determines the current switch value from the command of the priority switch PrioSwiVal. The resulting output is sent to the binary output object Cmd.

MuxMdlt

FB_BA_MMUX_R04

The multiplexer MuxMdlt determines the current control value from the modulation values Ctrl.fPresentValue, fMin, fMax and the modulation command of the priority switch PrioSwiVal. The resulting output is sent to the analog output object Mdlt.

fMax

REAL

Maximum value of the controller, which is output when the modulation command E_BA_MdltCmd.eMax is pending (see E_BA_Mdlt).

fMin

REAL

Minimum value of the controller, which is output when the modulation command E_BA_MdltCmd.eMin is pending (see E_BA_Mdlt).

Requirements

Development environment

Necessary function

TwinCAT from v3.1.4024.35

TF8040 | TwinCAT Building Automation from V5.2.1.0