home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / MATH / VISSIM.ZIP / PWM_EX.VSM < prev    next >
Text File  |  1994-02-25  |  5KB  |  162 lines

  1. ; VisSim Block Diagram Format (VBDF)
  2. ; Copyright (C) 1989-1994 Visual Solutions
  3. PV=1.500
  4. PS=0
  5. PE=1.5
  6. PP=0.002
  7. PI=170
  8. PX=0.002
  9. PN=1e-006
  10. PL=5
  11. PT=1e-005
  12. Pn=-9,6,16,"Times New Roman"
  13. Pc=47
  14. Po=0.01,50,664
  15. PD=800x600
  16. Pf=0x0
  17. Pr="b0=2,1,0,7,544;b1=19,-1,2,0,784;b2=18,-1,0,0,800"
  18. Ps=1560,0,0,1065,0,0
  19. Pd=17
  20. PM=1,1,1,1
  21. N.1="sinusoid"(0,6,1)*3x25
  22. N.2="plot"*47x21*79x33
  23. pt="PWM Response"
  24. px="Time (sec)"
  25. pax=0
  26. pf=H
  27. pf=F
  28. pb=3,-1
  29. pbx=1.5,0
  30. pbY=0,0
  31. pbX=0,0
  32. pc=512
  33. pm=10
  34. pb.0=0.7,0
  35. pL.0="Input signal"
  36. pb.1=1,1
  37. pb.2=0,0
  38. pL.2="Output PWM signal"
  39. pb.3=0,0
  40. N.3="summingJunction"*11x23
  41. N.4="const"(0)*3x23
  42. N.5="comment"*10x2*102x48<M>
  43. C="Generation of pulse width modulation requires three functions;
  44.  
  45.     1.  Sample and hold circuit
  46.     2.  Precision ramp voltage generator
  47.     3.  Comparator
  48.  
  49. Operation:
  50.     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).
  51.  
  52. Operation Notes:
  53.     1.  set PEAK RAMP AMPLITUDE GAIN to at least 1.1 times the maximum amplitude range of the input signal.
  54.     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.
  55.     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.
  56. "
  57. N.6="sampleHold"(0)*26x31<M>
  58. N.7="variable"*2x26<M>
  59. n=":PWM trigger"
  60. N.8="Compound"*27x32#1,1<C>
  61. n="PWM"
  62. Ms=1560,0,0,1065,0,0
  63. N.9="step"(0,-1)*11x45<M>
  64. N.10="resetIntegrator"(0,0)*21x45<M>
  65. N.11="const"(0)*12x49<M>
  66. N.12="variable"*1x47<M>
  67. n=":PWM trigger"
  68. N.13="summingJunction"*66x32<M>
  69. N.14="variable"*56x23<M>
  70. n=":Comparator reference level"
  71. N.15="summingJunction"*85x31<M>
  72. N.16=">="*109x32<M>
  73. N.17="const"(0)*100x35<M>
  74. N.18="/"*36x47<M>
  75. N.19="variable"*21x54<M>
  76. n=":pwm dt"
  77. N.20="Compound"*100x4<MC>
  78. n="Push for Info"
  79. Ms=1560,0,0,1065,0,0
  80. N.21="wireLabel"*100x1<M>
  81. n="PWM Model"
  82. N.22="variable"*85x58<M>
  83. n=":Comparator reference level"
  84. N.23="const"(4)*76x58<M>
  85. N.24="const"(0.1)*76x61<M>
  86. N.25="variable"*85x61<M>
  87. n=":pwm dt"
  88. N.26="variable"*85x56<M>
  89. n=":peak ramp amplitude gain"
  90. N.27="const"(5)*76x56<M>
  91. N.28="wireLabel"*87x52<M>
  92. n="Parameters"
  93. N.29="variable"*39x8<M>
  94. n=":PWM trigger"
  95. N.30="Compound"*18x8#1,1<MC>
  96. n="PULSE TRAIN"
  97. Ms=695,0,0,290,0,0
  98. N.31="ramp"(0,1)*14x24<M>
  99. N.32="sin"*73x32<M>
  100. N.33="/"*41x31<M>
  101. N.34="gain"(3.14159)*55x32<M>
  102. N.35="crossDetect"(0)*91x32<M>
  103. N.36="wireLabel"*12x21<M>
  104. n="TIME"
  105. N.37="wireLabel"*3x35<M>
  106. n="TIME BETWEEN PULSES"
  107. N.38="wireLabel"*115x35<M>
  108. n="PULSES"
  109. N.39="comment"*36x1*48x12<M>
  110. C="PULSE TRAIN GENERATES ON/OFF PULSES AT SETTABLE (VARIABLE) TIMES"
  111. N.40="variable"*3x8<M>
  112. n=":pwm dt"
  113. N.41="wireLabel"*2x35<M>
  114. n="x(t)"
  115. N.42="wireLabel"*119x29<M>
  116. n="x(pwm)"
  117. N.43="*"*57x40<M>
  118. N.44="variable"*19x40<M>
  119. n=":peak ramp amplitude gain"
  120. N.45="summingJunction"*45x48<M>
  121. N.46="const"(1)*38x52<M>
  122. N.47="comment"*1x1*49x5
  123. C="This block diagram simulates the Pulse Width Modulation  (PWM) of a sinusoidal input signal."
  124. I.2.i1=3.o1
  125. I.2.i2=8.o1
  126. I.3.i1=4.o1
  127. I.3.i2=1.o1
  128. I.6.i1=7.o1
  129. I.6.i2=8.i1
  130. G.8=6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,40,41,42,43,44,45,46,
  131. I.8.o1=16.o1
  132. I.8.i1=3.o1
  133. I.10.i1=9.o1
  134. I.10.i2=12.o1
  135. I.10.i3=11.o1
  136. I.13.i1=6.o1
  137. I.13.i2=43.o1
  138. f15.1.i=-
  139. I.15.i1=14.o1
  140. I.15.i2=13.o1
  141. I.16.i1=15.o1
  142. I.16.i2=17.o1
  143. I.18.i1=10.o1
  144. I.18.i2=19.o1
  145. G.20=5,
  146. I.22.i1=23.o1
  147. I.25.i1=24.o1
  148. I.26.i1=27.o1
  149. I.29.i1=30.o1
  150. G.30=31,32,33,34,35,36,37,38,39,
  151. I.30.o1=35.o1
  152. I.30.i1=40.o1
  153. I.32.i1=34.o1
  154. I.33.i1=31.o1
  155. I.33.i2=30.i1
  156. I.34.i1=33.o1
  157. I.35.i1=32.o1
  158. I.43.i1=44.o1
  159. I.43.i2=45.o1
  160. I.45.i1=18.o1
  161. I.45.i2=46.o1
  162.