Debian Codegraph @

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

raw
1 .PS
2 # Csource.m4
3 cct_init(svg_font(sans-serif,11bp__,2bp__))
4 maxpswid = 10
5
6 # The default line separation is a bit small if the top line contains
7 # subscripts, so we space stacked lines explicitly:
8 define(`stbelow',`at last ""-(0,textht*1.5)')
9
10 define(`loffset',`+(textoffset,0)')
11 define(`roffset',`-(textoffset,0)')
12
13 define(`npair',`[define(`m4lr',ifelse(`$1',,l,r))
14 J: mosfet(down_ dimen_,ifelse(`$1',,R,L),uHSDF,E)
15 {["svg_it(Q`'svg_sub(`$2'))" ljust; "2N5464" ljust stbelow]\
16 at J.nw+(ifelse(`$1',,-5bp__,5bp__),textht*0.75)}
17 G: J.G
18 line ifelse(`$1',,right,left) dimen_/4 from J.D
19 Q: bi_tr(up_ dimen_,ifelse(`$1',,L,R),,E) with .B at Here
20 {["svg_it(Q`'svg_sub(`$3'))" m4lr`'just; "2N4239" m4lr`'just stbelow] \
21 at last [].ifelse(`$1',,e,w)}
22 E: Q.E
23 S: dot(at (Q.C,J.S))
24 line from J.S to S then to Q.C ]')
25
26 define(`ppair',`[define(`m4lr',ifelse(`$1',,l,r))
27 J: mosfet(down_ dimen_,ifelse(`$1',,R,L),dHSDF,E)
28 {["svg_it(Q`'svg_sub(`$2'))" ljust; "2N3819" ljust stbelow] \
29 at J.sw+(ifelse(`$1',,0,`4bp__'),-textht*0.6)}
30 G: J.G
31 line ifelse(`$1',,right,left) dimen_/4 from J.S
32 Q: bi_tr(down_ dimen_,ifelse(`$1',,R,L),P,E) with .B at Here
33 {["svg_it(Q`'svg_sub(`$3'))" m4lr`'just; "2N4236" m4lr`'just stbelow]}
34 E: Q.E
35 S: dot(at (Q.C,J.D))
36 line from J.D to S then to Q.C ]')
37
38 textht = textht*0.8
39 R2: resistor(down_ dimen_)
40 {["svg_it(R`'svg_sub(2))" ljust; "150`'svg_ohm" ljust stbelow] \
41 at last [].e loffset }
42 dot
43 Q13: bi_tr(down_ dimen_,,P,E) with .E at Here
44 {["svg_it(Q`'svg_sub(13))" rjust; "2N4236" rjust stbelow] at last [].w }
45 line down 3.1*elen_ from Q13.C
46 Q14: bi_tr(up_ dimen_,R,,E) with .C at Here
47 {["svg_it(Q`'svg_sub(14))" rjust; "2N4239" rjust stbelow] at last [].w }
48 dot(at Q14.E)
49 { line left_ dimen_*1.3 then up_ dimen_
50 R1: potentiometer(up_ dimen_) with .Start at Here
51 {["svg_it(R`'svg_sub(1))" ljust; "20k`'svg_ohm" ljust stbelow] \
52 at last [].e loffset }
53 { ground(at R1.T1) }
54 line from R1.End to (R1.End,Q13.E) then to Q13.E }
55 { dot(at Q13.C+(0,-elen_))
56 line to (R1.R,Here)+(-dimen_/2,0)
57 { arrowline(right_ dimen_/2); llabel(,i`'svg_sub(1)) }
58 { move left 0.2}
59 V1: gap(down_ dimen_,1); rlabel(+,V`'svg_sub(1),-)
60 line down_ dimen_/4 chop dotrad_ chop 0; ground(,T) }
61 R3: resistor(down_ dimen_)
62 {["svg_it(R`'svg_sub(3))" ljust; "150svg_ohm" ljust stbelow] \
63 at last [].e loffset}
64 dot(at Q13.C+(0,-2*elen_))
65 line right_ dimen_/2
66 A1: opamp with .In2 at Here; "svg_it(A`'svg_sub(1))" at A1.C
67 { "Nexus" rjust "SQ-10A" rjust at (A1.E,A1.s)+(0,-textht/2) }
68 line left_ dimen_/4 from A1.In1 then up_ dimen_/2 then right dimen_
69 dot
70 { resistor(up_ elen_)
71 {["svg_it(R`'svg_sub(14))" rjust; "19k`'svg_ohm" rjust stbelow] \
72 at last [].w roffset}
73 line to (Here,Q13.E) then to Q13.E }
74 line to (A1.Out,Here)
75 dot
76 { line to A1.Out
77 dot
78 resistor(down_ to (Here,Q14.E))
79 {["svg_it(R`'svg_sub(13))" ljust; "91k`'svg_ohm" ljust stbelow] \
80 at last [].e loffset}
81 line to Q14.E }
82 R6: resistor(right_ dimen_)
83 {["svg_it(R`'svg_sub(6))" ljust; "15k`'svg_ohm" ljust stbelow] \
84 with .n at last [].sw+(0,-textoffset) }
85 dot
86 line to (Here,A1.In1) then right_ dimen_/4
87 A2: opamp with .In1 at Here; {"svg_it(A`'svg_sub(2))" at A2.C }
88 { "Nexus" rjust "SQ-10A" rjust at (A2.E,A2.s)+(0,-textht/2) }
89 line left_ dimen_/4 from A2.In2
90 ground
91
92 dot(at A2.Out)
93 DP1: npair(,3,4) with .E at (A2.Out,Q14.B)+(elen_*1.25,0)
94 #if 2 < 1 then {
95 line from A2.Out to (A2.Out,DP1.G) then to DP1.G
96 line from DP1.E to (DP1.E,R3.bottom); dot
97 D4: reversed(`diode',up_ dimen_/2 from DP1.S)
98 D3: reversed(`diode',up_ dimen_/2 from Here+(0,-dimen_/6))
99 { "OMC-V" rjust "svg_it(D`'svg_sub(4))" rjust \
100 "svg_it(D`'svg_sub(3))" rjust at last [].w }
101 DP2: ppair(,1,2) with .E at (DP1.E,Q13.B)
102 D1: diode(down_ dimen_/2 from DP2.S)
103 D2: diode(down_ dimen_/2 from Here+(0,dimen_/6))
104 {"svg_it(D`'svg_sub(1))" rjust "svg_it(D`'svg_sub(2))" rjust "OMC-V" rjust\
105 at last [].w }
106 dot(at (Here,A2))
107 line to D2.bottom
108 line from DP2.G to (A2.Out,DP2.G) then to A2.Out
109 line from DP2.E to (DP2.E,R2.top); dot
110
111 T: dot(at (DP1.E,A2)+(dimen_,0))
112 DP3: npair(,7,8) with .G at (Here,DP1.G)+(dimen_/4,0)
113 dot(at DP3.E)
114 line to Q14.B
115 DP4: ppair(,5,6) with .G at (DP3.G,DP2.G)
116 dot(at DP4.E)
117 line to Q13.B
118 line from DP3.G to (T,DP3.G) then to (T,DP4.G) then to DP4.G
119 R11: resistor(down_ dimen_ from DP4.S)
120 {["svg_it(R`'svg_sub(11))" rjust; "20`'svg_ohm" rjust stbelow] \
121 at last [].w roffset}
122 D5: diode(up_ from DP3.S to (DP3.S,A2),Z)
123 {["svg_it(D`'svg_sub(5))" rjust; "1N4729" rjust stbelow] \
124 at last [].w roffset}
125 line to R11.end
126 C4: capacitor(right_ dimen_*1.3 from DP3.S,C)
127 llabel(,svg_it(C`'svg_sub(4))); rlabel(,"0.68`'svg_micro(F)")
128 C3: capacitor(right_ dimen_*1.3 from DP4.S,C)
129 llabel(,svg_it(C`'svg_sub(3))); rlabel(,"0.68`'svg_micro(F)")
130 dot
131 dot(at (Here,R6))
132 C2: reversed(`capacitor',left_ dimen_*1.3,C)
133 rlabel(,svg_it(C`'svg_sub(2))); llabel(,"0.1`'svg_micro(F)")
134 line to R6.end
135
136 R5: resistor(up_ from R6.end to (R6.end,Q13.B))
137 {["svg_it(R`'svg_sub(5))" ljust; "100k`'svg_ohm" ljust stbelow] \
138 at last [].e loffset }
139 dot(at R5.top-(0,dimen_/2))
140 line left_ dimen_/2
141 capacitor(down_ dimen_,C)
142 {["svg_it(C`'svg_sub(1))" rjust; "1`'svg_micro(F)" rjust stbelow] \
143 at last [].w roffset}
144 ground(,T)
145
146 line from DP4.E to (DP4.E,R2.bottom)
147 resistor(up_ to (Here,R2.top))
148 {["svg_it(R`'svg_sub(9))" ljust; "910`'svg_ohm" ljust stbelow] \
149 at last [].e loffset}
150 dot
151 resistor(down_ from DP3.E to (DP3.E,R3.bottom))
152 {["svg_it(R`'svg_sub(10))" ljust; "910`'svg_ohm" ljust stbelow] \
153 at last [].e loffset}
154 dot
155
156 line from R5.top to (R5,Q13.E)
157 resistor(right_ elen_)
158 {["svg_it(R`'svg_sub(4))" ljust; "100k`'svg_ohm" ljust stbelow] \
159 with .s at last [].nw+(0,1bp__)}
160 line to (C4.end,Here) then to C4.end
161
162 DP5: npair(L,11,10) with .E at (C4.end,DP1.E)+(elen_*0.8,0)
163 line from DP5.E to (DP5.E,R3.bottom); dot
164 line from R3.bottom to Here+(dimen_/2,0)
165 dot(,,1)
166 "svg_it(-E`'svg_sub(CC))" ljust at last [].e
167 D6: diode(up_ from DP5.S to (DP5.S,A2),Z)
168 {["svg_it(D`'svg_sub(6))" rjust; "1N4728" rjust stbelow] \
169 at last [].w roffset}
170 DP6: ppair(L,12,9) with .E at (DP5.E,DP2.E)
171 line from DP6.E to (DP6.E,R2.top); dot
172 line from R2.top to Here+(dimen_/2,0)
173 dot(,,1)
174 { "svg_it(E`'svg_sub(CC))" ljust at last [].e }
175 resistor(down_ from DP6.S to (DP6.S,C2))
176 {["svg_it(R`'svg_sub(12))" rjust; "20`'svg_ohm" rjust stbelow] \
177 at last [].w roffset}
178 dot
179 { line to C2.e }
180 line to D6.end
181
182 Vr: dot(at (DP6.G,V1.top)+(dimen_/4,0))
183 line from DP6.G to (Vr,DP6.G) then to (Vr,DP5.G) then to DP5.G
184 reversed(`arrowline',right_ dimen_/2 from Vr); llabel(,i`'svg_sub(2))
185 V2: gap(down_ dimen_,1); llabel(+,V`'svg_sub(2),-)
186 { move right 0.2}
187 line down_ dimen_/4 chop dotrad_ chop 0; ground(,T)
188
189 dot(at (Vr,T))
190 resistor(left_ to (DP6.E,Here))
191 {["svg_it(R`'svg_sub(15))" ljust; "200`'svg_ohm" ljust stbelow] \
192 with .s at last [].nw+(0,textoffset)}
193 line to (DP1.E,Here)
194 dot
195 #}
196
197 command "</g>" # end font
198 .PE