summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/svg/pwrsupplySVG.m4
blob: 843c6660b5e20673f0c7b5ff39f938c224f56e05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.PS
# Pwrsupply.m4
cct_init
ifdef(`m4pco',`resetrgb')
  linewid = linewid*1.2

  down_
T:transformer
  line left_ elen_/4 from T.P1
  rgbdraw(0,0,255,fuse(left_ elen_/3,D))
  reversed(`switch')
  gap(down_ to (Here,T.P2))
  { fuse(right_ 2*dimen_/5 at last []) }
  line to T.P2
  blen = dimen_/2
W: T.TS+(dimen_,0)
N: W+(blen,blen)
S: W+(blen,-blen)
E: S+(blen,blen)
  diode(from W to N)
  diode(from S to E)
G:gap(from E+(dimen_*4/3,0) down_ (E.y-S.y)*5/4); llabel("+" wid 0.1*scale,,-)
C:capacitor(down_ G.start.y-G.end.y from 0.5 between E and G.start,C)

setrgb(255,0,0)
  line from T.S1 to (T.S1,N); line to N
  dot
  diode(to E); dot
  line from E to G.start; dot
  dot(at C.start)
resetrgb

setrgb(0,255,0,,D)
  dot(at C.end)
  dot(at G.end)
  ground
  line to (W,Here); line to W; dot
  diode(to S); dot
  line to (T.S2,Here); line to T.S2
resetrgb

.PE