FB_BA_PWM
The function block FB_BA_PWM calculates from an analog input signal rIn (0...100 %, internally fixed) and the period duration nPrd [s] a switch-on and a switch-off time fActTiOnand fActTiOff [s].
The following relationships apply:
- 100% at the input of a switch-on time fActTiOn of the total period nPrd and a switch-off time fActTiOff of 0 s
- 0 % at the input of a switch-on time fActTiOn of 0 s and a switch-off time fActTiOff of the total period duration nPrd.
In addition, there is the possibility to limit the switching time downwards via nMinSwiTi [s] to avoid damage to drives by too short actuating pulses. This behavior is only valid for 0> fIn >100!
If fIn = 0 or 100, the output bQ remains deleted or set. After the period time has elapsed, the current input signal is evaluated again. If it is still set to 0 or 100, there is no change of state of bQ.
Switching characteristics
- A FALSE signal at input bEn disables the function block and sets bQ to FALSE. Only the switch-on and switch-off times are continuously calculated and displayed at the outputs fActTiOn /fActTiOff [s].
- A rising edge at input bEn enables the function block: It will initially jump to a decision step. Depending on the previous state of the switching output bQ, the switching step is now accessed. However, if the input fIn is set to 0, an immediate jump occurs to the Off step (bQ=FALSE), or to the On step if fIn=100 (bQ=TRUE), irrespective of the previous state of bQ. The minimum switching time is deactivated for these two cases.
- A countdown timer with the current calculated starting value runs in the respective active step (ON or OFF), which is based on the pulse/pause ratio. The on- or off-step is completed with the calculated time, irrespective of whether the pulse/pause ratio changes in the meantime. The respective countdown is displayed at the outputs nRemTiOn / nRemTiOff in full seconds.
- Completion of the on- or off-step is followed by a jump back to the decision step (point 2).
Inputs
VAR_INPUT
bEn : BOOL;
fIn : REAL;
nPrd : UDINT;
nMinSwiTi : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
bEn | BOOL | Activation of pulse width modulation. |
fIn | REAL | Input signal, internally limited to 0...100%. |
nPrd | UDINT | Period time[s]. Internally limited to a minimum value of 0. |
nMinSwiTi | UDINT | Minimum switch-on time [s], to avoid too short pulses. Internally limited to values between 0 and nPrd. |
Outputs
VAR_OUTPUT
bQ : BOOL;
bLmtSwiTi : BOOL;
fActTiOn : REAL;
fActTiOff : REAL;
nRemTiOn : UDINT;
nRemTiOff : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
bQ | BOOL | PWM output. |
bLmtSwiTi | BOOL | Information output to indicate that the input signal is so low that the minimum switch-on time is used as limit. |
fActTiOn | REAL | Information output: calculated switch-on time [s]. |
fActTiOff | REAL | Information output: calculated switch-off time [s]. |
nRemTiOn | UDINT | Switch-on timer countdown [s]. |
nRemTiOff | UDINT | Switch-off timer countdown [s]. |
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.22 | Tc3_BA2 from v5.2.5.0 |