Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/MC.m4

raw
1 .PS
2 # MC.m4
3 cct_init
4
5 MC: [
6 dv = dimen_*0.6
7 dh = dimen_*0.4
8 backup = dimen_/6
9
10 for i=1 to 3 do {{
11 if i==2 then { Input: dot } else { line up (2-i)*dv }
12 source(right_ dimen_,AC); llabel(,,sprintf("$v_{\char%g}$",96+i))
13 resistor(right_ dimen_ from Here-(backup/2,0)); if i==1 then { llabel(,R_i)}
14 inductor(right_ dimen_ from Here-(backup,0),W); if i==1 then { llabel(,L_i)}
15 line right_ i*dh; b_current(sprintf("\strut$i_{\char%g}$",96+i)); dot
16 { line down (3-i)*dv; capacitor(down_ dimen_)
17 if i==1 then { rlabel(,C_i) }
18 if i==2 then { dot(ifgpic(at last line.end)) } \
19 else { line ifgpic(from last line.end) right (2-i)*dh }
20 }
21 line right 3*dh; dot
22 E: Here+((3-i)*dh+dimen_*3/2,(4-2*i)*dv)
23 for j=1 to 3 do {{
24 line up (6-j*3)*dv then right (3-i)*dh
25 switch(right_ E.x-Here.x)
26 llabel(,,sprintf("$S_{\char%g\char%g}$",96+i,64+j))
27 if i==2 then { dot } else { line down (2-i)*dv }
28 }}
29 line from E right dh then down E.y-Here.y
30 arrow right dimen_/2 ; { sprintf("\strut$i_{\char%g}\quad$",64+i) above }
31 resistor(right_ dimen_ from Here-(arrowht/2,0)); if i==1 then {llabel(,R_o)}
32 inductor(right_ dimen_ from Here-(backup,0),W); if i==1 then {llabel(,L_o)}
33 source(right_ dimen_,AC); llabel(sprintf("$v_{\char%g}$",64+i))
34 if i==2 then { Output: dot } else { line down (2-i)*dv }
35 }}
36 ]
37
38 Three: [
39 gapht = 4*dimen_
40 dv = dimen_*0.6
41 dh = dimen_*5/6
42 define(`swfet',`mosfet(`$1',,dMEDSuBQPy)')
43 define(`swpair',`[ up_
44 BS: swfet(up_ dimen_); { "`$1'" at BS.D-(0,2bp__) rjust }
45 L: line up_ gapht-2*dimen_ from BS.D
46 TS: swfet(up_ dimen_) with .S at Here; { "`$2'" at TS.S+(0,2bp__) rjust }
47 T: TS.D
48 B: BS.S
49 C: L.c
50 ]')
51
52 V1: gap(up_ gapht,1,A); { "$V_1$" at last arrow.c rjust }
53 line right_ dimen_/2
54 { C1: capacitor(down_ to (Here,V1.start)); llabel(C_1) }
55 for_(1,3,1,`
56 line right_ dimen_ ifelse(m4x,1,,*5/4)
57 {SP1`'m4x: swpair(S1`'eval(m4x+3),S1`'m4x) with .T at Here
58 dot(at last [].C + (0,(2-m4x)*dh))
59 line right_ (3-m4x)*dimen_*5/4 + dimen_/4
60 inductor(right_ dimen_,L); llabel(,L_{1\char`'eval(64+m4x)})
61 line down_ (2-m4x)*dh*2/3
62 pushdef(`dimen_',dimen_*1.2) inductor(right_ dimen_*3/4) popdef(`dimen_')
63 line down_ (2-m4x)*dh/3
64 M: move right_ dimen_/8
65 line up_ (2-m4x)*dh/3
66 pushdef(`dimen_',dimen_*1.2) inductor(right_ dimen_*3/4) popdef(`dimen_')
67 line up_ (2-m4x)*dh*2/3
68 inductor(right_ dimen_,L); llabel(,L_{2\char`'eval(64+m4x)})
69 line right_ dimen_/8+(m4x-1)*dh*5/4 + dimen_/4
70 dot
71 SP2`'m4x: swpair(S2`'eval(m4x+3),S2`'m4x) with .C at Here+(0,(m4x-2)*dh) }
72 ')
73 "$T_r$" at M.c+(0,dimen_*2/3)
74 line from V1.start to SP13.B
75 line from SP21.B to SP23.B+(dh*3/4,0)
76 { C2: capacitor(up_ to (Here,V1.end)); llabel(,,C_2) }
77 line right_ dimen_/2
78 gap(up_ gapht,1,A); { "$V_2$" at last arrow.c ljust }
79 line to SP21.T chop dotrad_ chop 0
80
81 ] with .nw at MC.sw+(0,-0.2)
82 .PE