FB_BA_PIDControlSequence

PID sequence controller as part of a sequence.
On receipt of the enable bEn = TRUE, the higher-level control block FB_BA_SequenceLinkBase is informed that the sequence controller is ready for operation for sequence control.
The data exchange between the sequence controllers FB_BA_SeqCtrl and the control block FB_BA_SequenceLinkBase takes place via the structure stSeqLink.
![]() | The input variable bHold on the function block FB_BA_SeqCtrl has no function! |
Output value fPresentValue
The function block determines the resulting value at the output fPresentValue depending on the enables bEn and stSequenceLink.bEnSeqLink, the control direction eActionPgm / eActionRm and the sequence number nActvSeqCtrl / nMyNum.
bEn | stSequenceLink.bEnSeqLink | eActionPgm/eActionRm | nActvSeqCtrl/nMyNum | fPresentValue |
|---|---|---|---|---|
TRUE | FALSE | E_BA_Action.eReverse |
| fMaxOutputPgm / fMaxOutputRm |
TRUE | FALSE | E_BA_Action.eDirect |
| fMinOutputPgm / fMinOutputRm |
FALSE | FALSE |
|
| 0 |
TRUE | TRUE | E_BA_Action.eReverse | nActvSeqCtrl > nMyNum | fMinOutputPgm / fMinOutputRm |
TRUE | TRUE | E_BA_Action.eReverse | nActvSeqCtrl < nMyNum | fMaxOutputPgm / fMaxOutputRm |
TRUE | TRUE | E_BA_Action.eDirect | nActvSeqCtrl < nMyNum | fMinOutputPgm / fMinOutputRm |
TRUE | TRUE | E_BA_Action.eDirect | nActvSeqCtrl > nMyNum | fMaxOutputPgm / fMaxOutputRm |
TRUE | TRUE |
| nActvSeqCtrl = nMyNum | FB_BA_Loop.fPresentValue |
Error detection
The error messages listed below are detected by FB_BA_SeqCtrl.
The x in the text messages stands for a numerical specification of a sequence controller.
The error messages are output in the TwinCAT 3 development environment in the "Error list" window. This can be activated under the menu item View.
The error texts are output via the properties ErrorParamMaxSeqCtrl and ErrorSeqNumMultiple.
![]() | Global parameter Tc3_BA2.BA_Param.nMaxSeqCtrl < 1 This message is the only one that disables sequence control. |
German | English |
|---|---|
Globaler Parameter Tc3_BA2.BA_Param.nMaxSeqCtrl < 1 | Global parameter Tc3_BA2.BA_Param.nMaxSeqCtrl < 1 |
Sequenznummer nMyNum = x mehrfach vergeben | Sequence number nMyNum = x assigned multiple times |
Syntax
FUNCTION_BLOCK FB_BA_SeqCtrl EXTENDS FB_BA_Loop
VAR_INPUT
nMyNum : UDINT;
END_VAR
VAR_OUTPUT
fE : REAL;
bSeqActv : BOOL;
nActvSeqCtrl : UDINT;
bIsActvSeqCtrl : BOOL;
bErr : BOOL;
END_VAR
VAR_IN_OUT
stSeqLink : ST_BA_SeqLink;
END_VAR
Inputs
Name | Type | Description |
|---|---|---|
nMyNum | UDINT | My number in the sequence. This number may only be present once in a sequence control. An internal limitation only allows values from 1 - XBA_Param.nMaxSeqCtrl. |
Outputs
Name | Type | Description |
|---|---|---|
fE | REAL | Displays the control deviation of the sequence controller. This depends on the control direction of the sequence controller. E_BA_Action.eDirect -> fE = fX-fW E_BA_Action.eReverse -> fE = fW-fX |
bSeqActv | BOOL | The sequence controller is implemented in the control sequence. |
nActvSeqCtrl | UDINT | Number of the active sequence controller. |
bIsActvSeqCtrl | BOOL | Indicates that the sequence controller is the active one in the sequence control. The property IsActvSeqCtrl also displays this message. |
bErr | BOOL | Indicates that an error has been detected. More detailed information is shown in the properties ErrorParamMaxSeqCtrl and SeqNumMultiple. Further explanations on error analysis can be found at Error detection. |
/
Inputs Outputs
Name | Type | Description |
|---|---|---|
stSeqLink | Data and command structure between the individual sequence controllers FB_BA_SeqCtrl and the function block FB_BA_SequenceLinkBase. |
Properties
Name | Type | Access | Description |
|---|---|---|---|
ActvSeqCtrl | UDINT | Get | The property shows the number of the active sequence controller. |
ErrorParamMaxSeqCtrl | Get | The property displays the following text in case of error: "Global parameter Tc3_BA2.BA_Param.nMaxSeqCtrl < 1", see BA_Param.nMaxSeqCtrl. The global parameter must be adjusted in any case, because due to the wrong parameterization the sequence stops. | |
SeqNumMultiple | Get | The property displays the following text in case of error: "Sequence number nMyNum = x assigned multiple times". A check of the displayed sequence number is necessary because it has been assigned several times in the sequence. | |
IsActvSeqCtrl | BOOL | Get | The sequence controller is the active one in the sequence control. |
Requirements
Development environment | Required PLC library |
|---|---|
TwinCAT from v3.1.4024.56 | Tc3_BA2 from v5.4.2.0 |
