FB_BA_MotorStpCtrl
The function block FB_BA_MotorStpCtrl is used to control multi-stage drives. The program always starts at level 1 and, depending on the requirements of nValue, switches step by step to the next higher level. Switching up and down into the individual steps is influenced by the 3 time specifications nStepUpDly, nStepDwnDly and nChangOverTime.
In case of a restart or by removing the enable, a restart of the drive is inhibited for the time period of (nOut * nStepDwnDly). This time course is indicated by the output variable nRemRelease. Internally the last active state of nOut is persistently stored for the calculation of the blocking time.
Example
Error handling
The limitation of the input value nNumOfStp is monitored and corrected internally.
nNumOfStp < 1 is adjusted to the value 1 and a detailed description is output via the ErrorDescription property.
nNumOfStp > 9 is adjusted to the value 9 and a detailed description is output via the ErrorDescription property.
In addition, a warning message is output in the Error List window of the TwinCAT programming tool.
The limitation of the input value nValue is monitored and corrected internally.
nValue < 1 is adjusted to the value 1 and via the property ErrorDescription a detailed description is output.
nValue > 9 is adjusted to the value 9 and via the property ErrorDescription a detailed description is output.
In addition, a warning message is output in the Error List window of the TwinCAT programming tool.
Inputs
VAR_INPUT
bEn : BOOL;
nValue : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
bEn | BOOL | General enable of the function block. If bEn is FALSE, then all output variables are FALSE or have the value 0. |
nValue | UDINT | Step to be controlled from 1 to 9. |
nValue | Request |
---|---|
1 | Off |
2 | bStep01 |
3 | bStep02 |
4 | bStep03 |
5 | bStep04 |
6 | bStep05 |
7 | bStep06 |
8 | bStep07 |
9 | bStep08 |
Inputs CONSTANT PERSISTENT
VAR_INPUT CONSTANT PERSISTENT
nStepUpDly : UDINT := 3000;
nStepDwnDly : UDINT := 1000;
nChangOverTime : UDINT := 100;
nNumOfStp : UDINT := 4;
END_VAR
Name | Type | Description |
---|---|---|
nStepUpDly | UDINT | Minimum switch-on time of the respective step [ms]. |
nStepDwnDly | UDINT | Switch-back time or switch-off time of the steps [ms]. |
nChangOverTime | UDINT | Time delay for the changeover phase when switching up [ms] between the steps in order to protect the motor windings. |
nNumOfStp | UDINT | Input of the number of steps required. The input is limited to a range from 1 to 9. |
Outputs
VAR_OUTPUT
nOut : UDINT;
bStep01 : BOOL;
bStep02 : BOOL;
bStep03 : BOOL;
bStep04 : BOOL;
bStep05 : BOOL;
bStep06 : BOOL;
bStep07 : BOOL;
bStep08 : BOOL;
nRemStepUpDly : UDINT;
nRemStepDwnDly : UDINT;
nRemChangOverTime : UDINT;
nRemRelease : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
nOut | UDINT | Output of the currently valid step from 1 to 9. |
bStep0N | BOOL | Output of step N depending on the stepped output signal nOut. |
nRemStepUpDly | UDINT | Remaining time of the minimum switch-on time of the respective step [ms]. |
nRemStepDwnDly | UDINT | Remaining time of the switch-back time or switch-off time of the steps [ms]. |
RemChangOverTime | UDINT | Remaining time of the changeover time when switching up and down [ms]. |
nRemRelease | UDINT | Remaining time of the internal blocking of the function block after a restart or by removing the enable bEn [ms]. |
Properties
Name | Type | Access | Description |
---|---|---|---|
ErrorDescription | T_MaxString | Get | Issues a detailed description of errors, see error handling. |
NumberOfSteps | UDINT | Get | Outputs the current or corrected value of the number of steps. In the error case of nNumOfStp there is a detailed description of the error at error handling. |
Step | STRING | Get | Output of the current step depending on nOut. |
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.22 | Tc3_BA2 from v5.2.5.0 |