### PWM – Pulse width modulation

Block SymbolLicensing group: STANDARD Function Description
The PWM block implements a pulse width modulation algorithm for proportional actuators. In the general, it is assumed the input signal u ranges in the interval from -1 to +1. The width $L$ of the output pulse is computed by the expression:

$L=\mathtt{\text{pertm}}\ast |\mathtt{\text{u}}|\phantom{\rule{0em}{0ex}},$

where pertm is the modulation time period. If $\mathtt{\text{u}}>\mathtt{\text{0}}$ ($\mathtt{\text{u}}<\mathtt{\text{0}}$), the pulse is generated in the output UP (DN). However, the width of the generated pulses are affected by other parameters of the block. The asymmetry factor asyfac determines the ratio of negative pulses duration to positive pulses duration. The modified pulse widths are given by:

$\begin{array}{cccc}\mathrm{\text{if}}\hfill & \mathtt{\text{u}}>\mathtt{\text{0}}\hfill & \mathrm{\text{then}}\hfill & L\left(\mathtt{\text{UP}}\right):=\left\{\begin{array}{ccc}L\hfill & \mathrm{\text{for}}\hfill & \mathtt{\text{asyfac}}\le 1.0\hfill \\ L∕\mathtt{\text{asyfac}}\hfill & \mathrm{\text{for}}\hfill & \mathtt{\text{asyfac}}>1.0\hfill \end{array}\right\\hfill \\ \mathrm{\text{if}}\hfill & \mathtt{\text{u}}<\mathtt{\text{0}}\hfill & \mathrm{\text{then}}\hfill & L\left(\mathtt{\text{DN}}\right):=\left\{\begin{array}{ccc}L\ast \mathtt{\text{asyfac}}\hfill & \mathrm{\text{for}}\hfill & \mathtt{\text{asyfac}}\le 1.0\hfill \\ L\hfill & \mathrm{\text{for}}\hfill & \mathtt{\text{asyfac}}>1.0\hfill \end{array}\right\\hfill \\ \hfill \end{array}$

Further, if the computed width is less than minimum pulse duration dtime the width is set to zero. If the pulse width differs from the modulation period pertm less than minimum pulse break time btime then width of the pulse is set to pertm. In the case the positive pulse is succeeded by the negative one (or vice versa) the latter pulse is possibly shifted in such a way that the distance between these pulses is at least equal to the minimum off time offtime. If $\mathtt{\text{SYNCH}}=\mathtt{\text{on}}$, then the change of the input value u causes the immediate recalculation of the current pulse widths if a synchronization condition is violated.

Input

 pertm Modulation period length [s]  $\odot$10.0 Double (F64) dtime Minimum width of the output pulse [s]  $\odot$0.1 Double (F64) btime Minimum delay between output pulses [s]  $\odot$0.1 Double (F64) offtime Minimum delay when altering direction [s]  $\odot$1.0 Double (F64) asyfac Asymmetry factor  $\odot$1.0 Double (F64) SYNCH Synchronization flag of the period start Bool off .. Synchronization disabled on ... Synchronization enabled