Debian Codegraph @

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

raw
1 divert(-1)
2 # tubedefs.m4
3 # macros for the Tubediags.m4 file
4
5 # Size parameters
6 define(`tubediam',`dimen_')
7 define(`tubethick',`2') # thick line thickness
8 define(`tubepindiam',`tubediam*3/8')
9 define(`tubeplatelen',`tubediam/2')
10 define(`tubegridlen',`tubediam*7/12')
11 define(`tubecathlen',`tubeplatelen-tubethick bp__')
12 define(`tubedotthick',`1.2')
13 define(`tubedotdiam',`tubediam/6')
14 define(`tgap',`tubediam*3/20')
15
16 # Generic tubes
17 `triode(diam,R[N|S|E|W])
18 R=tubeplate at bottom
19 N,S,E,W=half circle'
20 define(`triode',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
21 drawEnv(`$2')
22 G1: tubegrid(right tubegridlen at Env)
23 ifinstr(`$2',R,
24 `K1: tubecathode(,`$2') with .s at G1+(0,tgap)
25 P1: tubeplate(at G1+(0,-tgap))',
26 `K1: tubecathode(,`$2') with .n at G1+(0,-tgap)
27 P1: tubeplate(at G1+(0,tgap))')
28 `$3' ifelse(`$1',,,`popdef(`tubediam')')] ')
29
30 `tetrode(diam,R[N|S|E|W])
31 R=tubeplate at bottom
32 N,S,E,W=half circle'
33 define(`tetrode',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
34 drawEnv(`$2')
35 ifinstr(`$2',R,
36 `G1: tubegrid(right tubegridlen at Env+(0,tgap/2))
37 G2: tubegrid(right tubegridlen at G1-(0,tgap))
38 P1: tubeplate(at G2-(0,tgap))
39 K1: tubecathode(,`$2') with .s at G1+(0,tgap)',
40 `G1: tubegrid(right tubegridlen at Env-(0,tgap/2))
41 G2: tubegrid(right tubegridlen at G1+(0,tgap))
42 P1: tubeplate(at G2+(0,tgap))
43 K1: tubecathode(,`$2') with .n at G1+(0,-tgap)')
44 `$3' ifelse(`$1',,,`popdef(`tubediam')')] ')
45
46 `pentode(diam,R[N|S|E|W])
47 R=tubeplate at bottom
48 N,S,E,W=half circle'
49 define(`pentode',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
50 drawEnv(`$2') pushdef(`tgap',`tubediam/8')
51 ifinstr(`$2',R,
52 `G2: tubegrid(right tubegridlen at Env-(0,tgap/4))
53 G3: tubegrid(right tubegridlen at G2-(0,tgap))
54 P1: tubeplate(at G3-(0,tgap))
55 G1: tubegrid(right tubegridlen at G2+(0,tgap))
56 K1: tubecathode(,`$2') with .s at G1+(0,tgap)',
57 `G2: tubegrid(right tubegridlen at Env+(0,tgap/4))
58 G3: tubegrid(right tubegridlen at G2+(0,tgap))
59 P1: tubeplate(at G3+(0,tgap))
60 G1: tubegrid(right tubegridlen at G2-(0,tgap))
61 K1: tubecathode(,`$2') with .n at G1-(0,tgap)') popdef(`tgap')
62 `$3' ifelse(`$1',,,`popdef(`tubediam')')] ')
63
64 # utilities
65 define(`drawEnv',
66 `thktmp = linethick; linethick_(tubethick)
67 Env: circle invis diam tubediam
68 ifinstr(`$1',N,
69 `line from Env.w down tubediam*3/2/8
70 line from Env.e down tubediam*3/2/8
71 arc from Env.e to Env.w',
72 `$1',S,
73 `line from Env.w up tubediam*3/2/8
74 line from Env.e up tubediam*3/2/8
75 arc from Env.w to Env.e',
76 `$1',E,
77 `line from Env.n left tubediam*3/2/8
78 line from Env.s left tubediam*3/2/8
79 arc from Env.s to Env.n',
80 `$1',W,
81 `line from Env.n right tubediam*3/2/8
82 line from Env.s right tubediam*3/2/8
83 arc from Env.n to Env.s',
84 `circle diam tubediam') with .c at Env
85 linethick_(thktmp) ')
86
87 define(`tubedot',`dot(ifelse(`$1',,`at Here',`$1'),tubedotdiam/2,1,thick tubedotthick)')
88
89 define(`pin',`circle diam tubepindiam `$1'')
90
91 define(`Base_pins',`define(`pincount',`ifelse(`$2',,8,`$2')')dnl
92 define(`pinpattern',`ifelse(`$1',,8,`$1')')dnl
93 define(`pininit',`ifelse(`$3',,-90,`$3')')dnl
94 for_(1,pincount,1,
95 `pinang = pininit+360/(2*pinpattern)-m4x*360/pinpattern
96 Pin`'m4x: pin(at \
97 Base+(Rect_(Base.rad+tubepindiam/2+tubethick/2bp__,pinang)) \
98 ifsvg("svg_small(m4x)","\small m4x"))
99 {PinT`'m4x: Base+(Rect_(Base.rad+tubethick/2bp__,pinang))} ')
100 ')
101
102 # structural elements
103 `tubeplate(attributes,length)'
104 define(`tubeplate',`line thick tubethick right ifelse(`$2',,tubeplatelen,`$2') `$1'')
105
106 define(`thinthick',0.4)dnl
107 define(`thinline',`line thick thinthick')dnl
108
109 define(`tubeTab',`[
110 ang = ifelse(`$1',,90,`$1')
111 ca = cosd(ang); sa = sind(ang)
112 tabht = tubepindiam/2
113 tabwd = tabht*5/6
114 T0: Here
115 T1: T0+(vrot_(0,tabwd/2,ca,sa))
116 T2: T0+(vrot_(tabht,tabwd/2,ca,sa))
117 T3: T0+(vrot_(tabht,-tabwd/2,ca,sa))
118 T4: T0+(vrot_(0,-tabwd/2,ca,sa))
119 line from T1 to T2 then to T3 then to T4 fill_(ifelse(`$2',,1,`$2'))
120 ] with .T0 at Base+(Rect_(tubediam*3/2/2+tubethick/2bp__,ifelse(`$1',,90,`$1')))
121 ')
122
123 define(`tubegrid',`dashline(ifelse(`$1',,`right tubegridlen',`$1'),
124 thick tubethick,(tubegridlen*7/8/3),(tubegridlen/8/2))')
125
126 `tubecathode(length,R)'
127 define(`tubecathode',`[
128 box invis wid ifelse(`$1',,tubecathlen,`$1') ht tubeplatelen/6
129 ifinstr(`$2',R,
130 `line thick tubethick from last box.nw to last box.sw \
131 then to last box.se then to last box.ne',
132 `line thick tubethick from last box.sw to last box.nw \
133 then to last box.ne then to last box.se ')
134 `$3'] ')
135
136 `tubefilament(length,R)'
137 define(`tubefilament',`[ define(`filalen',`ifelse(`$1',,`tubeplatelen/3',`$1')')dnl
138 round(,tubethick) define(`filn',`ifinstr(`$2',R,-)')
139 line thick tubethick up filn`'tubeplatelen/3 right tubeplatelen*2/9; round(,tubethick)
140 line thick tubethick down filn`'tubeplatelen/3 right tubeplatelen*2/9
141 round(,tubethick)
142 `$3'] ')
143
144 # specific base examples, bottom view
145 define(`B_2AG',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
146 Base: circle thick tubethick diam tubediam*3/2
147 Base_pins(8,7)
148 Dk1: tubedot(at Base+(0,-tubedotdiam*5/6))
149 P1: tubeplate(at Base+(0,tubedotdiam/3))
150 thinline from PinT1 to Dk1 chop 0 chop tubedotdiam/2
151 thinline from P1 to Base.n
152 tubeTab(90)
153 `$2' ifelse(`$1',,,`popdef(`tubediam')') ]')
154
155 define(`B_2D',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
156 Base: circle thick tubethick diam tubediam*3/2
157 Base_pins(4,4)
158 G1: tubegrid(right tubegridlen at Base)
159 F1: tubefilament with .n at G1+(0,-tgap)
160 P1: tubeplate(at G1+(0,tgap))
161 thtmp = linethick; linethick = thinthick
162 T1: tubeTab(105)
163 T2: tubeTab(75)
164 line from PinT1 to F1.sw
165 line from PinT4 to F1.se
166 line from G1.start left tubediam*3/2/8 then to T1.T0
167 line from P1 up tubediam*3/2/8 then to T2.T0
168 linethick = thtmp
169 `$2' ifelse(`$1',,,`popdef(`tubediam')') ] ')
170
171 define(`B_4BB',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
172 Base: circle thick tubethick diam tubediam*3/2
173 Base_pins(8,8)
174 K1: tubecathode with .n at Base-(0,tgap/2)
175 F1: tubefilament with .n at K1.s
176 G1: tubegrid(right tubegridlen at K1.n+(0,tgap))
177 P1: tubeplate(at G1+(0,tgap))
178 pushdef(`hoprad_',`dimen_/16') thtmp = linethick; linethick_(thinthick)
179 T1: tubeTab(135)
180 T2: tubeTab(-45)
181 T3: tubeTab(-90,0)
182 line from PinT2 to F1.sw
183 L7: line from PinT7 to F1.se
184 line up tgap from P1 then to T1.T0
185 move to K1.se
186 crossover(to (Here,PinT8),,L7)
187 line right tgap from G1.end; corner
188 crossover(to (Here,T2.T1),,L7); line to T2.T0
189 popdef(`hoprad_') linethick_(thtmp)
190 `$2' ifelse(`$1',,,`popdef(`tubediam')') ] ')
191
192 define(`B_9K',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
193 Base: circle thick tubethick diam tubediam*3/2
194 Base_pins(10,9,-90-360/20)
195 G1: tubegrid(right tubegridlen at Base-(0,tgap/2))
196 K1: tubecathode with .n at G1+(0,-tgap)
197 F1: tubefilament with .n at K1.s
198 G2: tubegrid(right tubegridlen at G1+(0,tgap))
199 G3: tubegrid(right tubegridlen at G2+(0,tgap))
200 P1: tubeplate(at G3+(0,tgap))
201 pushdef(`hoprad_',`dimen_/16') thtmp = linethick; linethick_(thinthick)
202 L3: line from G3.start to PinT3
203 M6: move from G2.end to (PinT6,G2.end)
204 line from M6.start to M6.end then to PinT6
205 L7: line from K1.se right tubediam*3/2/5
206 L71: line to PinT7
207 line up tgap from P1 then left tubeplatelen/2
208 { M1: move left tgap down tgap
209 M21: move up tgap from PinT1 }
210 line to Intersect_(M1,M21)
211 crossover(to PinT1,R,L3)
212 L8: line right tgap from G1.e
213 crossover(to PinT8,,L71)
214 line from F1.se to (K1.e+(tgap*3/4,0),F1)
215 corner(thinthick)
216 crossover(to P1.e+(tgap*3/4,tgap/2),R,L7,L8)
217 line to PinT5
218 line up tgap*3/2 from PinT9 then to PinT8
219 line from F1.sw to (K1.w-(tgap*3/4,0),F1)
220 crossover(up P1.y-tgap/2-Here.y,,L3)
221 crossover(to PinT4,,M1)
222 popdef(`hoprad_') linethick_(thtmp)
223 `$2' ifelse(`$1',,,`popdef(`tubediam')') ] ')
224
225 # specific tubes
226 `V_6L6G(diam,R[N|S|E|W],G1|G2)
227 R=plate at bottom
228 N,S,E,W=half circle'
229 define(`V_6L6G',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
230 drawEnv(`$2') pushdef(`tgap',`tubediam/8')
231 ifinstr(`$2',R,
232 `G2: tubegrid(right tubegridlen at Env-(0,tgap/4))
233 G3: dashline(right tubegridlen at G2-(0,tgap),thick tubethick,
234 (tubegridlen*3/10),(tubegridlen*4/10))
235 P1: tubeplate(at G3-(0,tgap))
236 G1: tubegrid(right tubegridlen at G2+(0,tgap))
237 K1: tubecathode(,`$2') with .s at G1+(0,tgap)
238 line from K1.nw down tgap/2 left tgap
239 crossover(to (Here,G3),R,ifelse(`$3',,G1,`$3')); corner; line to G3.w ',
240 `G2: tubegrid(right tubegridlen at Env+(0,tgap/4))
241 G3: dashline(right tubegridlen at G2+(0,tgap),thick tubethick,
242 (tubegridlen*3/10),(tubegridlen*4/10))
243 P1: tubeplate(at G3+(0,tgap))
244 G1: tubegrid(right tubegridlen at G2-(0,tgap))
245 K1: tubecathode(,`$2') with .n at G1-(0,tgap)
246 line from K1.sw up tgap/2 left tgap
247 crossover(to (Here,G3),,ifelse(`$3',,G1,`$3')); corner; line to G3.w ')
248 popdef(`tgap') `$4' ifelse(`$1',,,`popdef(`tubediam')')] ')
249
250 `5U4G rectifier(diam,R)'
251 define(`V_5U4G',`[ ifelse(`$1',,,`pushdef(`tubediam',`$1')')
252 drawEnv(`$2')
253 P1: line thick tubethick up tubediam/3 with .c at Env-(tubediam/6,0)
254 P2: line thick tubethick up tubediam/3 with .c at Env+(tubediam/6,0)
255 ifinstr(`$2',R,
256 `F1: tubefilament(,R) with .n at Env.n-(0,tubediam/20) ',
257 `F1: tubefilament with .s at Env.s+(0,tubediam/20) ')
258 `$3'] ')
259
260 divert(0)dnl