FB_BA_PWM
The function block calculates switch-on and switch-off times rrActTiOn_sec and rActTiOff_sec [s] from an analog input signal rIn (0..100%, internally limited) and the period udiPrd_sec [s].
The following relationships apply:
- 100% at the input of a switch-on time rActTiOn_sec of the total period udiPrd_sec and a switch-off time rActTiOff_sec of 0 s
- 0% at the input of a switch-on time rActTiOn_sec of 0 s and a switch-off time rActTiOff_sec of the total period udiPrd_sec.
In addition, udiMinSwiTi_sec [s] can be used to set a lower limit for the switching time, in order to prevent damage to drives caused by too short actuating pulses. This behavior is only valid for 0>rIn>100!
If rIn=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 rActTiOn_sec/rActTiOff_sec [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 rIn is set to 0, an immediate jump occurs to the Off step (bQ=FALSE), or to the On step if rIn=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 udiRemTiOn_sec/udiRemTiOff_sec in full seconds.
- Completion of the on- or off-step is followed by a jump back to the decision step (point 2).
VAR_INPUT
bEn : BOOL;
rIn : REAL;
udiPrd_sec : UDINT;
udiMinSwiTi_sec : UDINT;
bEn: Activation of pulse width modulation.
rIn: Input signal, internally limited to 0..100%.
udiPrd_sec: Period time[s]. Internally limited to a minimum value of 0.
udiMinSwiTi_sec: Minimum switch-on time [s], to avoid too short pulses. Internally limited to values between 0 and udiPrd_sec..
VAR_OUTPUT
bQ : BOOL;
bLmtSwiTi : BOOL;
rActTiOn_sec : REAL;
rActTiOff_sec : REAL;
udiRemTiOn_sec : UDINT;
udiRemTiOff_sec : UDINT;
bQ: PWM output.
bLmtSwiTi: Information output to indicate that the input signal is so low that the minimum switch-on time is used as limit.
rActTiOn_sec: Information output: Calculated switch-on time.
rActTiOff_sec: Information output: Calculated switch-off time.
udiRemTiOn_sec: Switch-on timer countdown.
udiRemTiOff_sec: Switch-off timer countdown.
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT from v3.1.4024.7 | Tc3_BA from v1.1.6.0 |