Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/dpv/MCDPV.m4

raw
1 .PS
2 #MCDPV.m4
3 cct_init(svg_font(Times,11bp__))
4 textoffset = 3bp__
5
6 MC:[
7 dv = dimen_*0.6
8 dh = dimen_*0.4
9 backup = dimen_/6
10
11 for i=1 to 3 do {{
12 if i==2 then { Input: dot } else { line up (2-i)*dv }
13 source(right_ dimen_,AC)
14 # The pound sign has to be protected from m4
15 llabel(,,sprintf("svg_it(v`'svg_sub(&``#''%g;,66%))",96+i))
16 resistor(right_ dimen_ from Here-(backup/2,0))
17 if i==1 then { llabel(,R`'svg_sub(i))}
18 inductor(right_ dimen_ from Here-(backup,0),W)
19 if i==1 then { llabel(,L`'svg_sub(i))}
20 line right_ i*dh
21 b_current(sprintf("svg_it(i`'svg_sub(&``#''%g;,66%))",96+i)); dot
22 { line down (3-i)*dv; capacitor(down_ dimen_)
23 if i==1 then { rlabel(,C`'svg_it(i)) }
24 if i==2 then { dot } else { line right (2-i)*dh }}
25 line right 3*dh; dot
26 E: Here+((3-i)*dh+dimen_*2,(4-2*i)*dv)
27 for j=1 to 3 do {{
28 line up (6-j*3)*dv then right (3-i)*dh
29 switch(right_ E.x-Here.x)
30 llabel(,,sprintf("svg_it(S`'svg_sub(&``#''%g;&``#''%g;,66%))",96+i,64+j))
31 if i==2 then { dot } else { line down (2-i)*dv }
32 }}
33 line from E right dh then down E.y-Here.y
34 arrow right dimen_/2
35 { sprintf("svg_it(i`'svg_sub(&`#'%g;,66%))",64+i) above }
36 resistor(right_ dimen_ from Here-(arrowht/2,0))
37 if i==1 then {llabel(,R`'svg_sub(o))}
38 inductor(right_ dimen_ from Here-(backup,0),W)
39 if i==1 then {llabel(,L`'svg_sub(o))}
40 source(right_ dimen_,AC)
41 llabel(sprintf("svg_it(v`'svg_sub(&``#''%g;,66%))",64+i))
42 if i==2 then { Output: dot } else { line down (2-i)*dv }
43 }}
44 ]
45
46 Three: [
47 gapht = 4*dimen_
48 dv = dimen_*0.6
49 dh = dimen_*5/6
50 define(`swfet',`mosfet(`$1',,dMEDSuBQPy)')
51 define(`swpair',`[ up_
52 BS: swfet(up_ dimen_); { "`$1'" at BS.D-(0,2bp__) rjust }
53 L: line up_ gapht-2*dimen_ from BS.D
54 TS: swfet(up_ dimen_) with .S at Here; { "`$2'" at TS.S+(0,2bp__) rjust }
55 T: TS.D
56 B: BS.S
57 C: L.c
58 ]')
59
60 V1: gap(up_ gapht,1,A)
61 { "svg_it(V)svg_sub(1)" wid 12bp__ at last arrow.c rjust }
62 line right_ dimen_/2
63 { C1: capacitor(down_ to (Here,V1.start)); llabel(svg_it(C)svg_sub(1)) }
64 for_(1,3,1,`
65 line right_ dimen_ ifelse(m4x,1,,*5/4)
66 {SP1`'m4x: swpair(svg_it(S`'svg_sub(1`'eval(m4x+3))),
67 svg_it(S`'svg_sub(1`'m4x))) with .T at Here
68 dot(at last [].C + (0,(2-m4x)*dh))
69 line right_ (3-m4x)*dimen_*5/4+dimen_/4
70 inductor(right_ dimen_,L)
71 {sprintf("svg_it(L`'svg_sub(1&`#'%g;,70%))",64+m4x) at last [].n+(0,8bp__)}
72 line down_ (2-m4x)*dh*2/3
73 pushdef(`dimen_',dimen_*1.2) inductor(right_ dimen_*3/4) popdef(`dimen_')
74 line down_ (2-m4x)*dh/3
75 M: move right_ dimen_/8
76 line up_ (2-m4x)*dh/3
77 pushdef(`dimen_',dimen_*1.2) inductor(right_ dimen_*3/4) popdef(`dimen_')
78 line up_ (2-m4x)*dh*2/3
79 inductor(right_ dimen_,L)
80 {sprintf("svg_it(L`'svg_sub(2&`#'%g;,70%))",64+m4x) at last [].n+(0,8bp__)}
81 line right_ dimen_/8+(m4x-1)*dh*5/4 + dimen_/4
82 dot
83 SP2`'m4x: swpair(svg_it(S`'svg_sub(2`'eval(m4x+3))),
84 svg_it(S`'svg_sub(2`'m4x))) \
85 with .C at Here+(0,(m4x-2)*dh) }
86 ')
87 "svg_it(T)svg_sub(r)" at M.c+(0,dimen_*2/3)
88 line from V1.start to SP13.B
89 line from SP21.B to SP23.B+(dh*3/4,0)
90 { C2: capacitor(up_ to (Here,V1.end)); llabel(,,svg_it(C`'svg_sub(2))) }
91 line right_ dimen_/2
92 gap(up_ gapht,1,A)
93 { "svg_it(V`'svg_sub(2))" wid 12bp__ at last arrow.c ljust }
94 line to SP21.T chop dotrad_ chop 0
95
96 ] with .nw at MC.sw+(0,-0.2)
97
98 command "</g>" # end font
99 .PE