Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VRMS = 10 'Secondary Winding RMS Voltage
- VA = 18 'Reactive power of PSU
- f = 50 'Frequency Hz
- I = 750 / 1E3 'mA / 1E3
- C = 2200 / 1E6 'Smoothing Capacitance uF / 1E6
- vDrop = 0.9 'Estimated voltage drop of a rectifier diode at rated current
- PI = 3.14159
- SCREEN 12
- w = 640: h = 480
- 'draw axes (5v separation)
- FOR V = -15 TO 15 STEP 5
- y = h / 2 - V * 8
- LINE (0, y)-(w, y), 8
- NEXT
- LINE (0, h / 2)-(w, h / 2), 7
- dt = 1E-6
- FOR t = 0 TO 1 STEP dt
- vt = VRMS * SQR(2) * SIN(2 * PI * t * f)
- Ir = ABS(VA / vt)
- VR = ABS(vt) - vDrop * 2: IF VR < 0 THEN VR = 0 'full wave rectifier
- 'VR = vt - vDrop: IF VR < 0 THEN VR = 0 'half wave rectifier
- Q = Q - I * dt: IF Q < 0 THEN Q = 0
- IF vc < VR THEN Q = Q + Ir * dt
- vc = Q / C
- PSET (t * w * 20, h / 2 - vt * 8), 9 'no-load unrectified (blue)
- PSET (t * w * 20, h / 2 - VR * 8), 12 'no-load rectified (red)
- PSET (t * w * 20, h / 2 - vc * 8), 14 'loaded output voltage (yellow)
- IF t > .5 THEN
- IF vc > vcmax THEN vcmax = vc
- IF vc < vcmin THEN vcmin = vc
- ELSE
- vcmin = 1000: vcmax = 0
- END IF
- NEXT
- PRINT "Linear PSU simulator"
- PRINT "Rated Voltage : "; VRMS; "V"
- PRINT "PSU Reactive Power : "; VA; "VA"
- PRINT "Load Current : "; I * 1000; "mA"
- PRINT "Smoothed voltage : "; vcmin; "->"; vcmax
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement