C="Generation of pulse width modulation requires three functions;
1. Sample and hold circuit
2. Precision ramp voltage generator
3. Comparator
Operation:
The input signal, x(t), is a time varying signal with known max and min amplitude and frequency bandwidth. On input to the PWM routine, x(t) is passed through a S/H circuit to produce a piecewise linear x(t) approximation designated as x(k). A ramp generator output producing a precision ramp voltage which has a peak to peak amplitude slightly larger than the maximum amplitude range of the input signal is added to x(k). The peak to peak amplitude is controlled by the PEAK RAMP AMPLITUDE GAIN which should be set to 1.1 times the maximum amplitude range of the input signal. This sum is then compared with a fixed reference value (the COMPARATOR REFERENCE LEVEL). When the sum is greater than the comparator reference level, the output PWM pulse is HIGH (1), when the sum is less than the comparator reference level, the output PWM pulse is LOW (0).
Operation Notes:
1. set PEAK RAMP AMPLITUDE GAIN to at least 1.1 times the maximum amplitude range of the input signal.
2. select COMPARATOR REFERENCE LEVEL such that there is always an intersection with the sum of the S/H circuit and the ramp voltage. This will require one or more test runs using the desired input signal. If this is not possible, INCREASE the PEAK RAMP AMPLITUDE GAIN.
3. select the PWM update time (PWM DT) to a value less than 1/2 the max period of the input signal, x(t) - The Nyquist frequency.
"
N.6="sampleHold"(0)*26x31<M>
N.7="variable"*2x26<M>
n=":PWM trigger"
N.8="Compound"*27x32#1,1<C>
n="PWM"
Ms=1560,0,0,1065,0,0
N.9="step"(0,-1)*11x45<M>
N.10="resetIntegrator"(0,0)*21x45<M>
N.11="const"(0)*12x49<M>
N.12="variable"*1x47<M>
n=":PWM trigger"
N.13="summingJunction"*66x32<M>
N.14="variable"*56x23<M>
n=":Comparator reference level"
N.15="summingJunction"*85x31<M>
N.16=">="*109x32<M>
N.17="const"(0)*100x35<M>
N.18="/"*36x47<M>
N.19="variable"*21x54<M>
n=":pwm dt"
N.20="Compound"*100x4<MC>
n="Push for Info"
Ms=1560,0,0,1065,0,0
N.21="wireLabel"*100x1<M>
n="PWM Model"
N.22="variable"*85x58<M>
n=":Comparator reference level"
N.23="const"(4)*76x58<M>
N.24="const"(0.1)*76x61<M>
N.25="variable"*85x61<M>
n=":pwm dt"
N.26="variable"*85x56<M>
n=":peak ramp amplitude gain"
N.27="const"(5)*76x56<M>
N.28="wireLabel"*87x52<M>
n="Parameters"
N.29="variable"*39x8<M>
n=":PWM trigger"
N.30="Compound"*18x8#1,1<MC>
n="PULSE TRAIN"
Ms=695,0,0,290,0,0
N.31="ramp"(0,1)*14x24<M>
N.32="sin"*73x32<M>
N.33="/"*41x31<M>
N.34="gain"(3.14159)*55x32<M>
N.35="crossDetect"(0)*91x32<M>
N.36="wireLabel"*12x21<M>
n="TIME"
N.37="wireLabel"*3x35<M>
n="TIME BETWEEN PULSES"
N.38="wireLabel"*115x35<M>
n="PULSES"
N.39="comment"*36x1*48x12<M>
C="PULSE TRAIN GENERATES ON/OFF PULSES AT SETTABLE (VARIABLE) TIMES"
N.40="variable"*3x8<M>
n=":pwm dt"
N.41="wireLabel"*2x35<M>
n="x(t)"
N.42="wireLabel"*119x29<M>
n="x(pwm)"
N.43="*"*57x40<M>
N.44="variable"*19x40<M>
n=":peak ramp amplitude gain"
N.45="summingJunction"*45x48<M>
N.46="const"(1)*38x52<M>
N.47="comment"*1x1*49x5
C="This block diagram simulates the Pulse Width Modulation (PWM) of a sinusoidal input signal."