FB_CTRL_PI_PID

FB_CTRL_PI_PID 1:

The function block provides a cascaded PI-PID controller in the functional diagram. Internally, this function block uses the FB_CTRL_PI, FB_CTRL_LIMITER and FB_CTRL_PID transfer elements.

Transfer function of the PI element

FB_CTRL_PI_PID 2:

Transfer function of the PID-element

FB_CTRL_PI_PID 3:

Functional diagram for the cascaded transfer element

FB_CTRL_PI_PID 4:

FB_CTRL_PI_PID 5: VAR_INPUT

VAR_INPUT
    fSetpointValue           : FLOAT;
    fActualValueOuterLoop    : FLOAT;
    fActualValueInnerLoop    : FLOAT;
    fPreControl              : FLOAT;
    fManSyncValueInnerLoop   : FLOAT;
    bSyncInnerLoop           : BOOL;
    eModeInnerLoop           : E_CTRL_MODE;
    bHoldInnerLoop           : BOOL;
    fManSyncValueOuterLoop   : FLOAT;
    bSyncOuterLoop           : BOOL;
    eModeOuterLoop           : E_CTRL_MODE;
    bHoldOuterLoop           : BOOL;
END_VAR

Name

Type

Description

fSetpointValue

FLOAT

Setpoint of the controlled variable

fActualValueOuterLoop

FLOAT

The actual value of the controlled variable that is fed back to the PI controller of the outer control loop.

fActualValueInnerLoop

FLOAT

The actual value of the controlled variable that is fed back to the PID controller of the inner control loop.

fPreControl

FLOAT

Pre-control that is connected behind the PI controller.

fManSyncValueInnerLoop

FLOAT

Input, to whose value it is possible to set the internal state of the PID-element (the inner control loop).

bSyncInnerLoop

BOOL

A rising edge at this input sets the PID-element (the inner control loop) to the value "fManSyncValueInnerLoop".

eModeInnerLoop

E_CTRL_MODE

Input that specifies the operation mode of the PID-element (the inner control loop).

bHoldInnerLoop

BOOL

A TRUE at this input holds the internal state of the PID-element (the inner control loop) constant at the current value.

fManSyncValueOuterLoop

FLOAT

Input, to whose value it is possible to set the internal state of the PI element (the outer control loop).

bSyncOuterLoop

BOOL

A rising edge at this input sets the PI element (the outer control loop) to the value "fManSyncValueOuterLoop".

eModeOuterLoop

E_CTRL_MODE

Input that specifies the operation mode of the PI element (the outer control loop).

bHoldOuterLoop

BOOL

A TRUE at this input holds the internal state of the PI element (the outer control loop) constant at the current value.

FB_CTRL_PI_PID 6: VAR_OUTPUT

VAR_OUTPUT
    fOut                   : FLOAT;
    eStateInnerLoop        : E_CTRL_STATE;
    bARWactiveInnerLoop    : BOOL;
    eErrorIdInnerLoop      : E_CTRL_ERRORCODES;
    bErrorInnerLoop        : BOOL;
    eStateOuterLoop       
 : E_CTRL_STATE;
    bARWactiveOuterLoop    : BOOL;
    eErrorIdOuterLoop      : E_CTRL_ERRORCODES;
    bErrorOuterLoop        : BOOL;
END_VAR

Name

Type

Description

fOut

FLOAT

Output of the PI-PID-element

eStateInnerLoop

E_CTRL_STATE

State of the internal PID-element (inner control loop)

bARWactive
InnerLoop

BOOL

A TRUE at this output indicates that the output of the PID-element (the inner control loop) is being restricted.

eErrorIdInnerLoop

E_CTRL_ERROR
CODES

Returns the error number of the PID-element (the inner control loop) when the bError output is set.

bErrorInnerLoop

BOOL

Is set to TRUE as soon as an error occurs in the PID-element (the inner control loop).

eStateOuterLoop

E_CTRL_STATE

State of the internal PI element (outer control loop)

bARWactiveOuterLoop

BOOL

A TRUE at this output indicates that the PI element's (the outer control loop) output is being restricted.

eErrorIdOuterLoop

E_CTRL_ERRORCODES

Returns the error number of the PI element (the outer control loop) when the bError output is set.

bErrorOuterLoop

BOOL

Is set to TRUE as soon as an error occurs in the PI element (the outer control loop).

VAR_IN_OUT

VAR_IN_OUT
    stParams        : ST_CTRL_PI_PID_PARAMS;
END_VAR

Name

Type

Description

stParams

ST_CTRL_PI_PID_PARAMS

Parameter structure of the PI-PID-element

stParams consists of the following elements:

TYPE
ST_CTRL_PI_PID_PARAMS :
STRUCT
    tCtrlCycleTime         : TIME := T#0ms;
    tTaskCycleTime         : TIME := T#0ms;
    fKp_OuterLoop          : FLOAT := 0;
    tTn_OuterLoop          : TIME := T#0s;
    fMaxLimit_OuterLoop    : FLOAT := 1E38;
    fMinLimit_OuterLoop    : FLOAT := -1E38;
    fKp_InnerLoop          : FLOAT := 0;
    tTn_InnerLoop          : TIME := T#0ms;
    tTv_InnerLoop          : TIME := T#0ms;
    tTd_InnerLoop          : TIME := T#0ms;
    fMaxLimit_InnerLoop    : FLOAT := 1E38;
    fMinLimit_InnerLoop    : FLOAT := -1E38;
END_STRUCT
END_TYPE

Name

Type

Description

tCtrlCycleTime

TIME

Cycle time with which the control loop is processed. This must be greater than or equal to the TaskCycleTime. The function block uses this input value to calculate internally whether the state and the output values have to be updated in the current cycle.

tTaskCycleTime

TIME

Cycle time with which the function block is called. If the function block is called in every cycle this corresponds to the task cycle time of the calling task.

fKp_OuterLoop

FLOAT

Controller amplification / controller coefficient of the PI element (outer control loop)

tTn_OuterLoop

TIME

Integral action time of the internal PI element (outer control loop). The I-component is deactivated if this is parameterized as T#0s.

fMaxLimit_OuterLoop

FLOAT

Upper limit at which integration in the PID-element is halted and to which the output is limited (ARW measure). Reaching this limit is indicated by a TRUE at the bARWactiveOuterLoop output.

fMinLimit_OuterLoop

FLOAT

Lower limit at which integration in the PID-element is halted and to which the output is limited (ARW measure). Reaching this limit is indicated by a TRUE at the bARWactiveOuterLoop output.

fKp_InnerLoop

FLOAT

Controller amplification / controller coefficient of the PID element (inner control loop)

tTn_InnerLoop

TIME

Integral action time of the PID-element (inner control loop). The I-component is deactivated if this is parameterized as T#0s.

tTv_InnerLoop

TIME

Derivative action time of the PID-element (inner control loop). The D-component is deactivated if this is parameterized as T#0s.

tTd_InnerLoop

TIME

Damping time of the PID-element (inner control loop)

fMaxLimit_InnerLoop

FLOAT

Upper limit at which integration in the PID-element is halted and to which the output is limited (ARW measure). Reaching this limit is indicated by a TRUE at the bARWactiveInnerLoop output.

fMinLimit_InnerLoop

FLOAT

Lower limit at which integration in the PID-element is halted and to which the output is limited (ARW measure). Reaching this limit is indicated by a TRUE at the bARWactiveInnerLoop output.