Debian Codegraph @

texmf-dist/tex/latex/circuitikz/circuitikz-1.4.6-body.tex

raw
1 % Copyright 2018-2026 by Romano Giannetti
2 % Copyright 2015-2026 by Stefan Lindner
3 % Copyright 2013-2026 by Stefan Erhardt
4 % Copyright 2007-2026 by Massimo Redaelli
5 %
6 % This file may be distributed and/or modified
7 %
8 % 1. under the LaTeX Project Public License and/or
9 % 2. under the GNU Public License.
10 %
11 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
12
13 \NeedsTeXFormat{LaTeX2e}
14
15 \def\pgfcircversion{1.4.6}
16 \def\pgfcircversiondate{2022/02/04}
17
18 %% Version 3.0 of pgf/TikZ is required
19 \RequirePackage{tikz}
20 \usetikzlibrary{calc}
21 %
22 % "arrows" library is deprecated, and behave badly with
23 % arrows on short paths. Change to the new arrows.meta
24 % In pfgcirc.define, we will add the old definition of
25 % latex' which we have lost in the transition
26 %
27 \usetikzlibrary{arrows.meta, bending}
28 \usetikzlibrary{fpu} % may be needed for use fpu reciprocal (v1.0.1)
29 %
30 % global of options (better use styles!)
31 %
32 \DeclareOption{european}{\AtEndOfPackage{%
33 \ctikzset{voltage=european} \ctikzset{current=european} \ctikzset{inductor=european}
34 \ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european}}
35 }
36 \DeclareOption{american}{\AtEndOfPackage{%
37 \ctikzset{voltage=american} \ctikzset{current=american} \ctikzset{resistor=american} \ctikzset{inductor=american} \ctikzset{gas filled surge arrester choice = american}
38 \ctikzset{logic ports = american}}
39 }
40 %
41 % voltages
42 %
43 \DeclareOption{europeanvoltage}{\AtEndOfPackage{%
44 \ctikzset{voltage=european}}
45 }
46 \DeclareOption{straightvoltages}{\AtEndOfPackage{%
47 \ctikzset{voltage=straight}}
48 }
49 \DeclareOption{americanvoltage}{\AtEndOfPackage{%
50 \ctikzset{voltage=american}}
51 }
52 \DeclareOption{europeanvoltages}{\AtEndOfPackage{%
53 \ctikzset{voltage=european}}
54 }
55 \DeclareOption{americanvoltages}{\AtEndOfPackage{%
56 \ctikzset{voltage=american}}
57 }
58 % Voltage directions
59 \DeclareOption{oldvoltagedirection}{\AtEndOfPackage{%
60 \pgf@circ@oldvoltagedirectiontrue
61 \pgf@circ@explicitvdirtrue
62 \pgf@circ@fixbatteriesfalse}
63 }
64 \DeclareOption{nooldvoltagedirection}{\AtEndOfPackage{%
65 \pgf@circ@oldvoltagedirectionfalse
66 \pgf@circ@explicitvdirtrue
67 \pgf@circ@fixbatteriesfalse}
68 }
69 \DeclareOption{RPvoltages}{\AtEndOfPackage{%
70 \pgf@circ@oldvoltagedirectiontrue
71 \pgf@circ@explicitvdirtrue
72 \pgf@circ@fixbatteriestrue}
73 }
74 \DeclareOption{EFvoltages}{\AtEndOfPackage{%
75 \pgf@circ@oldvoltagedirectionfalse
76 \pgf@circ@explicitvdirtrue
77 \pgf@circ@fixbatteriestrue}
78 }
79 %
80 % currents
81 %
82 \DeclareOption{europeancurrent}{\AtEndOfPackage{%
83 \ctikzset{current = european}}
84 }
85 \DeclareOption{americancurrent}{\AtEndOfPackage{%
86 \ctikzset{current = american}}
87 }
88 \DeclareOption{europeancurrents}{\AtEndOfPackage{%
89 \ctikzset{current = european}}
90 }
91 \DeclareOption{americancurrents}{\AtEndOfPackage{%
92 \ctikzset{current = american}}
93 }
94 %
95 % resistors
96 %
97 \DeclareOption{americanresistor}{\AtEndOfPackage{%
98 \ctikzset{resistor = american}}
99 }
100 \DeclareOption{europeanresistor}{\AtEndOfPackage{%
101 \ctikzset{resistor = european}}
102 }
103 \DeclareOption{americanresistors}{\AtEndOfPackage{%
104 \ctikzset{resistor = american}}
105 }
106 \DeclareOption{europeanresistors}{\AtEndOfPackage{%
107 \ctikzset{resistor = european}}
108 }
109 %
110 % inductors
111 %
112 \DeclareOption{americaninductor}{\AtEndOfPackage{%
113 \ctikzset{inductor = american}}
114 }
115 \DeclareOption{europeaninductor}{\AtEndOfPackage{%
116 \ctikzset{inductor = european}}
117 }
118 \DeclareOption{cuteinductor}{\AtEndOfPackage{%
119 \ctikzset{inductor = cute}}
120 }
121 \DeclareOption{americaninductors}{\AtEndOfPackage{%
122 \ctikzset{inductor = american}}
123 }
124 \DeclareOption{europeaninductors}{\AtEndOfPackage{%
125 \ctikzset{inductor = european}}
126 }
127 \DeclareOption{cuteinductors}{\AtEndOfPackage{%
128 \ctikzset{inductor = cute}}
129 }
130 %
131 % logic ports
132 %
133 \DeclareOption{americanport}{\AtEndOfPackage{%
134 \ctikzset{logic ports = american}}
135 }
136 \DeclareOption{europeanport}{\AtEndOfPackage{%
137 \ctikzset{logic ports = european}}
138 }
139 \DeclareOption{americanports}{\AtEndOfPackage{%
140 \ctikzset{logic ports = american}}
141 }
142 \DeclareOption{europeanports}{\AtEndOfPackage{%
143 \ctikzset{logic ports = european}}
144 }
145 %
146 % surge arresters (really?)
147 %
148 \DeclareOption{americangfsurgearrester}{\AtEndOfPackage{%
149 \ctikzset{gas filled surge arrester choice = american}}
150 }
151 \DeclareOption{europeangfsurgearrester}{\AtEndOfPackage{%
152 \ctikzset{gas filled surge arrester choice = european}}
153 }
154 %
155 % diodes
156 %
157 \DeclareOption{fulldiodes}{\AtEndOfPackage{%
158 \ctikzset{diode = full}}
159 }
160 \DeclareOption{emptydiodes}{\AtEndOfPackage{%
161 \ctikzset{diode = empty}}
162 }
163 \DeclareOption{strokediodes}{\AtEndOfPackage{%
164 \ctikzset{diode = stroke}}
165 }
166 \DeclareOption{fulldiode}{\AtEndOfPackage{%
167 \ctikzset{diode = full}}
168 }
169 \DeclareOption{emptydiode}{\AtEndOfPackage{%
170 \ctikzset{diode = empty}}
171 }
172 \DeclareOption{strokediode}{\AtEndOfPackage{%
173 \ctikzset{diode = stroke}}
174 }
175 %
176 % MOSes and FETs
177 %
178 \DeclareOption{arrowmos}{\AtEndOfPackage{%
179 \pgf@circuit@mos@arrowstrue}
180 }
181 \DeclareOption{noarrowmos}{\AtEndOfPackage{%
182 \pgf@circuit@mos@arrowsfalse}
183 }
184 \DeclareOption{fetbodydiode}{\AtEndOfPackage{%
185 \pgf@circuit@fet@bodydiodetrue}
186 }
187 \DeclareOption{nofetbodydiode}{\AtEndOfPackage{%
188 \pgf@circuit@fet@bodydiodefalse}
189 }
190 \DeclareOption{fetsolderdot}{\AtEndOfPackage{%
191 \pgf@circuit@fet@solderdottrue}
192 }
193 \DeclareOption{nofetsolderdot}{\AtEndOfPackage{%
194 \pgf@circuit@fet@solderdotfalse}
195 }
196 \DeclareOption{emptypmoscircle}{\AtEndOfPackage{%
197 \pgf@circuit@pmos@emptycircletrue}
198 }
199 \DeclareOption{lazymos}{\AtEndOfPackage{%
200 \ctikzset{tripoles/nmos/width=.5}
201 \ctikzset{tripoles/nmos/gate height=.35}
202 \ctikzset{tripoles/nmos/base height=.35}
203 \ctikzset{tripoles/nmos/height/.initial=1.2}
204 \ctikzset{tripoles/nmos/base width=.5}
205 \ctikzset{tripoles/nmos/gate width=.65}
206 \ctikzset{tripoles/pmos/width=.5}
207 \ctikzset{tripoles/pmos/gate height=.35}
208 \ctikzset{tripoles/pmos/base height=.35}
209 \ctikzset{tripoles/pmos/height/.initial=1.2}
210 \ctikzset{tripoles/pmos/base width=.5}
211 \ctikzset{tripoles/pmos/gate width=.65}
212 \pgf@circuit@pmos@emptycircletrue}
213 }
214 %
215 % BJTs labels
216 %
217 \DeclareOption{legacytransistorstext}{\AtEndOfPackage{%
218 \pgf@circuit@transisors@fixlabelsfalse}
219 }
220 \DeclareOption{nolegacytransistorstext}{\AtEndOfPackage{%
221 \pgf@circuit@transisors@fixlabelstrue}
222 }
223 \DeclareOption{centertransistorstext}{\AtEndOfPackage{%
224 \pgf@circuit@transisors@fixlabelstrue}
225 }
226 %
227 % labels
228 %
229 \DeclareOption{straightlabels}{\AtEndOfPackage{%
230 \ctikzset{label/align = straight}}
231 }
232 \DeclareOption{rotatelabels}{\AtEndOfPackage{%
233 \ctikzset{label/align = rotate}}
234 }
235 \DeclareOption{smartlabels}{\AtEndOfPackage{%
236 \ctikzset{label/align = smart}}
237 }
238 %
239 % Several options (better use styles)
240 %
241 \DeclareOption{betterproportions}{\AtEndOfPackage{%
242 \ctikzset{monopoles/ground/width/.initial=.15}
243 \ctikzset{bipoles/resistor/height/.initial=.23}
244 \ctikzset{bipoles/resistor/width/.initial=.6}
245 \ctikzset{bipoles/capacitor/height/.initial=.4}
246 \ctikzset{bipoles/capacitor/width/.initial=.1}
247 \ctikzset{bipoles/potentiometer/height/.initial=.6}
248 \ctikzset{bipoles/potentiometer/height 2/.initial=.23}
249 \ctikzset{bipoles/potentiometer/width/.initial=.6}
250 \ctikzset{bipoles/photoresistor/height/.initial=.6}
251 \ctikzset{bipoles/photoresistor/height 2/.initial=.23}
252 \ctikzset{bipoles/photoresistor/width/.initial=.6}
253 \ctikzset{bipoles/thermistor/main/.initial=.7}
254 \ctikzset{bipoles/thermistor/height/.initial=.328}%.23/.7
255 \ctikzset{bipoles/thermistor/width/.initial=.6}
256 \ctikzset{bipoles/thermistorntc/width/.initial=.6}
257 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
258 \ctikzset{bipoles/thermistorntc/height/.initial=.328}%.23/.7
259 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.23/.7
260 \ctikzset{bipoles/thermistorptc/width/.initial=.6}
261 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
262 \ctikzset{bipoles/thermistorptc/height/.initial=.328}%.23/.7
263 \ctikzset{bipoles/varistor/main/.initial=.7}
264 \ctikzset{bipoles/varistor/height/.initial=.328}%.23/.7
265 \ctikzset{bipoles/varistor/width/.initial=.6}
266 \ctikzset{bipoles/vresistor/height/.initial=.45}
267 \ctikzset{bipoles/vresistor/width/.initial=.6}
268 \ctikzset{bipoles/generic/height/.initial=.23}
269 \ctikzset{bipoles/generic/width/.initial=.6}
270 \ctikzset{bipoles/generic potentiometer/height/.initial=.6}
271 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.23}
272 \ctikzset{bipoles/generic potentiometer/width/.initial=.6}
273 \ctikzset{bipoles/ageneric/height/.initial=.23}
274 \ctikzset{bipoles/ageneric/width/.initial=.6}
275 \ctikzset{bipoles/memristor/height/.initial=.23}
276 \ctikzset{bipoles/memristor/wave height/.initial=.375}
277 \ctikzset{bipoles/memristor/width/.initial=.60}
278 \ctikzset{bipoles/tgeneric/height/.initial=.525}
279 \ctikzset{bipoles/tgeneric/width/.initial=.6}
280 \ctikzset{bipoles/tfullgeneric/height/.initial=.525}
281 \ctikzset{bipoles/tfullgeneric/width/.initial=.60}
282 \ctikzset{bipoles/fullgeneric/height/.initial=.23}
283 \ctikzset{bipoles/fullgeneric/width/.initial=.6}
284 \ctikzset{bipoles/diode/height/.initial=.3}
285 \ctikzset{bipoles/diode/width/.initial=.25}
286 \ctikzset{bipoles/bidirectionaldiode/height/.initial=.66}
287 \ctikzset{bipoles/bidirectionaldiode/width/.initial=.6}
288 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
289 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
290 \ctikzset{tripoles/thyristor/height/.initial=.66}
291 \ctikzset{tripoles/thyristor/height 2/.initial=.3}
292 \ctikzset{tripoles/thyristor/width/.initial=.6}
293 \ctikzset{tripoles/thyristor/diode height/.initial=.3}
294 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
295 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
296 \ctikzset{tripoles/triac/height/.initial=.66}
297 \ctikzset{tripoles/triac/width/.initial=.6}
298 \ctikzset{tripoles/triac/diode width left/.initial=.3}
299 \ctikzset{tripoles/triac/diode width right/.initial=.3}}
300 }
301 % This is a nice hack that prints all the shapes declared
302 % by the package. Very useful for coverage testing and debugging.
303 %
304 % \let\origpgfdeclareshape=\pgfdeclareshape
305 % \def\pgfdeclareshape#1{%
306 % \typeout{SHAPE:\space"#1"}%
307 % \origpgfdeclareshape{#1}
308 % }
309 %
310 %
311 %%%%%%%%%
312 %%% These is the only direct options!
313 \DeclareOption{siunitx}{
314 \pgf@circ@siunitxtrue
315 }
316 \DeclareOption{nosiunitx}{
317 \pgf@circ@siunitxfalse
318 }
319 \DeclareOption{compatibility}{
320 \pgf@circuit@compattrue
321 }
322
323
324 %% we have to load this before options to define the magics for compatibility
325 %%%%%%%%%%% Springe nach tex/pgfcirc.defines
326 %%%---------- open: tex/pgfcirc.defines.tex
327 % Copyright 2018-2026 by Romano Giannetti
328 % Copyright 2015-2026 by Stefan Lindner
329 % Copyright 2013-2026 by Stefan Erhardt
330 % Copyright 2007-2026 by Massimo Redaelli
331 %
332 % This file may be distributed and/or modified
333 %
334 % 1. under the LaTeX Project Public License and/or
335 % 2. under the GNU Public License.
336 %
337 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
338 %
339 % This file has folding marks for vim (See last line).
340 %
341
342 %
343 % This file is loaded *before* the options for the package are executed, mainly
344 % for the following three ifs
345 %
346 % these three ifs are fundamental for the package loading options;
347 % do not move away
348 \newif\ifpgf@circ@siunitx
349 \newif\ifpgf@circ@siunitx@res
350 \newif\ifpgf@circuit@compat
351
352 %% Key managements%<<<1
353
354 \long\def\pgf@circ@comment#1{}
355
356 \def\circuitikzbasekey{/tikz/circuitikz}
357
358 \pgfkeys{\circuitikzbasekey/.is family}
359
360 \def\circuitikzset{\expandafter\pgfqkeys\expandafter{\circuitikzbasekey}}
361 \let\ctikzset\circuitikzset
362 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
363 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
364
365 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
366 %%>>>
367
368 %% Temporary Counters and dimensions%<<<1
369 %% Temporary Counters
370 \newcount\pgf@circ@count@a
371 \newcount\pgf@circ@count@b
372 \newcount\pgf@circ@count@c
373 %%%%%%%%%%%%
374 %% Dimensions
375 % coordinate
376 \newdimen\pgf@circ@res@up
377 \newdimen\pgf@circ@res@down
378 \newdimen\pgf@circ@res@zero
379 \newdimen\pgf@circ@res@left
380 \newdimen\pgf@circ@res@right
381 \newdimen\pgf@circ@res@other
382 \newdimen\pgf@circ@res@step
383 \newdimen\pgf@circ@res@temp
384 % Base len for all circuitikz
385 \newdimen\pgf@circ@Rlen
386 % scaled length for internal use in scalable shapes
387 \newdimen\pgf@circ@scaled@Rlen
388 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
389 \pgf@circ@Rlen = 1.4cm
390 % by default scale is 1.0
391 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
392 % inital thickness
393 \newdimen \pgfstartlinewidth
394 %%>>>
395
396 % arrow tips macros and utilities %<<<1
397
398 % the default arrow is latexslim, which has been ported over old arrows library (deprecated)
399 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
400 % this was the original definition of latex' tips, renamed to avoid clashes
401 %
402 \pgfarrowsdeclare{latexslim}{latexslim}
403 {
404 \pgfutil@tempdima=0.28pt%
405 \advance\pgfutil@tempdima by.3\pgflinewidth%
406 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
407 \pgfarrowsrightextend{+6\pgfutil@tempdima}
408 }
409 {
410 \pgfutil@tempdima=0.28pt%
411 \advance\pgfutil@tempdima by.3\pgflinewidth%
412 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
413 \pgfpathcurveto
414 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
415 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
416 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
417 \pgfpathcurveto
418 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
419 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
420 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
421 \pgfpathcurveto
422 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
423 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
424 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
425 \pgfpathclose
426 \pgfusepathqfill
427 }
428
429 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
430
431 % select the arrows using available defaults.
432 \def\pgfcirc@arrow@default{default}
433 % choose the arrows to use. Use #2 and #3 if the key is equal to "default"
434 % arguments: type, default start, default end
435 \def\pgfcirc@set@arrows#1#2#3{%
436 \pgfkeysifdefined{\circuitikzbasekey/#1 start arrow}%
437 {\edef\@@start{\ctikzvalof{#1 start arrow}}}%
438 {\edef\@@start{\pgfcirc@arrow@default}}
439 \pgfkeysifdefined{\circuitikzbasekey/#1 end arrow}%
440 {\edef\@@end{\ctikzvalof{#1 end arrow}}}%
441 {\edef\@@end{\pgfcirc@arrow@default}}
442 \ifx\@@start\pgfcirc@arrow@default
443 \pgfsetarrowsstart{#2}%
444 \else
445 \pgfsetarrowsstart{\@@start}%
446 \fi
447 \ifx\@@end\pgfcirc@arrow@default
448 \pgfsetarrowsend{#3}%
449 \else
450 \pgfsetarrowsend{\@@end}%
451 \fi
452 }
453
454 \def\pgf@circ@declare@family@arrows#1{%
455 \ctikzset{#1 start arrow/.initial={default}}
456 \ctikzset{#1 end arrow/.initial={default}}
457 \tikzset{#1 start arrow/.style={\circuitikzbasekey/#1 start arrow={##1}}}
458 \tikzset{#1 end arrow/.style={\circuitikzbasekey/#1 end arrow={##1}}}
459 }
460 %%>>>
461
462 %% Macros to do things depending on the class%<<<1
463
464 \def\pgf@circ@setifdefinedfill#1#2{%
465 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
466 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
467 \ifdefined\ctikzclass
468 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
469 {% yes, it's defined
470 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
471 \ifx\@@tmp\@@none % but it's none
472 \pgfusepath{#2}%
473 \else
474 \pgfsetfillcolor{\@@tmp}%
475 \pgfusepath{#1}%
476 \fi
477 }{% the class is defined but the fill key not; use #2
478 \pgfusepath{#2}%
479 }
480 \else
481 \pgfusepath{#2}%
482 \fi
483 }
484
485 %% Macro to fill or draw
486
487 \def\pgf@circ@draworfill{%
488 \ifx\tikz@fillcolor\pgfutil@empty
489 \pgf@circ@setifdefinedfill{draw,fill}{draw}
490 \else
491 \pgfsetfillcolor{\tikz@fillcolor}
492 \pgfusepath{draw, fill}
493 \fi
494 }
495
496 \def\pgf@circ@draworfillandclip{%
497 \ifx\tikz@fillcolor\pgfutil@empty
498 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
499 \pgfusepath{draw, clip}
500 \else
501 \pgfsetfillcolor{\tikz@fillcolor}
502 \pgfusepath{draw, clip, fill}
503 \fi
504 }
505
506 \def\pgf@circ@maybefill{%
507 \ifx\tikz@fillcolor\pgfutil@empty
508 \pgf@circ@setifdefinedfill{fill}{discard}
509 \else
510 \pgfsetfillcolor{\tikz@fillcolor}
511 \pgfusepath{fill}
512 \fi
513 }
514
515 %% Macros for setting linewidth
516 % #1 is the legacy class (bipoles, tripoles) etc
517 % #2 is the reference linewidth
518 \def\pgf@circ@setlinewidth#1#2{%
519 \ifdefined\ctikzclass
520 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
521 {% yes, it's defined
522 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
523 \ifx\@@tmp\@@none % but it's none
524 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
525 \else
526 \pgfsetlinewidth{\@@tmp #2}%
527 \fi
528 }{ % key not defined, do the legacy thing
529 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
530 }% Ok, do nothing
531 \else % no class
532 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
533 \fi
534 }
535 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
536 \ctikzset{none/thickness/.initial=1.0} % do not touch
537
538 % set thickness relative to current thickness if exists class and key
539 \def\pgf@circ@set@relative@thickness#1{%
540 \ifdefined\ctikzclass
541 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/#1}
542 {% yes, it's defined
543 \pgfsetlinewidth{\ctikzvalof{\ctikzclass/#1}\pgflinewidth}%
544 }{}
545 \fi
546 }
547
548 % auxiliary macro to reset some thing in paths, for background images.
549 % use with care and ALWAYS inside a \pgfscope, see here:
550 % https://matrix.to/#/!NuxCISwYQJuyWwNsEI:matrix.org/$vQO6luq1F66LJ79dERmaqKI46qMBcjStqYCPi725uZE?via=matrix.org&via=2krueger.de&via=im.f3l.de
551 % Thanks to @muzimuzhi
552 %
553 \def\pgf@circ@reset@arrows{%
554 \pgfsetshortenstart{+0pt}\pgfsetshortenend{+0pt}\pgfsetarrows{-}%
555 }
556 \def\pgf@circ@reset@rounded{%
557 \pgfsetcornersarced{\pgfpointorigin}%
558 }
559 \def\pgf@circ@reset@arrows@rounded{%
560 \pgf@circ@reset@arrows\pgf@circ@reset@rounded
561 }
562
563 %%>>>
564
565 %% font changes compatible with plain/LaTeX/ConTeXt%<<<1
566 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
567
568 \ifpgfutil@format@is@latex
569 \long\def\pgf@circ@font@tiny{\tiny}
570 \long\def\pgf@circ@font@small{\small}
571 \long\def\pgf@circ@font@bold{\textbf}
572 \long\def\pgf@circ@font@boldmath{\boldmath}
573 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
574 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
575 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
576 \else\ifpgfutil@format@is@plain
577 \long\def\pgf@circ@font@tiny{\fiverm}
578 \long\def\pgf@circ@font@small{\sevenrm}
579 \long\def\pgf@circ@font@bold#1{{\bf#1}}
580 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
581 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
582 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
583 \long\def\pgf@circ@font@twelve{\twelverm} %
584 \else\ifpgfutil@format@is@context
585 \long\def\pgf@circ@font@tiny{\tfxx}
586 \long\def\pgf@circ@font@small{\tfx}
587 \long\def\pgf@circ@font@bold{\bold}
588 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
589 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
590 \long\def\pgf@circ@font@tenbm{\normal\bold}%
591 \long\def\pgf@circ@font@twelve{\tfa} %
592 \fi\fi\fi
593
594
595 %
596 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
597 %
598 % this is needed to avoid problems with \ConTeXt
599 \ifcsname normalunexpanded\endcsname
600 \let\pgfcircutil@unexpanded\normalunexpanded
601 \else
602 \let\pgfcircutil@unexpanded\unexpanded
603 \fi
604 % minimally expand a pgfkey to check if it's {}/undefined or filled.
605 \def\unexpandedvalueof#1{%
606 \pgfcircutil@unexpanded\expandafter\expandafter
607 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
608 \def\pgf@circ@valueof@chk#1{%
609 \ifx\relax#1%
610 \expandafter\pgfutil@firstoftwo
611 \else
612 \expandafter\pgfutil@secondoftwo
613 \fi
614 {{}}% #1 is \relax, so consider empty
615 {\expandafter{#1}}% otherwise, leave the key after one more expansion
616 }%
617 %>>>
618
619 %% Generic macro for defining a bipole shape%<<<
620 % #1 - additional anchors
621 % #2 - lower y-size of the bipole (from the center).
622 % #3 - #shape is the name of the shape
623 % #4 - upper y-size of the bipole (from the center)
624 % #5 - width of the bipole
625 % #6 - macros drawing the bipole
626 %
627 \long\def\pgfcircdeclarebipole{%
628 \pgfcircdeclarebipolescaled{default}}
629
630 %% Generic macro for defining a bipole shape
631 % #1 - scale factor
632 % #2 - additional anchors
633 % #3 - lower y-size of the bipole (from the center).
634 % #4 - #shape is the name of the shape
635 % #5 - upper y-size of the bipole (from the center)
636 % #6 - width of the bipole
637 % #7 - macros drawing the bipole
638 %
639 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
640 \pgfdeclareshape{#4shape}{
641 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
642 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
643 \savedanchor{\northeast}{
644 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
645 \pgf@y=#5\pgf@circ@scaled@Rlen
646 \pgf@y=.5\pgf@y
647 \pgf@x=#6\pgf@circ@scaled@Rlen
648 \pgf@x=.5\pgf@x
649 }
650 \savedanchor{\northeastborder}{
651 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
652 \pgf@y=#5\pgf@circ@scaled@Rlen
653 \pgf@y=.5\pgf@y
654 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
655 \pgf@x=#6\pgf@circ@scaled@Rlen
656 \pgf@x=.5\pgf@x
657 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
658 }
659 \savedanchor{\southwestborder}{
660 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
661 \pgf@y=-#3\pgf@circ@scaled@Rlen
662 \pgf@y=.5\pgf@y
663 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
664 \pgf@x=-#6\pgf@circ@scaled@Rlen
665 \pgf@x=.5\pgf@x
666 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
667 }
668 \savedanchor{\southwest}{
669 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
670 \pgf@y=-#3\pgf@circ@scaled@Rlen
671 \pgf@y=.5\pgf@y
672 \pgf@x=-#6\pgf@circ@scaled@Rlen
673 \pgf@x=.5\pgf@x
674 }
675 \savedanchor{\centerpoint}{
676 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
677 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
678 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
679 \pgfpointorigin
680 \pgf@y=\pgf@circ@res@up
681 \advance\pgf@y by\pgf@circ@res@down
682 \pgf@y=.5\pgf@y
683 }
684 \anchor{center}{\pgfpointorigin}
685 \anchor{n}{
686 \northeast
687 \pgf@x=0cm
688 }
689 \anchor{north east}{
690 \northeast
691 }
692 \anchor{north west}{
693 \northeast
694 \pgf@x=-\pgf@x
695 }
696 \anchor{ne}{
697 \northeast
698 }
699 \anchor{nw}{
700 \northeast
701 \pgf@x=-\pgf@x
702 }
703 \anchor{e}{
704 \northeast
705 \pgf@y=0cm
706 }
707 \anchor{s}{
708 \southwest
709 \pgf@x=0cm
710 }
711 \anchor{south east}{
712 \southwest
713 \pgf@x=-\pgf@x
714 }
715 \anchor{south west}{
716 \southwest
717 }
718 \anchor{se}{
719 \southwest
720 \pgf@x=-\pgf@x
721 }
722 \anchor{sw}{
723 \southwest
724 }
725 \anchor{w}{
726 \southwest
727 \pgf@y=0cm
728 }
729 \anchor{north}{
730 \northeast
731 \pgf@x=0cm
732 }
733 \anchor{east}{
734 \northeast
735 \pgf@y=0cm
736 }
737 \anchor{south}{
738 \southwest
739 \pgf@x=0cm
740 }
741 \anchor{west}{
742 \southwest
743 \pgf@y=0cm
744 }
745 \anchor{right}{
746 \northeast
747 \pgf@y=0cm
748 }
749 \anchor{above}{
750 \northeast
751 \pgf@x=0cm
752 }
753 \anchor{left}{
754 \southwest
755 \pgf@y=0cm
756 }
757 \anchor{below}{
758 \southwest
759 \pgf@x=0cm
760 }
761 \anchor{a}{
762 \northeast
763 \pgf@y=0cm
764 }
765 \anchor{b}{
766 \southwest
767 \pgf@y=0cm
768 }
769 \savedanchor{\textanchor}{%
770 \pgf@y=\ht\pgfnodeparttextbox
771 \pgf@x=-.5\wd\pgfnodeparttextbox
772 }
773 \anchor{text}{
774 \textanchor
775 }
776 \anchorborder{%
777 \ifpgf@circuit@bipole@inverted
778 \pgf@circ@res@left=-\pgf@x
779 \pgf@circ@res@up=-\pgf@y
780 \else
781 \pgf@circ@res@left=\pgf@x
782 \pgf@circ@res@up=\pgf@y
783 \fi
784 \ifdim\pgf@circ@res@up>0cm
785 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder}
786 \else
787 \southwestborder
788 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
789 \fi
790 }
791
792 #2
793
794 \backgroundpath{
795 \pgfsetcolor{\ctikzvalof{color}}
796
797 \northeast
798 \pgf@circ@res@up = \pgf@y
799 \pgf@circ@res@zero = 0cm
800 \pgf@circ@res@left = -\pgf@x
801 \pgf@circ@res@right = \pgf@x
802 \southwest
803 \pgf@circ@res@down = \pgf@y
804 \pgf@circ@scaled@Rlen=\scaledRlen
805 \pgfstartlinewidth=\pgflinewidth
806 % no rounded corners nor default arrows on bipole's bodies
807 \pgf@circ@reset@arrows@rounded
808 #7
809
810 \pgfsetlinewidth{\pgfstartlinewidth}
811 }
812 }
813 }% %>>>
814
815 %% anchor adjustment macros%<<<
816
817 % Extend the border anchor position by the specified factors on the right-top (north east corner)
818 % and the left-down (southwest border). Argument must be number (possibly decimal) without sign
819
820 \def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down
821 \anchorborder{%
822 \ifpgf@circuit@bipole@inverted
823 \pgf@circ@res@left=-\pgf@x
824 \pgf@circ@res@up=-\pgf@y
825 \else
826 \pgf@circ@res@left=\pgf@x
827 \pgf@circ@res@up=\pgf@y
828 \fi
829 \ifdim\pgf@circ@res@up>0cm
830 \northeastborder
831 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}}
832 \else
833 \southwestborder
834 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}}
835 \fi
836 }
837 }
838
839 % Just up and down (very common)
840 \def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}}% %>>>
841
842 % text position in some component.%<<<1
843 % (added with ieeestd logic ports. Maybe to be extended to other components,
844 % like amplifiers)
845 %
846 \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
847 \tikzset{component text/.is choice}%
848 \tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
849 \tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
850 \ctikzset{component text/.is choice}%
851 \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
852 \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
853 \ctikzset{left text distance/.initial=0.3em}%
854 %>>>
855
856 % voltage direction options%<<<1
857
858 \newif\ifpgf@circ@oldvoltagedirection % default false
859 \newif\ifpgf@circ@explicitvdir
860 \newif\ifpgf@circ@fixbatteries
861
862 \ctikzset{voltage dir/.is choice}
863 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
864 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
865 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
866 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
867 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}%
868 %>>>
869
870 % bipole definitions for path component and text decorations%%<<<1
871 %
872 % Option "t=*" for nodes
873 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
874 %
875 \ctikzset{bipole/.is family}
876 \ctikzset{bipole/kind/.initial=}
877 \ctikzset{bipole/name/.initial=}
878 \newif\ifpgf@circuit@bipole@isvoltage
879 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
880 \newif\ifpgf@circuit@bipole@override@source@vif
881 \ctikzset{bipole/override source vif/.is if=pgf@circuit@bipole@override@source@vif}
882 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
883 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
884 \newif\ifpgf@circuit@bipole@strokedsymbol
885 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
886 \newif\ifpgf@circuit@bipole@iscurrent
887 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
888
889 \ctikzset{bipole/voltage/.is family}
890 \newif\ifpgf@circuit@bipole@voltage@backward
891 \ctikzset{bipole/voltage/direction/.is choice}
892 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
893 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
894 \newif\ifpgf@circuit@bipole@voltage@below
895 \ctikzset{bipole/voltage/position/.is choice}
896 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
897 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
898
899 \ctikzset{bipole/voltage/label/unit/.initial=}
900 \ctikzset{bipole/voltage/label/name/.initial=}
901
902 \ctikzset{bipole/current/.is family}
903 \newif\ifpgf@circuit@bipole@current@backward
904 \ctikzset{bipole/current/direction/.is choice}
905 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
906 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
907 \newif\ifpgf@circuit@bipole@current@before
908 \ctikzset{bipole/current/x position/.is choice}
909 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
910 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
911 \newif\ifpgf@circuit@bipole@current@below
912 \ctikzset{bipole/current/y position/.is choice}
913 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
914 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
915 \ctikzset{bipole/current/label/unit/.initial=}
916 \ctikzset{bipole/current/label/name/.initial=}
917
918 \ctikzset{bipole/flow/.is family}
919 \newif\ifpgf@circuit@bipole@flow@backward
920 \ctikzset{bipole/flow/direction/.is choice}
921 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
922 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
923 \newif\ifpgf@circuit@bipole@flow@before
924 \ctikzset{bipole/flow/x position/.is choice}
925 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
926 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
927 \newif\ifpgf@circuit@bipole@flow@below
928 \ctikzset{bipole/flow/y position/.is choice}
929 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
930 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
931 \ctikzset{bipole/flow/label/unit/.initial=}
932 \ctikzset{bipole/flow/label/name/.initial=}
933 \ctikzset{flow/distance/.initial = .5}
934 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
935
936 \ctikzset{bipole/label/.is family}
937 \ctikzset{bipole/label/position/.initial=90}
938 \ctikzset{bipole/label/unit/.initial=}
939 \ctikzset{bipole/label/name/.initial=}
940 \ctikzset{bipole/annotation/.is family}
941 \ctikzset{bipole/annotation/position/.initial=-90}
942 \ctikzset{bipole/annotation/unit/.initial=}
943 \ctikzset{bipole/annotation/name/.initial=}
944
945
946 \ctikzset{label/align/.is choice}
947 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
948 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
949 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
950 %%>>>
951
952 % traditional styles %<<<1
953 %
954 \ctikzset{thickness/.initial=2}
955 \ctikzset{color/.initial=black}
956 \pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
957 \ctikzset{bipoles/border margin/.initial=1.1}
958 \ctikzset{bipoles/thickness/.initial=2}
959 \ctikzset{tripoles/thickness/.initial=2}
960 \ctikzset{quadpoles/thickness/.initial=2}
961 \ctikzset{nodes width/.initial=.04}
962 %%>>>
963
964 % Styles definitions and macros%<<<1
965
966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
967 %% main style definitions
968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
969
970 % load a style file: search ctikzstyle-NAME.tex in path
971 \def\ctikzloadstyle#1{%
972 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
973 \tikzerror{I did not find the circuitikz style #1}}%
974 }
975
976 % load and enact a style
977 \def\ctikzsetstyle#1{%
978 \ctikzloadstyle{#1}%
979 \tikzset{#1 circuit style}%
980 }
981
982 % global style parameters
983 \ctikzset{default/scale/.initial=1.0} % do not touch
984 \ctikzset{default/fill/.initial=none} % do not touch
985 \ctikzset{default/thickness/.initial=none} % do not touch
986 % default is use as the generic default style for bipoles
987
988 % mostly bipoles:
989
990 \ctikzset{resistors/scale/.initial=1.0}
991 \ctikzset{resistors/fill/.initial=none}
992 \ctikzset{resistors/thickness/.initial=none}
993 \ctikzset{resistors/modifier thickness/.initial=1}% relative to main thickness
994
995 \ctikzset{capacitors/scale/.initial=1.0}
996 \ctikzset{capacitors/fill/.initial=none}
997 \ctikzset{capacitors/thickness/.initial=none}
998 \ctikzset{capacitors/modifier thickness/.initial=1}
999
1000 \ctikzset{inductors/scale/.initial=1.0}
1001 \ctikzset{inductors/fill/.initial=none}
1002 \ctikzset{inductors/thickness/.initial=none}
1003 \ctikzset{inductors/modifier thickness/.initial=1}
1004
1005 \ctikzset{diodes/scale/.initial=1.0}
1006 \ctikzset{diodes/fill/.initial=none}
1007 \ctikzset{diodes/thickness/.initial=none}
1008
1009 \ctikzset{batteries/scale/.initial=1.0}
1010 \ctikzset{batteries/fill/.initial=none}
1011 \ctikzset{batteries/thickness/.initial=none}
1012
1013 \ctikzset{sources/scale/.initial=1.0}
1014 \ctikzset{sources/fill/.initial=none}
1015 \ctikzset{sources/thickness/.initial=none}
1016
1017 \ctikzset{csources/scale/.initial=1.0}
1018 \ctikzset{csources/fill/.initial=none}
1019 \ctikzset{csources/thickness/.initial=none}
1020
1021 \ctikzset{instruments/scale/.initial=1.0}
1022 \ctikzset{instruments/fill/.initial=none}
1023 \ctikzset{instruments/thickness/.initial=none}
1024
1025 \ctikzset{mechanicals/scale/.initial=1.0}
1026 \ctikzset{mechanicals/fill/.initial=none}
1027 \ctikzset{mechanicals/thickness/.initial=none}
1028
1029 \ctikzset{misc/scale/.initial=1.0}
1030 \ctikzset{misc/fill/.initial=none}
1031 \ctikzset{misc/thickness/.initial=none}
1032
1033 \ctikzset{blocks/scale/.initial=1.0}
1034 \ctikzset{blocks/fill/.initial=none}
1035 \ctikzset{blocks/thickness/.initial=none}
1036
1037 % mostly nodes
1038
1039 \ctikzset{grounds/scale/.initial=1.0}
1040 \ctikzset{grounds/fill/.initial=none}
1041 \ctikzset{grounds/thickness/.initial=none}
1042
1043 \ctikzset{power supplies/scale/.initial=1.0}
1044 \ctikzset{power supplies/fill/.initial=none}
1045 \ctikzset{power supplies/thickness/.initial=none}
1046
1047 \ctikzset{transistors/scale/.initial=1.0}
1048 \ctikzset{transistors/fill/.initial=none}
1049 \ctikzset{transistors/thickness/.initial=none}
1050 \ctikzset{transistors/modifier thickness/.initial=1}% relative to main thickness
1051
1052 \ctikzset{tubes/scale/.initial=1.0}
1053 \ctikzset{tubes/fill/.initial=none}
1054 \ctikzset{tubes/thickness/.initial=none}
1055
1056 \ctikzset{RF/scale/.initial=1.0}
1057 \ctikzset{RF/fill/.initial=none}
1058 \ctikzset{RF/thickness/.initial=none}
1059
1060 \ctikzset{electromechanicals/scale/.initial=1.0}
1061 \ctikzset{electromechanicals/fill/.initial=none}
1062 \ctikzset{electromechanicals/thickness/.initial=none}
1063
1064 % transformers go with inductors
1065 \ctikzset{amplifiers/scale/.initial=1.0}
1066 \ctikzset{amplifiers/fill/.initial=none}
1067 \ctikzset{amplifiers/thickness/.initial=none}
1068
1069 \ctikzset{switches/scale/.initial=1.0}
1070 \ctikzset{switches/fill/.initial=none}
1071 \ctikzset{switches/thickness/.initial=none}
1072
1073 \ctikzset{logic ports/scale/.initial=1.0}
1074 \ctikzset{logic ports/fill/.initial=none}
1075 \ctikzset{logic ports/thickness/.initial=none}
1076
1077 \ctikzset{flipflops/scale/.initial=1.0}
1078 \ctikzset{flipflops/fill/.initial=none}
1079 \ctikzset{flipflops/thickness/.initial=none}
1080
1081 \ctikzset{muxdemuxes/scale/.initial=1.0}
1082 \ctikzset{muxdemuxes/fill/.initial=none}
1083 \ctikzset{muxdemuxes/thickness/.initial=none}
1084
1085 \ctikzset{chips/scale/.initial=1.0}
1086 \ctikzset{chips/fill/.initial=none}
1087 \ctikzset{chips/thickness/.initial=none}
1088
1089 \ctikzset{displays/scale/.initial=1.0}
1090 \ctikzset{displays/fill/.initial=none}
1091 \ctikzset{displays/thickness/.initial=none}
1092 %
1093 % general styles
1094 %
1095 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
1096 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
1097 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
1098 %%>>>
1099
1100 % voltage and current options%<<<1
1101 %
1102 \ctikzset{current arrow scale/.initial=16}
1103 \ctikzset{current/distance/.initial = .5}
1104
1105 \newif\ifpgf@circuit@europeancurrent
1106 \newif\ifpgf@circuit@europeanvoltage
1107 \newif\ifpgf@circuit@bipole@voltage@straight
1108 \newif\ifpgf@circuit@bipole@voltage@raised
1109
1110 \ctikzset{voltage/.is choice}
1111 %
1112 % straight is expected to be a subset of european, so disable it in american style
1113 %
1114 \ctikzset{voltage/american/.code = {%
1115 \pgf@circuit@europeanvoltagefalse
1116 \pgf@circuit@bipole@voltage@straightfalse
1117 \pgf@circuit@bipole@voltage@raisedfalse
1118 }}
1119 \ctikzset{voltage/raised/.code = {%
1120 \pgf@circuit@europeanvoltagefalse
1121 \pgf@circuit@bipole@voltage@straightfalse
1122 \pgf@circuit@bipole@voltage@raisedtrue
1123 }}
1124 \ctikzset{voltage/european/.code = {%
1125 \pgf@circuit@europeanvoltagetrue
1126 \pgf@circuit@bipole@voltage@straightfalse
1127 \pgf@circuit@bipole@voltage@raisedfalse
1128 }}
1129 \ctikzset{voltage/straight/.code = {%
1130 \pgf@circuit@europeanvoltagetrue
1131 \pgf@circuit@bipole@voltage@straighttrue
1132 \pgf@circuit@bipole@voltage@raisedfalse
1133 }}
1134 \ctikzset{voltage/curved/.code = {%
1135 \pgf@circuit@europeanvoltagetrue
1136 \pgf@circuit@bipole@voltage@straightfalse
1137 \pgf@circuit@bipole@voltage@raisedfalse
1138 }}
1139 % are these used?
1140 \ctikzset{current/.is choice}
1141 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
1142 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
1143
1144 % this is left for backward compatibility...
1145 \ctikzset{straight/.is choice}
1146 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
1147 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
1148 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
1149 %
1150 % voltage is used also to set parameters, apart for the /.is choice
1151 % above. I hope it is ok --- would be a mess otherwise
1152 %
1153 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
1154 \ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
1155 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
1156 %
1157 % keys for exporting voltage, current, flow anchors
1158 %
1159 \newif\ifpgfcirc@has@v\pgfcirc@has@vfalse
1160 \newif\ifpgfcirc@has@f\pgfcirc@has@ffalse
1161 \newif\ifpgfcirc@has@i\pgfcirc@has@ifalse
1162 \def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname}
1163 \def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname}
1164 %
1165 % shaping the +/- sign, see pgfcircvoltage.tex
1166 \ctikzset{voltage/american font/.initial={}}
1167 \ctikzset{voltage/american plus/.initial={$+$}}
1168 \ctikzset{voltage/american minus/.initial={$-$}}
1169 % here we start the voltage adjustments for special components.
1170 % default values:
1171 %
1172 % this is the distance of the "point" marking the voltage along the line
1173 % 0.0 is on the external nodes of the to path
1174 % 1.0 is cramped on the object
1175 % this can be overriden component by component
1176 \ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1
1177 %
1178 % this is the distance from the line (perpendicular to) where the voltage is drawn.
1179 % It is global, and not adjustable by component (use the "label distance" or locally
1180 % if you need it)
1181 \ctikzset{voltage/distance from line/.initial=.08}% in \pgf@circ@scaled@Rlen units
1182 %
1183 % bend paramenters for european arc. You can override them component-based
1184 \ctikzset{voltage/bump b/.initial=1.5}
1185 %
1186 % generator voltages symbols or arrows (always straight) are put along the
1187 % 60 ... 120 angles of the symbol (don't ask why). The distance here is on the
1188 % center..angle line. It's called bump a because I don't know...
1189 %
1190 \ctikzset{voltage/bump a/.initial=1.2}
1191 %
1192 % these are the label distances FROM the drawings.
1193 % You can override them component by component.
1194 \ctikzset{voltage/european label distance/.initial=1.4}
1195 \ctikzset{voltage/straight label distance/.initial=1.4}
1196 \ctikzset{voltage/american label distance/.initial=1.4}
1197 % american open voltage adjusting
1198 %
1199 \newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue
1200 \ctikzset{open voltage position/.is choice}
1201 \ctikzset{open voltage position/center/.code={\pgf@adjust@open@voltagetrue}}
1202 \ctikzset{open voltage position/legacy/.code={\pgf@adjust@open@voltagefalse}}
1203 % bad names, kept for compatibility, don't use
1204 \ctikzset{american open voltage/.is choice}
1205 \ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}}
1206 \ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}}
1207 %
1208 % voltage and current styles
1209 %
1210 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
1211 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
1212 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
1213 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
1214 \tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
1215 \tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}}
1216 %%>>>
1217
1218 % vim: set fdm=marker fmr=%<<<,%>>>:
1219 %%%---------- close: tex/pgfcirc.defines
1220
1221 % setup option defaults and process them
1222 % notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning
1223 \ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages, americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels}
1224 \ProcessOptions\relax
1225
1226 %%%%%%%%%%% Springe nach tex/pgfcircutils
1227 %%%---------- open: tex/pgfcircutils.tex
1228 % Copyright 2018-2026 by Romano Giannetti
1229 % Copyright 2015-2026 by Stefan Lindner
1230 % Copyright 2013-2026 by Stefan Erhardt
1231 % Copyright 2007-2026 by Massimo Redaelli
1232 %
1233 % This file may be distributed and/or modified
1234 %
1235 % 1. under the LaTeX Project Public License and/or
1236 % 2. under the GNU Public License.
1237 %
1238 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
1239
1240 \def\pgf@circ@handleSI#1{
1241 \noexpandarg
1242 \def\pgf@temp{}
1243 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
1244 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
1245
1246 \ifnum\pgf@circ@handleSI@unit@len=0
1247 \pgf@circ@siunitx@resfalse
1248 \else
1249 \IfEndWith{#1}{>}{
1250 \pgf@circ@siunitx@restrue
1251 \noexpandarg
1252 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
1253 %\typeout{si |#1|}
1254 }{
1255 \pgf@circ@siunitx@resfalse
1256 %\typeout{no si |#1|}
1257 }
1258 \fi
1259 }
1260
1261 \def\pgf@circ@ifkeyempty#1{
1262 \pgfextra{
1263 \ctikzset{#1/.get=\pgf@circ@temp}
1264 \edef\pgf@temp{}
1265 }
1266 \ifx\pgf@circ@temp\pgf@temp
1267 }
1268
1269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1270 %% Math routines
1271
1272 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
1273
1274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1275 %% useful commands
1276
1277 \ifpgfutil@format@is@latex
1278 %% flipping text
1279 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
1280 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
1281 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
1282 % text mode overbar
1283 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1284 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
1285 \else\ifpgfutil@format@is@plain
1286 % text mode overbar
1287 % but really circuitikz will not work in plain...
1288 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1289 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
1290 \else\ifpgfutil@format@is@context
1291 %% flipping text
1292 \def\ctikzflipx#1{\mirror{#1}}
1293 \def\ctikzflipy#1{\mirror{\rotate[rotation=180]{#1}}}
1294 \def\ctikzflipxy#1{\rotate[rotation=180]{#1}}
1295 % text mode overbar
1296 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1297 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
1298 \fi\fi\fi
1299
1300 %%%%%%%%%%%%%%%%%%%%%%%%%%%
1301 %% switch to use fpu in reciprocal scale transformations
1302 %%
1303 %% this code has been contributed by Schrödinger's cat
1304 %% https://tex.stackexchange.com/a/529159/38080
1305 %%
1306 %% Use the official key to use the fpu if installed, see
1307 %% https://github.com/pgf-tikz/pgf/issues/861
1308 %%
1309 %% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080
1310 %% Thanks to Henri Menke for a faster approach https://github.com/circuitikz/circuitikz/commit/00966c45c42b464fab5429f89f2b7fb414e9b3f7#commitcomment-54592494
1311 %%
1312 \pgfkeysifdefined{/pgf/fpu/install only/.@cmd}{%
1313 \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}%
1314 }{%
1315 \pgfkeysifdefined{/pgf/use fpu reciprocal/.@cmd}{% use stock one
1316 }{
1317 \pgfqkeys{/pgf}{use fpu reciprocal/.code={%
1318 \def\pgfmathreciprocal@##1{%
1319 \begingroup
1320 \pgfmathfloatparsenumber{##1}%
1321 \pgfmathfloatreciprocal@{\pgfmathresult}%
1322 \pgfmathfloattofixed@{\pgfmathresult}%
1323 \pgfmath@smuggleone\pgfmathresult
1324 \endgroup
1325 }}}}%
1326 }
1327
1328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1329 %% subcircuits (experimental)
1330 %%
1331 %% introduced by Romano Giannetti around April 2021
1332 %% changes suggested by Jonathan P. Spratte
1333 %%
1334 \newbox\ctikz@scratchbox
1335 \pgfutil@protected\def\ctikzsubcircuitdef#1#2#3{%
1336 \expandafter\gdef\csname #1@Anchor\endcsname{}%
1337 \expandafter\gdef\csname #1@setanchors\endcsname{%
1338 \setbox\ctikz@scratchbox=\hbox{%
1339 \tikzpicture
1340 \draw (0,0) \csname#1\endcsname{T-#1}{};
1341 \foreach [count=\i] \anchor in {#2}
1342 % reference anchor is -center
1343 \draw (0,{2-\i/2}) let \p1 = ($(T-#1-subckt@reference)-(T-#1-\anchor)$) in
1344 node[right]{\anchor: \x1,\y1 \expandafter\xdef\csname #1@Anchor\anchor\endcsname{++(\x1,\y1)}};
1345 \endtikzpicture
1346 }%
1347 }%
1348 \expandafter\gdef\csname#1\endcsname##1##2{%
1349 \csname #1@Anchor##2\endcsname coordinate(##1-subckt@reference)#3%
1350 }%
1351 }
1352 \long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname}
1353
1354
1355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1356 %% Basic utility macros
1357 %%
1358 %% Functions provided here are:
1359 %% \pgf@circ@ifempty{<argument>}{<true>}{<false>}
1360 %% Tests whether <argument> is completely empty.
1361 %% \pgf@circ@ifblank{<argument>}{<true>}{<false>}
1362 %% Tests whether <argument> is either empty or only contains spaces.
1363 %% \pgf@circ@trimspaces@do{<argument>}{<next>}
1364 %% Trims at most one space from either end of <argument> and forwards the
1365 %% result to <next> as <next>{<trimmed argument>}
1366
1367 % these two are pretty standard code
1368 \long\def\pgf@circ@ifempty#1%
1369 {%
1370 \if\relax\detokenize{#1}\relax
1371 \expandafter\pgfutil@firstoftwo
1372 \else
1373 \expandafter\pgfutil@secondoftwo
1374 \fi
1375 }
1376 \long\def\pgf@circ@ifblank#1%
1377 {%
1378 \if\relax\detokenize\expandafter{\pgfutil@gobble#1.}\relax
1379 \expandafter\pgfutil@firstoftwo
1380 \else
1381 \expandafter\pgfutil@secondoftwo
1382 \fi
1383 }
1384
1385 % \pgfutil@trimspaces needs two expansions. The first expansion we'll do during
1386 % the definition.
1387 \def\pgf@circ@trimspaces@do#1%
1388 {%
1389 \def\pgf@circ@trimspaces@do##1%
1390 {\expandafter\pgf@circ@trimspaces@do@\expandafter{#1}}%
1391 }
1392 \expandafter\pgf@circ@trimspaces@do\expandafter{\pgfutil@trimspaces{#1}}
1393 \def\pgf@circ@trimspaces@do@#1#2{#2{#1}}
1394
1395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1396 %% list handling
1397 %%
1398 %% Contribution by Jonathan P. Spratte (blame him!)
1399 %%
1400 %% The list implementation here has a few limitations. Those are:
1401 %% 1. not long, so no \par in the lists (but many used functions in pgfutil
1402 %% aren't long as well)
1403 %% 2. list elements can't contain a Q with category code 3 (but the used
1404 %% function \pgfutil@trimspaces doesn't support them as well, and this
1405 %% should be a very rare token anyway)
1406 %% 3. list elements can't contain the token \pgf@circ@set@list as that is used
1407 %% as the end marker
1408 %% 4. currently these lists are meant for numeric data (hence only
1409 %% \pgf@circ@if@num@in@list is provided as a test), as a result there is
1410 %% another limitation for the data here. If the list element contains no
1411 %% hyphen '-', the element will be stored without further processing
1412 %% 'as-is' (well, after trimming spaces). If there is a hyphen we assume
1413 %% well-behaved input data and will interpret this as a num-range without
1414 %% further tests.
1415 %%
1416 %% Functions provided here are:
1417 %% \pgf@circ@set@list<macro>{<csv-list>}
1418 %% Parses the <csv-list> and stores the result inside <macro> (local
1419 %% assignment). If a num-range given as <start - stop> (with or without
1420 %% spaces) is found it will be expanded to <start>,<start+1>,...,<stop>.
1421 %% \pgf@circ@if@num@in@list<macro>{<value>}{<true>}{<false>}
1422 %% Checks whether <value> (numeric value, evaluated once with \numexpr) is
1423 %% found inside the list stored in <macro>. There are two special cases: If
1424 %% <macro> is undefined <false> is executed. If the list contains only one
1425 %% element and that is `all' <true> is executed.
1426
1427 % set the catcode of our marker
1428 \chardef\pgf@circ@temp=\the\catcode`\Q
1429 \catcode`\Q=3
1430
1431 % lists will have the structure
1432 % <marker><element 1><marker>...<element n><marker>
1433 % As marker we use a Q with category 3. Under the assumption that no list
1434 % element does ever contain that token we can set the elements without braces,
1435 % allowing us to use \pgfutil@in@ to search for elements (see above). The other
1436 % token that isn't allowed to show up in the list is \pgf@circ@set@list, that we
1437 % use as another marker during parsing.
1438 % The other big restriction in this implementation is that lists can't contain a
1439 % \par (but \pgfutil@in@ doesn't support that anyway so there is not much
1440 % sense in supporting it here)
1441 \pgfutil@protected\def\pgf@circ@set@list#1#2%
1442 {%
1443 % clear the error flag
1444 \let\pgf@circ@error@marker\pgf@circ@undefined
1445 % set the list
1446 \edef#1%
1447 {Q\pgf@circ@set@list@sanitize#2,\pgf@circ@set@list,\pgf@circ@set@list}%
1448 % there was an error, throw the error message, recovery was already done by
1449 % ignoring the offending elements.
1450 \ifx\pgf@circ@error@marker\relax
1451 \begingroup
1452 \newlinechar`\^^J
1453 \pgfutil@packageerror{circuitikz}
1454 {%
1455 Unallowed marker found in list^^J%
1456 \pgfutil@unexpanded{#2}.^^J%
1457 Offending elements were ignored.%
1458 }
1459 {Lists can't contain a Q with category code 3}%
1460 \endgroup
1461 \fi
1462 }
1463 % just a utility for the <marker> test
1464 \def\pgf@circ@set@list@gobbletomarker#1Q{}
1465 % quick way to check whether list parsing is done by gobbling up to a marker, in
1466 % this case the marker is \pgf@circ@set@list
1467 \def\pgf@circ@set@list@sanitize@checkend#1\pgf@circ@set@list{}
1468 % will only be called after the last element is handled, will gobble the
1469 % remainder of the current sanitizing step
1470 \def\pgf@circ@set@list@sanitize@end\pgf@circ@set@list#1\pgf@circ@set@list{}
1471 % grabs the next list element, checks whether we're done, and if not sanitizes
1472 % it (meaning stripping spaces from either end and placing the <marker>).
1473 \def\pgf@circ@set@list@sanitize#1,%
1474 {%
1475 \pgf@circ@set@list@sanitize@checkend
1476 #1\pgf@circ@set@list@sanitize@end\pgf@circ@set@list
1477 \pgf@circ@set@list@sanitize@a{#1}%
1478 }
1479 % testing whether a list element contains the used <marker> expandably, if it
1480 % does set the flag, else continue sanitizing.
1481 \def\pgf@circ@set@list@sanitize@a#1%
1482 {%
1483 \expandafter\pgf@circ@ifempty\expandafter
1484 % if this is empty no marker was found
1485 {\pgf@circ@set@list@gobbletomarker#1Q}
1486 {%
1487 \pgf@circ@ifblank{#1}
1488 {}% ignore blank entries
1489 {\pgf@circ@trimspaces@do{#1}\pgf@circ@set@list@sanitize@b}%
1490 }
1491 {%
1492 % panic, there was a marker found in a list element. We'll recover by
1493 % ignoring the current element after setting a flag. When we do
1494 % \csname ...\endcsname on an undefined macro name TeX will let that
1495 % macro to relax and we exploit this to expandable set a flag and
1496 % gobbling the result.
1497 \expandafter\pgfutil@gobble\csname pgf@circ@error@marker\endcsname
1498 }%
1499 % get the next element
1500 \pgf@circ@set@list@sanitize
1501 }
1502 % we'll protect any element from further expanding using \unexpanded and place
1503 % the marker after the element, and ignore empty/blank elements
1504 \def\pgf@circ@set@list@sanitize@b#1%
1505 {%
1506 \expandafter\pgf@circ@ifempty\expandafter
1507 % if this is empty no hyphen is found
1508 {\pgf@circ@gobbletohyphen#1-}
1509 {\pgfutil@unexpanded{#1}Q}
1510 {\pgf@circ@set@list@parse@range{#1}}%
1511 }
1512 \def\pgf@circ@gobbletohyphen#1-{}
1513 \def\pgf@circ@set@list@parse@range#1{\pgf@circ@set@list@parse@range@a#1Q}
1514 \def\pgf@circ@set@list@parse@range@a#1-#2Q%
1515 {%
1516 \expandafter\pgf@circ@set@list@parse@range@b
1517 \the\numexpr#1\expandafter Q\the\numexpr#2Q%
1518 }
1519 \def\pgf@circ@set@list@parse@range@b#1Q#2Q%
1520 {%
1521 \ifnum#1<#2
1522 % expand to the range from #1 to #2 (inclusive)
1523 \pgf@circ@set@list@range{#1}{#2}%
1524 \else
1525 \ifnum#2<#1
1526 % if #2 is smaller than #1 just swap the order
1527 \pgf@circ@set@list@range{#2}{#1}%
1528 \else
1529 % last case, they are equal, so just put the result here
1530 #1Q%
1531 \fi
1532 \fi
1533 }
1534 \def\pgf@circ@set@list@parse@range@norange#1Q#2{\pgfutil@unexpanded{#2}Q}
1535 \def\pgf@circ@set@list@range#1#2%
1536 {%
1537 #1Q%
1538 \ifnum#1<#2
1539 \expandafter\pgfutil@secondoftwo
1540 \fi
1541 \pgfutil@gobble
1542 {\expandafter\pgf@circ@set@list@range\expandafter{\the\numexpr#1+1}{#2}}%
1543 }
1544
1545 % flag for special value
1546 \def\pgf@circ@all@flag{QallQ}
1547 \pgfutil@protected\def\pgf@circ@if@num@in@list#1#2%
1548 {%
1549 % test whether the list macro is defined, if it isn't result is false
1550 \pgfutil@ifx\pgf@circ@undefined#1%
1551 {\pgfutil@secondoftwo}
1552 {%
1553 % test whether the list macro is just the special value 'all', if so
1554 % true, else search (and start that by evaluating a numexpr)
1555 \pgfutil@ifx\pgf@circ@all@flag#1%
1556 {\pgfutil@firstoftwo}
1557 {%
1558 \expandafter\pgf@circ@if@num@in@list@a\expandafter
1559 {\the\numexpr#2}%
1560 #1%
1561 }%
1562 }%
1563 }
1564 % next step is expanding the list macro
1565 \pgfutil@protected\def\pgf@circ@if@num@in@list@a#1#2%
1566 {\expandafter\pgf@circ@if@num@in@list@b\expandafter{#2}{#1}}
1567 % now use \pgfutil@in@ to check whether there is the searched list element
1568 \pgfutil@protected\def\pgf@circ@if@num@in@list@b#1#2%
1569 {%
1570 \begingroup
1571 % put the <marker> around the number to make sure only full matches are
1572 % found. \pgfutil@in@ will set \ifpgfutil@in@ to true if it finds a match
1573 \pgfutil@in@{Q#2Q}{#1}%
1574 \expandafter
1575 \endgroup
1576 \ifpgfutil@in@
1577 \expandafter\pgfutil@firstoftwo
1578 \else
1579 \expandafter\pgfutil@secondoftwo
1580 \fi
1581 }
1582
1583 % reset the catcode of Q
1584 \catcode`\Q=\pgf@circ@temp
1585
1586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1587 %% temporary fix for old TikZ versions (remove me)
1588 %%
1589 %% All blame to Romano Giannetti for this code!
1590 %%
1591 %% This tries to be smart and provide \pgfutil@unexpanded and \pgfutil@ifx if
1592 %% PGF doesn't provide them.
1593
1594 \ifx\pgfutil@unexpanded\pgf@circ@undefined
1595 \ifpgfutil@format@is@context
1596 \let\pgfutil@unexpanded\normalunexpanded
1597 \else
1598 \let\pgfutil@unexpanded\unexpanded
1599 \fi
1600 \fi
1601
1602 \ifx\pgfutil@ifx\pgf@circ@undefined
1603 \long\def\pgfutil@ifx#1#2{%
1604 \ifx#1#2%
1605 \expandafter\pgfutil@firstoftwo
1606 \else
1607 \expandafter\pgfutil@secondoftwo
1608 \fi}
1609 \fi
1610
1611 %%
1612 %% generic tunable arrow for components that have no "variable" thing
1613 %%
1614 \def\ctikztunablearrow{\pgfutil@ifnextchar[{\ctikztunablearrow@full}{\ctikztunablearrow@simple}}%
1615 \def\ctikztunablearrow@simple{\ctikztunablearrow@full[]}%
1616 \def\ctikztunablearrow@full[#1]#2#3#4#5{%
1617 % add tunable arrow to a component
1618 % relative thickness, relative length, rotation from axis, name of the component
1619 \scope
1620 \draw
1621 \pgfextra{\pgfcirc@set@arrows{tunable}{}{latexslim}
1622 \pgfsetlinewidth{#2\pgflinewidth}} [#1]
1623 let \p1=($(#5.north east)-(#5.south west)$), \p2=($(#5.east)-(#5.west)$),
1624 \n1 = {veclen(\x1,\y1)},
1625 \n2 = {atan2(\y2,\x2)} in
1626 % node[above]{\n1, \n2}
1627 (#5.center) ++({\n2+(#4)}:{-0.5*(\n1)*(#3)}) -- ++({\n2+(#4)}:{(\n1)*(#3)});
1628 \endscope
1629 }
1630 %%%---------- close: tex/pgfcircutils
1631 %%%%%%%%%%% Springe nach tex/pgfcircpath
1632 %%%---------- open: tex/pgfcircpath.tex
1633 % Copyright 2018-2026 by Romano Giannetti
1634 % Copyright 2015-2026 by Stefan Lindner
1635 % Copyright 2013-2026 by Stefan Erhardt
1636 % Copyright 2007-2026 by Massimo Redaelli
1637 %
1638 % This file may be distributed and/or modified
1639 %
1640 % 1. under the LaTeX Project Public License and/or
1641 % 2. under the GNU Public License.
1642 %
1643 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
1644
1645
1646 \def\pgf@circ@direction{0.0}
1647
1648 % swap two coordinates
1649 \def\pgfcirc@swap@coordinates#1#2{%
1650 coordinate (pgfcirc@tmp@swap) at (#1)
1651 coordinate (#1) at (#2)
1652 coordinate (#2) at (pgfcirc@tmp@swap)
1653 }
1654
1655 % Names
1656 \ctikzset{name/.style = { n={#1} } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
1657 \ctikzset{n/.code = {
1658 \pgfkeys{/tikz/circuitikz/bipole/name={#1}}
1659 }}
1660
1661 % Reflect the node along
1662 \ctikzset{mirrored/.is choice}
1663 \ctikzset{mirror value/.initial=1}
1664 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
1665 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
1666 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
1667
1668 % Invert node along path
1669 \ctikzset{inverted/.is choice}
1670 \ctikzset{invert value/.initial=1}
1671 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
1672 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
1673 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
1674 \newif\ifpgf@circuit@bipole@inverted
1675 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
1676
1677 \newif\ifpgf@circuit@bipole@voltage@backward
1678 \ctikzset{bipole/voltage/direction/.is choice}
1679 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
1680 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
1681
1682 % Initialize paths
1683 \def\pgfcircresetpath{
1684 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
1685 bipole/inverted=false, bipole/kind=,
1686 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
1687 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
1688 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
1689 bipole/current/y position=above, bipole/current/direction=forward,
1690 mirrored=false
1691 }
1692 }
1693
1694 %
1695 % expandable IF for the extra nodes (thanks to Henri Menke)
1696 % see https://chat.stackexchange.com/transcript/message/56560808#56560808
1697 %
1698 \def\pgfcirc@if@has@i{%
1699 \ifpgfcirc@has@i
1700 \expandafter\pgfutil@firstoftwo
1701 \else
1702 \expandafter\pgfutil@secondoftwo
1703 \fi}
1704 \def\pgfcirc@if@has@v{%
1705 \ifpgfcirc@has@v
1706 \expandafter\pgfutil@firstoftwo
1707 \else
1708 \expandafter\pgfutil@secondoftwo
1709 \fi}
1710 \def\pgfcirc@if@has@f{%
1711 \ifpgfcirc@has@f
1712 \expandafter\pgfutil@firstoftwo
1713 \else
1714 \expandafter\pgfutil@secondoftwo
1715 \fi}
1716
1717
1718
1719 %% Generic bipole path
1720 \def\pgf@circ@bipole@path#1#2{
1721 % Create a bipole path from the shapes defined with \pgfcircdeclarebipole
1722 % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape"
1723 % appended to the main (path-style) name
1724 % #1 path-style node name
1725 % #2 the argument passed from the to-path structure; don't touch
1726 %
1727 % Example:
1728 % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
1729 %
1730 \pgf@circ@bipole@path@base{shape}{}{#1}{#2}
1731 }
1732 %%
1733 %% ultra-generic bipole path
1734 %% I am not sure what the last argument is needed for, but don't touch it or everything explodes
1735 %%
1736 \def\pgf@circ@bipole@path@base#1#2#3#4{%
1737 %
1738 % Create a path-style component based on a node-style shape
1739 % #1: postfix to be added to the name path to obtain the main shape name
1740 % #2: text to be passed as text to the node
1741 % #3: name of the bipole component
1742 % #4: this will be filled by the argument of the to-path
1743 %
1744 \pgfextra{
1745 \ctikzset{bipole/kind = #3}
1746 \edef\pgf@temp{\ctikzvalof{bipole/name}}
1747 \def\pgf@circ@temp{}
1748 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
1749 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
1750 \ctikzset{bipole/name = pgfcirc@#3\pgf@circ@rand} % create it (re-usage should not create problem, but...)
1751 \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing
1752 \else
1753 \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors
1754 \fi
1755 }
1756 % save start and stop values
1757 % notice that we DO NOT MOVE the path position at all!
1758 coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart)
1759 coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget)
1760 \pgfextra{
1761 % find the direction (angle) of the path
1762 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
1763 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
1764 \edef\pgf@circ@direction{\pgfmathresult}
1765 % the global macro pgfcirc@whatever-direction is accessible as \ctikzgetdirection{whatever}
1766 % this gives access to the element path direction
1767 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction}
1768 }
1769 % position the component in the middle of the path. We DO NOT MOVE the current position!
1770 node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value},
1771 xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name})
1772 at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2}
1773 % set start and end labels
1774 \ifpgf@circuit@bipole@inverted
1775 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
1776 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
1777 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
1778 \else
1779 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.right)
1780 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.left)
1781 \fi
1782 \else
1783 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
1784 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
1785 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
1786 \else
1787 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.left)
1788 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.right)
1789 \fi
1790 \fi
1791 % draw the leads unless it's an open circuit
1792 % stop at the component
1793 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
1794 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
1795 \else
1796 % it is important to start the path with -- to have correct line joins!
1797 -- (pgfcirc@anchorstartnode)
1798 \fi
1799 % Add all the "ornaments": labels, annotations, voltages, currents and flows
1800 \drawpoles
1801 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
1802 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
1803 % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a
1804 % it should be logically safe for older version too --- even if TikZ reverted the change
1805 % use explandable ifs too, thanks to Henri Menke
1806 {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}%
1807 {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}%
1808 {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}%
1809 % finish the path from the component to the final target
1810 % you never know --- re-set \pgf@temp to detect open
1811 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
1812 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
1813 (\tikztotarget)
1814 \else
1815 (pgfcirc@anchorendnode) -- (\tikztotarget)
1816 \fi
1817 % reset internal circuit keys
1818 \pgfextra{\pgfcircresetpath}
1819 %draw pending nodes an path
1820 \tikztonodes
1821 }
1822
1823 %% Macros for path and style activation for bipoles or path-style
1824
1825 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
1826 \def\compattikzset#1{%
1827 % \typeout{BIPOLEDEF:\space \detokenize{#1}}%
1828 \tikzset{\comnpatname#1}}
1829 %
1830 % this is used for components that are mainly node-style but have a path-style form
1831 %
1832 \def\pgfcirc@node@to@path#1#2#3{%
1833 % add a path-style component based on a node-style one without mangling the name
1834 % of the shape.
1835 % #1: node-type shape name (existing)
1836 % #2: path-type name (to be created)
1837 % #3: additional options to add to the path style
1838 %
1839 \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}%
1840 \compattikzset{#2/.style = {\circuitikzbasekey,
1841 /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1},
1842 #3}}%
1843 \ctikzset{bipoles/#1/height/.initial=1}%
1844 }
1845 %
1846 % this one is for normal definition: path to style, directly
1847 % the first parameter (#1) here is l,v,i (l=..., v=..., i=...)
1848 % the last parameter are options to be inserted in the "to path" definition
1849 %
1850 \def\pgfcirc@path@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@#2@path to style #3
1851 \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\csname pgf@circ@#2@path\endcsname, #1={##1}}}%
1852 }
1853 % this one create a alias style from a node definition
1854 \def\pgfcirc@node@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@bipole@path{#2} to style #3
1855 \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\pgf@circ@bipole@path{#2}, #1={##1}}}%
1856 }
1857 % this create an alias style
1858 \def\pgfcirc@style@to@style#1#2{% alias style #1 to style #2
1859 \compattikzset{#2/.style={\comnpatname #1={##1}}}%
1860 }
1861 % this create an alias style, changing the labelling
1862 \def\pgfcirc@style@to@style@label#1#2#3{% alias style #1 to style #2
1863 \compattikzset{#2/.style={\comnpatname #1, #3={##1}}}%
1864 }
1865 % create a bipole
1866 \def\pgfcirc@activate@bipole#1#2#3#4{% path name, base node name, style name
1867 \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}%
1868 \pgfcirc@path@to@style{#1}{#2}{#4}{}% no options here, let's see
1869 }
1870 \def\pgfcirc@activate@bipole@simple#1#2{\pgfcirc@activate@bipole{#1}{#2}{#2}{#2}}
1871 % create a bipole with options
1872 \def\pgfcirc@activate@bipole@opt#1#2#3#4#5{% path name, base node name, style name
1873 \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}%
1874 \pgfcirc@path@to@style{#1}{#2}{#4}{#5}% no options here, let's see
1875 }
1876 \def\pgfcirc@activate@bipole@simple@opt#1#2#3{\pgfcirc@activate@bipole@opt{#1}{#2}{#2}{#2}{#3}}
1877
1878
1879 %% New system, for simple object
1880 %% \pgfcirc@activate@bipole@simple{l}{mass}
1881 %% New system, different names
1882 %% The old system is the following
1883 %% 1 - define just the pgf@circ@path@whatever#1
1884 %% (see for example the variable one)
1885 %% 2 - set the style
1886 %% \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l={#1}}}
1887
1888 %% Path definition with the new mechanism have been moved to where the nodes
1889 %% are defined.
1890
1891 %% Handling of terminals%<<<
1892
1893 \ctikzset{bipole/nodes/.is family}
1894 \ctikzset{bipole/nodes/left/.initial=none}
1895 \ctikzset{bipole/nodes/right/.initial=none}
1896 \tikzset{bipole nodes/.style n args={2}{%
1897 \circuitikzbasekey/bipole/nodes/left=#1,
1898 \circuitikzbasekey/bipole/nodes/right=#2
1899 }
1900 }
1901
1902 %% Easily usable styles
1903
1904 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1905 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1906 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
1907 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1908 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
1909 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1910 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1911 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
1912 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
1913 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
1914 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1915 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
1916 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
1917 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1918 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1919
1920 % rectjoinfill workarounds
1921
1922 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
1923 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
1924 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1925 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1926 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1927 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1928 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1929 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1930 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1931
1932 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
1933
1934 \def\drawpoles{
1935 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
1936 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
1937 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
1938 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
1939 }
1940 % %>>>
1941
1942 %%
1943 %% Definition of path for transistors
1944 %%
1945 % Transistor like bipoles
1946
1947 \def\pgf@circ@trans@path#1#2{
1948 \pgfextra{
1949 \edef\pgf@temp{\ctikzvalof{bipole/name}}
1950 \def\pgf@circ@temp{#2}
1951 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
1952 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
1953 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
1954 \fi
1955 }
1956 \ifpgf@circuit@bipole@inverted
1957 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
1958 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
1959 \else
1960 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
1961 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
1962 \fi
1963 \pgfextra{
1964 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
1965 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
1966 \pgfmathadd{\pgfmathresult}{-90}
1967 \pgfmathround{\pgfmathresult}
1968 \edef\pgf@circ@direction{\pgfmathresult}
1969 }
1970 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
1971 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
1972 (\ctikzvalof{bipole/name}) {}
1973 node {\ctikzvalof{bipole/label/name}}
1974 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
1975 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
1976 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
1977 \else
1978 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
1979 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
1980 \fi
1981 \drawpoles
1982 \pgfextra{
1983 \pgfcircresetpath
1984 }
1985 (\tikztotarget) \tikztonodes % and go on!
1986 }
1987
1988 \def\pgf@circ@definetranspath#1{
1989 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
1990 }
1991
1992 %
1993 % vim: set fdm=marker fmr=%<<<,%>>>:
1994 %%%---------- close: tex/pgfcircpath
1995
1996 %%%%%%%%%%% Springe nach tex/pgfcircshapes
1997 %%%---------- open: tex/pgfcircshapes.tex
1998 % Copyright 2018-2026 by Romano Giannetti
1999 % Copyright 2015-2026 by Stefan Lindner
2000 % Copyright 2013-2026 by Stefan Erhardt
2001 % Copyright 2007-2026 by Massimo Redaelli
2002 %
2003 % This file may be distributed and/or modified
2004 %
2005 % 1. under the LaTeX Project Public License and/or
2006 % 2. under the GNU Public License.
2007 %
2008 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2009
2010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2011 %% Other shapes
2012
2013 %% Nothing
2014
2015 \pgfdeclareshape{emptyshape}{
2016 \savedanchor{\northeast}{%
2017 \pgf@x=.5\wd\pgfnodeparttextbox%
2018 \pgf@y=.5\ht\pgfnodeparttextbox%
2019 }
2020 \anchor{north}{\northeast\pgf@x=0cm\relax}
2021 \anchor{east}{\northeast\pgf@y=0cm\relax}
2022 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2023 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2024 \anchor{north east}{\northeast}
2025 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2026 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2027 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2028 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
2029 \anchor{center}{
2030 \pgfpointorigin
2031 }
2032 }
2033 %
2034 % Provision for changing opacity. Only expert use, see the manual.
2035 %
2036 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
2037 \tikzset{open poles opacity/.code={%
2038 \ctikzset{poles/open fill opacity=#1}%
2039 }}
2040 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
2041 \tikzset{full poles opacity/.code={%
2042 \ctikzset{poles/full fill opacity=#1}%
2043 }}
2044
2045 %
2046 % Provision for changing default background
2047 %
2048
2049 \ctikzset{open poles fill/.initial={white}}
2050
2051 %% Full terminal
2052
2053 \pgfdeclareshape{circ}{
2054 \anchor{center}{
2055 \pgfpointorigin
2056 }
2057 \savedanchor\northwest{%
2058 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2059 \pgf@x=-\pgf@y
2060 }
2061 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2062 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2063 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2064 \anchor{west}{ \northwest \pgf@y=0pt }
2065 \anchor{w}{ \northwest \pgf@y=0pt }
2066 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2067 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2068 \anchor{north}{ \northwest \pgf@x=0pt }
2069 \anchor{n}{ \northwest \pgf@x=0pt }
2070 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2071 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2072 \anchor{north west}{ \northwest }
2073 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2074 \anchorborder{
2075 \pgf@circ@res@left=\pgf@x
2076 \pgf@circ@res@up=\pgf@y
2077 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2078 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2079 }
2080 \behindforegroundpath{
2081 \pgfscope
2082 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2083 \pgfsetcolor{\ctikzvalof{color}}
2084 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2085 \pgfusepath{draw,fill}
2086 \endpgfscope
2087 }
2088 }
2089
2090 %% Empty round terminal
2091
2092 \pgfdeclareshape{ocirc}{
2093 \anchor{center}{
2094 \pgfpointorigin
2095 }
2096 \savedanchor\northwest{%
2097 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2098 \pgf@x=-\pgf@y
2099 }
2100 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2101 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2102 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2103 \anchor{west}{ \northwest \pgf@y=0pt }
2104 \anchor{w}{ \northwest \pgf@y=0pt }
2105 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2106 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2107 \anchor{north}{ \northwest \pgf@x=0pt }
2108 \anchor{n}{ \northwest \pgf@x=0pt }
2109 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2110 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2111 \anchor{north west}{ \northwest }
2112 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2113 \anchorborder{
2114 \pgf@circ@res@left=\pgf@x
2115 \pgf@circ@res@up=\pgf@y
2116 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2117 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2118 }
2119 \behindforegroundpath{
2120 \pgfscope
2121 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2122 \pgfsetcolor{\ctikzvalof{color}}
2123 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2124 \ifx\tikz@fillcolor\pgfutil@empty
2125 % set the default fill color to white
2126 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2127 % ...but override it if the class is defined!
2128 % note that this element has no class, but will inherit it when used
2129 % into another component
2130 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2131 \else
2132 \pgfsetfillcolor{\tikz@fillcolor}
2133 \fi
2134 \pgfusepath{draw,fill}
2135 \endpgfscope
2136 }
2137 }
2138
2139 %% Diamond terminal
2140
2141 \pgfdeclareshape{diamondpole}{
2142 \anchor{center}{
2143 \pgfpointorigin
2144 }
2145 \savedanchor\northwest{%
2146 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2147 \pgf@x=-\pgf@y
2148 }
2149 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2150 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2151 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2152 \anchor{west}{ \northwest \pgf@y=0pt }
2153 \anchor{w}{ \northwest \pgf@y=0pt }
2154 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2155 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2156 \anchor{north}{ \northwest \pgf@x=0pt }
2157 \anchor{n}{ \northwest \pgf@x=0pt }
2158 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2159 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2160 \anchor{north west}{ \northwest }
2161 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2162 \anchorborder{
2163 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2164 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2165 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2166 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2167 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2168 \pgfextracty{\pgf@circ@res@up}{\northwest}
2169 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2170 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2171 \pgfpointintersectionoflines
2172 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2173 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2174 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2175 \pgf@x=\@@switchx\pgf@x
2176 \pgf@y=\@@switchy\pgf@y
2177 }
2178 \behindforegroundpath{
2179 \pgfscope
2180 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2181 \pgftransformrotate{45}
2182 \pgfpathrectanglecorners
2183 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2184 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2185 \pgfsetcolor{\ctikzvalof{color}}
2186 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2187 \pgfusepath{draw,fill}
2188 \endpgfscope
2189 }
2190 }
2191
2192 %% Diamond terminal, unfilled
2193
2194 \pgfdeclareshape{odiamondpole}{
2195 \anchor{center}{
2196 \pgfpointorigin
2197 }
2198 \savedanchor\northwest{%
2199 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2200 \pgf@x=-\pgf@y
2201 }
2202 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2203 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2204 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2205 \anchor{west}{ \northwest \pgf@y=0pt }
2206 \anchor{w}{ \northwest \pgf@y=0pt }
2207 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2208 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2209 \anchor{north}{ \northwest \pgf@x=0pt }
2210 \anchor{n}{ \northwest \pgf@x=0pt }
2211 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2212 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2213 \anchor{north west}{ \northwest }
2214 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2215 \anchorborder{
2216 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2217 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2218 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2219 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2220 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2221 \pgfextracty{\pgf@circ@res@up}{\northwest}
2222 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2223 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2224 \pgfpointintersectionoflines
2225 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2226 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2227 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2228 \pgf@x=\@@switchx\pgf@x
2229 \pgf@y=\@@switchy\pgf@y
2230 }
2231 \behindforegroundpath{
2232 \pgfscope
2233 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2234 \pgftransformrotate{45}
2235 \pgfpathrectanglecorners
2236 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2237 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2238 \pgfsetcolor{\ctikzvalof{color}}
2239 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2240 \ifx\tikz@fillcolor\pgfutil@empty
2241 % set the default fill color to white
2242 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2243 % ...but override it if the class is defined!
2244 % note that this element has no class, but will inherit it when used
2245 % into another component
2246 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2247 \else
2248 \pgfsetfillcolor{\tikz@fillcolor}
2249 \fi
2250 \pgfusepath{draw,fill}
2251 \endpgfscope
2252 }
2253 }
2254
2255 %% square terminal, filled
2256
2257 \pgfdeclareshape{squarepole}{
2258 \anchor{center}{
2259 \pgfpointorigin
2260 }
2261 \savedanchor\northwest{%
2262 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2263 \pgf@x=-\pgf@y
2264 }
2265 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2266 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2267 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2268 \anchor{west}{ \northwest \pgf@y=0pt }
2269 \anchor{w}{ \northwest \pgf@y=0pt }
2270 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2271 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2272 \anchor{north}{ \northwest \pgf@x=0pt }
2273 \anchor{n}{ \northwest \pgf@x=0pt }
2274 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2275 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2276 \anchor{north west}{ \northwest }
2277 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2278 \anchorborder{
2279 \pgf@xa=\pgf@x
2280 \pgf@ya=\pgf@y
2281 \pgfextracty{\pgf@circ@res@up}{\northwest}
2282 \pgfpointborderrectangle
2283 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2284 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2285 }
2286 \behindforegroundpath{
2287 \pgfscope
2288 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2289 \pgfpathrectanglecorners
2290 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2291 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2292 \pgfsetcolor{\ctikzvalof{color}}
2293 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2294 \pgfusepath{draw,fill}
2295 \endpgfscope
2296 }
2297 }
2298 %% square terminal, unfilled
2299
2300 \pgfdeclareshape{osquarepole}{
2301 \anchor{center}{
2302 \pgfpointorigin
2303 }
2304 \savedanchor\northwest{%
2305 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2306 \pgf@x=-\pgf@y
2307 }
2308 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2309 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2310 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2311 \anchor{west}{ \northwest \pgf@y=0pt }
2312 \anchor{w}{ \northwest \pgf@y=0pt }
2313 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2314 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2315 \anchor{north}{ \northwest \pgf@x=0pt }
2316 \anchor{n}{ \northwest \pgf@x=0pt }
2317 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2318 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2319 \anchor{north west}{ \northwest }
2320 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2321 \anchorborder{
2322 \pgf@xa=\pgf@x
2323 \pgf@ya=\pgf@y
2324 \pgfextracty{\pgf@circ@res@up}{\northwest}
2325 \pgfpointborderrectangle
2326 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2327 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2328 }
2329 \behindforegroundpath{
2330 \pgfscope
2331 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2332 \pgfpathrectanglecorners
2333 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2334 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2335 \pgfsetcolor{\ctikzvalof{color}}
2336 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2337 \ifx\tikz@fillcolor\pgfutil@empty
2338 % set the default fill color to white
2339 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2340 % ...but override it if the class is defined!
2341 % note that this element has no class, but will inherit it when used
2342 % into another component
2343 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2344 \else
2345 \pgfsetfillcolor{\tikz@fillcolor}
2346 \fi
2347 \pgfusepath{draw,fill}
2348 \endpgfscope
2349 }
2350 }
2351 % BNC connector
2352
2353 \pgfdeclareshape{bnc}{
2354 \anchor{center}{
2355 \pgfpointorigin
2356 }
2357 % BNC size is 2.5 times the size of the internal "ocirc"
2358 \savedanchor\northwest{%
2359 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2360 \pgf@y=2.5\pgf@y
2361 \pgf@x=-\pgf@y
2362 }
2363 % center is on the opening
2364 \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2365 \anchor{zero}{ \pgfpointorigin }
2366 \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2367 \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2368 % geo-anchors
2369 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2370 \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2371 \anchor{west}{ \northwest \pgf@y=0pt }
2372 \anchor{left}{ \northwest \pgf@y=0pt }
2373 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2374 \anchor{north}{ \northwest \pgf@x=0pt }
2375 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2376 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2377 \anchor{north west}{ \northwest }
2378 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2379 % put the node text above and centered
2380 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
2381 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
2382 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
2383 }
2384 }
2385 \anchorborder{
2386 \pgf@circ@res@left=\pgf@x
2387 \pgf@circ@res@up=\pgf@y
2388 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2389 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2390 }
2391 \behindforegroundpath{
2392 \pgfextracty{\pgf@circ@res@other}{\northwest}
2393 \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen
2394 \pgfscope
2395 \pgfstartlinewidth=\pgflinewidth
2396 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
2397 \pgfsetcolor{\ctikzvalof{color}}
2398 % external circle
2399 \pgfscope
2400 % clipping path: first a rectangle bigger then the shape
2401 % to avoid problems with the line thickness
2402 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
2403 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
2404 % next the opening to the right
2405 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
2406 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
2407 % do the difference and clip before drawing
2408 \pgfseteorule
2409 \pgfusepath{clip}
2410 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
2411 \pgfusepath{draw}
2412 \endpgfscope
2413 % internal circle
2414 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
2415 \pgf@circ@draworfill
2416 % and the contact line to the right
2417 \pgfsetlinewidth{\pgfstartlinewidth}
2418 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2419 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
2420 \pgfusepath{draw}
2421 \endpgfscope
2422 }
2423 }
2424
2425 %% Fill for correct rectangular joins
2426
2427 \pgfdeclareshape{rectjoinfill}{
2428 \savedanchor{\northeast}{%
2429 \pgf@x=.5\pgflinewidth%
2430 \pgf@y=.5\pgflinewidth%
2431 }
2432 \anchor{north}{\northeast\pgf@x=0cm\relax}
2433 \anchor{east}{\northeast\pgf@y=0cm\relax}
2434 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2435 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2436 \anchor{north east}{\northeast}
2437 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2438 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2439 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2440 \anchor{center}{
2441 \pgfpointorigin
2442 }
2443 \anchorborder{
2444 \pgf@circ@res@left=\pgf@x
2445 \pgf@circ@res@up=\pgf@y
2446 }
2447 \behindforegroundpath{
2448 \pgfscope
2449 \pgfpathrectanglecorners
2450 {\pgfpoint{0}{.5\pgflinewidth}}
2451 {\pgfpoint{0}{-.5\pgflinewidth}}
2452 \pgfsetcolor{\ctikzvalof{color}}
2453 \pgfusepath{draw,fill}
2454 \endpgfscope
2455 }
2456 }
2457
2458 %% transistor arrow
2459
2460 \def\pgf@circ@find@linescale{
2461 % find the scale inverse of the scale factor: line width do not scale
2462 % with scale=..., transform shape so we have to counteract it.
2463 \iftikz@fullytransformed % this is true if `transform shape` is active
2464 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
2465 % Note that this trick is not working inside a `spy` environment...
2466 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
2467 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
2468 \else
2469 \pgfmathsetmacro{\@@factor}{1.0}
2470 \fi
2471 }
2472
2473 \pgfdeclareshape{trarrow}{%
2474 % this arrow is only filled but grows with the linewidth, more or less
2475 % like currarrow do
2476 \savedanchor{\northeast}{%
2477 \pgf@circ@res@step = \pgf@circ@Rlen
2478 \pgf@circ@find@linescale
2479 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2480 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
2481 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2482 }
2483 % The arrow size should be more or less the same of a currarrow, which is
2484 % both filled and stroke, for backward output compatibility (more or less)
2485 %
2486 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
2487 % |-\__ currarrow as the tip at (W,0)
2488 % | | and the upper tail at (-0.7*W, 0.8*W)
2489 % | \__ it then "overshoot" do to the linew width L
2490 % | \__ xangle \alpha
2491 % ---0------->
2492 %
2493 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
2494 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
2495 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
2496 %
2497 \savedanchor{\northwest}{%
2498 \pgf@circ@res@step = \pgf@circ@Rlen
2499 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2500 \pgf@circ@find@linescale
2501 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
2502 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2503 }
2504 \savedanchor{\tip}{%
2505 \pgf@circ@res@step = \pgf@circ@Rlen
2506 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2507 \pgf@circ@find@linescale
2508 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
2509 }
2510 \anchor{north}{\northeast\pgf@x=0cm\relax}
2511 \anchor{east}{\northeast\pgf@y=0cm\relax}
2512 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2513 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2514 \anchor{north east}{\northeast}
2515 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2516 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2517 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2518 \anchor{center}{
2519 \pgfpointorigin
2520 }
2521 \anchor{tip}{
2522 \tip
2523 }
2524 \anchor{btip}{% this anchor is behind the tip of half a linewidth
2525 \tip
2526 \pgf@circ@find@linescale
2527 \pgf@circ@res@temp=\@@factor\pgflinewidth
2528 \advance\pgf@x by -.5\pgf@circ@res@temp
2529 }
2530 \behindforegroundpath{
2531 \pgfscope
2532 \northwest
2533 \pgf@circ@res@up=\pgf@y
2534 \pgf@circ@res@left=\pgf@x
2535 \tip
2536 \pgf@circ@res@step = \pgf@x
2537 %
2538 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2539 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
2540 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2541 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
2542 \pgfpathclose
2543 \pgfsetcolor{\ctikzvalof{color}}
2544 \pgfusepath{fill} % just fill
2545 \endpgfscope
2546 }
2547 }
2548
2549 %% Current arrow
2550
2551 %% we need a phantom version of this shape for advanced v-i-f
2552 %% use strange names to keep ot private
2553 \newif\ifpgfcirc@really@draw@currarrow\pgfcirc@really@draw@currarrowtrue
2554 \ctikzset{phantom@currarrow/.code=\pgfcirc@really@draw@currarrowfalse}
2555 \ctikzset{normal@currarrow/.code=\pgfcirc@really@draw@currarrowtrue}
2556
2557 \pgfdeclareshape{currarrow}{
2558 \savedanchor{\northeast}{%
2559 \pgf@circ@res@step = \pgf@circ@Rlen
2560 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2561 \pgf@x=.5\pgf@circ@res@step
2562 \pgf@y=\pgf@x%
2563 }
2564 \anchor{north}{\northeast\pgf@x=0cm\relax}
2565 \anchor{east}{\northeast\pgf@y=0cm\relax}
2566 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2567 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2568 \anchor{north east}{\northeast}
2569 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2570 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2571 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2572 \anchor{center}{
2573 \pgfpointorigin
2574 }
2575 \anchor{tip}{
2576 \pgfpointorigin
2577 \pgf@circ@res@step = \pgf@circ@Rlen
2578 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2579 \pgf@x =\pgf@circ@res@step
2580 }
2581 \behindforegroundpath{
2582 \pgfscope
2583 \ifpgfcirc@really@draw@currarrow
2584 \pgf@circ@reset@arrows@rounded
2585 \pgf@circ@res@step = \pgf@circ@Rlen
2586 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2587
2588 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
2589 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2590 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2591 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2592 \pgfpathclose
2593 \pgfsetcolor{\ctikzvalof{color}}
2594 \pgfusepath{draw,fill}
2595 \fi
2596 \endpgfscope
2597 }
2598 }
2599
2600 %% Flow arrow
2601 %% we need a phantom version of this shape for advanced v-i-f
2602 %% use strange names to keep ot private
2603 \newif\ifpgfcirc@really@draw@flowarrow\pgfcirc@really@draw@flowarrowtrue
2604 \ctikzset{phantom@flowarrow/.code=\pgfcirc@really@draw@flowarrowfalse}
2605 \ctikzset{normal@flowarrow/.code=\pgfcirc@really@draw@vlowarrowtrue}
2606
2607 \pgfdeclareshape{flowarrow}{
2608 \savedanchor{\northeast}{%
2609 \pgf@circ@res@step = \pgf@circ@Rlen
2610 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2611 \pgf@y=.5\pgf@circ@res@step
2612 \pgf@circ@res@step = \pgf@circ@Rlen
2613 \divide \pgf@circ@res@step by 4
2614 \pgf@x=\pgf@circ@res@step%
2615 }
2616 \anchor{north}{\northeast\pgf@x=0cm\relax}
2617 \anchor{east}{\northeast\pgf@y=0cm\relax}
2618 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2619 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2620 \anchor{north east}{\northeast}
2621 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2622 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2623 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2624 \anchor{text}{% text centered above
2625 \pgfpointorigin
2626 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
2627 }
2628 \anchor{center}{
2629 \pgfpointorigin
2630 }
2631 \anchor{tip}{
2632 \pgfpointorigin
2633 \pgf@circ@res@step = \pgf@circ@Rlen
2634 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2635 \pgf@x =\pgf@circ@res@step
2636 }
2637 \behindforegroundpath{
2638 \pgfscope
2639 \ifpgfcirc@really@draw@flowarrow
2640 \pgf@circ@reset@arrows@rounded
2641 \pgf@circ@res@step = \pgf@circ@Rlen
2642 \divide \pgf@circ@res@step by 4
2643 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
2644 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2645 \pgfsetcolor{\ctikzvalof{color}}
2646 \pgfusepath{draw}
2647 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
2648 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
2649 \fi
2650 \endpgfscope
2651 }
2652 }
2653
2654 %% Input arrow
2655
2656 \pgfdeclareshape{inputarrow}{
2657 \savedanchor{\northeast}{% this is really not northeast, really -northwest
2658 \pgf@circ@res@step = \pgf@circ@Rlen
2659 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2660 \pgf@y=.5\pgf@circ@res@step
2661 \pgf@x=1.7\pgf@circ@res@step
2662 }
2663 \anchor{north}{\northeast\pgf@x=0cm\relax}
2664 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
2665 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2666 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2667 \anchor{north east}{\northeast\pgf@x=0cm\relax}
2668 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2669 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
2670 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2671 \savedanchor{\tip}{
2672 \pgfpointorigin
2673 }
2674 \anchor{center}{
2675 \tip
2676 }
2677 \anchor{tip}{
2678 \tip
2679 }
2680 \behindforegroundpath{
2681
2682 \pgfscope
2683 \pgf@circ@reset@arrows@rounded
2684 \pgf@circ@res@step = \pgf@circ@Rlen
2685 \divide \pgf@circ@res@step by 16
2686 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
2687 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2688 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
2689 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2690 \pgfpathclose
2691 \pgfsetcolor{\ctikzvalof{color}}
2692 \pgfusepath{fill}
2693 \endpgfscope
2694 }
2695 }
2696
2697
2698 %% box
2699
2700 \pgfdeclareshape{box}{
2701 \anchor{center}{
2702 \pgfpointorigin
2703 }
2704 \behindforegroundpath{
2705
2706 \pgfscope
2707 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
2708 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2709 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2710 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2711 \pgf@circ@draworfill
2712 \endpgfscope
2713 }
2714 }
2715
2716 %% box scaled with blocks
2717
2718 \pgfdeclareshape{blockbox}{
2719 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
2720 \anchor{center}{
2721 \pgfpointorigin
2722 }
2723 \behindforegroundpath{
2724 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
2725 \pgfscope
2726 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
2727 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2728 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2729 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2730 \pgf@circ@draworfill
2731 \endpgfscope
2732 }
2733 }
2734
2735 % full nodes for wire crossing
2736
2737 \pgfdeclareshape{jump crossing}
2738 {
2739 \savedanchor\northwest{%
2740 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2741 \pgf@y=.5\pgf@y
2742 \pgf@x=-\pgf@y
2743 }
2744 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2745 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2746 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2747 \anchor{west}{ \northwest \pgf@y=0pt }
2748 \anchor{w}{ \northwest \pgf@y=0pt }
2749 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2750 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2751 \anchor{north}{ \northwest \pgf@x=0pt }
2752 \anchor{n}{ \northwest \pgf@x=0pt }
2753 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2754 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2755 \anchor{north west}{ \northwest }
2756 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2757 \behindbackgroundpath{
2758 \northwest
2759 \pgf@circ@res@up = \pgf@y
2760 \pgf@circ@res@down = -\pgf@y
2761 \pgf@circ@res@right = -\pgf@x
2762 \pgf@circ@res@left = \pgf@x
2763 % horizontal jumper
2764 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2765 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
2766 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
2767 \pgfsetbeveljoin
2768 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2769 % vertical, broken path
2770 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2771 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
2772 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
2773 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2774 \pgfusepath{draw}
2775
2776 }
2777 }
2778 \pgfdeclareshape{plain crossing}
2779 {
2780 \savedanchor\northwest{%
2781 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2782 \pgf@y=.5\pgf@y
2783 \pgf@x=-\pgf@y
2784 }
2785 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2786 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2787 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2788 \anchor{west}{ \northwest \pgf@y=0pt }
2789 \anchor{w}{ \northwest \pgf@y=0pt }
2790 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2791 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2792 \anchor{north}{ \northwest \pgf@x=0pt }
2793 \anchor{n}{ \northwest \pgf@x=0pt }
2794 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2795 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2796 \anchor{north west}{ \northwest }
2797 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2798 \behindbackgroundpath{
2799 \northwest
2800 \pgf@circ@res@up = \pgf@y
2801 \pgf@circ@res@down = -\pgf@y
2802 \pgf@circ@res@right = -\pgf@x
2803 \pgf@circ@res@left = \pgf@x
2804 % horizontal jumper
2805 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2807 % vertical, broken path
2808 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2809 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
2810 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
2811 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2812 \pgfusepath{draw}
2813
2814 }
2815 }
2816
2817 %%%---------- close: tex/pgfcircshapes
2818 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
2819 %%%---------- open: tex/pgfcircmonopoles.tex
2820 % Copyright 2018-2026 by Romano Giannetti
2821 % Copyright 2015-2026 by Stefan Lindner
2822 % Copyright 2013-2026 by Stefan Erhardt
2823 % Copyright 2007-2026 by Massimo Redaelli
2824 %
2825 % This file may be distributed and/or modified
2826 %
2827 % 1. under the LaTeX Project Public License and/or
2828 % 2. under the GNU Public License.
2829 %
2830 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2831
2832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2833 %% Monopoles
2834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2835
2836 %%%%%%%%%%%%%
2837 %% Grounds
2838 %%%%%%%%%%%%%
2839
2840
2841 % grounds and power supplies%<<<1
2842
2843 \ctikzset{monopoles/.is family}
2844 \ctikzset{monopoles/ground/width/.initial=.25}
2845 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
2846 \ctikzset{monopoles/ground/thickness/.initial=2}
2847 \ctikzset{monopoles/rground/thickness/.initial=2}
2848 \ctikzset{monopoles/tground/thickness/.initial=3}
2849 \ctikzset{monopoles/vcc/width/.initial=.2}
2850 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
2851 \ctikzset{monopoles/vee/arrow/.initial=legacy}
2852 \ctikzset{monopoles/match/width/.initial=.4}
2853 \ctikzset{monopoles/chassis/width/.initial=.25}
2854 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
2855 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
2856 \ctikzset{monopoles/antenna/width/.initial=.25}
2857 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
2858 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
2859 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
2860 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
2861 \ctikzset{monopoles/txantenna/width/.initial=.25}
2862 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
2863 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
2864 \ctikzset{monopoles/rxantenna/width/.initial=.25}
2865 \ctikzset{monopoles/bareantenna/width/.initial=.25}
2866 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
2867 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
2868 \ctikzset{monopoles/waves/width/.initial=0.5}%
2869 %>>>
2870
2871 %% Node shapes for grounds and power supply%<<<
2872
2873 %% Ground symbol
2874 % #1 -> name
2875 % #2 -> width
2876 % #3 -> depth
2877 % #4 -> code
2878 \long\def\pgf@circ@declareground#1#2#3#4{
2879 \pgfdeclareshape{#1}{
2880 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
2881 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2882 \savedanchor{\southeast}{
2883 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2884 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2885 \pgf@x=#2\pgf@x
2886 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2887 \pgf@y=-#3\pgf@y
2888 }
2889 \anchor{north}{\pgfpointorigin}
2890 \anchor{north east}{\southeast\pgf@y=0pt\relax}
2891 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
2892 \anchor{south east}{\southeast}
2893 \anchor{south}{\southeast\pgf@x=0pt\relax}
2894 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
2895 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
2896 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
2897 \anchor{left}{\pgfpointorigin}
2898 \anchor{right}{\pgfpointorigin}
2899 \anchor{center}{\pgfpointorigin}
2900 \behindforegroundpath{
2901 \pgf@circ@scaled@Rlen=\scaledRlen
2902 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2903 \pgfscope
2904 \pgfstartlinewidth=\pgflinewidth
2905 #4
2906 \endpgfscope
2907 }
2908 }
2909 }
2910
2911
2912 \pgf@circ@declareground{ground}{0.6}{1.6}{
2913 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
2914 \pgfpathmoveto{\pgfpointorigin}
2915 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
2916 \pgfusepath{draw}
2917 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2918 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2919 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2920 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2921 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2922 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2923 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2924 \pgfusepath{draw}
2925 }
2926
2927 \pgf@circ@declareground{tlground}{0.6}{0.4}{
2928 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2929 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
2930 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
2931 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
2932 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
2933 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
2934 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
2935 \pgfusepath{draw}
2936 }
2937
2938
2939 \pgf@circ@declareground{rground}{0.6}{1}{
2940 \pgfpathmoveto{\pgfpointorigin}
2941 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
2942 \pgfusepath{draw}
2943
2944 \pgfstartlinewidth=\pgflinewidth
2945 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
2946
2947 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2948 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2949 \pgfsetroundcap\pgfusepath{draw}
2950 }
2951
2952 \pgf@circ@declareground{tground}{0.6}{0}{
2953 \pgfpathmoveto{\pgfpointorigin}
2954 \pgfusepath{draw}
2955
2956 \pgfstartlinewidth=\pgflinewidth
2957 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
2958
2959 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
2960 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
2961 \pgfusepath{draw}
2962 }
2963
2964 \pgf@circ@declareground{sground}{0.6}{1.8}{
2965 \pgfpathmoveto{\pgfpointorigin}
2966 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
2967 \pgfusepath{draw}
2968
2969 \pgfstartlinewidth=\pgflinewidth
2970 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2971
2972 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2973 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2974 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
2975 \pgfpathclose
2976 \pgf@circ@draworfill
2977 }
2978
2979 % noiseless ground
2980 \pgf@circ@declareground{nground}{0.9}{1.6}{
2981 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
2982 \pgfpathmoveto{\pgfpointorigin}
2983 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
2984 \pgfusepath{draw}
2985 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2986 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2987 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2988 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2989 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2990 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2991 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2992 \pgfusepath{draw}
2993 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2994 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
2995 \pgfusepath{draw}
2996 }
2997
2998 % protective ground
2999 \pgf@circ@declareground{pground}{0.9}{1.8}{
3000 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3001 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
3002 \pgf@circ@draworfill
3003 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3004 \pgfpathmoveto{\pgfpointorigin}
3005 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
3006 \pgfusepath{draw}
3007 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3008 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3009 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3010 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3011 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3012 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3013 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3014 \pgfusepath{draw}
3015 }
3016
3017 % chassis ground
3018 \pgf@circ@declareground{cground}{1}{2}{
3019 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3020 \pgfpathmoveto{\pgfpointorigin}
3021 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3022 \pgfusepath{draw}
3023 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3024 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3025 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3026 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3027 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3028 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3029 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3030 \pgfusepath{draw}
3031 }
3032
3033 % Contributed by @fotesan https://github.com/fotesan
3034 % european ground
3035 \pgf@circ@declareground{eground}{1.1}{1.7}{
3036 \pgfpathmoveto{\pgfpointorigin}
3037 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3038 \pgfusepath{draw}
3039
3040 \pgfstartlinewidth=\pgflinewidth
3041 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3042
3043 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3044 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3045 \pgfusepath{draw}
3046
3047 \pgfsetlinewidth{\pgfstartlinewidth}
3048 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3049 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3050 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3051 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3052 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3053 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3054 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3055 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3056 \pgfusepath{draw}
3057 }
3058
3059 \pgf@circ@declareground{eground2}{1.1}{1.7}{
3060 \pgfpathmoveto{\pgfpointorigin}
3061 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3062 \pgfusepath{draw}
3063
3064 \pgfstartlinewidth=\pgflinewidth
3065 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3066
3067 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3068 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3069 \pgfusepath{draw}
3070
3071 \pgfsetlinewidth{\pgfstartlinewidth}
3072 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3073 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3074 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3075 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3076 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3077 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3078 \pgfusepath{draw}
3079 }
3080
3081 %%%%%%%%%%%%%%%%%%
3082 %% Power supplies
3083 %%%%%%%%%%%%%%%%%%
3084
3085 % Vcc
3086 \pgfdeclareshape{vcc}{
3087 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3088 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3089 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3090 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3091 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3092 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3093 }
3094 \savedanchor{\northeast}{%
3095 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3096 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3097 \pgf@x=.5\pgf@circ@res@step
3098 \pgf@y=3\pgf@x%
3099 }
3100 \anchor{north}{\northeast\pgf@x=0cm\relax}
3101 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3102 \anchor{south}{\pgfpointorigin}
3103 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3104 \anchor{north east}{\northeast}
3105 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3106 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3107 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3108 \anchor{center}{\pgfpointorigin}
3109 \anchor{left}{\pgfpointorigin}
3110 \anchor{right}{\pgfpointorigin}
3111 \anchor{text}{
3112 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3113 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3114 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3115 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3116 \pgf@x=0pt
3117 \pgf@y=2\pgf@circ@res@step
3118 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
3119 \pgf@x=-.5\wd\pgfnodeparttextbox
3120 }
3121 \behindforegroundpath{
3122 \pgf@circ@scaled@Rlen=\scaledRlen
3123 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3124 \pgfscope
3125 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
3126 \ifx\pgf@temp\pgf@circ@temp
3127 \pgfstartlinewidth=\pgflinewidth
3128 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3129
3130 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3131 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
3132 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3133 \pgfusepath{draw}
3134
3135 \pgfsetlinewidth{\pgfstartlinewidth}
3136 \else
3137 \pgfsetarrowsend{\pgf@circ@temp}
3138 \fi
3139 \pgfpathmoveto{\pgfpointorigin}
3140 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
3141 \pgfusepath{draw}
3142 \endpgfscope
3143 }
3144 }
3145
3146 % Vee
3147 \pgfdeclareshape{vee}{
3148 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3149 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3150 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3151 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3152 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3153 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3154 }
3155 \savedanchor{\northeast}{%
3156 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3157 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3158 \pgf@x=.5\pgf@circ@res@step
3159 \pgf@y=-3\pgf@x%
3160 }
3161 \anchor{south}{\northeast\pgf@x=0cm\relax}
3162 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3163 \anchor{north}{\pgfpointorigin}
3164 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3165 \anchor{south east}{\northeast}
3166 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
3167 \anchor{north east}{\northeast\pgf@y=0pt\relax}
3168 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3169 \anchor{center}{\pgfpointorigin}
3170 \anchor{left}{\pgfpointorigin}
3171 \anchor{right}{\pgfpointorigin}
3172 \anchor{text}{
3173 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3174 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3175 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3176 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3177 \pgf@x=0pt
3178 \pgf@y=-2\pgf@circ@res@step
3179 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
3180 \pgf@x=-.5\wd\pgfnodeparttextbox
3181 }
3182
3183 \behindforegroundpath{
3184 \pgf@circ@scaled@Rlen=\scaledRlen
3185 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3186 \pgfscope
3187 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
3188 \ifx\pgf@temp\pgf@circ@temp
3189
3190 \pgfstartlinewidth=\pgflinewidth
3191 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3192
3193 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3194 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
3195 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3196 \pgfusepath{draw}
3197 \pgfsetlinewidth{\pgfstartlinewidth}
3198 \else
3199 \pgfsetarrowsend{\pgf@circ@temp}
3200 \fi
3201 \pgfpathmoveto{\pgfpointorigin}
3202 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3203 \pgfusepath{draw}
3204 \endpgfscope
3205 }
3206 }% %>>>
3207
3208
3209 %% This are strange, and probably wrong FIXME
3210 % \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
3211 % \compattikzset{vss/.style = {\comnpatname vee = #1}}
3212 \pgfcirc@style@to@style{vcc}{vdd}
3213 \pgfcirc@style@to@style{vee}{vss}
3214
3215
3216 %%%%%%%%%%%%%%
3217 %% RF bipoles and monopoles
3218 %%%%%%%%%%%%%%
3219
3220 %% RF bipoles and monopoles settings %<<<1
3221 \ctikzset{bipoles/mstline/height/.initial=0.3}
3222 \ctikzset{bipoles/mstline/width/.initial=1.2}
3223 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
3224 \ctikzset{monopoles/msport/width/.initial=.5}
3225 \ctikzset{monopoles/msrstub/height/.initial=1.0}
3226 \ctikzset{monopoles/msrstub/width/.initial=0.6}%
3227 %>>>
3228
3229 %% Node shapes for RF bipoles%<<<
3230
3231 \pgfcircdeclarebipolescaled{RF}
3232 {}
3233 {\ctikzvalof{bipoles/tline/height}}
3234 {tline}
3235 {\ctikzvalof{bipoles/tline/height}}
3236 {\ctikzvalof{bipoles/tline/width}}
3237 {
3238 \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
3239 \pgfscope
3240 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3241 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
3242 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
3243 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
3244 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
3245 \pgfpatharc{-90}{90}{\pgf@circ@res@step and \pgf@circ@res@up}
3246 \pgf@circ@draworfill
3247 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
3248 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
3249 \pgfusepath{stroke}
3250 \endpgfscope
3251 \pgfsetlinewidth{\pgfstartlinewidth}
3252 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
3253 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3254 \pgfusepath{stroke}
3255 }
3256
3257 % microstrip transmission line
3258 \pgfcircdeclarebipolescaled{RF}
3259 {}
3260 {\ctikzvalof{bipoles/mstline/height}}
3261 {mstline}
3262 {\ctikzvalof{bipoles/mstline/height}}
3263 {\ctikzvalof{bipoles/mstline/width}}
3264 {
3265 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3266 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3267 \pgf@circ@draworfill
3268 }% %>>>
3269
3270 %% Path definitions for RF path objects%<<<
3271 \pgfcirc@activate@bipole@simple{l}{mstline}
3272 \pgfcirc@activate@bipole@simple{l}{tline}
3273 \pgfcirc@style@to@style{tline}{transmission line}
3274 \pgfcirc@style@to@style{tline}{TL}
3275 % %>>>
3276
3277 %% Node shapes for RF monopoles%<<<
3278
3279 % Legacy tlinestub
3280 % Contributed by Leonardo Azzinnari
3281 \pgfdeclareshape{tlinestub}{
3282 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3283 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3284 \savedanchor{\northeast}{%
3285 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3286 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3287 \pgf@x=1.2\pgf@circ@res@step
3288 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3289 \pgf@y=.2\pgf@circ@res@step%
3290 }
3291 % the center is on the left side of the shape for facility of usage
3292 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3293 \anchor{east}{\northeast\pgf@y=0cm\relax}
3294 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
3295 \anchor{west}{\pgfpointorigin}
3296 \anchor{north east}{\northeast}
3297 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3298 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3299 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3300 \anchor{center}{\pgfpointorigin}
3301 % this is not exact, but it's better than nothing
3302 \anchor{text}{\northeast\pgf@xa=\pgf@x\pgf@ya=\pgf@y
3303 \pgfpoint{\dimexpr-.5\wd\pgfnodeparttextbox+.8\pgf@xa}
3304 {\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@ya}}
3305 \behindforegroundpath{
3306 \pgfstartlinewidth=\pgflinewidth
3307
3308 \pgf@circ@scaled@Rlen=\scaledRlen
3309 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width}\pgf@circ@scaled@Rlen
3310
3311 \pgfscope
3312 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3313 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3314 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3315 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3316 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3317 \pgfpatharc{90}{-90}{-0.125\pgf@circ@res@step and -0.25\pgf@circ@res@step}
3318 \pgf@circ@draworfill
3319 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3320 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3321 \pgfusepath{stroke}
3322 \endpgfscope
3323 \pgfpathmoveto{\pgfpointorigin}
3324 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3325 \pgfusepath{draw}
3326 }
3327 }
3328
3329 %% New antennas without tails
3330
3331 % main body of antennas
3332 \def\pgf@circ@antennabody{%
3333 \pgfstartlinewidth=\pgflinewidth
3334 \pgf@circ@scaled@Rlen=\scaledRlen
3335 \pgfsetcolor{\ctikzvalof{color}}
3336 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3337 \pgfscope
3338 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3339 \pgfpathmoveto{\pgfpointorigin}
3340 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3341 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3342 \pgfsetbeveljoin
3343 \pgfpathclose
3344 \pgf@circ@draworfill
3345 \endpgfscope
3346 \pgfsetlinewidth{\pgfstartlinewidth}
3347 \pgfpathmoveto{\pgfpointorigin}
3348 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3349 \pgfusepath{draw}
3350 }
3351
3352 % Waves for the antennas.
3353 \def\pgf@circ@antennawaves{%
3354 \pgfscope
3355 % define a triangle for clipping the waves
3356 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3357 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3358 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3359 \pgfpathclose
3360 \pgfusepath{clip}
3361 % ...and build the waves as clipped circles
3362 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3363 \pgfmathloop%
3364 \ifnum\pgf@circ@count@a>2
3365 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3366 \advance\pgf@circ@count@a-1\relax%
3367 \repeatpgfmathloop
3368 \pgfusepath{draw}
3369 \endpgfscope
3370 }
3371
3372 % additional shape with the waves
3373 \pgfdeclareshape{waves}{
3374 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3375 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3376 \anchor{center}{\pgfpointorigin}
3377 \savedanchor{\northeast}{
3378 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3379 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3380 \pgf@x=\pgf@circ@res@step
3381 \pgf@y=\pgf@circ@res@step
3382 }
3383 \anchor{text}{
3384 \northeast
3385 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3386 }
3387 \anchor{top}{\northeast\pgf@x=0pt}
3388 \anchor{right}{\northeast\pgf@y=0pt}
3389 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3390 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3391 \anchor{north}{\northeast\pgf@x=0pt}
3392 \anchor{north east}{\northeast}
3393 \anchor{east}{\northeast\pgf@y=0pt}
3394 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3395 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3396 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3397 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3398 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3399 \behindforegroundpath{
3400 \pgf@circ@scaled@Rlen=\scaledRlen
3401 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3402 \pgf@circ@res@step=0.5\pgf@circ@res@step
3403 \pgfsetcolor{\ctikzvalof{color}}
3404 \pgfscope
3405 % define a triangle for clipping the waves
3406 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3407 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
3408 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
3409 \pgfpathclose
3410 \pgfusepath{clip}
3411 % ...and build the waves as clipped circles
3412 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3413 \pgfmathloop%
3414 \ifnum\c@pgf@counta>1
3415 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3416 \advance\c@pgf@counta-1\relax%
3417 \repeatpgfmathloop
3418 \pgfusepath{draw}
3419 \endpgfscope
3420 }
3421 }
3422
3423 % the three types of antennas: simple, TX, RX. Notice that you can flip them...
3424
3425 \pgfdeclareshape{bareantenna}{
3426 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3427 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3428 \anchor{center}{\pgfpointorigin}
3429 \savedanchor{\northeast}{
3430 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3431 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3432 \pgf@x=\pgf@circ@res@step
3433 \pgf@y=2\pgf@circ@res@step
3434 }
3435 \anchor{text}{
3436 \northeast
3437 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3438 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3439 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3440 }
3441 \anchor{top}{\northeast\pgf@x=0pt}
3442 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3443 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3444 \anchor{bottom}{\pgfpointorigin}
3445 \anchor{north}{\northeast\pgf@x=0pt}
3446 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3447 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3448 \anchor{south}{\pgfpointorigin}
3449 \anchor{north east}{\northeast}
3450 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3451 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3452 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3453 \behindforegroundpath{
3454 \pgf@circ@antennabody
3455 }
3456 }
3457
3458 \pgfdeclareshape{bareTXantenna}{
3459 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3460 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3461 \anchor{center}{\pgfpointorigin}
3462 \savedanchor{\northeast}{
3463 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3464 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3465 \pgf@x=\pgf@circ@res@step
3466 \pgf@y=2\pgf@circ@res@step
3467 }
3468 \savedanchor{\savedwaves}{
3469 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3470 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3471 \pgf@x=4.2\pgf@circ@res@step
3472 \pgf@y=\pgf@circ@res@step
3473 }
3474 \anchor{text}{
3475 \northeast
3476 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3477 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3478 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
3479 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3480 }
3481 \anchor{waves}{\savedwaves}
3482 \anchor{top}{\northeast\pgf@x=0pt}
3483 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3484 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3485 \anchor{bottom}{\pgfpointorigin}
3486 \anchor{north}{\northeast\pgf@x=0pt}
3487 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3488 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3489 \anchor{south}{\pgfpointorigin}
3490 \anchor{north east}{\northeast}
3491 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3492 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3493 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3494 \behindforegroundpath{
3495 \pgf@circ@antennabody
3496 \pgf@circ@antennawaves
3497 }
3498 }
3499
3500 \pgfdeclareshape{bareRXantenna}{
3501 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3502 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3503 \anchor{center}{\pgfpointorigin}
3504 \savedanchor{\northeast}{
3505 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3506 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3507 \pgf@x=\pgf@circ@res@step
3508 \pgf@y=2\pgf@circ@res@step
3509 }
3510 \savedanchor{\savedwaves}{
3511 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3512 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3513 \pgf@x=-4.2\pgf@circ@res@step
3514 \pgf@y=\pgf@circ@res@step
3515 }
3516 \anchor{text}{
3517 \northeast
3518 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3519 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3520 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3521 }
3522 \anchor{waves}{\savedwaves}
3523 \anchor{top}{\northeast\pgf@x=0pt}
3524 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3525 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3526 \anchor{bottom}{\pgfpointorigin}
3527 \anchor{north}{\northeast\pgf@x=0pt}
3528 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3529 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3530 \anchor{south}{\pgfpointorigin}
3531 \anchor{north east}{\northeast}
3532 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3533 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3534 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3535 \behindforegroundpath{
3536 \pgf@circ@antennabody
3537 \pgftransformxshift{-5.2\pgf@circ@res@step}
3538 \pgf@circ@antennawaves
3539 }
3540 }
3541
3542 %%% dynodes (see https://github.com/circuitikz/circuitikz/issues/469)
3543 \ctikzset{monopoles/dynode/width/.initial=0.4}
3544 \ctikzset{monopoles/dynode/height/.initial=0.8}
3545 \ctikzset{monopoles/dynode/arc pos/.initial=0.5}
3546 \ctikzset{monopoles/dynode/arc angle/.initial=30}
3547 \ctikzset{monopoles/dynode/top width/.initial=1.0}
3548
3549 \pgfdeclareshape{dynode}{
3550 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
3551 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3552 \anchor{center}{\pgfpointorigin}
3553 \savedanchor{\northeast}{
3554 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3555 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
3556 \pgf@x=0.5\pgf@x
3557 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3558 }
3559 \savedanchor{\arcpos}{% bottom part of the arc pos
3560 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3561 \pgf@x=0pt
3562 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3563 \pgf@y=\ctikzvalof{monopoles/dynode/arc pos}\pgf@y
3564 }
3565 \savedanchor{\topright}{%
3566 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3567 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
3568 \pgf@x=\ctikzvalof{monopoles/dynode/top width}\pgf@x
3569 \pgf@x=0.5\pgf@x
3570 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3571 }
3572 \anchor{arc}{\arcpos}
3573 \anchor{top right}{\topright}
3574 \anchor{top left}{\topright\pgf@x=-\pgf@x}
3575 \anchor{text}{
3576 \northeast
3577 \advance\pgf@x by 4pt\relax
3578 \pgf@y=\dimexpr0.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3579 }
3580 \anchor{top}{\northeast\pgf@x=0pt}
3581 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3582 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3583 \anchor{bottom}{\pgfpointorigin}
3584 \anchor{north}{\northeast\pgf@x=0pt}
3585 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3586 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3587 \anchor{south}{\pgfpointorigin}
3588 \anchor{north east}{\northeast}
3589 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3590 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3591 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3592 \behindforegroundpath{
3593 \pgfstartlinewidth=\pgflinewidth
3594 \pgf@circ@scaled@Rlen=\scaledRlen
3595 \pgfsetcolor{\ctikzvalof{color}}
3596 \northeast
3597 \pgf@circ@res@right=\pgf@x
3598 \pgf@circ@res@up=\pgf@y
3599 \arcpos
3600 \pgf@circ@res@step=\pgf@y
3601 % top
3602 \pgfscope
3603 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3604 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
3605 \pgfpathlineto{\pgfpoint{\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
3606 \pgfusepath{draw}
3607 \endpgfscope
3608 % arc
3609 \edef\@@angle{\ctikzvalof{monopoles/dynode/arc angle}}
3610 \ifnum90=\@@angle\else % avoid divisions by zero
3611 % radius
3612 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right/cos(\@@angle)}
3613 % start angle y position
3614 \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@step+\pgf@circ@res@other*(1-sin(\@@angle))}
3615 \pgfsetlinewidth{\pgfstartlinewidth}
3616 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@step}}
3617 \pgfpatharc{-180+\@@angle}{-\@@angle}{\pgf@circ@res@other}
3618 \fi
3619 % tail
3620 \pgfpathmoveto{\pgfpointorigin}
3621 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3622 \pgfusepath{draw}
3623 }
3624 }
3625 % Microstrip monopoles
3626
3627 \pgfdeclareshape{mslstub}{
3628 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3629 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3630 \savedanchor{\southeast}{
3631 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3632 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3633 \pgf@x=.5\pgf@x
3634 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3635 \pgf@y=-.5\pgf@y
3636 }
3637 \savedanchor{\northwest}{
3638 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3639 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3640 \pgf@x=-.5\pgf@x
3641 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3642 \pgf@y=.5\pgf@y
3643 }
3644 \anchor{north}{\northwest\pgf@x=0pt\relax}
3645 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3646 \anchor{east}{\southeast\pgf@y=0pt\relax}
3647 \anchor{south east}{\southeast}
3648 \anchor{south}{\southeast\pgf@x=0pt\relax}
3649 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3650 \anchor{west}{\northwest\pgf@y=0pt\relax}
3651 \anchor{north west}{\northwest}
3652 %
3653 \anchor{center}{\northwest\pgf@y=0pt\relax}
3654 \anchor{left}{\northwest\pgf@y=0pt\relax}
3655 \anchor{right}{\southeast\pgf@y=0pt\relax}
3656 % put the node text above and centered
3657 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3658 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3659 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3660 }
3661 }
3662 \behindbackgroundpath{
3663 \pgfextracty{\pgf@circ@res@up}{\northwest}
3664 \pgfextractx{\pgf@circ@res@right}{\southeast}
3665 \pgfextractx{\pgf@circ@res@left}{\northwest}
3666 \pgfextracty{\pgf@circ@res@down}{\southeast}
3667 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3668 \pgfstartlinewidth=\pgflinewidth
3669 \pgfscope
3670 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3671 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3672 \pgf@circ@draworfill
3673 \endpgfscope
3674 }
3675 }
3676
3677 \pgfdeclareshape{msrstub}{
3678 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3679 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3680 \savedanchor{\southeast}{
3681 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3682 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3683 \pgf@x=.5\pgf@x
3684 \pgf@y=0pt\relax
3685 }
3686 \savedanchor{\northwest}{
3687 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3688 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3689 \pgf@x=-.5\pgf@x
3690 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
3691 \pgf@y=.5\pgf@y
3692 }
3693 \anchor{north}{\northwest\pgf@x=0pt\relax}
3694 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3695 \anchor{east}{\southeast\pgf@y=0pt\relax}
3696 \anchor{south east}{\southeast}
3697 \anchor{south}{\southeast\pgf@x=0pt\relax}
3698 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3699 \anchor{west}{\northwest\pgf@y=0pt\relax}
3700 \anchor{north west}{\northwest}
3701 %
3702 \anchor{center}{\pgfpointorigin}
3703 \anchor{left}{\pgfpointorigin}
3704 \anchor{right}{\pgfpointorigin}
3705 % put the node text above and centered
3706 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3707 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3708 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3709 }
3710 }
3711 \behindbackgroundpath{
3712 \pgfextracty{\pgf@circ@res@up}{\northwest}
3713 \pgfextractx{\pgf@circ@res@right}{\southeast}
3714 \pgfextractx{\pgf@circ@res@left}{\northwest}
3715 \pgfextracty{\pgf@circ@res@down}{\southeast}
3716 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3717 \pgfstartlinewidth=\pgflinewidth
3718 \pgfscope
3719 \pgfpathmoveto{\pgfpointorigin}
3720 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3721 \pgfusepath{draw}
3722 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3723 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
3724 \pgfpatharc{135}{45}{\pgf@circ@res@step}
3725 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
3726 \pgfpatharc{45}{135}{\pgf@circ@res@up}
3727 \pgfclosepath
3728 \pgf@circ@draworfill
3729 \endpgfscope
3730 }
3731 }
3732
3733 \pgfdeclareshape{msport}{
3734 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3735 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3736 \savedanchor{\southeast}{
3737 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3738 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3739 \pgf@x=.5\pgf@x
3740 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3741 \pgf@y=-.5\pgf@y
3742 }
3743 \savedanchor{\northwest}{
3744 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3745 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3746 \pgf@x=-.5\pgf@x
3747 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3748 \pgf@y=.5\pgf@y
3749 }
3750 \anchor{north}{\northwest\pgf@x=0pt\relax}
3751 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3752 \anchor{east}{\southeast\pgf@y=0pt\relax}
3753 \anchor{south east}{\southeast}
3754 \anchor{south}{\southeast\pgf@x=0pt\relax}
3755 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3756 \anchor{west}{\northwest\pgf@y=0pt\relax}
3757 \anchor{north west}{\northwest}
3758 %
3759 \anchor{center}{\northwest\pgf@y=0pt\relax}
3760 \anchor{left}{\northwest\pgf@y=0pt\relax}
3761 \anchor{right}{\southeast\pgf@y=0pt\relax}
3762 % put the node text above and centered
3763 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3764 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3765 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3766 }
3767 }
3768 \behindbackgroundpath{
3769 \pgfextracty{\pgf@circ@res@up}{\northwest}
3770 \pgfextractx{\pgf@circ@res@right}{\southeast}
3771 \pgfextractx{\pgf@circ@res@left}{\northwest}
3772 \pgfextracty{\pgf@circ@res@down}{\southeast}
3773 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
3774 \pgfstartlinewidth=\pgflinewidth
3775 \pgfscope
3776 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
3779 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
3780 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3781 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
3782 \pgfpathclose
3783 \pgf@circ@draworfill
3784 \endpgfscope
3785 }
3786 }
3787
3788 % Legacy antennas (with tails)
3789 \def\pgf@circ@shift@antenna@xy#1#2{%
3790 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
3791 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
3792 \relax}
3793
3794 % Legacy antenna
3795 \pgfdeclareshape{antenna}{
3796 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3797 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3798 \anchor{center}{\pgfpointorigin}
3799 \savedanchor{\northeast}{
3800 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3801 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3802 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3803 \pgf@y=4\pgf@circ@res@step
3804 }
3805 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
3806 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
3807 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
3808 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
3809 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
3810 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
3811 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
3812 \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{4}}
3813 \anchor{text}{
3814 \northeast
3815 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
3816 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
3817 }
3818 \behindforegroundpath{
3819 \pgfstartlinewidth=\pgflinewidth
3820 \pgf@circ@scaled@Rlen=\scaledRlen
3821 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3822
3823 \pgftransformxshift{ -4\pgf@circ@res@step }
3824
3825 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3826 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3827
3828 \pgfusepath{draw}
3829
3830 \pgfscope
3831 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3832 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3833 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3834 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3835 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3836 \pgfsetcolor{\ctikzvalof{color}}
3837 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3838 \pgfusepath{draw}
3839 \endpgfscope
3840 \pgfsetlinewidth{\pgfstartlinewidth}
3841
3842 }
3843 }
3844
3845 % Legacy TX antenna
3846 \pgfdeclareshape{txantenna}{
3847 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3848 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3849 \anchor{center}{\pgfpointorigin}
3850 \savedanchor{\northeast}{
3851 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3852 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3853 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3854 \pgf@y=4\pgf@circ@res@step
3855 }
3856 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
3857 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
3858 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
3859 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
3860 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
3861 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
3862 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
3863 \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}}
3864 \anchor{text}{
3865 \northeast
3866 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
3867 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
3868 }
3869 \behindforegroundpath{
3870 \pgfstartlinewidth=\pgflinewidth
3871 \pgf@circ@scaled@Rlen=\scaledRlen
3872 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
3873
3874 \pgfpathmoveto{\pgfpointorigin}
3875 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
3876 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3877 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3878
3879 \pgfusepath{draw}
3880
3881 \pgfscope
3882 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3883 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3884 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3885 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3886 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3887 \pgfsetcolor{\ctikzvalof{color}}
3888 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3889 \pgfusepath{draw}
3890 \endpgfscope
3891 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
3892 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
3893 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
3894 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
3895 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
3896 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
3897 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
3898 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
3899 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
3900 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
3901 \pgfusepath{draw}
3902 \pgfsetlinewidth{\pgfstartlinewidth}
3903
3904 }
3905 }
3906
3907 % Legacy RX antenna
3908 \pgfdeclareshape{rxantenna}{
3909 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3910 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3911 \anchor{center}{\pgfpointorigin}
3912 \savedanchor{\northeast}{
3913 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3914 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3915 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3916 \pgf@y=4\pgf@circ@res@step
3917 }
3918 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
3919 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
3920 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
3921 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
3922 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
3923 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
3924 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
3925 \anchor{south west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{4}}
3926 \anchor{text}{
3927 \northeast
3928 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
3929 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
3930 }
3931 \behindforegroundpath{
3932 \pgfstartlinewidth=\pgflinewidth
3933 \pgf@circ@scaled@Rlen=\scaledRlen
3934 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
3935
3936 \pgfpathmoveto{\pgfpointorigin}
3937 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
3938 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3939 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3940
3941 \pgfusepath{draw}
3942
3943 \pgfscope
3944 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3945 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3946 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3947 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3948 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3949 \pgfsetcolor{\ctikzvalof{color}}
3950 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3951 \pgfusepath{draw}
3952 \endpgfscope
3953
3954 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
3955 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
3956 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
3957 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
3958 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
3959 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
3960 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
3961 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
3962 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
3963 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
3964 \pgfusepath{draw}
3965 \pgfsetlinewidth{\pgfstartlinewidth}
3966 }
3967 }
3968
3969 % Legacy match
3970 \pgfdeclareshape{match}{
3971 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3972 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3973 \savedanchor{\northeast}{%
3974 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3975 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
3976 \pgf@x=2\pgf@circ@res@step
3977 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
3978 \pgf@y=.5\pgf@circ@res@step%
3979 }
3980 % the center is on the left side of the shape for facility of usage
3981 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3982 \anchor{east}{\northeast\pgf@y=0cm\relax}
3983 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
3984 \anchor{west}{\pgfpointorigin}
3985 \anchor{north east}{\northeast}
3986 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3987 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3988 \anchor{south west}{\pgfpointorigin}
3989 \anchor{center}{
3990 \pgfpointorigin
3991 }
3992 \anchor{text}{
3993 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3994 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
3995 \pgf@x=1.5\pgf@x
3996 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
3997 \pgf@y=-1.5\ht\pgfnodeparttextbox
3998 }
3999 \behindforegroundpath{
4000 \pgf@circ@scaled@Rlen=\scaledRlen
4001 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4002
4003 \pgfscope
4004 \pgfpathmoveto{\pgfpointorigin}
4005 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
4006 \pgfusepath{draw}
4007
4008 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4009 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
4010 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
4011 \pgfusepath{fill}
4012
4013 \pgfsetlinewidth{\pgfstartlinewidth}
4014 \endpgfscope
4015 }
4016 }
4017 % %>>>
4018
4019 % vim: set fdm=marker fmr=%<<<,%>>>:
4020 %%%---------- close: tex/pgfcircmonopoles
4021 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
4022 %%%---------- open: tex/pgfcircbipoles.tex
4023 % Copyright 2018-2026 by Romano Giannetti
4024 % Copyright 2015-2026 by Stefan Lindner
4025 % Copyright 2013-2026 by Stefan Erhardt
4026 % Copyright 2007-2026 by Massimo Redaelli
4027 %
4028 % This file may be distributed and/or modified
4029 %
4030 % 1. under the LaTeX Project Public License and/or
4031 % 2. under the GNU Public License.
4032 %
4033 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
4034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4035 %% Standard bipole shapes declarations
4036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4037
4038 %% Generic macro and flags for bipoles %<<<
4039 % Fixing tunable directions
4040 \newif\ifpgf@circ@fixtunable@dir
4041 \ctikzset{bipoles/fix tunable direction/.is if=pgf@circ@fixtunable@dir}
4042 \ctikzset{bipoles/fix tunable direction=true}
4043 % choosing several arrows
4044 \pgf@circ@declare@family@arrows{tunable}
4045 \pgf@circ@declare@family@arrows{wiper}
4046 \pgf@circ@declare@family@arrows{switch}
4047 \pgf@circ@declare@family@arrows{gto gate}
4048
4049 %>>>
4050
4051
4052 %%%%%%%%%%%%%%%%%%%%%%%%
4053 % Resistive components: generics, resistors, wires
4054 %%%%%%%%%%%%%%%%%%%%%%%%
4055
4056 %% Definitions for resistive components %<<<
4057
4058 % Zig Zag resistors
4059 \ctikzset{resistors/zigs/.initial=3}
4060 \ctikzset{resistors/width/.code={%
4061 \ctikzset{bipoles/resistor/width=#1}%
4062 \ctikzset{bipoles/vresistor/width=#1}%
4063 \ctikzset{bipoles/potentiometer/width=#1}%
4064 \ctikzset{bipoles/resistivesens/width=#1}%
4065 \ctikzset{bipoles/photoresistor/width=#1}%
4066 \ctikzset{bipoles/thermistor/width=#1}%
4067 \ctikzset{bipoles/thermistorntc/width=#1}%
4068 \ctikzset{bipoles/thermistorptc/width=#1}%
4069 \ctikzset{bipoles/varistor/width=#1}%
4070 \ctikzset{bipoles/generic/width=#1}%
4071 \ctikzset{bipoles/generic potentiometer/width=#1}%
4072 \ctikzset{bipoles/ageneric/width=#1}%
4073 \ctikzset{bipoles/tgeneric/width=#1}%
4074 }}
4075 \ctikzset{wiper pos/.code={%
4076 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
4077 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
4078 }}
4079 % zigzag resistor
4080 \ctikzset{bipoles/resistor/height/.initial=.3}
4081 \ctikzset{bipoles/resistor/width/.initial=.8}
4082 \ctikzset{bipoles/potentiometer/height/.initial=.8}
4083 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
4084 \ctikzset{bipoles/potentiometer/width/.initial=.8}
4085 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
4086 \ctikzset{bipoles/vresistor/height/.initial=.6}
4087 \ctikzset{bipoles/vresistor/width/.initial=.8}
4088 \ctikzset{bipoles/resistivesens/height/.initial=.6}
4089 \ctikzset{bipoles/resistivesens/width/.initial=.8}
4090 % square resistors
4091 \ctikzset{bipoles/photoresistor/height/.initial=.6}
4092 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
4093 \ctikzset{bipoles/photoresistor/width/.initial=.8}
4094 \ctikzset{bipoles/thermistor/main/.initial=.7}
4095 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
4096 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
4097 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
4098 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
4099 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
4100 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
4101 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
4102 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
4103 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
4104 \ctikzset{bipoles/thermistor/width/.initial=.8}
4105 \ctikzset{bipoles/varistor/main/.initial=.7}
4106 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
4107 \ctikzset{bipoles/varistor/width/.initial=.8}
4108 \ctikzset{bipoles/generic/height/.initial=.30}
4109 \ctikzset{bipoles/generic/width/.initial=.80}
4110 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
4111 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
4112 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
4113 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
4114 \ctikzset{bipoles/ageneric/height/.initial=.30}
4115 \ctikzset{bipoles/tgeneric/height/.initial=.70}
4116 \ctikzset{bipoles/tgeneric/width/.initial=.80}
4117 \ctikzset{bipoles/ageneric/width/.initial=.80}
4118 \ctikzset{bipoles/memristor/height/.initial=.30}
4119 \ctikzset{bipoles/memristor/wave height/.initial=.5}
4120 \ctikzset{bipoles/memristor/width/.initial=.80}
4121
4122 \newif\ifpgf@circuit@europeanresistor
4123 \ctikzset{resistor/.is choice}
4124 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
4125 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
4126 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
4127 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}%
4128
4129 % wires (open, shorts, ...)
4130
4131 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
4132 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
4133 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
4134 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
4135 \ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning
4136 \ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning
4137 % multiwire
4138 \ctikzset{bipoles/multiwire/height/.initial=0.4}
4139 \ctikzset{bipoles/multiwire/width/.initial=0.2}
4140 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
4141 % crossing wires
4142 \ctikzset{bipoles/crossing/size/.initial=.2}
4143
4144 %%>>>
4145
4146 %% Shapes for generic, resistives and wires components %<<<
4147 %% Short circuit
4148
4149 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
4150 %%% natural length is zero.
4151 \pgfcircdeclarebipole
4152 {% fix the anchor border to add a bit of space for voltage and labels
4153 % it uses the dummy width and height
4154 \anchorborder{%
4155 \ifpgf@circuit@bipole@inverted
4156 \pgf@circ@res@left=-\pgf@x
4157 \pgf@circ@res@up=-\pgf@y
4158 \else
4159 \pgf@circ@res@left=\pgf@x
4160 \pgf@circ@res@up=\pgf@y
4161 \fi
4162 \ifdim\pgf@circ@res@up>0cm
4163 \pgf@x=\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4164 \pgf@y=\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4165 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4166 {\pgfpoint{\pgf@x}{\pgf@y}}
4167 \else
4168 \pgf@x=-\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4169 \pgf@y=-\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4170 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4171 {\pgfpoint{-\pgf@x}{-\pgf@y}}
4172 \fi
4173 }
4174 }
4175 {0}
4176 {short}
4177 {0}
4178 {0}
4179 {}
4180
4181 %% Open circuit
4182 \pgfcircdeclarebipole
4183 {}
4184 {\ctikzvalof{bipoles/open/height}}
4185 {open}
4186 {\ctikzvalof{bipoles/open/height}}
4187 {\ctikzvalof{bipoles/open/width}}
4188 {}
4189
4190 % multiwire(s)
4191 \pgfcircdeclarebipole
4192 {}
4193 {\ctikzvalof{bipoles/multiwire/height}}
4194 {multiwire}
4195 {\ctikzvalof{bipoles/multiwire/height}}
4196 {\ctikzvalof{bipoles/multiwire/width}}
4197 {
4198 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4199 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4200 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4201 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4202 \pgfusepath{draw}
4203 }
4204
4205 \pgfcircdeclarebipole
4206 {}
4207 {\ctikzvalof{bipoles/multiwire/height}}
4208 {bmultiwire}
4209 {\ctikzvalof{bipoles/multiwire/height}}
4210 {\ctikzvalof{bipoles/multiwire/width}}
4211 {
4212 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4213 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4214 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4215 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4216 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4217 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4218 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4219 \pgfusepath{draw}
4220 }
4221
4222 \pgfcircdeclarebipole
4223 {}
4224 {\ctikzvalof{bipoles/multiwire/height}}
4225 {tmultiwire}
4226 {\ctikzvalof{bipoles/multiwire/height}}
4227 {\ctikzvalof{bipoles/multiwire/width}}
4228 {
4229 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4230 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4231 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4232 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4233 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4234 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}}
4235 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}}
4236 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4237 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4238 \pgfusepath{draw}
4239 }
4240
4241 %%%%%%%%%%%%%%%%
4242 %% Crossing
4243 %%%%%%%%%%%%%%%%
4244
4245 %% crossing bipole (but see also nodes)
4246 \pgfcircdeclarebipole
4247 {}
4248 {\ctikzvalof{bipoles/crossing/size}}
4249 {crossing}
4250 {\ctikzvalof{bipoles/crossing/size}}
4251 {\ctikzvalof{bipoles/crossing/size}}{
4252 \pgfscope
4253 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
4254 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
4255 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
4256 \pgfsetbeveljoin
4257 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
4258 \pgfusepath{draw}
4259 \endpgfscope
4260 }
4261 %
4262 %
4263 %% Generic bipole - used as resistor by some
4264 \pgfcircdeclarebipolescaled{resistors}
4265 {}
4266 {\ctikzvalof{bipoles/generic/height}}
4267 {generic}
4268 {\ctikzvalof{bipoles/generic/height}}
4269 {\ctikzvalof{bipoles/generic/width}}
4270 {
4271 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4272 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4273 \pgf@circ@draworfill
4274 }
4275
4276 %
4277 % generic crossed, suggested by Radványi Patrik Tamás <[email protected]>
4278 % inherit "generic" properties
4279 %
4280 \pgfcircdeclarebipolescaled{resistors}
4281 {}
4282 {\ctikzvalof{bipoles/generic/height}}
4283 {xgeneric}
4284 {\ctikzvalof{bipoles/generic/height}}
4285 {\ctikzvalof{bipoles/generic/width}}
4286 {
4287 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4288 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4289 \pgf@circ@draworfill
4290 % cross it
4291 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4292 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4293 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4294 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4295 \pgfusepath{draw}
4296 }
4297 %% Generic empty tunable
4298 \pgfcircdeclarebipolescaled{resistors}
4299 {}
4300 {\ctikzvalof{bipoles/tgeneric/height}}
4301 {tgeneric}
4302 {\ctikzvalof{bipoles/tgeneric/height}}
4303 {\ctikzvalof{bipoles/tgeneric/width}}
4304 {
4305 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
4306 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4307 \pgf@circ@draworfill
4308 \pgfscope
4309 \pgf@circ@set@relative@thickness{modifier thickness}
4310 \pgfcirc@set@arrows{tunable}{}{latexslim}
4311 \ifpgf@circ@fixtunable@dir
4312 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4313 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4314 \else
4315 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4316 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4317 \fi
4318 \pgfusepath{draw}
4319 \endpgfscope
4320 }
4321
4322 %% Generic asymmetric bipole
4323 \pgfcircdeclarebipolescaled{resistors}
4324 {}
4325 {\ctikzvalof{bipoles/ageneric/height}}
4326 {ageneric}
4327 {\ctikzvalof{bipoles/ageneric/height}}
4328 {\ctikzvalof{bipoles/ageneric/width}}
4329 {
4330 \pgfscope
4331 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4332 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4333 \pgf@circ@draworfill
4334 \endpgfscope
4335
4336 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4337 \pgfusepath{stroke,fill}
4338 }
4339
4340 %% Memristor
4341 \pgfcircdeclarebipolescaled{resistors}
4342 {}
4343 {\ctikzvalof{bipoles/memristor/height}}
4344 {memristor}
4345 {\ctikzvalof{bipoles/memristor/height}}
4346 {\ctikzvalof{bipoles/memristor/width}}
4347 {
4348 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4349 \divide \pgf@circ@res@step by 14
4350
4351 \pgfscope
4352 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4353 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4354 \pgf@circ@draworfill
4355 \endpgfscope
4356 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4357 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
4358 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4359 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4360 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4361 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4362 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4363 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4364 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
4365 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
4366
4367 \pgfusepath{draw}
4368
4369 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4370 \pgfusepath{stroke,fill}
4371 }
4372
4373 %% Photoresistor
4374 \pgfcircdeclarebipolescaled{resistors}
4375 {}
4376 {\ctikzvalof{bipoles/photoresistor/height 2}}
4377 {photoresistor}
4378 {\ctikzvalof{bipoles/photoresistor/height}}
4379 {\ctikzvalof{bipoles/photoresistor/width}}
4380 {
4381 \pgfscope
4382 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
4383 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4384 \pgf@circ@draworfill
4385 \endpgfscope
4386
4387 \pgfscope
4388 \pgfsetarrowsend{latexslim}
4389 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
4390 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4391 \pgfusepath{draw}
4392 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
4393 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4394 \pgfusepath{draw}
4395 \endpgfscope
4396 }
4397
4398
4399
4400 %% Thermistor
4401 \pgfcircdeclarebipolescaled{resistors}
4402 {% anchor for labelling the type of dependency
4403 \anchor{label}{%
4404 \southwest
4405 \pgf@x=0.4\pgf@x
4406 \pgf@y=1.2\pgf@y
4407 }%
4408 \pgfcirc@border@extend@updown{1}{1.2}
4409 }
4410 {\ctikzvalof{bipoles/thermistor/height}}
4411 {thermistor}
4412 {\ctikzvalof{bipoles/thermistor/height}}
4413 {\ctikzvalof{bipoles/thermistor/width}}
4414 {
4415 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistor/main}\pgf@circ@res@up}}
4416 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4417 \pgf@circ@draworfill
4418 \pgf@circ@set@relative@thickness{modifier thickness}
4419 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4420 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4421 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4422 \pgfusepath{draw}
4423 }
4424
4425 %% Thermistor PTC
4426 \pgfcircdeclarebipolescaled{resistors}
4427 {}
4428 {\ctikzvalof{bipoles/thermistorptc/height 2}}
4429 {thermistorptc}
4430 {\ctikzvalof{bipoles/thermistorptc/height}}
4431 {\ctikzvalof{bipoles/thermistorptc/width}}
4432 {
4433 \pgfscope
4434 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorptc/main}\pgf@circ@res@up}}
4435 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4436 \pgf@circ@draworfill
4437 \pgf@circ@set@relative@thickness{modifier thickness}
4438 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4439 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4440 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4441 \pgfusepath{draw}
4442 \endpgfscope
4443
4444 \pgfsetlinewidth{\pgfstartlinewidth}
4445 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4446 \pgfsetarrowsend{latexslim}
4447 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4448 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4449 \pgfusepath{draw}
4450 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4451 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4452 \pgfusepath{draw}
4453 }
4454
4455 %% Thermistor NTC
4456 \pgfcircdeclarebipolescaled{resistors}
4457 {}
4458 {\ctikzvalof{bipoles/thermistorntc/height 2}}
4459 {thermistorntc}
4460 {\ctikzvalof{bipoles/thermistorntc/height}}
4461 {\ctikzvalof{bipoles/thermistorntc/width}}
4462 {
4463 \pgfscope
4464 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/thermistorntc/main}\pgf@circ@res@up}}
4465 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4466 \pgf@circ@draworfill
4467 \pgf@circ@set@relative@thickness{modifier thickness}
4468 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4469 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4470 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4471 \pgfusepath{draw}
4472 \endpgfscope
4473
4474 \pgfsetlinewidth{\pgfstartlinewidth}
4475 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4476 \pgfsetarrowsend{latexslim}
4477 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4478 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4479 \pgfusepath{draw}
4480 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4481 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4482 \pgfusepath{draw}
4483 }
4484
4485 %% Varistor
4486 \pgfcircdeclarebipolescaled{resistors}
4487 {
4488 \pgfcirc@border@extend@updown{1}{1.4}
4489 }
4490 {\ctikzvalof{bipoles/varistor/height}}
4491 {varistor}
4492 {\ctikzvalof{bipoles/varistor/height}}
4493 {\ctikzvalof{bipoles/varistor/width}}
4494 {
4495 \pgfscope
4496 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{-\ctikzvalof{bipoles/varistor/main}\pgf@circ@res@up}}
4497 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4498 \pgf@circ@draworfill
4499 \pgf@circ@set@relative@thickness{modifier thickness}
4500 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4501 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
4502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4503 \pgfusepath{draw}
4504 \endpgfscope
4505
4506 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
4507 }
4508
4509 %% Generic tunable
4510 \pgfcircdeclarebipolescaled{resistors}
4511 {
4512 \savedanchor{\wiper}{
4513 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4514 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
4515 \pgf@y=.5\pgf@ya
4516 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
4517 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
4518 }
4519 \anchor{wiper}{\wiper}
4520 \anchor{W}{\wiper}
4521 }
4522 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
4523 {genericpotentiometer}
4524 {\ctikzvalof{bipoles/generic potentiometer/height}}
4525 {\ctikzvalof{bipoles/generic potentiometer/width}}
4526 {
4527
4528 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4529 \divide \pgf@circ@res@step by 14
4530
4531 \pgfscope
4532 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4533 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4534 \pgf@circ@draworfill
4535 \endpgfscope
4536 \pgfscope
4537 %\pgfsetlinewidth{\pgfstartlinewidth}
4538 \pgfcirc@set@arrows{wiper}{}{latexslim}
4539 \pgfextractx{\pgf@circ@res@other}{\wiper}
4540 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4541 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4542 \pgfusepath{draw}
4543 \endpgfscope
4544 }
4545
4546 %% Zig-zag resistors
4547 \def\pgf@circ@zigzag#1{%
4548 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
4549
4550 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4551 \pgf@circ@res@other = \pgf@circ@res@left
4552 \pgf@circ@count@a=\zigs\relax
4553 % first half zig
4554 \advance\pgf@circ@res@other by \pgf@circ@res@step
4555 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4556 \pgfmathloop%
4557 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
4558 \ifnum\pgf@circ@count@a>0
4559 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4560 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4561 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4562 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4563 \repeatpgfmathloop%
4564 % last zig and a half
4565 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4566 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4567 \advance\pgf@circ@res@other by \pgf@circ@res@step
4568 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
4569 \pgfsetbeveljoin
4570 \pgfusepath{draw}
4571 }
4572
4573 %% Resistor
4574 \pgfcircdeclarebipolescaled{resistors}
4575 {
4576 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4577 }
4578 {\ctikzvalof{bipoles/resistor/height}}
4579 {resistor}
4580 {\ctikzvalof{bipoles/resistor/height}}
4581 {\ctikzvalof{bipoles/resistor/width}}
4582 {
4583 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4584 \pgftransformationadjustments
4585 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4586 \pgf@circ@zigzag{1}
4587 }
4588
4589
4590 %% Variable resistor
4591 \pgfcircdeclarebipolescaled{resistors}
4592 {
4593 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4594 }
4595 {\ctikzvalof{bipoles/vresistor/height}}
4596 {vresistor}
4597 {\ctikzvalof{bipoles/vresistor/height}}
4598 {\ctikzvalof{bipoles/vresistor/width}}
4599 {
4600 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4601 \pgftransformationadjustments
4602 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4603 \pgf@circ@zigzag{.5}
4604
4605 \pgfscope
4606 \pgf@circ@set@relative@thickness{modifier thickness}
4607 \pgfcirc@set@arrows{tunable}{}{latexslim}
4608 \ifpgf@circ@fixtunable@dir
4609 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4610 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4611 \else
4612 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4613 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4614 \fi
4615 \pgfusepath{draw}
4616 \endpgfscope
4617 }
4618
4619 %% Potentiometer
4620 \pgfcircdeclarebipolescaled{resistors}
4621 {
4622 \savedanchor{\wiper}{
4623 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4624 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
4625 \pgf@y=.5\pgf@ya
4626 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
4627 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
4628 }
4629 \anchor{wiper}{\wiper}
4630 \anchor{W}{\wiper}
4631 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4632 }
4633 {\ctikzvalof{bipoles/potentiometer/height 2}}
4634 {potentiometer}
4635 {\ctikzvalof{bipoles/potentiometer/height}}
4636 {\ctikzvalof{bipoles/potentiometer/width}}
4637 {
4638 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4639 \pgftransformationadjustments
4640 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4641 \pgf@circ@zigzag{1}
4642
4643 \pgfscope
4644 %\pgfsetlinewidth{\pgfstartlinewidth}
4645 \pgf@circ@set@relative@thickness{modifier thickness}
4646 \pgfcirc@set@arrows{wiper}{}{latexslim}
4647 \pgfextractx{\pgf@circ@res@other}{\wiper}
4648 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4649 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4650 \pgfusepath{draw}
4651 \endpgfscope
4652 }
4653
4654 %% Resistive sensor
4655 \pgfcircdeclarebipolescaled{resistors}
4656 {% anchor for labelling the type of dependency
4657 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
4658 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4659 }
4660 {\ctikzvalof{bipoles/resistivesens/height}}
4661 {resistivesens}
4662 {\ctikzvalof{bipoles/resistivesens/height}}
4663 {\ctikzvalof{bipoles/resistivesens/width}}
4664 {%
4665 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4666 \pgftransformationadjustments
4667 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4668 \pgf@circ@zigzag{.5}
4669
4670 \pgfscope
4671 \pgf@circ@set@relative@thickness{modifier thickness}
4672 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4673 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4674 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}}
4675 \pgfusepath{draw}
4676 \endpgfscope
4677 }% %>>>
4678
4679 %% Paths for resistive components: generic, resistors and wires% %<<<
4680
4681 %% GENERICS
4682 \def\pgf@circ@empty@path#1{}
4683 \pgfcirc@activate@bipole@simple{l}{generic}
4684 \pgfcirc@activate@bipole@simple{l}{ageneric}
4685 \pgfcirc@activate@bipole@simple{l}{tgeneric}
4686 \pgfcirc@activate@bipole@simple{l}{xgeneric}
4687 \pgfcirc@activate@bipole@simple{l}{fullgeneric}
4688 \pgfcirc@activate@bipole@simple{l}{tfullgeneric}
4689 \pgfcirc@activate@bipole@simple{l}{short}
4690 \pgfcirc@activate@bipole@simple{l}{open}
4691
4692 %% wires and crossings
4693
4694 \pgfcirc@activate@bipole@simple{l}{crossing}
4695 \pgfcirc@style@to@style{crossing}{xing}
4696 \pgfcirc@activate@bipole@simple{l}{multiwire}
4697 \pgfcirc@activate@bipole@simple{l}{bmultiwire}
4698 \pgfcirc@activate@bipole@simple{l}{tmultiwire}
4699
4700 % automatically switching path --- to be defined manually
4701 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
4702 \pgfcirc@path@to@style{l}{resistor}{resistor}{}
4703 \pgfcirc@node@to@style{l}{resistor}{american resistor}{}
4704 \pgfcirc@node@to@style{l}{generic}{european resistor}{}
4705 \pgfcirc@style@to@style{resistor}{R}
4706
4707 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
4708 \pgfcirc@path@to@style{l}{vresistor}{variable resistor}{}
4709 \pgfcirc@node@to@style{l}{vresistor}{variable american resistor}{}
4710 \pgfcirc@node@to@style{l}{tgeneric}{variable european resistor}{}
4711 \pgfcirc@style@to@style{variable resistor}{vR}
4712
4713 \def\pgf@circ@resistivesens@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
4714 \pgfcirc@path@to@style{l}{resistivesens}{resistive sensor}{}
4715 \pgfcirc@node@to@style{l}{resistivesens}{american resistive sensor}{}
4716 \pgfcirc@node@to@style{l}{thermistor}{european resistive sensor}{}
4717 \pgfcirc@style@to@style{resistive sensor}{sR}
4718
4719 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
4720 \pgfcirc@path@to@style{l}{potentiometer}{potentiometer}{}
4721 \pgfcirc@node@to@style{l}{potentiometer}{american potentiometer}{}
4722 \pgfcirc@node@to@style{l}{genericpotentiometer}{european potentiometer}{}
4723 \pgfcirc@style@to@style{potentiometer}{pR}
4724
4725 \pgfcirc@activate@bipole@simple{l}{thermistor}
4726 \pgfcirc@style@to@style{thermistor}{thR}
4727 \pgfcirc@activate@bipole{l}{thermistorptc}{thermistorptc}{thermistor ptc}
4728 \pgfcirc@style@to@style{thermistor ptc}{thRp}
4729 \pgfcirc@activate@bipole{l}{thermistorntc}{thermistorntc}{thermistor ntc}
4730 \pgfcirc@style@to@style{thermistor ntc}{thRn}
4731 \pgfcirc@activate@bipole@simple{l}{photoresistor}
4732 \pgfcirc@style@to@style{photoresistor}{phR}
4733 \pgfcirc@activate@bipole@simple{l}{varistor}
4734 \pgfcirc@activate@bipole@simple{l}{memristor}
4735 \pgfcirc@style@to@style{memristor}{Mr}%
4736 % %>>>
4737
4738 %%%%%%%%%%%%%%
4739 %% Capacitors
4740 %%%%%%%%%%%%%
4741
4742 %% Definitions for Capacitors%<<<1
4743 \ctikzset{bipoles/capacitor/height/.initial=.6}
4744 \ctikzset{bipoles/capacitor/width/.initial=.2}
4745 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
4746 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
4747 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
4748 %%% pcapacitor is deprecated
4749 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
4750 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
4751 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
4752 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
4753 \ctikzset{bipoles/ccapacitor/width/.initial=.2}
4754 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
4755 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
4756 \ctikzset{bipoles/vcapacitor/width/.initial=.2}
4757 \ctikzset{bipoles/vcapacitor/tunable width/.initial=3}
4758 \ctikzset{bipoles/vcapacitor/capacitor width/.code={%
4759 \pgfutil@packagewarning{circuitikz}{vcapacitor/capacitor width deprecated; ignored}%
4760 }}% deprecated
4761 % piezoelectric (double size by default)
4762 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
4763 \ctikzset{bipoles/piezoelectric/width/.initial=.4}%
4764 % constant phase element (double size by default)
4765 \ctikzset{bipoles/cpe/height/.initial=.6}
4766 \ctikzset{bipoles/cpe/width/.initial=.4}
4767 %
4768 % style settings
4769 %
4770 \ctikzset{capacitors/width/.code={%
4771 \pgfmathsetmacro{\pgfcirc@@double}{2*#1}%
4772 \ctikzset{bipoles/.cd,
4773 capacitor/width=#1, ecapacitor/width=#1, ccapacitor/width=#1,
4774 vcapacitor/width=#1,
4775 piezoelectric/width=\pgfcirc@@double,
4776 cpe/width=\pgfcirc@@double,
4777 }}}
4778 \ctikzset{capacitors/height/.code={%
4779 \ctikzset{bipoles/.cd,
4780 capacitor/height=#1, ecapacitor/height=#1, ccapacitor/height=#1,
4781 vcapacitor/height=#1,
4782 piezoelectric/height=#1,
4783 cpe/height=#1,
4784 }}}
4785 \def\pgfcirc@maybe@fill@straight@capacitor{%
4786 \pgfscope
4787 \pgfpathrectanglecorners
4788 {\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4789 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4790 \pgf@circ@maybefill
4791 \endpgfscope
4792 }
4793 %>>>
4794
4795 %% Shapes for capacitors%<<<
4796 %% Plain Capacitor
4797 \pgfcircdeclarebipolescaled{capacitors}
4798 {}
4799 {\ctikzvalof{bipoles/capacitor/height}}
4800 {capacitor}
4801 {\ctikzvalof{bipoles/capacitor/height}}
4802 {\ctikzvalof{bipoles/capacitor/width}}
4803 {
4804 \pgfcirc@maybe@fill@straight@capacitor
4805
4806 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4807 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4808 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4809
4810 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4811 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4812 \pgfusepath{draw}
4813
4814 }
4815
4816 %% Capacitive sensor
4817 \pgfcircdeclarebipolescaled{capacitors}
4818 {
4819 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
4820 \pgfcirc@border@extend@full{2.6}{1}{4.4}{1.2}
4821 }
4822 {\ctikzvalof{bipoles/capacitor/height}}
4823 {capacitivesens}
4824 {\ctikzvalof{bipoles/capacitor/height}}
4825 {\ctikzvalof{bipoles/capacitor/width}}
4826 {
4827 \pgfcirc@maybe@fill@straight@capacitor
4828 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4829 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4830 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4831
4832 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4833 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4834 \pgfusepath{draw}
4835 \pgfscope
4836 \pgf@circ@set@relative@thickness{modifier thickness}
4837 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
4838 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
4839 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
4840 \pgfusepath{draw}
4841 \endpgfscope
4842 }
4843
4844 %% Polar Capacitor (DEPRECATED)
4845 \pgfcircdeclarebipolescaled{capacitors}
4846 {}
4847 {\ctikzvalof{bipoles/pcapacitor/height}}
4848 {polarcapacitor}
4849 {\ctikzvalof{bipoles/pcapacitor/height}}
4850 {\ctikzvalof{bipoles/pcapacitor/width}}
4851 {
4852
4853 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4854
4855 \pgfutil@packagewarning{circuitikz}{polar capacitor has been deprecated; change to curved capacitor (see manual)}%
4856
4857 \pgfscope
4858 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
4859 \pgftransformrotate{-90}
4860 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
4861 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
4862 \pgfusepath{draw}
4863 \endpgfscope
4864
4865 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4866 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4867 \pgfusepath{draw}
4868 }
4869
4870
4871 %% Curved capacitor
4872 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
4873 % for a rationale
4874 %
4875 \pgfcircdeclarebipolescaled{capacitors}
4876 {}
4877 {\ctikzvalof{bipoles/ccapacitor/height}}
4878 {ccapacitor}
4879 {\ctikzvalof{bipoles/ccapacitor/height}}
4880 {\ctikzvalof{bipoles/ccapacitor/width}}
4881 {
4882 \pgfscope
4883 \pgfscope
4884 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4885 \pgftransformrotate{-90}
4886 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
4887 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}}
4888 \pgftransformrotate{90}
4889 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4890 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4891 \pgfpathclose{}
4892 \pgf@circ@maybefill
4893 \endpgfscope
4894 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4895 \pgfscope
4896 % \pgfsetcolor{red}
4897 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4898 \pgftransformrotate{-90}
4899 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
4900 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}}
4901 \pgfusepath{draw}
4902 \endpgfscope
4903 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4904 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4905 \pgfusepath{draw}
4906 \endpgfscope
4907 % extend wire to the curved capacitor
4908 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}{0pt}}
4909 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4910 \pgfusepath{draw}
4911 }
4912
4913 %% Electrolytic Capacitor
4914 \pgfcircdeclarebipolescaled{capacitors}
4915 {}
4916 {\ctikzvalof{bipoles/ecapacitor/height}}
4917 {ecapacitor}
4918 {\ctikzvalof{bipoles/ecapacitor/height}}
4919 {\ctikzvalof{bipoles/ecapacitor/width}}
4920 {
4921 \pgfsetrectcap
4922 % % % Draw plus pole
4923 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4924 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4925 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
4926 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
4927 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4928 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4929 \pgf@circ@draworfill
4930 % % Draw minus pole
4931 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4932 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
4933 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
4934 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4935 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4936 \pgfsetfillcolor{\ctikzvalof{color}}
4937 \pgfusepath{draw,fill}
4938 \pgfsetfillcolor{\ctikzvalof{color}}
4939 % % plus pole annotation
4940 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
4941 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
4942 }
4943
4944 %% Variable Capacitor
4945 \pgfcircdeclarebipolescaled{capacitors}
4946 {}
4947 {\ctikzvalof{bipoles/vcapacitor/height}}
4948 {vcapacitor}
4949 {\ctikzvalof{bipoles/vcapacitor/height}}
4950 {\ctikzvalof{bipoles/vcapacitor/width}}
4951 {
4952 \pgfcirc@maybe@fill@straight@capacitor
4953 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/tunable width} \pgf@circ@res@right
4954
4955 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4956 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}}
4957 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@down}}
4958
4959 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4960 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4961 \pgfusepath{draw}
4962
4963 \pgfscope
4964 \pgf@circ@set@relative@thickness{modifier thickness}
4965 \pgfcirc@set@arrows{tunable}{}{latexslim}
4966 \ifpgf@circ@fixtunable@dir
4967 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
4968 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
4969 \else
4970 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
4971 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
4972 \fi
4973 \pgfusepath{draw}
4974 \endpgfscope
4975
4976 \pgfsetlinewidth{\pgfstartlinewidth}
4977 \pgfusepath{draw}
4978 }
4979
4980
4981 %% Piezoelectric Element
4982
4983 \pgfcircdeclarebipolescaled{capacitors}
4984 {}
4985 {\ctikzvalof{bipoles/piezoelectric/height}}
4986 {piezoelectric}
4987 {\ctikzvalof{bipoles/piezoelectric/height}}
4988 {\ctikzvalof{bipoles/piezoelectric/width}}
4989 {
4990 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
4991 % \divide \pgf@circ@res@step by 5
4992
4993 %% Outer markings
4994 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4995 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4996 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4997
4998 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4999 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5000 \pgfusepath{draw}
5001
5002 %% Inner Box
5003 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
5004 \pgfscope
5005 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5006 \pgfpathrectanglecorners
5007 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
5008 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
5009 \pgf@circ@draworfill
5010 \endpgfscope
5011 }
5012
5013 % Ferroelectric capacitor, suggested by Mayeul Cantan
5014 % (see https://github.com/circuitikz/circuitikz/issues/515)
5015 \pgfcircdeclarebipolescaled{capacitors}
5016 {
5017 \anchor{curve right}{\southwest\pgf@x=-1.8\pgf@x\pgf@y=\pgf@y}%
5018 \anchor{curve left}{\southwest\pgf@x=1.8\pgf@x\pgf@y=-\pgf@y}%
5019 \anchor{kink right}{\southwest\pgf@x=-1.8\pgf@x\pgf@y=0.5\pgf@y}%
5020 \anchor{kink left}{\southwest\pgf@x=1.8\pgf@x\pgf@y=-0.5\pgf@y}%
5021 \pgfcirc@border@extend@full{1.8}{1}{1.8}{1}
5022 }
5023 {\ctikzvalof{bipoles/capacitor/height}}
5024 {ferrocap}
5025 {\ctikzvalof{bipoles/capacitor/height}}
5026 {\ctikzvalof{bipoles/capacitor/width}}
5027 {
5028 \pgfcirc@maybe@fill@straight@capacitor
5029
5030 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5031 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5032 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5033
5034 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5035 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5036 \pgfusepath{draw}
5037 \pgfscope
5038 \pgf@circ@set@relative@thickness{modifier thickness}
5039 \pgfsetcornersarced{\pgfpoint{0.2\pgf@circ@res@right}{0.2\pgf@circ@res@up}}
5040 \pgfpathmoveto{\pgfpoint{-1.8\pgf@circ@res@right}{\pgf@circ@res@up}}
5041 \pgfpathlineto{\pgfpoint{-1.8\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
5042 \pgfpathlineto{\pgfpoint{1.8\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
5043 \pgfpathlineto{\pgfpoint{1.8\pgf@circ@res@right}{\pgf@circ@res@down}}
5044 \pgfusepath{draw}
5045 \endpgfscope
5046 }
5047
5048 %% Constant phase element
5049 \pgfcircdeclarebipolescaled{capacitors}
5050 {}
5051 {\ctikzvalof{bipoles/cpe/height}}
5052 {cpe}
5053 {\ctikzvalof{bipoles/cpe/height}}
5054 {\ctikzvalof{bipoles/cpe/width}}
5055 {
5056 \pgfscope
5057 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5058 \pgfpathlineto{\pgfpointorigin}
5059 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5060 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5061 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5062 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5063 \pgfpathclose
5064 \pgf@circ@maybefill
5065 \endpgfscope
5066
5067 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
5068 \pgfpathlineto{\pgfpointorigin}
5069 \pgfusepath{draw}
5070 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5071 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5072 \pgfpathlineto{\pgfpointorigin}
5073 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5074
5075 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5076 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5077 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5078 \pgfusepath{draw}
5079 }
5080
5081 % %>>>
5082
5083 %% Paths for capacitors%<<<
5084 \pgfcirc@activate@bipole@simple{l}{capacitor}
5085 \pgfcirc@style@to@style{capacitor}{C}
5086 \pgfcirc@activate@bipole@simple{l}{ecapacitor}
5087 \pgfcirc@style@to@style{ecapacitor}{eC}
5088 \pgfcirc@style@to@style{ecapacitor}{elko}
5089 \pgfcirc@activate@bipole{l}{polarcapacitor}{polarcapacitor}{polar capacitor}
5090 %% polar capacitor is deprecated, use curved capacitor instead
5091 \pgfcirc@style@to@style{polar capacitor}{pC}
5092 \pgfcirc@activate@bipole{l}{ccapacitor}{ccapacitor}{curved capacitor}
5093 \pgfcirc@style@to@style{curved capacitor}{cC}
5094 \pgfcirc@activate@bipole{l}{vcapacitor}{vcapacitor}{variable capacitor}
5095 \pgfcirc@style@to@style{variable capacitor}{vC}
5096 \pgfcirc@activate@bipole@simple{l}{piezoelectric}
5097 \pgfcirc@style@to@style{piezoelectric}{PZ}
5098 \pgfcirc@activate@bipole{l}{capacitivesens}{capacitivesens}{capacitive sensor}
5099 \pgfcirc@style@to@style{capacitive sensor}{sC}
5100 \pgfcirc@activate@bipole@simple{l}{ferrocap}
5101 \pgfcirc@style@to@style{ferrocap}{feC}
5102 \pgfcirc@activate@bipole@simple{l}{cpe}
5103 % %>>>
5104
5105 %%%%%%%%%%%%%%%
5106 %% Inductors
5107 %%%%%%%%%%%%%%%
5108
5109 % Definitions of Inductors%<<<1
5110
5111 \ctikzset{inductors/coils/.code={%
5112 \ctikzset{bipoles/cuteinductor/coils=#1}%
5113 \ctikzset{bipoles/cutechoke/coils=#1}%
5114 \ctikzset{bipoles/americaninductor/coils=#1}%
5115 \ctikzset{bipoles/vcuteinductor/coils=#1}%
5116 \ctikzset{bipoles/vamericaninductor/coils=#1}%
5117 }}
5118 \ctikzset{inductors/width/.code={%
5119 \ctikzset{bipoles/cuteinductor/width=#1}%
5120 \ctikzset{bipoles/cutechoke/width=#1}%
5121 \ctikzset{bipoles/americaninductor/width=#1}%
5122 \ctikzset{bipoles/vcuteinductor/width=#1}%
5123 \ctikzset{bipoles/vamericaninductor/width=#1}%
5124 \ctikzset{bipoles/fullgeneric/width=#1}%
5125 \ctikzset{bipoles/tfullgeneric/width=#1}%
5126 }}
5127 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
5128 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
5129 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
5130 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
5131 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
5132 %% Cute choke settings
5133 \ctikzset{bipoles/cutechoke/height/.initial=.3}
5134 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
5135 \ctikzset{bipoles/cutechoke/width/.initial=.6}
5136 \ctikzset{bipoles/cutechoke/coils/.initial=5}
5137 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
5138 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
5139 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
5140 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
5141 \newif\ifpgf@circuit@bipole@twolineschoke
5142 \pgf@circuit@bipole@twolineschokefalse
5143 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
5144 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
5145 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
5146 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
5147 %
5148 % generic core anchor settings
5149 \ctikzset{bipoles/inductors/core distance/.initial={2pt}}
5150 \def\pgfcir@basic@core@anchors{%
5151 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5152 \anchor{core east}{%
5153 \northeast\advance\pgf@y by\coredistance
5154 }
5155 \anchor{core west}{%
5156 \northeast\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5157 }
5158 }
5159 %
5160 \ctikzset{bipoles/americaninductor/height/.initial=.3}
5161 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
5162 \ctikzset{bipoles/americaninductor/width/.initial=.8}
5163 \ctikzset{bipoles/americaninductor/coils/.initial=4}
5164 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
5165 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
5166 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
5167 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
5168 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
5169 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
5170 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
5171 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
5172 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
5173 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
5174 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
5175 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
5176 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
5177 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
5178 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
5179 \ctikzset{inductor/.is choice}
5180 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
5181 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
5182 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
5183
5184 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
5185 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
5186 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
5187 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
5188 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
5189
5190 %%>>>
5191
5192 %% Shapes for inductors%<<<
5193 %% cute inductor
5194 \pgfcircdeclarebipolescaled{inductors}
5195 {
5196 \savedanchor{\midtap}{%
5197 \pgf@x=0pt\relax
5198 \pgfmathsetlength{\pgf@y}{%
5199 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5200 \ctikzvalof{bipoles/cuteinductor/height} :% even
5201 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5202 *\pgf@circ@scaled@Rlen/2
5203 }
5204 }
5205 \anchor{midtap}{\midtap}
5206 \pgfcir@basic@core@anchors
5207 }
5208 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5209 {cuteinductor}
5210 {\ctikzvalof{bipoles/cuteinductor/height}}
5211 {\ctikzvalof{bipoles/cuteinductor/width}}
5212 {
5213 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5214 \pgftransformationadjustments
5215
5216 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5217 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5218
5219
5220 \pgfmathsetlength{\pgf@circ@res@step}
5221 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5222
5223 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5224 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5225 {
5226 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5227 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5228 }
5229 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5230 \pgfsetbuttcap
5231 \pgfsetbeveljoin
5232 \pgfusepath{stroke}
5233 }
5234
5235 %% cute inductive sensor
5236 \pgfcircdeclarebipolescaled{inductors}
5237 {% anchor for labelling the type of dependency
5238 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5239 \savedanchor{\midtap}{%
5240 \pgf@x=0pt\relax
5241 \pgfmathsetlength{\pgf@y}{%
5242 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5243 \ctikzvalof{bipoles/cuteinductor/height} :% even
5244 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5245 *\pgf@circ@scaled@Rlen/2
5246 }
5247 }
5248 \anchor{midtap}{\midtap}
5249 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5250 \pgfcir@basic@core@anchors
5251 }
5252 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5253 {scuteinductor}
5254 {\ctikzvalof{bipoles/cuteinductor/height}}
5255 {\ctikzvalof{bipoles/cuteinductor/width}}
5256 {
5257 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5258 \pgftransformationadjustments
5259
5260 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5261 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5262
5263
5264 \pgfmathsetlength{\pgf@circ@res@step}
5265 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5266
5267 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5268 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5269 {
5270 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5271 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5272 }
5273 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5274 \pgfsetbuttcap
5275 \pgfsetbeveljoin
5276 \pgfusepath{stroke}
5277 \pgfscope
5278 \pgf@circ@set@relative@thickness{modifier thickness}
5279 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5280 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5281 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5282 \pgfusepath{draw}
5283 \endpgfscope
5284 }
5285
5286 %% cute choke
5287 \pgfcircdeclarebipolescaled{inductors}
5288 {
5289 \savedanchor{\midtap}{%
5290 \pgf@x=0pt\relax
5291 \pgfmathsetlength{\pgf@y}{%
5292 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5293 \ctikzvalof{bipoles/cuteinductor/height} :% even
5294 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5295 *\pgf@circ@scaled@Rlen/2
5296 }
5297 }
5298 \anchor{midtap}{\midtap}
5299 }
5300 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
5301 {cutechoke}
5302 {\ctikzvalof{bipoles/cutechoke/height}}
5303 {\ctikzvalof{bipoles/cutechoke/width}}
5304 {
5305 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5306 \pgftransformationadjustments
5307
5308 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5309 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
5310
5311
5312 \pgfmathsetlength{\pgf@circ@res@step}
5313 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
5314
5315 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5316 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
5317 {
5318 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5319 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5320 }
5321 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5322 \pgfsetbuttcap
5323 \pgfsetbeveljoin
5324 \pgfusepath{stroke}
5325
5326 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5327 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5328 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5329 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5330 \pgfusepath{stroke}
5331
5332 \ifpgf@circuit@bipole@twolineschoke
5333 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}}
5334 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up+\ctikzvalof{bipoles/cutechoke/cstep}\pgf@circ@res@up}}
5335 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5336 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5337 \pgfusepath{stroke}
5338 \fi
5339 }
5340
5341 %% variable cute inductor
5342 \pgfcircdeclarebipolescaled{inductors}
5343 {
5344 \savedanchor{\midtap}{%
5345 \pgf@x=0pt\relax
5346 \pgfmathsetlength{\pgf@y}{%
5347 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5348 \ctikzvalof{bipoles/cuteinductor/height} :% even
5349 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5350 *\pgf@circ@scaled@Rlen/2
5351 }
5352 }
5353 \anchor{midtap}{\midtap}
5354 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5355 \anchor{core east}{%
5356 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance
5357 }
5358 \anchor{core west}{%
5359 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5360 }
5361 }
5362 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
5363 {vcuteinductor}
5364 {\ctikzvalof{bipoles/vcuteinductor/height}}
5365 {\ctikzvalof{bipoles/vcuteinductor/width}}
5366 {
5367 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5368 \pgftransformationadjustments
5369
5370 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5371 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
5372
5373
5374 \pgfmathsetlength{\pgf@circ@res@step}
5375 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
5376
5377 \pgfscope
5378 \pgf@circ@set@relative@thickness{modifier thickness}
5379 \pgfcirc@set@arrows{tunable}{}{latexslim}
5380 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5381 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5382 \pgfusepath{draw}
5383 \endpgfscope
5384
5385 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5386 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
5387 {
5388 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5389 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
5390 }
5391 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5392 \pgfsetbuttcap
5393 \pgfsetbeveljoin
5394 \pgfusepath{stroke}
5395 }
5396
5397 %% american inductor
5398 \pgfcircdeclarebipolescaled{inductors}
5399 {
5400 \savedanchor{\midtap}{%
5401 \pgf@x=0pt\relax
5402 \pgfmathsetlength{\pgf@y}{%
5403 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5404 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5405 0) %odd
5406 *\pgf@circ@scaled@Rlen/2
5407 }
5408 }
5409 \anchor{midtap}{\midtap}
5410 \pgfcir@basic@core@anchors
5411 }
5412 {\ctikzvalof{bipoles/americaninductor/height 2}}
5413 {americaninductor}
5414 {\ctikzvalof{bipoles/americaninductor/height}}
5415 {\ctikzvalof{bipoles/americaninductor/width}}
5416 {
5417 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5418 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5419 \pgftransformationadjustments
5420 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5421 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5422 \divide \pgf@circ@res@step by 2
5423 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5424
5425 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5426 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5427 {
5428 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5429 }
5430 \pgfsetbuttcap
5431 \pgfsetbeveljoin
5432 \pgfusepath{stroke}
5433 }
5434
5435
5436 %% american inductive sensor
5437 \pgfcircdeclarebipolescaled{inductors}
5438 {% anchor for labelling the type of dependency
5439 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5440 \savedanchor{\midtap}{%
5441 \pgf@x=0pt\relax
5442 \pgfmathsetlength{\pgf@y}{%
5443 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5444 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5445 0) %odd
5446 *\pgf@circ@scaled@Rlen/2
5447 }
5448 }
5449 \anchor{midtap}{\midtap}
5450 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5451 \pgfcir@basic@core@anchors
5452 }
5453 {\ctikzvalof{bipoles/americaninductor/height 2}}
5454 {samericaninductor}
5455 {\ctikzvalof{bipoles/americaninductor/height}}
5456 {\ctikzvalof{bipoles/americaninductor/width}}
5457 {
5458 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5459 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5460 \pgftransformationadjustments
5461 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5462 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5463 \divide \pgf@circ@res@step by 2
5464 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5465
5466 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5467 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5468 {
5469 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5470 }
5471 \pgfsetbuttcap
5472 \pgfsetbeveljoin
5473 \pgfusepath{stroke}
5474 \pgfscope
5475 \pgf@circ@set@relative@thickness{modifier thickness}
5476 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5477 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5478 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5479 \pgfusepath{draw}
5480 \endpgfscope
5481 }
5482
5483 %% variable american inductor
5484 \pgfcircdeclarebipolescaled{inductors}
5485 {
5486 \savedanchor{\midtap}{%
5487 \pgf@x=0pt\relax
5488 \pgfmathsetlength{\pgf@y}{%
5489 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
5490 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
5491 0) %odd
5492 *\pgf@circ@scaled@Rlen/2
5493 }
5494 }
5495 \anchor{midtap}{\midtap}
5496 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5497 \anchor{core east}{%
5498 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance
5499 }
5500 \anchor{core west}{%
5501 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5502 }
5503 }
5504 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
5505 {vamericaninductor}
5506 {\ctikzvalof{bipoles/vamericaninductor/height}}
5507 {\ctikzvalof{bipoles/vamericaninductor/width}}
5508 {
5509 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
5510 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5511 \pgftransformationadjustments
5512 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5513 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
5514 \divide \pgf@circ@res@step by 2
5515 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
5516
5517 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth}}%correct value would be 0.5 but arcs are not really flat, therefore 0.4 is better is (almost) all cases
5518 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
5519 {
5520 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5521 }
5522 \pgfsetbuttcap
5523 \pgfsetbeveljoin
5524 \pgfusepath{stroke}
5525
5526 \pgfscope
5527 \pgf@circ@set@relative@thickness{modifier thickness}
5528 \pgfcirc@set@arrows{tunable}{}{latexslim}
5529 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5530 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5531 \pgfusepath{draw}
5532 \endpgfscope
5533 }
5534
5535 %% Generic bipole, filled - used as inductor by some
5536 \pgfcircdeclarebipolescaled{inductors}
5537 {
5538 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5539 \pgfcir@basic@core@anchors
5540 }
5541 {\ctikzvalof{bipoles/fullgeneric/height}}
5542 {fullgeneric}
5543 {\ctikzvalof{bipoles/fullgeneric/height}}
5544 {\ctikzvalof{bipoles/fullgeneric/width}}
5545 {
5546 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5547 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5548
5549 \pgfusepath{draw,fill}
5550 }
5551
5552 %% Generic sensor, filled - used as inductive sensor by some
5553 \pgfcircdeclarebipolescaled{inductors}
5554 {% anchor for labelling the type of dependency
5555 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
5556 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5557 \pgfcirc@border@extend@full{1}{2}{1}{2}
5558 \pgfcir@basic@core@anchors
5559 }
5560 {\ctikzvalof{bipoles/fullgeneric/height}}
5561 {sfullgeneric}
5562 {\ctikzvalof{bipoles/fullgeneric/height}}
5563 {\ctikzvalof{bipoles/fullgeneric/width}}
5564 {
5565
5566 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5567 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5568 \pgfusepath{draw,fill}
5569 \pgfscope
5570 \pgf@circ@set@relative@thickness{modifier thickness}
5571 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
5572 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
5573 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
5574 \pgfusepath{draw}
5575 \endpgfscope
5576 }
5577
5578 %% Generic full tunable
5579 \pgfcircdeclarebipolescaled{inductors}
5580 {
5581 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5582 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5583 \anchor{core east}{%
5584 \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance
5585 }
5586 \anchor{core west}{%
5587 \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance\pgf@x=-\pgf@x
5588 }
5589 }
5590 {\ctikzvalof{bipoles/tfullgeneric/height}}
5591 {tfullgeneric}
5592 {\ctikzvalof{bipoles/tfullgeneric/height}}
5593 {\ctikzvalof{bipoles/tfullgeneric/width}}
5594 {
5595 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
5596 \divide \pgf@circ@res@step by 14
5597
5598 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
5599 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5600 \pgfusepath{draw,fill}
5601
5602 \pgfscope
5603 \pgf@circ@set@relative@thickness{modifier thickness}
5604 \pgfcirc@set@arrows{tunable}{}{latexslim}
5605 \ifpgf@circ@fixtunable@dir
5606 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5607 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5608 \else
5609 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5610 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5611 \fi
5612 \pgfusepath{draw}
5613 \endpgfscope
5614 }
5615 % %>>>
5616
5617 %% Paths for Inductors%<<<
5618 %% these are complex because of the three-way set
5619 %% should be simplified
5620 \def\pgf@circ@inductor@path#1{%
5621 \pgfextra{
5622 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
5623 \def\pgf@temp{european}%
5624 }
5625 \ifx\pgf@temp\pgf@circ@temp%
5626 \pgf@circ@europeaninductor@path{#1}%
5627 \else%
5628 \pgfextra{ \def\pgf@temp{cute} }%
5629 \ifx\pgf@temp\pgf@circ@temp%
5630 \pgf@circ@cuteinductor@path{#1}%
5631 \else%
5632 \pgf@circ@americaninductor@path{#1}%
5633 \fi%
5634 \fi%
5635 }
5636 \pgfcirc@path@to@style{l}{inductor}{inductor}{}
5637 \pgfcirc@style@to@style{inductor}{L}
5638 \pgfcirc@activate@bipole{l}{europeaninductor}{fullgeneric}{european inductor}
5639 \pgfcirc@activate@bipole{l}{americaninductor}{americaninductor}{american inductor}
5640 \pgfcirc@activate@bipole{l}{cuteinductor}{cuteinductor}{cute inductor}
5641
5642 \def\pgf@circ@vinductor@path#1{
5643 \pgfextra{
5644 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
5645 \def\pgf@temp{european}%
5646 }
5647 \ifx\pgf@temp\pgf@circ@temp%
5648 \pgf@circ@veuropeaninductor@path{#1}%
5649 \else%
5650 \pgfextra{ \def\pgf@temp{cute} }%
5651 \ifx\pgf@temp\pgf@circ@temp%
5652 \pgf@circ@vcuteinductor@path{#1}%
5653 \else%
5654 \pgf@circ@vamericaninductor@path{#1}%
5655 \fi%
5656 \fi%
5657 }
5658 \pgfcirc@path@to@style{l}{vinductor}{variable inductor}{}
5659 \pgfcirc@style@to@style{variable inductor}{vL}
5660 \pgfcirc@activate@bipole{l}{veuropeaninductor}{tfullgeneric}{variable european inductor}
5661 \pgfcirc@activate@bipole{l}{vamericaninductor}{vamericaninductor}{variable american inductor}
5662 \pgfcirc@activate@bipole{l}{vcuteinductor}{vcuteinductor}{variable cute inductor}
5663
5664 \def\pgf@circ@inductivesens@path#1{%
5665 \pgfextra{
5666 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
5667 \def\pgf@temp{european}%
5668 }
5669 \ifx\pgf@temp\pgf@circ@temp%
5670 \pgf@circ@europeaninductivesens@path{#1}%
5671 \else%
5672 \pgfextra{ \def\pgf@temp{cute} }%
5673 \ifx\pgf@temp\pgf@circ@temp%
5674 \pgf@circ@cuteinductivesens@path{#1}%
5675 \else%
5676 \pgf@circ@americaninductivesens@path{#1}%
5677 \fi%
5678 \fi%
5679 }
5680 \pgfcirc@path@to@style{l}{inductivesens}{inductive sensor}{}
5681 \pgfcirc@style@to@style{inductive sensor}{sL}
5682 \pgfcirc@activate@bipole{l}{europeaninductivesens}{sfullgeneric}{european inductive sensor}
5683 \pgfcirc@activate@bipole{l}{americaninductivesens}{samericaninductor}{american inductive sensor}
5684 \pgfcirc@activate@bipole{l}{cuteinductivesens}{scuteinductor}{cute inductive sensor}
5685
5686 \pgfcirc@activate@bipole{l}{cutechoke}{cutechoke}{cute choke}
5687 % %>>>
5688
5689 %%%%%%%%%%%
5690 %% Sources (batteries, independent, dependents and so on
5691 %%%%%%%%%%%
5692
5693 % Definitions for Sources%<<<1
5694
5695 \ctikzset{bipoles/esource/height/.initial=.60}
5696 \ctikzset{bipoles/esource/width/.initial=.60}
5697 \ctikzset{bipoles/pvsource/height/.initial=.60}
5698 \ctikzset{bipoles/pvsource/width/.initial=.60}
5699 \ctikzset{bipoles/pvmodule/height/.initial=.60}
5700 \ctikzset{bipoles/pvmodule/width/.initial=1.20}
5701 \ctikzset{bipoles/isource/height/.initial=.60}
5702 \ctikzset{bipoles/isource/width/.initial=.60}
5703 \ctikzset{bipoles/oosource/height/.initial=.60}
5704 \ctikzset{bipoles/oosource/width/.initial=.60}
5705 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
5706 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
5707 \ctikzset{bipoles/dcisource/angle/.initial=80}
5708 \ctikzset{bipoles/dcisource/height/.initial=.60}
5709 \ctikzset{bipoles/dcisource/width/.initial=.60}
5710 \ctikzset{bipoles/dcvsource/height/.initial=.60}
5711 \ctikzset{bipoles/dcvsource/width/.initial=.60}
5712 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
5713 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
5714 \ctikzset{bipoles/isourceam/height/.initial=.60}
5715 \ctikzset{bipoles/isourceam/width/.initial=.60}
5716 \ctikzset{bipoles/vsource/height/.initial=.60}
5717 \ctikzset{bipoles/vsource/width/.initial=.60}
5718 \ctikzset{bipoles/vsourceam/height/.initial=.60}
5719 \ctikzset{bipoles/vsourceam/width/.initial=.60}
5720 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
5721 \ctikzset{bipoles/isourcesin/height/.initial=.60}
5722 \ctikzset{bipoles/isourcesin/width/.initial=.60}
5723 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
5724 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
5725 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
5726 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
5727 \ctikzset{bipoles/cisource/height/.initial=.7}
5728 \ctikzset{bipoles/cisource/width/.initial=.7}
5729 \ctikzset{bipoles/cisourceam/height/.initial=.7}
5730 \ctikzset{bipoles/cisourceam/width/.initial=.7}
5731 \ctikzset{bipoles/ecsource/height/.initial=.7}
5732 \ctikzset{bipoles/ecsource/width/.initial=.7}
5733 \ctikzset{bipoles/cvsource/height/.initial=.7}
5734 \ctikzset{bipoles/cvsource/width/.initial=.7}
5735 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
5736 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
5737 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
5738 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
5739 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
5740 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
5741 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
5742 \ctikzset{bipoles/battery/height/.initial=.6}
5743 \ctikzset{bipoles/battery/width/.initial=.3}
5744 \ctikzset{bipoles/battery1/height/.initial=.6}
5745 \ctikzset{bipoles/battery1/width/.initial=.3}
5746 \ctikzset{bipoles/battery2/height/.initial=.6}
5747 \ctikzset{bipoles/battery2/width/.initial=.3}
5748 % noise sources
5749 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
5750
5751 % for special symbols in the sources: sin, square, triangle, delta, wye, zig, etc.
5752 \ctikzset{sources/symbol/thickness/.initial={1}}
5753 \ctikzset{csources/symbol/thickness/.initial={1}}
5754 \ctikzset{sources/symbol/rotate/.initial={90}}
5755 \ctikzset{csources/symbol/rotate/.initial={90}}
5756
5757 % % % ootransformer
5758 \ctikzset{bipoles/oosourcetrans/height/.initial=.6}
5759 \ctikzset{bipoles/oosourcetrans/width/.initial=.6}
5760 \ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
5761 \ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
5762 \ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
5763
5764 % % % oootransformer
5765 \ctikzset{bipoles/ooosource/height/.initial=.6}
5766 \ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
5767 \ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
5768 \ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
5769
5770 % % % primary windings
5771 \newif\ifpgf@circ@prim@delta
5772 \newif\ifpgf@circ@prim@wye
5773 \newif\ifpgf@circ@prim@zig
5774 \pgfkeys{tikz/prim/.is choice}
5775 \pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}}
5776 \pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}}
5777 \pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}}
5778
5779 % % % secondary windings
5780 \newif\ifpgf@circ@sec@delta
5781 \newif\ifpgf@circ@sec@wye
5782 \newif\ifpgf@circ@sec@zig
5783 \pgfkeys{tikz/sec/.is choice}
5784 \pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}}
5785 \pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}}
5786 \pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}}
5787
5788 % % % tertiary windings (ooosource)
5789 \newif\ifpgf@circ@tert@delta
5790 \newif\ifpgf@circ@tert@wye
5791 \newif\ifpgf@circ@tert@zig
5792 \pgfkeys{tikz/tert/.is choice}
5793 \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}}
5794 \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}}
5795 \pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}%
5796
5797 %%>>>
5798
5799 %% Nodes definitions for sources%<<<
5800
5801 %% Battery
5802 \pgfcircdeclarebipolescaled{batteries}
5803 {}
5804 {\ctikzvalof{bipoles/battery/height}}
5805 {battery}
5806 {\ctikzvalof{bipoles/battery/height}}
5807 {\ctikzvalof{bipoles/battery/width}}
5808 {
5809 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
5810 \divide \pgf@circ@res@step by 6
5811
5812 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5813
5814 \ifpgf@circ@fixbatteries
5815 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5816 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5817
5818 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5819 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5820
5821 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5823
5824 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5825 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5826 \else
5827 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5828 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5829
5830 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5831 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5832
5833 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5834 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5835
5836 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5837 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5838 \fi
5839 \pgfusepath{draw}
5840 }
5841
5842
5843 %% Battery 1 % poles with equl thickness
5844
5845 \pgfcircdeclarebipolescaled{batteries}
5846 {}
5847 {\ctikzvalof{bipoles/battery1/height}}
5848 {battery1}
5849 {\ctikzvalof{bipoles/battery1/height}}
5850 {\ctikzvalof{bipoles/battery1/width}}
5851 {
5852 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5853 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5854 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5855 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5856 \pgfusepath{draw}
5857
5858 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5859 \ifpgf@circ@fixbatteries
5860 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5861 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5862
5863 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5864 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5865 \else
5866 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5867 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5868
5869 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5870 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5871 \fi
5872 \pgfusepath{draw}
5873 }
5874
5875 %% Battery 2 % negative pole thicker
5876
5877 \pgfcircdeclarebipolescaled{batteries}
5878 {}
5879 {\ctikzvalof{bipoles/battery2/height}}
5880 {battery2}
5881 {\ctikzvalof{bipoles/battery2/height}}
5882 {\ctikzvalof{bipoles/battery2/width}}
5883 {
5884 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5886 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5887 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5888 \pgfusepath{draw}
5889
5890 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5891 \ifpgf@circ@fixbatteries
5892 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5893 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5894 \pgfusepath{draw}
5895 \pgfsetlinewidth{3\pgflinewidth}
5896 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5897 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5898 \else
5899 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5900 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5901 \pgfusepath{draw}
5902 \pgfsetlinewidth{3\pgflinewidth}
5903 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5904 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5905 \fi
5906 \pgfusepath{draw}
5907 }
5908
5909 %%%%%%%%%%%
5910 %% Round and diamond sources
5911 %%%%%%%%%%%
5912
5913 % % % symbol drawing macros (NOT for delta, wye, zig)
5914 \def\pgf@circ@sources@symbol@setup{% called in a pgfscope
5915 \edef\@@@auto{auto}\edef\@@@rotate{\ctikzvalof{\ctikzclass/symbol/rotate}}
5916 \ifx\@@@auto\@@@rotate
5917 \pgfgettransformentries\a\b\temp\temp\temp\temp
5918 \pgfmathsetmacro{\@@@rotate}{-atan2(\b,\a)}
5919 \fi
5920 \pgftransformrotate{\@@@rotate}%
5921 \pgf@circ@set@relative@thickness{symbol/thickness}%
5922 }
5923
5924 %% Independent voltage source
5925 \pgfcircdeclarebipolescaled{sources}
5926 {}
5927 {\ctikzvalof{bipoles/vsource/height}}
5928 {vsource}
5929 {\ctikzvalof{bipoles/vsource/height}}
5930 {\ctikzvalof{bipoles/vsource/width}}
5931 {
5932
5933 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5934
5935 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5936 \pgf@circ@draworfill
5937 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5938 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5939 \pgfusepath{draw}
5940 }
5941
5942 %% To change the internal symbols of the voltage source american style
5943 \ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
5944 \ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
5945 %% Independent voltage source - American style
5946 \pgfcircdeclarebipolescaled{sources}
5947 {}
5948 {\ctikzvalof{bipoles/vsourceam/height}}
5949 {vsourceAM}
5950 {\ctikzvalof{bipoles/vsourceam/height}}
5951 {\ctikzvalof{bipoles/vsourceam/width}}
5952 {
5953
5954 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5955 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5956 \pgf@circ@draworfill
5957 \pgfsetcolor{\ctikzvalof{color}}
5958 \ifpgf@circ@oldvoltagedirection
5959 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5960 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5961 \else
5962 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5963 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5964 \fi
5965 }
5966
5967 %% Independent sinusoidal voltage source
5968 \pgfcircdeclarebipolescaled{sources}
5969 {}
5970 {\ctikzvalof{bipoles/vsourcesin/height}}
5971 {vsourcesin}
5972 {\ctikzvalof{bipoles/vsourcesin/height}}
5973 {\ctikzvalof{bipoles/vsourcesin/width}}
5974 {
5975
5976 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5977 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5978 \pgf@circ@draworfill
5979
5980 \pgf@circ@res@up = .5\pgf@circ@res@up
5981 \pgfscope
5982 \pgf@circ@sources@symbol@setup
5983 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5984 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5985 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5986 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5987 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5988 \pgfusepath{draw}
5989 \endpgfscope
5990 }
5991
5992 % Square Voltage source - contributed by Alistair Kwan
5993 \pgfcircdeclarebipolescaled{sources}
5994 {}
5995 {\ctikzvalof{bipoles/vsourcesquare/height}}
5996 {vsourcesquare}
5997 {\ctikzvalof{bipoles/vsourcesquare/height}}
5998 {\ctikzvalof{bipoles/vsourcesquare/width}}
5999 {
6000 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6001 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6002 \pgf@circ@draworfill
6003 \pgf@circ@res@up = .5\pgf@circ@res@up
6004 \pgfscope
6005 \pgf@circ@sources@symbol@setup
6006 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
6007 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
6008 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
6009 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
6010 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
6011 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
6012 \pgfusepath{draw}
6013 \endpgfscope
6014 }
6015
6016 % Triangle Voltage source - contributed by Ralf Farkas
6017 \pgfcircdeclarebipolescaled{sources}
6018 {}
6019 {\ctikzvalof{bipoles/vsourcetri/height}}
6020 {vsourcetri}
6021 {\ctikzvalof{bipoles/vsourcetri/height}}
6022 {\ctikzvalof{bipoles/vsourcetri/width}}
6023 {
6024
6025 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6026 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6027 \pgf@circ@draworfill
6028
6029 \pgf@circ@res@up = .5\pgf@circ@res@up
6030 \pgfscope
6031 \pgf@circ@sources@symbol@setup
6032 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
6033 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
6034 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
6035 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
6036 \pgfusepath{draw}
6037 \endpgfscope
6038 }
6039
6040 %% PV Source
6041 \pgfcircdeclarebipolescaled{sources}
6042 {}
6043 {\ctikzvalof{bipoles/pvsource/height}}
6044 {pvsource}
6045 {\ctikzvalof{bipoles/pvsource/height}}
6046 {\ctikzvalof{bipoles/pvsource/width}}
6047 {
6048 \pgfpointorigin
6049 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6050 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6051 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6052 \pgf@circ@draworfill
6053
6054 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
6055 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6056 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
6057 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6058 \pgfusepath{draw}
6059
6060 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6061 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
6062 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
6063
6064 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
6065 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
6066 \pgfusepath{draw}
6067
6068 %Arrow Part
6069 \pgfscope
6070 \pgfsetarrowsend{latex}
6071 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
6072 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
6073 \pgfusepath{draw}
6074 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
6075 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
6076 \pgfusepath{draw}
6077 \endpgfscope
6078
6079 }
6080
6081 %% PV Module - contributed by Andre Alves
6082 \pgfcircdeclarebipolescaled{sources}
6083 {}
6084 {\ctikzvalof{bipoles/pvmodule/height}}
6085 {pvmodule}
6086 {\ctikzvalof{bipoles/pvmodule/height}}
6087 {\ctikzvalof{bipoles/pvmodule/width}}
6088 {
6089
6090 % Draw rectangle
6091 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6092 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6093 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6094 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6095 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6096 \pgfpathclose
6097 \pgf@circ@draworfill
6098
6099 % Draw triangle
6100 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6101 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0}}
6102 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6103 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6104 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6105 \pgf@circ@draworfill
6106
6107 \pgfusepath{draw}
6108 }
6109
6110 %% Empty Source
6111 \pgfcircdeclarebipolescaled{sources}
6112 {}
6113 {\ctikzvalof{bipoles/esource/height}}
6114 {esource}
6115 {\ctikzvalof{bipoles/esource/height}}
6116 {\ctikzvalof{bipoles/esource/width}}
6117 {
6118 \pgfpointorigin
6119 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6120 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6121 \pgf@circ@draworfill
6122 }
6123
6124 %% DC Current Source with open shape
6125 \pgfcircdeclarebipolescaled{sources}
6126 {}
6127 {\ctikzvalof{bipoles/dcisource/height}}
6128 {dcisource}
6129 {\ctikzvalof{bipoles/dcisource/height}}
6130 {\ctikzvalof{bipoles/dcisource/width}}
6131 {
6132 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6133 \pgfpathmoveto{\pgfpointorigin}
6134 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6135 \pgf@circ@maybefill
6136 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
6137 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
6138 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
6139 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
6140 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
6141 \pgfusepath{draw}
6142
6143 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6144 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6145 \pgfusepath{draw}
6146 \pgfscope
6147 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6148 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6149 \endpgfscope
6150 }
6151
6152 %% DC-Voltage source
6153 \pgfcircdeclarebipolescaled{sources}
6154 {}
6155 {\ctikzvalof{bipoles/dcvsource/height}}
6156 {dcvsource}
6157 {\ctikzvalof{bipoles/dcvsource/height}}
6158 {\ctikzvalof{bipoles/dcvsource/width}}
6159 {
6160 \pgfpointorigin
6161 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6162 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6163 \pgf@circ@draworfill
6164 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
6165 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
6166 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
6167 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
6168 \pgfusepath{draw}
6169 }
6170
6171 %% Independent current source
6172 \pgfcircdeclarebipolescaled{sources}
6173 {}
6174 {\ctikzvalof{bipoles/isource/height}}
6175 {isource}
6176 {\ctikzvalof{bipoles/isource/height}}
6177 {\ctikzvalof{bipoles/isource/width}}
6178 {
6179 \pgfpointorigin
6180 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6181 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6182 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6183 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6184 \pgf@circ@draworfill
6185 }
6186
6187 %% Independent double oo source
6188 \pgfcircdeclarebipolescaled{sources}
6189 {
6190 \anchor{centerprim}{
6191 \northeast
6192 \pgf@y=0pt\relax
6193 \pgf@x=-\ctikzvalof{bipoles/oosource/circleoffset}\pgf@x
6194 }
6195 \anchor{centersec}{
6196 \northeast
6197 \pgf@y=0pt\relax
6198 \pgf@x=\ctikzvalof{bipoles/oosource/circleoffset}\pgf@x
6199 }
6200 }
6201 {\ctikzvalof{bipoles/oosource/height}}
6202 {oosource}
6203 {\ctikzvalof{bipoles/oosource/height}}
6204 {\ctikzvalof{bipoles/oosource/width}}
6205 {
6206 \pgfpointorigin
6207 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6208 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
6209 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
6210 \pgf@circ@maybefill
6211 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
6212 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right}
6213 \pgf@circ@draworfill
6214 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
6215 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
6216 \pgfusepath{draw}
6217 }
6218
6219 % % % winding symbols
6220 \ctikzset{sources/symbol/delta scale/.initial={1}}
6221 \ctikzset{sources/symbol/wye scale/.initial={1}}
6222 \ctikzset{sources/symbol/zig scale/.initial={1}}
6223 % triangle
6224 \def\pgf@circ@delta#1{
6225 \pgfscope
6226 \pgftransformscale{-.01*\ctikzvalof{\ctikzclass/symbol/delta scale}*\pgf@circ@res@left*#1}
6227 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6228 \pgftransformrotate{-\pgfcircmathresult}
6229
6230 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6231 \pgf@circ@set@relative@thickness{symbol/thickness}
6232 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6233 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6234 \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}}
6235 \pgfpathclose
6236 \pgfusepath{stroke}
6237 \endpgfscope
6238 }
6239
6240 % star
6241 \def\pgf@circ@wye#1{
6242 \pgfscope
6243 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/wye scale}*\pgf@circ@res@left*#1}
6244 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6245 \pgftransformrotate{-\pgfcircmathresult}
6246
6247 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6248 \pgf@circ@set@relative@thickness{symbol/thickness}
6249 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
6250 \pgfpathlineto{\pgfpointorigin}
6251 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}}
6252 \pgfpathmoveto{\pgfpointorigin}
6253 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}}
6254 \pgfusepath{stroke}
6255 \endpgfscope
6256 }
6257
6258 % zigzag
6259 \def\pgf@circ@zig#1{
6260 \pgfscope
6261 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/zig scale}*\pgf@circ@res@left*#1}
6262 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6263 \pgftransformrotate{-\pgfcircmathresult}
6264
6265 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6266 \pgf@circ@set@relative@thickness{symbol/thickness}
6267 \pgfpathmoveto{\pgfpointorigin}
6268 \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}}
6269 \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}}
6270
6271 \pgfpathmoveto{\pgfpointorigin}
6272 \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}}
6273 \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}}
6274
6275 \pgfpathmoveto{\pgfpointorigin}
6276 \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}}
6277 \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}}
6278 \pgfusepath{stroke}
6279 \endpgfscope
6280 }
6281
6282 % % % % round three-phase transformer
6283 \pgfcircdeclarebipolescaled{sources}
6284 {
6285 \anchor{centerprim}{
6286 \northeast
6287 \pgf@y=0pt\relax
6288 \pgf@x=-\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@x
6289 }
6290 \anchor{centersec}{
6291 \northeast
6292 \pgf@y=0pt\relax
6293 \pgf@x=\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@x
6294 }
6295 }
6296 {\ctikzvalof{bipoles/oosourcetrans/height}}
6297 {oosourcetrans}
6298 {\ctikzvalof{bipoles/oosourcetrans/height}}
6299 {\ctikzvalof{bipoles/oosourcetrans/width}}
6300 {
6301
6302 \pgfpointorigin
6303 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6304 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6305 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6306 \pgf@circ@maybefill
6307 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}}
6308 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6309 \pgf@circ@draworfill
6310 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6311 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6312 \pgfusepath{draw}
6313 % % % % draw inner symbols
6314 %%primary winding
6315 \ifpgf@circ@prim@delta
6316 \pgfscope
6317 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6318 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6319 \endpgfscope
6320
6321 \else\ifpgf@circ@prim@wye
6322 \pgfscope
6323 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6324 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6325 \endpgfscope
6326
6327 \else\ifpgf@circ@prim@zig
6328 \pgfscope
6329 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6330 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6331 \endpgfscope
6332 \fi\fi\fi
6333
6334 %%secondary winding
6335 \ifpgf@circ@sec@delta
6336 \pgfscope
6337 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6338 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6339 \endpgfscope
6340
6341 \else\ifpgf@circ@sec@wye
6342 \pgfscope
6343 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6344 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6345 \endpgfscope
6346
6347 \else\ifpgf@circ@sec@zig
6348 \pgfscope
6349 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6350 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6351 \endpgfscope
6352 \fi\fi\fi
6353 }
6354
6355
6356 % % % % ooosource for three phase transformer
6357 \pgfcircdeclarebipolescaled{sources}
6358 {
6359 \anchor{right}{
6360 \northeast
6361 \pgf@y=0pt
6362 \pgfmathparse{
6363 \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
6364 %%the sqrt must be > 0, the circles have to intersect
6365 sqrt(
6366 pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
6367 pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
6368 )
6369 }
6370 \pgf@x=\pgfmathresult\pgf@x
6371 }
6372 \anchor{east}{
6373 \northeast
6374 \pgf@y=0pt
6375 }
6376 \savedanchor{\centerprim}{
6377 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6378 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6379 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
6380 \pgf@y=0pt
6381 \pgf@x=.5\pgf@circ@res@other
6382 }
6383 \anchor{centerprim}{
6384 \centerprim
6385 }
6386 \savedanchor{\centersec}{
6387 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6388 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6389 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
6390 \pgfpointpolar{60}{.5\pgf@circ@res@other}
6391 \pgf@y=-\pgf@y
6392 \pgf@x=-\pgf@x
6393 }
6394 \anchor{centersec}{
6395 \centersec
6396 }
6397 \savedanchor{\centertert}{
6398 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6399 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6400 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
6401 \pgfpointpolar{60}{.5\pgf@circ@res@other}
6402 \pgf@y=\pgf@y
6403 \pgf@x=-\pgf@x
6404 }
6405 \anchor{centertert}{
6406 \centertert
6407 }
6408
6409 % add some anchors in case the are needed :)
6410 \anchor{prim1}{
6411 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6412 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6413 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6414 \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@res@other}}
6415 }
6416 \anchor{prim2}{
6417 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6418 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6419 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6420 \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@res@other}}
6421 }
6422 \anchor{sec1}{
6423 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6424 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6425 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6426 \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@res@other}}
6427 }
6428 \anchor{sec2}{
6429 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6430 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6431 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6432 \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@res@other}}
6433 }
6434 \anchor{sec3}{
6435 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6436 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6437 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6438 \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@res@other}}
6439 }
6440 \anchor{tert1}{
6441 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6442 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6443 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6444 \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@res@other}}
6445 }
6446 \anchor{tert2}{
6447 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6448 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6449 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6450 \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@res@other}}
6451 }
6452 \anchor{tert3}{
6453 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6454 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6455 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6456 \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@res@other}}
6457 }
6458 }
6459 {\ctikzvalof{bipoles/ooosource/height}}
6460 {ooosource}
6461 {\ctikzvalof{bipoles/ooosource/height}}
6462 {\ctikzvalof{bipoles/ooosource/height}}
6463 {
6464 % \pgf@circ@res@other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf@circ@scaled@Rlen
6465
6466 % % filling
6467 % left
6468 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6469 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6470 \pgf@circ@maybefill
6471
6472 % up
6473 \pgfscope
6474 \pgfpointorigin
6475 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6476 \pgf@circ@maybefill
6477 \endpgfscope
6478 % down
6479 \pgfscope
6480 \pgfpointorigin
6481 \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6482 \pgf@circ@draworfill
6483 \endpgfscope
6484
6485 % drawing
6486 % left
6487 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6488 \pgfusepath{draw}
6489
6490 % up
6491 \pgfscope
6492 \pgfpointorigin
6493 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6494 \pgfusepath{draw}
6495 \endpgfscope
6496
6497 % % % draw inner symbols
6498
6499 % % primary winding
6500 \ifpgf@circ@prim@delta
6501 \pgfscope
6502 \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6503 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6504 \endpgfscope
6505
6506 \else\ifpgf@circ@prim@wye
6507 \pgfscope
6508 \pgftransformxshift{.6\pgf@circ@res@left}
6509 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6510 \endpgfscope
6511
6512 \else\ifpgf@circ@prim@zig
6513 \pgfscope
6514 \pgftransformxshift{.6\pgf@circ@res@left}
6515 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6516 \endpgfscope
6517 \fi\fi\fi
6518
6519 % % secondary winding
6520 \ifpgf@circ@sec@delta
6521 \pgfscope
6522 \pgfpointorigin
6523 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6524 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6525 \endpgfscope
6526
6527 \else\ifpgf@circ@sec@wye
6528 \pgfscope
6529 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6530 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6531 \endpgfscope
6532
6533 \else\ifpgf@circ@sec@zig
6534 \pgfscope
6535 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6536 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6537 \endpgfscope
6538 \fi\fi\fi
6539
6540 % % tertiary winding
6541 \ifpgf@circ@tert@delta
6542 \pgfscope
6543 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6544 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6545 \endpgfscope
6546
6547 \else\ifpgf@circ@tert@wye
6548 \pgfscope
6549 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6550 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6551 \endpgfscope
6552
6553 \else\ifpgf@circ@tert@zig
6554 \pgfscope
6555 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6556 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6557 \endpgfscope
6558 \fi\fi\fi
6559 }
6560
6561 %% Independent current source - American
6562 \pgfcircdeclarebipolescaled{sources}
6563 {}
6564 {\ctikzvalof{bipoles/isourceam/height}}
6565 {isourceAM}
6566 {\ctikzvalof{bipoles/isourceam/height}}
6567 {\ctikzvalof{bipoles/isourceam/width}}
6568 {
6569 \pgfpointorigin
6570 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6571 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6572 \pgf@circ@draworfill
6573
6574 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6575 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6576 \pgfusepath{draw}
6577 \pgfscope
6578 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6579 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6580 \endpgfscope
6581 }
6582
6583 %% Independent sinusoidal current source
6584 \pgfcircdeclarebipolescaled{sources}
6585 {}
6586 {\ctikzvalof{bipoles/isource/height}}
6587 {isourcesin}
6588 {\ctikzvalof{bipoles/isource/height}}
6589 {\ctikzvalof{bipoles/isource/width}}
6590 {
6591 \pgfpointorigin
6592 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6593 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6594 \pgf@circ@draworfill
6595
6596 \pgf@circ@res@up = .5\pgf@circ@res@up
6597 \pgfscope
6598 \pgf@circ@sources@symbol@setup
6599 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6600 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6601 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6602 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6603 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6604 \pgfusepath{draw}
6605 \endpgfscope
6606 }
6607
6608 %% Empty controlled source
6609 \pgfcircdeclarebipolescaled{csources}
6610 {}
6611 {\ctikzvalof{bipoles/ecsource/height}}
6612 {ecsource}
6613 {\ctikzvalof{bipoles/ecsource/height}}
6614 {\ctikzvalof{bipoles/ecsource/width}}
6615 {
6616
6617 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6618
6619 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6620 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6621 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6622 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6623 \pgfpathclose
6624 \pgf@circ@draworfill
6625 }
6626
6627 %% Controlled voltage source
6628 \pgfcircdeclarebipolescaled{csources}
6629 {}
6630 {\ctikzvalof{bipoles/cvsource/height}}
6631 {cvsource}
6632 {\ctikzvalof{bipoles/cvsource/height}}
6633 {\ctikzvalof{bipoles/cvsource/width}}
6634 {
6635
6636 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6637
6638 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6639 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6640 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6641 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6642 \pgfpathclose
6643 \pgf@circ@draworfill
6644
6645 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6646 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6647 \pgfusepath{draw}
6648 }
6649
6650 %% To change the internal symbols of the controlled voltage source american style
6651 \ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
6652 \ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}}
6653 %% Controlled voltage source - American
6654 \pgfcircdeclarebipolescaled{csources}
6655 {}
6656 {\ctikzvalof{bipoles/cvsourceam/height}}
6657 {cvsourceAM}
6658 {\ctikzvalof{bipoles/cvsourceam/height}}
6659 {\ctikzvalof{bipoles/cvsourceam/width}}
6660 {
6661 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6662 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6663 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6664 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6665 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6666 \pgfpathclose
6667 \pgf@circ@draworfill
6668
6669 \pgfsetcolor{\ctikzvalof{color}}
6670 \ifpgf@circ@oldvoltagedirection
6671 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6672 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6673 \else
6674 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6675 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6676 \fi
6677 }
6678
6679 %% Controlled sinusoidal voltage source
6680 \pgfcircdeclarebipolescaled{csources}
6681 {}
6682 {\ctikzvalof{bipoles/cvsourcesin/height}}
6683 {cvsourcesin}
6684 {\ctikzvalof{bipoles/cvsourcesin/height}}
6685 {\ctikzvalof{bipoles/cvsourcesin/width}}
6686 {
6687
6688 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6689
6690 \pgfscope
6691 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6692 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6693 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6694 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6695 \pgfpathclose
6696 \pgf@circ@draworfill
6697 \endpgfscope
6698
6699 \pgf@circ@res@up = .5\pgf@circ@res@up
6700 \pgfscope
6701 \pgf@circ@sources@symbol@setup
6702 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6703 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6704 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6705 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6706 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6707 \pgfusepath{draw}
6708 \endpgfscope
6709 }
6710
6711 %% Controlled sinusoidal current source
6712 \pgfcircdeclarebipolescaled{csources}
6713 {}
6714 {\ctikzvalof{bipoles/cvsourcesin/height}}
6715 {cisourcesin}
6716 {\ctikzvalof{bipoles/cvsourcesin/height}}
6717 {\ctikzvalof{bipoles/cvsourcesin/width}}
6718 {
6719
6720 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6721
6722 \pgfscope
6723 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6724 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6725 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6726 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6727 \pgfpathclose
6728 \pgf@circ@draworfill
6729 \endpgfscope
6730
6731 \pgf@circ@res@up = .5\pgf@circ@res@up
6732 \pgfscope
6733 \pgf@circ@sources@symbol@setup
6734 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6735 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6736 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6737 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6738 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6739 \pgfusepath{draw}
6740 \endpgfscope
6741 }
6742
6743 %% Controlled current source
6744 \pgfcircdeclarebipolescaled{csources}
6745 {}
6746 {\ctikzvalof{bipoles/cisource/height}}
6747 {cisource}
6748 {\ctikzvalof{bipoles/cisource/height}}
6749 {\ctikzvalof{bipoles/cisource/width}}
6750 {
6751
6752 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6753
6754 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6755 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6756 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6757 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6758 \pgfpathclose
6759 \pgf@circ@draworfill
6760
6761 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6762 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6763 \pgfusepath{draw}
6764 }
6765
6766 %% Controlled current source - American
6767 \pgfcircdeclarebipolescaled{csources}
6768 {}
6769 {\ctikzvalof{bipoles/cisourceam/height}}
6770 {cisourceAM}
6771 {\ctikzvalof{bipoles/cisourceam/height}}
6772 {\ctikzvalof{bipoles/cisourceam/width}}
6773 {
6774 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6775
6776 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6777 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6779 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6780 \pgfpathclose
6781 \pgf@circ@draworfill
6782 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6783 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6784 \pgfusepath{draw}
6785 \pgfscope
6786 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6787 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6788 \endpgfscope
6789 }
6790
6791 %% Cute Independent voltage source
6792 \pgfcircdeclarebipolescaled{sources}
6793 {}
6794 {\ctikzvalof{bipoles/vsource/height}}
6795 {vsourceC}
6796 {\ctikzvalof{bipoles/vsource/height}}
6797 {\ctikzvalof{bipoles/vsource/width}}
6798 {
6799 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6800 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6801 \pgf@circ@draworfill
6802 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6803 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6804 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6805 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6806 \pgfsetroundcap\pgfusepath{draw}
6807 }
6808
6809 %% Cute Independent current source
6810 \pgfcircdeclarebipolescaled{sources}
6811 {}
6812 {\ctikzvalof{bipoles/isource/height}}
6813 {isourceC}
6814 {\ctikzvalof{bipoles/isource/height}}
6815 {\ctikzvalof{bipoles/isource/width}}
6816 {
6817 \pgfpointorigin
6818 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6819 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6820 \pgf@circ@draworfill
6821 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6822 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6823 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6824 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6825 \pgfsetroundcap\pgfusepath{draw}
6826 }
6827
6828 %% Cute Controlled voltage source
6829 \pgfcircdeclarebipolescaled{csources}
6830 {}
6831 {\ctikzvalof{bipoles/cvsource/height}}
6832 {cvsourceC}
6833 {\ctikzvalof{bipoles/cvsource/height}}
6834 {\ctikzvalof{bipoles/cvsource/width}}
6835 {
6836 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6837 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6838 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6839 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6840 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6841 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6842 \pgf@circ@draworfill
6843 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6844 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6845 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6846 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6847 \pgfsetroundcap\pgfusepath{draw}
6848 }
6849
6850 %% Cute Controlled current source
6851 \pgfcircdeclarebipolescaled{csources}
6852 {}
6853 {\ctikzvalof{bipoles/cisource/height}}
6854 {cisourceC}
6855 {\ctikzvalof{bipoles/cisource/height}}
6856 {\ctikzvalof{bipoles/cisource/width}}
6857 {
6858 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6859 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6860 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6861 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6862 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6863 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6864 \pgf@circ@draworfill
6865 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6866 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6867 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
6868 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
6869 \pgfsetroundcap\pgfusepath{draw}
6870 }
6871
6872 %% Noise voltage source
6873 \pgfcircdeclarebipolescaled{sources}
6874 {}
6875 {\ctikzvalof{bipoles/vsource/height}}
6876 {vsourceN}
6877 {\ctikzvalof{bipoles/vsource/height}}
6878 {\ctikzvalof{bipoles/vsource/width}}
6879 {
6880 \pgfscope
6881 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6882 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6883 %
6884 \pgf@circ@scaled@Rlen=\scaledRlen
6885 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6886 \edef\pgf@noise@temp{dashed}
6887 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6888 \ifx\pgf@noise@temp\pgf@noise@fill
6889 % fillable in this case
6890 \pgf@circ@draworfillandclip
6891 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6892 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6893 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6894 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6895 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6896 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6897 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6898 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6899 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6900 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6901 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6902 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6903 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6904 %
6905 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6906 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6907 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6908 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6909 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6910 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6911 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6912 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6913 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6914 \pgfusepath{draw}
6915 \else
6916 \pgfsetfillcolor{\pgf@noise@fill}
6917 \pgfusepath{draw,fill}
6918 \fi
6919 \endpgfscope
6920 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6921 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6922 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6923 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6924 \pgfsetroundcap\pgfusepath{draw}
6925 }
6926 %% Noise current source
6927
6928 \pgfcircdeclarebipolescaled{sources}
6929 {}
6930 {\ctikzvalof{bipoles/isource/height}}
6931 {isourceN}
6932 {\ctikzvalof{bipoles/isource/height}}
6933 {\ctikzvalof{bipoles/isource/width}}
6934 {
6935 \pgfpointorigin
6936 \pgfscope
6937 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6938 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6939 %
6940 \pgf@circ@scaled@Rlen=\scaledRlen
6941 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6942 \edef\pgf@noise@temp{dashed}
6943 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6944 \ifx\pgf@noise@temp\pgf@noise@fill
6945 % fillable in this case
6946 \pgf@circ@draworfillandclip
6947 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6948 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6949 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6950 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6951 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6952 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6953 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6954 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6955 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6956 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6957 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6958 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6959 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6960 %
6961 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6962 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6963 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6964 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6965 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6966 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6967 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6968 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6969 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6970 \pgfusepath{draw}
6971 \else
6972 \pgfsetfillcolor{\pgf@noise@fill}
6973 \pgfusepath{draw,fill}
6974 \fi
6975 \endpgfscope
6976 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6977 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6978 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6979 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6980 \pgfsetroundcap\pgfusepath{draw}
6981 }
6982 % %>>>
6983
6984 %% Paths definitions for Sources%<<<
6985
6986 %% Batteries
6987
6988 \pgfcirc@activate@bipole@simple@opt{v}{battery}{\circuitikzbasekey/bipole/is voltage=true,
6989 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6990 \pgfcirc@activate@bipole@opt{v}{batteryone}{battery1}{battery1}{\circuitikzbasekey/bipole/is voltage=true,
6991 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6992 \pgfcirc@activate@bipole@opt{v}{batterytwo}{battery2}{battery2}{\circuitikzbasekey/bipole/is voltage=true,
6993 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6994 %% Sources: voltage
6995
6996 \pgfcirc@activate@bipole@opt{v}{vsource}{vsource}{european voltage source}{%
6997 \circuitikzbasekey/bipole/is voltage=true,
6998 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6999 \pgfcirc@activate@bipole@opt{v}{vsourceam}{vsourceAM}{american voltage source}{%
7000 \circuitikzbasekey/bipole/is voltage=true,
7001 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false}
7002 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi voltage source}{voltage source}
7003 \pgfcirc@style@to@style{voltage source}{vsource}
7004 \pgfcirc@style@to@style{voltage source}{V}
7005
7006 \pgfcirc@activate@bipole@opt{v}{cvsource}{cvsource}{european controlled voltage source}{%
7007 \circuitikzbasekey/bipole/is voltage=true,
7008 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7009 \pgfcirc@activate@bipole@opt{v}{cvsourceam}{cvsourceAM}{american controlled voltage source}{%
7010 \circuitikzbasekey/bipole/is voltage=true,
7011 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false}
7012 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source}{controlled voltage source}
7013 \pgfcirc@style@to@style{controlled voltage source}{cvsource}
7014 \pgfcirc@style@to@style{controlled voltage source}{controlled vsource}
7015 \pgfcirc@style@to@style{controlled voltage source}{cV}
7016
7017 \pgfcirc@activate@bipole@simple@opt{v}{esource}{%
7018 \circuitikzbasekey/bipole/is voltage=true,
7019 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7020
7021 \pgfcirc@activate@bipole@opt{v}{ecsource}{ecsource}{empty controlled source}{%
7022 \circuitikzbasekey/bipole/is voltage=true,
7023 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7024 \pgfcirc@style@to@style{empty controlled source}{ecsource}
7025
7026 \pgfcirc@activate@bipole@opt{v}{vsourcesin}{vsourcesin}{sinusoidal voltage source}{%
7027 \circuitikzbasekey/bipole/is voltage=true,
7028 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7029 \pgfcirc@style@to@style{sinusoidal voltage source}{vsourcesin}
7030 \pgfcirc@style@to@style{sinusoidal voltage source}{sV}
7031
7032 \pgfcirc@activate@bipole@opt{v}{cvsourcesin}{cvsourcesin}{controlled sinusoidal voltage source}{%
7033 \circuitikzbasekey/bipole/is voltage=true,
7034 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7035 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{cvsourcesin}
7036 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{controlled vsourcesin}
7037 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{csV}
7038
7039 \pgfcirc@activate@bipole@opt{v}{vsourcesquare}{vsourcesquare}{square voltage source}{%
7040 \circuitikzbasekey/bipole/is voltage=true,
7041 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7042 \pgfcirc@style@to@style{square voltage source}{vsourcesquare}
7043 \pgfcirc@style@to@style{square voltage source}{sqV}
7044
7045 \pgfcirc@activate@bipole@opt{v}{vsourcetri}{vsourcetri}{triangle voltage source}{%
7046 \circuitikzbasekey/bipole/is voltage=true,
7047 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7048 \pgfcirc@style@to@style{triangle voltage source}{vsourcetri}
7049 \pgfcirc@style@to@style{triangle voltage source}{tV}
7050
7051 \pgfcirc@activate@bipole@simple@opt{v}{pvsource}{%
7052 \circuitikzbasekey/bipole/is voltage=true,
7053 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7054
7055 \pgfcirc@activate@bipole@simple@opt{v}{pvmodule}{%
7056 \circuitikzbasekey/bipole/is voltage=true,
7057 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7058
7059 \pgfcirc@activate@bipole@simple@opt{v}{dcvsource}{%
7060 \circuitikzbasekey/bipole/is voltage=true,
7061 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7062
7063 \pgfcirc@activate@bipole@opt{v}{oosource}{oosource}{voosource}{%
7064 \circuitikzbasekey/bipole/is voltage=true,
7065 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7066
7067 \pgfcirc@activate@bipole@simple@opt{v}{ooosource}{%
7068 \circuitikzbasekey/bipole/is voltage=true,
7069 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7070
7071 \pgfcirc@activate@bipole@simple@opt{v}{oosourcetrans}{%
7072 \circuitikzbasekey/bipole/is voltage=true,
7073 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7074
7075 \pgfcirc@activate@bipole@opt{v}{vsourceC}{vsourceC}{cute european voltage source}{%
7076 \circuitikzbasekey/bipole/is voltage=true,
7077 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7078 \pgfcirc@style@to@style{cute european voltage source}{vsourceC}
7079 \pgfcirc@style@to@style{cute european voltage source}{ceV}
7080
7081 \pgfcirc@activate@bipole@opt{v}{cvsourceC}{cvsourceC}{cute european controlled voltage source}{%
7082 \circuitikzbasekey/bipole/is voltage=true,
7083 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7084 \pgfcirc@style@to@style{cute european controlled voltage source}{cvsourceC}
7085 \pgfcirc@style@to@style{cute european controlled voltage source}{cceV}
7086
7087 \pgfcirc@activate@bipole@opt{v}{vsourceN}{vsourceN}{noise voltage source}{%
7088 \circuitikzbasekey/bipole/is voltage=true,
7089 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
7090 \pgfcirc@style@to@style{noise voltage source}{vsourceN}
7091 \pgfcirc@style@to@style{noise voltage source}{nV}
7092
7093 %% Sources: current
7094
7095 \pgfcirc@activate@bipole@opt{i}{isource}{isource}{european current source}{%
7096 \circuitikzbasekey/bipole/is current=true}
7097 \pgfcirc@activate@bipole@opt{i}{isourceam}{isourceAM}{american current source}{%
7098 \circuitikzbasekey/bipole/is current=true}
7099 \pgfcirc@style@to@style{\ifpgf@circuit@europeancurrent european \else american \fi current source}{current source}
7100 \pgfcirc@style@to@style{current source}{isource}
7101 \pgfcirc@style@to@style{current source}{I}
7102
7103 \pgfcirc@activate@bipole@opt{i}{cisource}{cisource}{european controlled current source}{%
7104 \circuitikzbasekey/bipole/is current=true}
7105 \pgfcirc@activate@bipole@opt{i}{cisourceam}{cisourceAM}{american controlled current source}{%
7106 \circuitikzbasekey/bipole/is current=true}
7107 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled current source}{controlled current source}
7108 \pgfcirc@style@to@style{controlled current source}{cisource}
7109 \pgfcirc@style@to@style{controlled current source}{controlled isource}
7110 \pgfcirc@style@to@style{controlled current source}{cI}
7111
7112 \pgfcirc@activate@bipole@opt{i}{isourcesin}{isourcesin}{sinusoidal current source}{%
7113 \circuitikzbasekey/bipole/is current=true}
7114 \pgfcirc@style@to@style{sinusoidal current source}{isourcesin}
7115 \pgfcirc@style@to@style{sinusoidal current source}{sI}
7116
7117 \pgfcirc@activate@bipole@opt{i}{cisourcesin}{cisourcesin}{controlled sinusoidal current source}{%
7118 \circuitikzbasekey/bipole/is current=true}
7119 \pgfcirc@style@to@style{controlled sinusoidal current source}{cisourcesin}
7120 \pgfcirc@style@to@style{controlled sinusoidal current source}{controlled isourcesin}
7121 \pgfcirc@style@to@style{controlled sinusoidal current source}{csI}
7122
7123 \pgfcirc@activate@bipole@simple@opt{i}{dcisource}{%
7124 \circuitikzbasekey/bipole/is current=true}
7125
7126 \pgfcirc@activate@bipole@opt{i}{oosource}{oosource}{ioosource}{%
7127 \circuitikzbasekey/bipole/is current=true}
7128
7129 \pgfcirc@activate@bipole@opt{i}{isourceC}{isourceC}{cute european current source}{%
7130 \circuitikzbasekey/bipole/is current=true}
7131 \pgfcirc@style@to@style{cute european current source}{isourceC}
7132 \pgfcirc@style@to@style{cute european current source}{ceI}
7133
7134 \pgfcirc@activate@bipole@opt{i}{cisourceC}{cisourceC}{cute european controlled current source}{%
7135 \circuitikzbasekey/bipole/is current=true}
7136 \pgfcirc@style@to@style{cute european controlled current source}{cisourceC}
7137 \pgfcirc@style@to@style{cute european controlled current source}{cceI}
7138
7139 \pgfcirc@activate@bipole@opt{i}{isourceN}{isourceN}{noise current source}{%
7140 \circuitikzbasekey/bipole/is current=true}
7141 \pgfcirc@style@to@style{noise current source}{isourceN}
7142 \pgfcirc@style@to@style{noise current source}{nI}
7143
7144 % build alias with voltage and current directions (legacy)
7145
7146 \def\pgf@temp#1{
7147 \pgfcirc@style@to@style@label{voltage source}{V#1}{v#1}
7148 \pgfcirc@style@to@style@label{controlled voltage source}{cV#1}{v#1}
7149 \pgfcirc@style@to@style@label{sinusoidal voltage source}{sV#1}{v#1}
7150 \pgfcirc@style@to@style@label{controlled sinusoidal voltage source}{csV#1}{v#1}
7151 }
7152 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
7153 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
7154 \def\pgf@temp#1{
7155 \pgfcirc@style@to@style@label{current source}{I#1}{i#1}
7156 \pgfcirc@style@to@style@label{controlled current source}{cI#1}{i#1}
7157 \pgfcirc@style@to@style@label{sinusoidal current source}{sI#1}{i#1}
7158 \pgfcirc@style@to@style@label{controlled sinusoidal current source}{csI#1}{i#1}
7159 }
7160 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
7161 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
7162 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
7163 % %>>>
7164
7165 %%%%%%%%%%%%%%
7166 %% Diodes
7167 %%%%%%%%%%%%%%
7168
7169 % Definitions for diodes%<<<1
7170
7171 \ctikzset{bipoles/diode/height/.initial=.50}
7172 \ctikzset{bipoles/diode/width/.initial=.40}
7173 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
7174 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
7175 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
7176 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
7177 \ctikzset{bipoles/varcap/height/.initial=.50}
7178 \ctikzset{bipoles/varcap/width/.initial=.45}
7179
7180 \ctikzset{tripoles/thyristor/height/.initial=1.10}
7181 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
7182 \ctikzset{tripoles/thyristor/width/.initial=1.0}
7183 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
7184 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
7185 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
7186 \ctikzset{tripoles/thyristor/gate height/.initial=0.0} % legacy 0
7187 \ctikzset{tripoles/thyristor/gate kink/.initial=1.0} % legacy 1.0
7188 \ctikzset{tripoles/thyristor/gto space up/.initial=0.5} % legacy 0.5
7189 \ctikzset{tripoles/thyristor/gto space down/.initial=0.0} % legacy 0.0
7190 \ctikzset{tripoles/thyristor/gto bar width/.initial=0.2} % legacy 0.2
7191
7192 \ctikzset{tripoles/triac/height/.initial=1.1}
7193 \ctikzset{tripoles/triac/width/.initial=1}
7194 \ctikzset{tripoles/triac/diode width left/.initial=.3}
7195 \ctikzset{tripoles/triac/diode width right/.initial=.3}
7196 \ctikzset{tripoles/triac/gate kink/.initial=1}
7197
7198 \ctikzset{thyristor style/.is choice}
7199 \ctikzset{thyristor style/legacy/.code={%
7200 \ctikzset{tripoles/thyristor/height=1.1}%
7201 \ctikzset{tripoles/thyristor/height 2=.5}%
7202 \ctikzset{tripoles/thyristor/width=1.0}%
7203 \ctikzset{tripoles/thyristor/diode height=.5}%
7204 \ctikzset{tripoles/thyristor/diode width left=.4}%
7205 \ctikzset{tripoles/thyristor/diode width right=.3}%
7206 \ctikzset{tripoles/thyristor/gate height=0.0}%
7207 \ctikzset{tripoles/thyristor/gate kink=1.0}%
7208 \ctikzset{tripoles/thyristor/gto space up=0.5}%
7209 \ctikzset{tripoles/thyristor/gto space down=0.0}%
7210 \ctikzset{tripoles/thyristor/gto bar width=0.2}%
7211 \ctikzset{tripoles/triac/gate kink=1}%
7212 }}
7213 \ctikzset{thyristor style/compact/.code={%
7214 \ctikzset{tripoles/thyristor/height=0.8}% legacy 1.1
7215 \ctikzset{tripoles/thyristor/height 2=.5}%
7216 \ctikzset{tripoles/thyristor/width=1.0}%
7217 \ctikzset{tripoles/thyristor/diode height=.5}%
7218 \ctikzset{tripoles/thyristor/diode width left=.4}%
7219 \ctikzset{tripoles/thyristor/diode width right=.4}%legacy 0.3
7220 \ctikzset{tripoles/thyristor/gate height=0.5}% legacy 0
7221 \ctikzset{tripoles/thyristor/gate kink=0.7}% legacy 1.0
7222 \ctikzset{tripoles/thyristor/gto space up=0.25}% legacy 0.5
7223 \ctikzset{tripoles/thyristor/gto space down=0.25}% legacy 0.0
7224 \ctikzset{tripoles/thyristor/gto bar width=0.2}%
7225 \ctikzset{tripoles/triac/gate kink=.7}%
7226 }}
7227
7228 %
7229 % Flipping arrows in LED and photodiodes
7230 %
7231 \newif\ifpgf@led@fliparrows
7232 \newif\ifpgf@pd@fliparrows
7233 \pgf@led@fliparrowsfalse
7234 \pgf@pd@fliparrowsfalse
7235 %
7236 % by default the arrows start (LED) and go (PD) to the anode.
7237 %
7238 \ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse}
7239 \ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse}
7240 %
7241 % but they can start form the cathode (LED) or go to it (PD)
7242 %
7243 \ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue}
7244 \ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue}
7245
7246 \newif\ifpgf@circuit@strokediode
7247 \newif\ifpgf@circuit@fulldiode
7248 \pgf@circuit@strokediodefalse
7249 \pgf@circuit@fulldiodefalse
7250
7251 \ctikzset{diode/.is choice}
7252 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
7253 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue }
7254 \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}
7255
7256 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
7257 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
7258 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
7259
7260 %%>>>
7261
7262 %% Node components for diodes %<<<1
7263
7264 %% Black generic diode
7265 \pgfcircdeclarebipolescaled{diodes}
7266 {}
7267 {\ctikzvalof{bipoles/diode/height}}
7268 {fulldiode}
7269 {\ctikzvalof{bipoles/diode/height}}
7270 {\ctikzvalof{bipoles/diode/width}}
7271 {
7272
7273 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7274
7275 \pgfscope
7276 \pgftransformxshift{\pgf@circ@res@left}
7277 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7278 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7279 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7280 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7281 \pgfusepath{draw,fill}
7282 \endpgfscope
7283 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7284 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7285 \pgfusepath{draw}
7286 }
7287
7288 %% Black Zener diode
7289 \pgfcircdeclarebipolescaled{diodes}
7290 {}
7291 {\ctikzvalof{bipoles/diode/height}}
7292 {fullzdiode}
7293 {\ctikzvalof{bipoles/diode/height}}
7294 {\ctikzvalof{bipoles/diode/width}}
7295 {
7296
7297 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7298
7299 \pgfscope
7300 \pgftransformxshift{\pgf@circ@res@left}
7301 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7302 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7303 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7304 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7305 \pgfusepath{draw,fill}
7306 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7307 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7308 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7309 \pgfusepath{draw}
7310 \endpgfscope
7311 }
7312
7313 %% Black alternative zigzag Zener diode
7314 \pgfcircdeclarebipolescaled{diodes}
7315 {% fix the anchor border
7316 \pgfcirc@border@extend@updown{1.3}{1.3}
7317 }
7318 {\ctikzvalof{bipoles/diode/height}}
7319 {fullzzdiode}
7320 {\ctikzvalof{bipoles/diode/height}}
7321 {\ctikzvalof{bipoles/diode/width}}
7322 {
7323
7324 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7325
7326 \pgfscope
7327 \pgftransformxshift{\pgf@circ@res@left}
7328 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7329 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7330 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7331 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7332 \pgfusepath{draw,fill}
7333 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
7334 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7335 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7336 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
7337 \pgfusepath{draw}
7338 \endpgfscope
7339 }
7340
7341 %% Black Schottky diode
7342 \pgfcircdeclarebipolescaled{diodes}
7343 {}
7344 {\ctikzvalof{bipoles/diode/height}}
7345 {fullsdiode}
7346 {\ctikzvalof{bipoles/diode/height}}
7347 {\ctikzvalof{bipoles/diode/width}}
7348 {
7349
7350 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7351 \pgfscope
7352 \pgftransformxshift{\pgf@circ@res@left}
7353 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7354 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7355 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7356 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7357 \pgfusepath{draw,fill}
7358
7359 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
7360 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7361 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7362 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7363 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7364 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7365 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
7366 \pgfusepath{draw}
7367 \endpgfscope
7368
7369 }
7370
7371 %% Black tunnel diode
7372 \pgfcircdeclarebipolescaled{diodes}
7373 {}
7374 {\ctikzvalof{bipoles/diode/height}}
7375 {fulltdiode}
7376 {\ctikzvalof{bipoles/diode/height}}
7377 {\ctikzvalof{bipoles/diode/width}}
7378 {
7379
7380 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7381 \pgfscope
7382 \pgftransformxshift{\pgf@circ@res@left}
7383 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7384 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7385 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7386 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7387 \pgfusepath{draw,fill}
7388
7389 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7390 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7391 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7392 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7393 \pgfusepath{draw}
7394 \endpgfscope
7395 }
7396
7397 %
7398 % draw LED arrows
7399 %
7400 \def\pgf@circ@draw@ledarrows{%
7401 \pgfsetlinewidth{\pgfstartlinewidth}
7402 \pgfsetarrowsend{latexslim}
7403 \ifpgf@led@fliparrows
7404 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
7405 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7406 \pgfusepath{draw}
7407 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
7408 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
7409 \pgfusepath{draw}
7410 \else
7411 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
7412 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
7413 \pgfusepath{draw}
7414 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
7415 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7416 \pgfusepath{draw}
7417 \fi
7418 }
7419 %
7420 % ---and photodiode arrows
7421 %
7422 \def\pgf@circ@draw@pdarrows{%
7423 \pgfsetlinewidth{\pgfstartlinewidth}
7424 \pgfsetarrowsstart{latexslim}
7425 \ifpgf@pd@fliparrows
7426 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
7427 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7428 \pgfusepath{draw}
7429 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
7430 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
7431 \pgfusepath{draw}
7432 \else
7433 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
7434 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
7435 \pgfusepath{draw}
7436 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
7437 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7438 \pgfusepath{draw}
7439 \fi
7440 }
7441 %
7442 % --and laser diode arrows - contributed by Andre Alves
7443 %
7444 \def\pgf@circ@draw@laserarrows{%
7445 \pgfsetlinewidth{\pgfstartlinewidth}
7446 \pgfsetarrowsend{latexslim}
7447 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{1.1\pgf@circ@res@up}}
7448 \pgfpathlineto{\pgfpoint{-0.4\pgf@circ@res@right}{2.1\pgf@circ@res@up}}
7449 \pgfusepath{draw}
7450 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{1.1\pgf@circ@res@up}}
7451 \pgfpathlineto{\pgfpoint{0.2\pgf@circ@res@right}{2.1\pgf@circ@res@up}}
7452 \pgfusepath{draw}
7453 }
7454 %% Black light emitting diode
7455 \pgfcircdeclarebipolescaled{diodes}
7456 {% fix the anchor border
7457 \pgfcirc@border@extend@updown{1.8}{1}
7458 }
7459 {\ctikzvalof{bipoles/diode/height}}
7460 {fulllediode}
7461 {\ctikzvalof{bipoles/diode/height}}
7462 {\ctikzvalof{bipoles/diode/width}}
7463 {
7464
7465 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7466 \pgfscope
7467 \pgftransformxshift{\pgf@circ@res@left}
7468 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7469 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7470 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7471 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7472 \pgfusepath{draw,fill}
7473 \endpgfscope
7474 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7475 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7476 \pgfusepath{draw}
7477
7478 \pgf@circ@draw@ledarrows
7479 }
7480
7481 %% Black laser diode - contributed by Andre Alves
7482 \pgfcircdeclarebipolescaled{diodes}
7483 {% fix the anchor border
7484 \pgfcirc@border@extend@updown{1.8}{1}
7485 }
7486 {\ctikzvalof{bipoles/diode/height}}
7487 {fulllaserdiode}
7488 {\ctikzvalof{bipoles/diode/height}}
7489 {\ctikzvalof{bipoles/diode/width}}
7490 {
7491
7492 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7493 \pgfscope
7494 \pgftransformxshift{\pgf@circ@res@left}
7495 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7496 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7497 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7498 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7499 \pgfusepath{draw,fill}
7500 \endpgfscope
7501 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7503 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@up}}
7504 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@down}}
7505 \pgfusepath{draw}
7506
7507 \pgf@circ@draw@laserarrows
7508 }
7509
7510 %% Black photodiode
7511 \pgfcircdeclarebipolescaled{diodes}
7512 {% fix the anchor border
7513 \pgfcirc@border@extend@updown{1.8}{1}
7514 }
7515 {\ctikzvalof{bipoles/diode/height}}
7516 {fullpdiode}
7517 {\ctikzvalof{bipoles/diode/height}}
7518 {\ctikzvalof{bipoles/diode/width}}
7519 {
7520
7521 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7522 \pgfscope
7523 \pgftransformxshift{\pgf@circ@res@left}
7524 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7525 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7526 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7527 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7528 \pgfusepath{draw,fill}
7529 \endpgfscope
7530 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7531 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7532 \pgfusepath{draw}
7533
7534 \pgf@circ@draw@pdarrows
7535 }
7536
7537 %% Black varcap
7538 \pgfcircdeclarebipolescaled{diodes}
7539 {}
7540 {\ctikzvalof{bipoles/varcap/height}}
7541 {fullvarcap}
7542 {\ctikzvalof{bipoles/varcap/height}}
7543 {\ctikzvalof{bipoles/varcap/width}}
7544 {
7545 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7546 \pgfsetlinewidth{\pgf@circ@res@temp}
7547 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7548 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7549 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7550 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7551 \pgfusepath{draw,fill}
7552 %
7553 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7554 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7555 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7556 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7557 \pgfusepath{draw}
7558 }
7559
7560 %% Code for the diode triangle
7561 \def\pgf@circ@basicdiodeshape{
7562 % \pgfscope
7563 \pgftransformxshift{\pgf@circ@res@left}
7564 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7565 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7566 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7567 \pgfpathclose
7568 \pgf@circ@draworfill
7569 \pgfscope
7570 % to allow filling, we need to draw explicitly the stroke here.
7571 \pgfsetlinewidth{\pgfstartlinewidth}
7572 \ifpgf@circuit@bipole@strokedsymbol
7573 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7574 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
7575 \pgfusepath{draw}
7576 \fi
7577 \endpgfscope
7578 % \endpgfscope
7579 }
7580
7581 %% Empty generic diode
7582 \pgfcircdeclarebipolescaled{diodes}
7583 {}
7584 {\ctikzvalof{bipoles/diode/height}}
7585 {emptydiode}
7586 {\ctikzvalof{bipoles/diode/height}}
7587 {\ctikzvalof{bipoles/diode/width}}
7588 {
7589 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7590 \pgfscope
7591 \pgf@circ@basicdiodeshape
7592 \endpgfscope
7593 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7594 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7595 \pgfusepath{draw}
7596 }
7597
7598 %% Empty Zener diode
7599 \pgfcircdeclarebipolescaled{diodes}
7600 {}
7601 {\ctikzvalof{bipoles/diode/height}}
7602 {emptyzdiode}
7603 {\ctikzvalof{bipoles/diode/height}}
7604 {\ctikzvalof{bipoles/diode/width}}
7605 {
7606
7607 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7608
7609 \pgfscope
7610 \pgf@circ@basicdiodeshape
7611 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7612 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7613 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7614 \pgfusepath{draw}
7615 \endpgfscope
7616 }
7617
7618 %% Empty alternative zigzag Zener diode
7619 \pgfcircdeclarebipolescaled{diodes}
7620 {% fix the anchor border
7621 \pgfcirc@border@extend@updown{1.3}{1.3}
7622 }
7623 {\ctikzvalof{bipoles/diode/height}}
7624 {emptyzzdiode}
7625 {\ctikzvalof{bipoles/diode/height}}
7626 {\ctikzvalof{bipoles/diode/width}}
7627 {
7628
7629 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7630
7631 \pgfscope
7632 \pgf@circ@basicdiodeshape
7633 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
7634 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7635 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7636 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
7637 \pgfusepath{draw}
7638 \endpgfscope
7639 }
7640 %% Empty Schottky diode
7641 \pgfcircdeclarebipolescaled{diodes}
7642 {}
7643 {\ctikzvalof{bipoles/diode/height}}
7644 {emptysdiode}
7645 {\ctikzvalof{bipoles/diode/height}}
7646 {\ctikzvalof{bipoles/diode/width}}
7647 {
7648
7649 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7650 \pgfscope
7651 \pgf@circ@basicdiodeshape
7652 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
7653 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7654 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7655 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7656 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7657 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7658 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
7659 \pgfusepath{draw}
7660 \endpgfscope
7661
7662 }
7663
7664 %% Empty tunnel diode
7665 \pgfcircdeclarebipolescaled{diodes}
7666 {}
7667 {\ctikzvalof{bipoles/diode/height}}
7668 {emptytdiode}
7669 {\ctikzvalof{bipoles/diode/height}}
7670 {\ctikzvalof{bipoles/diode/width}}
7671 {
7672
7673 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7674 \pgfscope
7675 \pgf@circ@basicdiodeshape
7676 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7677 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7678 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7679 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7680 \pgfusepath{draw}
7681 \endpgfscope
7682 }
7683
7684 %% Empty light emitting diode
7685 \pgfcircdeclarebipolescaled{diodes}
7686 {% fix the anchor border
7687 \pgfcirc@border@extend@updown{1.8}{1}
7688 }
7689 {\ctikzvalof{bipoles/diode/height}}
7690 {emptylediode}
7691 {\ctikzvalof{bipoles/diode/height}}
7692 {\ctikzvalof{bipoles/diode/width}}
7693 {
7694
7695 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7696 \pgfscope
7697 \pgf@circ@basicdiodeshape
7698 \endpgfscope
7699 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7700 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7701 \pgfusepath{draw}
7702
7703 \pgf@circ@draw@ledarrows
7704 }
7705
7706 %% Empty laser diode - contributed by Andre Alves
7707 \pgfcircdeclarebipolescaled{diodes}
7708 {% fix the anchor border
7709 \pgfcirc@border@extend@updown{1.8}{1}
7710 }
7711 {\ctikzvalof{bipoles/diode/height}}
7712 {emptylaserdiode}
7713 {\ctikzvalof{bipoles/diode/height}}
7714 {\ctikzvalof{bipoles/diode/width}}
7715 {
7716
7717 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7718 \pgfscope
7719 \pgf@circ@basicdiodeshape
7720 \endpgfscope
7721 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7722 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7723 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@up}}
7724 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@down}}
7725 \pgfusepath{draw}
7726
7727 \pgf@circ@draw@laserarrows
7728 }
7729
7730 %% Empty photodiode
7731 \pgfcircdeclarebipolescaled{diodes}
7732 {% fix the anchor border
7733 \pgfcirc@border@extend@updown{1.8}{1}
7734 }
7735 {\ctikzvalof{bipoles/diode/height}}
7736 {emptypdiode}
7737 {\ctikzvalof{bipoles/diode/height}}
7738 {\ctikzvalof{bipoles/diode/width}}
7739 {
7740
7741 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7742 \pgfscope
7743 \pgf@circ@basicdiodeshape
7744 \endpgfscope
7745 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7746 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7747 \pgfusepath{draw}
7748
7749 \pgf@circ@draw@pdarrows
7750 }
7751
7752 %% Empty varcap
7753 \pgfcircdeclarebipolescaled{diodes}
7754 {}
7755 {\ctikzvalof{bipoles/varcap/height}}
7756 {emptyvarcap}
7757 {\ctikzvalof{bipoles/varcap/height}}
7758 {\ctikzvalof{bipoles/varcap/width}}
7759 {
7760 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7761 \pgfsetlinewidth{\pgf@circ@res@temp}
7762 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7763 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7764 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7765 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7766 \pgfpathclose
7767 \pgf@circ@draworfill
7768 \pgfscope
7769 % to allow filling, we need to draw explicitily the stroke here.
7770 \pgfsetlinewidth{\pgfstartlinewidth}
7771 \ifpgf@circuit@bipole@strokedsymbol
7772 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7773 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7774 \pgfusepath{draw}
7775 \fi
7776 \endpgfscope
7777 %
7778 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7779 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7780 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7781 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7782 \pgfusepath{draw}
7783 }
7784
7785 %% Empty bidirectionaldiode
7786 \pgfcircdeclarebipolescaled{diodes}
7787 {}
7788 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7789 {emptybidirectionaldiode}
7790 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7791 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7792 {
7793
7794 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7795
7796 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7797 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7798
7799 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7800 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7801 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7802 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7803
7804 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7805 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7807 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7808
7809 \pgf@circ@draworfill
7810
7811 \pgfsetlinewidth{\pgfstartlinewidth}
7812
7813 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7814 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7815
7816 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7817 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7818
7819 \pgfusepath{draw}
7820 }
7821
7822 %% Full bidirectionaldiode
7823 \pgfcircdeclarebipolescaled{diodes}
7824 {}
7825 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7826 {fullbidirectionaldiode}
7827 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7828 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7829 {
7830
7831 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7832
7833 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7834 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7835
7836 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7837 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7838 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7839 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7840
7841 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7842 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7843 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7844 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7845
7846 \pgfusepath{draw, fill}
7847
7848 \pgfsetlinewidth{\pgfstartlinewidth}
7849
7850 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7851 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7852
7853 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7854 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7855
7856 \pgfusepath{draw}
7857 }
7858
7859 %%% Thyristors in general
7860
7861
7862 \def\pgfcircdeclarethyristor#1#2#3#4{%name, fill (0-> black; 1-empty), gate position (1: catode, -1: anode), extra code
7863 \pgfcircdeclarebipolescaled{diodes}
7864 {
7865 \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/thyristor/gate kink}}}
7866 \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x}
7867 \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x}
7868 \anchor{anode}{\southwest\pgf@y=0cm}
7869 \anchor{cathode}{\northeast\pgf@y=0cm }
7870 }
7871 {\ctikzvalof{tripoles/thyristor/height 2}}
7872 {#1}
7873 {\ctikzvalof{tripoles/thyristor/height}}
7874 {\ctikzvalof{tripoles/thyristor/width}}
7875 {
7876 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7877 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7878
7879 \pgfscope
7880 % draw the thick parts here (shifted horizontally)
7881 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7882 % draw the basic triangle
7883 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7884
7885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
7886 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
7887 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7888 \pgfpathclose
7889 \ifnum#2=0\relax
7890 \pgfusepath{draw,fill}
7891 \else
7892 \pgf@circ@draworfill
7893 \fi
7894 % draw the vertical bar
7895 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7896 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7897 \pgfusepath{draw}
7898 \endpgfscope
7899
7900 % back to normal linewidth
7901 % stroke if needed
7902 \ifpgf@circuit@bipole@strokedsymbol
7903 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7904 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7905 \pgfusepath{draw}
7906 \fi
7907
7908 % draw the gate thing;
7909 #4
7910
7911 % draw the leads in/out
7912 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7913 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7914
7915 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7916 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7917
7918 \pgfusepath{draw}
7919 }
7920 }
7921
7922 \def\pgfcirc@thyristor@simplegate{%
7923 \pgfpathmoveto{\pgfpoint
7924 {\pgf@circ@res@step}
7925 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7926 }
7927 \pgfpathlineto{\pgfpoint
7928 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7929 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
7930 }
7931 \pgfpathlineto{\pgfpoint
7932 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7933 {\pgf@circ@res@up}
7934 }
7935 \pgfusepath{draw}
7936 }
7937
7938 %% Black thyristor
7939 \pgfcircdeclarethyristor{fullthyristor}{0}{1}{\pgfcirc@thyristor@simplegate}
7940 %% Empty thyristor
7941 \pgfcircdeclarethyristor{emptythyristor}{1}{1}{\pgfcirc@thyristor@simplegate}
7942 %% black and empty GTO (standard: double line symbol, no arrow)
7943
7944 \def\pgfcirc@doublegate@gto@add{
7945 % connection to gate terminal
7946 \pgfpathmoveto{\pgfpoint
7947 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7948 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up -
7949 \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7950 }
7951 \pgfpathlineto{\pgfpoint
7952 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7953 {\pgf@circ@res@up}
7954 }
7955 \pgfusepath{draw}
7956 \pgfscope
7957 \pgfcirc@set@arrows{gto gate}{}{}
7958 % \pgfsetarrowsstart{latexslim}
7959 % first (lower) gto line: from body to gate
7960 \pgfpathmoveto{\pgfpoint
7961 {\pgf@circ@res@step}
7962 {(\ctikzvalof{tripoles/thyristor/gate height}-\ctikzvalof{tripoles/thyristor/gto space down})
7963 *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7964 }
7965 \pgfpathlineto{\pgfpoint
7966 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7967 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up -
7968 \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7969 }
7970 \pgfusepath{draw}
7971 % second (higher) gto line: from gate to body
7972 \pgfpathmoveto{\pgfpoint
7973 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7974 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up +
7975 \ctikzvalof{tripoles/thyristor/gto space up}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7976 }
7977 \pgfpathlineto{\pgfpoint
7978 {\pgf@circ@res@step}
7979 {(\ctikzvalof{tripoles/thyristor/gate height}+\ctikzvalof{tripoles/thyristor/gto space up})
7980 *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7981 }
7982 \pgfusepath{draw}
7983 \endpgfscope
7984 }
7985 \pgfcircdeclarethyristor{fullgto}{0}{1}{\pgfcirc@doublegate@gto@add}
7986 \pgfcircdeclarethyristor{emptygto}{1}{1}{\pgfcirc@doublegate@gto@add}
7987
7988 \def\pgfcirc@bargate@gto@add{%
7989 \pgfpathmoveto{\pgfpoint
7990 {\pgf@circ@res@step}
7991 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7992 }
7993 \pgfpathlineto{\pgfpoint
7994 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7995 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
7996 }
7997 \pgfpathlineto{\pgfpoint
7998 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7999 {\pgf@circ@res@up}
8000 }
8001 % draw bar line.
8002 \pgfpathmoveto{\pgfpoint
8003 {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right}
8004 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
8005 }
8006 \pgfpathlineto{\pgfpoint
8007 {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right}
8008 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
8009 }
8010 \pgfusepath{draw}
8011 }
8012
8013 \pgfcircdeclarethyristor{fullgtobar}{0}{1}{\pgfcirc@bargate@gto@add}
8014 \pgfcircdeclarethyristor{emptygtobar}{1}{1}{\pgfcirc@bargate@gto@add}
8015
8016 %% Thyristors with anode-connected gate
8017
8018 \def\pgfcirc@thyristor@anodegate{%
8019 \pgfpathmoveto{\pgfpoint
8020 {\pgf@circ@res@other}
8021 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8022 }
8023 \pgfpathlineto{\pgfpoint
8024 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
8025 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
8026 }
8027 \pgfpathlineto{\pgfpoint
8028 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
8029 {\pgf@circ@res@up}
8030 }
8031 \pgfusepath{draw}
8032 }
8033
8034 %% Black PUT
8035 \pgfcircdeclarethyristor{fullput}{0}{-1}{\pgfcirc@thyristor@anodegate}
8036 %% Empty PUT
8037 \pgfcircdeclarethyristor{emptyput}{1}{-1}{\pgfcirc@thyristor@anodegate}
8038 %% black and empty GTO (standard: double line symbol, no arrow)
8039
8040 \def\pgfcirc@anodebargate@gto@add{%
8041 \pgfpathmoveto{\pgfpoint
8042 {\pgf@circ@res@other}
8043 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
8044 }
8045 \pgfpathlineto{\pgfpoint
8046 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
8047 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
8048 }
8049 \pgfpathlineto{\pgfpoint
8050 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
8051 {\pgf@circ@res@up}
8052 }
8053 % draw bar line.
8054 \pgfpathmoveto{\pgfpoint
8055 {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left}
8056 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
8057 }
8058 \pgfpathlineto{\pgfpoint
8059 {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left}
8060 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
8061 }
8062 \pgfusepath{draw}
8063 }
8064
8065 \pgfcircdeclarethyristor{fullagtobar}{0}{-1}{\pgfcirc@anodebargate@gto@add}
8066 \pgfcircdeclarethyristor{emptyagtobar}{1}{-1}{\pgfcirc@anodebargate@gto@add}
8067
8068 % Triacs
8069
8070 \def\pgfcircdeclaretriac#1#2{%name, fill (0-> black; 1-empty)
8071 \pgfcircdeclarebipolescaled{diodes}
8072 {
8073 \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/triac/gate kink}}}
8074 \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x}
8075 \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x}
8076 \anchor{anode}{\southwest\pgf@y=0cm}
8077 \anchor{cathode}{\northeast\pgf@y=0cm }
8078 }
8079 {\ctikzvalof{tripoles/triac/height}}
8080 {#1}
8081 {\ctikzvalof{tripoles/triac/height}}
8082 {\ctikzvalof{tripoles/triac/width}}
8083 {
8084 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8085
8086 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
8087 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
8088
8089 % diodes forms
8090 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8091 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
8092 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8093 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8094
8095 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8096 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
8097 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8098 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
8099
8100 \ifnum#2=0\relax
8101 \pgfusepath{draw,fill}
8102 \else
8103 \pgf@circ@draworfill
8104 \fi
8105
8106 \pgfsetlinewidth{\pgfstartlinewidth}
8107
8108 % draw gate
8109 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
8110 \pgfpathlineto{\pgfpoint
8111 {\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}
8112 {-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
8113 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
8114
8115 % draw leads
8116 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8117 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8118
8119 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
8120 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8121
8122 \pgfusepath{draw}
8123
8124 }
8125 }
8126
8127 \pgfcircdeclaretriac{fulltriac}{0}
8128 \pgfcircdeclaretriac{emptytriac}{1}
8129
8130 % end of shape definitions for diodes%>>>
8131
8132 %% Paths definitions for Diodes%<<<
8133
8134 \def\pgfcirc@tmp@generatediodes#1#2{
8135 \pgfcirc@activate@bipole{l}{#1diode}{#1diode}{#1 diode}
8136 \pgfcirc@style@to@style{#1 diode}{D#2}
8137 \pgfcirc@activate@bipole{l}{#1zdiode}{#1zdiode}{#1 Zener diode}
8138 \pgfcirc@style@to@style{#1 Zener diode}{zD#2}
8139 \pgfcirc@activate@bipole{l}{#1zzdiode}{#1zzdiode}{#1 ZZener diode}
8140 \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2}
8141 \pgfcirc@activate@bipole{l}{#1sdiode}{#1sdiode}{#1 Schottky diode}
8142 \pgfcirc@style@to@style{#1 Schottky diode}{sD#2}
8143 \pgfcirc@activate@bipole{l}{#1tdiode}{#1tdiode}{#1 tunnel diode}
8144 \pgfcirc@style@to@style{#1 tunnel diode}{tD#2}
8145 \pgfcirc@activate@bipole{l}{#1lediode}{#1lediode}{#1 led}
8146 \pgfcirc@style@to@style{#1 led}{leD#2}
8147 \pgfcirc@activate@bipole{l}{#1laserdiode}{#1laserdiode}{#1 laser diode}
8148 \pgfcirc@style@to@style{#1 laser diode}{lasD#2}
8149 \pgfcirc@activate@bipole{l}{#1pdiode}{#1pdiode}{#1 photodiode}
8150 \pgfcirc@style@to@style{#1 photodiode}{pD#2}
8151 \pgfcirc@activate@bipole{l}{#1varcap}{#1varcap}{#1 varcap}
8152 \pgfcirc@style@to@style{#1 varcap}{VC#2}
8153 \pgfcirc@activate@bipole{l}{#1bidirectionaldiode}{#1bidirectionaldiode}{#1 bidirectionaldiode}
8154 \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2}
8155 \pgfcirc@activate@bipole{l}{#1thyristor}{#1thyristor}{#1 thyristor}
8156 \pgfcirc@style@to@style{#1 thyristor}{Ty#2}
8157 \pgfcirc@activate@bipole{l}{#1put}{#1put}{#1 put}
8158 \pgfcirc@style@to@style{#1 put}{PUT#2}
8159 \pgfcirc@activate@bipole{l}{#1gto}{#1gto}{#1 gto}
8160 \pgfcirc@style@to@style{#1 gto}{GTO#2}
8161 \pgfcirc@activate@bipole{l}{#1gtobar}{#1gtobar}{#1 gtobar}
8162 \pgfcirc@style@to@style{#1 gtobar}{GTOb#2}
8163 \pgfcirc@activate@bipole{l}{#1agtobar}{#1agtobar}{#1 agtobar}
8164 \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2}
8165 \pgfcirc@activate@bipole{l}{#1triac}{#1triac}{#1 triac}
8166 \pgfcirc@style@to@style{#1 triac}{Tr#2}
8167 }
8168 \pgfcirc@tmp@generatediodes{full}{*}
8169 \pgfcirc@tmp@generatediodes{empty}{o}
8170 \def\pgfcirc@tmp@generatestrokeddiodes#1#2{
8171 \pgfcirc@node@to@style{l}{emptydiode}{#1 diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8172 \pgfcirc@style@to@style{#1 diode}{D#2}
8173 \pgfcirc@node@to@style{l}{emptyzdiode}{#1 Zener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8174 \pgfcirc@style@to@style{#1 Zener diode}{zD#2}
8175 \pgfcirc@node@to@style{l}{emptyzzdiode}{#1 ZZener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8176 \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2}
8177 \pgfcirc@node@to@style{l}{emptysdiode}{#1 Schottky diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8178 \pgfcirc@style@to@style{#1 Schottky diode}{sD#2}
8179 \pgfcirc@node@to@style{l}{emptytdiode}{#1 tunnel diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8180 \pgfcirc@style@to@style{#1 tunnel diode}{tD#2}
8181 \pgfcirc@node@to@style{l}{emptylediode}{#1 led}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8182 \pgfcirc@style@to@style{#1 led}{leD#2}
8183 \pgfcirc@node@to@style{l}{emptylaserdiode}{#1 laser diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8184 \pgfcirc@style@to@style{#1 laser diode}{lasD#2}
8185 \pgfcirc@node@to@style{l}{emptypdiode}{#1 photodiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8186 \pgfcirc@style@to@style{#1 photodiode}{pD#2}
8187 \pgfcirc@node@to@style{l}{emptyvarcap}{#1 varcap}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8188 \pgfcirc@style@to@style{#1 varcap}{VC#2}
8189 \pgfcirc@node@to@style{l}{emptybidirectionaldiode}{#1 bidirectionaldiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8190 \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2}
8191 \pgfcirc@node@to@style{l}{emptythyristor}{#1 thyristor}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8192 \pgfcirc@style@to@style{#1 thyristor}{Ty#2}
8193 \pgfcirc@node@to@style{l}{emptyput}{#1 put}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8194 \pgfcirc@style@to@style{#1 put}{PUT#2}
8195 \pgfcirc@node@to@style{l}{emptygto}{#1 gto}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8196 \pgfcirc@style@to@style{#1 gto}{GTO#2}
8197 \pgfcirc@node@to@style{l}{emptygtobar}{#1 gtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8198 \pgfcirc@style@to@style{#1 gtobar}{GTOb#2}
8199 \pgfcirc@node@to@style{l}{emptyagtobar}{#1 agtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8200 \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2}
8201 \pgfcirc@node@to@style{l}{emptytriac}{#1 triac}{\circuitikzbasekey/bipole/is strokedsymbol=true}
8202 \pgfcirc@style@to@style{#1 triac}{Tr#2}
8203 }
8204 \pgfcirc@tmp@generatestrokeddiodes{stroke}{-}
8205 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
8206 % these are auto-switching styles
8207 \pgfcirc@style@to@style{\pgfcircdiodestylemacro diode}{diode}
8208 \pgfcirc@style@to@style{diode}{D}
8209 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Zener diode}{Zener diode}
8210 \pgfcirc@style@to@style{Zener diode}{zD}
8211 \pgfcirc@style@to@style{\pgfcircdiodestylemacro ZZener diode}{ZZener diode}
8212 \pgfcirc@style@to@style{ZZener diode}{zzD}
8213 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Schottky diode}{Schottky diode}
8214 \pgfcirc@style@to@style{Schottky diode}{sD}
8215 \pgfcirc@style@to@style{\pgfcircdiodestylemacro tunnel diode}{tunnel diode}
8216 \pgfcirc@style@to@style{tunnel diode}{tD}
8217 \pgfcirc@style@to@style{\pgfcircdiodestylemacro led}{led}
8218 \pgfcirc@style@to@style{led}{leD}
8219 \pgfcirc@style@to@style{\pgfcircdiodestylemacro photodiode}{photodiode}
8220 \pgfcirc@style@to@style{photodiode}{pD}
8221
8222 \pgfcirc@style@to@style{\pgfcircdiodestylemacro laser diode}{laser diode}
8223 \pgfcirc@style@to@style{laser diode}{lasD}
8224
8225 \pgfcirc@style@to@style{\pgfcircdiodestylemacro varcap}{varcap}
8226 \pgfcirc@style@to@style{varcap}{VC}
8227 \pgfcirc@style@to@style{\pgfcircdiodestylemacro bidirectionaldiode}{bidirectionaldiode}
8228 \pgfcirc@style@to@style{bidirectionaldiode}{biD}
8229 \pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor}
8230 \pgfcirc@style@to@style{thyristor}{Ty}
8231 \pgfcirc@style@to@style{\pgfcircdiodestylemacro put}{put}
8232 \pgfcirc@style@to@style{put}{PUT}
8233 \pgfcirc@style@to@style{\pgfcircdiodestylemacro gto}{gto}
8234 \pgfcirc@style@to@style{gto}{GTO}
8235 \pgfcirc@style@to@style{\pgfcircdiodestylemacro gtobar}{gtobar}
8236 \pgfcirc@style@to@style{gtobar}{GTOb}
8237 \pgfcirc@style@to@style{\pgfcircdiodestylemacro agtobar}{agtobar}
8238 \pgfcirc@style@to@style{agtobar}{aGTOb}
8239 \pgfcirc@style@to@style{\pgfcircdiodestylemacro triac}{triac}
8240 \pgfcirc@style@to@style{triac}{Tr}
8241 % %>>>
8242
8243 %%%%%%%%%%%%%
8244 %% switches and buttons
8245 %%%%%%%%%%%%%
8246
8247 %% Definitions for switches%<<<1
8248
8249 \ctikzset{bipoles/spst/height/.initial=.35}
8250 \ctikzset{bipoles/spst/width/.initial=.35}
8251 \ctikzset{bipoles/spst/depth/.initial=.2}
8252 \ctikzset{bipoles/nos/height/.initial=.3}
8253 \ctikzset{bipoles/nos/width/.initial=.35}
8254 \ctikzset{bipoles/nos/depth/.initial=.2}
8255 \ctikzset{bipoles/ncs/height/.initial=.35}
8256 \ctikzset{bipoles/ncs/width/.initial=.35}
8257 \ctikzset{bipoles/ncs/depth/.initial=.2}
8258 \ctikzset{bipoles/pushbutton/height/.initial=.5}
8259 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
8260 \ctikzset{bipoles/pushbutton/width/.initial=.50}
8261 %%% reed switch
8262 \ctikzset{bipoles/reed/height/.initial=.4}
8263 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
8264 \ctikzset{bipoles/reed/depth/.initial=.4}
8265 %% Cute switches
8266 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
8267 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
8268 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
8269 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
8270 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
8271
8272 \ctikzset{tripoles/spdt/width/.initial=.85}
8273 \ctikzset{tripoles/spdt/height/.initial=.45}
8274 \ctikzset{tripoles/spdt/margin/.initial=.45}
8275
8276 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
8277 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
8278 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
8279 %%>>>
8280
8281 %% Shapes Node for bipoles switches and similar things%<<<
8282 %% (Closing) SPST
8283 \pgfcircdeclarebipolescaled{switches}
8284 {}
8285 {\ctikzvalof{bipoles/spst/depth}}
8286 {cspst}
8287 {\ctikzvalof{bipoles/spst/height}}
8288 {\ctikzvalof{bipoles/spst/width}}
8289 {
8290 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8291 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8292 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
8293 \pgfusepath{draw}
8294
8295 \pgfscope
8296 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8297 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
8298 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
8299 \pgfcirc@set@arrows{switch}{}{latexslim}
8300 \pgfsetbeveljoin
8301 \pgfusepath{draw}
8302 \endpgfscope
8303 }
8304
8305 %% Opening SPST
8306 \pgfcircdeclarebipolescaled{switches}
8307 {}
8308 {\ctikzvalof{bipoles/spst/depth}}
8309 {ospst}
8310 {\ctikzvalof{bipoles/spst/height}}
8311 {\ctikzvalof{bipoles/spst/width}}
8312 {
8313
8314 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8315 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8316 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
8317 \pgfusepath{draw}
8318
8319 \pgfscope
8320 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8321 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
8322 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
8323 \pgfcirc@set@arrows{switch}{}{latexslim}
8324 \pgfsetbeveljoin
8325 \pgfusepath{draw}
8326 \endpgfscope
8327 }
8328
8329 %% Normal open Switch
8330 \pgfcircdeclarebipolescaled{switches}
8331 {}
8332 {\ctikzvalof{bipoles/nos/depth}}
8333 {nos}
8334 {\ctikzvalof{bipoles/nos/height}}
8335 {\ctikzvalof{bipoles/nos/width}}
8336 {
8337
8338 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8339 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8340 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
8341 \pgfsetbuttcap
8342 \pgfusepath{draw}
8343 }
8344
8345 %% Normal closed Switch
8346 \pgfcircdeclarebipolescaled{switches}
8347 {}
8348 {\ctikzvalof{bipoles/ncs/depth}}
8349 {ncs}
8350 {\ctikzvalof{bipoles/ncs/height}}
8351 {\ctikzvalof{bipoles/ncs/width}}
8352 {
8353 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8354 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8355 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
8356 \pgfusepath{draw}
8357 \pgfsetlinewidth{\pgfstartlinewidth}
8358 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8359 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
8360 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
8361 \pgfusepath{draw}
8362 }
8363
8364 %% Push Button
8365 \pgfcircdeclarebipolescaled{switches}
8366 {
8367 \anchor{tip}{\northeast\pgf@x=0pt\relax}
8368 }
8369 {\ctikzvalof{bipoles/pushbutton/height 2}}
8370 {pushbutton}
8371 {\ctikzvalof{bipoles/pushbutton/height}}
8372 {\ctikzvalof{bipoles/pushbutton/width}}
8373 {
8374 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8375 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
8376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
8377 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
8378 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
8379 \pgfusepath{draw}
8380
8381 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8382 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8383 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8384 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8385 }
8386
8387 %% Normally closed Push Button
8388 \pgfcircdeclarebipolescaled{switches}
8389 {
8390 \anchor{tip}{\northeast\pgf@x=0pt\relax}
8391 }
8392 {\ctikzvalof{bipoles/pushbutton/height 2}}
8393 {ncpushbutton}
8394 {\ctikzvalof{bipoles/pushbutton/height}}
8395 {\ctikzvalof{bipoles/pushbutton/width}}
8396 {
8397 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8398 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8399 % Warning, if the nodes will have a class, we have to touch this.
8400 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8401 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
8402 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
8403 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
8404 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
8405 \pgfusepath{draw}
8406 %
8407 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8408 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8409 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8410 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8411 }
8412 %% Push Button (normally closed but now open :-) see
8413 %% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299
8414 \pgfcircdeclarebipolescaled{switches}
8415 {
8416 \anchor{tip}{
8417 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8418 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
8419 \pgf@x=0pt\relax
8420 }
8421 }
8422 {\ctikzvalof{bipoles/pushbutton/height 2}}
8423 {pushbuttonc}
8424 {\ctikzvalof{bipoles/pushbutton/height}}
8425 {\ctikzvalof{bipoles/pushbutton/width}}
8426 {
8427 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8428 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8429 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
8430 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}
8431 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}}
8432 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
8433 \pgfusepath{draw}
8434
8435 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8436 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8437 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8438 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8439 }
8440
8441 %% Normally closed Push Button now open
8442 \pgfcircdeclarebipolescaled{switches}
8443 {
8444 \anchor{tip}{
8445 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8446 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
8447 \pgf@x=0pt\relax
8448 }
8449 }
8450 {\ctikzvalof{bipoles/pushbutton/height 2}}
8451 {ncpushbuttono}
8452 {\ctikzvalof{bipoles/pushbutton/height}}
8453 {\ctikzvalof{bipoles/pushbutton/width}}
8454 {
8455 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8456 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8457 % Warning, if the nodes will have a class, we have to touch this.
8458 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8459 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}}
8460 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}}
8461 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}}
8462 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
8463 \pgfusepath{draw}
8464 %
8465 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8466 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8467 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8468 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8469 }
8470 %%% reed switches
8471 \pgfcircdeclarebipolescaled{switches}
8472 {}
8473 {\ctikzvalof{bipoles/reed/depth}}
8474 {reed}
8475 {\ctikzvalof{bipoles/reed/height}}
8476 {\ctikzvalof{bipoles/reed/width}}
8477 {
8478 % this is designed to be the same as a "nos".
8479 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
8480 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
8481 \pgfscope
8482 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8483 % eclosure
8484 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
8485 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
8486 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
8487 \pgfpatharc{270}{90}{\pgf@circ@res@up}
8488 \pgfpathclose
8489 \pgf@circ@draworfill
8490 % switch
8491 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
8492 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
8493 % connection lines
8494 \pgfsetbuttcap
8495 \pgfusepath{draw}
8496 \endpgfscope
8497 % connection lines
8498 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8499 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
8500 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8501 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
8502 \pgfusepath{draw}
8503 }
8504
8505 % cute switch "to" shapes help function
8506 % #1 -> name
8507 % #2 -> barposition
8508 % #3 -> arrowcode
8509 \long\def\pgfcircdeclarecutesw#1#2#3{
8510 \pgfcircdeclarebipolescaled{switches}
8511 {
8512 \savedanchor\midlever{
8513 % these values are calculated when we create the definition of the shape.
8514 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8515 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
8516 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
8517 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8518 \pgf@circ@res@down = -.5\pgf@y
8519 \pgf@circ@res@up = .5\pgf@y
8520 \pgfextracty{\pgf@circ@res@other}{#2}
8521 \pgf@x=0pt
8522 \pgf@y=.5\pgf@circ@res@other
8523 }
8524 % radius of the connector
8525 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8526 % If cnnecting nodes are scaled, we have to modify this
8527 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
8528 % shapename
8529 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
8530 % shape type
8531 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
8532 % mid of the lever, to stack switches
8533 \anchor{mid}{\midlever}
8534 \anchor{cout}{\northeast \pgf@y=0cm}
8535 \anchor{cin}{\southwest\pgf@y=0cm}
8536 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
8537 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
8538 }
8539 {\ctikzvalof{bipoles/cuteswitch/height 2}}
8540 {#1}
8541 {\ctikzvalof{bipoles/cuteswitch/height}}
8542 {\ctikzvalof{bipoles/cuteswitch/width}}{
8543 \pgfscope
8544 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8545 % If cnnecting nodes are scaled, we have to modify this
8546 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8547 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8548 \pgfsetlinewidth{2\pgf@circ@res@temp}
8549 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8550 \pgfpathlineto{#2}
8551 \pgfsetroundcap\pgfusepath{draw}
8552 \endpgfscope
8553 \pgfscope % arrow
8554 #3
8555 \endpgfscope
8556 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8557 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
8558 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8559 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
8560 }
8561 }
8562
8563 %% closed cute switch
8564 \pgfcircdeclarecutesw{cuteclosedswitch}
8565 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
8566 {}
8567
8568 %% open cute switch
8569 \pgfcircdeclarecutesw{cuteopenswitch}
8570 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8571 {}
8572
8573 %% closing cute switch
8574 \pgfcircdeclarecutesw{cuteclosingswitch}
8575 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8576 {
8577 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8578 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8579 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
8580 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
8581 \pgfcirc@set@arrows{switch}{}{latexslim}
8582 \pgfusepath{draw}
8583 }
8584
8585 %% opening cute switch
8586 \pgfcircdeclarecutesw{cuteopeningswitch}
8587 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
8588 {
8589 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8590 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8591 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
8592 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
8593 \pgfcirc@set@arrows{switch}{}{latexslim}
8594 \pgfusepath{draw}
8595 }
8596
8597 \pgfcircdeclarebipole{
8598 \anchor{out 1}{
8599 \northeast
8600 \pgf@y=0cm
8601 }
8602 \anchor{out 2}{
8603 \northeast
8604 \pgf@y=.8\pgf@y
8605 }
8606 }
8607 {\ctikzvalof{tripoles/toggleswitch/height 2}}
8608 {toggleswitch}
8609 {\ctikzvalof{tripoles/toggleswitch/height}}
8610 {\ctikzvalof{tripoles/toggleswitch/width}}
8611 {
8612
8613 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8614 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
8615 \pgfusepath{draw}
8616 \pgfscope
8617 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
8618 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8619 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
8620 \pgfusepath{draw}
8621 \endpgfscope
8622
8623 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8624 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
8625
8626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
8627 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
8628 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
8629 \pgfusepath{draw}
8630
8631
8632 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
8633 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
8634 \pgfusepath{draw}
8635
8636 \pgfsetdash{{.08\pgf@circ@res@up}{.04\pgf@circ@res@up}{.7\pgf@circ@res@up}{.04\pgf@circ@res@up}{.8\pgf@circ@res@up}}{0cm}
8637 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
8638 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
8639 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
8640 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
8641 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
8642 \pgfusepath{draw}
8643 \pgfsetdash{}{0cm}
8644 }
8645
8646 % %>>>
8647
8648 %% Shape nodes for switches (non-bipoles)%<<<
8649
8650 %%%%%%%%%%%%%
8651 %% switches
8652 %%%%%%%%%%%%%
8653
8654 % Legacy spdt
8655 \pgfdeclareshape{spdt}{
8656 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
8657 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
8658 \savedanchor\northwest{%
8659 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8660 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
8661 \pgf@y=.5\pgf@y
8662 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
8663 \pgf@x=.5\pgf@x
8664 }
8665 \anchor{left}{%
8666 \northwest
8667 \pgf@y=0pt
8668 }
8669 \anchor{in}{
8670 \northwest
8671 \pgf@y=0pt
8672 }
8673 \anchor{out 1}{
8674 \northwest
8675 \pgf@x=-\pgf@x
8676 }
8677 \anchor{out 2}{
8678 \northwest
8679 \pgf@x=-\pgf@x
8680 \pgf@y=-\pgf@y
8681 }
8682 \anchor{center}{
8683 \pgf@y=0pt
8684 \pgf@x=0pt
8685 }
8686 \anchor{east}{
8687 \northwest
8688 \pgf@y=0pt
8689 \pgf@x=-\pgf@x
8690 }
8691 \anchor{west}{
8692 \northwest
8693 \pgf@y=0pt
8694 }
8695 \anchor{south}{
8696 \northwest
8697 \pgf@x=0pt
8698 \pgf@y=-\pgf@y
8699 }
8700 \anchor{north}{
8701 \northwest
8702 \pgf@x=0pt
8703 }
8704 \anchor{south west}{
8705 \northwest
8706 \pgf@y=-\pgf@y
8707 }
8708 \anchor{north east}{
8709 \northwest
8710 \pgf@x=-\pgf@x
8711 }
8712 \anchor{north west}{
8713 \northwest
8714 }
8715 \anchor{south east}{
8716 \northwest
8717 \pgf@x=-\pgf@x
8718 \pgf@y=-\pgf@y
8719 }
8720 \backgroundpath{
8721 \pgfsetcolor{\ctikzvalof{color}}
8722
8723 \northwest
8724 \pgf@circ@res@up = \pgf@y
8725 \pgf@circ@res@down = -\pgf@y
8726 \pgf@circ@res@right = -\pgf@x
8727 \pgf@circ@res@left = \pgf@x
8728 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
8729
8730
8731 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8732 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
8733 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8734 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
8735
8736 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8737 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8738
8739 \pgfusepath{draw}
8740
8741 \pgfscope
8742 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
8743 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
8744 \endpgfscope
8745 \pgfscope
8746 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
8747 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
8748 \endpgfscope
8749 \pgfscope
8750 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
8751 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
8752 \endpgfscope
8753
8754 \pgfscope
8755 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
8756 \pgfpathlineto{
8757 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
8758 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
8759 }
8760 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
8761 \pgfusepath{draw}
8762 \endpgfscope
8763 }
8764 }
8765
8766
8767 % cute switch "node" shapes, matching with cute "to" shapes
8768 % #1 -> name
8769 % #2 -> barposition
8770 % #3 -> arrowcode
8771 \long\def\pgfcircdeclarecutespdt#1#2#3{
8772 \pgfdeclareshape{#1}
8773 {
8774 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
8775 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
8776 \savedanchor\northwest{%
8777 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8778 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
8779 \pgf@y=.5\pgf@y
8780 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
8781 \pgf@x=.25\pgf@x
8782 }
8783 \savedanchor\midlever{
8784 % these values are calculated when we create the definition of the shape.
8785 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8786 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
8787 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
8788 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8789 \pgf@circ@res@down = -.5\pgf@y
8790 \pgf@circ@res@up = .5\pgf@y
8791 \pgfextracty{\pgf@circ@res@other}{#2}
8792 \pgf@x=0pt
8793 \pgf@y=.5\pgf@circ@res@other
8794 }
8795 % radius of the connector
8796 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8797 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
8798 % shapename
8799 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
8800 % shape type
8801 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
8802 % mid of the lever, to stack switches
8803 \anchor{mid}{\midlever}
8804 % center anchors
8805 \anchor{cin}{ \northwest \pgf@y=0pt}
8806 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
8807 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
8808 % horizontal angles
8809 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
8810 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
8811 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
8812
8813 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
8814 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
8815 \anchor{west}{ \northwest \pgf@y=0pt }
8816 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
8817 \anchor{north}{ \northwest \pgf@x=0pt }
8818 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
8819 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
8820 \anchor{north west}{ \northwest }
8821 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
8822
8823 \backgroundpath{
8824 \pgfsetcolor{\ctikzvalof{color}}
8825 \northwest
8826 \pgf@circ@res@up = \pgf@y
8827 \pgf@circ@res@down = -\pgf@y
8828 \pgf@circ@res@right = -\pgf@x
8829 \pgf@circ@res@left = \pgf@x
8830
8831 \pgfscope
8832 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8833 \pgf@circ@res@temp=\radius\relax
8834 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8835 \pgfsetlinewidth{2\pgf@circ@res@temp}
8836 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8837 \pgfpathlineto{#2}
8838 \pgfsetroundcap\pgfusepath{draw}
8839 \endpgfscope
8840 \pgfscope % arrow
8841 #3
8842 \endpgfscope
8843 % terminals
8844 \pgfscope
8845 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8846 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
8847 \endpgfscope
8848 \pgfscope
8849 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8850 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
8851 \endpgfscope
8852 \pgfscope
8853 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8854 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
8855 \endpgfscope
8856
8857 }
8858 }
8859 }
8860
8861 \pgfcircdeclarecutespdt{cute spdt up}
8862 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
8863 {}
8864
8865 \pgfcircdeclarecutespdt{cute spdt mid}
8866 {\pgfpoint{\pgf@circ@res@right}{0pt}}
8867 {}
8868
8869 \pgfcircdeclarecutespdt{cute spdt down}
8870 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
8871 {}
8872
8873 \pgfcircdeclarecutespdt{cute spdt up arrow}
8874 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
8875 {
8876 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8877 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8878 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
8879 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
8880 \pgfcirc@set@arrows{switch}{}{latexslim}
8881 \pgfusepath{draw}
8882 }
8883
8884 \pgfcircdeclarecutespdt{cute spdt mid arrow}
8885 {\pgfpoint{\pgf@circ@res@right}{0pt}}
8886 {
8887 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8888 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8889 \pgfcirc@set@arrows{switch}{latexslim}{latexslim}
8890 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
8891 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
8892 \pgfusepath{draw}
8893 }
8894
8895 \pgfcircdeclarecutespdt{cute spdt down arrow}
8896 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
8897 {
8898 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8899 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8900 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
8901 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
8902 \pgfcirc@set@arrows{switch}{}{latexslim}
8903 \pgfusepath{draw}
8904 }
8905 % %>>>
8906
8907 %% Paths Switches and buttons%<<<
8908
8909 \pgfcirc@activate@bipole{l}{cspst}{cspst}{closing switch}
8910 \pgfcirc@style@to@style{closing switch}{switch}
8911 \pgfcirc@style@to@style{closing switch}{cspst}
8912 \pgfcirc@style@to@style{switch}{spst}
8913 \pgfcirc@activate@bipole{l}{ospst}{ospst}{opening switch}
8914 \pgfcirc@style@to@style{opening switch}{ospst}
8915
8916 \pgfcirc@activate@bipole@simple{l}{nos}
8917 \pgfcirc@style@to@style{nos}{normal open switch}
8918 \pgfcirc@activate@bipole@simple{l}{ncs}
8919 \pgfcirc@style@to@style{ncs}{normal closed switch}
8920
8921 \pgfcirc@activate@bipole{l}{pushbutton}{pushbutton}{push button}
8922 \pgfcirc@style@to@style{push button}{nopb}
8923 \pgfcirc@style@to@style{push button}{normally open push button}
8924 \pgfcirc@activate@bipole{l}{ncpushbutton}{ncpushbutton}{ncpb}
8925 \pgfcirc@style@to@style{ncpb}{normally closed push button}
8926 \pgfcirc@activate@bipole{l}{pushbuttonc}{pushbuttonc}{nopbc}
8927 \pgfcirc@style@to@style{nopbc}{normally open push button closed}
8928 \pgfcirc@activate@bipole{l}{ncpushbuttono}{ncpushbuttono}{ncpbo}
8929 \pgfcirc@style@to@style{ncpbo}{normally closed push button open}
8930
8931 \pgfcirc@activate@bipole{l}{toggleswitch}{toggleswitch}{toggle switch}
8932 \pgfcirc@activate@bipole@simple{l}{reed}
8933
8934 \pgfcirc@activate@bipole{l}{cuteclosedswitch}{cuteclosedswitch}{cute closed switch}
8935 \pgfcirc@style@to@style{cute closed switch}{ccsw}
8936 \pgfcirc@activate@bipole{l}{cuteopenswitch}{cuteopenswitch}{cute open switch}
8937 \pgfcirc@style@to@style{cute open switch}{cosw}
8938 \pgfcirc@activate@bipole{l}{cuteclosingswitch}{cuteclosingswitch}{cute closing switch}
8939 \pgfcirc@style@to@style{cute closing switch}{ccgsw}
8940 \pgfcirc@activate@bipole{l}{cuteopeningswitch}{cuteopeningswitch}{cute opening switch}
8941 \pgfcirc@style@to@style{cute opening switch}{cogsw}% %>>>
8942
8943 %%%%%%%%%%%%%%%%%
8944 %% Instruments
8945 %%%%%%%%%%%%%%%%%
8946
8947 %% Definitions for Instruments %<<<1
8948 \ctikzset{bipoles/ammeter/height/.initial=.60}
8949 \ctikzset{bipoles/ammeter/width/.initial=.60}
8950 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
8951 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
8952 \ctikzset{bipoles/voltmeter/height/.initial=.60}
8953 \ctikzset{bipoles/voltmeter/width/.initial=.60}
8954 \ctikzset{bipoles/smeter/height/.initial=.60}
8955 \ctikzset{bipoles/smeter/width/.initial=.60}
8956 \ctikzset{bipoles/smeter/voltage/additional shift/.initial=1}
8957 \ctikzset{bipoles/qmeter/depth/.initial=.40}
8958 \ctikzset{bipoles/qmeter/height/.initial=.80}
8959 \ctikzset{bipoles/qmeter/width/.initial=.60}
8960 % this must be specified for each one
8961 \ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5}
8962 \ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5}
8963 \ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5}
8964 \ctikzset{bipoles/iloop/width/.initial=.40}
8965 \ctikzset{bipoles/iloop/height/.initial=.60}
8966
8967 \ctikzset{bipoles/oscope/height/.initial=.60}
8968 \ctikzset{bipoles/oscope/width/.initial=.60}
8969 \ctikzset{bipoles/oscope/voltage/additional shift/.initial=1}
8970
8971
8972 % option to not rotate the new (Romano's) instruments
8973 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
8974 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
8975 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
8976 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
8977 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
8978 %%>>>
8979
8980 %% Node shapes for instruments%<<<
8981
8982 % % METERINGSHAPE
8983 \long\def\drawmeteringcircle{
8984 \def\pgf@circ@temp{right}
8985 \ifx\tikz@res@label@pos\pgf@circ@temp
8986 \pgf@circ@res@step=-1.2\pgf@circ@res@up
8987 \else
8988 \def\pgf@circ@temp{below}
8989 \ifx\tikz@res@label@pos\pgf@circ@temp
8990 \pgf@circ@res@step=-1.2\pgf@circ@res@up
8991 \else
8992 \pgf@circ@res@step=1.2\pgf@circ@res@up
8993 \fi
8994 \fi
8995 %draw connections to circle
8996 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8997 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
8998 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
8999 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9000 \pgfusepath{draw}
9001 %draw circle
9002 \pgfscope
9003 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9004 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
9005 \pgf@circ@draworfill
9006 \endpgfscope
9007 %draw arrow
9008 \pgfscope
9009 \pgfsetarrowsend{latex}
9010 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9011 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
9012 \pgfusepath{draw}
9013 \endpgfscope
9014 }
9015
9016 %AMPEREMETER
9017 \pgfcircdeclarebipolescaled{instruments}
9018 {}
9019 {\ctikzvalof{bipoles/ammeter/height}}
9020 {ammeter}
9021 {\ctikzvalof{bipoles/ammeter/height}}
9022 {\ctikzvalof{bipoles/ammeter/width}}
9023 {
9024 \drawmeteringcircle
9025 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
9026 }
9027 %OHMMETER
9028 \pgfcircdeclarebipolescaled{instruments}
9029 {}
9030 {\ctikzvalof{bipoles/ohmmeter/height}}
9031 {ohmmeter}
9032 {\ctikzvalof{bipoles/ohmmeter/height}}
9033 {\ctikzvalof{bipoles/ohmmeter/width}}
9034 {
9035 \drawmeteringcircle
9036 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
9037 }
9038 %VOLTMETER
9039 \pgfcircdeclarebipolescaled{instruments}
9040 {}
9041 {\ctikzvalof{bipoles/voltmeter/height}}
9042 {voltmeter}
9043 {\ctikzvalof{bipoles/voltmeter/height}}
9044 {\ctikzvalof{bipoles/voltmeter/width}}
9045 {
9046 \drawmeteringcircle
9047 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
9048
9049 }
9050
9051 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
9052 %
9053 % oscilloscope waveforms
9054
9055 \ctikzset{%
9056 bipoles/oscope/waveform/sin/.code={%
9057 \pgfpathmoveto{\pgfpoint{-0.6cm}{0cm}}
9058 \pgfpathsine{\pgfpoint{0.3cm}{0.4cm}}
9059 \pgfpathcosine{\pgfpoint{0.3cm}{-0.4cm}}
9060 \pgfpathsine{\pgfpoint{0.3cm}{-0.4cm}}
9061 \pgfpathcosine{\pgfpoint{0.3cm}{0.4cm}}
9062 \pgfusepath{draw}
9063 },
9064 bipoles/oscope/waveform/ramps/.code={%
9065 \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}}
9066 \pgfpathlineto{\pgfpoint{-0.05cm}{0.25cm}}
9067 \pgfpathlineto{\pgfpoint{-0.05cm}{-0.25cm}}
9068 \pgfpathlineto{\pgfpoint{0.65cm}{0.25cm}}
9069 \pgfpathlineto{\pgfpoint{0.65cm}{-0.25cm}}
9070 \pgfusepath{draw}
9071 },
9072 bipoles/oscope/waveform/square/.code={%
9073 \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}}
9074 \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}}
9075 \pgfpathlineto{\pgfpoint{-0.6cm}{0.25cm}}
9076 \pgfpathlineto{\pgfpoint{0cm}{0.25cm}}
9077 \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}}
9078 \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}}
9079 \pgfpathlineto{\pgfpoint{0.6cm}{0.25cm}}
9080 \pgfpathlineto{\pgfpoint{0.75cm}{0.25cm}}
9081 \pgfusepath{draw}
9082 },
9083 bipoles/oscope/waveform/triangle/.code={%
9084 \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}}
9085 \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}}
9086 \pgfpathlineto{\pgfpoint{-0.3cm}{0.25cm}}
9087 \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}}
9088 \pgfpathlineto{\pgfpoint{0.3cm}{0.25cm}}
9089 \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}}
9090 \pgfpathlineto{\pgfpoint{0.75cm}{0cm}}
9091 \pgfusepath{draw}
9092 },
9093 bipoles/oscope/waveform/zero/.code={
9094 \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}}
9095 \pgfpathlineto{\pgfpoint{0.75cm}{0cm}}
9096 \pgfusepath{draw}
9097 },%
9098 bipoles/oscope/waveform/lissajous/.code={%
9099 \pgfpathellipse{\pgfpoint{0cm}{0cm}}
9100 {\pgfpoint{0.5cm}{0.35cm}}{\pgfpoint{-0.3cm}{0.2cm}}
9101 \pgfusepath{draw}
9102 },
9103 bipoles/oscope/waveform/none/.code={},%
9104 }
9105 % default waveform (backward compatible)
9106 \ctikzset{bipoles/oscope/waveform/.initial=ramps}
9107
9108 \pgfcircdeclarebipolescaled{instruments}
9109 {
9110 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
9111 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
9112 % put the node text above and centered
9113 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
9114 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
9115 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
9116 }
9117 }
9118 }
9119 {\ctikzvalof{bipoles/oscope/height}}
9120 {oscope}
9121 {\ctikzvalof{bipoles/oscope/height}}
9122 {\ctikzvalof{bipoles/oscope/width}}
9123 {
9124 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9125 \pgfextracty{\pgf@circ@res@up}{\northeast}
9126 \pgfextractx{\pgf@circ@res@right}{\northeast}
9127 \pgfextractx{\pgf@circ@res@left}{\southwest}
9128 \pgfextracty{\pgf@circ@res@down}{\southwest}
9129 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
9130 \pgfscope
9131 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
9132 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9133 \pgf@circ@draworfill
9134 \endpgfscope
9135 % get the rotation
9136 \ifpgf@circuit@straightinstruments
9137 \pgfgettransformentries\a\b\temp\temp\temp\temp
9138 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
9139 \else
9140 \edef\rot{0}
9141 \fi
9142 % and unrotate the scope
9143 \pgfscope
9144 \pgftransformrotate{\rot}
9145 % grid
9146 \pgfscope
9147 \pgfsetlinewidth{0.5\pgfstartlinewidth}
9148 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
9149 % the "almost one" make the grid complete most of the time --- beware of antialiasing
9150 \pgfpathgrid[stepx=0.995\pgf@circ@res@step, stepy=0.995\pgf@circ@res@step]%
9151 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
9152 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
9153 \pgfsetstrokeopacity{0.5}
9154 \pgfusepath{draw}
9155 \endpgfscope
9156 % function displayed
9157 \pgfscope
9158 \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm}
9159 \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm}
9160 \pgftransformxscale{\@@scalex}
9161 \pgftransformyscale{\@@scaley}
9162 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9163 \pgfkeys{\circuitikzbasekey/bipoles/oscope/waveform/\ctikzvalof{bipoles/oscope/waveform}}
9164 \endpgfscope
9165 \endpgfscope
9166 }
9167 % generic round meter with always horizontal text, no arrow
9168 \pgfcircdeclarebipolescaled{instruments}
9169 {}
9170 {\ctikzvalof{bipoles/esource/height}}
9171 {rmeter}
9172 {\ctikzvalof{bipoles/esource/height}}
9173 {\ctikzvalof{bipoles/esource/width}}
9174 {
9175 \pgfpointorigin
9176 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9177 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
9178 \pgf@circ@draworfill
9179 % draw the text label
9180 % get the rotation
9181 \ifpgf@circuit@straightinstruments
9182 \pgfgettransformentries\a\b\temp\temp\temp\temp
9183 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
9184 \else
9185 \edef\rot{0}
9186 \fi
9187 % and unrotate the scope
9188 \pgfscope
9189 \pgfsetcolor{\ctikzvalof{color}}
9190 \pgftransformrotate{\rot}
9191 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
9192 \endpgfscope
9193 }
9194
9195 % generic round meter with always horizontal text, with arrow
9196 \pgfcircdeclarebipolescaled{instruments}
9197 {}
9198 {\ctikzvalof{bipoles/esource/height}}
9199 {rmeterwa}
9200 {\ctikzvalof{bipoles/esource/height}}
9201 {\ctikzvalof{bipoles/esource/width}}
9202 {
9203 \pgfpointorigin
9204 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9205 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
9206 \pgf@circ@draworfill
9207 % draw the text label
9208 % get the rotation
9209 \ifpgf@circuit@straightinstruments
9210 \pgfgettransformentries\a\b\temp\temp\temp\temp
9211 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
9212 \else
9213 \edef\rot{0}
9214 \fi
9215 % and unrotate the scope
9216 \pgfscope
9217 \pgftransformrotate{\rot}
9218 \pgfsetcolor{\ctikzvalof{color}}
9219 \pgfsetlinewidth{\pgfstartlinewidth}
9220 % arrow: create a center hole to have better visual
9221 \pgfscope
9222 % clipping path: first a rectangle bigger then the shape
9223 % to avoid problems with the line thickness
9224 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
9225 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
9226 % next open a circle into it
9227 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
9228 % do the difference and clip before drawing
9229 \pgfseteorule
9230 \pgfusepath{clip}
9231 \pgfsetarrowsend{latexslim}
9232 % the arrow is better if it has a bit of breath and it's not 45º
9233 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
9234 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
9235 \pgfusepath{draw}
9236 \endpgfscope
9237 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
9238 \endpgfscope
9239 }
9240
9241 % generic square meter with always horizontal text
9242 \pgfcircdeclarebipolescaled{instruments}
9243 {
9244 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
9245 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
9246 % put the node text above and centered
9247 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
9248 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
9249 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
9250 }
9251 }
9252 }
9253 {\ctikzvalof{bipoles/smeter/height}}
9254 {smeter}
9255 {\ctikzvalof{bipoles/smeter/height}}
9256 {\ctikzvalof{bipoles/smeter/width}}
9257 {
9258 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9259 \pgfextracty{\pgf@circ@res@up}{\northeast}
9260 \pgfextractx{\pgf@circ@res@right}{\northeast}
9261 \pgfextractx{\pgf@circ@res@left}{\southwest}
9262 \pgfextracty{\pgf@circ@res@down}{\southwest}
9263 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
9264 \pgfscope
9265 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
9266 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9267 \pgf@circ@draworfill
9268 \endpgfscope
9269 % get the rotation
9270 \ifpgf@circuit@straightinstruments
9271 \pgfgettransformentries\a\b\temp\temp\temp\temp
9272 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
9273 \else
9274 \edef\rot{0}
9275 \fi
9276 % and unrotate the scope
9277 \pgfscope
9278 \pgftransformrotate{\rot}
9279 % the metering window
9280 \pgfscope
9281 \def\@starta{105}\def\@stopa{75}
9282 \pgfsetlinewidth{\pgfstartlinewidth}
9283 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
9284 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
9285 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
9286 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
9287 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
9288 \pgfclosepath
9289 \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}}
9290 \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}}
9291 \pgfusepath{draw}
9292 \endpgfscope
9293 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
9294 \endpgfscope
9295 }
9296
9297 % probes qucs style:
9298 % #1 : name
9299 % #2 : extra code
9300 \long\def\pgfcirc@qucsprobe#1#2{
9301 \pgfcircdeclarebipolescaled{instruments}
9302 {
9303 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
9304 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
9305 % put the node text above and centered
9306 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
9307 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
9308 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
9309 }
9310 }
9311 }
9312 {\ctikzvalof{bipoles/qmeter/depth}}
9313 {#1}
9314 {\ctikzvalof{bipoles/qmeter/height}}
9315 {\ctikzvalof{bipoles/qmeter/width}}
9316 {
9317 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9318 \pgfextracty{\pgf@circ@res@up}{\northeast}
9319 \pgfextractx{\pgf@circ@res@right}{\northeast}
9320 \pgfextractx{\pgf@circ@res@left}{\southwest}
9321 \pgfextracty{\pgf@circ@res@down}{\southwest}
9322 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
9323 \pgfscope
9324 \pgfscope
9325 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
9326 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9327 \pgf@circ@draworfill
9328 \endpgfscope
9329 \def\@starta{103}\def\@stopa{77}
9330 \pgfsetlinewidth{\pgfstartlinewidth}
9331 \pgfscope
9332 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
9333 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
9334 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
9335 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
9336 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
9337 \pgfclosepath
9338 \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}}
9339 \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}}
9340 \pgfusepath{draw}
9341 \pgf@circ@draworfill
9342 \endpgfscope
9343 #2
9344 \endpgfscope
9345 }
9346 }
9347
9348 \pgfcirc@qucsprobe{qiprobe}{
9349 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9350 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9351 \pgfusepath{draw}
9352 \pgfnode{currarrow}{center}{}{}{}
9353 }
9354
9355 \pgfcirc@qucsprobe{qvprobe}{
9356 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
9357 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9358 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
9359 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
9360 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
9361 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9362 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
9363 \pgfusepath{draw}
9364 \pgfscope
9365 % "+" and "-", drawn so that they scale correctly
9366 \pgfsetlinewidth{2\pgfstartlinewidth}
9367 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
9368 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
9369 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
9370 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
9371 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
9372 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
9373 \pgfusepath{draw}
9374 \endpgfscope
9375 }
9376
9377 \pgfcirc@qucsprobe{qpprobe}{
9378 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9380 \pgfusepath{draw}
9381 \pgfnode{currarrow}{center}{}{}{}
9382 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
9383 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
9384 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
9385 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
9386 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
9387 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
9388 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
9389 \pgfusepath{draw}
9390 \pgfscope
9391 % "+" and "-", drawn so that they scale correctly
9392 \pgfsetlinewidth{2\pgfstartlinewidth}
9393 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
9394 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
9395 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
9396 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
9397 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
9398 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
9399 \pgfusepath{draw}
9400 \endpgfscope
9401 }
9402
9403 % current loop for oscope and similar: stylized
9404 \pgfcircdeclarebipolescaled{instruments}
9405 {
9406 \anchor{i}{\northeast\pgf@x=0pt\relax}
9407 \anchor{text}{
9408 \pgfextracty{\pgf@circ@res@up}{\northeast}
9409 \pgfextractx{\pgf@circ@res@left}{\northeast}
9410 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
9411 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
9412 }
9413 }
9414 }
9415 {\ctikzvalof{bipoles/iloop/height}}
9416 {iloop}
9417 {\ctikzvalof{bipoles/iloop/height}}
9418 {\ctikzvalof{bipoles/iloop/width}}
9419 {
9420 \pgfextracty{\pgf@circ@res@up}{\northeast}
9421 \pgfextractx{\pgf@circ@res@right}{\northeast}
9422 \pgf@circ@res@down=-\pgf@circ@res@up
9423 \pgf@circ@res@left=-\pgf@circ@res@right
9424 \pgfscope
9425 \pgfstartlinewidth=\pgflinewidth
9426 \pgfsetcolor{\ctikzvalof{color}}
9427 % external ellipse
9428 \pgfscope
9429 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9430 % clipping path: first a rectangle bigger then the shape
9431 % to avoid problems with the line thickness
9432 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
9433 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
9434 % next the opening to the left
9435 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
9436 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
9437 % do the difference and clip before drawing
9438 \pgfseteorule
9439 \pgfusepath{clip}
9440 \pgfpathellipse{\pgfpointorigin}{
9441 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
9442 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
9443 \pgfusepath{draw}
9444 \endpgfscope
9445 % internal wire
9446 \pgfsetlinewidth{\pgfstartlinewidth}
9447 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9448 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
9449 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
9450 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9451 % and the contact line up
9452 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
9453 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
9454 \pgfusepath{draw}
9455 \endpgfscope
9456 }
9457
9458 % current loop for oscope and similar: real (double connection)
9459 \pgfcircdeclarebipolescaled{instruments}
9460 {
9461 \anchor{i+}{
9462 \pgfextracty{\pgf@circ@res@up}{\northeast}
9463 \pgfextractx{\pgf@circ@res@right}{\northeast}
9464 \pgf@circ@res@step=0.4\pgf@circ@res@right
9465 \pgf@circ@res@other=0.8\pgf@circ@res@up
9466 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
9467 \pgf@y=\pgf@circ@res@up
9468 }
9469 \anchor{i-}{
9470 \pgfextracty{\pgf@circ@res@up}{\northeast}
9471 \pgfextractx{\pgf@circ@res@right}{\northeast}
9472 \pgf@circ@res@step=0.4\pgf@circ@res@right
9473 \pgf@circ@res@other=0.8\pgf@circ@res@up
9474 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
9475 \pgf@y=\pgf@circ@res@up
9476 }
9477 \anchor{text}{
9478 \pgfextracty{\pgf@circ@res@up}{\northeast}
9479 \pgfextractx{\pgf@circ@res@left}{\northeast}
9480 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
9481 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
9482 }
9483 }
9484 }
9485 {\ctikzvalof{bipoles/iloop/height}}
9486 {iloop2}
9487 {\ctikzvalof{bipoles/iloop/height}}
9488 {\ctikzvalof{bipoles/iloop/width}}
9489 {
9490 \pgfextracty{\pgf@circ@res@up}{\northeast}
9491 \pgfextractx{\pgf@circ@res@right}{\northeast}
9492 \pgf@circ@res@down=-\pgf@circ@res@up
9493 \pgf@circ@res@left=-\pgf@circ@res@right
9494 % must be the same than internal i+ and i- anchors definition
9495 \pgf@circ@res@step=0.4\pgf@circ@res@right
9496 \pgf@circ@res@other=0.8\pgf@circ@res@up
9497 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
9498 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
9499 \pgfscope
9500 \pgfstartlinewidth=\pgflinewidth
9501 \pgfsetcolor{\ctikzvalof{color}}
9502 % external ellipse
9503 \pgfscope
9504 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9505 % clipping path: first a rectangle bigger then the shape
9506 % to avoid problems with the line thickness
9507 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
9508 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
9509 % next the opening to the left
9510 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
9511 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
9512 % do the difference and clip before drawing
9513 \pgfseteorule
9514 \pgfusepath{clip}
9515 \pgfpathmoveto{\@plus}
9516 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
9517 \pgfusepath{draw}
9518 \endpgfscope
9519 % internal wire
9520 \pgfsetlinewidth{\pgfstartlinewidth}
9521 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9522 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
9523 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
9524 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9525 % and the contact line up
9526 % I use ...left and ---right as temporal lengths here to avoid defining more
9527 \pgfextractx{\pgf@circ@res@left}{\@plus}
9528 \pgfextractx{\pgf@circ@res@right}{\@minus}
9529 \pgfpathmoveto{\@plus}
9530 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9531 \pgfpathmoveto{\@minus}
9532 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9533 \pgfusepath{draw}
9534 \endpgfscope
9535 }
9536 % %>>>
9537
9538 % Path definitions for Instruments%<<<
9539
9540 \pgfcirc@activate@bipole@simple{l}{ammeter}
9541 \pgfcirc@activate@bipole@simple{l}{ohmmeter}
9542 \pgfcirc@activate@bipole@simple{l}{voltmeter}
9543 \pgfcirc@activate@bipole@simple{l}{oscope}
9544 \pgfcirc@activate@bipole@simple{l}{rmeter}
9545 \pgfcirc@activate@bipole@simple{l}{rmeterwa}
9546 \pgfcirc@activate@bipole@simple{l}{smeter}
9547 \pgfcirc@activate@bipole@simple{l}{iloop}
9548 % \pgfcirc@activate@bipole@simple{l}{iloop2} that was wrong
9549 \pgfcirc@activate@bipole{l}{ilooptwo}{iloop2}{iloop2}
9550 \pgfcirc@activate@bipole@simple{l}{qvprobe}
9551 \pgfcirc@activate@bipole@simple{l}{qiprobe}
9552 \pgfcirc@activate@bipole@simple{l}{qpprobe}
9553 % %>>>
9554
9555 %%%%%%%%%%%%%%%%%%%%%%%
9556 %% MECHANICAL SYMBOLS
9557 %%%%%%%%%%%%%%%%%%%%%%%
9558
9559 %% Settings for Mechanical section%<<<1
9560 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
9561 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
9562 \ctikzset{bipoles/spring/height/.initial=.5}
9563 \ctikzset{bipoles/spring/width/.initial=.5}
9564 \ctikzset{bipoles/inerter/height/.initial=.7}
9565 \ctikzset{bipoles/inerter/width/.initial=.175}
9566 \ctikzset{bipoles/mass/height/.initial=.55}
9567 \ctikzset{bipoles/mass/box height/.initial=.4}
9568 \ctikzset{bipoles/mass/width/.initial=.5}
9569
9570 \ctikzset{bipoles/damper/height/.initial=.35}
9571 \ctikzset{bipoles/damper/length/.initial=.3}
9572 \ctikzset{bipoles/damper/width/.initial=.4}
9573 %%>>>
9574
9575 %% Node shapes Mechanical analog system%<<<
9576 %% mechanical capacitance - stiffness/spring
9577
9578 \pgfcircdeclarebipolescaled{mechanicals}
9579 {}
9580 {\ctikzvalof{bipoles/spring/height}}
9581 {spring}
9582 {\ctikzvalof{bipoles/spring/height}}
9583 {\ctikzvalof{bipoles/spring/width}}{
9584 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9585 \pgftransformationadjustments
9586
9587 \pgfmathsetlength{\pgf@circ@res@step}
9588 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
9589
9590 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
9591 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
9592 \pgf@circ@res@other = \pgf@circ@res@left
9593 \advance\pgf@circ@res@other by \pgf@circ@res@step
9594 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9595 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9596 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9597 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9598 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9599 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9600 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9601 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9602 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9603 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9604 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9605 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9606 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9607 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9608 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9609 \advance\pgf@circ@res@other by \pgf@circ@res@step
9610 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
9611 \pgfsetbuttcap
9612 \pgfsetbeveljoin
9613 \pgfusepath{stroke}
9614 }
9615
9616 %% mechanical capacitance - inerter
9617 \pgfcircdeclarebipolescaled{mechanicals}
9618 {}
9619 {\ctikzvalof{bipoles/inerter/height}}
9620 {inerter}
9621 {\ctikzvalof{bipoles/inerter/height}}
9622 {\ctikzvalof{bipoles/inerter/width}}
9623 {
9624 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9625 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9626 \pgf@circ@draworfill
9627 }
9628
9629
9630 %% mechanical inductance - mass
9631 \pgfcircdeclarebipolescaled{mechanicals}
9632 {}
9633 {\ctikzvalof{bipoles/mass/box height}}
9634 {mass}
9635 {\ctikzvalof{bipoles/mass/height}}
9636 {\ctikzvalof{bipoles/mass/width}}
9637 {
9638 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9639 \pgftransformationadjustments
9640 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9641 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
9642 \pgf@circ@draworfill
9643
9644 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9645 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9646 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9647 \pgfsetrectcap
9648 \pgfsetmiterjoin
9649 \pgfusepath{stroke}
9650 }
9651
9652 %% mechanical resistor - damper
9653 \pgfcircdeclarebipolescaled{mechanicals}
9654 {}
9655 {\ctikzvalof{bipoles/damper/height}}
9656 {damper}
9657 {\ctikzvalof{bipoles/damper/height}}
9658 {\ctikzvalof{bipoles/damper/width}}
9659 {
9660 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9661 \pgf@circ@maybefill
9662
9663 % line into the damper
9664 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9665 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9666 {\pgf@circ@res@zero}}
9667 \pgfusepath{stroke}
9668
9669 % damper box
9670 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9671 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9672 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9674 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9675
9676 \pgfsetrectcap
9677 \pgfsetmiterjoin
9678 \pgfusepath{stroke}
9679
9680 % damper vertical element
9681 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9682 {.8\pgf@circ@res@down}}
9683 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9684 {.8\pgf@circ@res@up}}
9685 \pgfsetbuttcap
9686 \pgfusepath{stroke}
9687
9688 }
9689 %% mechanical viscoelastic element, suggested by @alex
9690 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
9691 \pgfcircdeclarebipolescaled{mechanicals}
9692 {} % extra anchors
9693 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
9694 {viscoe} % name
9695 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
9696 {\ctikzvalof{bipoles/damper/width}} % width
9697 { % draw the bipole
9698 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9699 \pgf@circ@maybefill
9700
9701 % spring into the damper
9702 \pgfscope
9703 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9704 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9705 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
9706 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
9707 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
9708 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
9709 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
9710 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
9711 \pgfusepath{stroke}
9712 \endpgfscope
9713 % damper box
9714 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9715 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9716 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9717 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9718 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9719
9720 \pgfsetrectcap
9721 \pgfsetmiterjoin
9722 \pgfusepath{stroke}
9723
9724 % damper vertical element
9725 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9726 {.8\pgf@circ@res@down}}
9727 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9728 {.8\pgf@circ@res@up}}
9729 \pgfsetbuttcap
9730 \pgfusepath{stroke}
9731
9732 }
9733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9734 %% electromechanical device (motor/generator)
9735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9736
9737 \pgfdeclareshape{elmech}
9738 {
9739 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
9740 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9741 \savedanchor\northwest{
9742 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9743 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
9744 \pgf@y=.5\pgf@y
9745 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
9746 \pgf@x=.5\pgf@x
9747 }
9748 \anchor{center}{
9749 \pgfpointorigin
9750 }
9751 \anchor{text}{
9752 \pgfpointorigin
9753 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
9754 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
9755 }
9756 \anchor{left}{%
9757 \northwest
9758 \pgf@y=0pt
9759 }
9760 \anchor{right}{%
9761 \northwest
9762 \pgf@y=0pt
9763 \pgf@x=-\pgf@x
9764 }
9765 \anchor{top}{
9766 \northwest
9767 \pgf@x=0pt
9768 }
9769 \anchor{pathstart}{
9770 \northwest
9771 \pgf@x=0pt
9772 }
9773 \anchor{pathend}{
9774 \northwest
9775 \pgf@x=0pt
9776 \pgf@y=-\pgf@y
9777 }
9778 \anchor{bottom}{
9779 \northwest
9780 \pgf@x=0pt
9781 \pgf@y=-\pgf@y
9782 }
9783 \anchor{center}{
9784 \pgf@y=0pt
9785 \pgf@x=0pt
9786 }
9787 \anchor{east}{
9788 \northwest
9789 \pgf@y=0pt
9790 \pgf@x=-\pgf@x
9791 }
9792 \anchor{west}{
9793 \northwest
9794 \pgf@y=0pt
9795 }
9796 \anchor{south}{
9797 \northwest
9798 \pgf@x=0pt
9799 \pgf@y=-\pgf@y
9800 }
9801 \anchor{north}{
9802 \northwest
9803 \pgf@x=0pt
9804 }
9805 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
9806 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
9807 \anchor{north west}{ \northwest }
9808 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
9809 \anchorborder{%
9810 \@tempdima=\pgf@x\@tempdimb=\pgf@y
9811 \northwest\pgf@circ@res@other=-\pgf@x
9812 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
9813 }
9814 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
9815 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
9816 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
9817 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
9818 \anchor{block up right}{
9819 \northwest
9820 % remember that pgf@x is negative
9821 % center of the block is at 0.5*H+W*cos(30)/2
9822 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
9823 \pgf@x=-0.5\pgf@x
9824 }
9825 \anchor{block up left}{
9826 \northwest
9827 % remember that pgf@x is negative
9828 % center of the block is at 0.5*H+W*cos(30)/2
9829 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
9830 \pgf@x=0.5\pgf@x
9831 }
9832 \anchor{block down right}{
9833 \northwest
9834 % remember that pgf@x is negative
9835 % center of the block is at 0.5*H+W*cos(30)/2
9836 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
9837 \pgf@y=-\pgf@y
9838 \pgf@x=-0.5\pgf@x
9839 }
9840 \anchor{block down left}{
9841 \northwest
9842 % remember that pgf@x is negative
9843 % center of the block is at 0.5*H+W*cos(30)/2
9844 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
9845 \pgf@y=-\pgf@y
9846 \pgf@x=0.5\pgf@x
9847 }
9848 \behindbackgroundpath{
9849 \pgfsetcolor{\ctikzvalof{color}}
9850 \pgf@circ@scaled@Rlen=\scaledRlen
9851 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
9852 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
9853 \pgfscope
9854 \pgfstartlinewidth=\pgflinewidth
9855 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9856 \pgfscope % clip the bar: whole size minus the circle
9857 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
9858 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
9859 \pgfseteorule
9860 \pgfusepath{clip}
9861 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
9862 \pgfsetfillcolor{\ctikzvalof{color}}
9863 \pgfusepath{fill, draw}
9864 \endpgfscope
9865 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
9866 \ifx\tikz@fillcolor\pgfutil@empty
9867 % set the default fill color to white
9868 \pgfsetfillcolor{white}
9869 % ...but override it if the class is defined!
9870 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
9871 \else
9872 \pgfsetfillcolor{\tikz@fillcolor}
9873 \pgfusepath{draw, fill}
9874 \fi
9875 \endpgfscope
9876 }
9877 }
9878
9879 % %>>>
9880
9881 %% Path definitions for Mechanical%<<<
9882
9883 \pgf@circ@definetranspath{elmech}
9884 \pgfcirc@activate@bipole@simple{l}{spring}
9885 \pgfcirc@activate@bipole@simple{l}{inerter}
9886 \pgfcirc@activate@bipole@simple{l}{mass}
9887 \pgfcirc@activate@bipole@simple{l}{damper}
9888 \pgfcirc@activate@bipole@simple{l}{viscoe}
9889 % %>>>
9890
9891 %%%%%%%%%%%%%%%%%%%%%%%%%
9892 %% Miscellaneous bipoles
9893 %%%%%%%%%%%%%%%%%%%%%%%%%
9894
9895 % settings for microphone, loudspeaker, fuses and misc%<<<1
9896
9897 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
9898 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
9899 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
9900 \ctikzset{bipoles/mic/height/.initial=1.2}
9901 \ctikzset{bipoles/mic/depth/.initial=.1}
9902 \ctikzset{bipoles/mic/width/.initial=.8}%
9903
9904 % arresters, fuses, lamps, etc
9905
9906 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
9907 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
9908 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
9909 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
9910 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
9911 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
9912 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
9913 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
9914 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
9915 \ctikzset{bipoles/fuse/height/.initial=.20}
9916 \ctikzset{bipoles/fuse/width/.initial=.50}
9917 \ctikzset{bipoles/afuse/height/.initial=.20}
9918 \ctikzset{bipoles/afuse/width/.initial=.50}
9919 \ctikzset{bipoles/lamp/height/.initial=.60}
9920 \ctikzset{bipoles/lamp/width/.initial=.60}
9921 \ctikzset{bipoles/bulb/height/.initial=.8}
9922 \ctikzset{bipoles/bulb/width/.initial=.8}
9923 \ctikzset{bipoles/tline/height/.initial=.3}
9924 \ctikzset{bipoles/tline/width/.initial=.6}
9925 \ctikzset{bipoles/squid/height/.initial=.60}
9926 \ctikzset{bipoles/squid/width/.initial=.60}
9927 \ctikzset{bipoles/barrier/height/.initial=.60}
9928 \ctikzset{bipoles/barrier/width/.initial=.60}
9929 \ctikzset{bipoles/openbarrier/gap/.initial=0.5}
9930 \ctikzset{bipoles/thermocouple/height/.initial=.250}
9931 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
9932 \ctikzset{bipoles/thermocouple/width/.initial=.140}
9933 \newif\ifpgf@circuit@europeangfsurgearrester
9934 \ctikzset{gas filled surge arrester choice/.is choice}
9935 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
9936 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
9937
9938 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
9939 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
9940 %%>>>
9941
9942 %% Node shapes for miscellaneous symbols %<<<
9943 %% loudspeaker and microphone
9944
9945 \pgfcircdeclarebipolescaled{misc}
9946 {}
9947 {\ctikzvalof{bipoles/loudspeaker/depth}}
9948 {loudspeaker}
9949 {\ctikzvalof{bipoles/loudspeaker/height}}
9950 {\ctikzvalof{bipoles/loudspeaker/width}}{
9951
9952 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
9953 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9954 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
9955 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
9956 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
9957 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
9958 \pgfpathclose
9959 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9960 \pgf@circ@draworfill
9961 }
9962
9963 \pgfcircdeclarebipolescaled{misc}
9964 {}
9965 {\ctikzvalof{bipoles/mic/depth}}
9966 {mic}
9967 {\ctikzvalof{bipoles/mic/height}}
9968 {\ctikzvalof{bipoles/mic/width}}{
9969
9970 \pgfscope
9971 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9972 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
9973 \pgf@circ@draworfill
9974 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}}
9975 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
9976 \pgfusepath{draw}
9977 \endpgfscope
9978 \pgfscope
9979 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9980 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
9981 % 0.25358 is 0.6-0.4*cos(30)
9982 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
9983 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
9984 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
9985 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9986 \pgfusepath{draw}
9987
9988 \pgfusepath{draw}
9989 \endpgfscope
9990 }
9991
9992 %% european gas filled surge arrester
9993 \pgfcircdeclarebipolescaled{misc}
9994 {}
9995 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
9996 {european gas filled surge arrester}
9997 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
9998 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
9999 {
10000
10001 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10002 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10003
10004 \pgf@circ@draworfill
10005
10006 \pgfscope
10007 \pgfsetarrowsend{latexslim}
10008 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10009 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
10010 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10011 \pgfusepath{draw}
10012
10013 \endpgfscope
10014 }
10015
10016 %% american gas filled surge arrester
10017 \pgfcircdeclarebipolescaled{misc}
10018 {}
10019 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
10020 {american gas filled surge arrester}
10021 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
10022 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
10023
10024 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10025 \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up
10026 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
10027 \pgfusepath{draw}
10028
10029 \pgfscope
10030 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10031 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
10032 \pgf@circ@draworfill
10033 \endpgfscope
10034
10035 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
10036 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10037 \pgfusepath{draw}
10038
10039 \pgfscope
10040 \pgfsetarrowsend{latex}
10041
10042 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10043 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
10044 \pgfusepath{draw}
10045
10046 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10047 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
10048 \pgfusepath{draw}
10049 \endpgfscope{}
10050
10051 \pgfcircle{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/dot x}\pgf@circ@res@left}{\ctikzvalof{bipoles/american gas filled surge arrester/dot y}\pgf@circ@res@down}}{\ctikzvalof{bipoles/american gas filled surge arrester/size}\pgf@circ@res@down}
10052 \pgfusepath{fill}
10053 }
10054
10055 %% thermocouple
10056 \pgfcircdeclarebipolescaled{misc}
10057 {}
10058 {\ctikzvalof{bipoles/thermocouple/height 2}}
10059 {thermocouple}
10060 {\ctikzvalof{bipoles/thermocouple/height}}
10061 {\ctikzvalof{bipoles/thermocouple/width}}
10062 {
10063 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10064 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
10065 \pgfusepath{draw}
10066 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
10067 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10068 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
10069 \pgfusepath{draw}
10070 \pgfsetlinewidth{\pgfstartlinewidth}
10071 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
10072 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
10073 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10074 \pgfusepath{draw}
10075 }
10076
10077 %% fuse
10078 \pgfcircdeclarebipolescaled{misc}
10079 {}
10080 {\ctikzvalof{bipoles/fuse/height}}
10081 {fuse}
10082 {\ctikzvalof{bipoles/fuse/height}}
10083 {\ctikzvalof{bipoles/fuse/width}}
10084 {
10085 \pgfscope
10086 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10087 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10088 \pgf@circ@draworfill
10089 \endpgfscope
10090
10091 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10092 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10093 \pgfusepath{draw}
10094
10095 }
10096
10097 %% asymmetric fuse
10098 \pgfcircdeclarebipolescaled{misc}
10099 {}
10100 {\ctikzvalof{bipoles/afuse/height}}
10101 {afuse}
10102 {\ctikzvalof{bipoles/afuse/height}}
10103 {\ctikzvalof{bipoles/afuse/width}}
10104 {
10105 \pgfscope
10106 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10107 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10108 \pgf@circ@draworfill
10109 \endpgfscope
10110
10111 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10112 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10113 \pgfusepath{draw}
10114
10115 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10116 \pgfusepath{stroke,fill}
10117 }
10118
10119 %% SQUID added by Cor Molenaar 5 March 2010
10120 \pgfcircdeclarebipolescaled{misc}
10121 {}
10122 {\ctikzvalof{bipoles/squid/height}}
10123 {squid}
10124 {\ctikzvalof{bipoles/squid/height}}
10125 {\ctikzvalof{bipoles/squid/width}}
10126 {
10127 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10128
10129 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10130 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
10131 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
10132 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
10133 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
10134 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
10135 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
10136 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
10137 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
10138
10139 \pgfusepath{draw}
10140 }
10141
10142 % Generic barrier added by Cor Molenaar 5 March 2010
10143 \pgfcircdeclarebipolescaled{misc}
10144 {}
10145 {\ctikzvalof{bipoles/barrier/height}}
10146 {barrier}
10147 {\ctikzvalof{bipoles/barrier/height}}
10148 {\ctikzvalof{bipoles/barrier/width}}
10149 {
10150 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10151
10152 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
10153 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
10154 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
10155 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
10156 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
10157 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
10158
10159 \pgfusepath{draw}
10160 }
10161
10162 %
10163 % open version of the barrier symbol
10164 % suggested by Radványi Patrik Tamás <[email protected]>
10165 %
10166 \pgfcircdeclarebipolescaled{misc}
10167 {}
10168 {\ctikzvalof{bipoles/barrier/height}}
10169 {openbarrier}
10170 {\ctikzvalof{bipoles/barrier/height}}
10171 {\ctikzvalof{bipoles/barrier/width}}
10172 {
10173 % this is set with normal wire linewidth
10174 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10175 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}}
10176 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10177 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}}
10178 \pgfusepath{draw}
10179
10180 % do the cross part
10181 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10182
10183 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
10184 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
10185 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
10186 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
10187
10188 \pgfusepath{draw}
10189 }
10190 %% Lamp
10191 \pgfcircdeclarebipolescaled{misc}
10192 {}
10193 {\ctikzvalof{bipoles/lamp/height}}
10194 {lamp}
10195 {\ctikzvalof{bipoles/lamp/height}}
10196 {\ctikzvalof{bipoles/lamp/width}}
10197 {
10198 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10199
10200 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10201 \pgf@circ@draworfill
10202 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
10203 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
10204 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
10205 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
10206 \pgfusepath{draw}
10207 }
10208
10209 %% bulb
10210 \pgfcircdeclarebipolescaled{misc}
10211 {}
10212 {\ctikzvalof{bipoles/bulb/height}}
10213 {bulb}
10214 {\ctikzvalof{bipoles/bulb/height}}
10215 {\ctikzvalof{bipoles/bulb/width}}
10216 {%
10217 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10218 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
10219 \pgf@circ@draworfill
10220 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10221 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
10222 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
10223 \pgfsetbeveljoin
10224 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10225 \pgfusepath{draw}
10226 }% %>>>
10227
10228 %% Path definitions for Miscellaneous%<<<
10229
10230 \pgfcirc@activate@bipole@simple{l}{lamp}
10231 \pgfcirc@activate@bipole@simple{l}{bulb}
10232 \pgfcirc@activate@bipole@simple{l}{squid}
10233 \pgfcirc@activate@bipole@simple{l}{barrier}
10234 \pgfcirc@activate@bipole@simple{l}{openbarrier}
10235 \pgfcirc@activate@bipole@simple{l}{thermocouple}
10236 \pgfcirc@activate@bipole@simple{l}{fuse}
10237 \pgfcirc@activate@bipole{l}{afuse}{afuse}{asymmetric fuse}
10238 \pgfcirc@style@to@style{asymmetric fuse}{afuse}
10239 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
10240 \pgfcirc@activate@bipole{l}{europeangfsurgearrester}{european gas filled surge arrester}{european gas filled surge arrester}
10241 \pgfcirc@activate@bipole{l}{americangfsurgearrester}{american gas filled surge arrester}{american gas filled surge arrester}
10242 \pgfcirc@path@to@style{l}{gfsurgearrester}{gas filled surge arrester}{}
10243 \pgfcirc@path@to@style{l}{gfsurgearrester}{gf surge arrester}{}
10244 \pgfcirc@activate@bipole@simple{l}{mic}
10245 \pgfcirc@activate@bipole@simple{l}{loudspeaker}
10246 % %>>>
10247
10248 % end of pgfcircbipoles.tex
10249 % vim: set fdm=marker fmr=%<<<,%>>>:
10250 %%%---------- close: tex/pgfcircbipoles
10251 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
10252 %%%---------- open: tex/pgfcirctripoles.tex
10253 % Copyright 2018-2026 by Romano Giannetti
10254 % Copyright 2015-2026 by Stefan Lindner
10255 % Copyright 2013-2026 by Stefan Erhardt
10256 % Copyright 2007-2026 by Massimo Redaelli
10257 %
10258 % This file may be distributed and/or modified
10259 %
10260 % 1. under the LaTeX Project Public License and/or
10261 % 2. under the GNU Public License.
10262 %
10263 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
10264
10265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10266 %% Tripoles
10267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10268
10269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10270 %% Logic Ports
10271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10272
10273 %% Settings for Logic ports%<<<1
10274 %% beware that the third option is in IEEE ports in pgfcircmultipoles.tex
10275
10276 % switches for logic gates
10277 %
10278 \pgfkeys{/tikz/number inputs/.initial=0}
10279 \pgfkeys{/tikz/number inputs/.default=0}
10280
10281 \newif\ifpgf@circuit@europeanlogicport
10282 \ctikzset{logic ports/.is choice}
10283 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
10284 \tikzset{and port/.style={shape=european and port}}%
10285 \tikzset{or port/.style={shape=european or port}}%
10286 \tikzset{xor port/.style={shape=european xor port}}%
10287 \tikzset{buffer port/.style={shape=european buffer port}}%
10288 \tikzset{not port/.style={shape=european not port}}%
10289 \tikzset{nand port/.style={shape=european nand port}}%
10290 \tikzset{nor port/.style={shape=european nor port}}%
10291 \tikzset{xnor port/.style={shape=european xnor port}}%
10292 % there is no Schmitt ports in european style (yet)
10293 \tikzset{schmitt port/.style={shape=schmitt}}%
10294 \tikzset{invschmitt port/.style={shape=invschmitt}}%
10295 }}
10296 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
10297 \tikzset{and port/.style={shape=american and port}}%
10298 \tikzset{or port/.style={shape=american or port}}%
10299 \tikzset{xor port/.style={shape=american xor port}}%
10300 \tikzset{buffer port/.style={shape=american buffer port}}%
10301 \tikzset{not port/.style={shape=american not port}}%
10302 \tikzset{nand port/.style={shape=american nand port}}%
10303 \tikzset{nor port/.style={shape=american nor port}}%
10304 \tikzset{xnor port/.style={shape=american xnor port}}%
10305 \tikzset{schmitt port/.style={shape=schmitt}}%
10306 \tikzset{invschmitt port/.style={shape=invschmitt}}%
10307 }}
10308
10309 \ctikzset{logic ports origin/.is choice}
10310 \ctikzset{logic ports origin/legacy/.code={
10311 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
10312 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
10313 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
10314 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
10315 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
10316 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
10317 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
10318 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
10319 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
10320 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
10321 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
10322 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
10323 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
10324 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
10325 }%
10326 }
10327 \ctikzset{logic ports origin/center/.code={%
10328 \ctikzset{tripoles/american and port/origin/.initial=0}%
10329 \ctikzset{tripoles/american nand port/origin/.initial=0}%
10330 \ctikzset{tripoles/american nor port/origin/.initial=0}%
10331 \ctikzset{tripoles/american or port/origin/.initial=0}%
10332 \ctikzset{tripoles/american xor port/origin/.initial=0}%
10333 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
10334 \ctikzset{tripoles/european and port/origin/.initial=0}%
10335 \ctikzset{tripoles/european nand port/origin/.initial=0}%
10336 \ctikzset{tripoles/european or port/origin/.initial=0}%
10337 \ctikzset{tripoles/european nor port/origin/.initial=0}%
10338 \ctikzset{tripoles/european xor port/origin/.initial=0}%
10339 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
10340 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
10341 \ctikzset{tripoles/european not port/origin/.initial=0}%
10342 }%
10343 }
10344
10345 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
10346 \ctikzset{american or shape/.is choice}
10347 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
10348 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
10349
10350 \newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue
10351 \ctikzset{logic ports draw input leads/.is choice}
10352 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}}
10353 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}}
10354 \tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}}
10355 \tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}}
10356
10357 \newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue
10358 \ctikzset{logic ports draw output leads/.is choice}
10359 \ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}}
10360 \ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}}
10361 \tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}}
10362 \tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}}
10363
10364 \ctikzset{logic ports draw leads/.is choice}
10365 \ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
10366 \ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
10367 \tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
10368 \tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
10369
10370 % adding a different style of xnor port
10371 % see https://github.com/circuitikz/circuitikz/issues/467
10372 \ctikzset{european xnor style/.is choice}
10373 \ctikzset{european xnor style/default/.code={%
10374 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}%
10375 }
10376 \ctikzset{european xnor style/direct/.code={%
10377 \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}%
10378 }
10379
10380
10381 % old, legacy keys that should be killed over
10382 \ctikzset{bipoles/buffer/height/.initial=1}
10383 \ctikzset{bipoles/buffer/width/.initial=1}
10384 \ctikzset{bipoles/not port/width/.initial=1}
10385 \ctikzset{bipoles/not port/height/.initial=.8}
10386 \ctikzset{bipoles/not port/circle width/.initial=.15}
10387
10388 \ctikzset{tripoles/american and port/width/.initial=1.1}
10389 \ctikzset{tripoles/american and port/height/.initial=.8}
10390 \ctikzset{tripoles/american and port/port width/.initial=.7}
10391 \ctikzset{tripoles/american and port/input height/.initial=.5}
10392 \ctikzset{tripoles/american nand port/width/.initial=1.1}
10393 \ctikzset{tripoles/american nand port/height/.initial=.8}
10394 \ctikzset{tripoles/american nand port/port width/.initial=.7}
10395 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
10396 \ctikzset{tripoles/american nand port/input height/.initial=.5}
10397 \ctikzset{tripoles/american or port/width/.initial=1.1}
10398 \ctikzset{tripoles/american or port/height/.initial=.8}
10399 \ctikzset{tripoles/american or port/port width/.initial=.7}
10400 \ctikzset{tripoles/american or port/input height/.initial=.5}
10401 \ctikzset{tripoles/american or port/input skip/.initial=.25}
10402 \ctikzset{tripoles/american or port/aaa/.initial=.6}
10403 \ctikzset{tripoles/american or port/bbb/.initial=.4}
10404 \ctikzset{tripoles/american or port/ccc/.initial=.5}
10405 \ctikzset{tripoles/american or port/ddd/.initial=.0}
10406 \ctikzset{tripoles/american nor port/width/.initial=1.1}
10407 \ctikzset{tripoles/american nor port/height/.initial=.8}
10408 \ctikzset{tripoles/american nor port/port width/.initial=.7}
10409 \ctikzset{tripoles/american nor port/input height/.initial=.5}
10410 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
10411 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
10412 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
10413 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
10414 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
10415 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
10416 \ctikzset{tripoles/american xor port/width/.initial=1.1}
10417 \ctikzset{tripoles/american xor port/height/.initial=.8}
10418 \ctikzset{tripoles/american xor port/port width/.initial=.7}
10419 \ctikzset{tripoles/american xor port/input height/.initial=.5}
10420 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
10421 \ctikzset{tripoles/american xor port/distance/.initial=.1}
10422 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
10423 \ctikzset{tripoles/american xnor port/height/.initial=.8}
10424 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
10425 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
10426 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
10427 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
10428 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
10429 \ctikzset{tripoles/american and port/origin/.initial=0.8}
10430 \ctikzset{tripoles/american and port/inputs/.initial=2}
10431 % variable number of inputs
10432 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
10433 \ctikzset{tripoles/american nand port/inputs/.initial=2}
10434 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
10435 \ctikzset{tripoles/american nor port/inputs/.initial=2}
10436 \ctikzset{tripoles/american nor port/angle/.initial=70}
10437 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
10438 \ctikzset{tripoles/american or port/origin/.initial=0.8}
10439 \ctikzset{tripoles/american or port/inputs/.initial=2}
10440 \ctikzset{tripoles/american or port/angle/.initial=70}
10441 \ctikzset{tripoles/american or port/inner/.initial=0.3}
10442 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
10443 \ctikzset{tripoles/american xor port/inputs/.initial=2}
10444 \ctikzset{tripoles/american xor port/angle/.initial=70}
10445 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
10446 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
10447 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
10448 \ctikzset{tripoles/american xnor port/angle/.initial=70}
10449 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
10450
10451 \ctikzset{tripoles/european and port/width/.initial=1.4}
10452 \ctikzset{tripoles/european and port/height/.initial=.65}
10453 \ctikzset{tripoles/european and port/reserved/.initial=.6}
10454 \ctikzset{tripoles/european and port/input height/.initial=.6}
10455 \ctikzset{tripoles/european or port/width/.initial=1.4}
10456 \ctikzset{tripoles/european or port/height/.initial=.65}
10457 \ctikzset{tripoles/european or port/reserved/.initial=.6}
10458 \ctikzset{tripoles/european or port/input height/.initial=.6}
10459 \ctikzset{tripoles/european xor port/width/.initial=1.4}
10460 \ctikzset{tripoles/european xor port/height/.initial=.65}
10461 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
10462 \ctikzset{tripoles/european xor port/input height/.initial=.6}
10463 \ctikzset{tripoles/european nand port/width/.initial=1.4}
10464 \ctikzset{tripoles/european nand port/not height/.initial=.3}
10465 \ctikzset{tripoles/european nand port/not width/.initial=.8}
10466 \ctikzset{tripoles/european nand port/height/.initial=.65}
10467 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
10468 \ctikzset{tripoles/european nand port/input height/.initial=.6}
10469 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
10470 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
10471 \ctikzset{tripoles/european buffer port/not width/.initial=.8}
10472 \ctikzset{tripoles/european buffer port/height/.initial=.65}
10473 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
10474 \ctikzset{tripoles/european buffer port/input height/.initial=0}
10475 \ctikzset{tripoles/european not port/width/.initial=1.4}
10476 \ctikzset{tripoles/european not port/not height/.initial=.3}
10477 \ctikzset{tripoles/european not port/not width/.initial=.8}
10478 \ctikzset{tripoles/european not port/height/.initial=.65}
10479 \ctikzset{tripoles/european not port/reserved/.initial=.6}
10480 \ctikzset{tripoles/european not port/input height/.initial=0}
10481 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
10482 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
10483 \ctikzset{tripoles/european xnor port/not width/.initial=.8}
10484 \ctikzset{tripoles/european xnor port/height/.initial=.65}
10485 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
10486 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
10487 \ctikzset{tripoles/european nor port/width/.initial=1.4}
10488 \ctikzset{tripoles/european nor port/not height/.initial=.3}
10489 \ctikzset{tripoles/european nor port/not width/.initial=.8}
10490 \ctikzset{tripoles/european nor port/height/.initial=.65}
10491 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
10492 \ctikzset{tripoles/european nor port/input height/.initial=.6}
10493 % variable number of inputs
10494 \ctikzset{tripoles/european and port/origin/.initial=0.8}
10495 \ctikzset{tripoles/european and port/inputs/.initial=2}
10496 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
10497 \ctikzset{tripoles/european nand port/inputs/.initial=2}
10498 \ctikzset{tripoles/european or port/origin/.initial=0.8}
10499 \ctikzset{tripoles/european or port/inputs/.initial=2}
10500 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
10501 \ctikzset{tripoles/european nor port/inputs/.initial=2}
10502 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
10503 \ctikzset{tripoles/european xor port/inputs/.initial=2}
10504 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
10505 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
10506 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
10507 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
10508 \ctikzset{tripoles/european not port/origin/.initial=0.8}
10509 \ctikzset{tripoles/european not port/inputs/.initial=1}%
10510 %%% parameters that are not used anymore after multi-input
10511 %%% gates --- left for compatibility of source code.
10512 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
10513 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
10514 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
10515 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
10516 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
10517 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
10518 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
10519 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
10520 %%>>>
10521
10522 %% Node shapes for Logic ports%<<<
10523 %%
10524 %% Code from John Kormylo at tex.stackexchange.com
10525 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
10526 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
10527 %%
10528
10529 \newcount\pgf@circ@res@count% reserve global register
10530
10531 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
10532 {%
10533 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10534 \step
10535 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10536 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10537 }%
10538
10539 % #1 = \pgfmathcounter #2=type #3 specificic port
10540 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
10541 \def\pgf@circ@logicport@baseinput#1#2#3%
10542 {%
10543 % and and nand
10544 \ifnum #2=1\relax
10545 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10546 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10547 \step
10548 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10549 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10550 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
10551 \fi
10552 % or and nor
10553 \ifnum #2=2\relax
10554 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10555 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10556 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10557 \step
10558 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10559 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10560 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
10561 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10562 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10563 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10564 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10565 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10566 \pgf@circ@res@temp=\pgf@y
10567 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10568 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10569 \pgf@x=\pgf@circ@res@other
10570 \fi
10571 % xor and xnor
10572 \ifnum #2=3\relax
10573 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10574 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10575 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10576 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
10577 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10578 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10579 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10580 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10581 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10582 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
10583 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10584 % this compensates for the effect of the line width on the gap between the arcs
10585 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10586 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10587
10588 \step
10589 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10590 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10591 \pgf@circ@res@temp=\pgf@y
10592 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10593 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10594 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10595 \pgf@x=\pgf@circ@res@other
10596 \fi
10597 % european
10598 \ifnum #2=4\relax
10599 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10600 \pgfextractx{\pgf@circ@res@other}{\left}%
10601 \step
10602 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10603 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10604 \pgf@x=\pgf@circ@res@other
10605 \fi
10606 }%
10607
10608 %%% american
10609 \long\def\pgfcircdeclarelogicport#1#2#3{%
10610 \pgfdeclareshape{american #1 port}%
10611 {%
10612 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10613 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10614 \savedmacro\resize{% automatic
10615 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10616 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10617 \pgf@circ@res@up = .5\pgf@circ@res@up
10618 \pgf@circ@res@down = -\pgf@circ@res@up
10619 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
10620 \pgf@circ@res@right = .5\pgf@circ@res@right
10621 \pgf@circ@res@left = -\pgf@circ@res@right
10622 }%
10623 \savedmacro\inputs{% get number of inputs
10624 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
10625 \ifnum\pgf@circ@res@count=0
10626 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
10627 \fi
10628 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
10629 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
10630 \def\inputs{\the\pgf@circ@res@count}%
10631 }%
10632 \savedanchor\step{% 1/2 gap at edges
10633 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10634 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10635 \divide\pgf@circ@res@step by \pgf@circ@res@count
10636 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
10637 }%
10638 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10639 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10640 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
10641 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
10642 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
10643
10644 \anchor{center}{\origin}% for backwards compatibility
10645 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
10646
10647 % create input anchors
10648 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
10649 \pgfmathloop%
10650 \ifnum\pgfmathcounter>\pgf@circ@res@count%
10651 \else%
10652 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
10653 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
10654 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
10655 }%
10656 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
10657 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
10658 }%
10659 %}{}%
10660 \repeatpgfmathloop%
10661 }
10662
10663 \anchor{out}{\northeast\pgf@y=0pt}
10664 \anchor{bout}{\right\pgf@y=0pt}
10665
10666
10667 \anchor{left}{\left}% edges of component minus leads
10668 \anchor{right}{\right}
10669
10670 \anchor{north east}{\northeast}% see \Compass macro
10671 \anchor{south west}{\southwest}
10672 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10673 \pgfpoint{0cm}{\pgf@circ@res@up}}
10674 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10675 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10676 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10677 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
10678 \pgfpoint{\pgf@circ@res@left}{0cm}}
10679 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10680 \pgfpoint{0cm}{\pgf@circ@res@down}}
10681 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10682 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10683 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10684 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
10685 \pgfpoint{\pgf@circ@res@right}{0cm}}
10686
10687 \backgroundpath{
10688 \pgfsetcolor{\ctikzvalof{color}}
10689 #3
10690 }
10691 }
10692 }
10693 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10694 \pgfcircdeclarelogicport{and}{1}{
10695 \pgfextracty{\pgf@circ@res@temp}{\step}%
10696 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10697 \pgf@circ@res@count = \inputs\relax
10698 \ifpgfcirc@draw@input@leads
10699 %input leads
10700 \loop\ifnum\pgf@circ@res@count>0
10701 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10702 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10703 \pgfpathlineto{\pgfpoint
10704 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
10705 {\pgf@circ@res@temp}}
10706 \advance\pgf@circ@res@count by -1
10707 \repeat
10708 \fi
10709 % output lead
10710 \ifpgfcirc@draw@output@leads
10711 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10712 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}}
10713 \pgfusepath{draw}
10714 \fi
10715
10716
10717 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10718 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
10719
10720 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10721 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10722 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
10723 \pgfpathclose
10724 \pgf@circ@draworfill
10725 }
10726 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10727 \pgfcircdeclarelogicport{nand}{1}{
10728 \pgfextracty{\pgf@circ@res@temp}{\step}%
10729 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10730 \pgf@circ@res@count = \inputs\relax
10731 \ifpgfcirc@draw@input@leads
10732 %input leads
10733 \loop\ifnum\pgf@circ@res@count>0
10734 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10735 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10736 \pgfpathlineto{\pgfpoint
10737 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
10738 {\pgf@circ@res@temp}}
10739 \advance\pgf@circ@res@count by -1
10740 \repeat
10741 \fi
10742
10743 \ifpgfcirc@draw@output@leads
10744 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10745 \pgfpathlineto{\pgfpoint
10746 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
10747 \pgfusepath{draw}
10748 \fi
10749 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10750 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
10751 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
10752 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10753
10754 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10755 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10756 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
10757 \pgfpathclose
10758
10759 \pgfpathellipse
10760 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
10761 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10762 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10763
10764 \pgf@circ@draworfill
10765 }
10766 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10767 \pgfcircdeclarelogicport{nor}{2}{
10768 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
10769 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
10770 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10771 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10772 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
10773 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10774
10775 \pgfextracty{\pgf@circ@res@temp}{\step}%
10776 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10777 \pgf@circ@res@count = \inputs\relax
10778 \ifpgfcirc@draw@input@leads
10779 %input leads
10780 \loop\ifnum\pgf@circ@res@count>0
10781 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10782 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10783 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10784 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10785 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10786 \advance\pgf@circ@res@count by -1
10787 \repeat
10788 \fi
10789
10790 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
10791 \ifpgfcirc@draw@output@leads
10792 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10793 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10794 \pgfusepath{draw}
10795 \fi
10796
10797 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10798
10799 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
10800 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
10801 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10802 \advance\pgf@circ@res@other by -\pgf@circ@res@step
10803
10804 % main shape
10805 \ifpgfcirc@roundy@or@shapes
10806 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10807 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10808 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10809 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10810 \pgfpathclose
10811 \else
10812 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10813 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10814 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10815 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}}
10816 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10817 \pgfpathclose
10818 \fi
10819
10820 % not dot
10821 \pgfpathellipse
10822 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
10823 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10824 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10825
10826 \pgf@circ@draworfill
10827 }
10828 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10829 \pgfcircdeclarelogicport{or}{2}{
10830 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
10831 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
10832 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10833 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10834 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
10835 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10836
10837 \pgfextracty{\pgf@circ@res@temp}{\step}%
10838 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10839 \pgf@circ@res@count = \inputs\relax
10840 \ifpgfcirc@draw@input@leads
10841 %input leads
10842 \loop\ifnum\pgf@circ@res@count>0
10843 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10844 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10845 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10846 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10847 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10848 \advance\pgf@circ@res@count by -1
10849 \repeat
10850 \fi
10851
10852 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
10853 \ifpgfcirc@draw@output@leads
10854 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10855 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10856 \pgfusepath{draw}
10857 \fi
10858
10859 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10860
10861 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
10862
10863 % main shape
10864 \ifpgfcirc@roundy@or@shapes
10865 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10866 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10867 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10868 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10869 \pgfpathclose
10870 \else
10871 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10872 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10873 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10874 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}}
10875 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10876 \pgfpathclose
10877 \fi
10878
10879 \pgf@circ@draworfill
10880 }
10881 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10882 \pgfcircdeclarelogicport{xor}{3}{
10883 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
10884 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
10885 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10886 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10887 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
10888 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10889 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
10890 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10891 % this compensates for the effect of the line width on the gap between the arcs
10892 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10893 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10894
10895 \pgfextracty{\pgf@circ@res@temp}{\step}%
10896 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10897 \pgf@circ@res@count = \inputs\relax
10898 \ifpgfcirc@draw@input@leads
10899 %input leads
10900 \loop\ifnum\pgf@circ@res@count>0
10901 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10902 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10903 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10904 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10905 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10906 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10907 \advance\pgf@circ@res@count by -1
10908 \repeat
10909 \fi
10910
10911 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
10912 \ifpgfcirc@draw@output@leads
10913 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10914 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10915 \pgfusepath{draw}
10916 \fi
10917
10918 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10919
10920 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
10921
10922 % main shape
10923 \ifpgfcirc@roundy@or@shapes
10924 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10925 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10926 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10927 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10928 \pgfpathclose
10929 \else
10930 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10931 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10932 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10933 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}}
10934 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10935 \pgfpathclose
10936 \fi
10937 \pgf@circ@draworfill
10938
10939 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
10940
10941 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
10942 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
10943
10944 \pgfusepath{draw}
10945 }
10946 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10947 \pgfcircdeclarelogicport{xnor}{3}{
10948 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
10949 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
10950 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10951 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10952 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
10953 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10954 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
10955 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10956 % this compensates for the effect of the line width on the gap between the arcs
10957 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10958 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10959
10960 \pgfextracty{\pgf@circ@res@temp}{\step}%
10961 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10962 \pgf@circ@res@count = \inputs\relax
10963 \ifpgfcirc@draw@input@leads
10964 %input leads
10965 \loop\ifnum\pgf@circ@res@count>0
10966 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10967 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10968 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10969 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10970 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10971 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10972 \advance\pgf@circ@res@count by -1
10973 \repeat
10974 \fi
10975
10976 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
10977 \ifpgfcirc@draw@output@leads
10978 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10979 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10980 \pgfusepath{draw}
10981 \fi
10982
10983 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10984
10985 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
10986 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
10987 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10988 \advance\pgf@circ@res@other by -\pgf@circ@res@step
10989
10990 % main shape
10991 \ifpgfcirc@roundy@or@shapes
10992 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10993 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10994 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10995 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10996 \pgfpathclose
10997 \else
10998 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10999 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11000 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11001 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@other}{0pt}}
11002 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@right}{0.5\pgf@circ@res@up}}{\pgfpoint{0.3\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11003 \pgfpathclose
11004 \fi
11005
11006 \pgfpathellipse
11007 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
11008 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
11009 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
11010 \pgf@circ@draworfill
11011
11012 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
11013 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
11014
11015 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
11016 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
11017
11018 \pgfusepath{draw}
11019 }
11020
11021 %%% Original one-input ports
11022
11023 \pgfdeclareshape{american not port}{
11024 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11025 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11026 \anchor{center}{\pgfpointorigin}
11027 \savedanchor\northwest{%
11028 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11029 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11030 \pgf@y=.5\pgf@y
11031 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11032 \pgf@x=.5\pgf@x
11033 }
11034 \anchor{in}{
11035 \northwest
11036 \pgf@y=0pt
11037 }
11038 \anchor{in 1}{
11039 \northwest
11040 \pgf@y=0pt
11041 }
11042 \anchor{left}{
11043 \northwest
11044 \pgf@x=0.7\pgf@x
11045 \pgf@y=0pt
11046 }
11047 \anchor{bin}{
11048 \northwest
11049 \pgf@x=0.7\pgf@x
11050 \pgf@y=0pt
11051 }
11052 \anchor{bin 1}{
11053 \northwest
11054 \pgf@y=0pt
11055 \pgf@x=0.7\pgf@x
11056 }
11057 \anchor{out}{
11058 \northwest
11059 \pgf@y=0pt
11060 \pgf@x=-\pgf@x
11061 }
11062 \anchor{right}{
11063 \northwest
11064 \pgf@y=0pt
11065 \pgf@x=-0.7\pgf@x
11066 }
11067 \anchor{bout}{
11068 \northwest
11069 \pgf@y=0pt
11070 \pgf@x=-0.7\pgf@x
11071 }
11072 \anchor{center}{
11073 \pgfpointorigin
11074 }
11075 \anchor{east}{
11076 \northwest
11077 \pgf@y=0pt
11078 \pgf@x=-\pgf@x
11079 }
11080 \anchor{west}{
11081 \northwest
11082 \pgf@y=0pt
11083 }
11084 \anchor{south}{
11085 \northwest
11086 \pgf@x=0pt
11087 \pgf@y=-\pgf@y
11088 }
11089 \anchor{north}{
11090 \northwest
11091 \pgf@x=0pt
11092 }
11093 \anchor{south west}{
11094 \northwest
11095 \pgf@y=-\pgf@y
11096 }
11097 \anchor{north east}{
11098 \northwest
11099 \pgf@x=-\pgf@x
11100 }
11101 \anchor{north west}{
11102 \northwest
11103 }
11104 \anchor{south east}{
11105 \northwest
11106 \pgf@x=-\pgf@x
11107 \pgf@y=-\pgf@y
11108 }
11109 \anchorborder{% this is used when the node is used as a path element
11110 \pgf@xa=\pgf@x
11111 \pgf@ya=\pgf@y
11112 \pgfextracty{\pgf@circ@res@up}{\northwest}
11113 \pgfextractx{\pgf@circ@res@left}{\northwest}
11114 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11115 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11116 }
11117 \anchor{text}{%
11118 % centered and a bit to the left (it's a triangle)!
11119 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11120 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11121 }
11122 \backgroundpath{
11123 \pgfsetcolor{\ctikzvalof{color}}
11124
11125 \northwest
11126 \pgf@circ@res@up = \pgf@y
11127 \pgf@circ@res@down = -\pgf@y
11128 \pgf@circ@res@right = -\pgf@x
11129 \pgf@circ@res@left = \pgf@x
11130
11131 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11132
11133 \pgfscope
11134 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11135 \pgftransformxshift{.7\pgf@circ@res@left}
11136 \pgf@circ@res@step=\pgf@circ@res@right
11137 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11138 \pgf@circ@res@step=.7\pgf@circ@res@step
11139
11140 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11141 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11142 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11143 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11144 \pgf@circ@draworfill
11145 \pgfpathellipse
11146 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11147 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11148 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11149 \pgf@circ@draworfill
11150 \endpgfscope
11151
11152 \ifpgfcirc@draw@input@leads
11153 %input leads
11154 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11155 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11156 \fi
11157
11158 \ifpgfcirc@draw@output@leads
11159 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11160 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11161 \fi
11162
11163 \pgfusepath{draw}
11164 }
11165 }
11166
11167 \pgfdeclareshape{american buffer port}{
11168 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11169 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11170 \anchor{center}{\pgfpointorigin}
11171 \savedanchor\northwest{%
11172 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11173 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11174 \pgf@y=.5\pgf@y
11175 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11176 \pgf@x=.5\pgf@x
11177 }
11178 \anchor{in}{
11179 \northwest
11180 \pgf@y=0pt
11181 }
11182 \anchor{in 1}{
11183 \northwest
11184 \pgf@y=0pt
11185 }
11186 \anchor{left}{
11187 \northwest
11188 \pgf@x=0.7\pgf@x
11189 \pgf@y=0pt
11190 }
11191 \anchor{bin}{
11192 \northwest
11193 \pgf@x=0.7\pgf@x
11194 \pgf@y=0pt
11195 }
11196 \anchor{bin 1}{
11197 \northwest
11198 \pgf@y=0pt
11199 \pgf@x=0.7\pgf@x
11200 }
11201 \anchor{out}{
11202 \northwest
11203 \pgf@y=0pt
11204 \pgf@x=-\pgf@x
11205 }
11206 \anchor{right}{
11207 \northwest
11208 \pgf@y=0pt
11209 \pgf@x=-0.7\pgf@x
11210 }
11211 \anchor{bout}{
11212 \northwest
11213 \pgf@y=0pt
11214 \pgf@x=-0.7\pgf@x
11215 }
11216 \anchor{center}{
11217 \pgfpointorigin
11218 }
11219 \anchor{east}{
11220 \northwest
11221 \pgf@y=0pt
11222 \pgf@x=-\pgf@x
11223 }
11224 \anchor{west}{
11225 \northwest
11226 \pgf@y=0pt
11227 }
11228 \anchor{south}{
11229 \northwest
11230 \pgf@x=0pt
11231 \pgf@y=-\pgf@y
11232 }
11233 \anchor{north}{
11234 \northwest
11235 \pgf@x=0pt
11236 }
11237 \anchor{south west}{
11238 \northwest
11239 \pgf@y=-\pgf@y
11240 }
11241 \anchor{north east}{
11242 \northwest
11243 \pgf@x=-\pgf@x
11244 }
11245 \anchor{north west}{
11246 \northwest
11247 }
11248 \anchor{south east}{
11249 \northwest
11250 \pgf@x=-\pgf@x
11251 \pgf@y=-\pgf@y
11252 }
11253 \anchorborder{% this is used when the node is used as a path element
11254 \pgf@xa=\pgf@x
11255 \pgf@ya=\pgf@y
11256 \pgfextracty{\pgf@circ@res@up}{\northwest}
11257 \pgfextractx{\pgf@circ@res@left}{\northwest}
11258 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11259 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11260 }
11261 \anchor{text}{%
11262 % centered and a bit to the left (it's a triangle)!
11263 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11264 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11265 }
11266 \backgroundpath{
11267 \pgfsetcolor{\ctikzvalof{color}}
11268
11269 \northwest
11270 \pgf@circ@res@up = \pgf@y
11271 \pgf@circ@res@down = -\pgf@y
11272 \pgf@circ@res@right = -\pgf@x
11273 \pgf@circ@res@left = \pgf@x
11274
11275 \pgfscope
11276 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11277 \pgftransformxshift{.7\pgf@circ@res@left}
11278 \pgf@circ@res@step=\pgf@circ@res@right
11279 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11280 \pgf@circ@res@step=.7\pgf@circ@res@step
11281
11282 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11283 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11284 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11285 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11286 \pgf@circ@draworfill
11287 \endpgfscope
11288
11289 \ifpgfcirc@draw@input@leads
11290 %input leads
11291 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11292 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11293 \fi
11294
11295 \ifpgfcirc@draw@output@leads
11296 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11297 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11298 \fi
11299
11300 \pgfusepath{draw}
11301 }
11302 }
11303 \pgfdeclareshape{invschmitt}{
11304 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11305 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11306 \anchor{center}{\pgfpointorigin}
11307 \savedanchor\northwest{%
11308 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11309 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11310 \pgf@y=.5\pgf@y
11311 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11312 \pgf@x=.5\pgf@x
11313 }
11314 \anchor{in}{
11315 \northwest
11316 \pgf@y=0pt
11317 }
11318 \anchor{in 1}{
11319 \northwest
11320 \pgf@y=0pt
11321 }
11322 \anchor{left}{
11323 \northwest
11324 \pgf@y=0pt
11325 \pgf@x=0.7\pgf@x
11326 }
11327 \anchor{bin}{
11328 \northwest
11329 \pgf@y=0pt
11330 \pgf@x=0.7\pgf@x
11331 }
11332 \anchor{bin 1}{
11333 \northwest
11334 \pgf@y=0pt
11335 \pgf@x=0.7\pgf@x
11336 }
11337 \anchor{out}{
11338 \northwest
11339 \pgf@y=0pt
11340 \pgf@x=-\pgf@x
11341 }
11342 \anchor{right}{
11343 \northwest
11344 \pgf@y=0pt
11345 \pgf@x=-0.7\pgf@x
11346 }
11347 \anchor{bout}{
11348 \northwest
11349 \pgf@y=0pt
11350 \pgf@x=-0.7\pgf@x
11351 }
11352 \anchor{center}{
11353 \pgfpointorigin
11354 }
11355 \anchor{east}{
11356 \northwest
11357 \pgf@y=0pt
11358 \pgf@x=-\pgf@x
11359 }
11360 \anchor{west}{
11361 \northwest
11362 \pgf@y=0pt
11363 }
11364 \anchor{south}{
11365 \northwest
11366 \pgf@x=0pt
11367 \pgf@y=-\pgf@y
11368 }
11369 \anchor{north}{
11370 \northwest
11371 \pgf@x=0pt
11372 }
11373 \anchor{south west}{
11374 \northwest
11375 \pgf@y=-\pgf@y
11376 }
11377 \anchor{north east}{
11378 \northwest
11379 \pgf@x=-\pgf@x
11380 }
11381 \anchor{north west}{
11382 \northwest
11383 }
11384 \anchor{south east}{
11385 \northwest
11386 \pgf@x=-\pgf@x
11387 \pgf@y=-\pgf@y
11388 }
11389 \anchorborder{% this is used when the node is used as a path element
11390 \pgf@xa=\pgf@x
11391 \pgf@ya=\pgf@y
11392 \pgfextracty{\pgf@circ@res@up}{\northwest}
11393 \pgfextractx{\pgf@circ@res@left}{\northwest}
11394 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11395 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11396 }
11397 \anchor{text}{%
11398 % centered and a bit to the left (it's a triangle)!
11399 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11400 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11401 }
11402 \backgroundpath{
11403 \pgfsetcolor{\ctikzvalof{color}}
11404
11405 \northwest
11406 \pgf@circ@res@up = \pgf@y
11407 \pgf@circ@res@down = -\pgf@y
11408 \pgf@circ@res@right = -\pgf@x
11409 \pgf@circ@res@left = \pgf@x
11410
11411 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11412
11413 \pgfscope
11414 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11415 \pgftransformxshift{.7\pgf@circ@res@left}
11416 \pgf@circ@res@step=\pgf@circ@res@right
11417 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11418 \pgf@circ@res@step=.7\pgf@circ@res@step
11419
11420 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11421 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11422 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11423 \pgfpathclose
11424 \pgf@circ@draworfill
11425 \pgfpathellipse
11426 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11427 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11428 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11429 \pgf@circ@draworfill
11430 \endpgfscope
11431
11432 \ifpgfcirc@draw@input@leads
11433 %input leads
11434 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11435 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11436 \fi
11437
11438 \ifpgfcirc@draw@output@leads
11439 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11440 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11441 \fi
11442 \pgfusepath{draw}
11443 %draw inner shape
11444
11445 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11446
11447 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11448 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11449 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11450 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11451 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11452 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11453 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11454 \pgfusepath{draw}
11455
11456 }
11457 }
11458
11459 \pgfdeclareshape{schmitt}{
11460 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11461 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11462 \anchor{center}{\pgfpointorigin}
11463 \savedanchor\northwest{%
11464 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11465 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11466 \pgf@y=.5\pgf@y
11467 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11468 \pgf@x=.5\pgf@x
11469 }
11470 \anchor{in}{
11471 \northwest
11472 \pgf@y=0pt
11473 }
11474 \anchor{in 1}{
11475 \northwest
11476 \pgf@y=0pt
11477 }
11478 \anchor{left}{
11479 \northwest
11480 \pgf@y=0pt
11481 \pgf@x=0.7\pgf@x
11482 }
11483 \anchor{bin}{
11484 \northwest
11485 \pgf@y=0pt
11486 \pgf@x=0.7\pgf@x
11487 }
11488 \anchor{bin 1}{
11489 \northwest
11490 \pgf@y=0pt
11491 \pgf@x=0.7\pgf@x
11492 }
11493 \anchor{out}{
11494 \northwest
11495 \pgf@y=0pt
11496 \pgf@x=-\pgf@x
11497 }
11498 \anchor{right}{
11499 \northwest
11500 \pgf@y=0pt
11501 \pgf@x=-.7\pgf@x
11502 }
11503 \anchor{bout}{
11504 \northwest
11505 \pgf@y=0pt
11506 \pgf@x=-.7\pgf@x
11507 }
11508 \anchor{center}{
11509 \pgfpointorigin
11510 }
11511 \anchor{east}{
11512 \northwest
11513 \pgf@y=0pt
11514 \pgf@x=-\pgf@x
11515 }
11516 \anchor{west}{
11517 \northwest
11518 \pgf@y=0pt
11519 }
11520 \anchor{south}{
11521 \northwest
11522 \pgf@x=0pt
11523 \pgf@y=-\pgf@y
11524 }
11525 \anchor{north}{
11526 \northwest
11527 \pgf@x=0pt
11528 }
11529 \anchor{south west}{
11530 \northwest
11531 \pgf@y=-\pgf@y
11532 }
11533 \anchor{north east}{
11534 \northwest
11535 \pgf@x=-\pgf@x
11536 }
11537 \anchor{north west}{
11538 \northwest
11539 }
11540 \anchor{south east}{
11541 \northwest
11542 \pgf@x=-\pgf@x
11543 \pgf@y=-\pgf@y
11544 }
11545 \anchorborder{% this is used when the node is used as a path element
11546 \pgf@xa=\pgf@x
11547 \pgf@ya=\pgf@y
11548 \pgfextracty{\pgf@circ@res@up}{\northwest}
11549 \pgfextractx{\pgf@circ@res@left}{\northwest}
11550 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11551 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11552 }
11553 \anchor{text}{%
11554 % centered and a bit to the left (it's a triangle)!
11555 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11556 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11557 }
11558 \backgroundpath{
11559 \pgfsetcolor{\ctikzvalof{color}}
11560
11561
11562 \northwest
11563 \pgf@circ@res@up = \pgf@y
11564 \pgf@circ@res@down = -\pgf@y
11565 \pgf@circ@res@right = -\pgf@x
11566 \pgf@circ@res@left = \pgf@x
11567
11568 \pgfscope
11569 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11570 \pgftransformxshift{.7\pgf@circ@res@left}
11571 \pgf@circ@res@step=\pgf@circ@res@right
11572 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11573 \pgf@circ@res@step=.7\pgf@circ@res@step
11574
11575 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11576 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11577 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11578 \pgfpathclose
11579 \pgf@circ@draworfill
11580 \endpgfscope
11581
11582 \ifpgfcirc@draw@input@leads
11583 %input leads
11584 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11585 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11586 \fi
11587
11588 \ifpgfcirc@draw@output@leads
11589 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11590 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
11591 \fi
11592 \pgfusepath{draw}
11593 %draw inner shape
11594
11595 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11596
11597 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11598 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11599 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11600 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11601 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11602 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11603 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11604 \pgfusepath{draw}
11605
11606 }
11607 }
11608
11609
11610 %%% start european logic ports, from John Kormylo
11611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11612 %%
11613
11614 % #1 - name
11615 % #2 - text inside
11616 % #3 - number of inputs
11617 % #4 = is it a not?
11618 %
11619 % option to add a circle for not-output, see
11620 % https://github.com/circuitikz/circuitikz/issues/385
11621 %
11622 \newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
11623 \newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse
11624 \ctikzset{tripoles/european not shape/.initial=ocirc}
11625 \ctikzset{tripoles/european not symbol/.is choice}
11626 \ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
11627 \ctikzset{tripoles/european not symbol/circle/.code={%
11628 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
11629 \ctikzset{tripoles/european not symbol/ieee circle/.code={%
11630 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
11631
11632 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
11633 \pgfdeclareshape{european #1 port}
11634 {
11635 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11636 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11637 \saveddimen{\boutshift}{%
11638 \edef\pgf@temp{not}
11639 \edef\pgf@circ@temp{#4}
11640 \ifx\pgf@temp\pgf@circ@temp % is a not
11641 \ifpgf@circ@european@port@circle
11642 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11643 \edef\pgf@temp{ocirc}
11644 \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
11645 \ifx\pgf@temp\pgf@circ@temp % it's ocirc
11646 \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
11647 \else % it's ieee not circ
11648 \pgf@circ@notradius % defined together with ieeestd ports
11649 \pgf@x=2\pgf@circ@res@temp
11650 \fi
11651 \else
11652 \pgf@x=0pt
11653 \fi
11654 \else
11655 \pgf@x=0pt
11656 \fi
11657 }
11658 \savedmacro\resize{% automatic
11659 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11660 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11661 \pgf@circ@res@up = .5\pgf@circ@res@up
11662 \pgf@circ@res@down = -\pgf@circ@res@up
11663 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
11664 \pgf@circ@res@right = .5\pgf@circ@res@right
11665 \pgf@circ@res@left = -\pgf@circ@res@right
11666 }%
11667 \savedmacro\inputs{% get number of inputs
11668 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
11669 \ifnum\pgf@circ@res@count=0
11670 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
11671 \fi
11672 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
11673 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
11674 \def\inputs{\the\pgf@circ@res@count}%
11675 }%
11676 \savedanchor\step{% 1/2 gap at edges
11677 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11678 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11679 \divide\pgf@circ@res@step by #3
11680 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
11681 }%
11682 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
11683 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
11684 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11685 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
11686 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
11687
11688 \anchor{center}{\origin}% for backwards compatibility
11689 % the text anchor overlaps the logic symbol
11690 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
11691 % create input anchors
11692 \ifnum#3=1\relax
11693 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11694 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11695 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11696 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11697 \else
11698 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
11699 \pgfmathloop%
11700 \ifnum\pgfmathcounter>#3%
11701 \else%
11702 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
11703 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
11704 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
11705 }%
11706 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
11707 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
11708 }%
11709 %}{}%
11710 \repeatpgfmathloop%
11711 }
11712 \fi
11713 \anchor{out}{\northeast\pgf@y=0pt}
11714 \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
11715
11716 \anchor{left}{\left}% edges of component minus leads
11717 \anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
11718
11719 \anchor{north east}{\northeast}% see \Compass macro
11720 \anchor{south west}{\southwest}
11721 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11722 \pgfpoint{0cm}{\pgf@circ@res@up}}
11723 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11724 \pgfextractx{\pgf@circ@res@left}{\southwest}%
11725 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11726 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
11727 \pgfpoint{\pgf@circ@res@left}{0cm}}
11728 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11729 \pgfpoint{0cm}{\pgf@circ@res@down}}
11730 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11731 \pgfextractx{\pgf@circ@res@right}{\northeast}%
11732 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11733 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
11734 \pgfpoint{\pgf@circ@res@right}{0cm}}
11735
11736 \anchorborder{% this is used when the node is used as a path element
11737 \pgf@xa=\pgf@x
11738 \pgf@ya=\pgf@y
11739 \pgfextracty{\pgf@circ@res@up}{\northeast}
11740 \pgfextractx{\pgf@circ@res@right}{\northeast}
11741 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11742 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11743 }
11744 \backgroundpath{
11745 \pgfsetcolor{\ctikzvalof{color}}
11746 \pgfstartlinewidth=\pgflinewidth
11747 \pgfscope
11748 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11749 \pgfpathrectanglecorners
11750 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
11751 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
11752 \pgf@circ@draworfill
11753 \endpgfscope
11754 \ifpgfcirc@draw@input@leads
11755 %input leads
11756 \ifnum#3=1\relax
11757 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
11758 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11759 \else
11760 \pgfextracty{\pgf@circ@res@temp}{\step}%
11761 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11762 %\pgf@circ@res@count = #3\relax% redundant
11763 \loop\ifnum\pgf@circ@res@count>0
11764 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11765 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11766 \pgfpathlineto{\pgfpoint
11767 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
11768 {\pgf@circ@res@temp}}
11769 \advance\pgf@circ@res@count by -1
11770 \repeat
11771 \fi
11772 \pgfusepath{draw}
11773 \fi
11774 %
11775 \ifpgfcirc@draw@output@leads
11776 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11777 \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
11778 \pgfusepath{draw}
11779 \fi
11780 %
11781 \edef\pgf@temp{not}
11782 \edef\pgf@circ@temp{#4}
11783 \ifx\pgf@temp\pgf@circ@temp % is a not
11784 \ifpgf@circ@european@port@circle
11785 \pgfscope
11786 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11787 \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
11788 % reset linewidth for IEEE ports, otherwise they will multiply...
11789 \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
11790 \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
11791 \endpgfscope
11792 \else
11793 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
11794 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
11795 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
11796 \pgfusepath{draw}
11797 \fi
11798 \fi
11799 %
11800 \pgfpathmoveto{\pgfpointorigin}
11801 \pgftext{#2}
11802 }
11803 }
11804 }
11805 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
11806 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
11807 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
11808 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
11809 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
11810 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
11811 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
11812 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
11813
11814 %% end european logic ports
11815 % %>>>
11816
11817 %% IEEE standard logic ports module%<<<
11818
11819 %%
11820 %% Original multi-input code from John Kormylo at tex.stackexchange.com
11821 %% Help by TheTeXnician <[email protected]>
11822 %% Suggested idea and example code by Jason Sachs <[email protected]>
11823 %% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
11824 %% Most of the code, all errors and bugs by Romano Giannetti <[email protected]>
11825 %% Everything is in the same place here --- more or less; first step to move towards
11826 %% a module interface for circutikz
11827 %%
11828
11829 % base settings for ieeestd ports.
11830
11831 \ctikzset{ieeestd ports/.is family}
11832 % baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
11833 % the value of 0.4 is the standard pin distance for a port with height=num pins
11834 % and matches the chip distance
11835 \ctikzset{ieeestd ports/baselen/.initial=0.4}
11836 % these are in term of baselen; width depends on height (fixed proportions)
11837 \ctikzset{ieeestd ports/height/.initial=2}
11838 \ctikzset{ieeestd ports/pin length/.initial=0.7}
11839 % the standard "not" circle should be 1/6.5 of height (diameter);
11840 % so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
11841 \ctikzset{ieeestd ports/not radius/.initial=0.154}
11842 \ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
11843 % the suggested xnor distance is is 1.24, so 1.25/3.25/2
11844 % xor/xnor leads go full in in IEEE; let this be optional
11845 \ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
11846 \ctikzset{ieeestd ports/xor leads in/.initial=1}%
11847 %
11848 % base size of a small external schmitt symbol
11849 %
11850 \ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
11851 %
11852 % input management
11853 % we are using the same /tikz/number inputs than the legacy ports
11854 %
11855 \tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
11856 %
11857 % integrate with the other logic ports
11858 %
11859 %
11860 \newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse
11861 \ctikzset{logic ports/ieee/.code= {%
11862 \pgf@circuit@ieeelogicporttrue
11863 \pgf@circuit@europeanlogicportfalse
11864 \tikzset{and port/.style={shape=ieeestd and port}}%
11865 \tikzset{or port/.style={shape=ieeestd or port}}%
11866 \tikzset{xor port/.style={shape=ieeestd xor port}}%
11867 \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
11868 \tikzset{not port/.style={shape=ieeestd not port}}%
11869 \tikzset{nand port/.style={shape=ieeestd nand port}}%
11870 \tikzset{nor port/.style={shape=ieeestd nor port}}%
11871 \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
11872 \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
11873 \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}%
11874 }}
11875 % add code to be compatible with the other ports
11876 \ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}}
11877 \ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}}
11878 \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
11879 %
11880 % the base angle for the or port. See the drawings. This will not change with height
11881 %
11882 \pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
11883 % \typeout{ANGLE-IS\space\pgf@circ@orangle}
11884 \def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
11885 {%
11886 \ifnum#1>\inputs
11887 \PackageError{circuitikz}{%
11888 You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
11889 which has been defined with \inputs\space pins%
11890 }{Please check the manual about logic ports; if you press return I'll try to continue}
11891 \fi
11892 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
11893 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
11894 \pgf@circ@res@step=\pind
11895 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
11896 \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
11897 }%
11898
11899 % #1 = \pgfmathcounter #2=type
11900 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
11901 \def\pgf@circ@ieeeport@baseinput#1#2%
11902 {%
11903 \ifnum#1>\inputs
11904 \PackageError{circuitikz}{%
11905 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
11906 which has been defined with \inputs\space pins%
11907 }{Please check the manual about logic ports; if you press return I'll try to continue}
11908 \fi
11909 % Find the vertical position (this is the same for any port)
11910 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
11911 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
11912 % rack (extended) pins; they are the same for all the ports
11913 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
11914 % above: 1..K (included)
11915 % below: inputs-K..inputs
11916 % Find the pins on the rack; they are 1...
11917 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
11918 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
11919 % border anchors for rack should be ok
11920 \pgfextractx{\pgf@circ@res@left}{\topleft}
11921 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
11922 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
11923 % we have finished if we are in the rack
11924 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
11925 % we are on the inner ports; we have to do the hard work here
11926 % and and nand
11927 \ifnum #2=1
11928 \relax % It's an and/nand, all border ports are on the rack line
11929 \fi
11930 % or and nor
11931 \ifnum #2=2
11932 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
11933 \fi
11934 % xor and xnor
11935 \ifnum #2=3\relax
11936 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
11937 \fi
11938 \fi\fi
11939 }%
11940 % inner base ports for xor types port
11941 % #1 = \pgfmathcounter #2=type
11942 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
11943 \def\pgf@circ@ieeeport@innerbaseinput#1%
11944 {%
11945 \ifnum#1>\inputs
11946 \PackageError{circuitikz}{%
11947 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
11948 which has been defined with \inputs\space pins%
11949 }{Please check the manual about logic ports; if you press return I'll try to continue}
11950 \fi
11951 % Find the vertical position (this is the same for any port)
11952 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
11953 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
11954 % rack (extended) pins; they are the same for all the ports
11955 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
11956 % above: 1..K (included)
11957 % below: inputs-K..inputs
11958 % Find the pins on the rack; they are 1...
11959 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
11960 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
11961 % border anchors for rack should be ok
11962 \pgfextractx{\pgf@circ@res@left}{\topleft}
11963 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
11964 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
11965 % we have finished if we are in the rack
11966 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
11967 % we are on the inner ports; we have to do the hard work here
11968 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
11969 \fi\fi
11970 }%
11971
11972 %%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
11973 \def\pgf@circ@ieeestd@baselen{%
11974 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11975 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
11976 }
11977 \def\pgf@circ@ieeestd@stdH{%
11978 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11979 \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
11980 \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
11981 }
11982 \def\pgf@circ@ieeestd@pinlen{%
11983 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11984 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
11985 \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
11986 }
11987 \def\pgf@circ@ieeestd@xorbar{%
11988 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11989 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
11990 \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
11991 }
11992 %% Not circle
11993 \def\pgf@circ@notradius{
11994 \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
11995 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
11996 % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
11997 }
11998 %% Find (in ...@other) the height of the rack
11999 \def\pgf@circ@findrackH{%
12000 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
12001 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
12002 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
12003 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
12004 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
12005 \pgf@circ@ieeestd@stdH
12006 \multiply\pgf@circ@res@temp by 2\relax% full height
12007 \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
12008 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
12009 % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
12010 }
12011 %%
12012 \def\pgf@circ@find@ieeeport@up{% leave it in up
12013 % Normal port limits
12014 \pgf@circ@ieeestd@stdH
12015 \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
12016 % rack top size
12017 \pgf@circ@findrackH
12018 \ifdim\pgf@circ@res@other > \pgf@circ@res@up
12019 \pgf@circ@res@up=\pgf@circ@res@other
12020 \else
12021 \fi
12022 }
12023 \def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
12024 % Normal port limits
12025 \pgf@circ@ieeestd@stdH
12026 \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
12027 \pgf@circ@res@right=\pgf@circ@res@left % save the border value
12028 \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
12029 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
12030 % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
12031 % this is the normal left border
12032 % For the or or xor port, the limit can be the pointy thing (in case the
12033 % pinlen is zero or too small)
12034 % add to the body margin the or/nor peak:
12035 \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
12036 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
12037 \advance\pgf@circ@res@right by \pgf@circ@res@other
12038 % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
12039 \fi
12040 % add to the body margin the xor/xnor distance
12041 \ifnum #1 = 3\relax% "xor" or "xnor" gates.
12042 \pgf@circ@ieeestd@xorbar
12043 \advance\pgf@circ@res@right by \pgf@circ@res@temp
12044 % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
12045 \fi
12046 % and if this exceeds the normal margin, this is it
12047 % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
12048 \ifdim \pgf@circ@res@right > \pgf@circ@res@left
12049 \pgf@circ@res@left=\pgf@circ@res@right
12050 \fi
12051 % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
12052 \pgf@circ@res@left=-\pgf@circ@res@left
12053 }
12054 \def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
12055 % Normal port limits
12056 \pgf@circ@ieeestd@stdH
12057 \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
12058 \pgf@circ@notradius
12059 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
12060 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
12061 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
12062 \pgf@circ@res@right=\pgf@circ@res@other
12063 \fi
12064 }
12065 \def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
12066 % Normal port limits
12067 \pgf@circ@ieeestd@stdH
12068 % notice 0.8660254 is cos(30)
12069 \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
12070 \pgf@circ@notradius
12071 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
12072 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
12073 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
12074 \pgf@circ@res@right=\pgf@circ@res@other
12075 \fi
12076 }
12077
12078
12079 %%% ieeestd multi-input ports
12080 %%% #1: name
12081 %%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
12082 %%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
12083 %%% #4: drawing for the port
12084 \long\def\pgfcircdeclareieeeport#1#2#3#4{%
12085 \pgfdeclareshape{ieeestd #1 port}%
12086 {%
12087 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12088 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12089 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
12090 \saveddimen{\baselen}{%
12091 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
12092 }
12093 \saveddimen{\stdH}{% This is HALF the height of the inner port
12094 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
12095 }
12096 \saveddimen{\notdiameter}{
12097 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
12098 }
12099 \saveddimen{\pind}{% pin distance;
12100 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
12101 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
12102 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
12103 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
12104 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
12105 \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
12106 \divide\pgf@x by \pgf@circ@count@b
12107 }
12108 \saveddimen{\pinlen}{%
12109 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
12110 }
12111 \saveddimen{\xorbar}{%
12112 \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
12113 }
12114 % anchors for the body (no pins included here)
12115 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
12116 \pgf@circ@ieeestd@stdH
12117 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
12118 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12119 }
12120 \savedanchor{\topleft}{%
12121 \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
12122 \pgf@circ@ieeestd@stdH
12123 \pgf@circ@res@other=0pt\relax
12124 \ifnum #2 = 2\relax% "or" or "nor" gates.
12125 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
12126 \fi
12127 \ifnum #2 = 3\relax% "xor" or "xnor" gates.
12128 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
12129 +\pgf@circ@res@right}
12130 \fi
12131 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
12132 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12133 }
12134 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
12135 \pgf@circ@ieeestd@stdH
12136 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
12137 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
12138 }
12139 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
12140 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
12141 \pgf@circ@ieeestd@stdH
12142 % #3 is =1 if the port is a negated output one
12143 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
12144 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
12145 }
12146 % geographical anchors --- must be rectangulars!
12147 \savedanchor{\northwest}{%
12148 \pgf@circ@find@ieeeport@up
12149 \pgf@circ@find@ieeeport@left{#2}
12150 % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
12151 \pgf@x=\pgf@circ@res@left
12152 \pgf@y=\pgf@circ@res@up
12153 }
12154 \savedanchor{\southwest}{%
12155 \pgf@circ@find@ieeeport@up
12156 \pgf@circ@find@ieeeport@left{#2}
12157 \pgf@x=\pgf@circ@res@left
12158 \pgf@y=-\pgf@circ@res@up
12159 }
12160 \savedanchor{\southeast}{%
12161 \pgf@circ@find@ieeeport@up
12162 \pgf@circ@find@ieeeport@right{#3}
12163 \pgf@x=\pgf@circ@res@right
12164 \pgf@y=-\pgf@circ@res@up
12165 }
12166 \savedanchor{\northeast}{%
12167 \pgf@circ@find@ieeeport@up
12168 \pgf@circ@find@ieeeport@right{#3}
12169 \pgf@x=\pgf@circ@res@right
12170 \pgf@y=\pgf@circ@res@up
12171 }
12172 \savedmacro\inputs{% get number of inputs
12173 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
12174 \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
12175 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
12176 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
12177 \def\inputs{\the\pgf@circ@count@a}%
12178 }%
12179 \savedmacro\inners{% get number of "inner" inputs (for racks)
12180 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
12181 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
12182 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
12183 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
12184 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
12185 % \typeout{INNER is \the\pgf@circ@count@b}%
12186 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
12187 \def\inners{\the\pgf@circ@count@b}%
12188 }%
12189 \anchor{center}{\pgfpointorigin}
12190 \anchor{text}{
12191 \ifpgf@circ@center@text
12192 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12193 \else
12194 \pgf@circ@ieeestd@stdH
12195 \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
12196 \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12197 \fi
12198 }
12199 % create input anchors
12200 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
12201 \pgf@circ@count@a=\inputs
12202 \pgfmathloop%
12203 \ifnum\pgfmathcounter>\pgf@circ@count@a%
12204 \else%
12205 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
12206 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
12207 \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
12208 }%
12209 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
12210 \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
12211 }%
12212 \ifnum #2 = 3\relax % xor/xnor inner border pins
12213 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
12214 \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
12215 }%
12216 \fi
12217 %}{}%
12218 \repeatpgfmathloop%
12219 }
12220 % output anchor
12221 \anchor{out}{%
12222 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
12223 \advance\pgf@circ@res@other by\pinlen
12224 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
12225 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
12226 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
12227 \fi
12228 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
12229 }
12230 \anchor{bout}{\bottomright\pgf@y=0pt}
12231
12232 \anchor{body right}{\bodyright\pgf@y=0pt}
12233 \anchor{right}{\bottomright\pgf@y=0pt}
12234 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
12235 \anchor{left}{% central edge of the component
12236 \bodyleft\pgf@y=0pt
12237 \ifnum #2=3\relax
12238 \advance\pgf@x by -\xorbar
12239 \fi
12240 }
12241 \anchor{up}{%
12242 \bodyleft
12243 \ifnum #2 > 1 % pointy shapes
12244 \pgf@circ@ieeestd@stdH
12245 % horizontal coordinate where the right semicircle starts
12246 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
12247 % vertical drop of the circle at the above coordinate
12248 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
12249 \advance \pgf@y by -\pgf@circ@res@step
12250 \fi
12251 \pgf@x=0pt
12252 }
12253 \anchor{down}{%
12254 \bodyleft
12255 \ifnum #2 > 1 % pointy shapes
12256 \pgf@circ@ieeestd@stdH
12257 % horizontal coordinate where the right semicircle starts
12258 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
12259 % vertical drop of the circle at the above coordinate
12260 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
12261 \advance \pgf@y by -\pgf@circ@res@step
12262 \fi
12263 \pgf@y=-\pgf@y\pgf@x=0pt
12264 }
12265
12266 % geographical anchors
12267 \anchor{nw}{\northwest}
12268 \anchor{ne}{\northeast}
12269 \anchor{se}{\southeast}
12270 \anchor{sw}{\southwest}
12271 \anchor{north west}{\northwest}
12272 \anchor{north east}{\northeast}
12273 \anchor{south east}{\southeast}
12274 \anchor{south west}{\southwest}
12275 % over 0,0 even if asymmetric
12276 % will break if the geocoords are not rectangular
12277 \anchor{n}{\northwest\pgf@x=0pt\relax}
12278 \anchor{e}{\northeast\pgf@y=0pt\relax}
12279 \anchor{s}{\southwest\pgf@x=0pt\relax}
12280 \anchor{w}{\northwest\pgf@y=0pt\relax}
12281 \anchor{north}{\northwest\pgf@x=0pt\relax}
12282 \anchor{east}{\northeast\pgf@y=0pt\relax}
12283 \anchor{south}{\southwest\pgf@x=0pt\relax}
12284 \anchor{west}{\northwest\pgf@y=0pt\relax}
12285
12286 \backgroundpath{
12287 \pgfscope
12288 \pgfsetcolor{\ctikzvalof{color}}
12289 #4
12290 \endpgfscope
12291 % output lead:
12292 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
12293 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
12294 \advance\pgf@circ@res@other by \pinlen\relax
12295 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
12296 \ifpgfcirc@draw@output@leads
12297 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12298 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12299 \pgfusepath{draw}
12300 \fi
12301 \fi
12302 \ifnum #3=1\relax\pgfscope
12303 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
12304 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
12305 \endpgfscope\fi
12306 }
12307 }
12308 }
12309
12310 %%% #1 direct name #2 negated name #3 type #4 drawing (without output)
12311 \long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
12312 \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
12313 \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
12314 }
12315 %
12316 % ieeestd "and" and "nand"
12317 %
12318 \pgfcircdeclareieeeportpair{and}{nand}{1}{%
12319 \pgf@circ@count@a = \inputs\relax
12320 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
12321 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
12322 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12323 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
12324 \ifpgfcirc@draw@input@leads
12325 %input leads --- all the same for AND ports
12326 \loop\ifnum\pgf@circ@count@a>0
12327 \advance\pgf@circ@res@temp by -\pind
12328 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12329 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
12330 \advance\pgf@circ@count@a by -1
12331 \repeat
12332 \fi
12333 \pgfusepath{draw}
12334 %% Body. let's start from the top left
12335 \pgfscope
12336 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12337 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
12338 \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
12339 \pgfpatharc{90}{-90}{\stdH}
12340 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
12341 \pgfpathclose
12342 \pgf@circ@draworfill
12343 % rack now; skip if not needed.
12344 % \typeout{WHAT\space \inputs\space \inners}
12345 \ifnum\inputs>\inners
12346 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12347 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
12348 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
12349 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12350 \pgfusepath{draw}
12351 \fi
12352 \endpgfscope
12353 }
12354 %
12355 % or/nor and xor/xnor are practically the same. Let factor out everything
12356 % the argument #1 is put just before the drawing of the inner pins
12357 % the argument #2 is put after the drawing of the body
12358 %
12359 \long\def\pgf@circ@ieeeport@orxor#1#2{%
12360 \pgf@circ@count@a = \inputs\relax
12361 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
12362 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
12363 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12364 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
12365 % rack (extended) pins; they are the same for all the ports
12366 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
12367 % above: 1..K (included)
12368 % below: inputs-K..inputs
12369 % Find the pins on the rack; they are 1...
12370 \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
12371 \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
12372 \ifpgfcirc@draw@input@leads
12373 %input leads --- for or ports
12374 \loop\ifnum\pgf@circ@count@a>0
12375 \pgfextractx{\pgf@circ@res@right}{\topleft}
12376 \advance\pgf@circ@res@temp by -\pind
12377 % this is the height; let's find the "right" position
12378 \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
12379 % inner pins
12380 % \typeout{INNER\space\pgf@circ@count@a}
12381 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
12382 % hook for xor/xnor
12383 #1
12384 \fi\fi
12385 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
12386 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
12387 \pgfusepath{draw}
12388 \advance\pgf@circ@count@a by -1
12389 \repeat
12390 \fi
12391 %% Body. let's start from the top left
12392 \pgfscope
12393 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12394 % it should start here, but with this trick the close comes out better.
12395 % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
12396 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
12397 \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
12398 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
12399 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
12400 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
12401 %% this should be 2 and 2; but the round part is not a perfect circle that way
12402 %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
12403 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
12404 \pgfpathclose
12405 \pgf@circ@draworfill
12406 % hook for xor/xnor
12407 #2
12408 % rack now; skip if not needed.
12409 % \typeout{WHAT\space \inputs\space \inners}
12410 \ifnum\inputs>\inners
12411 \pgfextractx{\pgf@circ@res@left}{\topleft}
12412 \pgfextracty{\pgf@circ@res@down}{\topleft}
12413 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12414 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
12415 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
12416 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12417 \pgfusepath{draw}
12418 \fi
12419 \endpgfscope
12420 }
12421 %
12422 % ieeestd "or" and "nor"
12423 %
12424 \pgfcircdeclareieeeportpair{or}{nor}{2}{%
12425 \pgf@circ@ieeeport@orxor{}{}
12426 }
12427 \pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
12428 \pgf@circ@ieeeport@orxor{
12429 \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
12430 \ifnum\@@tmp=0\relax
12431 % move pin start to the left to leave the xor gap free (not standard)
12432 \advance\pgf@circ@res@right by -\xorbar
12433 \fi
12434 }{%
12435 % add the xor/xnor bar
12436 \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
12437 % see the comment on the main body about the 2.2
12438 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
12439 \pgfusepath{draw}
12440 }
12441 }
12442 %
12443 % Buffer and inverters
12444 %
12445 % #1: name
12446 % #2: polarity
12447 % #3: content
12448 \long\def\pgfcircdeclareieeebufferport#1#2#3{%
12449 \pgfdeclareshape{ieeestd #1 port}%
12450 {%
12451 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12452 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12453 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
12454 \saveddimen{\baselen}{%
12455 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
12456 }
12457 \saveddimen{\stdH}{% This is HALF the height of the inner port
12458 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
12459 }
12460 \saveddimen{\notdiameter}{
12461 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
12462 }
12463 \saveddimen{\pinlen}{%
12464 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
12465 }
12466 % anchors for the body (no pins included here)
12467 % Notice that 0.8660254 is cos(30)
12468 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
12469 \pgf@circ@ieeestd@stdH
12470 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
12471 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12472 }
12473 \savedanchor{\topleft}{%
12474 \pgf@circ@ieeestd@stdH
12475 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
12476 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12477 }
12478 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
12479 \pgf@circ@ieeestd@stdH
12480 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
12481 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12482 }
12483 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
12484 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
12485 \pgf@circ@ieeestd@stdH
12486 % #2 is =1 if the port is a negated output one
12487 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
12488 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
12489 }
12490 % geographical anchors --- must be rectangulars!
12491 \savedanchor{\northwest}{%
12492 \pgf@circ@ieeestd@stdH
12493 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
12494 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12495 }
12496 \savedanchor{\southwest}{%
12497 \pgf@circ@ieeestd@stdH
12498 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
12499 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
12500 }
12501 \savedanchor{\southeast}{%
12502 \pgf@circ@ieeestd@stdH
12503 \pgf@circ@res@up=\pgf@circ@res@temp
12504 \pgf@circ@find@ieeeport@not@right{#2}
12505 \pgf@x=\pgf@circ@res@right
12506 \pgf@y=-\pgf@circ@res@up
12507 }
12508 \savedanchor{\northeast}{%
12509 \pgf@circ@ieeestd@stdH
12510 \pgf@circ@res@up=\pgf@circ@res@temp
12511 \pgf@circ@find@ieeeport@not@right{#2}
12512 \pgf@x=\pgf@circ@res@right
12513 \pgf@y=\pgf@circ@res@up
12514 }
12515 \anchor{center}{\pgfpointorigin}
12516 \anchor{text}{
12517 \ifpgf@circ@center@text
12518 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12519 \else
12520 \pgf@circ@ieeestd@stdH
12521 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12522 \fi
12523 }
12524 % input anchors
12525 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
12526 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
12527 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
12528 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
12529 % output anchors
12530 \anchor{out}{%
12531 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
12532 \advance\pgf@circ@res@other by\pinlen
12533 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
12534 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
12535 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
12536 \fi
12537 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
12538 }
12539 \anchor{bout}{\bottomright\pgf@y=0pt}
12540
12541 \anchor{body right}{\bodyright\pgf@y=0pt}
12542 \anchor{right}{\bottomright\pgf@y=0pt}
12543 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
12544 \anchor{left}{\bodyleft\pgf@y=0pt}
12545 \anchor{up}{%
12546 \bodyleft
12547 \pgf@y=+0.5\pgf@y\pgf@x=0pt
12548 }
12549 \anchor{down}{%
12550 \bodyleft
12551 \pgf@y=-0.5\pgf@y\pgf@x=0pt
12552 }
12553 % this is for when it's used as a bipole
12554 % we use the enclosing rectangle (see below)
12555 \anchorborder{%
12556 %% This (commented out) is the correct border anchor. But if we use the correct
12557 %% border anchor there is no horizontal space for the label ;-) because
12558 %% the triangle is too steep. So we will use a simple square border
12559 %%
12560 %% find the border anchor of a triangle (like a not port or an
12561 %% amplifier) ---
12562 %%
12563 %% -----^ up
12564 %% I --- |
12565 %% I -|--
12566 %%left I | --- right
12567 %% ----I-----|-------I-----
12568 %%
12569 %%
12570 %\pgf@xa=\pgf@x
12571 %% it's simmetrical w/ vertical side, use only positive y
12572 %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
12573 %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
12574 %\pgfextracty{\pgf@circ@res@up}{\bodyleft}
12575 %\pgfextractx{\pgf@circ@res@left}{\bodyleft}
12576 %\pgfextractx{\pgf@circ@res@right}{\bodyright}
12577 %% limit angle for the left (vertical) side
12578 %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)}
12579 %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)}
12580 %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)}
12581 %% find the border
12582 %\ifnum\@@leftside>0
12583 % % vertical side
12584 % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12585 % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12586 %\else
12587 % % triangle upper line
12588 % \pgfpointintersectionoflines
12589 % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
12590 % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}}
12591 %\fi
12592 %% readjust y sign
12593 %\pgf@y=\@@switchy\pgf@y
12594 %
12595 % this is the square border to position the path label with a bit of horizontal space
12596 %
12597 \pgf@xa=\pgf@x
12598 \pgf@ya=\pgf@y
12599 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12600 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12601 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12602 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12603 }
12604 % geographical anchors
12605 \anchor{nw}{\northwest}
12606 \anchor{ne}{\northeast}
12607 \anchor{se}{\southeast}
12608 \anchor{sw}{\southwest}
12609 \anchor{north west}{\northwest}
12610 \anchor{north east}{\northeast}
12611 \anchor{south east}{\southeast}
12612 \anchor{south west}{\southwest}
12613 % over 0,0 even if asymmetric
12614 % will break if the geocoords are not rectangular
12615 \anchor{n}{\northwest\pgf@x=0pt\relax}
12616 \anchor{e}{\northeast\pgf@y=0pt\relax}
12617 \anchor{s}{\southwest\pgf@x=0pt\relax}
12618 \anchor{w}{\northwest\pgf@y=0pt\relax}
12619 \anchor{north}{\northwest\pgf@x=0pt\relax}
12620 \anchor{east}{\northeast\pgf@y=0pt\relax}
12621 \anchor{south}{\southwest\pgf@x=0pt\relax}
12622 \anchor{west}{\northwest\pgf@y=0pt\relax}
12623
12624 \backgroundpath{
12625 \pgfscope
12626 \pgfsetcolor{\ctikzvalof{color}}
12627 #3
12628 \endpgfscope
12629 % output lead:
12630 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
12631 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
12632 \advance\pgf@circ@res@other by \pinlen\relax
12633 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
12634 \ifpgfcirc@draw@output@leads
12635 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12636 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12637 \pgfusepath{draw}
12638 \fi
12639 \fi
12640 \ifnum #2=1\relax\pgfscope
12641 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
12642 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
12643 \endpgfscope\fi
12644 }
12645 }
12646 }
12647
12648 %%% #1 direct name #2 negated name #3 drawing (without output)
12649 \long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
12650 \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
12651 \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
12652 }
12653
12654 \pgfcircdeclareieeebufferportpair{buffer}{not}{%
12655 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12656 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12657 \pgfextractx{\pgf@circ@res@right}{\bodyright}
12658 % \draw input pin
12659 \ifpgfcirc@draw@input@leads
12660 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12661 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
12662 \pgfusepath{draw}
12663 \fi
12664 \pgfscope
12665 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12666 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12667 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12668 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12669 \pgfpathclose
12670 \pgf@circ@draworfill
12671 \endpgfscope
12672 }
12673
12674 \pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{%
12675 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12676 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12677 \pgfextractx{\pgf@circ@res@right}{\bodyright}
12678 % \draw input pin
12679 \ifpgfcirc@draw@input@leads
12680 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12681 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
12682 \pgfusepath{draw}
12683 \fi
12684 \pgfscope
12685 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12686 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12687 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12688 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12689 \pgfpathclose
12690 \pgf@circ@draworfill
12691 \endpgfscope
12692 % draw schmitt symbol in normal line thickness
12693 \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
12694 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
12695 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
12696 \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
12697 \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
12698 \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
12699 \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
12700 \pgfusepath{draw}
12701 }
12702
12703
12704 \pgfdeclareshape{schmitt symbol}{
12705 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12706 \anchor{center}{\pgfpointorigin}
12707 \savedanchor\northwest{%
12708 \pgf@circ@ieeestd@stdH
12709 \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
12710 \pgf@x=-1.5\pgf@y
12711 }
12712 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
12713 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
12714 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
12715 \anchor{west}{\northwest\pgf@y=0pt}
12716 \anchor{w}{\northwest \pgf@y=0pt}
12717 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
12718 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
12719 \anchor{north}{\northwest\pgf@x=0pt}
12720 \anchor{n}{\northwest\pgf@x=0pt}
12721 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
12722 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
12723 \anchor{north west}{\northwest}
12724 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
12725 \backgroundpath{
12726 \pgfscope
12727 \pgfsetcolor{\ctikzvalof{color}}
12728 \pgfextractx{\pgf@circ@res@left}{\northwest}
12729 \pgfextracty{\pgf@circ@res@up}{\northwest}
12730 \pgf@circ@res@left=0.7\pgf@circ@res@left
12731 \pgf@circ@res@up=0.7\pgf@circ@res@up
12732 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12733 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
12734 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
12735 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12736 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
12737 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
12738 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12739 \pgfusepath{draw}
12740 \endpgfscope
12741 }
12742 }
12743
12744 \pgfdeclareshape{notcirc}{
12745 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12746 \anchor{center}{\pgfpointorigin}
12747 \savedanchor\northwest{%
12748 \pgf@circ@notradius
12749 \pgf@y=\pgf@circ@res@temp
12750 \pgf@x=-\pgf@y
12751 }
12752 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
12753 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
12754 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
12755 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
12756 \anchor{left}{\northwest\pgf@y=0pt}
12757 \anchor{west}{\northwest\pgf@y=0pt}
12758 \anchor{w}{\northwest \pgf@y=0pt}
12759 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
12760 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
12761 \anchor{north}{\northwest\pgf@x=0pt}
12762 \anchor{n}{\northwest\pgf@x=0pt}
12763 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
12764 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
12765 \anchor{north west}{\northwest}
12766 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
12767 \anchorborder{
12768 \pgf@circ@res@left=\pgf@x
12769 \pgf@circ@res@up=\pgf@y
12770 \northwest\pgf@circ@res@temp=\pgf@y
12771 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
12772 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
12773 }
12774 \behindforegroundpath{
12775 \pgfscope
12776 \northwest\pgf@circ@res@temp=\pgf@y
12777 \pgfsetcolor{\ctikzvalof{color}}
12778 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12779 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
12780 \ifx\tikz@fillcolor\pgfutil@empty
12781 % set the default fill color to white
12782 \pgfsetfillcolor{white}
12783 % ...but override it if the class is defined!
12784 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
12785 \else
12786 \pgfsetfillcolor{\tikz@fillcolor}
12787 \fi
12788 \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
12789 \pgfusepath{draw,fill}
12790 \endpgfscope
12791 }
12792 }
12793
12794 %%%% Transmission gates
12795 % tgates are only ieee style for now
12796 \tikzset{%
12797 tgate/.style ={shape=ieee tgate},
12798 double tgate/.style ={shape=ieee double tgate},
12799 }
12800 \ctikzset{tgate scale/.initial=0.7}
12801 % Buffer and inverters
12802 %
12803 % #1: name
12804 % #2: 1: one-not, 2:double-not
12805 % #3: content
12806 \long\def\pgfcircdeclareieeetgate#1#2#3{%
12807 \pgfdeclareshape{ieee #1}%
12808 {%
12809 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12810 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12811 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
12812 \saveddimen{\baselen}{%
12813 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
12814 }
12815 \saveddimen{\stdH}{% This is HALF the height of the inner port
12816 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
12817 }
12818 \saveddimen{\notdiameter}{
12819 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
12820 }
12821 \saveddimen{\notradius}{
12822 \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp
12823 }
12824 \saveddimen{\pinlen}{%
12825 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
12826 }
12827 % anchors for the body (no pins included here)
12828 % Notice that 0.8660254 is cos(30)
12829 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
12830 \pgf@circ@ieeestd@stdH
12831 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12832 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12833 }
12834 \savedanchor{\topleft}{%
12835 \pgf@circ@ieeestd@stdH
12836 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12837 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12838 }
12839 \savedanchor{\bodyright}{%
12840 \pgf@circ@ieeestd@stdH
12841 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12842 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12843 }
12844 \savedanchor{\bottomright}{% Here it is the same as \bodyright
12845 \pgf@circ@ieeestd@stdH
12846 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12847 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12848 }
12849 % geographical anchors --- must be rectangulars!
12850 \savedanchor{\northwest}{%
12851 \pgf@circ@ieeestd@stdH
12852 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12853 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12854 }
12855 \savedanchor{\southwest}{%
12856 \pgf@circ@ieeestd@stdH
12857 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12858 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12859 }
12860 \savedanchor{\southeast}{%
12861 \pgf@circ@ieeestd@stdH
12862 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12863 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12864 }
12865 \savedanchor{\northeast}{%
12866 \pgf@circ@ieeestd@stdH
12867 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12868 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12869 }
12870 \anchor{center}{\pgfpointorigin}
12871 \anchor{text}{
12872 \ifpgf@circ@center@text
12873 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12874 \else
12875 \pgf@circ@ieeestd@stdH
12876 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12877 \fi
12878 }
12879 % input anchors
12880 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
12881 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
12882 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
12883 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
12884 % gates
12885 \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y
12886 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
12887 \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y
12888 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}}
12889 % gate (up) (2.1547 = 1+1/cos(30)
12890 \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y
12891 \pgf@x=0pt\relax
12892 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
12893 \ifdim\pinlen>\pgf@circ@res@temp
12894 \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}
12895 \else
12896 \pgf@y=\pgf@circ@res@temp
12897 \fi
12898 }
12899 \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y
12900 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}}
12901
12902 % output anchors
12903 \anchor{out}{%
12904 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
12905 \advance\pgf@circ@res@other by\pinlen
12906 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
12907 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
12908 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
12909 \fi
12910 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
12911 }
12912 \anchor{bout}{\bottomright\pgf@y=0pt}
12913
12914 \anchor{body right}{\bodyright\pgf@y=0pt}
12915 \anchor{right}{\bottomright\pgf@y=0pt}
12916 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
12917 \anchor{left}{\bodyleft\pgf@y=0pt}
12918 \anchor{up}{%
12919 \bodyleft
12920 \pgf@x=0pt
12921 \ifnum#2=1\relax
12922 \pgf@y=0pt
12923 \else
12924 \pgf@y=.5\pgf@y
12925 \fi
12926 \advance\pgf@y by \notdiameter
12927 }
12928 \anchor{down}{%
12929 \bodyleft
12930 \pgf@x=0pt
12931 \ifnum#2=1\relax
12932 \pgf@y=0pt
12933 \else
12934 \pgf@y=-.5\pgf@y
12935 \fi
12936 }
12937 % this is for when it's used as a bipole
12938 % we use the enclosing rectangle (see below)
12939 \anchorborder{%
12940 %
12941 % this is the square border to position the path label with a bit of horizontal space
12942 %
12943 \pgf@xa=\pgf@x
12944 \pgf@ya=\pgf@y
12945 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12946 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12947 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12948 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12949 }
12950 % geographical anchors
12951 \anchor{nw}{\northwest}
12952 \anchor{ne}{\northeast}
12953 \anchor{se}{\southeast}
12954 \anchor{sw}{\southwest}
12955 \anchor{north west}{\northwest}
12956 \anchor{north east}{\northeast}
12957 \anchor{south east}{\southeast}
12958 \anchor{south west}{\southwest}
12959 % over 0,0 even if asymmetric
12960 % will break if the geocoords are not rectangular
12961 \anchor{n}{\northwest\pgf@x=0pt\relax}
12962 \anchor{e}{\northeast\pgf@y=0pt\relax}
12963 \anchor{s}{\southwest\pgf@x=0pt\relax}
12964 \anchor{w}{\northwest\pgf@y=0pt\relax}
12965 \anchor{north}{\northwest\pgf@x=0pt\relax}
12966 \anchor{east}{\northeast\pgf@y=0pt\relax}
12967 \anchor{south}{\southwest\pgf@x=0pt\relax}
12968 \anchor{west}{\northwest\pgf@y=0pt\relax}
12969
12970 \backgroundpath{
12971 \pgfscope
12972 \pgfsetcolor{\ctikzvalof{color}}
12973 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12974 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12975 \pgfextractx{\pgf@circ@res@right}{\bodyright}
12976 % \draw input pins
12977 \ifpgfcirc@draw@input@leads
12978 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12979 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
12980 % gate (down)
12981 \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}}
12982 \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
12983 % gate (up) (2.1547 = 1+1/cos(30)
12984 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
12985 \ifdim\pinlen>\pgf@circ@res@temp
12986 \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}}
12987 \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}}
12988 \fi
12989 \pgfusepath{draw}
12990 \fi
12991 #3
12992 \endpgfscope
12993 % output lead:
12994 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
12995 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
12996 \advance\pgf@circ@res@other by \pinlen\relax
12997 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
12998 \ifpgfcirc@draw@output@leads
12999 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13000 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
13001 \pgfusepath{draw}
13002 \fi
13003 \fi
13004 }
13005 }
13006 }
13007
13008 \pgfcircdeclareieeetgate{tgate}{1}{%
13009 \pgfscope
13010 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13011 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
13012 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
13013 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
13014 \pgfpathclose
13015 \pgf@circ@draworfill
13016 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13017 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
13018 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
13019 \pgfpathclose
13020 \pgf@circ@draworfill
13021 \endpgfscope
13022 \pgfscope
13023 % 1.1547 is 1/cos(30)
13024 \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}}
13025 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
13026 \endpgfscope
13027 }
13028
13029 \pgfcircdeclareieeetgate{double tgate}{2}{%
13030 \pgfscope
13031 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13032 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
13033 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
13034 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13035 \pgfpathclose
13036 \pgf@circ@draworfill
13037 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13038 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
13039 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13040 \pgfpathclose
13041 \pgf@circ@draworfill
13042 % bottom triangles
13043 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
13044 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
13045 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13046 \pgfpathclose
13047 \pgf@circ@draworfill
13048 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
13049 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
13050 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13051 \pgfpathclose
13052 \pgf@circ@draworfill
13053 \endpgfscope
13054 \pgfscope
13055 % 1.1547 is 1/cos(30)
13056 \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}}
13057 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
13058 \endpgfscope
13059 }% %>>>
13060
13061 %% Path-style definitions for logical ports%<<<
13062 %
13063 % create path-style element for one input --- one output logical ports
13064 %
13065 \def\pgfcirc@port@node@to@path#1#2{%
13066 %
13067 % add a logic port path style component --- we need to suppress leads
13068 % and use the correct center
13069 %
13070 \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}%
13071 }
13072 \pgfcirc@port@node@to@path{not port}{inline not}
13073 \pgfcirc@port@node@to@path{buffer port}{inline buffer}
13074 \pgfcirc@port@node@to@path{schmitt port}{inline schmitt}
13075 \pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt}
13076
13077 \pgfcirc@port@node@to@path{tgate}{inline tgate}
13078 \pgfcirc@port@node@to@path{double tgate}{inline double tgate}
13079 % %>>>
13080
13081 %%%%%%%%%%%%%%%%%%%%%%%%
13082 %% Transistors
13083 %%%%%%%%%%%%%%%%%%%%%%%%
13084
13085 % Settings for Transistors %<<<1
13086
13087 \newif\ifpgf@circuit@trans@depletiontype
13088 \pgf@circuit@trans@depletiontypefalse
13089
13090 \newif\ifpgf@circuit@mos@arrows
13091 \ctikzset{tripoles/mos style/.is choice}
13092 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
13093 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
13094 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
13095 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
13096
13097 % Fixed label positions
13098 \newif\ifpgf@circuit@transisors@fixlabels
13099 \pgf@circuit@transisors@fixlabelstrue
13100 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
13101 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
13102 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
13103 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
13104
13105 % Option solderdot for fet
13106 \newif\ifpgf@circuit@fet@solderdot
13107 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
13108 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
13109 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
13110 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
13111
13112 % Option bodydiode for fet
13113 \newif\ifpgf@circuit@fet@bodydiode
13114 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
13115 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
13116 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
13117 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
13118
13119 % Option draw fet without gate connection
13120 \newif\ifpgf@circuit@bpt@drawgate
13121 \pgf@circuit@bpt@drawgatetrue
13122 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
13123 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
13124 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
13125 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
13126
13127 % Option draw bpt with schottky base
13128 \newif\ifpgf@circuit@bpt@schottky
13129 \pgf@circuit@bpt@schottkyfalse
13130 \pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
13131 \ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
13132 \pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
13133 \ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
13134 \ctikzset{tripoles/schottky base size/.initial=0.05}
13135
13136 % Option to add ferroelectric symbol
13137 \newif\ifpgf@circuit@tr@ferroel
13138 \pgf@circuit@tr@ferroelfalse
13139 \pgfkeys{/tikz/ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}}
13140 \ctikzset{ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}}
13141 \pgfkeys{/tikz/no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}}
13142 \ctikzset{no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}}
13143
13144
13145 % Option draw bpt without base connection
13146 \newif\ifpgf@circuit@bpt@drawbase
13147 \pgf@circuit@bpt@drawbasetrue
13148 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
13149 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
13150 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
13151 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
13152
13153 % Option draw bpt with optical input
13154 \newif\ifpgf@circuit@bpt@drawphoto
13155 \pgf@circuit@bpt@drawphotofalse
13156 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
13157 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
13158 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
13159 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
13160
13161 % Option draw fet without bulk connection -- Added by Burak Kelleci
13162 \newif\ifpgf@circuit@bpt@drawbulk
13163 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
13164 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
13165 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
13166 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
13167
13168 % Option draw pmos with empty circle
13169 \newif\ifpgf@circuit@pmos@emptycircle
13170 \pgf@circuit@pmos@emptycirclefalse
13171 \ctikzset{tripoles/pmos style/.is choice}
13172 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
13173 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
13174 % Option draw pmos with no circle
13175 \newif\ifpgf@circuit@pmos@nocircle
13176 \pgf@circuit@pmos@nocirclefalse
13177 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
13178 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
13179 % back to normal
13180 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
13181 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
13182 % arrows at the end, the correct way
13183 \newif\ifpgf@circuit@trans@arrowatend
13184 \pgf@circuit@trans@arrowatendfalse
13185 \ctikzset{transistors/arrow pos/.is choice}
13186 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
13187 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
13188
13189 \newif\ifpgf@circuit@trans@ntype
13190 \pgf@circuit@trans@ntypetrue %default true
13191 %\newif\ifpgf@circuit@trans@ptype
13192 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
13193 \ctikzset{tripoles/nmos/width/.initial=.7}
13194 \ctikzset{tripoles/nmos/gate height/.initial=.35}
13195 \ctikzset{tripoles/nmos/base height/.initial=.5}
13196 \ctikzset{tripoles/nmos/conn height/.initial=0}
13197 \ctikzset{tripoles/nmos/height/.initial=1.1}
13198 \ctikzset{tripoles/nmos/base width/.initial=.5}
13199 \ctikzset{tripoles/nmos/gate width/.initial=.62}
13200 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
13201 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
13202 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
13203 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
13204 \ctikzset{tripoles/nmos/curr direction/.initial=1}
13205
13206 \ctikzset{tripoles/pmos/width/.initial=.7}
13207 \ctikzset{tripoles/pmos/gate height/.initial=.35}
13208 \ctikzset{tripoles/pmos/base height/.initial=.5}
13209 \ctikzset{tripoles/pmos/conn height/.initial=0}
13210 \ctikzset{tripoles/pmos/height/.initial=1.1}
13211 \ctikzset{tripoles/pmos/base width/.initial=.5}
13212 \ctikzset{tripoles/pmos/gate width/.initial=.62}
13213 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
13214 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
13215 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
13216 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
13217 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
13218
13219 \ctikzset{tripoles/nmosd/width/.initial=.7}
13220 \ctikzset{tripoles/nmosd/gate height/.initial=.35}
13221 \ctikzset{tripoles/nmosd/base height/.initial=.5}
13222 \ctikzset{tripoles/nmosd/conn height/.initial=0}
13223 \ctikzset{tripoles/nmosd/height/.initial=1.1}
13224 \ctikzset{tripoles/nmosd/base width/.initial=.5}
13225 \ctikzset{tripoles/nmosd/gate width/.initial=.62}
13226 \ctikzset{tripoles/nmosd/arrow pos/.initial=.6}
13227 \ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3}
13228 \ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3}
13229 \ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6}
13230 \ctikzset{tripoles/nmosd/curr direction/.initial=1}
13231 \ctikzset{tripoles/nmosd/depletion width/.initial=.1}
13232 \ctikzset{tripoles/nmosd/depletion color/.initial=default}
13233
13234 \ctikzset{tripoles/pmosd/width/.initial=.7}
13235 \ctikzset{tripoles/pmosd/gate height/.initial=.35}
13236 \ctikzset{tripoles/pmosd/base height/.initial=.5}
13237 \ctikzset{tripoles/pmosd/conn height/.initial=0}
13238 \ctikzset{tripoles/pmosd/height/.initial=1.1}
13239 \ctikzset{tripoles/pmosd/base width/.initial=.5}
13240 \ctikzset{tripoles/pmosd/gate width/.initial=.62}
13241 \ctikzset{tripoles/pmosd/arrow pos/.initial=.4}
13242 \ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3}
13243 \ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3}
13244 \ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6}
13245 \ctikzset{tripoles/pmosd/curr direction/.initial=-1}
13246 \ctikzset{tripoles/pmosd/depletion width/.initial=.1}
13247 \ctikzset{tripoles/pmosd/depletion color/.initial=default}
13248 \ctikzset{tripoles/hemt/width/.initial=.7}
13249 \ctikzset{tripoles/hemt/gate height/.initial=.35}
13250 \ctikzset{tripoles/hemt/base height/.initial=.5}
13251 \ctikzset{tripoles/hemt/conn height/.initial=0}
13252 \ctikzset{tripoles/hemt/height/.initial=1.1}
13253 \ctikzset{tripoles/hemt/base width/.initial=.5}
13254 \ctikzset{tripoles/hemt/gate width/.initial=.5}% the horizontal position is the same
13255 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
13256 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
13257 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
13258 \ctikzset{tripoles/hemt/curr direction/.initial=1}
13259
13260 \ctikzset{tripoles/nfet/width/.initial=.7}
13261 \ctikzset{tripoles/nfet/gate height/.initial=.35}
13262 \ctikzset{tripoles/nfet/base height/.initial=.5}
13263 \ctikzset{tripoles/nfet/conn height/.initial=0}
13264 \ctikzset{tripoles/nfet/height/.initial=1.1}
13265 \ctikzset{tripoles/nfet/base width/.initial=.5}
13266 \ctikzset{tripoles/nfet/gate width/.initial=.62}
13267 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
13268 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
13269 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
13270 \ctikzset{tripoles/nfet/curr direction/.initial=1}
13271
13272 \ctikzset{tripoles/pfet/width/.initial=.7}
13273 \ctikzset{tripoles/pfet/gate height/.initial=.35}
13274 \ctikzset{tripoles/pfet/base height/.initial=.5}
13275 \ctikzset{tripoles/pfet/conn height/.initial=0}
13276 \ctikzset{tripoles/pfet/height/.initial=1.1}
13277 \ctikzset{tripoles/pfet/base width/.initial=.5}
13278 \ctikzset{tripoles/pfet/gate width/.initial=.62}
13279 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
13280 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
13281 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
13282 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
13283
13284 \ctikzset{tripoles/nfetd/width/.initial=.7}
13285 \ctikzset{tripoles/nfetd/gate height/.initial=.35}
13286 \ctikzset{tripoles/nfetd/base height/.initial=.5}
13287 \ctikzset{tripoles/nfetd/conn height/.initial=0}
13288 \ctikzset{tripoles/nfetd/height/.initial=1.1}
13289 \ctikzset{tripoles/nfetd/base width/.initial=.5}
13290 \ctikzset{tripoles/nfetd/gate width/.initial=.62}
13291 \ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3}
13292 \ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3}
13293 \ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6}
13294 \ctikzset{tripoles/nfetd/curr direction/.initial=1}
13295
13296 \ctikzset{tripoles/pfetd/width/.initial=.7}
13297 \ctikzset{tripoles/pfetd/gate height/.initial=.35}
13298 \ctikzset{tripoles/pfetd/base height/.initial=.5}
13299 \ctikzset{tripoles/pfetd/conn height/.initial=0}
13300 \ctikzset{tripoles/pfetd/height/.initial=1.1}
13301 \ctikzset{tripoles/pfetd/base width/.initial=.5}
13302 \ctikzset{tripoles/pfetd/gate width/.initial=.62}
13303 \ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3}
13304 \ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3}
13305 \ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6}
13306 \ctikzset{tripoles/pfetd/curr direction/.initial=-1}
13307
13308 \ctikzset{tripoles/nigfete/width/.initial=.7}
13309 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
13310 \ctikzset{tripoles/nigfete/base height/.initial=.5}
13311 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
13312 \ctikzset{tripoles/nigfete/height/.initial=1.1}
13313 \ctikzset{tripoles/nigfete/base width/.initial=.5}
13314 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
13315 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
13316 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
13317 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
13318 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
13319
13320 \ctikzset{tripoles/nigfetd/width/.initial=.7}
13321 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
13322 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
13323 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
13324 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
13325 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
13326 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
13327 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
13328 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
13329 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
13330 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
13331
13332 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
13333 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
13334 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
13335 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
13336 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
13337 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
13338 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
13339 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
13340 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
13341 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
13342 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
13343
13344 \ctikzset{tripoles/pigfete/width/.initial=.7}
13345 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
13346 \ctikzset{tripoles/pigfete/base height/.initial=.5}
13347 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
13348 \ctikzset{tripoles/pigfete/height/.initial=1.1}
13349 \ctikzset{tripoles/pigfete/base width/.initial=.5}
13350 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
13351 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
13352 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
13353 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
13354 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
13355
13356 \ctikzset{tripoles/pigfetd/width/.initial=.7}
13357 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
13358 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
13359 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
13360 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
13361 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
13362 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
13363 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
13364 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
13365 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
13366 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
13367
13368 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
13369 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
13370 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
13371 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
13372 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
13373 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
13374 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
13375 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
13376 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
13377 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
13378 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
13379
13380 \ctikzset{tripoles/npn/width/.initial=.6}
13381 \ctikzset{tripoles/npn/base height/.initial=.45}
13382 \ctikzset{tripoles/npn/base height 2/.initial=.15}
13383 \ctikzset{tripoles/npn/base height/.initial=.4}
13384 \ctikzset{tripoles/npn/conn height/.initial=0}
13385 \ctikzset{tripoles/npn/height/.initial=1.1}
13386 \ctikzset{tripoles/npn/base width/.initial=.5}
13387 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
13388 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
13389 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
13390 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
13391 \ctikzset{tripoles/npn/curr direction/.initial=1}
13392
13393 \ctikzset{tripoles/pnp/width/.initial=.6}
13394 \ctikzset{tripoles/pnp/base height/.initial=.45}
13395 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
13396 \ctikzset{tripoles/pnp/base height/.initial=.4}
13397 \ctikzset{tripoles/pnp/conn height/.initial=0}
13398 \ctikzset{tripoles/pnp/height/.initial=1.1}
13399 \ctikzset{tripoles/pnp/base width/.initial=.5}
13400 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
13401 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
13402 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
13403 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
13404 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
13405
13406 \ctikzset{tripoles/pigbt/width/.initial=.6}
13407 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
13408 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
13409 \ctikzset{tripoles/pigbt/base height/.initial=.4}
13410 \ctikzset{tripoles/pigbt/outer base height/.initial=.4}
13411 \ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
13412 \ctikzset{tripoles/pigbt/conn height/.initial=0}
13413 \ctikzset{tripoles/pigbt/height/.initial=1.1}
13414 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
13415 \ctikzset{tripoles/pigbt/base width/.initial=.5}
13416 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
13417 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
13418 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
13419 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
13420
13421 \ctikzset{tripoles/nigbt/width/.initial=.6}
13422 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
13423 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
13424 \ctikzset{tripoles/nigbt/base height/.initial=.4}
13425 \ctikzset{tripoles/nigbt/outer base height/.initial=.4}
13426 \ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
13427 \ctikzset{tripoles/nigbt/conn height/.initial=0}
13428 \ctikzset{tripoles/nigbt/height/.initial=1.1}
13429 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
13430 \ctikzset{tripoles/nigbt/base width/.initial=.5}
13431 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
13432 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
13433 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
13434 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
13435
13436 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
13437 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
13438 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
13439 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
13440 \ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
13441 \ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
13442 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
13443 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
13444 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
13445 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
13446 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
13447 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
13448 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
13449 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
13450
13451 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
13452 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
13453 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
13454 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
13455 \ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
13456 \ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
13457 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
13458 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
13459 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
13460 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
13461 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
13462 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
13463 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
13464 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
13465
13466 \ctikzset{tripoles/igbt/outer base height/.code={
13467 \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
13468 \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
13469 \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
13470 \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
13471 \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
13472 \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
13473 }}
13474 \ctikzset{tripoles/igbt/outer base thickness/.code={
13475 \ctikzset{tripoles/nigbt/outer base thickness=#1}
13476 \ctikzset{tripoles/pigbt/outer base thickness=#1}
13477 \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
13478 \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
13479 }}
13480
13481 \ctikzset{tripoles/njfet/width/.initial=.7}
13482 \ctikzset{tripoles/njfet/gate height/.initial=.5}
13483 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
13484 \ctikzset{tripoles/njfet/gate width/.initial=.5}
13485 \ctikzset{tripoles/njfet/base width/.initial=.5}
13486 \ctikzset{tripoles/njfet/conn height/.initial=.35}% at the exterior
13487 \ctikzset{tripoles/njfet/union height/.initial=.35}% at the gate
13488 \ctikzset{tripoles/njfet/conn kink/.initial=1}% 1=no kink
13489 \ctikzset{tripoles/njfet/height/.initial=1.1}
13490 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
13491 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
13492 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
13493 \ctikzset{tripoles/njfet/curr direction/.initial=1}
13494
13495 \ctikzset{tripoles/pjfet/width/.initial=.7}
13496 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
13497 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
13498 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
13499 \ctikzset{tripoles/pjfet/base width/.initial=.5}
13500 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
13501 \ctikzset{tripoles/pjfet/union height/.initial=.35}% at the gate
13502 \ctikzset{tripoles/pjfet/conn kink/.initial=1}% 1=no kink
13503 \ctikzset{tripoles/pjfet/height/.initial=1.1}
13504 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
13505 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
13506 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
13507 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
13508
13509 \ctikzset{tripoles/nujt/width/.initial=.7}
13510 \ctikzset{tripoles/nujt/gate height/.initial=.5}
13511 \ctikzset{tripoles/nujt/gate height 2/.initial=.35}
13512 \ctikzset{tripoles/nujt/gate width/.initial=.5}
13513 \ctikzset{tripoles/nujt/base width/.initial=.5}
13514 \ctikzset{tripoles/nujt/conn height/.initial=.35}
13515 \ctikzset{tripoles/nujt/union height/.initial=0}% at the gate
13516 \ctikzset{tripoles/nujt/conn kink/.initial=.82}% to match the circle position
13517 \ctikzset{tripoles/nujt/height/.initial=1.1}
13518 \ctikzset{tripoles/nujt/bodydiode scale/.initial=.3}
13519 \ctikzset{tripoles/nujt/bodydiode distance/.initial=.3}
13520 \ctikzset{tripoles/nujt/bodydiode conn/.initial=.6}
13521 \ctikzset{tripoles/nujt/curr direction/.initial=1}
13522
13523 \ctikzset{tripoles/pujt/width/.initial=.7}
13524 \ctikzset{tripoles/pujt/gate height/.initial=.5}
13525 \ctikzset{tripoles/pujt/gate height 2/.initial=.35}
13526 \ctikzset{tripoles/pujt/gate width/.initial=.5}
13527 \ctikzset{tripoles/pujt/base width/.initial=.5}
13528 \ctikzset{tripoles/pujt/conn height/.initial=.35}
13529 \ctikzset{tripoles/pujt/union height/.initial=0}% at the gate
13530 \ctikzset{tripoles/pujt/conn kink/.initial=.82}% to match the circle position
13531 \ctikzset{tripoles/pujt/height/.initial=1.1}
13532 \ctikzset{tripoles/pujt/bodydiode scale/.initial=.3}
13533 \ctikzset{tripoles/pujt/bodydiode distance/.initial=.3}
13534 \ctikzset{tripoles/pujt/bodydiode conn/.initial=.6}
13535 \ctikzset{tripoles/pujt/curr direction/.initial=-1}
13536
13537 \ctikzset{tripoles/isfet/width/.initial=1}
13538 \ctikzset{tripoles/isfet/gate height/.initial=.35}
13539 \ctikzset{tripoles/isfet/base height/.initial=.5}
13540 \ctikzset{tripoles/isfet/height/.initial=1.1}
13541 \ctikzset{tripoles/isfet/base width/.initial=.3}
13542 \ctikzset{tripoles/isfet/gate width/.initial=.5}
13543 \ctikzset{tripoles/isfet/conn height/.initial=0}
13544 \ctikzset{tripoles/isfet/wave width/.initial=.16}
13545 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
13546 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
13547 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
13548 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
13549 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
13550 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
13551 \ctikzset{tripoles/isfet/curr direction/.initial=1}
13552 %
13553 % graphene FET
13554 %
13555 \ctikzset{tripoles/pgfet/width/.initial=.6}
13556 \ctikzset{tripoles/pgfet/gate height/.initial=.5}
13557 \ctikzset{tripoles/pgfet/gate height 2/.initial=0.25} % must be "gate height"/2
13558 \ctikzset{tripoles/pgfet/base height/.initial=.5} % must be "gate height"
13559 \ctikzset{tripoles/pgfet/outer base height/.initial=.25} % must be "gate height 2"
13560 \ctikzset{tripoles/pgfet/outer base thickness/.initial=1}
13561 \ctikzset{tripoles/pgfet/conn height/.initial=0}
13562 \ctikzset{tripoles/pgfet/height/.initial=1.1}
13563 \ctikzset{tripoles/pgfet/gate width/.initial=.5}
13564 \ctikzset{tripoles/pgfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width)
13565 \ctikzset{tripoles/pgfet/bodydiode scale/.initial=.3}
13566 \ctikzset{tripoles/pgfet/bodydiode distance/.initial=.6}
13567 \ctikzset{tripoles/pgfet/bodydiode conn/.initial=.6}
13568 \ctikzset{tripoles/pgfet/curr direction/.initial=-1}
13569
13570 \ctikzset{tripoles/ngfet/width/.initial=.6}
13571 \ctikzset{tripoles/ngfet/gate height/.initial=.5}
13572 \ctikzset{tripoles/ngfet/gate height 2/.initial=0.25} % must be "gate height"/2
13573 \ctikzset{tripoles/ngfet/base height/.initial=.5} % must be "gate height"
13574 \ctikzset{tripoles/ngfet/outer base height/.initial=.25} % must be "gate height 2"
13575 \ctikzset{tripoles/ngfet/outer base thickness/.initial=1}
13576 \ctikzset{tripoles/ngfet/conn height/.initial=0}
13577 \ctikzset{tripoles/ngfet/height/.initial=1.1}
13578 \ctikzset{tripoles/ngfet/gate width/.initial=.5}
13579 \ctikzset{tripoles/ngfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width)
13580 \ctikzset{tripoles/ngfet/bodydiode scale/.initial=.3}
13581 \ctikzset{tripoles/ngfet/bodydiode distance/.initial=.6}
13582 \ctikzset{tripoles/ngfet/bodydiode conn/.initial=.6}
13583 \ctikzset{tripoles/ngfet/curr direction/.initial=1}
13584 %
13585 % multi-emitter and multi-collector BJTs by Romano Giannetti
13586 %
13587 \ctikzset{tripoles/bjt/emitters/.initial=1}
13588 \ctikzset{tripoles/bjt/collectors/.initial=1}
13589 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
13590 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
13591 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
13592 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
13593 \ctikzset{tripoles/bjt/multi height/.initial=.5}
13594 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
13595 %
13596 \ctikzset{tripoles/bjt/width/.initial=.3}
13597 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
13598 \ctikzset{tripoles/bjt/base height/.initial=1.1}
13599 \ctikzset{tripoles/bjt/height/.initial=.4}
13600 \ctikzset{tripoles/bjt/base width/.initial=1}
13601 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
13602 % do NOT touch these two!
13603 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
13604 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
13605
13606
13607 %
13608 % definitions for transistor circles
13609 %
13610 \ctikzset{transistor circle/.is family}
13611 \ctikzset{transistor circle/relative thickness/.initial=1}
13612 \ctikzset{transistor circle/color/.initial=default}
13613 \ctikzset{transistor circle/dash/.initial=none}
13614 \ctikzset{transistor circle/scale circle radius/.initial=1}
13615 \ctikzset{transistor circle/default base in/.initial=0.9}
13616 \ctikzset{transistor circle/njfet base in/.initial=1.05}
13617 \ctikzset{transistor circle/pjfet base in/.initial=1.05}
13618 \ctikzset{transistor circle/isfet base in/.initial=0.65}
13619
13620 \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse
13621 \ctikzset{tr circle/.is if=pgf@circ@trcircle}
13622 \tikzset{tr circle/.is if=pgf@circ@trcircle}
13623 %%>>>
13624
13625 %% definitions of transistor shapes%<<<
13626 %
13627 % add a circle to the transistor:
13628 %
13629 \def\pgfcirc@transistorcircle{
13630 \ifpgf@circ@trcircle
13631 \pgfscope
13632 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13633 \pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth}
13634 \edef\@@none{none}\edef\@@default{default}
13635 \edef\@@tmp{\ctikzvalof{transistor circle/color}}
13636 \ifx\@@tmp\@@default\else
13637 \pgfsetcolor{\@@tmp}
13638 \fi
13639 \edef\@@tmp{\ctikzvalof{transistor circle/dash}}
13640 \ifx\@@tmp\@@none\else
13641 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
13642 \fi
13643 % radius of the circle
13644 % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2}
13645 % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp}
13646 \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius}
13647 \pgf@circ@draworfill
13648 \endpgfscope
13649 \fi
13650 }
13651
13652 % add a ferroelectric squish to transistors
13653
13654 \def\pgfcirc@ferroelectric#1#2{% #1 -> transistor type, #2 horizontal enlargment (prop to ...@left),
13655 \ifpgf@circuit@tr@ferroel\pgfscope
13656 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13657 \pgf@circ@set@relative@thickness{modifier thickness}
13658 % base-gate center and width of the sigmoid
13659 \pgfmathsetlength{\pgf@circ@res@other}
13660 {0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width}-(#2))*\pgf@circ@res@left}
13661 \pgfmathsetlength{\pgf@circ@res@temp}
13662 {1.2*abs(\ctikzvalof{tripoles/#1/gate width}-\ctikzvalof{tripoles/#1/base width}+0.5*(#2))*\pgf@circ@res@left}
13663 \pgfsetcornersarced{\pgfpoint{-0.2\pgf@circ@res@temp}{-0.2\pgf@circ@res@temp}}
13664 \pgfpathmoveto{\pgfpoint
13665 {\pgf@circ@res@other+\pgf@circ@res@temp}
13666 {1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}}
13667 \pgfpathlineto{\pgfpoint
13668 {\pgf@circ@res@other+\pgf@circ@res@temp}
13669 {0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}}
13670 \pgfpathlineto{\pgfpoint
13671 {\pgf@circ@res@other-\pgf@circ@res@temp}
13672 {0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}}
13673 \pgfpathlineto{\pgfpoint
13674 {\pgf@circ@res@other-\pgf@circ@res@temp}
13675 {1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}}
13676 \pgfusepath{draw}
13677 \endpgfscope\fi
13678 }
13679
13680 \ctikzset{tr gap fill/.initial=none}
13681 \tikzset{tr gap fill/.style={\circuitikzbasekey/tr gap fill={#1}}}
13682 % fill the gap in relevant transistors
13683 \def\pgfcirc@fillgategap#1{% #1 transistor type
13684 \edef\@@@none{none}\edef\@@@color{\ctikzvalof{tr gap fill}}% always exists
13685 \ifx\@@@none\@@@color\relax\else
13686 \begingroup % save the value of @res: other, step, temp
13687 \edef\@@@doit{1}% draw it, set to zero if we give up
13688 % ok, we have the color here. we have to get center position, with and height
13689 % normally is gate height; but in igbt is outer base height (grrrr)
13690 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/outer base height}{
13691 % yes, it's an IGBT
13692 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/outer base height}*\pgf@circ@res@up}
13693 }{
13694 %no. Let's try with gate height
13695 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate height}{
13696 % yes, go for it
13697 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/gate height}*\pgf@circ@res@up}
13698 }{
13699 %no, give up, let value to 0
13700 \edef\@@@doit{0}
13701 }
13702 }
13703 % now we have to find x1 and x2: these are base width and gate width
13704 % if do not have one of that, bail out.
13705 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{
13706 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{tripoles/#1/gate width}*\pgf@circ@res@left}
13707 }{
13708 \edef\@@@doit{0}
13709 }
13710 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/base width}{
13711 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}
13712 }{
13713 \edef\@@@doit{0}
13714 }
13715 % if found, draw it.
13716 \ifnum\@@@doit>0\relax
13717 \pgfscope
13718 \pgfsetfillcolor{\@@@color}
13719 \pgfsetcolor{\@@@color}
13720 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@other}}
13721 \pgfusepath{fill, draw}
13722 \endpgfscope
13723 \fi
13724 \endgroup
13725 \fi
13726 }
13727
13728 \long\def\pgfcircdeclaretransistor#1#2#3{
13729 \pgfdeclareshape{#1}
13730 {
13731 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
13732 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13733 \savedmacro{\circlebase}{
13734 \pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}%
13735 {% yes, we have it
13736 \edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}%
13737 }{% no, use default
13738 \edef\circlebase{\ctikzvalof{transistor circle/default base in}}
13739 }}
13740 % \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}}
13741 \saveddimen{\extrabodydiodelen}{
13742 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13743 \ifpgf@circuit@fet@bodydiode
13744 % try to put the text to the right of the flyback diode
13745 \pgfmathsetlength{\pgf@x}{(
13746 \ctikzvalof{tripoles/#1/bodydiode distance}*
13747 \ctikzvalof{tripoles/#1/width} +
13748 \ctikzvalof{tripoles/#1/bodydiode scale}*
13749 \ctikzvalof{bipoles/diode/height}/2
13750 )*\pgf@circ@scaled@Rlen}
13751 \else
13752 \pgf@x=0pt\relax
13753 \fi
13754 }
13755 \savedmacro{\scalecircleradius}{
13756 \edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}}
13757 }
13758 \saveddimen{\circleradius}{
13759 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13760 % repeat the extrabodydiodelen (grrr)
13761 \ifpgf@circuit@fet@bodydiode
13762 % try to put the text to the right of the flyback diode
13763 \pgfmathsetlength{\pgf@circ@res@other}{(
13764 \ctikzvalof{tripoles/#1/bodydiode distance}*
13765 \ctikzvalof{tripoles/#1/width} +
13766 \ctikzvalof{tripoles/#1/bodydiode scale}*
13767 \ctikzvalof{bipoles/diode/height}/2
13768 )*\pgf@circ@scaled@Rlen}
13769 \else
13770 \pgf@circ@res@other=0pt\relax
13771 \fi
13772 % left
13773 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13774 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
13775 % northeast
13776 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
13777 \pgf@yb=.5\pgf@yb
13778 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
13779 %
13780 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
13781 % find the radius of the circle
13782 \pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
13783 }
13784 \saveddimen{\circleleft}{
13785 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13786 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13787 \pgf@x=\circlebase\pgf@xa
13788 }
13789 \anchor{circle center}{
13790 \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius
13791 }
13792 \savedanchor{\centergap}{% this is the center position between gate and base
13793 % get "left"
13794 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13795 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13796 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{
13797 % yes, we have a separated gate
13798 \pgfmathsetlength{\pgf@x}
13799 {0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width})*\pgf@xa}
13800 }{
13801 % no, use just the base
13802 \pgfmathsetlength{\pgf@x}
13803 {\ctikzvalof{tripoles/#1/base width}*\pgf@xa}
13804 }
13805 \pgf@y=0pt\relax
13806 }
13807 \anchor{centergap}{\centergap}
13808 \anchor{center}{
13809 \pgfpointorigin
13810 }
13811 \savedanchor\northeast{% upper right
13812 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13813 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
13814 \pgf@y=.5\pgf@y
13815 \pgf@x=0pt
13816 }
13817 \savedanchor\left{%center left
13818 \pgf@y=0pt
13819 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13820 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13821 }
13822 \savedanchor\right{
13823 \pgf@x=0pt\pgf@y=0pt
13824 \ifpgf@circ@trcircle
13825 % repeat the \circleradius computation (GRRRR)
13826 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13827 % repeat the extrabodydiodelen (grrr)
13828 \ifpgf@circuit@fet@bodydiode
13829 % try to put the text to the right of the flyback diode
13830 \pgfmathsetlength{\pgf@circ@res@other}{(
13831 \ctikzvalof{tripoles/#1/bodydiode distance}*
13832 \ctikzvalof{tripoles/#1/width} +
13833 \ctikzvalof{tripoles/#1/bodydiode scale}*
13834 \ctikzvalof{bipoles/diode/height}/2
13835 )*\pgf@circ@scaled@Rlen}
13836 \else
13837 \pgf@circ@res@other=0pt\relax
13838 \fi
13839 % left
13840 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13841 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
13842 % northeast
13843 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
13844 \pgf@yb=.5\pgf@yb
13845 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
13846 %
13847 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
13848 % find the radius of the circle
13849 \pgfmathsetlength{\pgf@circ@res@other}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
13850 % repeat the circleleft computation
13851 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13852 \pgf@xb=\circlebase\pgf@xa
13853 \pgfmathsetlength{\pgf@x}{\pgf@xb+2*\pgf@circ@res@other}
13854 \fi
13855 }
13856 \anchor{text}{
13857 \northeast
13858 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13859 \ifpgf@circuit@transisors@fixlabels
13860 \ifpgf@circuit@fet@bodydiode
13861 \advance \pgf@x by \extrabodydiodelen
13862 \fi
13863 \ifpgf@circ@trcircle
13864 \left\pgf@xa=\pgf@x
13865 \pgfmathsetlength{\pgf@x}{\circleleft+2*\circleradius}
13866 % \advance \pgf@x by \circleradius
13867 \fi
13868 % add a bit of space to avoid central (substrate) terminal if drawn
13869 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
13870 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13871 \else
13872 \pgf@y=.7\pgf@y
13873 \pgf@x= \pgf@circ@scaled@Rlen
13874 \pgf@x=0.1\pgf@x
13875 \fi
13876 }
13877 \anchor{pathstart}{ % south
13878 \northeast
13879 \pgf@y=-\pgf@y
13880 }
13881 \anchor{pathend}{
13882 \northeast
13883 }
13884 \anchor{north}{
13885 \northeast
13886 \pgf@circ@res@step=\pgf@y
13887 \left
13888 \pgf@y=\pgf@circ@res@step
13889 \pgf@x=.5\pgf@x
13890 }
13891 \anchor{west}{
13892 \left
13893 }
13894 \anchor{left}{
13895 \left
13896 }
13897 \anchor{east}{
13898 \northeast
13899 \pgf@y=0pt
13900 }
13901 \anchor{right}{
13902 \right
13903 }
13904 \anchor{south}{
13905 \northeast
13906 \pgf@circ@res@step=\pgf@y
13907 \left
13908 \pgf@y=-\pgf@circ@res@step
13909 \pgf@x=.5\pgf@x
13910 }
13911 \anchor{south west}{
13912 \northeast
13913 \pgf@circ@res@step=\pgf@y
13914 \left
13915 \pgf@y=-\pgf@circ@res@step
13916 }
13917 \anchor{north east}{
13918 \northeast
13919 }
13920 \anchor{north west}{
13921 \northeast
13922 \pgf@circ@res@step=\pgf@y
13923 \left
13924 \pgf@y=\pgf@circ@res@step
13925 }
13926 \anchor{south east}{
13927 \northeast
13928 \pgf@y=-\pgf@y
13929 }
13930 \anchor{B}{
13931 \northeast
13932 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13933 \left
13934 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13935 }
13936 \anchor{base}{
13937 \northeast
13938 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13939 \left
13940 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13941 }
13942 \anchor{bulk}{ %added by Burak Kelleci
13943 \northeast
13944 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13945 \right
13946 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13947 }
13948 \anchor{nobulk}{ %added by Burak Kelleci
13949 \left
13950 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
13951 }
13952 \anchor{G}{
13953 \northeast
13954 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13955 \left
13956 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13957 }
13958 \anchor{gate}{
13959 \northeast
13960 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13961 \left
13962 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13963 }
13964 \anchor{nobase}{
13965 \left
13966 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
13967 }
13968 \anchor{circle base}{
13969 \left
13970 \pgf@x=\circlebase\pgf@x
13971 }
13972 \anchor{nogate}{
13973 \left
13974 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
13975 }
13976 \anchor{E}{
13977 \northeast
13978 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13979 }
13980 \anchor{emitter}{
13981 \northeast
13982 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13983 }
13984 \anchor{C}{
13985 \northeast
13986 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13987 }
13988 \anchor{collector}{
13989 \northeast
13990 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13991 }
13992 \anchor{S}{
13993 \northeast
13994 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13995 }
13996 \anchor{source}{
13997 \northeast
13998 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13999 }
14000 \anchor{D}{
14001 \northeast
14002 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
14003 }
14004 \anchor{drain}{
14005 \northeast
14006 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
14007 }
14008 \anchor{body C in}{
14009 \northeast
14010 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
14011 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
14012 }
14013 \anchor{circle C}{
14014 \left
14015 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
14016 \northeast
14017 \pgf@xb=\pgf@x %this is #2 of the circle
14018 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
14019 % the base of the triangle is x_2 - x_1 - r
14020 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
14021 % so let's go with the height
14022 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
14023 % finally, direction
14024 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
14025 }
14026 \anchor{circle E}{
14027 \left
14028 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
14029 \northeast
14030 \pgf@xb=\pgf@x %this is #2 of the circle
14031 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
14032 % the base of the triangle is x_2 - x_1 - r
14033 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
14034 % so let's go with the height
14035 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
14036 % finally, direction
14037 % finally, direction
14038 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
14039 }
14040 \anchor{body E in}{
14041 \northeast
14042 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
14043 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
14044 }
14045 \anchor{body C out}{
14046 \northeast
14047 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
14048 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
14049 \pgf@y=\pgf@ya
14050 \left
14051 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
14052 \pgf@y=\pgf@ya
14053 }
14054 \anchor{body E out}{
14055 \northeast
14056 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
14057 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
14058 \pgf@y=\pgf@ya
14059 \left
14060 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
14061 \pgf@y=\pgf@ya
14062 }
14063 #2
14064 \backgroundpath{
14065 \pgftransformationadjustments
14066 \pgfsetcolor{\ctikzvalof{color}}
14067 %
14068 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
14069 \pgf@circuit@trans@ntypetrue
14070 \else
14071 \pgf@circuit@trans@ntypefalse
14072 \fi
14073 \northeast
14074 \pgf@circ@res@up = \pgf@y
14075 \pgf@circ@res@down = -\pgf@y
14076 \pgf@circ@res@right = \pgf@x
14077 \left
14078 \pgf@circ@res@left = \pgf@x
14079 \pgf@circ@scaled@Rlen=\scaledRlen
14080 %
14081 #3
14082 % BODY DIODE
14083 \ifpgf@circuit@fet@bodydiode
14084 \drawbodydiode{#1}
14085 \fi
14086 %
14087 }
14088 }
14089 }
14090
14091 \long\def\drawbodydiode#1{
14092 \pgfscope
14093 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
14094 \pgftransformrotate{90}
14095 % diode scale and bodydiode scale interacts. We want the size of the diode
14096 % proportional to the transistor, so we will:
14097 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
14098 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
14099 \pgftransformscale{\@@BDscale}
14100 \ifpgf@circuit@fulldiode
14101 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
14102 \else
14103 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
14104 \fi
14105 \endpgfscope
14106 % Draw stroke line
14107 \ifpgf@circuit@strokediode
14108 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
14109 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
14110 \pgfusepath{stroke}
14111 \fi
14112 %Draw upper connection to body diode
14113 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
14114 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
14115 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
14116 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
14117 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
14118 \pgfusepath{draw}
14119 \pgfscope
14120 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
14121 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
14122 \pgftransformscale{0.5}
14123 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
14124 \endpgfscope{}
14125 %Draw lower connection to body diode
14126 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
14127 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
14128 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
14129 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
14130 \pgfusepath{draw}
14131 \pgfscope
14132 \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
14133 \pgftransformscale{0.5}
14134 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
14135 \endpgfscope
14136 }
14137
14138 \long\def\declarebpt#1{
14139 \pgfcircdeclaretransistor{#1}{
14140 \anchor{inner up}{
14141 \northeast
14142 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
14143 }
14144 \anchor{inner down}{
14145 \northeast
14146 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
14147 }
14148 }{
14149
14150 % add the circle if requested (before everything else, so we can fill it)
14151 \pgfcirc@transistorcircle
14152
14153 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14154 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14155 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
14156 \pgfpathlineto{\pgfpoint
14157 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14158 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
14159 \pgfusepath{draw}
14160
14161 % drawing base
14162 \pgfscope
14163 \pgfpathmoveto{\pgfpoint
14164 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14165 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
14166 \pgfpathlineto{\pgfpoint
14167 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14168 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
14169 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14170 \ifpgf@circuit@bpt@schottky
14171 % upper
14172 \pgfpathmoveto{\pgfpoint
14173 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14174 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
14175 \pgfpathlineto{\pgfpoint
14176 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14177 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
14178 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14179 \pgfpathlineto{\pgfpoint
14180 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
14181 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14182 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
14183 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14184 \pgfpathlineto{\pgfpoint
14185 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
14186 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14187 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
14188 % % lower
14189 \pgfpathmoveto{\pgfpoint
14190 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14191 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
14192 \pgfpathlineto{\pgfpoint
14193 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14194 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
14195 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14196 \pgfpathlineto{\pgfpoint
14197 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
14198 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14199 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
14200 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14201 \pgfpathlineto{\pgfpoint
14202 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
14203 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14204 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
14205 \fi
14206 \pgfusepath{draw}
14207 \endpgfscope
14208
14209 \pgfpathmoveto{\pgfpoint
14210 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14211 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
14212 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14213 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
14214 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14215 \pgfusepath{draw}
14216 %draw arrow depending on type of transistor
14217 \pgfscope
14218 \pgfslopedattimetrue
14219 \pgfallowupsidedownattimetrue
14220 \pgfresetnontranslationattimefalse
14221 \edef\@@anchor{center}
14222 \ifpgf@circuit@trans@ntype
14223 \ifpgf@circuit@trans@arrowatend
14224 \edef\@@anchor{btip}
14225 \pgftransformlineattime{1.0}{%
14226 \pgfpoint%
14227 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14228 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
14229 }{%
14230 \pgfpoint{\pgf@circ@res@right}%
14231 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
14232 }
14233 \else
14234 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
14235 \pgfpoint%
14236 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14237 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
14238 }{%
14239 \pgfpoint{\pgf@circ@res@right}%
14240 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
14241 }
14242 \fi
14243 \else % p-type
14244 \ifpgf@circuit@trans@arrowatend
14245 \edef\@@anchor{tip}
14246 \pgftransformlineattime{1.0}{%
14247 \pgfpoint{\pgf@circ@res@right}%
14248 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
14249 }{%
14250 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14251 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
14252 }
14253 \else
14254 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
14255 \pgfpoint{\pgf@circ@res@right}%
14256 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
14257 }{%
14258 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14259 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
14260 }
14261 \fi
14262 \fi
14263 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14264 \endpgfscope
14265
14266 \ifpgf@circuit@bpt@drawphoto
14267 \pgfscope
14268 \pgfsetarrowsstart{latexslim}
14269 \pgfpathmoveto{\pgfpointadd{\pgfpoint
14270 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14271 {\pgf@circ@res@up+\pgf@circ@res@down}}
14272 {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
14273 \pgfpathlineto{\pgfpointadd{\pgfpoint
14274 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14275 {\pgf@circ@res@up+\pgf@circ@res@down}}
14276 {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}}
14277 \pgfusepath{draw}
14278 \pgfpathmoveto{\pgfpointadd{\pgfpoint
14279 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14280 {\pgf@circ@res@up+\pgf@circ@res@down}}
14281 {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}}
14282 \pgfpathlineto{\pgfpointadd{\pgfpoint
14283 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14284 {\pgf@circ@res@up+\pgf@circ@res@down}}
14285 {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
14286 \pgfusepath{draw}
14287 \endpgfscope
14288 \else
14289 \ifpgf@circuit@bpt@drawbase
14290 \pgfpathmoveto{\pgfpoint
14291 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14292 {\pgf@circ@res@up+\pgf@circ@res@down}}
14293 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
14294 \pgfusepath{draw}
14295 \fi
14296 \fi
14297 }
14298 }
14299
14300 \declarebpt{npn}
14301 \declarebpt{pnp}
14302 %
14303 % multi-emitter and multi-collector BJTs by Romano Giannetti
14304 %
14305 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
14306 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
14307 \pgfextracty{\pgf@circ@res@other}{\basedimension}
14308 \ifnum\cdir>0 % NPN, above
14309 \pgfpoint{\pgf@circ@res@temp}{%
14310 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
14311 \else % PNP, below
14312 \pgfpoint{\pgf@circ@res@temp}{%
14313 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
14314 \fi
14315 }
14316 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
14317 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
14318 \pgfextracty{\pgf@circ@res@other}{\basedimension}
14319 \ifnum\cdir<0 % PNP, above
14320 \pgfpoint{\pgf@circ@res@temp}{%
14321 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
14322 \else % PNP, below
14323 \pgfpoint{\pgf@circ@res@temp}{%
14324 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
14325 \fi
14326 }
14327
14328 \long\def\declarebjt#1{
14329 \pgfdeclareshape{bjt#1}{
14330 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
14331 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14332 % \cdir is 1 for npn, -1 for pnp
14333 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
14334 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
14335 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
14336 % step up or down for the additional C/Es
14337 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
14338 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
14339 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
14340 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
14341 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
14342 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
14343 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14344 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
14345 \pgf@y=.5\pgf@y
14346 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
14347 \pgf@x=.5\pgf@x
14348 }
14349 \savedanchor\northeast{% upper right
14350 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14351 \pgfmathsetlength{\pgf@circ@res@step}{%
14352 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
14353 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14354 \ifnum\cdir> 0
14355 \edef\numup{\numC}\edef\numdown{\numE}
14356 \else
14357 \edef\numup{\numE}\edef\numdown{\numC}
14358 \fi
14359 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
14360 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
14361 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14362 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
14363 \pgf@x=.5\pgf@x
14364 }
14365 \savedanchor\southeast{% lower right
14366 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14367 \pgfmathsetlength{\pgf@circ@res@step}{%
14368 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
14369 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14370 \ifnum\cdir> 0
14371 \edef\numup{\numC}\edef\numdown{\numE}
14372 \else
14373 \edef\numup{\numE}\edef\numdown{\numC}
14374 \fi
14375 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
14376 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
14377 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14378 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
14379 \pgf@x=.5\pgf@x
14380 }
14381 \savedanchor\southwest{% lower left
14382 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14383 \pgfmathsetlength{\pgf@circ@res@step}{%
14384 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
14385 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14386 \ifnum\cdir> 0
14387 \edef\numup{\numC}\edef\numdown{\numE}
14388 \else
14389 \edef\numup{\numE}\edef\numdown{\numC}
14390 \fi
14391 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
14392 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
14393 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14394 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
14395 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14396 }
14397 \anchor{center}{\pgfpointorigin}
14398 \anchor{north}{\northeast\pgf@x=0cm\relax}
14399 \anchor{east}{\northeast\pgf@y=0cm\relax}
14400 \anchor{south}{\southwest\pgf@x=0cm\relax}
14401 \anchor{west}{\southwest\pgf@y=0cm}
14402 \anchor{north east}{\northeast}
14403 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
14404 \anchor{south west}{\southwest}
14405 \anchor{south east}{\southeast}
14406
14407 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
14408 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
14409 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
14410 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
14411 % center of the base "bar"
14412 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
14413 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
14414 }
14415 % geometrical centers
14416 \anchor{vcenter}{\pgf@x=0cm\relax
14417 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
14418 }
14419 \anchor{gcenter}{%
14420 \northeast\pgf@xa=0.5\pgf@x
14421 \southwest\advance\pgf@xa by 0.5\pgf@x
14422 \pgf@x=\pgf@xa
14423 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
14424 }
14425 % external connections
14426 \anchor{E}{
14427 \ifnum\cdir>0% npn, emitter down
14428 \southeast
14429 \else
14430 \northeast
14431 \fi
14432 }% first emitter
14433 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
14434 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
14435 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
14436
14437 \backgroundpath{
14438 \pgftransformationadjustments
14439 \pgfsetcolor{\ctikzvalof{color}}
14440 %
14441 % set the type and up and down number of connections
14442 %
14443 \ifnum\cdir> 0
14444 \pgf@circuit@trans@ntypetrue
14445 \edef\numup{\numC}
14446 \edef\numdown{\numE}
14447 \else
14448 \pgf@circuit@trans@ntypefalse
14449 \edef\numup{\numE}
14450 \edef\numdown{\numC}
14451 \fi
14452 \basedimension
14453 \pgf@circ@res@up = \pgf@y
14454 \pgf@circ@res@down = -\pgf@y
14455 \pgf@circ@res@right = \pgf@x
14456 \pgf@circ@res@left = -\pgf@x
14457 \pgf@circ@scaled@Rlen=\scaledRlen
14458 \pgf@circ@res@step=\multistep
14459 %
14460 % set arrow positions options
14461 %
14462 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
14463 \ifpgf@circuit@trans@arrowatend
14464 \edef\@@pos{1.0}
14465 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
14466 \edef\@@anchor{btip}
14467 \else
14468 \edef\@@anchor{tip}
14469 \fi
14470 \fi
14471 %
14472 % Drawing upper connections
14473 %
14474 \pgfscope
14475 \pgf@circ@count@a=\numup\relax
14476 \pgfmathloop%
14477 \ifnum\pgf@circ@count@a>0
14478 \advance\pgf@circ@count@a-1\relax
14479 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
14480 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
14481 \pgfpathmoveto{\pgfpoint
14482 {\pgf@circ@res@right}%
14483 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
14484 \pgfpathlineto{\pgfpoint
14485 {\pgf@circ@res@right}%
14486 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
14487 \else
14488 \pgfpathmoveto{\pgfpoint
14489 {\pgf@circ@res@right}%
14490 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
14491 \fi
14492 \pgfpathlineto{\pgfpoint
14493 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
14494 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
14495 \pgfsetroundcap % better when connecting to sloped lines
14496 \pgfusepath{draw}
14497 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
14498 \pgfscope
14499 \pgfslopedattimetrue
14500 \pgfallowupsidedownattimetrue
14501 \pgfresetnontranslationattimefalse
14502 \pgftransformlineattime{\@@pos}{%
14503 \pgfpoint
14504 {\pgf@circ@res@right}%
14505 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
14506 }{\pgfpoint
14507 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
14508 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
14509 }
14510 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14511 \endpgfscope
14512 \fi
14513 \repeatpgfmathloop
14514 \endpgfscope
14515 %
14516 % Drawing base
14517 %
14518 \pgfscope
14519 \pgfpathmoveto{\pgfpoint
14520 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14521 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
14522 \pgfpathlineto{\pgfpoint
14523 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14524 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
14525 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14526 \ifpgf@circuit@bpt@schottky
14527 % upper
14528 \pgfpathmoveto{\pgfpoint
14529 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14530 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
14531 \pgfpathlineto{\pgfpoint
14532 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14533 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
14534 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14535 \pgfpathlineto{\pgfpoint
14536 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
14537 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14538 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
14539 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14540 \pgfpathlineto{\pgfpoint
14541 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
14542 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14543 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
14544 % lower
14545 \pgfpathmoveto{\pgfpoint
14546 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14547 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
14548 \pgfpathlineto{\pgfpoint
14549 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14550 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
14551 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14552 \pgfpathlineto{\pgfpoint
14553 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
14554 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14555 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
14556 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14557 \pgfpathlineto{\pgfpoint
14558 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
14559 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14560 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
14561 \fi
14562 \pgfsetroundcap % I like it more...
14563 \pgfusepath{draw}
14564 \endpgfscope
14565 %
14566 % draw base external connection
14567 %
14568 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
14569 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
14570 \pgfusepath{draw}
14571 %
14572 % Drawing lower connections
14573 %
14574 \pgfscope
14575 \pgf@circ@count@a=\numdown\relax
14576 \pgfmathloop%
14577 \ifnum\pgf@circ@count@a>0
14578 \advance\pgf@circ@count@a-1\relax
14579 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
14580 \pgfpathmoveto{\pgfpoint
14581 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14582 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
14583 \pgfpathlineto{\pgfpoint
14584 {\pgf@circ@res@right}
14585 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
14586 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
14587 \pgfpathlineto{\pgfpoint
14588 {\pgf@circ@res@right}
14589 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
14590 \fi
14591 \pgfsetroundcap % better when connecting to sloped lines
14592 \pgfusepath{draw}
14593 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
14594 \pgfscope
14595 \pgfslopedattimetrue
14596 \pgfallowupsidedownattimetrue
14597 \pgfresetnontranslationattimefalse
14598 \pgftransformlineattime{\@@pos}{%
14599 \pgfpoint
14600 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
14601 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
14602 }{\pgfpoint
14603 {\pgf@circ@res@right}%
14604 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
14605 }
14606 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14607 \endpgfscope
14608 \fi
14609 \repeatpgfmathloop
14610 \endpgfscope
14611 }
14612 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
14613 % and is executed just before a node is drawn.
14614 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
14615 % Start with the maximum collector number and go backwards.
14616 \pgf@circ@count@a=\numC\relax
14617 \pgfmathloop%
14618 \ifnum\pgf@circ@count@a>0
14619 % we will create two anchors per pin: the "normal one" like `pin 1` for the
14620 % electrical contact, and the "border one" like `bpin 1` for labels.
14621 % they will coincide if `external pins width` is set to 0.
14622 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
14623 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
14624 }
14625 \advance\pgf@circ@count@a by -1\relax%
14626 \repeatpgfmathloop%
14627 % and emitters
14628 \pgf@circ@count@a=\numE\relax
14629 \pgfmathloop%
14630 \ifnum\pgf@circ@count@a>0
14631 % we will create two anchors per pin: the "normal one" like `pin 1` for the
14632 % electrical contact, and the "border one" like `bpin 1` for labels.
14633 % they will coincide if `external pins width` is set to 0.
14634 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
14635 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
14636 }
14637 \advance\pgf@circ@count@a by -1\relax%
14638 \repeatpgfmathloop%
14639 }%
14640 }
14641 }
14642
14643 \declarebjt{npn}
14644 \declarebjt{pnp}
14645
14646 % end of multi-bjts
14647
14648 \long\def\declareigbt#1{
14649 \pgfcircdeclaretransistor{#1}{
14650 \anchor{inner up}{
14651 \northeast
14652 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
14653 }
14654 \anchor{inner down}{
14655 \northeast
14656 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
14657 }
14658 \anchor{nobase}{
14659 \left
14660 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
14661 }
14662 }
14663 {
14664 % add the circle if requested (before everything else, so we can fill it)
14665 \pgfcirc@transistorcircle
14666 % fill the gap color if requested
14667 \pgfcirc@fillgategap{#1}
14668 %draw upper connection
14669 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14670 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14671 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
14672 \pgfpathlineto{\pgfpoint
14673 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14674 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
14675 \pgfusepath{draw}
14676
14677 %draw thicker gate lines
14678 \pgfscope
14679 \pgfscope
14680 \pgfpathmoveto{\pgfpoint
14681 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14682 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14683 \pgfpathlineto{\pgfpoint
14684 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14685 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14686 % set the normal thickness
14687 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14688 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
14689 \pgfsetlinewidth{\@@extrat\pgflinewidth}
14690 \pgfusepath{draw}
14691 \endpgfscope
14692 \pgfpathmoveto{\pgfpoint
14693 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14694 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14695 \pgfpathlineto{\pgfpoint
14696 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14697 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14698 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14699 \pgfusepath{draw}
14700 \endpgfscope
14701 %draw lower connection
14702 \pgfpathmoveto{\pgfpoint
14703 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14704 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
14705 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14706 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
14707 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14708 \pgfusepath{draw}
14709 %draw arrow depending on type of transistor
14710 \pgfscope
14711 \pgfslopedattimetrue
14712 \pgfallowupsidedownattimetrue
14713 \pgfresetnontranslationattimefalse
14714 \ifpgf@circuit@trans@arrowatend
14715 \ifpgf@circuit@trans@ntype
14716 \edef\@@anchor{btip}\edef\@@pos{1.0}
14717 \else
14718 \edef\@@anchor{tip}\edef\@@pos{1.0}
14719 \fi
14720 \else
14721 \edef\@@anchor{center}\edef\@@pos{0.5}
14722 \fi
14723 \ifpgf@circuit@trans@ntype
14724 \pgftransformlineattime{\@@pos}{%
14725 \pgfpoint%
14726 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14727 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
14728 }{%
14729 \pgfpoint{\pgf@circ@res@right}%
14730 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
14731 }
14732 \else
14733 \pgftransformlineattime{\@@pos}{%
14734 \pgfpoint{\pgf@circ@res@right}%
14735 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
14736 }{%
14737 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14738 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
14739 }
14740 \fi
14741 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14742 \endpgfscope
14743 %draw gate
14744 \ifpgf@circuit@bpt@drawgate
14745 \ifpgf@circuit@trans@ntype
14746 \pgfpathmoveto{\pgfpoint
14747 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14748 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14749 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
14750 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14751 \else
14752 \pgfpathmoveto{\pgfpoint
14753 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14754 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
14755 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
14756 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
14757 \fi
14758 \fi
14759 \pgfusepath{draw}
14760 }
14761 }
14762
14763 \declareigbt{pigbt}
14764 \declareigbt{nigbt}
14765 \declareigbt{Lnigbt}
14766 \declareigbt{Lpigbt}
14767
14768 % Graphene FET, See https://github.com/circuitikz/circuitikz/issues/496
14769 \long\def\declaregfet#1{
14770 \pgfcircdeclaretransistor{#1}{
14771 \anchor{inner up}{
14772 \northeast
14773 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
14774 }
14775 \anchor{inner down}{
14776 \northeast
14777 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
14778 }
14779 \anchor{outer hex up}{
14780 \left
14781 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
14782 \northeast
14783 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
14784 \pgf@x=-\pgf@xa
14785 }
14786 \anchor{outer hex down}{
14787 \left
14788 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
14789 \northeast
14790 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
14791 \pgf@y=-\pgf@y
14792 \pgf@x=-\pgf@xa
14793 }
14794 \anchor{inner hex up}{
14795 \left
14796 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
14797 \northeast
14798 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
14799 \pgf@x=\pgf@xa
14800 }
14801 \anchor{inner hex down}{
14802 \left
14803 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
14804 \northeast
14805 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
14806 \pgf@y=-\pgf@y
14807 \pgf@x=\pgf@xa
14808 }
14809 \anchor{right}{
14810 \northeast\pgf@y=0pt\relax
14811 \pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}*
14812 \ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen}
14813 \advance \pgf@x by \pgf@xa
14814 }
14815 \anchor{text}{% need a different text: no circle, shift to the right
14816 \northeast
14817 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14818 \ifpgf@circuit@transisors@fixlabels
14819 \ifpgf@circuit@fet@bodydiode
14820 \advance \pgf@x by \extrabodydiodelen
14821 \else
14822 \pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}*
14823 \ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen}
14824 \advance \pgf@x by \pgf@xa
14825 \fi
14826 % no circle for gfets
14827 % add a bit of space to avoid central (substrate) terminal if drawn
14828 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
14829 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14830 \else
14831 \pgf@y=.7\pgf@y
14832 \pgf@x= \pgf@circ@scaled@Rlen
14833 \pgf@x=0.1\pgf@x
14834 \fi
14835 }
14836 }
14837 {
14838 % no circle for gfets (clearly!)
14839 %draw upper connection to hexagon
14840 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14841 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14842 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
14843 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
14844 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
14845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14846 \pgfusepath{draw}
14847 % draw (fillable) hexagon
14848 \pgfscope
14849 \pgfpathmoveto{\pgfpoint
14850 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14851 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
14852 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14853 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
14854 \pgfpathlineto{\pgfpoint
14855 {-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14856 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
14857 \pgfpathlineto{\pgfpoint
14858 {-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14859 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
14860 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14861 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
14862 \pgfpathlineto{\pgfpoint
14863 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14864 {-\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
14865 \pgfpathclose
14866 \pgf@circ@draworfill
14867 \endpgfscope
14868 %draw thicker gate lines
14869 \pgfscope
14870 \pgfscope
14871 \pgfpathmoveto{\pgfpoint
14872 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14873 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14874 \pgfpathlineto{\pgfpoint
14875 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14876 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14877 % set the normal thickness
14878 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14879 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
14880 \pgfsetlinewidth{\@@extrat\pgflinewidth}
14881 \pgfusepath{draw}
14882 \endpgfscope
14883 \pgfpathmoveto{\pgfpoint
14884 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14885 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14886 \pgfpathlineto{\pgfpoint
14887 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14888 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14889 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14890 \pgfusepath{draw}
14891 \endpgfscope
14892 %draw arrow depending on type of transistor
14893 \pgfscope
14894 \pgfslopedattimetrue
14895 \pgfallowupsidedownattimetrue
14896 \pgfresetnontranslationattimefalse
14897 \ifpgf@circuit@trans@arrowatend
14898 \ifpgf@circuit@trans@ntype
14899 \edef\@@anchor{btip}\edef\@@pos{1.0}
14900 \else
14901 \edef\@@anchor{tip}\edef\@@pos{1.0}
14902 \fi
14903 \else
14904 \edef\@@anchor{center}\edef\@@pos{0.5}
14905 \fi
14906 \ifpgf@circuit@trans@ntype
14907 \pgftransformlineattime{\@@pos}{%
14908 \pgfpoint%
14909 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14910 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
14911 }{%
14912 \pgfpoint{\pgf@circ@res@right}%
14913 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
14914 }
14915 \else
14916 \pgftransformlineattime{\@@pos}{%
14917 \pgfpoint{\pgf@circ@res@right}%
14918 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
14919 }{%
14920 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14921 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
14922 }
14923 \fi
14924 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14925 \endpgfscope
14926 %draw gate
14927 \ifpgf@circuit@trans@ntype
14928 \pgfpathmoveto{\pgfpoint
14929 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14930 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14931 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
14932 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14933 \else
14934 \pgfpathmoveto{\pgfpoint
14935 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14936 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
14937 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
14938 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
14939 \fi
14940 \pgfusepath{draw}
14941 }
14942 }
14943
14944 \declaregfet{pgfet}
14945 \declaregfet{ngfet}
14946
14947 % Plain MOSes
14948
14949 \pgfcircdeclaretransistor{nmos}{
14950 \anchor{inner up}{
14951 \northeast
14952 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
14953 }
14954 \anchor{inner down}{
14955 \northeast
14956 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
14957 }
14958 }{%
14959 % add the circle if requested (before everything else, so we can fill it)
14960 \pgfcirc@transistorcircle
14961 % fill the gap color if requested
14962 \pgfcirc@fillgategap{nmos}
14963
14964 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14965 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14966 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
14967 \pgfpathlineto{\pgfpoint
14968 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14969 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
14970
14971 \pgfpathmoveto{\pgfpoint
14972 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14973 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
14974 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14975 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
14976 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14977 \pgfusepath{draw}
14978
14979 \pgfscope
14980 \pgfpathmoveto{\pgfpoint
14981 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14982 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
14983 \pgfpathlineto{\pgfpoint
14984 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14985 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
14986 \pgfpathmoveto{\pgfpoint
14987 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
14988 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
14989 \pgfpathlineto{\pgfpoint
14990 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
14991 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
14992 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14993 \pgfusepath{draw}
14994 \endpgfscope
14995 \ifpgf@circuit@mos@arrows
14996 \pgfscope
14997 \ifpgf@circuit@trans@arrowatend
14998 \pgftransformshift{\pgfpoint
14999 {\pgf@circ@res@right}%
15000 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
15001 }
15002 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
15003 \else
15004 \pgfslopedattimetrue
15005 \pgfallowupsidedownattimetrue
15006 \pgfresetnontranslationattimefalse
15007 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
15008 \pgfpoint%
15009 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
15010 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
15011 }{%
15012 \pgfpoint
15013 {\pgf@circ@res@right}%
15014 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
15015 }
15016 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
15017 \fi
15018 \endpgfscope
15019 \fi
15020
15021 \ifpgf@circuit@bpt@drawgate
15022 \pgfpathmoveto{\pgfpoint
15023 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
15024 {\pgf@circ@res@up+\pgf@circ@res@down}}
15025 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
15026 \pgfusepath{draw}
15027 \fi
15028
15029 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
15030 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
15031 {\pgf@circ@res@up+\pgf@circ@res@down}}
15032 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
15033 {\pgf@circ@res@up+\pgf@circ@res@down}}
15034 \pgfusepath{draw}
15035 \fi
15036
15037 \pgfcirc@ferroelectric{nmos}{0}
15038 }
15039
15040 \pgfcircdeclaretransistor{pmos}{
15041 \anchor{inner up}{
15042 \northeast
15043 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
15044 }
15045 \anchor{inner down}{
15046 \northeast
15047 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
15048 }
15049 }{%
15050 % add the circle if requested (before everything else, so we can fill it)
15051 \pgfcirc@transistorcircle
15052 % fill the gap color if requested
15053 \pgfcirc@fillgategap{nmos}
15054
15055 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15056 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15057 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
15058 \pgfpathlineto{\pgfpoint
15059 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
15060 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
15061 \pgfusepath{draw}
15062
15063 \ifpgf@circuit@mos@arrows
15064 \pgfscope
15065 \ifpgf@circuit@trans@arrowatend
15066 \pgftransformshift{\pgfpoint
15067 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
15068 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
15069 }
15070 \pgftransformrotate{180}
15071 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
15072 \else
15073 \pgfslopedattimetrue
15074 \pgfallowupsidedownattimetrue
15075 \pgfresetnontranslationattimefalse
15076 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
15077 \pgfpoint%
15078 {\pgf@circ@res@right}%
15079 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
15080 }{%
15081 \pgfpoint
15082 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
15083 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
15084 }
15085 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
15086 \fi
15087 \endpgfscope
15088 \fi
15089
15090 \pgfscope
15091 \pgfpathmoveto{\pgfpoint
15092 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
15093 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
15094 \pgfpathlineto{\pgfpoint
15095 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
15096 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
15097 \pgfpathmoveto{\pgfpoint
15098 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
15099 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
15100 \pgfpathlineto{\pgfpoint
15101 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
15102 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
15103 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15104 \pgfusepath{draw}
15105 \endpgfscope
15106
15107 \pgfpathmoveto{\pgfpoint
15108 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
15109 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
15110 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15111 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
15112 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15113
15114
15115 \pgfusepath{draw}
15116 \ifpgf@circuit@bpt@drawgate
15117 \pgfpathmoveto{\pgfpoint
15118 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
15119 {\pgf@circ@res@up+\pgf@circ@res@down}}
15120 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
15121 \pgfusepath{draw}
15122 \fi
15123
15124 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
15125 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
15126 {\pgf@circ@res@up+\pgf@circ@res@down}}
15127 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
15128 {\pgf@circ@res@up+\pgf@circ@res@down}}
15129 \pgfusepath{draw}
15130 \fi
15131
15132 \ifpgf@circuit@pmos@nocircle\else
15133 % we are not scaling the circle with the MOS --- I think it's better to have it
15134 % coherent with the poles/nodes of the rest of the circuit.
15135 \pgfpathcircle{\pgfpoint
15136 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
15137 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
15138 \ifpgf@circuit@pmos@emptycircle
15139 \pgfsetfillcolor{white}
15140 \fi
15141 \pgfusepath{draw,fill}
15142 \fi
15143
15144 \pgfcirc@ferroelectric{pmos}{0}
15145 }
15146
15147 %%% depletion MOSFET (simplified symbols)
15148
15149 \long\def\pgfcirc@filldraw@depletion#1{%
15150 \ifx\tikz@fillcolor\pgfutil@empty
15151 % if there is no explicit fill check the specific key
15152 \edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}%
15153 \ifx\@@tmp\@@none % if it's none
15154 \pgfusepath{draw}%
15155 \else
15156 \edef\@@default{default}%
15157 \ifx\@@tmp\@@default % fill with the pen color
15158 \pgfusepath{draw, fill}%
15159 \else
15160 \pgfsetfillcolor{\@@tmp}%
15161 \pgfusepath{draw, fill}%
15162 \fi
15163 \fi
15164 \else
15165 \pgfsetfillcolor{\tikz@fillcolor}%
15166 \pgfusepath{draw, fill}%
15167 \fi
15168 }
15169
15170 \pgfcircdeclaretransistor{nmosd}{
15171 \anchor{inner up}{
15172 \northeast
15173 \pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
15174 }
15175 \anchor{inner down}{
15176 \northeast
15177 \pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
15178 }
15179 \anchor{nobulk}{ %override
15180 \left
15181 \pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x
15182 \pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x
15183 \advance\pgf@x by -\pgf@circ@res@temp
15184 }
15185 }{%
15186 % draw depletion channel
15187 % add the circle if requested (before everything else, so we can fill it)
15188 \pgfcirc@transistorcircle
15189 % fill the gap color if requested
15190 \pgfcirc@fillgategap{nmos}
15191 \pgfscope
15192 \pgfpathrectanglecorners
15193 {\pgfpoint
15194 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
15195 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
15196 {\pgfpoint
15197 {(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left}
15198 {-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
15199 \pgfcirc@filldraw@depletion{nmosd}
15200 \endpgfscope
15201 % draw drain and source terminals
15202 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15203 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
15204 \pgfpathlineto{\pgfpoint
15205 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
15206 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
15207
15208 \pgfpathmoveto{\pgfpoint
15209 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
15210 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
15211 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15212 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
15213 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15214 \pgfusepath{draw}
15215
15216 \pgfscope
15217 \pgfpathmoveto{\pgfpoint
15218 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
15219 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}}
15220 \pgfpathlineto{\pgfpoint
15221 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
15222 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}}
15223 \pgfpathmoveto{\pgfpoint
15224 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
15225 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
15226 \pgfpathlineto{\pgfpoint
15227 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
15228 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
15229 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15230 \pgfusepath{draw}
15231 \endpgfscope
15232 \ifpgf@circuit@mos@arrows
15233 \pgfscope
15234 \ifpgf@circuit@trans@arrowatend
15235 \pgftransformshift{\pgfpoint
15236 {\pgf@circ@res@right}%
15237 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}%
15238 }
15239 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
15240 \else
15241 \pgfslopedattimetrue
15242 \pgfallowupsidedownattimetrue
15243 \pgfresetnontranslationattimefalse
15244 \pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{%
15245 \pgfpoint%
15246 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}%
15247 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
15248 }{%
15249 \pgfpoint
15250 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
15251 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
15252 }
15253 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
15254 \fi
15255 \endpgfscope
15256 \fi
15257
15258 \ifpgf@circuit@bpt@drawgate
15259 \pgfpathmoveto{\pgfpoint
15260 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
15261 {\pgf@circ@res@up+\pgf@circ@res@down}}
15262 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
15263 \pgfusepath{draw}
15264 \fi
15265
15266 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
15267 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
15268 {\pgf@circ@res@up+\pgf@circ@res@down}}
15269 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
15270 {\pgf@circ@res@up+\pgf@circ@res@down}}
15271 \pgfusepath{draw}
15272 \fi
15273
15274 \pgfcirc@ferroelectric{nmosd}{\ctikzvalof{tripoles/nmosd/depletion width}}
15275 }
15276
15277 \pgfcircdeclaretransistor{pmosd}{
15278 \anchor{inner up}{
15279 \northeast
15280 \pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
15281 }
15282 \anchor{inner down}{
15283 \northeast
15284 \pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
15285 }
15286 \anchor{nobulk}{ %override
15287 \left
15288 \pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x
15289 \pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x
15290 \advance\pgf@x by -\pgf@circ@res@temp
15291 }
15292 }{%
15293 % add the circle if requested (before everything else, so we can fill it)
15294 \pgfcirc@transistorcircle
15295 % fill the gap color if requested
15296 \pgfcirc@fillgategap{nmos}
15297 % draw depletion channel
15298 \pgfscope
15299 \pgfpathrectanglecorners
15300 {\pgfpoint
15301 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15302 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15303 {\pgfpoint
15304 {(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left}
15305 {-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15306 \pgfcirc@filldraw@depletion{pmosd}
15307 \endpgfscope
15308 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15309 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15310 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15311 \pgfpathlineto{\pgfpoint
15312 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15313 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15314 \pgfusepath{draw}
15315
15316 \ifpgf@circuit@mos@arrows
15317 \pgfscope
15318 \ifpgf@circuit@trans@arrowatend
15319 \pgftransformshift{\pgfpoint
15320 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
15321 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
15322 }
15323 \pgftransformrotate{180}
15324 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
15325 \else
15326 \pgfslopedattimetrue
15327 \pgfallowupsidedownattimetrue
15328 \pgfresetnontranslationattimefalse
15329 \pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{%
15330 \pgfpoint%
15331 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
15332 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
15333 }{%
15334 \pgfpoint
15335 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}%
15336 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
15337 }
15338 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
15339 \fi
15340 \endpgfscope
15341 \fi
15342
15343 \pgfscope
15344 \pgfpathmoveto{\pgfpoint
15345 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15346 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}}
15347 \pgfpathlineto{\pgfpoint
15348 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15349 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}}
15350 \pgfpathmoveto{\pgfpoint
15351 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
15352 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15353 \pgfpathlineto{\pgfpoint
15354 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
15355 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
15356 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15357 \pgfusepath{draw}
15358 \endpgfscope
15359
15360 \pgfpathmoveto{\pgfpoint
15361 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15362 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
15363 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15364 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
15365 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15366
15367
15368 \pgfusepath{draw}
15369 \ifpgf@circuit@bpt@drawgate
15370 \pgfpathmoveto{\pgfpoint
15371 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
15372 {\pgf@circ@res@up+\pgf@circ@res@down}}
15373 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
15374 \pgfusepath{draw}
15375 \fi
15376
15377 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
15378 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
15379 {\pgf@circ@res@up+\pgf@circ@res@down}}
15380 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
15381 {\pgf@circ@res@up+\pgf@circ@res@down}}
15382 \pgfusepath{draw}
15383 \fi
15384
15385 \ifpgf@circuit@pmos@nocircle\else
15386 % we are not scaling the circle with the MOS --- I think it's better to have it
15387 % coherent with the poles/nodes of the rest of the circuit.
15388 \pgfpathcircle{\pgfpoint
15389 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
15390 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
15391 \ifpgf@circuit@pmos@emptycircle
15392 \pgfsetfillcolor{white}
15393 \fi
15394 \pgfusepath{draw,fill}
15395 \fi
15396
15397 \pgfcirc@ferroelectric{pmosd}{\ctikzvalof{tripoles/pmosd/depletion width}}
15398 }
15399 %% HEMT FET Transistor
15400 \pgfcircdeclaretransistor{hemt}{
15401 \anchor{inner up}{
15402 \northeast
15403 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
15404 }
15405 \anchor{inner down}{
15406 \northeast
15407 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
15408 }
15409 }{%
15410 % add the circle if requested (before everything else, so we can fill it)
15411 \pgfcirc@transistorcircle
15412 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15413 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15414 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
15415 \pgfpathlineto{\pgfpoint
15416 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15417 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
15418
15419 \pgfpathmoveto{\pgfpoint
15420 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15421 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
15422 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15423 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
15424 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15425 \pgfusepath{draw}
15426
15427 \pgfscope
15428 \pgfpathmoveto{\pgfpoint
15429 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15430 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
15431 \pgfpathlineto{\pgfpoint
15432 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15433 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
15434 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15435 \pgfusepath{draw}
15436 \endpgfscope
15437
15438 \ifpgf@circuit@bpt@drawgate
15439 \pgfpathmoveto{\pgfpoint
15440 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15441 {\pgf@circ@res@up+\pgf@circ@res@down}}
15442 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
15443 \pgfusepath{draw}
15444 \fi
15445 }
15446
15447 \long\def\drawfetcore#1{
15448 \pgftransformationadjustments
15449 % add the circle if requested (before everything else, so we can fill it)
15450 \pgfcirc@transistorcircle
15451 % fill the gap color if requested
15452 \pgfcirc@fillgategap{#1}
15453
15454 %top connection
15455 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15456 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15457 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
15458 \pgfpathlineto{\pgfpoint
15459 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15460 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
15461 \pgfusepath{draw}
15462 \pgfscope
15463 \pgfpathmoveto{\pgfpoint
15464 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15465 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
15466 \ifpgf@circuit@trans@depletiontype
15467 \pgfpathlineto{\pgfpoint
15468 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15469 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
15470 \else
15471
15472 \pgfpathlineto{\pgfpoint
15473 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15474 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
15475 \pgfpathmoveto{\pgfpoint
15476 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15477 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
15478 \pgfpathlineto{\pgfpoint
15479 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15480 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
15481 \pgfpathmoveto{\pgfpoint
15482 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15483 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
15484 \pgfpathlineto{\pgfpoint
15485 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15486 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
15487 \fi
15488 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15489 \pgfusepath{draw}
15490 \endpgfscope
15491 %Bulk connection line
15492 \pgfpathmoveto{\pgfpoint
15493 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15494 {\pgf@circ@res@up+\pgf@circ@res@down}}
15495 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
15496 {\pgf@circ@res@up+\pgf@circ@res@down}}
15497
15498 %bottom connection
15499 \pgfpathmoveto{\pgfpoint
15500 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15501 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
15502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15503 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
15504 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15505 \pgfusepath{draw}
15506
15507 %draw thick gate line
15508 \pgfscope
15509 \pgfpathmoveto{\pgfpoint
15510 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15511 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15512 \pgfpathlineto{\pgfpoint
15513 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15514 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15515 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15516 \pgfusepath{draw}
15517 \endpgfscope
15518
15519 % arrows
15520 \pgfscope
15521 \pgfslopedattimetrue
15522 \pgfallowupsidedownattimetrue
15523 \pgfresetnontranslationattimefalse
15524 \ifpgf@circuit@trans@arrowatend
15525 \ifpgf@circuit@trans@ntype
15526 \edef\@@anchor{tip}
15527 \edef\@@pos{1.0}
15528 \else
15529 \edef\@@anchor{btip}
15530 \edef\@@pos{0.0}
15531 \fi
15532 \else
15533 \edef\@@anchor{center}\edef\@@pos{0.6}
15534 \fi
15535 \pgftransformlineattime{\@@pos}{%
15536 \pgfpoint
15537 {\pgf@circ@res@right}%
15538 {\pgf@circ@res@up+\pgf@circ@res@down}%
15539 }{%
15540 \pgfpoint%
15541 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
15542 {\pgf@circ@res@up+\pgf@circ@res@down}%
15543 }
15544 \ifpgf@circuit@trans@ntype
15545 \else
15546 \pgftransformrotate{180}
15547 \fi
15548 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
15549 \endpgfscope
15550
15551 % GATE CONNECTION
15552 \ifpgf@circuit@bpt@drawgate
15553 \ifpgf@circuit@trans@ntype
15554 \pgfpathmoveto{\pgfpoint
15555 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15556 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
15557 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
15558 \else
15559 \pgfpathmoveto{\pgfpoint
15560 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15561 {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
15562 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
15563 \fi
15564 \pgfusepath{draw}
15565 \fi
15566
15567 \pgfcirc@ferroelectric{#1}{0}
15568
15569 }
15570
15571 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3
15572 {\pgfcircdeclaretransistor{#1}{
15573 \anchor{bulk}{\left\pgf@x=0pt}
15574 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
15575 \anchor{inner up}{
15576 \northeast
15577 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
15578 }
15579 \anchor{inner down}{
15580 \northeast
15581 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
15582 }
15583 #2
15584 }
15585 {#3}
15586 }
15587
15588 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
15589 \pgf@circuit@trans@depletiontypefalse
15590 \drawfetcore{nfet}
15591 }
15592
15593 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
15594 \pgf@circuit@trans@depletiontypefalse
15595 \drawfetcore{pfet}
15596 }
15597
15598 \pgfdeclaretransistorwrapperaddbulk{nfetd}{}{%
15599 \pgf@circuit@trans@depletiontypetrue
15600 \drawfetcore{nfetd}
15601 }
15602
15603 \pgfdeclaretransistorwrapperaddbulk{pfetd}{}{%
15604 \pgf@circuit@trans@depletiontypetrue
15605 \drawfetcore{pfetd}
15606 }
15607 % N-CHANNEL IGFET ENHANCEMENT TYPE
15608 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
15609 \pgf@circuit@trans@depletiontypefalse
15610 \drawfetcore{nigfete}
15611
15612 % SOURCE CONNECTION
15613 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15614 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
15615 \pgfusepath{draw}
15616
15617 % SOLDER DOT at source-bulk connection
15618 \ifpgf@circuit@fet@solderdot
15619 \pgfscope
15620 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15621 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
15622 \pgfnode{circ}{center}{}{}{}
15623 \endpgfscope{}
15624 \fi
15625 }
15626
15627 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
15628 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
15629 \pgf@circuit@trans@depletiontypefalse
15630 \drawfetcore{nigfetebulk}
15631 % SOLDER DOT at source-bulk connection
15632 \ifpgf@circuit@fet@solderdot
15633 \pgfscope
15634 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15635 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
15636 \pgfnode{circ}{center}{}{}{}
15637 \endpgfscope{}
15638 \fi
15639 }
15640
15641 % N-CHANNEL IGFET DEPLETION TYPE
15642 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
15643 \pgf@circuit@trans@depletiontypetrue
15644 \drawfetcore{nigfetd}
15645
15646 % SOURCE CONNECTION
15647 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15648 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
15649 \pgfusepath{draw}
15650
15651 % SOLDER DOT at source-bulk connection
15652 \ifpgf@circuit@fet@solderdot
15653 \pgfscope
15654 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15655 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
15656 \pgfnode{circ}{center}{}{}{}
15657 \endpgfscope{}
15658 \fi
15659 }
15660
15661 % P-CHANNEL IGFET ENHANCEMENT TYPE
15662 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
15663 \pgf@circuit@trans@depletiontypefalse
15664 \drawfetcore{pigfete}
15665 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15666
15667 % SOURCE CONNECTION
15668 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15669 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15670 \pgfusepath{draw}
15671
15672
15673 % SOLDER DOT at source-bulk connection
15674 \ifpgf@circuit@fet@solderdot
15675 \pgfscope
15676 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15677 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
15678 \pgfnode{circ}{center}{}{}{}
15679 \endpgfscope
15680 \fi
15681 }
15682
15683 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
15684 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
15685 \pgf@circuit@trans@depletiontypefalse
15686 \drawfetcore{pigfetebulk}
15687 }
15688
15689 % P-CHANNEL IGFET DEPLETION TYPE
15690 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
15691 \pgf@circuit@trans@depletiontypetrue
15692 \drawfetcore{pigfetd}
15693
15694 % SOURCE CONNECTION
15695 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15696 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15697 \pgfusepath{draw}
15698
15699
15700 % SOLDER DOT at source-bulk connection
15701 \ifpgf@circuit@fet@solderdot
15702 \pgfscope
15703 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15704 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
15705 \pgfnode{circ}{center}{}{}{}
15706 \endpgfscope{}
15707 \fi
15708 }
15709
15710 %%% uni-junction transistors: jfets, ujts
15711
15712 \long\def\pgfcircdeclarejunctiontransistor#1#2#3{% name, extra anchors, extra draw
15713 \pgfcircdeclaretransistor{#1}{
15714 \anchor{inner up}{
15715 \northeast
15716 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
15717 }
15718 \anchor{inner down}{
15719 \northeast
15720 \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
15721 }
15722 \anchor{kink}{
15723 \northeast
15724 \pgf@ya=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
15725 \left
15726 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
15727 \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x
15728 }
15729 % extra anchors (or override)
15730 #2
15731 }{%
15732 % add the circle if requested (before everything else, so we can fill it)
15733 \pgfcirc@transistorcircle
15734
15735 % get direction
15736 \edef\@@dir{\ctikzvalof{tripoles/#1/curr direction}}
15737
15738 % draw drain/source connections: up
15739 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15740 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15741 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
15742 \pgfpathlineto{\pgfpoint
15743 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15744 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
15745
15746 % down
15747 \pgfpathmoveto{\pgfpoint
15748 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15749 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
15750 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15751 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
15752 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15753 \pgfusepath{draw}
15754
15755 \pgfscope
15756 \pgfpathmoveto{\pgfpoint
15757 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15758 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
15759 \pgfpathlineto{\pgfpoint
15760 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15761 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
15762 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15763 \pgfusepath{draw}
15764 \endpgfscope
15765
15766 % arrow
15767 \pgfscope
15768 \pgfslopedattimetrue
15769 \pgfallowupsidedownattimetrue
15770 \pgfresetnontranslationattimefalse
15771 \ifpgf@circuit@trans@arrowatend
15772 \ifnum\@@dir>0
15773 \edef\@@anchor{tip}\edef\@@pos{1.0}
15774 \else
15775 \edef\@@anchor{btip}\edef\@@pos{1.0}
15776 \fi
15777 \else
15778 \ifnum\@@dir>0
15779 \edef\@@anchor{center}\edef\@@pos{0.6}
15780 \else
15781 \edef\@@anchor{center}\edef\@@pos{0.4}
15782 \fi
15783 \fi
15784 % find x1, x2 and y for the base arrow
15785 \ifnum\@@dir>0
15786 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left
15787 \pgf@circ@res@other=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left
15788 \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@down
15789 \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down
15790 \else
15791 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left
15792 \pgf@circ@res@other=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left
15793 \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up
15794 \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@up
15795 \fi
15796 %
15797 % gate line (called emitter in UJT)
15798 %
15799 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}}
15800 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
15801 %
15802 % horizontal gate line
15803 %
15804 \ifpgf@circuit@bpt@drawgate
15805 \ifnum\@@dir>0
15806 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}}
15807 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
15808 \else
15809 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
15810 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
15811 \fi
15812 \fi
15813 \pgfusepath{draw}
15814 %
15815 % gate arrows (called emitter in UJT)
15816 %
15817 \pgftransformlineattime{\@@pos}{%
15818 \pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}
15819 }{%
15820 \pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}
15821 }
15822 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
15823 %
15824 % gate line (called emitter in UJT)
15825 %
15826 \endpgfscope
15827
15828 % extra drawings
15829 #3
15830 }
15831 }
15832
15833 % NJFET and PJFET
15834
15835 \pgfcircdeclarejunctiontransistor{njfet}{}{}
15836 \pgfcircdeclarejunctiontransistor{pjfet}{}{}
15837
15838 \def\@ujtanchoroverride#1{
15839 \savedanchor{\ujtrealemitter}{
15840 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15841 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
15842 \pgf@y=.5\pgf@y %north anchor height
15843 % kink AND conn height, they're the same
15844 \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
15845 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15846 % horizontal
15847 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen % left
15848 \ifpgf@circuit@bpt@drawgate\else
15849 \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x
15850 \fi
15851 }
15852 \anchor{E}{\ujtrealemitter}
15853 \anchor{emitter}{\ujtrealemitter}
15854 \anchor{B2}{\northeast\pgf@y=-\pgf@y}
15855 \anchor{B1}{\northeast}
15856 }
15857
15858
15859 \pgfcircdeclarejunctiontransistor{nujt}{\@ujtanchoroverride{nujt}}{}
15860 \pgfcircdeclarejunctiontransistor{pujt}{\@ujtanchoroverride{pujt}}{}
15861
15862
15863 \pgfdeclaretransistorwrapperaddbulk{isfet}{
15864 }{%
15865 % add the circle if requested (before everything else, so we can fill it)
15866 \pgfcirc@transistorcircle
15867 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15868 % DRAIN CONNECTION
15869 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15870 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
15871 % DRAIN
15872 \pgfpathlineto{\pgfpoint
15873 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15874 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
15875 \pgfusepath{draw}
15876
15877 % GATE, DEPLETION TYPE
15878 \pgfscope %% added
15879 \pgfpathmoveto{\pgfpoint
15880 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15881 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
15882 \pgfpathlineto{\pgfpoint
15883 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15884 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
15885 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
15886 \pgfusepath{draw} %% added
15887 \endpgfscope %% added
15888
15889 % BULK
15890 \pgfpathmoveto{\pgfpoint
15891 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15892 {\pgf@circ@res@up+\pgf@circ@res@down}}
15893 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
15894 {\pgf@circ@res@up+\pgf@circ@res@down}}
15895
15896 % SOURCE
15897 \pgfpathmoveto{\pgfpoint
15898 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15899 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
15900 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15901 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
15902 % SOURCE CONNECTION
15903 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15904 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15905 \pgfusepath{draw}
15906
15907 % SOLDER DOT at source-bulk connection
15908 \ifpgf@circuit@fet@solderdot
15909 \pgfscope
15910 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15911 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
15912 \pgfnode{circ}{center}{}{}{}
15913 \endpgfscope{}
15914 \fi
15915 % ARROW
15916 \pgfscope
15917 \pgfslopedattimetrue
15918 \pgfallowupsidedownattimetrue
15919 \pgfresetnontranslationattimefalse
15920 \ifpgf@circuit@trans@arrowatend
15921 \edef\@@anchor{tip}\edef\@@pos{1.0}
15922 \else
15923 \edef\@@anchor{center}\edef\@@pos{0.6}
15924 \fi
15925 \pgftransformlineattime{\@@pos}{%
15926 \pgfpoint
15927 {\pgf@circ@res@right}%
15928 {\pgf@circ@res@up+\pgf@circ@res@down}%
15929 }{%
15930 \pgfpoint%
15931 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
15932 {\pgf@circ@res@up+\pgf@circ@res@down}%
15933 }
15934 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
15935 \endpgfscope
15936 \pgfusepath{draw}
15937
15938 % Wavy lines
15939 \pgfscope
15940 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
15941 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15942 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15943 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15944 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15945 \pgfusepath{draw}
15946
15947 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
15948 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15949 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15950 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15951 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15952 \pgfusepath{draw}
15953
15954 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
15955 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15956 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15957 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15958 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15959 \pgfusepath{draw}
15960 \endpgfscope
15961 }
15962
15963 % end of transistors
15964 % %>>>
15965
15966 %% Transistor's path definitions%<<<
15967
15968 \pgf@circ@definetranspath{nmos}
15969 \pgf@circ@definetranspath{pmos}
15970 \pgf@circ@definetranspath{nmosd}
15971 \pgf@circ@definetranspath{pmosd}
15972 \pgf@circ@definetranspath{hemt}
15973 \pgf@circ@definetranspath{npn}
15974 \pgf@circ@definetranspath{pnp}
15975 \pgf@circ@definetranspath{nfet}
15976 \pgf@circ@definetranspath{nigfete}
15977 \pgf@circ@definetranspath{nigfetd}
15978 \pgf@circ@definetranspath{nigfetebulk}
15979 \pgf@circ@definetranspath{pfet}
15980 \pgf@circ@definetranspath{pigfete}
15981 \pgf@circ@definetranspath{pigfetd}
15982 \pgf@circ@definetranspath{pigfetebulk}
15983 \pgf@circ@definetranspath{njfet}
15984 \pgf@circ@definetranspath{pjfet}
15985 \pgf@circ@definetranspath{pigbt}
15986 \pgf@circ@definetranspath{nigbt}
15987 \pgf@circ@definetranspath{Lpigbt}
15988 \pgf@circ@definetranspath{Lnigbt}% %>>>
15989
15990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15991 %% Amplifiers
15992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15993
15994 % Settings for Amplifiers%<<<1
15995 %
15996 % switches for op amps
15997 % changing input polarity
15998 %
15999 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
16000 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
16001 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
16002 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
16003 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
16004 %
16005 % changing output polarity (for fully diff objects)
16006 %
16007 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
16008 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
16009 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
16010 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
16011 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
16012
16013 % Operational amplifier
16014 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
16015 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
16016 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
16017 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
16018 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
16019 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
16020
16021 % Fully differential operational amplifier
16022 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
16023 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
16024 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
16025 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
16026 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
16027 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
16028 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
16029
16030 \ctikzset{tripoles/en amp/width/.initial=1.7}
16031 \ctikzset{tripoles/en amp/port width/.initial=.7}
16032 \ctikzset{tripoles/en amp/height/.initial=1.6}
16033 \ctikzset{tripoles/en amp/input height/.initial=.3}
16034 \ctikzset{tripoles/en amp/up pos/.initial=.45}
16035 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
16036 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
16037 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
16038 \tikzset{
16039 en amp text/.code = {%
16040 \ctikzsetvalof{tripoles/en amp/text}{#1}%
16041 },
16042 en amp text A/.code = {%
16043 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
16044 },
16045 }
16046
16047 % Transconductance amplifier
16048 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
16049 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
16050 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
16051 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
16052 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
16053 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
16054 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
16055
16056 % Instrumentation amplifier
16057 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
16058 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
16059 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
16060 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
16061 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
16062 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
16063 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
16064 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
16065
16066 % Instrumentation amplifier with differential output
16067 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
16068 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
16069 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
16070 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
16071 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
16072 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
16073 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
16074 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
16075 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
16076
16077 % Instrumentation amplifier with gain resistor terminals
16078 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
16079 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
16080 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
16081 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
16082 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
16083 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
16084 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
16085 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
16086 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
16087
16088 % Plain amplifier
16089 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
16090 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
16091 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
16092 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
16093 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
16094
16095 % changing fonts and symbols of amplifiers
16096 \ctikzset{amplifiers/symbol font/.code={%
16097 \ctikzset{tripoles/inst amp ra/font=#1}%
16098 \ctikzset{tripoles/fd inst amp/font=#1}%
16099 \ctikzset{tripoles/inst amp/font=#1}%
16100 \ctikzset{tripoles/gm amp/font=#1}%
16101 \ctikzset{tripoles/en amp/font=#1}%
16102 \ctikzset{tripoles/fd op amp/font=#1}%
16103 \ctikzset{tripoles/op amp/font=#1}%
16104 }}
16105 \ctikzset{amplifiers/plus/.initial={$+$}}
16106 \ctikzset{amplifiers/minus/.initial={$-$}}
16107 \tikzset{amp symbol font/.code={%
16108 \ctikzset{amplifiers/symbol font={#1}}%
16109 }
16110 }
16111 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
16112 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
16113 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
16114 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
16115 %%>>>
16116
16117 %% Nodes for amplifiers%<<<
16118 %% operational and instrumentation amplifiers
16119
16120 \pgfdeclareshape{op amp}
16121 {
16122 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16123 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16124 \anchor{center}{\pgfpointorigin}
16125 \savedanchor\northwest{%
16126 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16127 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
16128 \pgf@y=.5\pgf@y
16129 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
16130 \pgf@x=.5\pgf@x
16131 }
16132 \savedanchor\left{%
16133 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16134 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
16135 \pgf@x=.5\pgf@x
16136 \pgf@y=0pt
16137 }
16138 \anchor{south}{
16139 \northwest
16140 \pgf@y=-\pgf@y
16141 \pgf@x=0pt
16142 }
16143 \anchor{north}{
16144 \northwest
16145 \pgf@x=0pt
16146 }
16147 \savedanchor\left{%
16148 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16149 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
16150 \pgf@x=.5\pgf@x
16151 \pgf@y=0pt
16152 }
16153 \savedanchor\inOneFixed{%
16154 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16155 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
16156 \pgf@y=.5\pgf@y
16157 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
16158 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
16159 \pgf@x=.5\pgf@x
16160 }
16161 \anchor{in up}{
16162 \inOneFixed
16163 }
16164 \anchor{in down}{
16165 \inOneFixed
16166 \pgf@y=-\pgf@y
16167 }
16168 \savedanchor\inOne{%
16169 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16170 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
16171 \pgf@y=.5\pgf@y
16172 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
16173 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
16174 \pgf@x=.5\pgf@x
16175 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16176 }
16177 \anchor{-}{
16178 \inOne
16179 }
16180 \anchor{+}{
16181 \inOne
16182 \pgf@y=-\pgf@y
16183 }
16184 \savedanchor\up{%
16185 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16186 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
16187 \pgf@y=.5\pgf@y
16188 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
16189 \pgf@x=.5\pgf@x
16190 \pgf@circ@res@up = \pgf@y
16191 \pgf@circ@res@right = -\pgf@x
16192 \pgf@circ@res@left = \pgf@x
16193 \pgfpointlineattime{
16194 \ctikzvalof{tripoles/op amp/up pos}}{
16195 \pgfpoint{
16196 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
16197 {\pgf@circ@res@up}}
16198 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
16199 }
16200 \anchor{up}{
16201 \up
16202 }
16203 \anchor{down}{
16204 \up
16205 \pgf@y=-\pgf@y
16206 }
16207 \anchor{out}{
16208 \northwest
16209 \pgf@y=0pt
16210 \pgf@x=-\pgf@x
16211 }
16212 \anchor{west}{
16213 \left
16214 }
16215 \anchor{east}{
16216 \left
16217 \pgf@x=-\pgf@x
16218 }
16219
16220 % support for border anchors
16221 \savedanchor\leftedge{%
16222 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16223 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
16224 \pgf@x=.5\pgf@x
16225 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
16226 \pgf@y=0pt
16227 }
16228 \anchor{leftedge}{\leftedge}
16229 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16230 \anchor{bin up}{
16231 \inOneFixed
16232 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16233 }
16234 \anchor{bin down}{
16235 \inOneFixed
16236 \pgf@y=-\pgf@y
16237 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16238 }
16239 \anchor{b-}{
16240 \inOne
16241 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16242 }
16243 \anchor{b+}{
16244 \inOne
16245 \pgf@y=-\pgf@y
16246 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16247 }
16248 \anchor{bout}{
16249 \leftedge
16250 \pgf@y=0pt
16251 \pgf@x=-\pgf@x
16252 }
16253 % end border anchors
16254 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16255 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16256 \anchor{north west}{ \northwest }
16257 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16258
16259 \anchor{text}{
16260 \ifpgf@circ@center@text
16261 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16262 \else
16263 \leftedge
16264 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16265 \fi
16266 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16267 }
16268
16269 \backgroundpath{
16270 \pgfsetcolor{\ctikzvalof{color}}
16271
16272 \northwest
16273 \pgf@circ@res@up = \pgf@y
16274 \pgf@circ@res@down = -\pgf@y
16275 \pgf@circ@res@right = -\pgf@x
16276 \pgf@circ@res@left = \pgf@x
16277 \pgf@circ@scaled@Rlen=\scaledRlen
16278
16279 % Triangle
16280 \pgfscope
16281 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16282 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
16283 \pgf@circ@res@step=\pgf@circ@res@right
16284 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16285 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
16286
16287 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16288 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16289 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16290 \pgfpathclose
16291 \pgf@circ@draworfill
16292 \endpgfscope
16293
16294 % Negative input terminal
16295 \pgfpathmoveto{\pgfpoint
16296 {\pgf@circ@res@left}
16297 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
16298 \pgfpathlineto{\pgfpoint
16299 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
16300 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
16301 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
16302
16303 % Positive input terminal
16304 \pgfpathmoveto{\pgfpoint
16305 {\pgf@circ@res@left}
16306 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
16307 \pgfpathlineto{\pgfpoint
16308 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
16309 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
16310 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
16311
16312 % Output terminal
16313 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16314 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
16315 \pgfsetrectcap
16316 \pgfusepath{draw}
16317 }
16318 }
16319
16320 % Op amp shape as in european standard EN 60617
16321 \pgfdeclareshape{en amp}
16322 {
16323 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16324 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16325 \anchor{center}{\pgfpointorigin}
16326 \savedanchor\northwest{%
16327 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16328 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
16329 \pgf@y=.5\pgf@y
16330 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16331 \pgf@x=.5\pgf@x
16332 }
16333 \savedanchor\left{%
16334 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16335 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16336 \pgf@x=.5\pgf@x
16337 \pgf@y=0pt
16338 }
16339 \anchor{south}{
16340 \northwest
16341 \pgf@y=-\pgf@y
16342 \pgf@x=0pt
16343 }
16344 \anchor{north}{
16345 \northwest
16346 \pgf@x=0pt
16347 }
16348 \savedanchor\inOneFixed{%
16349 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16350 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
16351 \pgf@y=.5\pgf@y
16352 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
16353 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16354 \pgf@x=.5\pgf@x
16355 }
16356 \anchor{in up}{
16357 \inOneFixed
16358 }
16359 \anchor{in down}{
16360 \inOneFixed
16361 \pgf@y=-\pgf@y
16362 }
16363 \savedanchor\inOne{%
16364 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16365 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
16366 \pgf@y=.5\pgf@y
16367 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
16368 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16369 \pgf@x=.5\pgf@x
16370 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16371 }
16372 \anchor{-}{
16373 \inOne
16374 }
16375 \anchor{+}{
16376 \inOne
16377 \pgf@y=-\pgf@y
16378 }
16379 \anchor{up}{
16380 \northwest
16381 \pgf@x=0pt
16382 }
16383 \anchor{down}{
16384 \northwest
16385 \pgf@x=0pt
16386 \pgf@y=-\pgf@y
16387 }
16388 \anchor{out}{
16389 \northwest
16390 \pgf@y=0pt
16391 \pgf@x=-\pgf@x
16392 }
16393 \anchor{west}{
16394 \left
16395 }
16396 \anchor{east}{
16397 \left
16398 \pgf@x=-\pgf@x
16399 }
16400 % support for border anchors
16401 \savedanchor\leftedge{%
16402 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16403 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16404 \pgf@x=.5\pgf@x
16405 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
16406 \pgf@y=0pt
16407 }
16408 \anchor{leftedge}{\leftedge}
16409 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16410 \anchor{bin up}{
16411 \inOneFixed
16412 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16413 }
16414 \anchor{bin down}{
16415 \inOneFixed
16416 \pgf@y=-\pgf@y
16417 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16418 }
16419 \anchor{b-}{
16420 \inOne
16421 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16422 }
16423 \anchor{b+}{
16424 \inOne
16425 \pgf@y=-\pgf@y
16426 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16427 }
16428 \anchor{bout}{
16429 \leftedge
16430 \pgf@y=0pt
16431 \pgf@x=-\pgf@x
16432 }
16433 % end border anchors
16434 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16435 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16436 \anchor{north west}{ \northwest }
16437 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16438 \anchor{text}{
16439 \ifpgf@circ@center@text
16440 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16441 \else
16442 \leftedge
16443 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16444 \fi
16445 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16446 }
16447
16448 \backgroundpath{
16449 \pgfsetcolor{\ctikzvalof{color}}
16450 \northwest
16451 \pgf@circ@res@up = \pgf@y
16452 \pgf@circ@res@down = -\pgf@y
16453 \pgf@circ@res@right = -\pgf@x
16454 \pgf@circ@res@left = \pgf@x
16455 \pgf@circ@scaled@Rlen=\scaledRlen
16456
16457 \pgfscope
16458 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16459 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
16460 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
16461 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
16462 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
16463 \pgfpathclose
16464 \pgf@circ@draworfill
16465 \endpgfscope
16466
16467 \pgfpathmoveto{\pgfpoint
16468 {\pgf@circ@res@left}
16469 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
16470 \pgfpathlineto{\pgfpoint
16471 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
16472 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
16473 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
16474
16475 \pgfpathmoveto{\pgfpoint
16476 {\pgf@circ@res@left}
16477 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
16478 \pgfpathlineto{\pgfpoint
16479 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
16480 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
16481 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/en amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
16482
16483 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16484 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
16485 \pgfsetrectcap
16486 \pgfusepath{draw}
16487
16488
16489 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
16490 % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$}
16491 }
16492 }
16493
16494 % Fully differential output op amp
16495 % Contributed by Kristofer M. Monisit
16496 \pgfdeclareshape{fd op amp}
16497 {
16498 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16499 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16500 \anchor{center}{\pgfpointorigin}
16501 \savedanchor\northwest{%
16502 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16503 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16504 \pgf@y=.5\pgf@y
16505 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16506 \pgf@x=.5\pgf@x
16507 }
16508 \savedanchor\outline{%
16509 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16510 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16511 \pgf@y=.5\pgf@y
16512 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16513 \pgf@x=.5\pgf@x
16514 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
16515 }
16516 \anchor{south}{
16517 \northwest
16518 \pgf@y=-\pgf@y\pgf@x=0pt\relax
16519 }
16520 \anchor{north}{
16521 \northwest\pgf@x=0pt\relax
16522 }
16523 \savedanchor\left{%
16524 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16525 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16526 \pgf@x=.5\pgf@x
16527 \pgf@y=0pt
16528 }
16529 \savedanchor\inOneFixed{%
16530 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16531 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16532 \pgf@y=.5\pgf@y
16533 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
16534 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16535 \pgf@x=.5\pgf@x
16536 }
16537 \anchor{in up}{
16538 \inOneFixed
16539 }
16540 \anchor{in down}{
16541 \inOneFixed
16542 \pgf@y=-\pgf@y
16543 }
16544 \savedanchor\inOne{%
16545 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16546 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16547 \pgf@y=.5\pgf@y
16548 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
16549 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16550 \pgf@x=.5\pgf@x
16551 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16552 }
16553 \anchor{-}{
16554 \inOne
16555 }
16556 \anchor{+}{
16557 \inOne
16558 \pgf@y=-\pgf@y
16559 }
16560 \savedanchor\up{%
16561 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16562 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16563 \pgf@y=.5\pgf@y
16564 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16565 \pgf@x=.5\pgf@x
16566 \pgf@circ@res@up = \pgf@y
16567 \pgf@circ@res@right = -\pgf@x
16568 \pgf@circ@res@left = \pgf@x
16569 \pgfpointlineattime{
16570 \ctikzvalof{tripoles/fd op amp/up pos}}{
16571 \pgfpoint{
16572 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
16573 {\pgf@circ@res@up}}
16574 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
16575 }
16576 \anchor{up}{
16577 \up
16578 }
16579 \anchor{down}{
16580 \up
16581 \pgf@y=-\pgf@y
16582 }
16583 \anchor{out up}{
16584 \northwest
16585 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
16586 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16587 }
16588 \anchor{out down}{
16589 \northwest
16590 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
16591 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16592 }
16593 \anchor{out +}{
16594 \outline
16595 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
16596 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16597 }
16598 \anchor{out -}{
16599 \outline
16600 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
16601 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16602 }
16603 % support for border anchors
16604 \savedanchor\leftedge{%
16605 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16606 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16607 \pgf@x=.5\pgf@x
16608 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16609 \pgf@y=0pt
16610 }
16611 \anchor{leftedge}{\leftedge}
16612 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16613 \anchor{bin up}{
16614 \inOneFixed
16615 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16616 }
16617 \anchor{bin down}{
16618 \inOneFixed
16619 \pgf@y=-\pgf@y
16620 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16621 }
16622 \anchor{b-}{
16623 \inOne
16624 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16625 }
16626 \anchor{b+}{
16627 \inOne
16628 \pgf@y=-\pgf@y
16629 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16630 }
16631 \anchor{bout}{
16632 \leftedge
16633 \pgf@y=0pt
16634 \pgf@x=-\pgf@x
16635 }
16636 \anchor{bout +}{
16637 \outline
16638 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
16639 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
16640 {\pgfpoint{\pgf@xa}{0pt}}
16641 {\pgfpoint{0pt}{\pgf@ya}}
16642 }
16643 \anchor{bout -}{
16644 \outline
16645 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
16646 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
16647 {\pgfpoint{\pgf@xa}{0pt}}
16648 {\pgfpoint{0pt}{\pgf@ya}}
16649 \pgf@y=-\pgf@y
16650 }
16651 \anchor{bout up}{
16652 \northwest
16653 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
16654 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
16655 {\pgfpoint{\pgf@xa}{0pt}}
16656 {\pgfpoint{0pt}{\pgf@ya}}
16657 }
16658 \anchor{bout down}{
16659 \northwest
16660 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
16661 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
16662 {\pgfpoint{\pgf@xa}{0pt}}
16663 {\pgfpoint{0pt}{\pgf@ya}}
16664 \pgf@y=-\pgf@y
16665 }
16666 % end border anchors
16667 \anchor{west}{
16668 \left
16669 }
16670 \anchor{east}{
16671 \left
16672 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16673 }
16674 \anchor{out}{% should not be used
16675 \left
16676 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16677 }
16678 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16679 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
16680 \anchor{north west}{ \northwest }
16681 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
16682 \anchor{text}{
16683 \ifpgf@circ@center@text
16684 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16685 \else
16686 \leftedge
16687 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16688 \fi
16689 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16690 }
16691 \backgroundpath{
16692 \pgfsetcolor{\ctikzvalof{color}}
16693
16694 \northwest
16695 \pgf@circ@res@up = \pgf@y
16696 \pgf@circ@res@down = -\pgf@y
16697 \pgf@circ@res@right = -\pgf@x
16698 \pgf@circ@res@left = \pgf@x
16699 \pgf@circ@scaled@Rlen=\scaledRlen
16700
16701 % Triangle
16702 % Includes output terminals in the traingular shape
16703 % to ensure that diagonal joins are properly displayed
16704 % we first draw the main triangle and the leads with normal thickness,
16705 % and the redraw the main triangle with the component shape
16706 \pgfscope
16707 % shift origin a bit to ease calculations
16708 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
16709 \pgf@circ@res@step=\pgf@circ@res@right
16710 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16711 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
16712
16713 % Initial point (right vertex)
16714 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16715
16716 % Negative output terminal
16717 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
16718 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
16719 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
16720
16721 % Top vertex
16722 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16723
16724 % Bottom vertex
16725 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16726
16727 % Positive output terminal
16728 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
16729 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
16730 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
16731
16732 % Right vertex
16733 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16734
16735 \pgfpathclose
16736 \pgfusepath{stroke}
16737
16738 % ok, now we'll redraw the triangle with the class specific
16739 % thickness and optionally fill
16740
16741 \pgfscope
16742 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
16743
16744 % Initial point (right vertex)
16745 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16746 % Top vertex
16747 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16748 % Bottom vertex
16749 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16750
16751 \pgfpathclose
16752 \pgf@circ@draworfill
16753 \endpgfscope % thick and fill
16754 \endpgfscope % shift
16755
16756 % Negative input terminal
16757 \pgfpathmoveto{\pgfpoint
16758 {\pgf@circ@res@left}
16759 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
16760 \pgfpathlineto{\pgfpoint
16761 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
16762 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
16763 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
16764
16765 % Positive input terminal
16766 \pgfpathmoveto{\pgfpoint
16767 {\pgf@circ@res@left}
16768 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
16769 \pgfpathlineto{\pgfpoint
16770 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
16771 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
16772 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
16773
16774 % Negative output terminal label
16775 \pgftext[right, bottom, x=3pt, y=1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
16776
16777 % Positive output terminal label
16778 \pgftext[right, top, x=3pt, y=-1pt, at=\pgfpoint{0pt}{0.425\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd op amp/font} \ifpgf@circuit@oa@oplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
16779
16780 \pgfsetrectcap
16781 \pgfusepath{draw}
16782 }
16783 }
16784
16785
16786 % Instrumentation amplifier with differential output
16787 \pgfdeclareshape{fd inst amp}
16788 {
16789 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16790 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16791 % when tikz calls the anchor it wants the relative position in the lengths
16792 % \pgf@x \pgf@y
16793 % \pgfpoint* functions set that variables
16794 % anchors are visible outside and run on use
16795 \anchor{center}{\pgfpointorigin}
16796 % savedanchors are internals and run on node creation (not use)
16797 % bounding-box top left
16798 \savedanchor\northwest{%
16799 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16800 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16801 \pgf@y=.5\pgf@y
16802 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16803 \pgf@x=.5\pgf@x
16804 }
16805 \anchor{nw}{
16806 \northwest
16807 }
16808 \anchor{south}{
16809 \northwest
16810 \pgf@y=-\pgf@y\pgf@x=0pt\relax
16811 }
16812 \anchor{north}{
16813 \northwest\pgf@x=0pt\relax
16814 }
16815 \savedanchor\left{%
16816 \pgf@y=0pt
16817 }
16818 \anchor{leftedge}
16819 {\left
16820 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
16821 }
16822 \savedanchor\inOneFixed{%
16823 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16824 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16825 \pgf@y=.5\pgf@y
16826 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
16827 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16828 \pgf@x=.5\pgf@x
16829 }
16830 \anchor{in up}{
16831 \inOneFixed
16832 }
16833 \anchor{in down}{
16834 \inOneFixed
16835 \pgf@y=-\pgf@y
16836 }
16837 \savedanchor\inOne{%
16838 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16839 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16840 \pgf@y=.5\pgf@y
16841 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
16842 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16843 \pgf@x=.5\pgf@x
16844 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16845 }
16846 \anchor{-}{
16847 \inOne
16848 }
16849 \anchor{+}{
16850 \inOne
16851 \pgf@y=-\pgf@y
16852 }
16853 \savedanchor\up{%
16854 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16855 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16856 \pgf@y=.5\pgf@y
16857 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16858 \pgf@x=.5\pgf@x
16859 \pgf@circ@res@up = \pgf@y
16860 \pgf@circ@res@right = -\pgf@x
16861 \pgf@circ@res@left = \pgf@x
16862 \pgfpointlineattime{
16863 \ctikzvalof{tripoles/fd inst amp/up pos}}{
16864 \pgfpoint{
16865 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
16866 {\pgf@circ@res@up}}
16867 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
16868 }
16869 \anchor{up}{
16870 \up
16871 }
16872 \anchor{down}{
16873 \up
16874 \pgf@y=-\pgf@y
16875 }
16876 % reference voltage input anchors.
16877 \savedanchor\refv{%
16878 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16879 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16880 \pgf@y=.5\pgf@y
16881 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16882 \pgf@x=.5\pgf@x
16883 \pgf@circ@res@up = \pgf@y
16884 \pgf@circ@res@right = -\pgf@x
16885 \pgf@circ@res@left = \pgf@x
16886 \pgfpointlineattime{
16887 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
16888 \pgfpoint{
16889 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
16890 {\pgf@circ@res@up}}
16891 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
16892 }
16893 % we need both because they are normally drawn under the amp, and if you
16894 % mirror it vertically you need them
16895 \anchor{refv up}{
16896 \refv
16897 }
16898 \anchor{refv down}{
16899 \refv
16900 \pgf@y=-\pgf@y
16901 }
16902 \savedanchor\outport{
16903 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16904 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16905 \pgf@y=.5\pgf@y
16906 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
16907 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16908 \pgf@x=-.5\pgf@x
16909 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
16910 }
16911 \anchor{out}{
16912 \outport
16913 \pgf@y=0pt
16914 }
16915 \anchor{out +}{
16916 \outport
16917 }
16918 \anchor{out -}{
16919 \outport
16920 \pgf@y=-\pgf@y
16921 }
16922 \savedanchor\outportfixed{
16923 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16924 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16925 \pgf@y=.5\pgf@y
16926 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
16927 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16928 \pgf@x=-.5\pgf@x
16929 }
16930 \anchor{out up}{
16931 \outportfixed
16932 }
16933 \anchor{out down}{
16934 \outportfixed
16935 \pgf@y=-\pgf@y
16936 }
16937 % support for border anchors
16938 \savedanchor\leftedge{%
16939 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16940 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16941 \pgf@x=.5\pgf@x
16942 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
16943 \pgf@y=0pt
16944 }
16945 \anchor{leftedge}{\leftedge}
16946 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16947 \anchor{bin up}{
16948 \inOneFixed
16949 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16950 }
16951 \anchor{bin down}{
16952 \inOneFixed
16953 \pgf@y=-\pgf@y
16954 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16955 }
16956 \anchor{b-}{
16957 \inOne
16958 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16959 }
16960 \anchor{b+}{
16961 \inOne
16962 \pgf@y=-\pgf@y
16963 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16964 }
16965 \anchor{bout}{
16966 \leftedge
16967 \pgf@x=-\pgf@x \pgf@y=0pt
16968 }
16969 \anchor{bout +}{
16970 \outport
16971 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
16972 }
16973 \anchor{bout -}{
16974 \outport
16975 \pgf@y=-\pgf@y
16976 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
16977 }
16978 \anchor{bout up}{
16979 \outportfixed
16980 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
16981 }
16982 \anchor{bout down}{
16983 \outportfixed
16984 \pgf@y=-\pgf@y
16985 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
16986 }
16987 % end border anchors
16988 %
16989 \anchor{west}{
16990 \left
16991 }
16992 \anchor{east}{
16993 \left
16994 \pgf@x=-\pgf@x
16995 }
16996 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16997 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16998 \anchor{north west}{ \northwest }
16999 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17000 \anchor{text}{
17001 \ifpgf@circ@center@text
17002 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17003 \else
17004 \leftedge
17005 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
17006 \fi
17007 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17008 }
17009
17010 % let's start drawing the component
17011 \backgroundpath{
17012 \pgfsetcolor{\ctikzvalof{color}}
17013 %
17014 \northwest
17015 \pgf@circ@res@up = \pgf@y
17016 \pgf@circ@res@down = -\pgf@y
17017 \pgf@circ@res@right = -\pgf@x
17018 \pgf@circ@res@left = \pgf@x
17019 \pgf@circ@scaled@Rlen=\scaledRlen
17020 % main component, normally in thicker lines
17021 \pgfscope
17022 \newdimen\pgf@circ@res@right@double
17023 \pgf@circ@res@right@double=2\pgf@circ@res@right
17024
17025 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17026 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
17027 \pgf@circ@res@step=\pgf@circ@res@right
17028 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17029 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
17030 %first point (near output)
17031 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
17032 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
17033 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
17034 % and then to the input "front up", "down", to the output short side "down"
17035 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17036 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17037 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@down}}
17038 % ...and close
17039 \pgfpathclose
17040 \pgf@circ@draworfill
17041 \endpgfscope
17042
17043 % input terminal up
17044 \pgfpathmoveto{\pgfpoint
17045 {\pgf@circ@res@left}
17046 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
17047 %
17048 \pgfpathlineto{\pgfpoint
17049 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
17050 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
17051 %
17052 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
17053
17054 % input terminal down
17055 \pgfpathmoveto{\pgfpoint
17056 {\pgf@circ@res@left}
17057 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
17058 %
17059 \pgfpathlineto{\pgfpoint
17060 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
17061 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
17062 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
17063
17064 % output leads down and up
17065 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
17066 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
17067 \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$-\;$\else$+\;$\fi}
17068
17069 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
17070 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
17071 \pgftext[right, at=\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/fd inst amp/font}\ifpgf@circuit@oa@oplusup$+\;$\else$-\;$\fi}
17072 %
17073 \pgfsetrectcap
17074 \pgfusepath{draw}
17075 }
17076 }
17077
17078 % Transconductance amplifier (Transkonduktanzverstärker)
17079 \pgfdeclareshape{gm amp}
17080 {
17081 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17082 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17083 \anchor{center}{\pgfpointorigin}
17084 \savedanchor\northwest{%
17085 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17086 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
17087 \pgf@y=.5\pgf@y
17088 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
17089 \pgf@x=.5\pgf@x
17090 }
17091 \anchor{south}{
17092 \northwest
17093 \pgf@y=-\pgf@y
17094 }
17095 \anchor{north}{
17096 \northwest
17097 }
17098 \savedanchor\left{%
17099 \pgf@y=0pt
17100 }
17101 \anchor{leftedge}
17102 {\left
17103 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
17104 }
17105 \savedanchor\inOneFixed{%
17106 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17107 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
17108 \pgf@y=.5\pgf@y
17109 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
17110 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
17111 \pgf@x=.5\pgf@x
17112 }
17113 \anchor{in up}{
17114 \inOneFixed
17115 }
17116 \anchor{in down}{
17117 \inOneFixed
17118 \pgf@y=-\pgf@y
17119 }
17120 \savedanchor\inOne{%
17121 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17122 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
17123 \pgf@y=.5\pgf@y
17124 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
17125 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
17126 \pgf@x=.5\pgf@x
17127 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17128 }
17129 \anchor{-}{
17130 \inOne
17131 }
17132 \anchor{+}{
17133 \inOne
17134 \pgf@y=-\pgf@y
17135 }
17136 \savedanchor\up{%
17137 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17138 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
17139 \pgf@y=.5\pgf@y
17140 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
17141 \pgf@x=.5\pgf@x
17142 \pgf@circ@res@up = \pgf@y
17143 \pgf@circ@res@right = -\pgf@x
17144 \pgf@circ@res@left = \pgf@x
17145 \pgfpointlineattime{
17146 \ctikzvalof{tripoles/gm amp/up pos}}{
17147 \pgfpoint{
17148 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
17149 {\pgf@circ@res@up}}
17150 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
17151 }
17152 \anchor{up}{
17153 \up
17154 }
17155 \anchor{down}{
17156 \up
17157 \pgf@y=-\pgf@y
17158 }
17159 \anchor{out}{
17160 \northwest
17161 \pgf@y=0pt
17162 \pgf@x=-\pgf@x
17163 }
17164 % support for border anchors
17165 \savedanchor\leftedge{%
17166 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17167 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
17168 \pgf@x=.5\pgf@x
17169 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
17170 \pgf@y=0pt
17171 }
17172 \anchor{leftedge}{\leftedge}
17173 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
17174 \anchor{bin up}{
17175 \inOneFixed
17176 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17177 }
17178 \anchor{bin down}{
17179 \inOneFixed
17180 \pgf@y=-\pgf@y
17181 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17182 }
17183 \anchor{b-}{
17184 \inOne
17185 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17186 }
17187 \anchor{b+}{
17188 \inOne
17189 \pgf@y=-\pgf@y
17190 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17191 }
17192 \anchor{bout}{
17193 \leftedge
17194 \pgf@y=0pt
17195 \pgf@x=-\pgf@x
17196 }
17197 % end border anchors
17198 \anchor{west}{
17199 \left
17200 }
17201 \anchor{east}{
17202 \left
17203 \pgf@x=-\pgf@x
17204 }
17205 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17206 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17207 \anchor{north west}{ \northwest }
17208 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17209
17210 \anchor{text}{
17211 \ifpgf@circ@center@text
17212 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17213 \else
17214 \leftedge
17215 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
17216 \fi
17217 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17218 }
17219 \backgroundpath{
17220 \pgfsetcolor{\ctikzvalof{color}}
17221
17222 \northwest
17223 \pgf@circ@res@up = \pgf@y
17224 \pgf@circ@res@down = -\pgf@y
17225 \pgf@circ@res@right = -\pgf@x
17226 \pgf@circ@res@left = \pgf@x
17227 \pgf@circ@scaled@Rlen=\scaledRlen
17228
17229 \pgfscope
17230 \newdimen\pgf@circ@res@right@double
17231 \pgf@circ@res@right@double=2\pgf@circ@res@right
17232
17233 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17234 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
17235 \pgf@circ@res@step=\pgf@circ@res@right
17236 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17237 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
17238 %Umrandung:
17239 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
17240 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}%vom Ausgang nach oben
17241 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
17242 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
17243 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@down}}%ecke links unten nach rechts unten
17244 \pgfpathclose
17245 \pgf@circ@draworfill
17246 \endpgfscope
17247
17248 \pgfpathmoveto{\pgfpoint
17249 {\pgf@circ@res@left}
17250 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
17251 \pgfpathlineto{\pgfpoint
17252 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
17253 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
17254 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
17255
17256
17257 \pgfpathmoveto{\pgfpoint
17258 {\pgf@circ@res@left}
17259 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
17260 \pgfpathlineto{\pgfpoint
17261 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
17262 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
17263 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/gm amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
17264
17265 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17266 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
17267 \pgfsetrectcap
17268 \pgfusepath{draw}
17269
17270 }
17271 }
17272
17273 % Instrumentation amplifier
17274 \pgfdeclareshape{inst amp}
17275 {
17276 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17277 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17278 % when tikz calls the anchor it wants the relative position in the lengths
17279 % \pgf@x \pgf@y
17280 % \pgfpoint* functions set that variables
17281 % anchors are visible outside and run on use
17282 \anchor{center}{\pgfpointorigin}
17283 % savedanchors are internals and run on node creation (not use)
17284 % bounding-box top left
17285 \savedanchor\northwest{%
17286 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17287 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17288 \pgf@y=.5\pgf@y
17289 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17290 \pgf@x=.5\pgf@x
17291 }
17292 \anchor{nw}{
17293 \northwest
17294 }
17295 \anchor{south}{
17296 \northwest
17297 \pgf@y=-\pgf@y
17298 }
17299 \anchor{north}{
17300 \northwest
17301 }
17302 \savedanchor\left{%
17303 \pgf@y=0pt
17304 }
17305 \anchor{leftedge}
17306 {\left
17307 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
17308 }
17309 \savedanchor\inOneFixed{%
17310 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17311 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17312 \pgf@y=.5\pgf@y
17313 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
17314 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17315 \pgf@x=.5\pgf@x
17316 }
17317 \anchor{in up}{
17318 \inOneFixed
17319 }
17320 \anchor{in down}{
17321 \inOneFixed
17322 \pgf@y=-\pgf@y
17323 }
17324 \savedanchor\inOne{%
17325 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17326 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17327 \pgf@y=.5\pgf@y
17328 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
17329 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17330 \pgf@x=.5\pgf@x
17331 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17332 }
17333 \anchor{-}{
17334 \inOne
17335 }
17336 \anchor{+}{
17337 \inOne
17338 \pgf@y=-\pgf@y
17339 }
17340 \savedanchor\up{%
17341 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17342 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17343 \pgf@y=.5\pgf@y
17344 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17345 \pgf@x=.5\pgf@x
17346 \pgf@circ@res@up = \pgf@y
17347 \pgf@circ@res@right = -\pgf@x
17348 \pgf@circ@res@left = \pgf@x
17349 \pgfpointlineattime{
17350 \ctikzvalof{tripoles/inst amp/up pos}}{
17351 \pgfpoint{
17352 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17353 {\pgf@circ@res@up}}
17354 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
17355 }
17356 \anchor{up}{
17357 \up
17358 }
17359 \anchor{down}{
17360 \up
17361 \pgf@y=-\pgf@y
17362 }
17363 % reference voltage input anchors.
17364 \savedanchor\refv{%
17365 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17366 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17367 \pgf@y=.5\pgf@y
17368 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17369 \pgf@x=.5\pgf@x
17370 \pgf@circ@res@up = \pgf@y
17371 \pgf@circ@res@right = -\pgf@x
17372 \pgf@circ@res@left = \pgf@x
17373 \pgfpointlineattime{
17374 \ctikzvalof{tripoles/inst amp/refv pos}}{
17375 \pgfpoint{
17376 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17377 {\pgf@circ@res@up}}
17378 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
17379 }
17380 % we need both because they are normally drawn under the amp, and if you
17381 % mirror it vertically you need them
17382 \anchor{refv up}{
17383 \refv
17384 }
17385 \anchor{refv down}{
17386 \refv
17387 \pgf@y=-\pgf@y
17388 }
17389 \anchor{out}{
17390 \northwest
17391 \pgf@y=0pt
17392 \pgf@x=-\pgf@x
17393 }
17394 % support for border anchors
17395 \savedanchor\leftedge{%
17396 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17397 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17398 \pgf@x=.5\pgf@x
17399 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
17400 \pgf@y=0pt
17401 }
17402 \anchor{leftedge}{\leftedge}
17403 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
17404 \anchor{bin up}{
17405 \inOneFixed
17406 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17407 }
17408 \anchor{bin down}{
17409 \inOneFixed
17410 \pgf@y=-\pgf@y
17411 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17412 }
17413 \anchor{b-}{
17414 \inOne
17415 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17416 }
17417 \anchor{b+}{
17418 \inOne
17419 \pgf@y=-\pgf@y
17420 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17421 }
17422 \anchor{bout}{
17423 \leftedge
17424 \pgf@y=0pt
17425 \pgf@x=-\pgf@x
17426 }
17427 % end border anchors
17428 \anchor{west}{
17429 \left
17430 }
17431 \anchor{east}{
17432 \left
17433 \pgf@x=-\pgf@x
17434 }
17435 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17436 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17437 \anchor{north west}{ \northwest }
17438 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17439
17440 \anchor{text}{
17441 \ifpgf@circ@center@text
17442 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17443 \else
17444 \leftedge
17445 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
17446 \fi
17447 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17448 }
17449
17450 % let's start drawing the component
17451 \backgroundpath{
17452 \pgfsetcolor{\ctikzvalof{color}}
17453 %
17454 \northwest
17455 \pgf@circ@res@up = \pgf@y
17456 \pgf@circ@res@down = -\pgf@y
17457 \pgf@circ@res@right = -\pgf@x
17458 \pgf@circ@res@left = \pgf@x
17459 \pgf@circ@scaled@Rlen=\scaledRlen
17460
17461 % main component, normally in thicker lines
17462 \pgfscope
17463 \newdimen\pgf@circ@res@right@double
17464 \pgf@circ@res@right@double=2\pgf@circ@res@right
17465
17466 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17467 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17468 \pgf@circ@res@step=\pgf@circ@res@right
17469 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17470 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
17471 %first point (near output)
17472 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
17473 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
17474 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
17475 % and then to the input "front up", "down", to the output short side "down"
17476 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17477 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17478 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
17479 % ...and close
17480 \pgfpathclose
17481 \pgf@circ@draworfill
17482 \endpgfscope
17483
17484 % Negative input terminal
17485 \pgfpathmoveto{\pgfpoint
17486 {\pgf@circ@res@left}
17487 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
17488 %
17489 \pgfpathlineto{\pgfpoint
17490 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17491 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
17492 %
17493 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
17494
17495 % Positive input terminal
17496 \pgfpathmoveto{\pgfpoint
17497 {\pgf@circ@res@left}
17498 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
17499 %
17500 \pgfpathlineto{\pgfpoint
17501 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17502 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
17503 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
17504
17505 % Output terminal
17506 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17507 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
17508 %
17509 \pgfsetrectcap
17510 \pgfusepath{draw}
17511 }
17512 }
17513
17514 % Instrumentation amplifier with terminals for gain resistance between inputs
17515 \pgfdeclareshape{inst amp ra}
17516 {
17517 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17518 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17519 \anchor{center}{\pgfpointorigin}
17520 % bounding-box top left
17521 \savedanchor\northwest{%
17522 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17523 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17524 \pgf@y=.5\pgf@y
17525 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17526 \pgf@x=.5\pgf@x
17527 }
17528 \anchor{nw}{
17529 \northwest
17530 }
17531 \anchor{south}{
17532 \northwest
17533 \pgf@y=-\pgf@y\pgf@x=0pt\relax
17534 }
17535 \anchor{north}{
17536 \northwest\pgf@x=0pt\relax
17537 }
17538 \savedanchor\left{%
17539 \pgf@y=0pt
17540 }
17541 \anchor{leftedge}
17542 {\left
17543 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
17544 }
17545 % inputs (+-)
17546 \savedanchor\inOneFixed{%
17547 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17548 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17549 \pgf@y=.5\pgf@y
17550 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
17551 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17552 \pgf@x=.5\pgf@x
17553 }
17554 \anchor{in up}{
17555 \inOneFixed
17556 }
17557 \anchor{in down}{
17558 \inOneFixed
17559 \pgf@y=-\pgf@y
17560 }
17561 \savedanchor\inOne{%
17562 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17563 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17564 \pgf@y=.5\pgf@y
17565 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
17566 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17567 \pgf@x=.5\pgf@x
17568 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17569 }
17570 \anchor{-}{
17571 \inOne
17572 }
17573 \anchor{+}{
17574 \inOne
17575 \pgf@y=-\pgf@y
17576 }
17577 % R ampli anchors. They are by default at 20% more than R-length distance
17578 % you can change that with the `ra pos` key (use 0.5 for one-R).
17579 \savedanchor\raOneFixed{%
17580 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17581 \pgf@y=\pgf@circ@scaled@Rlen
17582 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
17583 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17584 \pgf@x=.5\pgf@x
17585 }
17586 \anchor{ra up}{
17587 \raOneFixed
17588 }
17589 \anchor{ra down}{
17590 \raOneFixed
17591 \pgf@y=-\pgf@y
17592 }
17593 \savedanchor\raOne{%
17594 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17595 \pgf@y=\pgf@circ@scaled@Rlen
17596 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
17597 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17598 \pgf@x=.5\pgf@x
17599 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17600 }
17601 \anchor{ra-}{
17602 \raOne
17603 }
17604 \anchor{ra+}{
17605 \raOne
17606 \pgf@y=-\pgf@y
17607 }
17608 % power supplies
17609 \savedanchor\up{%
17610 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17611 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17612 \pgf@y=.5\pgf@y
17613 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17614 \pgf@x=.5\pgf@x
17615 \pgf@circ@res@up = \pgf@y
17616 \pgf@circ@res@right = -\pgf@x
17617 \pgf@circ@res@left = \pgf@x
17618 \pgfpointlineattime{
17619 \ctikzvalof{tripoles/inst amp ra/up pos}}{
17620 \pgfpoint{
17621 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17622 {\pgf@circ@res@up}}
17623 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
17624 }
17625 \anchor{up}{
17626 \up
17627 }
17628 \anchor{down}{
17629 \up
17630 \pgf@y=-\pgf@y
17631 }
17632 % reference voltage input anchors.
17633 \savedanchor\refv{%
17634 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17635 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17636 \pgf@y=0.5\pgf@y
17637 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17638 \pgf@x=0.5\pgf@x
17639 \pgf@circ@res@up = \pgf@y
17640 \pgf@circ@res@right = -\pgf@x
17641 \pgf@circ@res@left = \pgf@x
17642 \pgfpointlineattime{
17643 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
17644 \pgfpoint{
17645 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17646 {\pgf@circ@res@up}}
17647 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
17648 }
17649 % we need both because they are normally drawn under the amp, and if you
17650 % mirror it vertically you need them
17651 \anchor{refv up}{
17652 \refv
17653 }
17654 \anchor{refv down}{
17655 \refv
17656 \pgf@y=-\pgf@y
17657 }
17658 \anchor{out}{
17659 \northwest
17660 \pgf@y=0pt
17661 \pgf@x=-\pgf@x
17662 }
17663 % support for border anchors
17664 \savedanchor\leftedge{%
17665 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17666 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17667 \pgf@x=.5\pgf@x
17668 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
17669 \pgf@y=0pt
17670 }
17671 \anchor{leftedge}{\leftedge}
17672 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
17673 \anchor{bin up}{
17674 \inOneFixed
17675 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17676 }
17677 \anchor{bin down}{
17678 \inOneFixed
17679 \pgf@y=-\pgf@y
17680 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17681 }
17682 \anchor{b-}{
17683 \inOne
17684 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17685 }
17686 \anchor{b+}{
17687 \inOne
17688 \pgf@y=-\pgf@y
17689 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17690 }
17691 \anchor{bra up}{
17692 \raOneFixed
17693 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17694 }
17695 \anchor{bra down}{
17696 \raOneFixed
17697 \pgf@y=-\pgf@y
17698 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17699 }
17700 \anchor{bra-}{
17701 \raOne
17702 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17703 }
17704 \anchor{bra+}{
17705 \raOne
17706 \pgf@y=-\pgf@y
17707 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17708 }
17709 \anchor{bout}{
17710 \leftedge
17711 \pgf@y=0pt
17712 \pgf@x=-\pgf@x
17713 }
17714 % end border anchors
17715 \anchor{west}{
17716 \left
17717 }
17718 \anchor{east}{
17719 \left
17720 \pgf@x=-\pgf@x
17721 }
17722 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17723 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17724 \anchor{north west}{ \northwest }
17725 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17726
17727 \anchor{text}{
17728 \ifpgf@circ@center@text
17729 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17730 \else
17731 \leftedge
17732 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
17733 \fi
17734 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17735 }
17736
17737 % drawing of the component
17738 \backgroundpath{
17739 \pgfsetcolor{\ctikzvalof{color}}
17740
17741 \northwest
17742 \pgf@circ@res@up = \pgf@y
17743 \pgf@circ@res@down = -\pgf@y
17744 \pgf@circ@res@right = -\pgf@x
17745 \pgf@circ@res@left = \pgf@x
17746 \pgf@circ@scaled@Rlen=\scaledRlen
17747
17748 \newdimen\pgf@circ@res@right@double
17749 \pgf@circ@res@right@double=2\pgf@circ@res@right
17750
17751 % main component, normally in thicker lines
17752 \pgfscope
17753 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17754 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17755 \pgf@circ@res@step=\pgf@circ@res@right
17756 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17757 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
17758 %primer punto: la linea de salida (lado componente)
17759 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
17760 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
17761 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
17762 % and then to the input "front up", "down", to the output short side "down"
17763 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17764 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17765 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@down}}
17766 % ...and close
17767 \pgfpathclose
17768 \pgf@circ@draworfill
17769 \endpgfscope
17770
17771 % ra terminal -
17772 \pgfpathmoveto{\pgfpoint
17773 {\pgf@circ@res@left}
17774 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
17775 %
17776 \pgfpathlineto{\pgfpoint
17777 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17778 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
17779 % ra terminal +
17780 \pgfpathmoveto{\pgfpoint
17781 {\pgf@circ@res@left}
17782 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
17783 %
17784 \pgfpathlineto{\pgfpoint
17785 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17786 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
17787
17788 % Negative input terminal
17789 \pgfpathmoveto{\pgfpoint
17790 {\pgf@circ@res@left}
17791 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
17792 %
17793 \pgfpathlineto{\pgfpoint
17794 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17795 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
17796 %
17797 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@plus\else\pgf@circ@ampli@minus\fi}
17798
17799 % Positive input terminal
17800 \pgfpathmoveto{\pgfpoint
17801 {\pgf@circ@res@left}
17802 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
17803 %
17804 \pgfpathlineto{\pgfpoint
17805 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17806 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
17807 \pgftext[left, at=\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}{\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}]{\ctikzvalof{tripoles/inst amp ra/font} \ifpgf@circuit@oa@iplusup\pgf@circ@ampli@minus\else\pgf@circ@ampli@plus\fi}
17808
17809 % Output terminal
17810 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17811 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
17812 %
17813 \pgfsetrectcap
17814 \pgfusepath{draw}
17815 }
17816 }
17817
17818 % Buffer
17819 % Contributed by Danilo Piazzalunga
17820 \pgfdeclareshape{buffer}
17821 {
17822 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17823 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17824 \anchor{center}{\pgfpointorigin}
17825 \savedanchor\northwest{%
17826 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17827 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
17828 \pgf@y=.5\pgf@y
17829 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
17830 \pgf@x=.5\pgf@x
17831 }
17832 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
17833 \anchor{west}{ \northwest \pgf@y=0pt }
17834 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
17835 \anchor{north}{ \northwest \pgf@x=0pt }
17836 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17837 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17838 \anchor{north west}{ \northwest }
17839 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17840 \savedanchor\left{%
17841 \pgf@y=0pt
17842 }
17843 \anchor{in}{
17844 \northwest
17845 \pgf@y=0pt
17846 }
17847 \anchor{out}{
17848 \northwest
17849 \pgf@y=0pt
17850 \pgf@x=-\pgf@x
17851 }
17852 \anchor{bin}{
17853 \northwest
17854 \pgf@y=0pt
17855 \pgf@x=0.7\pgf@x
17856 }
17857 \anchor{bout}{
17858 \northwest
17859 \pgf@y=0pt
17860 \pgf@x=-0.7\pgf@x
17861 }
17862
17863 \anchor{text}{
17864 \ifpgf@circ@center@text
17865 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17866 \else
17867 \northwest
17868 \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
17869 \fi
17870 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17871 }
17872
17873 \backgroundpath{
17874 \pgfsetcolor{\ctikzvalof{color}}
17875
17876 \northwest
17877 \pgf@circ@res@up = \pgf@y
17878 \pgf@circ@res@down = -\pgf@y
17879 \pgf@circ@res@right = -\pgf@x
17880 \pgf@circ@res@left = \pgf@x
17881 \pgf@circ@scaled@Rlen=\scaledRlen
17882 \pgfscope
17883 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17884 \pgftransformxshift{.7\pgf@circ@res@left}
17885 \pgf@circ@res@step=\pgf@circ@res@right
17886 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17887 \pgf@circ@res@step=.7\pgf@circ@res@step
17888
17889 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
17890 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17891 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17892 \pgfpathclose
17893 \pgf@circ@draworfill
17894 \endpgfscope
17895
17896 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
17897 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
17898
17899 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17900 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
17901
17902 \pgfusepath{draw}
17903 }
17904 }
17905
17906 % plain amplifier, no symbols
17907 \pgfdeclareshape{plain amp}
17908 {
17909 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17910 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17911 \anchor{center}{\pgfpointorigin}
17912 \savedanchor\northwest{%
17913 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17914 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17915 \pgf@y=.5\pgf@y
17916 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17917 \pgf@x=.5\pgf@x
17918 }
17919 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
17920 \anchor{west}{ \northwest \pgf@y=0pt }
17921 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
17922 \anchor{north}{ \northwest \pgf@x=0pt }
17923 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17924 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17925 \anchor{north west}{ \northwest }
17926 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17927 \savedanchor\left{%
17928 \pgf@y=0pt
17929 }
17930 \savedanchor\inOne{%
17931 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17932 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17933 \pgf@y=.5\pgf@y
17934 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
17935 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17936 \pgf@x=.5\pgf@x
17937 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17938 }
17939 \savedanchor\inOneFixed{%
17940 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17941 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17942 \pgf@y=.5\pgf@y
17943 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
17944 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17945 \pgf@x=.5\pgf@x
17946 }
17947 \anchor{-}{
17948 \inOne
17949 }
17950 \anchor{+}{
17951 \inOne
17952 \pgf@y=-\pgf@y
17953 }
17954 \anchor{in up}{
17955 \inOneFixed
17956 }
17957 \anchor{in down}{
17958 \inOneFixed
17959 \pgf@y=-\pgf@y
17960 }
17961 % support for border anchors
17962 \savedanchor\leftedge{%
17963 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17964 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17965 \pgf@x=.5\pgf@x
17966 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
17967 \pgf@y=0pt
17968 }
17969 \anchor{leftedge}{\leftedge}
17970 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
17971 \anchor{bin up}{
17972 \inOneFixed
17973 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17974 }
17975 \anchor{bin down}{
17976 \inOneFixed
17977 \pgf@y=-\pgf@y
17978 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17979 }
17980 \anchor{b-}{
17981 \inOne
17982 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17983 }
17984 \anchor{b+}{
17985 \inOne
17986 \pgf@y=-\pgf@y
17987 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17988 }
17989 \anchor{bout}{
17990 \leftedge
17991 \pgf@y=0pt
17992 \pgf@x=-\pgf@x
17993 }
17994 % end border anchors
17995 \savedanchor\up{%
17996 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17997 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17998 \pgf@y=.5\pgf@y
17999 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
18000 \pgf@x=.5\pgf@x
18001 \pgf@circ@res@up = \pgf@y
18002 \pgf@circ@res@right = -\pgf@x
18003 \pgf@circ@res@left = \pgf@x
18004 \pgfpointlineattime{
18005 \ctikzvalof{tripoles/plain amp/up pos}}{
18006 \pgfpoint{
18007 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
18008 {\pgf@circ@res@up}}
18009 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
18010 }
18011 \anchor{up}{
18012 \up
18013 }
18014 \anchor{down}{
18015 \up
18016 \pgf@y=-\pgf@y
18017 }
18018 \anchor{out}{
18019 \northwest
18020 \pgf@y=0pt
18021 \pgf@x=-\pgf@x
18022 }
18023
18024 \anchor{text}{
18025 \ifpgf@circ@center@text
18026 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
18027 \else
18028 \leftedge
18029 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
18030 \fi
18031 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
18032 }
18033
18034 \backgroundpath{
18035 \pgfsetcolor{\ctikzvalof{color}}
18036
18037 \northwest
18038 \pgf@circ@res@up = \pgf@y
18039 \pgf@circ@res@down = -\pgf@y
18040 \pgf@circ@res@right = -\pgf@x
18041 \pgf@circ@res@left = \pgf@x
18042
18043 \pgfscope
18044 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18045 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
18046 \pgf@circ@res@step=\pgf@circ@res@right
18047 \advance\pgf@circ@res@step by -\pgf@circ@res@left
18048 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
18049
18050 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
18051 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18052 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
18053 \pgfpathclose
18054 \pgf@circ@draworfill
18055 \endpgfscope
18056 \pgfpathmoveto{\pgfpoint
18057 {\pgf@circ@res@left}
18058 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
18059 \pgfpathlineto{\pgfpoint
18060 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
18061 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
18062
18063
18064 \pgfpathmoveto{\pgfpoint
18065 {\pgf@circ@res@left}
18066 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
18067 \pgfpathlineto{\pgfpoint
18068 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
18069 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
18070
18071 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18072 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
18073
18074 \pgfusepath{draw}
18075 }
18076 }
18077
18078 % plain amplifier, no symbols, one input
18079 \pgfdeclareshape{plain mono amp}
18080 {
18081 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
18082 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18083 \anchor{center}{\pgfpointorigin}
18084 \savedanchor\northwest{%
18085 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18086 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
18087 \pgf@y=.5\pgf@y
18088 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
18089 \pgf@x=.5\pgf@x
18090 }
18091 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
18092 \anchor{west}{ \northwest \pgf@y=0pt }
18093 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
18094 \anchor{north}{ \northwest \pgf@x=0pt }
18095 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18096 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
18097 \anchor{north west}{ \northwest }
18098 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
18099 \savedanchor\left{%
18100 \pgf@y=0pt
18101 }
18102 \savedanchor\inOne{%
18103 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18104 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
18105 \pgf@x=.5\pgf@x
18106 \pgf@y=0pt\relax
18107 }
18108 \anchor{in}{
18109 \inOne
18110 }
18111 % support for border anchors
18112 \savedanchor\leftedge{%
18113 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18114 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
18115 \pgf@x=.5\pgf@x
18116 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
18117 \pgf@y=0pt
18118 }
18119 \anchor{leftedge}{\leftedge}
18120 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
18121 \anchor{bin}{
18122 \inOne
18123 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18124 }
18125 \anchor{bout}{
18126 \leftedge
18127 \pgf@y=0pt
18128 \pgf@x=-\pgf@x
18129 }
18130 % end border anchors
18131 \savedanchor\up{%
18132 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18133 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
18134 \pgf@y=.5\pgf@y
18135 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
18136 \pgf@x=.5\pgf@x
18137 \pgf@circ@res@up = \pgf@y
18138 \pgf@circ@res@right = -\pgf@x
18139 \pgf@circ@res@left = \pgf@x
18140 \pgfpointlineattime{
18141 \ctikzvalof{tripoles/plain amp/up pos}}{
18142 \pgfpoint{
18143 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
18144 {\pgf@circ@res@up}}
18145 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
18146 }
18147 \anchor{up}{
18148 \up
18149 }
18150 \anchor{down}{
18151 \up
18152 \pgf@y=-\pgf@y
18153 }
18154 \anchor{out}{
18155 \northwest
18156 \pgf@y=0pt
18157 \pgf@x=-\pgf@x
18158 }
18159
18160 \anchor{text}{
18161 \ifpgf@circ@center@text
18162 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
18163 \else
18164 \leftedge
18165 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
18166 \fi
18167 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
18168 }
18169 \backgroundpath{
18170 \pgfsetcolor{\ctikzvalof{color}}
18171
18172 \northwest
18173 \pgf@circ@res@up = \pgf@y
18174 \pgf@circ@res@down = -\pgf@y
18175 \pgf@circ@res@right = -\pgf@x
18176 \pgf@circ@res@left = \pgf@x
18177
18178 \pgfscope
18179 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18180 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
18181 \pgf@circ@res@step=\pgf@circ@res@right
18182 \advance\pgf@circ@res@step by -\pgf@circ@res@left
18183 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
18184
18185 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
18186 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18187 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
18188 \pgfpathclose
18189 \pgf@circ@draworfill
18190 \endpgfscope
18191 \pgfpathmoveto{\pgfpoint
18192 {\pgf@circ@res@left}
18193 {0pt}}
18194 \pgfpathlineto{\pgfpoint
18195 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
18196 {0pt}}
18197
18198 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18199 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
18200
18201 \pgfusepath{draw}
18202 }
18203 }% %>>>
18204
18205 %%%%%%%%%%%%%%%%%%%%%%%%%%%
18206 %% Tubes and magnetron
18207 %%%%%%%%%%%%%%%%%%%%%%%%
18208
18209 % Settings Electronic tubes: diodetube, triode, tetrode and pentode%<<<1
18210 \ctikzset{tubes/width/.initial=1} % relative width
18211 \ctikzset{tubes/height/.initial=1.4} % relative height
18212 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
18213 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
18214 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
18215 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
18216 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
18217 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
18218 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
18219 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
18220 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
18221 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
18222 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
18223 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
18224 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
18225
18226 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
18227
18228 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
18229 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
18230 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
18231 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
18232 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
18233 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
18234 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
18235 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
18236 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}%
18237 %>>>
18238
18239 %% Node shapes for tubes & co%<<<
18240
18241 %%%%%%%%%%%%%%%%%%%
18242 %% Magnetron
18243 %%%%%%%%%%%%%%%%%%%
18244
18245 \pgfdeclareshape{magnetron}
18246 {
18247 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
18248 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18249 \savedanchor\northwest{
18250 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18251 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
18252 \pgf@y=.5\pgf@y
18253 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
18254 \pgf@x=.5\pgf@x
18255 }
18256 \anchor{center}{
18257 \pgfpointorigin
18258 }
18259 \anchor{anode}{
18260 \northwest
18261 \pgf@x=0pt
18262 \pgf@y=-\pgf@y
18263 }
18264 \anchor{cathode1}{
18265 \northwest
18266 \pgf@circ@res@step=\pgf@y
18267 \pgfmathparse{cos(105)}
18268 \pgf@x=\pgfmathresult\pgf@circ@res@step
18269 \pgfmathparse{sin(105)}
18270 \pgf@y=\pgfmathresult\pgf@circ@res@step
18271 %\pgfpointorigin
18272 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
18273 }
18274 \anchor{cathode2}{
18275 \northwest
18276 \pgf@circ@res@step=\pgf@y
18277 \pgfmathparse{cos(75)}
18278 \pgf@x=\pgfmathresult\pgf@circ@res@step
18279 \pgfmathparse{sin(75)}
18280 \pgf@y=\pgfmathresult\pgf@circ@res@step
18281 %\pgfpointorigin
18282 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
18283 }
18284 \anchor{text}{
18285 \pgfpointorigin
18286 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
18287 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
18288 }
18289 \anchor{left}{%
18290 \northwest
18291 \pgf@y=0pt
18292 }
18293 \anchor{right}{%
18294 \northwest
18295 \pgf@y=0pt
18296 \pgf@x=-\pgf@x
18297 }
18298 \anchor{top}{
18299 \northwest
18300 \pgf@x=0pt
18301 }
18302 \anchor{pathstart}{
18303 \northwest
18304 \pgf@x=0pt
18305 }
18306 \anchor{pathend}{
18307 \northwest
18308 \pgf@x=0pt
18309 \pgf@y=-\pgf@y
18310 }
18311 \anchor{bottom}{
18312 \northwest
18313 \pgf@x=0pt
18314 \pgf@y=-\pgf@y
18315 }
18316 \anchor{center}{
18317 \pgf@y=0pt
18318 \pgf@x=0pt
18319 }
18320 \anchor{east}{
18321 \northwest
18322 \pgf@y=0pt
18323 \pgf@x=-\pgf@x
18324 }
18325 \anchor{west}{
18326 \northwest
18327 \pgf@y=0pt
18328 }
18329 \anchor{south}{
18330 \northwest
18331 \pgf@x=0pt
18332 \pgf@y=-\pgf@y
18333 }
18334 \anchor{north}{
18335 \northwest
18336 \pgf@x=0pt
18337 }
18338 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18339 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
18340 \anchor{north west}{ \northwest }
18341 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
18342 \backgroundpath{
18343 \pgfsetcolor{\ctikzvalof{color}}
18344 \pgf@circ@scaled@Rlen=\scaledRlen
18345 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
18346 \northwest
18347 \pgf@circ@res@up = \pgf@y
18348 \pgf@circ@res@down = -\pgf@y
18349 \pgf@circ@res@right = -\pgf@x
18350 \pgf@circ@res@left = \pgf@x
18351 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
18352
18353 \pgfscope
18354 \pgfstartlinewidth=\pgflinewidth
18355 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
18356 %create outer circle
18357 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
18358 \pgf@circ@draworfill
18359 %create chambers
18360 \foreach \angle in {45,135,225,315}{
18361 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
18362 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
18363 }
18364 \pgfsetroundcap
18365 \pgfusepath{draw}
18366 \pgfscope
18367 %draw connection from outside
18368 %anode
18369 \pgfsetlinewidth{\pgfstartlinewidth}
18370 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
18371 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
18372 %cathodes
18373 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
18374 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
18375 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
18376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
18377 \pgfsetbuttcap
18378 \pgfusepath{draw}
18379 \endpgfscope
18380 %create cathode
18381 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
18382 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
18383 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
18384 \pgfusepath{draw}
18385 %create anode
18386 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
18387 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
18388
18389 \pgfsetbuttcap
18390 \pgfusepath{draw}
18391 \endpgfscope
18392 }
18393 }
18394
18395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18396 % Electronic tubes, submitted by J. op den Brouw
18397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18398
18399 % Draw tube outline
18400 \def\pgf@circ@tubes@drawtube{%
18401 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
18402 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18403 \pgfutil@tempdima=\pgf@circ@res@right
18404 \advance\pgfutil@tempdima by -\pgf@circ@res@up
18405 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
18406 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
18407 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
18408 \pgfpatharc{270}{90}{\pgf@circ@res@up}
18409 \else
18410 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
18411 \pgfutil@tempdima=\pgf@circ@res@up
18412 \advance\pgfutil@tempdima by -\pgf@circ@res@right
18413 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
18414 \pgfpatharc{180}{0}{\pgf@circ@res@right}
18415 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
18416 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
18417 \fi
18418 \pgfpathclose
18419 }
18420
18421 %% The diode (tube), triode, tetrode and pentode only differ in the
18422 %% number of grids. So we construct a generic declare function in
18423 %% which we can put code for the grid anchors and grid drawing code
18424 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
18425 \long\def\pgfcircdeclaretube#1#2#3{%
18426 \pgfdeclareshape{#1}{
18427 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
18428 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18429 \anchor{center}{
18430 \pgfpointorigin
18431 }
18432 \savedanchor\northwest{%
18433 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18434 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
18435 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
18436 % x and y should be half the Rlen
18437 \pgf@y=\pgf@circ@res@up
18438 \pgf@y=.5\pgf@y
18439 \pgf@x=-\pgf@circ@res@right
18440 \pgf@x=.5\pgf@x
18441 }
18442 \anchor{north} {%
18443 \northwest
18444 \pgf@x=0pt
18445 }
18446 \anchor{east}{%
18447 \northwest
18448 \pgf@x=-\pgf@x
18449 \pgf@y=0pt
18450 }
18451 \anchor{south}{%
18452 \northwest
18453 \pgf@y=-\pgf@y
18454 \pgf@x=0pt
18455 }
18456 \anchor{west}{%
18457 \northwest
18458 \pgf@y=0pt
18459 }
18460 \anchor{north west}{%
18461 \northwest
18462 }
18463 \anchor{north east}{%
18464 \northwest
18465 \pgf@x=-\pgf@x
18466 }
18467 \anchor{south east}{
18468 \northwest
18469 \pgf@x=-\pgf@x
18470 \pgf@y=-\pgf@y
18471 }
18472 \anchor{south west}{
18473 \northwest
18474 \pgf@y=-\pgf@y
18475 }
18476 \anchor{anode} {%
18477 \northwest
18478 \pgf@x=0pt
18479 }
18480 \anchor{cathode}{%
18481 \northwest
18482 \pgf@y=-\pgf@y
18483 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
18484 }
18485 \anchor{cathode 1}{%
18486 \northwest
18487 \pgf@y=-\pgf@y
18488 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
18489 }
18490 \anchor{cathode 2}{%
18491 \northwest
18492 \pgf@y=-\pgf@y
18493 \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x
18494 }
18495 \anchor{filament 1}{%
18496 \northwest
18497 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
18498 \pgf@x=\pgfmathresult\pgf@x
18499 \pgf@y=-\pgf@y
18500 }
18501 \anchor{filament 2}{%
18502 \northwest
18503 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
18504 \pgf@x=-\pgfmathresult\pgf@x
18505 \pgf@y=-\pgf@y
18506 }
18507
18508 % Extra anchors
18509 #2
18510
18511 \backgroundpath{
18512 \pgfscope
18513 % Line width for tripoles
18514 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18515 \pgf@circ@scaled@Rlen=\scaledRlen
18516
18517 % Setup to draw tube
18518 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
18519 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
18520 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
18521 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18522
18523 % Tube outline
18524 \pgf@circ@tubes@drawtube
18525
18526 % Setup to draw grid, filament, anode and cathode
18527 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
18528 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
18529 \pgf@circ@res@up=0.5\pgf@circ@res@up
18530 \pgf@circ@res@right=0.5\pgf@circ@res@right
18531
18532 % Tube fill color (if any)
18533 \pgf@circ@draworfill
18534
18535 % Grid drawing
18536 #3
18537
18538 % Filament (is not drawn by default)
18539 \ifpgf@circuit@tubes@filament
18540 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
18541 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
18542 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
18543 \pgf@xa=\pgfmathresult\pgf@circ@res@right
18544 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
18545 \pgf@ya=\pgfmathresult\pgf@circ@res@up
18546 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
18547 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
18548 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
18549 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
18550 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
18551 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
18552 \pgf@circuit@tubes@filamentfalse
18553 \fi
18554
18555 % Anode (or plate)
18556 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
18557 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
18558 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
18559 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
18560
18561 % Cathode
18562 \ifpgf@circuit@tubes@nocathode
18563 \pgf@circuit@tubes@nocathodefalse
18564 \else
18565 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
18566 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
18567 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
18568 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
18569 \ifpgf@circuit@tubes@fullcathode
18570 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
18571 \pgf@circuit@tubes@fullcathodefalse
18572 \else
18573 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up-\ctikzvalof{tubes/cathode right extend}\pgf@circ@res@up}}
18574 \fi
18575 \fi
18576
18577 % Draw the background
18578 \pgfusepath{draw}
18579 \endpgfscope
18580 }
18581 }
18582 }
18583
18584 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
18585
18586 \pgfcircdeclaretube{triode}
18587 {
18588 \anchor{grid} {% should not be used
18589 \northwest
18590 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
18591 }
18592 \anchor{control} {%
18593 \northwest
18594 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
18595 }
18596 }
18597 {
18598 % Grid protrusion
18599 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18600 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
18601 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
18602 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
18603 % Grid dashes: calculations
18604 \pgf@xb=2\pgf@circ@res@right
18605 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
18606 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
18607 \multiply\pgf@circ@count@a by 2\relax
18608 \advance\pgf@circ@count@a by 1\relax
18609 \advance\pgf@circ@res@step by -\pgf@xa
18610 \divide\pgf@circ@res@step by \pgf@circ@count@a
18611 % Grid dashes: draw
18612 \pgf@circ@res@temp=\pgf@xa
18613 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
18614 \loop
18615 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18616 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
18617 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18618 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
18619 \advance\pgf@circ@count@a by-1
18620 \ifnum\pgf@circ@count@a>0\relax
18621 \repeat
18622 }
18623
18624 \pgfcircdeclaretube{tetrode}
18625 {
18626 \anchor{grid} {% should not be used
18627 \northwest
18628 \pgfutil@tempdima=\pgf@y
18629 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18630 \pgf@y=0.5\pgf@y
18631 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18632 }
18633 \anchor{control} {%
18634 \northwest
18635 \pgfutil@tempdima=\pgf@y
18636 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18637 \pgf@y=0.5\pgf@y
18638 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18639 }
18640 \anchor{screen} {%
18641 \northwest
18642 \pgfutil@tempdima=\pgf@y
18643 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
18644 \pgf@y=0.5\pgf@y
18645 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18646 }
18647 }
18648 {
18649 % Grid x/y points
18650 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18651 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
18652 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
18653 \pgfutil@tempdimb=-\pgfutil@tempdima
18654 \pgfutil@tempdima=0.5\pgfutil@tempdima
18655 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18656 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
18657 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18658 % Grid protrusion
18659 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
18660 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
18661 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
18662 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
18663 % Grid dashes: calculations
18664 \pgf@xb=2\pgf@circ@res@right
18665 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
18666 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
18667 \multiply\pgf@circ@count@a by 2\relax
18668 \advance\pgf@circ@count@a by 1\relax
18669 \advance\pgf@circ@res@step by -\pgf@xa
18670 \divide\pgf@circ@res@step by \pgf@circ@count@a
18671 % Grid dashes: draw
18672 \pgf@circ@res@temp=\pgf@xa
18673 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
18674 \loop
18675 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18676 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
18677 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
18678 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
18679 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
18680 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18681 \advance\pgf@circ@count@a by-1
18682 \ifnum\pgf@circ@count@a>0\relax
18683 \repeat
18684 }
18685
18686 \pgfcircdeclaretube{pentode}
18687 {
18688 \anchor{grid} {% should not be used
18689 \northwest
18690 \pgfutil@tempdima=\pgf@y
18691 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18692 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18693 }
18694 \anchor{control} {%
18695 \northwest
18696 \pgfutil@tempdima=\pgf@y
18697 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18698 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18699 }
18700 \anchor{screen} {%
18701 \northwest
18702 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
18703 }
18704 \anchor{suppressor} {%
18705 \northwest
18706 \pgfutil@tempdima=\pgf@y
18707 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
18708 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18709 }
18710 }
18711 {
18712 % Grid x/y points
18713 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18714 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
18715 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
18716 \pgfutil@tempdimb=-\pgfutil@tempdima
18717 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18718 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18719 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18720 % Grid protrusion
18721 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
18722 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
18723 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
18724 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
18725 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
18726 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
18727 % Grid dashes: calculations
18728 \pgf@xb=2\pgf@circ@res@right
18729 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
18730 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
18731 \multiply\pgf@circ@count@a by 2\relax
18732 \advance\pgf@circ@count@a by 1\relax
18733 \advance\pgf@circ@res@step by -\pgf@xa
18734 \divide\pgf@circ@res@step by \pgf@circ@count@a
18735 % Grid dashes: draw
18736 \pgf@circ@res@temp=\pgf@xa
18737 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
18738 \loop
18739 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18740 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
18741 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
18742 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
18743 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
18744 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
18745 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
18746 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18747 \advance\pgf@circ@count@a by-1
18748 \ifnum\pgf@circ@count@a>0\relax
18749 \repeat
18750 }
18751
18752 \pgfcircdeclaretube{pentode suppressor to cathode}
18753 {
18754 \anchor{grid} {% should not be used
18755 \northwest
18756 \pgfutil@tempdima=\pgf@y
18757 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18758 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18759 }
18760 \anchor{control} {%
18761 \northwest
18762 \pgfutil@tempdima=\pgf@y
18763 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18764 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18765 }
18766 \anchor{screen} {%
18767 \northwest
18768 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
18769 }
18770 }
18771 {
18772 % Grid x/y points
18773 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18774 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
18775 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
18776 \pgfutil@tempdimb=-\pgfutil@tempdima
18777 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18778 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18779 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18780 % Grid protrusion
18781 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
18782 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
18783 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
18784 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
18785 % Grid dashes: calculations
18786 \pgf@xb=2\pgf@circ@res@right
18787 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
18788 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
18789 \multiply\pgf@circ@count@a by 2\relax
18790 \advance\pgf@circ@count@a by 1\relax
18791 \advance\pgf@circ@res@step by -\pgf@xa
18792 \divide\pgf@circ@res@step by \pgf@circ@count@a
18793 % Grid dashes: draw
18794 \pgf@circ@res@temp=\pgf@xa
18795 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
18796 \loop
18797 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18798 \ifnum\pgf@circ@count@a>1\relax
18799 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
18800 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
18801 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
18802 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
18803 \fi
18804 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
18805 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
18806 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18807 \advance\pgf@circ@count@a by-1
18808 \ifnum\pgf@circ@count@a>0\relax
18809 \repeat
18810 % Grid: connection from suppressor to cathode
18811 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
18812 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
18813 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@[email protected]*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@[email protected]*\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
18814
18815 }% %>>>
18816
18817 % vim: set fdm=marker fmr=%<<<,%>>>:
18818 %%%---------- close: tex/pgfcirctripoles
18819 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
18820 %%%---------- open: tex/pgfcircquadpoles.tex
18821 % Copyright 2018-2026 by Romano Giannetti
18822 % Copyright 2015-2026 by Stefan Lindner
18823 % Copyright 2013-2026 by Stefan Erhardt
18824 % Copyright 2007-2026 by Massimo Redaelli
18825 %
18826 % This file may be distributed and/or modified
18827 %
18828 % 1. under the LaTeX Project Public License and/or
18829 % 2. under the GNU Public License.
18830 %
18831 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
18832
18833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18834 %% Quadripoles
18835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18836
18837
18838 % Setting for Transformers and similar quadpoles%<<<1
18839
18840 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
18841 \ctikzset{quadpoles/transformer/width/.initial=1.5}
18842 \ctikzset{quadpoles/transformer/width1/.initial=.4}
18843 \ctikzset{quadpoles/transformer/height/.initial=1.5}
18844 \ctikzset{quadpoles/transformer/height1/.initial=.8}
18845 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
18846 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
18847 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
18848 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
18849 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
18850 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
18851 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
18852 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
18853 \ctikzset{quadpoles/fourport/width/.initial=1.3}
18854 \ctikzset{quadpoles/fourport/height/.initial=1.3}
18855 \ctikzset{quadpoles/coupler/width/.initial=1.3}
18856 \ctikzset{quadpoles/coupler/height/.initial=1.3}
18857 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
18858 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
18859
18860
18861 \ctikzset{quadpoles style/.is choice}
18862 \ctikzset{quadpoles style/inward/.code={% default value
18863 \ctikzset{quadpoles/transformer/inner=0.4}%
18864 \ctikzset{quadpoles/transformer/width=1.5}%
18865 \ctikzset{quadpoles/transformer core/inner=0.4}%
18866 \ctikzset{quadpoles/transformer core/width=1.5}%
18867 \ctikzset{quadpoles/gyrator/inner=0.4}%
18868 \ctikzset{quadpoles/gyrator/width=1.5}%
18869 }%
18870 }
18871 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
18872 \ctikzset{quadpoles/transformer/inner=1}%
18873 \ctikzset{quadpoles/transformer/width=0.6}%
18874 \ctikzset{quadpoles/transformer core/inner=1}%
18875 \ctikzset{quadpoles/transformer core/width=0.6}%
18876 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
18877 \ctikzset{quadpoles/gyrator/width=0.6}%
18878 }%
18879 }
18880 %%>>>
18881
18882 %% Node shapes for quadpoles (basically transformers)%<<<
18883
18884 \long\def\pgfcircdeclarequadpole#1#2#3{
18885 \pgfdeclareshape{#1}
18886 {
18887 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
18888 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18889 % shapename
18890 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
18891 \anchor{center}{
18892 \northwest
18893 \pgf@x=0pt
18894 \pgf@y=0pt
18895 }
18896 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
18897 \savedanchor\northwest{%
18898 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18899 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
18900 \pgf@y=.5\pgf@y
18901 \pgf@x=.5\pgf@circ@scaled@Rlen
18902 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
18903 }
18904 %% we define the upper right (positive coord) dot (which is B1)
18905 \savedanchor{\innerdot}{%
18906 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18907 \pgf@xa=.5\pgf@circ@scaled@Rlen
18908 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
18909 % by default use the cute inductor size
18910 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
18911 % check if it's american
18912 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
18913 \edef\pgf@temp{american}
18914 \ifx\pgf@circ@temp\pgf@temp
18915 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
18916 \fi
18917 % check if it's european
18918 \edef\pgf@temp{european}
18919 \ifx\pgf@circ@temp\pgf@temp
18920 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
18921 \fi
18922 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
18923 }
18924 \savedanchor{\outerdot}{%
18925 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18926 \pgf@xa=.5\pgf@circ@scaled@Rlen
18927 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
18928 % by default use the cute inductor size
18929 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
18930 % check if it's american
18931 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
18932 \edef\pgf@temp{american}
18933 \ifx\pgf@circ@temp\pgf@temp
18934 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
18935 \fi
18936 % check if it's european
18937 \edef\pgf@temp{european}
18938 \ifx\pgf@circ@temp\pgf@temp
18939 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
18940 \fi
18941 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
18942 }
18943 \anchor{A2}{
18944 \northwest
18945 \pgf@y=-\pgf@y
18946 }
18947 \anchor{B1}{
18948 \northwest
18949 \pgf@x=-\pgf@x
18950 }
18951 \anchor{A1}{
18952 \northwest
18953 }
18954 \anchor{B2}{
18955 \northwest
18956 \pgf@x=-\pgf@x
18957 \pgf@y=-\pgf@y
18958 }
18959 %% dot's anchors
18960 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
18961 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
18962 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18963 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18964 \anchor{inner dot B1}{\innerdot}
18965 \anchor{outer dot B1}{\outerdot}
18966 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
18967 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
18968 % geographical
18969 \anchor{north}{
18970 \northwest
18971 \pgf@x=0pt
18972 }
18973 \anchor{south}{
18974 \northwest
18975 \pgf@x=0pt
18976 \pgf@y=-\pgf@y
18977 }
18978 \anchor{west}{
18979 \northwest
18980 \pgf@y=0pt
18981 }
18982 \anchor{east}{
18983 \northwest
18984 \pgf@y=0pt
18985 \pgf@x=-\pgf@x
18986 }
18987 \anchor{south west}{
18988 \northwest
18989 \pgf@y=-\pgf@y
18990 }
18991 \anchor{north east}{
18992 \northwest
18993 \pgf@x=-\pgf@x
18994 }
18995 \anchor{north west}{
18996 \northwest
18997 }
18998 \anchor{south east}{
18999 \northwest
19000 \pgf@x=-\pgf@x
19001 \pgf@y=-\pgf@y
19002 }
19003 \anchor{base}{
19004 \northwest
19005 \pgf@x=0pt
19006 }
19007 #3
19008 \backgroundpath{
19009 \pgfsetcolor{\ctikzvalof{color}}
19010
19011 \northwest
19012 \pgf@circ@res@up = \pgf@y
19013 \pgf@circ@res@down = -\pgf@y
19014 \pgf@circ@res@right = -\pgf@x
19015 \pgf@circ@res@left = \pgf@x
19016 #2
19017 }
19018 }
19019 }
19020
19021
19022 \def\pgf@circ@drawtransformerbasicanchor{
19023 \ctikzvalof{quadpoles/trans/height}
19024 \anchor{AA2}{
19025 \northwest
19026 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
19027 \pgf@x=.7\pgf@x
19028 \pgf@y=-\pgf@y
19029 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
19030 }
19031 \anchor{BB1}{
19032 \northwest
19033 \pgf@x=-\pgf@x
19034 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
19035 \pgf@x=.7\pgf@x
19036 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
19037 }
19038 \anchor{AA1}{
19039 \northwest
19040 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
19041 \pgf@x=.7\pgf@x
19042 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
19043 }
19044 \anchor{BB2}{
19045 \northwest
19046 \pgf@x=-\pgf@x
19047 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
19048 \pgf@x=.7\pgf@x
19049 \pgf@y=-\pgf@y
19050 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
19051 }
19052 }
19053
19054 %% Null styles that can be used to change individually the L1 and L2
19055 %% inductors of the transformer.
19056
19057 \ctikzset{transformer L1/.style={}}
19058 \ctikzset{transformer L2/.style={}}
19059
19060 \def\pgf@circ@drawtransformerbasicbody{
19061 \pgfscope
19062 \pgfslopedattimetrue
19063 \pgfallowupsidedownattimetrue
19064 \pgftransformlineattime{.5}{%
19065 \pgfpoint%
19066 {\stretto\pgf@circ@res@left}%
19067 {\pgf@circ@res@up}%
19068 }{%
19069 \pgfpoint
19070 {\stretto\pgf@circ@res@left}%
19071 {\pgf@circ@res@down}%
19072 }
19073
19074 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
19075 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
19076 \def\pgf@temp{european}%
19077 \ifx\pgf@temp\pgf@circ@temp%
19078 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
19079 \else%
19080 \def\pgf@temp{cute}
19081 \ifx\pgf@temp\pgf@circ@temp%
19082 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
19083 \else%
19084 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
19085 \fi%
19086 \fi%
19087
19088
19089 \endpgfscope
19090 \pgfscope
19091 \pgfslopedattimetrue
19092 \pgfallowupsidedownattimetrue
19093 \pgftransformlineattime{.5}{%
19094 \pgfpoint%
19095 {\stretto\pgf@circ@res@right}%
19096 {\pgf@circ@res@down}%
19097 }{%
19098 \pgfpoint
19099 {\stretto\pgf@circ@res@right}%
19100 {\pgf@circ@res@up}%
19101 }
19102
19103 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
19104 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
19105 \def\pgf@temp{european}%
19106 \ifx\pgf@temp\pgf@circ@temp%
19107 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
19108 \else%
19109 \def\pgf@temp{cute}
19110 \ifx\pgf@temp\pgf@circ@temp%
19111 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
19112 \else%
19113 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
19114 \fi%
19115 \fi%
19116
19117 \endpgfscope
19118
19119 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
19120 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
19121 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
19122
19123 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
19124 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
19125 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19126
19127 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
19128 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
19129 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
19130
19131 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
19132 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
19133 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
19134
19135 \pgfusepath{draw}
19136
19137 }
19138
19139
19140 \pgfcircdeclarequadpole{transformer}{
19141 \pgf@circ@drawtransformerbasicbody
19142 }{\pgf@circ@drawtransformerbasicanchor}
19143
19144 \pgfcircdeclarequadpole{transformer core}{
19145
19146 \pgf@circ@drawtransformerbasicbody
19147
19148 % use the chocke line thickness
19149 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
19150
19151 % Find the distance from center for the lines representing the core
19152 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
19153 % of the whole component, now as a fraction of the distance between coils, to be
19154 % compatible with the quadpoles "inner" style.
19155 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
19156
19157 \pgfmoveto{\pgfpoint%
19158 {\pgf@circ@res@other}%
19159 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
19160 }
19161 \pgflineto{
19162 \pgfpoint%
19163 {\pgf@circ@res@other}%
19164 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
19165 }
19166
19167 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
19168 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
19169 \pgfmoveto{\pgfpoint%
19170 {\pgf@circ@res@other}%
19171 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
19172 }
19173 \pgflineto{
19174 \pgfpoint%
19175 {\pgf@circ@res@other}%
19176 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
19177 }
19178
19179 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
19180 \pgfusepath{draw}
19181 }{\pgf@circ@drawtransformerbasicanchor}
19182
19183
19184 \pgfcircdeclarequadpole{gyrator}{
19185
19186 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
19187 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
19188 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
19189 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19190
19191 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
19192 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
19193 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
19194 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
19195
19196 \pgfusepath{draw}
19197
19198 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
19199 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
19200 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
19201 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
19202 \pgfpathclose
19203 \pgf@circ@draworfill
19204
19205 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
19206 \pgfpatharc{90}{270}{\pgf@circ@res@other}
19207 \pgfpathclose
19208 \pgf@circ@draworfill
19209 }{}
19210 % %>>>
19211
19212 %%%%%%%%%%%%%%%%%%%
19213 %% Block diagrams
19214 %%%%%%%%%%%%%%%%%%%
19215
19216 % Definitions and options for blocks (twoports and so)%<<<1
19217
19218 \ctikzset{bipoles/twoport/width/.initial=.7}
19219 \ctikzset{bipoles/twoport/height/.initial=.7}
19220 \ctikzset{bipoles/twoport/text/.initial=}
19221 \ctikzset{bipoles/twoportsplit/width/.initial=.7}
19222 \ctikzset{bipoles/twoport/text in/.initial=}
19223 \ctikzset{bipoles/twoport/text out/.initial=}
19224 \ctikzset{text/.style={t=#1}}
19225 \ctikzset{t/.code={%
19226 \ctikzsetvalof{bipoles/twoport/text}{#1}%
19227 }}
19228 \ctikzset{text in/.style={t1=#1}}
19229 \ctikzset{t1/.code={%
19230 \ctikzsetvalof{bipoles/twoport/text in}{#1}%
19231 }}
19232 \ctikzset{text out/.style={t2=#1}}
19233 \ctikzset{t2/.code={%
19234 \ctikzsetvalof{bipoles/twoport/text out}{#1}%
19235 }}
19236 \ctikzset{bipoles/vco/width/.initial=.7}
19237 \ctikzset{bipoles/bandpass/width/.initial=.7}
19238 \ctikzset{bipoles/bandstop/width/.initial=.7}
19239 \ctikzset{bipoles/highpass/width/.initial=.7}
19240 \ctikzset{bipoles/highpass2/width/.initial=.7}
19241 \ctikzset{bipoles/lowpass/width/.initial=.7}
19242 \ctikzset{bipoles/lowpass2/width/.initial=.7}
19243 \ctikzset{bipoles/allpass/width/.initial=.7}
19244 \ctikzset{bipoles/adc/width/.initial=.7}
19245 \ctikzset{bipoles/dac/width/.initial=.7}
19246 \ctikzset{bipoles/dsp/width/.initial=.7}
19247 \ctikzset{bipoles/fft/width/.initial=.7}
19248 \ctikzset{bipoles/amp/width/.initial=.7}
19249 \ctikzset{bipoles/vamp/width/.initial=.7}
19250 \ctikzset{bipoles/piattenuator/width/.initial=.7}
19251 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
19252 \ctikzset{bipoles/tattenuator/width/.initial=.7}
19253 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
19254 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
19255 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
19256 \ctikzset{bipoles/detector/width/.initial=.7}
19257 \ctikzset{tripoles/mixer/width/.initial=0.7}
19258 \ctikzset{tripoles/adder/width/.initial=0.7}
19259 \ctikzset{tripoles/circulator/width/.initial=.7}
19260 \ctikzset{tripoles/oscillator/width/.initial=.7}
19261
19262 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
19263 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
19264
19265 \ctikzset{tripoles/splitter/height/.initial=1.3}
19266 \ctikzset{tripoles/splitter/width/.initial=1.3}
19267
19268 \ctikzset{tripoles/mzm/height/.initial=1.3}
19269 \ctikzset{tripoles/mzm/width/.initial=1.3}
19270
19271 % Option ">" for twoports
19272 \newif\ifpgf@circuit@inputarrow
19273 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
19274 \ctikzset{inputarrow/.is choice}
19275 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
19276 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
19277
19278 % Option "boxed" for nodes and twoports
19279 \newif\ifpgf@circuit@boxed
19280 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}}
19281 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}}
19282 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}}
19283 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}}
19284
19285 % Option "dashed" for nodes and twoports
19286 \newif\ifpgf@circuit@dashed
19287 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
19288 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}%
19289
19290 % powerelectronic blocks
19291 \ctikzset{bipoles/sacdc/width/.initial=.7}
19292 \ctikzset{bipoles/sdcac/width/.initial=.7}
19293 \ctikzset{bipoles/sdcdc/width/.initial=.7}
19294 \ctikzset{bipoles/tacdc/width/.initial=.7}
19295 \ctikzset{bipoles/tdcac/width/.initial=.7}
19296 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
19297
19298 %>>>
19299
19300 %% Node shapes definition for path-style block diagrams%<<<
19301
19302 %% Draw the two-port fillable box
19303 \def\pgf@circ@twoportbox{
19304 \pgfscope
19305 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
19306 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
19307 \pgf@circ@draworfill
19308 \endpgfscope
19309 }
19310
19311 %% Generic two port box
19312 \pgfcircdeclarebipolescaled{blocks}
19313 {}
19314 {\ctikzvalof{bipoles/twoport/height}}
19315 {twoport}
19316 {\ctikzvalof{bipoles/twoport/height}}
19317 {\ctikzvalof{bipoles/twoport/width}}
19318 {
19319 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
19320 \divide \pgf@circ@res@step by 2
19321
19322 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19323 \pgf@circ@res@other = \pgf@circ@res@left
19324 \advance\pgf@circ@res@other by \pgf@circ@res@step
19325 \ifpgf@circuit@dashed
19326 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19327 \fi
19328 % draw outer box
19329 \pgf@circ@twoportbox
19330 \ifpgf@circuit@inputarrow
19331 {
19332 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19333 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19334 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19335 }
19336 \fi
19337
19338 % rotate inner symbol
19339 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19340 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19341 \pgftransformrotate{270}
19342 \fi\fi
19343 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
19344 \pgftransformrotate{180}
19345 \fi\fi
19346 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
19347 \pgftransformrotate{90}
19348 \fi\fi
19349
19350 % draw inner symbol
19351 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
19352
19353 }
19354
19355 %% twoport split
19356 \pgfcircdeclarebipolescaled{blocks}
19357 {}
19358 {\ctikzvalof{bipoles/twoportsplit/width}}
19359 {twoportsplit}
19360 {\ctikzvalof{bipoles/twoportsplit/width}}
19361 {\ctikzvalof{bipoles/twoportsplit/width}}
19362 {
19363 \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen
19364 \divide \pgf@circ@res@step by 2
19365
19366 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19367 \pgf@circ@res@other = \pgf@circ@res@left
19368 \advance\pgf@circ@res@other by \pgf@circ@res@step
19369
19370 \ifpgf@circuit@dashed
19371 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19372 \fi
19373
19374 % draw outer box
19375 \pgf@circ@twoportbox
19376
19377 \ifpgf@circuit@inputarrow
19378 {
19379 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19380 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19381 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19382 }
19383 \fi
19384
19385 %get texts
19386 \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}}
19387 \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}}
19388
19389 % rotate inner symbol
19390 \def\texti{\pgfcirc@tin}
19391 \def\textii{\pgfcirc@tout}
19392 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19393 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19394 \def\texti{\pgfcirc@tout}
19395 \def\textii{\pgfcirc@tin}
19396 \pgftransformrotate{270}
19397 \fi\fi
19398 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19399 \def\texti{\pgfcirc@tout}
19400 \def\textii{\pgfcirc@tin}
19401 \pgftransformrotate{180}
19402 \fi\fi
19403 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
19404 \pgftransformrotate{90}
19405 \def\texti{\pgfcirc@tin}
19406 \def\textii{\pgfcirc@tout}
19407 \fi\fi
19408
19409 % draw inner symbol
19410 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19411 \pgfsetarrows{-} %never draw arrows
19412 \pgfsetlinewidth{\pgfstartlinewidth}
19413 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19414 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
19415 \pgfusepath{draw}
19416
19417 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti}
19418 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii}
19419 }
19420
19421 %% voltage controled oscillator
19422 \pgfcircdeclarebipolescaled{blocks}
19423 {}
19424 {\ctikzvalof{bipoles/vco/width}}
19425 {vco}
19426 {\ctikzvalof{bipoles/twoport/width}}
19427 {\ctikzvalof{bipoles/vco/width}}
19428 {
19429 \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen
19430 \divide \pgf@circ@res@step by 2
19431
19432 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19433 \pgf@circ@res@other = \pgf@circ@res@left
19434 \advance\pgf@circ@res@other by \pgf@circ@res@step
19435
19436 \ifpgf@circuit@dashed
19437 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19438 \fi
19439 % draw circle
19440 \pgfscope
19441 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
19442 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
19443 \pgf@circ@draworfill
19444 \endpgfscope
19445 \ifpgf@circuit@inputarrow
19446 {
19447 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19448 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19449 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19450 }
19451 \fi
19452
19453 % rotate inner symbol
19454 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19455 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19456 \pgftransformrotate{270}
19457 \fi\fi
19458 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19459 \pgftransformrotate{180}
19460 \fi\fi
19461 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19462 \pgftransformrotate{90}
19463 \fi\fi
19464
19465 % draw inner sine waves
19466 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19467 \pgfsetlinewidth{\pgfstartlinewidth}
19468 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
19469 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19470 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19471 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19472 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19473 \pgfusepath{draw}
19474 }
19475
19476 %% bandpass filter
19477 \pgfcircdeclarebipolescaled{blocks}
19478 {}
19479 {\ctikzvalof{bipoles/bandpass/width}}
19480 {bandpass}
19481 {\ctikzvalof{bipoles/bandpass/width}}
19482 {\ctikzvalof{bipoles/bandpass/width}}
19483 {
19484
19485 \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen
19486 \divide \pgf@circ@res@step by 2
19487
19488 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19489 \pgf@circ@res@other = \pgf@circ@res@left
19490 \advance\pgf@circ@res@other by \pgf@circ@res@step
19491
19492 \ifpgf@circuit@dashed
19493 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19494 \fi
19495
19496 % draw outer box
19497 \pgf@circ@twoportbox
19498
19499 \ifpgf@circuit@inputarrow
19500 {
19501 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19502 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19503 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19504 }
19505 \fi
19506
19507 % rotate inner symbol
19508 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19509 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19510 \pgftransformrotate{270}
19511 \fi\fi
19512 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19513 \pgftransformrotate{180}
19514 \fi\fi
19515 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19516 \pgftransformrotate{90}
19517 \fi\fi
19518
19519 % draw inner symbol
19520 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19521 \pgfsetarrows{-} %never draw arrows
19522 \pgfsetlinewidth{\pgfstartlinewidth}
19523 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19524 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19525 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19526 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19527 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19528 \pgfusepath{draw}
19529 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
19530 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
19531 \pgfusepath{draw}
19532
19533 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19534 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19535 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19536 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19537 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19538 \pgfusepath{draw}
19539
19540 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19541 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19542 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19543 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19544 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19545 \pgfusepath{draw}
19546 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
19547 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
19548 \pgfusepath{draw}
19549 }
19550
19551 %% bandstop filter
19552 \pgfcircdeclarebipolescaled{blocks}
19553 {}
19554 {\ctikzvalof{bipoles/bandstop/width}}
19555 {bandstop}
19556 {\ctikzvalof{bipoles/bandstop/width}}
19557 {\ctikzvalof{bipoles/bandstop/width}}
19558 {
19559 \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen
19560 \divide \pgf@circ@res@step by 2
19561
19562 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19563 \pgf@circ@res@other = \pgf@circ@res@left
19564 \advance\pgf@circ@res@other by \pgf@circ@res@step
19565
19566 \ifpgf@circuit@dashed
19567 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19568 \fi
19569
19570 % draw outer box
19571 \pgf@circ@twoportbox
19572
19573 \ifpgf@circuit@inputarrow
19574 {
19575 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19576 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19577 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19578 }
19579 \fi
19580
19581 % rotate inner symbol
19582 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19583 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19584 \pgftransformrotate{270}
19585 \fi\fi
19586 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
19587 \pgftransformrotate{180}
19588 \fi\fi
19589 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19590 \pgftransformrotate{90}
19591 \fi\fi
19592
19593 % draw inner symbol
19594 \pgfsetdash{}{0pt}% always draw solid line for inner symbol
19595 \pgfsetarrows{-}%never draw arrows
19596 \pgfsetlinewidth{\pgfstartlinewidth}
19597 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19598 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19599 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19600 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19601 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19602 \pgfusepath{draw}
19603
19604 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19605 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19606 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19607 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19608 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19609 \pgfusepath{draw}
19610 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
19611 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
19612 \pgfusepath{draw}
19613
19614 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19615 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19616 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19617 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19618 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19619 \pgfusepath{draw}
19620 }
19621
19622 %% highpass filter
19623 \pgfcircdeclarebipolescaled{blocks}
19624 {}
19625 {\ctikzvalof{bipoles/highpass/width}}
19626 {highpass}
19627 {\ctikzvalof{bipoles/highpass/width}}
19628 {\ctikzvalof{bipoles/highpass/width}}
19629 {
19630 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen
19631 \divide \pgf@circ@res@step by 2
19632
19633 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19634 \pgf@circ@res@other = \pgf@circ@res@left
19635 \advance\pgf@circ@res@other by \pgf@circ@res@step
19636
19637 \ifpgf@circuit@dashed
19638 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19639 \fi
19640
19641 % draw outer box
19642 \pgf@circ@twoportbox
19643
19644 \ifpgf@circuit@inputarrow
19645 {
19646 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19647 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19648 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19649 }
19650 \fi
19651
19652 % rotate inner symbol
19653 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19654 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19655 \pgftransformrotate{270}
19656 \fi\fi
19657 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19658 \pgftransformrotate{180}
19659 \fi\fi
19660 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19661 \pgftransformrotate{90}
19662 \fi\fi
19663
19664 % draw inner symbol
19665 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19666 \pgfsetarrows{-} %never draw arrows
19667 \pgfsetlinewidth{\pgfstartlinewidth}
19668 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19669 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19670 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19671 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19672 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19673 \pgfusepath{draw}
19674
19675 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19676 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19677 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19678 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19679 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19680 \pgfusepath{draw}
19681 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
19682 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
19683 \pgfusepath{draw}
19684
19685 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19686 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19687 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19688 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19689 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19690 \pgfusepath{draw}
19691 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
19692 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
19693 \pgfusepath{draw}
19694 }
19695
19696 %% highpass2 filter ---simplyfied with just two waves
19697 \pgfcircdeclarebipolescaled{blocks}
19698 {}
19699 {\ctikzvalof{bipoles/highpass2/width}}
19700 {highpass2}
19701 {\ctikzvalof{bipoles/highpass2/width}}
19702 {\ctikzvalof{bipoles/highpass2/width}}
19703 {
19704 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass2/width}\pgf@circ@scaled@Rlen
19705 \divide \pgf@circ@res@step by 2
19706
19707 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19708 \pgf@circ@res@other = \pgf@circ@res@left
19709 \advance\pgf@circ@res@other by \pgf@circ@res@step
19710
19711 \ifpgf@circuit@dashed
19712 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19713 \fi
19714
19715 % draw outer box
19716 \pgf@circ@twoportbox
19717
19718 \ifpgf@circuit@inputarrow
19719 {
19720 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19721 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19722 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19723 }
19724 \fi
19725
19726 % rotate inner symbol
19727 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19728 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19729 \pgftransformrotate{270}
19730 \fi\fi
19731 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19732 \pgftransformrotate{180}
19733 \fi\fi
19734 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19735 \pgftransformrotate{90}
19736 \fi\fi
19737
19738 % draw inner symbol
19739 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19740 \pgfsetarrows{-} %never draw arrows
19741 \pgfsetlinewidth{\pgfstartlinewidth}
19742 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
19743 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19744 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19745 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19746 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19747 \pgfusepath{draw}
19748
19749 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
19750 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19751 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19752 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19753 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19754 \pgfusepath{draw}
19755 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19756 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@step}{-0.1\pgf@circ@res@step}}
19757 \pgfusepath{draw}
19758 }
19759
19760 %% lowpass filter
19761 \pgfcircdeclarebipolescaled{blocks}
19762 {}
19763 {\ctikzvalof{bipoles/lowpass/width}}
19764 {lowpass}
19765 {\ctikzvalof{bipoles/lowpass/width}}
19766 {\ctikzvalof{bipoles/lowpass/width}}
19767 {
19768 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen
19769 \divide \pgf@circ@res@step by 2
19770
19771 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19772 \pgf@circ@res@other = \pgf@circ@res@left
19773 \advance\pgf@circ@res@other by \pgf@circ@res@step
19774
19775 \ifpgf@circuit@dashed
19776 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19777 \fi
19778
19779 % draw outer box
19780 \pgf@circ@twoportbox
19781
19782 \ifpgf@circuit@inputarrow
19783 {
19784 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19785 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19786 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19787 }
19788 \fi
19789
19790 % rotate inner symbol
19791 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19792 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19793 \pgftransformrotate{270}
19794 \fi\fi
19795 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19796 \pgftransformrotate{180}
19797 \fi\fi
19798 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19799 \pgftransformrotate{90}
19800 \fi\fi
19801
19802 % draw inner symbol
19803 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19804 \pgfsetarrows{-} %never draw arrows
19805 \pgfsetlinewidth{\pgfstartlinewidth}
19806 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19807 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19808 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19809 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19810 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19811 \pgfusepath{draw}
19812 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
19813 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
19814 \pgfusepath{draw}
19815
19816 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19817 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19818 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19819 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19820 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19821 \pgfusepath{draw}
19822 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
19823 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
19824 \pgfusepath{draw}
19825
19826 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19827 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19828 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19829 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19830 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19831 \pgfusepath{draw}
19832 }
19833
19834 %% lowpass2 filter: simplyfied with just two waves
19835 \pgfcircdeclarebipolescaled{blocks}
19836 {}
19837 {\ctikzvalof{bipoles/lowpass2/width}}
19838 {lowpass2}
19839 {\ctikzvalof{bipoles/lowpass2/width}}
19840 {\ctikzvalof{bipoles/lowpass2/width}}
19841 {
19842 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass2/width}\pgf@circ@scaled@Rlen
19843 \divide \pgf@circ@res@step by 2
19844
19845 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19846 \pgf@circ@res@other = \pgf@circ@res@left
19847 \advance\pgf@circ@res@other by \pgf@circ@res@step
19848
19849 \ifpgf@circuit@dashed
19850 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19851 \fi
19852
19853 % draw outer box
19854 \pgf@circ@twoportbox
19855
19856 \ifpgf@circuit@inputarrow
19857 {
19858 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19859 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19860 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19861 }
19862 \fi
19863
19864 % rotate inner symbol
19865 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19866 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19867 \pgftransformrotate{270}
19868 \fi\fi
19869 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19870 \pgftransformrotate{180}
19871 \fi\fi
19872 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19873 \pgftransformrotate{90}
19874 \fi\fi
19875
19876 % draw inner symbol
19877 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19878 \pgfsetarrows{-} %never draw arrows
19879 \pgfsetlinewidth{\pgfstartlinewidth}
19880 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
19881 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19882 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19883 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19884 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19885 \pgfusepath{draw}
19886 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0.1\pgf@circ@res@step}}
19887 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19888 \pgfusepath{draw}
19889
19890 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
19891 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19892 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19893 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19894 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19895 \pgfusepath{draw}
19896 }
19897
19898 %% allpass filter
19899 \pgfcircdeclarebipolescaled{blocks}
19900 {}
19901 {\ctikzvalof{bipoles/allpass/width}}
19902 {allpass}
19903 {\ctikzvalof{bipoles/allpass/width}}
19904 {\ctikzvalof{bipoles/allpass/width}}
19905 {
19906 \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen
19907 \divide \pgf@circ@res@step by 2
19908
19909 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19910 \pgf@circ@res@other = \pgf@circ@res@left
19911 \advance\pgf@circ@res@other by \pgf@circ@res@step
19912
19913 \ifpgf@circuit@dashed
19914 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19915 \fi
19916
19917 % draw outer box
19918 \pgf@circ@twoportbox
19919
19920 \ifpgf@circuit@inputarrow
19921 {
19922 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19923 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19924 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19925 }
19926 \fi
19927
19928 % rotate inner symbol
19929 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19930 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19931 \pgftransformrotate{270}
19932 \fi\fi
19933 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19934 \pgftransformrotate{180}
19935 \fi\fi
19936 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19937 \pgftransformrotate{90}
19938 \fi\fi
19939
19940 % draw inner symbol
19941 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19942 \pgfsetarrows{-} %never draw arrows
19943 \pgfsetlinewidth{\pgfstartlinewidth}
19944 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19945 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19946 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19947 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19948 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19949 \pgfusepath{draw}
19950
19951 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19952 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19953 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19954 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19955 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19956 \pgfusepath{draw}
19957
19958 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19959 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19960 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19961 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19962 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19963 \pgfusepath{draw}
19964 }
19965
19966 %% ADC
19967 \pgfcircdeclarebipolescaled{blocks}
19968 {}
19969 {\ctikzvalof{bipoles/adc/width}}
19970 {adc}
19971 {\ctikzvalof{bipoles/adc/width}}
19972 {\ctikzvalof{bipoles/adc/width}}
19973 {
19974 \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen
19975 \divide \pgf@circ@res@step by 2
19976
19977 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19978 \pgf@circ@res@other = \pgf@circ@res@left
19979 \advance\pgf@circ@res@other by \pgf@circ@res@step
19980
19981 \ifpgf@circuit@dashed
19982 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19983 \fi
19984
19985 % draw outer box
19986 \pgf@circ@twoportbox
19987
19988 \ifpgf@circuit@inputarrow
19989 {
19990 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19991 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19992 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19993 }
19994 \fi
19995
19996 % rotate inner symbol
19997 \def\texti{A}
19998 \def\textii{D}
19999 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20000 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20001 \def\texti{D}
20002 \def\textii{A}
20003 \pgftransformrotate{270}
20004 \fi\fi
20005 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20006 \def\texti{D}
20007 \def\textii{A}
20008 \pgftransformrotate{180}
20009 \fi\fi
20010 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20011 \pgftransformrotate{90}
20012 \def\texti{A}
20013 \def\textii{D}
20014 \fi\fi
20015
20016 % draw inner symbol
20017 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20018 \pgfsetarrows{-} %never draw arrows
20019 \pgfsetlinewidth{\pgfstartlinewidth}
20020 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20021 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20022 \pgfusepath{draw}
20023
20024 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
20025 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
20026 }
20027
20028 %% DAC
20029 \pgfcircdeclarebipolescaled{blocks}
20030 {}
20031 {\ctikzvalof{bipoles/dac/width}}
20032 {dac}
20033 {\ctikzvalof{bipoles/dac/width}}
20034 {\ctikzvalof{bipoles/dac/width}}
20035 {
20036 \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen
20037 \divide \pgf@circ@res@step by 2
20038
20039 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20040 \pgf@circ@res@other = \pgf@circ@res@left
20041 \advance\pgf@circ@res@other by \pgf@circ@res@step
20042
20043 \ifpgf@circuit@dashed
20044 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20045 \fi
20046
20047 % draw outer box
20048 \pgf@circ@twoportbox
20049
20050 \ifpgf@circuit@inputarrow
20051 {
20052 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20053 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20054 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20055 }
20056 \fi
20057
20058 % rotate inner symbol
20059 \def\texti{D}
20060 \def\textii{A}
20061 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20062 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20063 \def\texti{A}
20064 \def\textii{D}
20065 \pgftransformrotate{270}
20066 \fi\fi
20067 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20068 \def\texti{A}
20069 \def\textii{D}
20070 \pgftransformrotate{180}
20071 \fi\fi
20072 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20073 \pgftransformrotate{90}
20074 \def\texti{D}
20075 \def\textii{A}
20076 \fi\fi
20077
20078 % draw inner symbol
20079 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20080 \pgfsetarrows{-} %never draw arrows
20081 \pgfsetlinewidth{\pgfstartlinewidth}
20082 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20083 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20084 \pgfusepath{draw}
20085
20086 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
20087 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
20088 }
20089
20090 %% DSP
20091 \pgfcircdeclarebipolescaled{blocks}
20092 {}
20093 {\ctikzvalof{bipoles/dsp/width}}
20094 {dsp}
20095 {\ctikzvalof{bipoles/dsp/width}}
20096 {\ctikzvalof{bipoles/dsp/width}}
20097 {
20098 \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen
20099 \divide \pgf@circ@res@step by 2
20100
20101 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20102 \pgf@circ@res@other = \pgf@circ@res@left
20103 \advance\pgf@circ@res@other by \pgf@circ@res@step
20104
20105 \ifpgf@circuit@dashed
20106 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20107 \fi
20108
20109 % draw outer box
20110 \pgf@circ@twoportbox
20111
20112 \ifpgf@circuit@inputarrow
20113 {
20114 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20115 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20116 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20117 }
20118 \fi
20119
20120 % rotate inner symbol
20121 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20122 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20123 \pgftransformrotate{270}
20124 \fi\fi
20125 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
20126 \pgftransformrotate{180}
20127 \fi\fi
20128 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20129 \pgftransformrotate{90}
20130 \fi\fi
20131
20132 % draw inner symbol
20133 \pgftext[center,x=0,y=0]{\textsf{DSP}}
20134 }
20135
20136 %% FFT
20137 \pgfcircdeclarebipolescaled{blocks}
20138 {}
20139 {\ctikzvalof{bipoles/fft/width}}
20140 {fft}
20141 {\ctikzvalof{bipoles/fft/width}}
20142 {\ctikzvalof{bipoles/fft/width}}
20143 {
20144 \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen
20145 \divide \pgf@circ@res@step by 2
20146
20147 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20148 \pgf@circ@res@other = \pgf@circ@res@left
20149 \advance\pgf@circ@res@other by \pgf@circ@res@step
20150
20151 \ifpgf@circuit@dashed
20152 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20153 \fi
20154
20155 % draw outer box
20156 \pgf@circ@twoportbox
20157
20158 \ifpgf@circuit@inputarrow
20159 {
20160 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20161 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20162 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20163 }
20164 \fi
20165
20166 % rotate inner symbol
20167 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20168 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20169 \pgftransformrotate{270}
20170 \fi\fi
20171 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
20172 \pgftransformrotate{180}
20173 \fi\fi
20174 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20175 \pgftransformrotate{90}
20176 \fi\fi
20177
20178 % draw inner symbol
20179 \pgftext[center,x=0,y=0]{\textsf{FFT}}
20180 }
20181
20182 %% Amplifier
20183 \pgfcircdeclarebipolescaled{blocks}
20184 {}
20185 {
20186 \ifpgf@circuit@boxed
20187 \ctikzvalof{bipoles/twoport/width}
20188 \else
20189 \ctikzvalof{bipoles/amp/width}
20190 \fi
20191 }
20192 {amp}
20193 {
20194 \ifpgf@circuit@boxed
20195 \ctikzvalof{bipoles/twoport/width}
20196 \else
20197 \ctikzvalof{bipoles/amp/width}
20198 \fi
20199 }
20200 {
20201 \ifpgf@circuit@boxed
20202 \ctikzvalof{bipoles/twoport/width}
20203 \else
20204 \ctikzvalof{bipoles/amp/width}
20205 \fi
20206 }
20207 {
20208 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
20209
20210 \ifpgf@circuit@dashed
20211 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20212 \fi
20213
20214 % draw outer box
20215 \ifpgf@circuit@boxed
20216 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
20217 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
20218 \pgf@circ@draworfill
20219 \fi
20220
20221 % draw input arrow
20222 \ifpgf@circuit@inputarrow
20223 {
20224 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20225 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20226 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20227 }
20228 \fi
20229
20230 \ifpgf@circuit@boxed
20231 \pgfsetlinewidth{\pgfstartlinewidth}
20232 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
20233 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
20234 \else
20235 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
20236 \fi
20237
20238 \pgfsetarrows{-} %never draw arrows
20239
20240 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
20241 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
20242 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
20243
20244 \pgfpathclose
20245 \pgf@circ@draworfill
20246
20247 % draw inner text
20248 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
20249 }
20250
20251
20252 %% variable amplifier
20253 \pgfcircdeclarebipolescaled{blocks}
20254 {}
20255 {
20256 \ifpgf@circuit@boxed
20257 \ctikzvalof{bipoles/twoport/width}
20258 \else
20259 \ctikzvalof{bipoles/amp/width}
20260 \fi
20261 }
20262 {vamp}
20263 {
20264 \ifpgf@circuit@boxed
20265 \ctikzvalof{bipoles/twoport/width}
20266 \else
20267 \ctikzvalof{bipoles/amp/width}
20268 \fi
20269 }
20270 {
20271 \ifpgf@circuit@boxed
20272 \ctikzvalof{bipoles/twoport/width}
20273 \else
20274 \ctikzvalof{bipoles/amp/width}
20275 \fi
20276 }
20277 {
20278 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
20279
20280 \ifpgf@circuit@dashed
20281 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20282 \fi
20283
20284 % draw outer box
20285 \ifpgf@circuit@boxed
20286 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
20287 \fi
20288
20289 % draw input arrow
20290 \ifpgf@circuit@inputarrow
20291 {
20292 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20293 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20294 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20295 }
20296 \fi
20297
20298 \ifpgf@circuit@boxed
20299 \pgfsetlinewidth{\pgfstartlinewidth}
20300 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
20301 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
20302 \else
20303 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
20304 \fi
20305
20306
20307 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20308 \pgfsetarrows{-} %never draw arrows
20309
20310 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
20311 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
20312 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
20313
20314 \pgfpathclose
20315 \pgf@circ@draworfill
20316
20317 % draw inner text
20318 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
20319
20320 % draw arrow
20321 \pgfsetlinewidth{\pgfstartlinewidth}
20322 \pgfsetarrowsend{latex}
20323 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
20324 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
20325 \pgfusepath{draw}
20326 }
20327
20328 %% pi attenuator
20329 \pgfcircdeclarebipolescaled{blocks}
20330 {}
20331 {\ctikzvalof{bipoles/piattenuator/width}}
20332 {piattenuator}
20333 {\ctikzvalof{bipoles/piattenuator/width}}
20334 {\ctikzvalof{bipoles/piattenuator/width}}
20335 {
20336 \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen
20337 \divide \pgf@circ@res@step by 2
20338
20339 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20340 \pgf@circ@res@other = \pgf@circ@res@left
20341 \advance\pgf@circ@res@other by \pgf@circ@res@step
20342
20343 \ifpgf@circuit@dashed
20344 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20345 \fi
20346
20347 % draw outer box
20348 \pgf@circ@twoportbox
20349
20350 \ifpgf@circuit@inputarrow
20351 {
20352 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20353 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20354 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20355 }
20356 \fi
20357
20358 % rotate inner symbol
20359 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20360 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20361 \pgftransformrotate{270}
20362 \fi\fi
20363 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20364 \pgftransformrotate{90}
20365 \fi\fi
20366
20367 % draw inner symbol
20368 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20369 \pgfsetarrows{-} %never draw arrows
20370 \pgfsetlinewidth{\pgfstartlinewidth}
20371 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
20372 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20373 \pgfusepath{draw}
20374 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
20375 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20376 \pgfusepath{draw}
20377 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20378 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20379 \pgfusepath{draw}
20380 }
20381
20382 %% variable pi attenuator
20383 \pgfcircdeclarebipolescaled{blocks}
20384 {}
20385 {\ctikzvalof{bipoles/vpiattenuator/width}}
20386 {vpiattenuator}
20387 {\ctikzvalof{bipoles/vpiattenuator/width}}
20388 {\ctikzvalof{bipoles/vpiattenuator/width}}
20389 {
20390 \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen
20391 \divide \pgf@circ@res@step by 2
20392
20393 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20394 \pgf@circ@res@other = \pgf@circ@res@left
20395 \advance\pgf@circ@res@other by \pgf@circ@res@step
20396
20397 \ifpgf@circuit@dashed
20398 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20399 \fi
20400
20401 % draw outer box
20402 \pgf@circ@twoportbox
20403
20404 \ifpgf@circuit@inputarrow
20405 {
20406 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20407 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20408 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20409 }
20410 \fi
20411
20412 % rotate inner symbol
20413 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20414 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20415 \pgftransformrotate{270}
20416 \fi\fi
20417 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20418 \pgftransformrotate{90}
20419 \fi\fi
20420
20421 % draw inner symbol
20422 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20423 \pgfsetarrows{-} %never draw arrows
20424 \pgfsetlinewidth{\pgfstartlinewidth}
20425 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
20426 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20427 \pgfusepath{draw}
20428 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
20429 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20430 \pgfusepath{draw}
20431 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20432 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20433 \pgfusepath{draw}
20434
20435 \pgfsetarrowsend{latex}
20436 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
20437 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
20438 \pgfusepath{draw}
20439 }
20440
20441 %% T attenuator
20442 \pgfcircdeclarebipolescaled{blocks}
20443 {}
20444 {\ctikzvalof{bipoles/tattenuator/width}}
20445 {tattenuator}
20446 {\ctikzvalof{bipoles/tattenuator/width}}
20447 {\ctikzvalof{bipoles/tattenuator/width}}
20448 {
20449 \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen
20450 \divide \pgf@circ@res@step by 2
20451
20452 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20453 \pgf@circ@res@other = \pgf@circ@res@left
20454 \advance\pgf@circ@res@other by \pgf@circ@res@step
20455
20456 \ifpgf@circuit@dashed
20457 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20458 \fi
20459
20460 % draw outer box
20461 \pgf@circ@twoportbox
20462
20463 \ifpgf@circuit@inputarrow
20464 {
20465 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20466 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20467 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20468 }
20469 \fi
20470
20471 % rotate inner symbol
20472 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20473 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20474 \pgftransformrotate{270}
20475 \fi\fi
20476 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20477 \pgftransformrotate{90}
20478 \fi\fi
20479
20480 % draw inner symbol
20481 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20482 \pgfsetarrows{-} %never draw arrows
20483 \pgfsetlinewidth{\pgfstartlinewidth}
20484 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
20485 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
20486 \pgfusepath{draw}
20487 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20488 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20489 \pgfusepath{draw}
20490 }
20491
20492 %% variable T attenuator
20493 \pgfcircdeclarebipolescaled{blocks}
20494 {}
20495 {\ctikzvalof{bipoles/vtattenuator/width}}
20496 {vtattenuator}
20497 {\ctikzvalof{bipoles/vtattenuator/width}}
20498 {\ctikzvalof{bipoles/vtattenuator/width}}
20499 {
20500 \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen
20501 \divide \pgf@circ@res@step by 2
20502
20503 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20504 \pgf@circ@res@other = \pgf@circ@res@left
20505 \advance\pgf@circ@res@other by \pgf@circ@res@step
20506
20507 \ifpgf@circuit@dashed
20508 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20509 \fi
20510
20511 % draw outer box
20512 \pgf@circ@twoportbox
20513
20514 \ifpgf@circuit@inputarrow
20515 {
20516 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20517 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20518 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20519 }
20520 \fi
20521
20522 % rotate inner symbol
20523 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20524 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20525 \pgftransformrotate{270}
20526 \fi\fi
20527 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20528 \pgftransformrotate{90}
20529 \fi\fi
20530
20531 % draw inner symbol
20532 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20533 \pgfsetarrows{-} %never draw arrows
20534 \pgfsetlinewidth{\pgfstartlinewidth}
20535 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
20536 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
20537 \pgfusepath{draw}
20538 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20539 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20540 \pgfusepath{draw}
20541
20542 \pgfsetarrowsend{latex}
20543 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
20544 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
20545 \pgfusepath{draw}
20546 }
20547
20548 %% phase shifter
20549 \pgfcircdeclarebipolescaled{blocks}
20550 {}
20551 {\ctikzvalof{bipoles/phaseshifter/width}}
20552 {phaseshifter}
20553 {\ctikzvalof{bipoles/phaseshifter/width}}
20554 {\ctikzvalof{bipoles/phaseshifter/width}}
20555 {
20556 \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen
20557 \divide \pgf@circ@res@step by 2
20558
20559 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20560 \pgf@circ@res@other = \pgf@circ@res@left
20561 \advance\pgf@circ@res@other by \pgf@circ@res@step
20562
20563 \ifpgf@circuit@dashed
20564 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20565 \fi
20566
20567 % draw outer box
20568 \pgf@circ@twoportbox
20569
20570 \ifpgf@circuit@inputarrow
20571 {
20572 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20573 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20574 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20575 }
20576 \fi
20577
20578 % rotate inner symbol
20579 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20580 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20581 \pgftransformrotate{270}
20582 \fi\fi
20583 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
20584 \pgftransformrotate{180}
20585 \fi\fi
20586 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20587 \pgftransformrotate{90}
20588 \fi\fi
20589
20590 % inner symbol
20591 \pgftext[center,x=0,y=0]{\Large$\varphi$}
20592 }
20593
20594 %% variable phase shifter
20595 \pgfcircdeclarebipolescaled{blocks}
20596 {}
20597 {\ctikzvalof{bipoles/phaseshifter/width}}
20598 {vphaseshifter}
20599 {\ctikzvalof{bipoles/vphaseshifter/width}}
20600 {\ctikzvalof{bipoles/vphaseshifter/width}}
20601 {
20602 \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen
20603 \divide \pgf@circ@res@step by 2
20604
20605 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20606 \pgf@circ@res@other = \pgf@circ@res@left
20607 \advance\pgf@circ@res@other by \pgf@circ@res@step
20608
20609 \ifpgf@circuit@dashed
20610 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20611 \fi
20612
20613 % draw outer box
20614 \pgf@circ@twoportbox
20615
20616 \ifpgf@circuit@inputarrow
20617 {
20618 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20619 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20620 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20621 }
20622 \fi
20623
20624 % rotate inner symbol
20625 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20626 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20627 \pgftransformrotate{270}
20628 \fi\fi
20629 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
20630 \pgftransformrotate{180}
20631 \fi\fi
20632 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20633 \pgftransformrotate{90}
20634 \fi\fi
20635
20636 % inner symbol
20637 \pgftext[center,x=0,y=0]{\Large$\varphi$}
20638
20639 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20640 \pgfsetlinewidth{\pgfstartlinewidth}
20641 \pgfsetarrowsend{latex}
20642 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
20643 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
20644 \pgfusepath{draw}
20645 }
20646
20647 %% detector
20648 \pgfcircdeclarebipolescaled{blocks}
20649 {}
20650 {\ctikzvalof{bipoles/detector/width}}
20651 {detector}
20652 {\ctikzvalof{bipoles/detector/width}}
20653 {\ctikzvalof{bipoles/detector/width}}
20654 {
20655 \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen
20656 \divide \pgf@circ@res@step by 2
20657
20658 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20659 \pgf@circ@res@other = \pgf@circ@res@left
20660 \advance\pgf@circ@res@other by \pgf@circ@res@step
20661
20662 \ifpgf@circuit@dashed
20663 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20664 \fi
20665
20666 % draw outer box
20667 \pgf@circ@twoportbox
20668
20669 \ifpgf@circuit@inputarrow
20670 {
20671 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20672 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20673 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20674 }
20675 \fi
20676
20677 % draw inner stuff
20678 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20679 \pgfsetarrows{-} %never draw arrows
20680 \pgfsetlinewidth{0.8\pgfstartlinewidth}
20681 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
20682 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
20683 \pgfusepath{draw}
20684
20685 \ifpgf@circuit@fulldiode
20686 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
20687 \pgftransformscale{\pgfmathresult}
20688 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
20689 \else
20690 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
20691 \pgftransformscale{\pgfmathresult}
20692 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
20693 \fi
20694
20695 }
20696
20697 %% single phase ac/dc converter
20698 \pgfcircdeclarebipolescaled{blocks}
20699 {
20700 \anchor{dc1}{
20701 \northeast
20702 \pgf@y=.4\pgf@y
20703 }
20704 \anchor{dc2}{
20705 \northeast
20706 \pgf@y=-.4\pgf@y
20707 }
20708 }
20709 {\ctikzvalof{bipoles/sacdc/width}}
20710 {sacdc}
20711 {\ctikzvalof{bipoles/sacdc/width}}
20712 {\ctikzvalof{bipoles/sacdc/width}}
20713 {
20714 \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen
20715 \divide \pgf@circ@res@step by 2
20716
20717 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20718 \pgf@circ@res@other = \pgf@circ@res@left
20719 \advance\pgf@circ@res@other by \pgf@circ@res@step
20720
20721 \ifpgf@circuit@dashed
20722 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20723 \fi
20724
20725 % draw outer box
20726 \pgf@circ@twoportbox
20727
20728 \ifpgf@circuit@inputarrow
20729 {
20730 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20731 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20732 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20733 }
20734 \fi
20735
20736 % rotate inner symbol
20737 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20738 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20739 \pgftransformrotate{270}
20740 \fi\fi
20741 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20742 \pgftransformrotate{180}
20743 \fi\fi
20744 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20745 \pgftransformrotate{90}
20746 \fi\fi
20747
20748 % draw inner symbol
20749 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20750 \pgfsetarrows{-} %never draw arrows
20751 \pgfsetlinewidth{\pgfstartlinewidth}
20752 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20753 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20754 \pgfusepath{draw}
20755
20756 % draw sin wave
20757 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
20758 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20759 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20760 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20761 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20762 \pgfusepath{draw}
20763
20764 % draw equal sign
20765 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
20766 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
20767 \pgfusepath{draw}
20768 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
20769 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
20770 \pgfusepath{draw}
20771 }
20772
20773
20774 %% dc/dc converter
20775 \pgfcircdeclarebipolescaled{blocks}
20776 {
20777 \anchor{dc1}{
20778 \northeast
20779 \pgf@y=.4\pgf@y
20780 \pgf@x=-\pgf@x
20781 }
20782 \anchor{dc2}{
20783 \northeast
20784 \pgf@y=-.4\pgf@y
20785 \pgf@x=-\pgf@x
20786 }
20787 }
20788 {\ctikzvalof{bipoles/sdcdc/width}}
20789 {sdcdc}
20790 {\ctikzvalof{bipoles/sdcdc/width}}
20791 {\ctikzvalof{bipoles/sdcdc/width}}
20792 {
20793 \pgf@circ@res@step = \ctikzvalof{bipoles/sdcdc/width}\pgf@circ@scaled@Rlen
20794 \divide \pgf@circ@res@step by 2
20795
20796 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20797 \pgf@circ@res@other = \pgf@circ@res@left
20798 \advance\pgf@circ@res@other by \pgf@circ@res@step
20799
20800 \ifpgf@circuit@dashed
20801 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20802 \fi
20803
20804 % draw outer box
20805 \pgf@circ@twoportbox
20806
20807 \ifpgf@circuit@inputarrow
20808 {
20809 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20810 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20811 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20812 }
20813 \fi
20814
20815 % rotate inner symbol
20816 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20817 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20818 \pgftransformrotate{270}
20819 \fi\fi
20820 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20821 \pgftransformrotate{180}
20822 \fi\fi
20823 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20824 \pgftransformrotate{90}
20825 \fi\fi
20826
20827 % draw inner symbol
20828 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20829 \pgfsetarrows{-} %never draw arrows
20830 \pgfsetlinewidth{\pgfstartlinewidth}
20831 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20832 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20833 \pgfusepath{draw}
20834
20835 % draw equal sign
20836 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
20837 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
20838 \pgfusepath{draw}
20839 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
20840 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
20841 \pgfusepath{draw}
20842
20843 % draw equal sign
20844 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
20845 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
20846 \pgfusepath{draw}
20847 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
20848 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
20849 \pgfusepath{draw}
20850 }
20851
20852
20853 %% single phase dc/ac converter
20854 \pgfcircdeclarebipolescaled{blocks}
20855 {
20856 \anchor{dc1}{
20857 \northeast
20858 \pgf@y=.4\pgf@y
20859 \pgf@x=-\pgf@x
20860 }
20861 \anchor{dc2}{
20862 \northeast
20863 \pgf@y=-.4\pgf@y
20864 \pgf@x=-\pgf@x
20865 }
20866 }
20867 {\ctikzvalof{bipoles/sdcac/width}}
20868 {sdcac}
20869 {\ctikzvalof{bipoles/sdcac/width}}
20870 {\ctikzvalof{bipoles/sdcac/width}}
20871 {
20872 \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen
20873 \divide \pgf@circ@res@step by 2
20874
20875 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20876 \pgf@circ@res@other = \pgf@circ@res@left
20877 \advance\pgf@circ@res@other by \pgf@circ@res@step
20878
20879 \ifpgf@circuit@dashed
20880 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20881 \fi
20882
20883 % draw outer box
20884 \pgf@circ@twoportbox
20885
20886 \ifpgf@circuit@inputarrow
20887 {
20888 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20889 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20890 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20891 }
20892 \fi
20893
20894 % rotate inner symbol
20895 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20896 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20897 \pgftransformrotate{270}
20898 \fi\fi
20899 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20900 \pgftransformrotate{180}
20901 \fi\fi
20902 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20903 \pgftransformrotate{90}
20904 \fi\fi
20905
20906 % draw inner symbol
20907 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20908 \pgfsetarrows{-} %never draw arrows
20909 \pgfsetlinewidth{\pgfstartlinewidth}
20910 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20911 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20912 \pgfusepath{draw}
20913
20914 % draw sin wave
20915 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
20916 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20917 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20918 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20919 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20920 \pgfusepath{draw}
20921
20922 % draw equal sign
20923 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
20924 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
20925 \pgfusepath{draw}
20926 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
20927 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
20928 \pgfusepath{draw}
20929 }
20930
20931
20932 %% threephase ac/dc converter
20933 \pgfcircdeclarebipolescaled{blocks}
20934 {
20935 \anchor{dc1}{
20936 \northeast
20937 \pgf@y=.4\pgf@y
20938 }
20939 \anchor{dc2}{
20940 \northeast
20941 \pgf@y=-.4\pgf@y
20942 }
20943 \anchor{ac1}{
20944 \northeast
20945 \pgf@y=.6\pgf@y
20946 \pgf@x=-\pgf@x
20947 }
20948 \anchor{ac2}{
20949 \northeast
20950 \pgf@y=0\pgf@y
20951 \pgf@x=-\pgf@x
20952 }
20953 \anchor{ac3}{
20954 \northeast
20955 \pgf@y=-.6\pgf@y
20956 \pgf@x=-\pgf@x
20957 }
20958 }
20959 {\ctikzvalof{bipoles/tacdc/width}}
20960 {tacdc}
20961 {\ctikzvalof{bipoles/tacdc/width}}
20962 {\ctikzvalof{bipoles/tacdc/width}}
20963 {
20964 \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen
20965 \divide \pgf@circ@res@step by 2
20966
20967 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20968 \pgf@circ@res@other = \pgf@circ@res@left
20969 \advance\pgf@circ@res@other by \pgf@circ@res@step
20970
20971 \ifpgf@circuit@dashed
20972 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20973 \fi
20974
20975 % draw outer box
20976 \pgf@circ@twoportbox
20977
20978 \ifpgf@circuit@inputarrow
20979 {
20980 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20981 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20982 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20983 }
20984 \fi
20985
20986 % rotate inner symbol
20987 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20988 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20989 \pgftransformrotate{270}
20990 \fi\fi
20991 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20992 \pgftransformrotate{180}
20993 \fi\fi
20994 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20995 \pgftransformrotate{90}
20996 \fi\fi
20997
20998 % draw inner symbol
20999 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21000 \pgfsetarrows{-} %never draw arrows
21001 \pgfsetlinewidth{\pgfstartlinewidth}
21002 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21003 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21004 \pgfusepath{draw}
21005
21006 % draw sin waves
21007 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}}
21008 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21009 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21010 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21011 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21012 \pgfusepath{draw}
21013 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
21014 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21015 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21016 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21017 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21018 \pgfusepath{draw}
21019 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}}
21020 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21021 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21022 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21023 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21024 \pgfusepath{draw}
21025
21026
21027
21028
21029 % draw equal sign
21030 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
21031 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
21032 \pgfusepath{draw}
21033 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
21034 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
21035 \pgfusepath{draw}
21036 }
21037
21038
21039 %% threephase dc/ac converter
21040 \pgfcircdeclarebipolescaled{blocks}
21041 {
21042 \anchor{dc1}{
21043 \northeast
21044 \pgf@y=.4\pgf@y
21045 \pgf@x=-\pgf@x
21046 }
21047 \anchor{dc2}{
21048 \northeast
21049 \pgf@y=-.4\pgf@y
21050 \pgf@x=-\pgf@x
21051 }
21052 \anchor{ac1}{
21053 \northeast
21054 \pgf@y=.6\pgf@y
21055 }
21056 \anchor{ac2}{
21057 \northeast
21058 \pgf@y=0\pgf@y
21059 }
21060 \anchor{ac3}{
21061 \northeast
21062 \pgf@y=-.6\pgf@y
21063 }
21064 }
21065 {\ctikzvalof{bipoles/tdcac/width}}
21066 {tdcac}
21067 {\ctikzvalof{bipoles/tdcac/width}}
21068 {\ctikzvalof{bipoles/tdcac/width}}
21069 {
21070 \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen
21071 \divide \pgf@circ@res@step by 2
21072
21073 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
21074 \pgf@circ@res@other = \pgf@circ@res@left
21075 \advance\pgf@circ@res@other by \pgf@circ@res@step
21076
21077 \ifpgf@circuit@dashed
21078 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
21079 \fi
21080
21081 % draw outer box
21082 \pgf@circ@twoportbox
21083
21084 \ifpgf@circuit@inputarrow
21085 {
21086 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
21087 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
21088 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
21089 }
21090 \fi
21091
21092 % rotate inner symbol
21093 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
21094 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
21095 \pgftransformrotate{270}
21096 \fi\fi
21097 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
21098 \pgftransformrotate{180}
21099 \fi\fi
21100 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
21101 \pgftransformrotate{90}
21102 \fi\fi
21103
21104 % draw inner symbol
21105 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21106 \pgfsetarrows{-} %never draw arrows
21107 \pgfsetlinewidth{\pgfstartlinewidth}
21108 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21109 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21110 \pgfusepath{draw}
21111
21112 % draw sin waves
21113 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}}
21114 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21115 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21116 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21117 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21118 \pgfusepath{draw}
21119 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
21120 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21121 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21122 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21123 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21124 \pgfusepath{draw}
21125 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}}
21126 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21127 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21128 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
21129 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
21130 \pgfusepath{draw}
21131
21132
21133
21134
21135 % draw equal sign
21136 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
21137 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
21138 \pgfusepath{draw}
21139 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
21140 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
21141 \pgfusepath{draw}
21142 }
21143 % %>>>
21144
21145 %% Path definitions for Blocks%<<<
21146
21147 \pgfcirc@activate@bipole@simple{l}{twoport}
21148 \pgfcirc@activate@bipole@simple{l}{twoportsplit}
21149 \pgfcirc@activate@bipole@simple{l}{vco}
21150 \pgfcirc@activate@bipole@simple{l}{bandpass}
21151 \pgfcirc@activate@bipole@simple{l}{bandstop}
21152 \pgfcirc@activate@bipole@simple{l}{highpass}
21153 \pgfcirc@activate@bipole@simple{l}{highpass2}
21154 \pgfcirc@activate@bipole@simple{l}{lowpass}
21155 \pgfcirc@activate@bipole@simple{l}{lowpass2}
21156 \pgfcirc@activate@bipole@simple{l}{allpass}
21157 \pgfcirc@activate@bipole@simple{l}{adc}
21158 \pgfcirc@activate@bipole@simple{l}{dac}
21159 \pgfcirc@activate@bipole@simple{l}{dsp}
21160 \pgfcirc@activate@bipole@simple{l}{fft}
21161 \pgfcirc@activate@bipole@simple{l}{amp}
21162 \pgfcirc@activate@bipole@simple{l}{vamp}
21163 \pgfcirc@activate@bipole@simple{l}{piattenuator}
21164 \pgfcirc@activate@bipole@simple{l}{vpiattenuator}
21165 \pgfcirc@activate@bipole@simple{l}{tattenuator}
21166 \pgfcirc@activate@bipole@simple{l}{vtattenuator}
21167 \pgfcirc@activate@bipole@simple{l}{phaseshifter}
21168 \pgfcirc@activate@bipole@simple{l}{vphaseshifter}
21169 \pgfcirc@activate@bipole@simple{l}{detector}
21170 \pgfcirc@activate@bipole@simple{l}{sacdc}
21171 \pgfcirc@activate@bipole@simple{l}{sdcac}
21172 \pgfcirc@activate@bipole@simple{l}{sdcdc}
21173 \pgfcirc@activate@bipole@simple{l}{tacdc}
21174 \pgfcirc@activate@bipole@simple{l}{tdcac}
21175 % %>>>
21176
21177 %% Node shapes for Block elements%<<<
21178
21179 \pgfdeclareshape{mixer}
21180 {
21181 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21182 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21183 \savedanchor\northwest{
21184 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21185 \ifpgf@circuit@boxed
21186 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21187 \pgf@y=.5\pgf@y
21188 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21189 \pgf@x=.5\pgf@x
21190 \else
21191 \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
21192 \pgf@y=.5\pgf@y
21193 \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
21194 \pgf@x=.5\pgf@x
21195 \fi
21196 }
21197 \anchor{center}{
21198 \pgfpointorigin
21199 }
21200 \anchor{left}{%
21201 \northwest
21202 \pgf@y=0pt
21203 }
21204 \anchor{right}{
21205 \northwest
21206 \pgf@y=0pt
21207 \pgf@x=-\pgf@x
21208 }
21209 \anchor{1}{
21210 \northwest
21211 \pgf@y=0pt
21212 }
21213 \anchor{2}{
21214 \northwest
21215 \pgf@y=-\pgf@y
21216 \pgf@x=0pt
21217 }
21218 \anchor{3}{
21219 \northwest
21220 \pgf@y=0pt
21221 \pgf@x=-\pgf@x
21222 }
21223 \anchor{4}{
21224 \northwest
21225 \pgf@y=\pgf@y
21226 \pgf@x=0pt
21227 }
21228 \anchor{in 1}{
21229 \northwest
21230 \pgf@y=0pt
21231 }
21232 \anchor{in1}{
21233 \northwest
21234 \pgf@y=0pt
21235 }
21236 \anchor{in}{
21237 \northwest
21238 \pgf@y=0pt
21239 }
21240 \anchor{in 2}{
21241 \northwest
21242 \pgf@y=-\pgf@y
21243 \pgf@x=0pt
21244 }
21245 \anchor{in2}{
21246 \northwest
21247 \pgf@y=-\pgf@y
21248 \pgf@x=0pt
21249 }
21250 \anchor{out}{
21251 \northwest
21252 \pgf@y=0pt
21253 \pgf@x=-\pgf@x
21254 }
21255 \anchor{center}{
21256 \pgf@y=0pt
21257 \pgf@x=0pt
21258 }
21259 \anchor{east}{
21260 \northwest
21261 \pgf@y=0pt
21262 \pgf@x=-\pgf@x
21263 }
21264 \anchor{west}{
21265 \northwest
21266 \pgf@y=0pt
21267 }
21268 \anchor{south}{
21269 \northwest
21270 \pgf@x=0pt
21271 \pgf@y=-\pgf@y
21272 }
21273 \anchor{north}{
21274 \northwest
21275 \pgf@x=0pt
21276 }
21277 \anchor{e}{
21278 \northwest
21279 \pgf@y=0pt
21280 \pgf@x=-\pgf@x
21281 }
21282 \anchor{w}{
21283 \northwest
21284 \pgf@y=0pt
21285 }
21286 \anchor{s}{
21287 \northwest
21288 \pgf@x=0pt
21289 \pgf@y=-\pgf@y
21290 }
21291 \anchor{n}{
21292 \northwest
21293 \pgf@x=0pt
21294 }
21295 \anchor{down}{
21296 \northwest
21297 \pgf@x=0pt
21298 \pgf@y=-\pgf@y
21299 }
21300 \anchor{up}{
21301 \northwest
21302 \pgf@x=0pt
21303 }
21304 \anchor{south west}{
21305 \northwest
21306 \pgf@y=-\pgf@y
21307 }
21308 \anchor{north east}{
21309 \northwest
21310 \pgf@x=-\pgf@x
21311 }
21312 \anchor{north west}{
21313 \northwest
21314 }
21315 \anchor{south east}{
21316 \northwest
21317 \pgf@x=-\pgf@x
21318 \pgf@y=-\pgf@y
21319 }
21320 \anchorborder{
21321 \pgf@circ@res@left=\pgf@x
21322 \pgf@circ@res@up=\pgf@y
21323 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
21324 }{\pgfpoint{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}}
21325 }
21326 \backgroundpath{
21327 \pgfsetcolor{\ctikzvalof{color}}
21328 \pgf@circ@scaled@Rlen=\scaledRlen
21329
21330 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
21331
21332 \pgfscope
21333 \pgfstartlinewidth=\pgflinewidth
21334
21335 % draw outer box
21336 \ifpgf@circuit@boxed
21337 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
21338 \fi
21339
21340 % draw outer circle
21341 \ifpgf@circuit@boxed
21342 \pgf@circ@res@step=.7\pgf@circ@res@step
21343 \pgfsetdash{}{0pt} % draw solid circle if boxed
21344 \else
21345 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
21346 \fi
21347 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
21348 \pgf@circ@draworfill
21349
21350 % draw inner stuff
21351 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21352 \pgfsetlinewidth{\pgfstartlinewidth}
21353 \pgfpathmoveto{\pgfpointorigin}
21354 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
21355 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
21356 \pgfpathmoveto{\pgfpointorigin}
21357 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
21358 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
21359 \pgfusepath{draw}
21360
21361 \endpgfscope
21362 }
21363 }
21364
21365 \pgfdeclareshape{adder}
21366 {
21367 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21368 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21369 \savedanchor\northwest{
21370 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21371 \ifpgf@circuit@boxed
21372 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21373 \pgf@y=.5\pgf@y
21374 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21375 \pgf@x=.5\pgf@x
21376 \else
21377 \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
21378 \pgf@y=.5\pgf@y
21379 \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
21380 \pgf@x=.5\pgf@x
21381 \fi
21382 }
21383 \anchor{center}{
21384 \pgfpointorigin
21385 }
21386 \anchor{left}{%
21387 \northwest
21388 \pgf@y=0pt
21389 }
21390 \anchor{right}{
21391 \northwest
21392 \pgf@y=0pt
21393 \pgf@x=-\pgf@x
21394 }
21395 \anchor{1}{
21396 \northwest
21397 \pgf@y=0pt
21398 }
21399 \anchor{2}{
21400 \northwest
21401 \pgf@y=-\pgf@y
21402 \pgf@x=0pt
21403 }
21404 \anchor{3}{
21405 \northwest
21406 \pgf@y=0pt
21407 \pgf@x=-\pgf@x
21408 }
21409 \anchor{4}{
21410 \northwest
21411 \pgf@y=\pgf@y
21412 \pgf@x=0pt
21413 }
21414 \anchor{in 1}{
21415 \northwest
21416 \pgf@y=0pt
21417 }
21418 \anchor{in1}{
21419 \northwest
21420 \pgf@y=0pt
21421 }
21422 \anchor{in}{
21423 \northwest
21424 \pgf@y=0pt
21425 }
21426 \anchor{in 2}{
21427 \northwest
21428 \pgf@y=-\pgf@y
21429 \pgf@x=0pt
21430 }
21431 \anchor{in2}{
21432 \northwest
21433 \pgf@y=-\pgf@y
21434 \pgf@x=0pt
21435 }
21436 \anchor{out}{
21437 \northwest
21438 \pgf@y=0pt
21439 \pgf@x=-\pgf@x
21440 }
21441 \anchor{center}{
21442 \pgf@y=0pt
21443 \pgf@x=0pt
21444 }
21445 \anchor{east}{
21446 \northwest
21447 \pgf@y=0pt
21448 \pgf@x=-\pgf@x
21449 }
21450 \anchor{west}{
21451 \northwest
21452 \pgf@y=0pt
21453 }
21454 \anchor{south}{
21455 \northwest
21456 \pgf@x=0pt
21457 \pgf@y=-\pgf@y
21458 }
21459 \anchor{north}{
21460 \northwest
21461 \pgf@x=0pt
21462 }
21463 \anchor{e}{
21464 \northwest
21465 \pgf@y=0pt
21466 \pgf@x=-\pgf@x
21467 }
21468 \anchor{w}{
21469 \northwest
21470 \pgf@y=0pt
21471 }
21472 \anchor{s}{
21473 \northwest
21474 \pgf@x=0pt
21475 \pgf@y=-\pgf@y
21476 }
21477 \anchor{n}{
21478 \northwest
21479 \pgf@x=0pt
21480 }
21481 \anchor{down}{
21482 \northwest
21483 \pgf@x=0pt
21484 \pgf@y=-\pgf@y
21485 }
21486 \anchor{up}{
21487 \northwest
21488 \pgf@x=0pt
21489 }
21490 \anchor{south west}{
21491 \northwest
21492 \pgf@y=-\pgf@y
21493 }
21494 \anchor{north east}{
21495 \northwest
21496 \pgf@x=-\pgf@x
21497 }
21498 \anchor{north west}{
21499 \northwest
21500 }
21501 \anchor{south east}{
21502 \northwest
21503 \pgf@x=-\pgf@x
21504 \pgf@y=-\pgf@y
21505 }
21506 \anchorborder{
21507 \pgf@circ@res@left=\pgf@x
21508 \pgf@circ@res@up=\pgf@y
21509 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
21510 }{\pgfpoint{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}}
21511 }
21512 \backgroundpath{
21513 \pgfsetcolor{\ctikzvalof{color}}
21514 \pgf@circ@scaled@Rlen=\scaledRlen
21515
21516 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
21517
21518 \pgfscope
21519 \pgfstartlinewidth=\pgflinewidth
21520
21521 % draw outer box
21522 \ifpgf@circuit@boxed
21523 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
21524 \fi
21525
21526 % draw outer circle
21527 \ifpgf@circuit@boxed
21528 \pgf@circ@res@step=.7\pgf@circ@res@step{}
21529 \pgfsetdash{}{0pt} % draw solid circle if boxed
21530 \else
21531 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
21532 \fi
21533 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
21534 \pgf@circ@draworfill
21535
21536 % draw inner stuff
21537 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21538 \pgfsetlinewidth{\pgfstartlinewidth}
21539
21540 \pgfpathmoveto{\pgfpointorigin}
21541 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
21542 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
21543 \pgfpathmoveto{\pgfpointorigin}
21544 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
21545 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
21546 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21547 \pgfusepath{draw}
21548
21549 \endpgfscope
21550 }
21551 }
21552
21553 \pgfdeclareshape{oscillator}
21554 {
21555 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21556 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21557 \savedanchor\northwest{
21558 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21559 \ifpgf@circuit@boxed
21560 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21561 \pgf@y=.5\pgf@y
21562 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21563 \else
21564 \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
21565 \pgf@y=.5\pgf@y
21566 \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
21567 \fi
21568 }
21569 \anchor{center}{
21570 \pgfpointorigin
21571 }
21572 \anchor{north}{
21573 \northwest
21574 \pgf@x=.5\pgf@x
21575 }
21576 \anchor{south}{
21577 \northwest
21578 \pgf@x=.5\pgf@x
21579 \pgf@y=-\pgf@y
21580 }
21581 \anchor{east}{
21582 \northwest
21583 \pgf@y=0pt
21584 \pgf@x=0pt
21585 }
21586 \anchor{west}{
21587 \northwest
21588 \pgf@y=0pt
21589 }
21590 \anchor{up}{
21591 \northwest
21592 \pgf@x=.5\pgf@x
21593 }
21594 \anchor{down}{
21595 \northwest
21596 \pgf@x=.5\pgf@x
21597 \pgf@y=-\pgf@y
21598 }
21599 \anchor{n}{
21600 \northwest
21601 \pgf@x=.5\pgf@x
21602 }
21603 \anchor{s}{
21604 \northwest
21605 \pgf@x=.5\pgf@x
21606 \pgf@y=-\pgf@y
21607 }
21608 \anchor{e}{
21609 \northwest
21610 \pgf@y=0pt
21611 \pgf@x=0pt
21612 }
21613 \anchor{w}{
21614 \northwest
21615 \pgf@y=0pt
21616 }
21617 \anchor{up}{
21618 \northwest
21619 \pgf@x=.5\pgf@x
21620 }
21621 \anchor{down}{
21622 \northwest
21623 \pgf@x=.5\pgf@x
21624 \pgf@y=-\pgf@y
21625 }
21626 \anchor{right}{
21627 \northwest
21628 \pgf@y=0pt
21629 \pgf@x=0pt
21630 }
21631 \anchor{left}{
21632 \northwest
21633 \pgf@y=0pt
21634 }
21635 \anchor{south west}{ \northwest \pgf@y=-\pgf@y}
21636 \anchor{north east}{ \northwest \pgf@x=0pt\relax}
21637 \anchor{north west}{ \northwest }
21638 \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
21639 \anchor{text}{
21640 \pgf@x=-2\pgf@x
21641 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
21642 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
21643 }
21644 \anchorborder{
21645 \pgf@circ@res@left=\pgf@x
21646 \pgf@circ@res@up=\pgf@y
21647 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
21648 }{\pgfpoint{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}}
21649 \pgfmathsetlength{\pgf@x}{\pgf@x-\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}
21650 }
21651 \backgroundpath{
21652 \pgfsetcolor{\ctikzvalof{color}}
21653 \pgf@circ@scaled@Rlen=\scaledRlen
21654
21655 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
21656
21657 \pgfscope
21658 \pgfstartlinewidth=\pgflinewidth
21659
21660 \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east"
21661
21662 % draw outer box
21663 \ifpgf@circuit@boxed{}
21664 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
21665 \fi
21666
21667 % draw outer circle
21668 \ifpgf@circuit@boxed
21669 \pgf@circ@res@step=.7\pgf@circ@res@step{}
21670 \pgfsetdash{}{0pt} % draw solid circle if boxed
21671 \else
21672 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
21673 \fi
21674 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
21675 \pgf@circ@draworfill
21676
21677 % draw inner sine waves
21678 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21679 \pgfsetlinewidth{\pgfstartlinewidth}
21680 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
21681 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
21682 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
21683 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
21684 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
21685 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
21686
21687 \pgfusepath{draw}
21688
21689 \endpgfscope
21690 }
21691 }
21692
21693 \pgfdeclareshape{circulator}
21694 {
21695 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21696 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21697 \savedanchor\northwest{
21698 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21699 \ifpgf@circuit@boxed
21700 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21701 \pgf@y=.5\pgf@y
21702 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21703 \pgf@x=.5\pgf@x
21704 \else
21705 \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
21706 \pgf@y=.5\pgf@y
21707 \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
21708 \pgf@x=.5\pgf@x
21709 \fi
21710 }
21711 \anchor{center}{
21712 \pgfpointorigin
21713 }
21714 \anchor{left}{%
21715 \northwest
21716 \pgf@y=0pt
21717 }
21718 \anchor{right}{
21719 \northwest
21720 \pgf@y=0pt
21721 \pgf@x=-\pgf@x
21722 }
21723 \anchor{1}{
21724 \northwest
21725 \pgf@y=0pt
21726 }
21727 \anchor{2}{
21728 \northwest
21729 \pgf@y=0pt
21730 \pgf@x=-\pgf@x
21731 }
21732 \anchor{3}{
21733 \northwest
21734 \pgf@y=-\pgf@y
21735 \pgf@x=0pt
21736 }
21737 \anchor{east}{
21738 \northwest
21739 \pgf@y=0pt
21740 \pgf@x=-\pgf@x
21741 }
21742 \anchor{west}{
21743 \northwest
21744 \pgf@y=0pt
21745 }
21746 \anchor{south}{
21747 \northwest
21748 \pgf@x=0pt
21749 \pgf@y=-\pgf@y
21750 }
21751 \anchor{north}{
21752 \northwest
21753 \pgf@x=0pt
21754 }
21755 \anchor{e}{
21756 \northwest
21757 \pgf@y=0pt
21758 \pgf@x=-\pgf@x
21759 }
21760 \anchor{w}{
21761 \northwest
21762 \pgf@y=0pt
21763 }
21764 \anchor{s}{
21765 \northwest
21766 \pgf@x=0pt
21767 \pgf@y=-\pgf@y
21768 }
21769 \anchor{n}{
21770 \northwest
21771 \pgf@x=0pt
21772 }
21773 \anchor{down}{
21774 \northwest
21775 \pgf@x=0pt
21776 \pgf@y=-\pgf@y
21777 }
21778 \anchor{up}{
21779 \northwest
21780 \pgf@x=0pt
21781 }
21782 \anchor{south west}{
21783 \northwest
21784 \pgf@y=-\pgf@y
21785 }
21786 \anchor{north east}{
21787 \northwest
21788 \pgf@x=-\pgf@x
21789 }
21790 \anchor{north west}{
21791 \northwest
21792 }
21793 \anchor{south east}{
21794 \northwest
21795 \pgf@x=-\pgf@x
21796 \pgf@y=-\pgf@y
21797 }
21798 \anchorborder{
21799 \pgf@circ@res@left=\pgf@x
21800 \pgf@circ@res@up=\pgf@y
21801 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
21802 }{\pgfpoint{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}}
21803 }
21804 \backgroundpath{
21805 \pgfsetcolor{\ctikzvalof{color}}
21806 \pgf@circ@scaled@Rlen=\scaledRlen
21807
21808 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
21809
21810 \pgfscope
21811 \pgfstartlinewidth=\pgflinewidth
21812
21813 % draw outer box
21814 \ifpgf@circuit@boxed
21815 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
21816 \fi
21817
21818 % draw outer circle
21819 \ifpgf@circuit@boxed{}
21820 \pgf@circ@res@step=.7\pgf@circ@res@step{}
21821 \pgfsetdash{}{0pt} % draw solid circle if boxed
21822 \else
21823 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
21824 \fi
21825 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
21826 \pgf@circ@draworfill
21827
21828 % inner arrow
21829 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21830 \pgfsetlinewidth{\pgfstartlinewidth}
21831
21832 \pgfsetarrowsend{latex}
21833 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
21834 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
21835 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
21836 \pgfusepath{draw}
21837
21838 \endpgfscope
21839 }
21840 }
21841
21842 %% gridnode
21843 \pgfdeclareshape{gridnode}
21844 {
21845 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21846 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21847 \savedanchor\northwest{
21848 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21849 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
21850 \pgf@y=.5\pgf@y
21851 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
21852 \pgf@x=.5\pgf@x
21853 }
21854 \anchor{center}{
21855 \pgfpointorigin
21856 }
21857
21858 \anchor{north}{
21859 \northwest
21860 \pgf@x=0pt
21861 }
21862 \anchor{up}{
21863 \northwest
21864 \pgf@x=0pt
21865 }
21866 \anchor{south}{
21867 \northwest
21868 \pgf@x=0pt
21869 \pgf@y=-\pgf@y
21870 }
21871 \anchor{down}{
21872 \northwest
21873 \pgf@x=0pt
21874 \pgf@y=-\pgf@y
21875 }
21876 \anchor{east}{
21877 \northwest
21878 \pgf@y=0pt
21879 \pgf@x=-\pgf@x
21880 }
21881 \anchor{right}{
21882 \northwest
21883 \pgf@y=0pt
21884 \pgf@x=-\pgf@x
21885 }
21886 \anchor{west}{
21887 \northwest
21888 \pgf@y=0pt
21889 }
21890 \anchor{left}{
21891 \northwest
21892 \pgf@y=0pt
21893 }
21894 \anchor{south west}{
21895 \northwest
21896 \pgf@y=-\pgf@y
21897 }
21898 \anchor{north east}{
21899 \northwest
21900 \pgf@x=-\pgf@x
21901 \relax
21902 }
21903 \anchor{north west}{
21904 \northwest
21905 }
21906 \anchor{south east}{
21907 \northwest
21908 \pgf@x=-\pgf@x
21909 \pgf@y=-\pgf@y
21910 }
21911 \anchor{text}{
21912 \pgf@x=-2\pgf@x
21913 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
21914 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
21915 }
21916 \backgroundpath{
21917 \pgfsetcolor{\ctikzvalof{color}}
21918 \pgf@circ@scaled@Rlen=\scaledRlen
21919
21920 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
21921
21922 \northwest
21923 \pgf@circ@res@up = \pgf@y
21924 \pgf@circ@res@down = -\pgf@y
21925 \pgf@circ@res@right = -\pgf@x
21926 \pgf@circ@res@left = \pgf@x
21927
21928 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
21929 \divide \pgf@circ@res@step by 2
21930
21931 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
21932 \pgf@circ@res@other = \pgf@circ@res@left
21933 \advance\pgf@circ@res@other by \pgf@circ@res@step
21934
21935 \ifpgf@circuit@dashed
21936 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
21937 \fi
21938
21939 % draw outer box
21940 \pgf@circ@twoportbox
21941
21942
21943 \ifpgf@circuit@inputarrow
21944 {
21945 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
21946 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
21947 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
21948 }
21949 \fi
21950
21951 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21952 \pgfsetarrows{-} %never draw arrows
21953 \pgfsetlinewidth{0.05mm}
21954
21955 % draw grid
21956 \foreach \line in {-1,-.5,...,1}
21957 {
21958 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
21959 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}}
21960
21961 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
21962 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}}
21963 }
21964
21965 %prevent from draw the inner cross twice
21966 \foreach \line in {-.5,0,...,.5}
21967 {
21968 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
21969 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}}
21970
21971 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
21972 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}}
21973 }
21974 \pgfusepath{draw}
21975 }
21976 }
21977
21978
21979 % Wilkinson divider
21980 \pgfdeclareshape{wilkinson}{
21981 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21982 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21983 \savedanchor\northwest{%
21984 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21985 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
21986 \pgf@y=.5\pgf@y
21987 \pgf@x= \pgf@circ@scaled@Rlen
21988 \pgf@x=.5\pgf@x
21989 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
21990 }
21991 \anchor{center}{
21992 \northwest
21993 \pgf@x=0pt
21994 \pgf@y=0pt
21995 }
21996 \anchor{north}{
21997 \northwest
21998 \pgf@x=0pt
21999 }
22000 \anchor{south}{
22001 \northwest
22002 \pgf@x=0pt
22003 \pgf@y=-\pgf@y
22004 }
22005 \anchor{west}{
22006 \northwest
22007 \pgf@y=0pt
22008 }
22009 \anchor{east}{
22010 \northwest
22011 \pgf@y=0pt
22012 \pgf@x=-\pgf@x
22013 }
22014 \anchor{south west}{
22015 \northwest
22016 \pgf@y=-\pgf@y
22017 }
22018 \anchor{north east}{
22019 \northwest
22020 \pgf@x=-\pgf@x
22021 }
22022 \anchor{north west}{
22023 \northwest
22024 }
22025 \anchor{south east}{
22026 \northwest
22027 \pgf@x=-\pgf@x
22028 \pgf@y=-\pgf@y
22029 }
22030 \anchor{in}{
22031 \northwest
22032 \pgf@y=0pt
22033 }
22034 \anchor{out1}{
22035 \northwest
22036 \pgf@x=-\pgf@x
22037 \pgf@y=-0.5\pgf@y
22038 }
22039 \anchor{out2}{
22040 \northwest
22041 \pgf@x=-\pgf@x
22042 \pgf@y=0.5\pgf@y
22043 }
22044 \anchor{text}{
22045 \northwest
22046 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
22047 \pgf@x=-.5\wd\pgfnodeparttextbox
22048 }
22049 \backgroundpath{
22050 \pgfsetcolor{\ctikzvalof{color}}
22051 \pgf@circ@scaled@Rlen=\scaledRlen
22052
22053 \northwest
22054 \pgf@circ@res@up = \pgf@y
22055 \pgf@circ@res@down = -\pgf@y
22056 \pgf@circ@res@right = -\pgf@x
22057 \pgf@circ@res@left = \pgf@x
22058
22059 \pgfstartlinewidth=\pgflinewidth
22060
22061 % draw outer box
22062 \pgf@circ@twoportbox
22063
22064 % draw inner stuff
22065 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
22066 \pgfsetarrows{-} %never draw arrows
22067 \pgfsetlinewidth{\pgfstartlinewidth}
22068 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
22069 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
22070 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22071 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22072 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
22073 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22074 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22075
22076 \pgfusepath{draw}
22077
22078 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
22079 % draw inner resisitor - european or american style is recognised
22080 {
22081 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
22082 \pgftransformrotate{90}
22083
22084 % calculate size of resistor
22085 \ifpgf@circuit@europeanresistor
22086 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
22087 \pgftransformscale{\pgfmathresult}
22088 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
22089 \else
22090 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
22091 \pgftransformscale{\pgfmathresult}
22092 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
22093 \fi
22094 }
22095
22096 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22097 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
22098
22099 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
22100 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22101 \pgfusepath{draw}
22102
22103 }
22104 }
22105
22106 %% resistive splitter
22107 \pgfdeclareshape{splitter}{
22108 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
22109 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22110 \savedanchor\northwest{%
22111 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22112 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
22113 \pgf@y=.5\pgf@y
22114 \pgf@x= \pgf@circ@scaled@Rlen
22115 \pgf@x=.5\pgf@x
22116 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
22117 }
22118 \anchor{center}{
22119 \northwest
22120 \pgf@x=0pt
22121 \pgf@y=0pt
22122 }
22123 \anchor{north}{
22124 \northwest
22125 \pgf@x=0pt
22126 }
22127 \anchor{south}{
22128 \northwest
22129 \pgf@x=0pt
22130 \pgf@y=-\pgf@y
22131 }
22132 \anchor{west}{
22133 \northwest
22134 \pgf@y=0pt
22135 }
22136 \anchor{east}{
22137 \northwest
22138 \pgf@y=0pt
22139 \pgf@x=-\pgf@x
22140 }
22141 \anchor{south west}{
22142 \northwest
22143 \pgf@y=-\pgf@y
22144 }
22145 \anchor{north east}{
22146 \northwest
22147 \pgf@x=-\pgf@x
22148 }
22149 \anchor{north west}{
22150 \northwest
22151 }
22152 \anchor{south east}{
22153 \northwest
22154 \pgf@x=-\pgf@x
22155 \pgf@y=-\pgf@y
22156 }
22157 \anchor{in}{
22158 \northwest
22159 \pgf@y=0pt
22160 }
22161 \anchor{out1}{
22162 \northwest
22163 \pgf@x=-\pgf@x
22164 \pgf@y=-0.5\pgf@y
22165 }
22166 \anchor{out2}{
22167 \northwest
22168 \pgf@x=-\pgf@x
22169 \pgf@y=0.5\pgf@y
22170 }
22171 \anchor{text}{
22172 \northwest
22173 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
22174 \pgf@x=-.5\wd\pgfnodeparttextbox
22175 }
22176 \backgroundpath{
22177 \pgfsetcolor{\ctikzvalof{color}}
22178 \pgf@circ@scaled@Rlen=\scaledRlen
22179
22180 \northwest
22181 \pgf@circ@res@up = \pgf@y
22182 \pgf@circ@res@down = -\pgf@y
22183 \pgf@circ@res@right = -\pgf@x
22184 \pgf@circ@res@left = \pgf@x
22185
22186 \pgfstartlinewidth=\pgflinewidth
22187
22188 % draw outer box
22189 \pgf@circ@twoportbox
22190
22191 % draw inner stuff
22192 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
22193 \pgfsetarrows{-} %never draw arrows
22194 \pgfsetlinewidth{\pgfstartlinewidth}
22195 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
22196 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
22197 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22198 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22199 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
22200 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22201 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22202
22203 \pgfusepath{draw}
22204
22205 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
22206 % draw inner resisitors - european or american style is recognised
22207 \foreach \respt/\resang/\linepta/\lineptb in %
22208 { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/%
22209 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down},%
22210 \pgfpoint{0}{0.25\pgf@circ@res@up}/25/%
22211 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
22212 \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/%
22213 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
22214 {
22215 {
22216 \pgftransformshift{\respt}
22217 \pgftransformrotate{\resang}
22218
22219 % calculate size of resistor
22220 \ifpgf@circuit@europeanresistor
22221 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
22222 \pgftransformscale{\pgfmathresult}
22223 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
22224 \else
22225 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
22226 \pgftransformscale{\pgfmathresult}
22227 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
22228 \fi
22229 }
22230
22231 \pgfpathmoveto{\linepta}
22232 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
22233
22234 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
22235 \pgfpathlineto{\lineptb}
22236 \pgfusepath{draw}
22237 }
22238 }
22239 }
22240
22241 %% couplers generics
22242 \long\def\pgfcircdeclarefourport#1#2{
22243
22244 \pgfdeclareshape{#1}{
22245 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
22246 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22247 \anchor{center}{
22248 \northwest
22249 \pgf@x=0pt
22250 \pgf@y=0pt
22251 }
22252 \savedanchor\northwest{%
22253 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22254 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
22255 \pgf@y=.5\pgf@y
22256 \pgf@x=.5\pgf@circ@scaled@Rlen
22257 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
22258 }
22259 \anchor{north}{
22260 \northwest
22261 \pgf@x=0pt
22262 }
22263 \anchor{south}{
22264 \northwest
22265 \pgf@x=0pt
22266 \pgf@y=-\pgf@y
22267 }
22268 \anchor{west}{
22269 \northwest
22270 \pgf@y=0pt
22271 }
22272 \anchor{east}{
22273 \northwest
22274 \pgf@y=0pt
22275 \pgf@x=-\pgf@x
22276 }
22277 \anchor{south west}{
22278 \northwest
22279 \pgf@y=-\pgf@y
22280 }
22281 \anchor{north east}{
22282 \northwest
22283 \pgf@x=-\pgf@x
22284 }
22285 \anchor{north west}{
22286 \northwest
22287 }
22288 \anchor{south east}{
22289 \northwest
22290 \pgf@x=-\pgf@x
22291 \pgf@y=-\pgf@y
22292 }
22293 \anchor{port1}{
22294 \northwest
22295 \pgf@y=-0.5\pgf@y
22296 }
22297 \anchor{port2}{
22298 \northwest
22299 \pgf@x=-\pgf@x
22300 \pgf@y=-0.5\pgf@y
22301 }
22302 \anchor{port3}{
22303 \northwest
22304 \pgf@x=-\pgf@x
22305 \pgf@y=0.5\pgf@y
22306 }
22307 \anchor{port4}{
22308 \northwest
22309 \pgf@y=0.5\pgf@y
22310 }
22311 \anchor{left down}{
22312 \northwest
22313 \pgf@y=-0.5\pgf@y
22314 }
22315 \anchor{right down}{
22316 \northwest
22317 \pgf@x=-\pgf@x
22318 \pgf@y=-0.5\pgf@y
22319 }
22320 \anchor{right up}{
22321 \northwest
22322 \pgf@x=-\pgf@x
22323 \pgf@y=0.5\pgf@y
22324 }
22325 \anchor{left up}{
22326 \northwest
22327 \pgf@y=0.5\pgf@y
22328 }
22329 \anchor{1}{
22330 \northwest
22331 \pgf@y=-0.5\pgf@y
22332 }
22333 \anchor{2}{
22334 \northwest
22335 \pgf@x=-\pgf@x
22336 \pgf@y=-0.5\pgf@y
22337 }
22338 \anchor{3}{
22339 \northwest
22340 \pgf@x=-\pgf@x
22341 \pgf@y=0.5\pgf@y
22342 }
22343 \anchor{4}{
22344 \northwest
22345 \pgf@y=0.5\pgf@y
22346 }
22347
22348 \anchor{text}{
22349 \northwest
22350 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
22351 \pgf@x=-.5\wd\pgfnodeparttextbox
22352 }
22353 \backgroundpath{
22354 \pgfsetcolor{\ctikzvalof{color}}
22355
22356 \northwest
22357 \pgf@circ@res@up = \pgf@y
22358 \pgf@circ@res@down = -\pgf@y
22359 \pgf@circ@res@right = -\pgf@x
22360 \pgf@circ@res@left = \pgf@x
22361 \pgf@circ@scaled@Rlen=\scaledRlen
22362
22363 \pgfstartlinewidth=\pgflinewidth
22364
22365 % draw outer box
22366 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
22367 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
22368 \pgf@circ@draworfill
22369
22370 % draw inner stuff
22371 #2
22372
22373 % draw inner text
22374 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
22375 }
22376 }
22377 }
22378
22379 % four-port
22380 \pgfcircdeclarefourport{fourport}{}
22381
22382 % straight coupler
22383 \pgfcircdeclarefourport{coupler}{
22384 \pgfsetlinewidth{\pgfstartlinewidth}
22385 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
22386 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22387 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22388 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22389 \pgfusepath{draw}
22390
22391 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
22392 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22393 \pgfsetarrows{latex-latex}
22394 \pgfusepath{draw}
22395 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22396 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
22397 \pgfsetarrows{latex-latex}
22398 \pgfusepath{draw}
22399 }
22400
22401 % "bended" coupler
22402 \pgfcircdeclarefourport{coupler2}{
22403 \pgfsetlinewidth{\pgfstartlinewidth}
22404 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
22405 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22406 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22407 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22408 \pgfusepath{draw}
22409
22410 \pgfscope
22411 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
22412 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
22413 \pgfsetarrowsend{latex}
22414 \pgfusepath{draw}
22415 \endpgfscope
22416 \pgfscope
22417 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
22418 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
22419 \pgfsetarrowsend{latex}
22420 \pgfusepath{draw}
22421 \endpgfscope
22422 \pgfscope
22423 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
22424 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
22425 \pgfsetarrowsend{latex}
22426 \pgfusepath{draw}
22427 \endpgfscope
22428 \pgfscope
22429 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
22430 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
22431 \pgfsetarrowsend{latex}
22432 \pgfusepath{draw}
22433 \endpgfscope
22434 }
22435
22436 % mach zehnder modulator
22437 \pgfdeclareshape{mzm}{
22438 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
22439 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22440 \savedanchor\northwest{%
22441 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22442 \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen
22443 \pgf@y=.5\pgf@y
22444 \pgf@x= \pgf@circ@scaled@Rlen
22445 \pgf@x=.5\pgf@x
22446 \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x
22447 }
22448 \anchor{center}{
22449 \northwest
22450 \pgf@x=0pt
22451 \pgf@y=0pt
22452 }
22453 \anchor{north}{
22454 \northwest
22455 \pgf@x=0pt
22456 }
22457 \anchor{south}{
22458 \northwest
22459 \pgf@x=0pt
22460 \pgf@y=-\pgf@y
22461 }
22462 \anchor{west}{
22463 \northwest
22464 \pgf@y=0pt
22465 }
22466 \anchor{east}{
22467 \northwest
22468 \pgf@y=0pt
22469 \pgf@x=-\pgf@x
22470 }
22471 \anchor{south west}{
22472 \northwest
22473 \pgf@y=-\pgf@y
22474 }
22475 \anchor{north east}{
22476 \northwest
22477 \pgf@x=-\pgf@x
22478 }
22479 \anchor{north west}{
22480 \northwest
22481 }
22482 \anchor{south east}{
22483 \northwest
22484 \pgf@x=-\pgf@x
22485 \pgf@y=-\pgf@y
22486 }
22487 \anchor{in}{
22488 \northwest
22489 \pgf@y=0pt
22490 }
22491 \anchor{mod}{
22492 \northwest
22493 \pgf@x=0pt
22494 }
22495 \anchor{out}{
22496 \northwest
22497 \pgf@x=-\pgf@x
22498 \pgf@y=0pt
22499 }
22500 \anchor{text}{
22501 \northwest
22502 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
22503 \pgf@x=-.5\wd\pgfnodeparttextbox
22504 }
22505 \backgroundpath{
22506 \pgfsetcolor{\ctikzvalof{color}}
22507 \pgf@circ@scaled@Rlen=\scaledRlen
22508
22509 \northwest
22510 \pgf@circ@res@up = \pgf@y
22511 \pgf@circ@res@down = -\pgf@y
22512 \pgf@circ@res@right = -\pgf@x
22513 \pgf@circ@res@left = \pgf@x
22514
22515 \pgfstartlinewidth=\pgflinewidth
22516
22517 % draw outer box
22518 \pgf@circ@twoportbox
22519
22520 % draw inner stuff
22521 % rotate inner symbol
22522 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
22523 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
22524 \pgftransformrotate{270}
22525 \fi\fi
22526 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
22527 \pgftransformrotate{180}
22528 \fi\fi
22529 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
22530 \pgftransformrotate{90}
22531 \fi\fi
22532
22533 % draw inner symbol
22534 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
22535 \pgfsetarrows{-} %never draw arrows
22536 \pgfsetlinewidth{\pgfstartlinewidth}
22537 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
22538 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
22539 \pgfusepath{draw}
22540
22541 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
22542 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
22543 \pgfusepath{draw}
22544
22545 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
22546 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
22547 \pgfusepath{draw}
22548
22549 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
22550 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
22551 \pgfusepath{draw}
22552
22553 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
22554 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
22555 \pgfusepath{draw}
22556
22557 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
22558 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
22559 \pgfusepath{draw}
22560
22561 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
22562 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
22563 \pgfusepath{draw}
22564
22565 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
22566 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
22567 \pgfusepath{draw}
22568
22569 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
22570 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}}
22571 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}}
22572 \pgfusepath{draw}
22573
22574 }
22575 }
22576 % %>>>
22577
22578 % vim: set fdm=marker fmr=%<<<,%>>>:
22579 %%%---------- close: tex/pgfcircquadpoles
22580 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
22581 %%%---------- open: tex/pgfcircmultipoles.tex
22582 % Copyright 2018-2026 by Romano Giannetti
22583 % Copyright 2015-2026 by Stefan Lindner
22584 % Copyright 2013-2026 by Stefan Erhardt
22585 % Copyright 2007-2026 by Massimo Redaelli
22586 %
22587 % This file may be distributed and/or modified
22588 %
22589 % 1. under the LaTeX Project Public License and/or
22590 % 2. under the GNU Public License.
22591 %
22592 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
22593
22594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22595 %% Chips and Rotary Switches
22596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22597
22598 % Definitions for Chips and Rotary switches (multipoles) %<<<1
22599 %
22600 \ctikzset{multipoles/thickness/.initial=2}
22601 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
22602 \ctikzset{multipoles/draw only pins/.initial={all}}
22603 \ctikzset{multipoles/draw only left pins/.initial={all}}
22604 \ctikzset{multipoles/draw only right pins/.initial={all}}
22605 \ctikzset{multipoles/draw only top pins/.initial={all}}
22606 \ctikzset{multipoles/draw only bottom pins/.initial={all}}
22607 \pgfqkeys{/tikz}{draw only pins/.add code={}{\ctikzset{multipoles/draw only pins={#1}}}}
22608 \pgfqkeys{/tikz}{draw only left pins/.add code={}{\ctikzset{multipoles/draw only left pins={#1}}}}
22609 \pgfqkeys{/tikz}{draw only right pins/.add code={}{\ctikzset{multipoles/draw only right pins={#1}}}}
22610 \pgfqkeys{/tikz}{draw only top pins/.add code={}{\ctikzset{multipoles/draw only top pins={#1}}}}
22611 \pgfqkeys{/tikz}{draw only bottom pins/.add code={}{\ctikzset{multipoles/draw only bottom pins={#1}}}}
22612 % DIP (dual in line package) chips
22613 \ctikzset{multipoles/dipchip/width/.initial=1.2}
22614 \ctikzset{multipoles/dipchip/num pins/.initial=8}
22615 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
22616 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
22617 % QFP (quad flat package) chips
22618 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
22619 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
22620 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
22621 % chip numbers
22622 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
22623 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
22624 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
22625 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
22626 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
22627 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
22628 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
22629 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
22630 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
22631 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
22632 % external chip pins
22633 \ctikzset{multipoles/external pins thickness/.initial=1}
22634 \ctikzset{multipoles/external pins width/.initial=0.2}
22635 \ctikzset{multipoles/external pad fraction/.initial=0}
22636 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
22637 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
22638 % topmarks
22639 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
22640 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
22641 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
22642 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
22643 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
22644
22645 % rotary switch by Romano
22646 \ctikzset{multipoles/rotary/thickness/.initial=1}
22647 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
22648 \ctikzset{multipoles/rotary/channels/.initial=5}
22649 \ctikzset{multipoles/rotary/angle/.initial=60}
22650 \ctikzset{multipoles/rotary/wiper/.initial=20}
22651 \ctikzset{multipoles/rotary/arrow/.is choice}
22652 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
22653 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
22654 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
22655 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
22656 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
22657 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
22658 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
22659
22660 \tikzset{%
22661 rotary switch/.style args={#1in#2wiper#3}{%
22662 shape=rotaryswitch,
22663 /tikz/circuitikz/multipoles/rotary/channels=#1,
22664 /tikz/circuitikz/multipoles/rotary/angle=#2,
22665 /tikz/circuitikz/multipoles/rotary/wiper=#3,
22666 },
22667 rotary switch -/.style args={#1in#2wiper#3}{
22668 rotary switch=#1 in #2 wiper #3,
22669 /tikz/circuitikz/multipoles/rotary/arrow=none,
22670 },
22671 rotary switch <-/.style args={#1in#2wiper#3}{
22672 rotary switch=#1 in #2 wiper #3,
22673 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
22674 },
22675 rotary switch ->/.style args={#1in#2wiper#3}{
22676 rotary switch=#1 in #2 wiper #3,
22677 /tikz/circuitikz/multipoles/rotary/arrow=cw,
22678 },
22679 rotary switch <->/.style args={#1in#2wiper#3}{
22680 rotary switch=#1 in #2 wiper #3,
22681 /tikz/circuitikz/multipoles/rotary/arrow=both,
22682 },
22683 % Notice that these should be the same as the initial values of the keys
22684 rotary switch/.default={5 in 60 wiper 20},
22685 rotary switch -/.default={5 in 60 wiper 20},
22686 rotary switch <-/.default={5 in 60 wiper 20},
22687 rotary switch ->/.default={5 in 60 wiper 20},
22688 rotary switch <->/.default={5 in 60 wiper 20},
22689 }
22690 %%>>>
22691
22692 %% Nodes definitions for chips%<<<
22693
22694 %%%%%%%%%
22695 %% Chips
22696 %%%%%%%%%
22697
22698 % let's use the same shifts everywhere, no magic numbers
22699 \def\pgf@circ@dip@pin@shift{0.5}
22700 \def\pgf@circ@qfp@pin@shift{0.25}
22701
22702 % derived from https://tex.stackexchange.com/a/146753/38080
22703 % original author Mark Wibrow
22704 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
22705 % a lot of thanks to @marmot for the un-rotation hint
22706 % https://tex.stackexchange.com/a/473571/38080
22707 % modifications for 'draw only pins' by Jonathan P. Spratte
22708
22709 % DIP (dual in line package) chips
22710
22711 % helper macro to set the anchors inside a loop (to expand the current count)
22712 \pgfutil@protected\def\pgf@circ@make@dippin@anchor#1%
22713 {%
22714 \expandafter\gdef\csname pgf@anchor@dipchip@pin #1\endcsname
22715 {%
22716 \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
22717 {\pgf@circ@dippinanchor{#1}{1}}
22718 {\pgf@circ@dippinanchor{#1}{0}}%
22719 }%
22720 \expandafter\gdef\csname pgf@anchor@dipchip@bpin #1\endcsname
22721 {\pgf@circ@dippinanchor{#1}{0}}%
22722 }
22723
22724 \pgfdeclareshape{dipchip}{
22725 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
22726 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22727 \savedmacro\numpins{%
22728 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
22729 \def\numpins{\the\pgf@circ@count@a}
22730 }
22731 \savedmacro\pgf@circ@pins@list
22732 {%
22733 \pgfkeysgetvalue
22734 {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
22735 \expandafter\pgf@circ@set@list
22736 \expandafter\pgf@circ@pins@list
22737 \expandafter{\pgf@circ@temp}%
22738 }%
22739 \savedanchor\centerpoint{%
22740 \pgf@x=-.5\wd\pgfnodeparttextbox%
22741 \pgf@y=-.5\ht\pgfnodeparttextbox%
22742 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
22743 }%
22744 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
22745 \anchor{center}{\origin}
22746 \anchor{text}{\centerpoint}% to adjust text
22747 \saveddimen\height{%
22748 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22749 \pgfmathsetlength\pgf@x{((\numpins)
22750 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
22751 }%
22752 \saveddimen{\chipspacing}{
22753 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22754 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
22755 \saveddimen{\width}{
22756 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22757 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
22758 \saveddimen{\extshift}{
22759 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22760 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
22761 % standard anchors
22762 \savedanchor\northwest{%
22763 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22764 \pgfmathsetlength\pgf@y{0.5*((\numpins)
22765 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
22766 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
22767 }
22768 \anchor{dot}{\northwest
22769 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
22770 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
22771 }
22772 \anchor{nw}{\northwest}
22773 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
22774 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
22775 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
22776 \anchor{north west}{\northwest}
22777 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
22778 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
22779 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
22780 \anchor{n}{\northwest\pgf@x=0pt }
22781 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
22782 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
22783 \anchor{w}{\northwest\pgf@y=0pt }
22784 \anchor{north}{\northwest\pgf@x=0pt }
22785 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
22786 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
22787 \anchor{west}{\northwest\pgf@y=0pt }
22788 % start drawing
22789 \backgroundpath{%
22790 \northwest
22791 \pgf@circ@res@up = \pgf@y
22792 \pgf@circ@res@down = -\pgf@y
22793 \pgf@circ@res@right = -\pgf@x
22794 \pgf@circ@res@left = \pgf@x
22795 \pgf@circ@scaled@Rlen=\scaledRlen
22796 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
22797 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
22798 \pgfscope% (for the line width)
22799 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
22800 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
22801 \pgf@circ@draworfill
22802 %% upside mark
22803 \ifpgf@circuit@chip@topmark
22804 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
22805 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
22806 \fi
22807 \pgfusepath{stroke}%
22808 \pgfsetcolor{\ctikzvalof{color}}
22809 % Adding the pin number
22810 \ifpgf@circuit@chip@shownumbers
22811 \pgf@circ@count@a=\numpins\relax
22812 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
22813 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
22814 \ifpgf@circuit@chip@straightnumbers
22815 \pgfgettransformentries\a\b\temp\temp\temp\temp
22816 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
22817 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
22818 \else
22819 \pgfmathsetmacro{\rot}{0}
22820 \pgfmathsetmacro{\quadrant}{0}
22821 \fi
22822 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
22823 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
22824 \pgfmathloop%
22825 \ifnum\pgf@circ@count@a>0
22826 \ifcase\quadrant % rotation 0
22827 % left
22828 \pgf@circ@count@c=\pgf@circ@count@a
22829 \pgftext[left,
22830 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22831 rotate=\rot]{\mytext}
22832 % right
22833 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22834 \pgftext[right,
22835 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22836 rotate=\rot]{\mytext}
22837 \or % rotation -90
22838 % left
22839 \pgf@circ@count@c=\pgf@circ@count@a
22840 \pgftext[top,
22841 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22842 rotate=\rot]{\mytext}
22843 % right
22844 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22845 \pgftext[bottom,
22846 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22847 rotate=\rot]{\mytext}
22848 \or %rotation 180
22849 % left
22850 \pgf@circ@count@c=\pgf@circ@count@a
22851 \pgftext[right,
22852 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22853 rotate=\rot]{\mytext}
22854 % right
22855 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22856 \pgftext[left,
22857 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22858 rotate=\rot]{\mytext}
22859 \or % rotation +90
22860 % left
22861 \pgf@circ@count@c=\pgf@circ@count@a
22862 \pgftext[bottom,
22863 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22864 rotate=\rot]{\mytext}
22865 % right
22866 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22867 \pgftext[top,
22868 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22869 rotate=\rot]{\mytext}
22870 \fi
22871 \advance\pgf@circ@count@a-1\relax%
22872 \repeatpgfmathloop
22873 \fi
22874 \endpgfscope
22875 % draw external pins or pads
22876 \ifdim\pgf@circ@res@other>0pt
22877 \ifpgfcirc@draw@input@leads
22878 \pgfscope
22879 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
22880 \pgf@circ@count@a=\numpins\relax
22881 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
22882 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
22883 \ifnum\padfrac>0
22884 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
22885 \fi
22886 \pgfmathloop%
22887 \ifnum\pgf@circ@count@a>0
22888 % left side
22889 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
22890 {%
22891 \ifnum\padfrac>0
22892 % pads
22893 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22894 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22895 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22896 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22897 \else
22898 % pins
22899 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22900 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22901 \fi
22902 }
22903 {}%
22904 % right side
22905 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins+1-\pgf@circ@count@a}
22906 {%
22907 \ifnum\padfrac>0
22908 % pads
22909 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22910 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22911 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22912 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22913 \else
22914 % pins
22915 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22916 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22917 \fi
22918 }
22919 {}%
22920 \advance\pgf@circ@count@a by -1\relax%
22921 \repeatpgfmathloop
22922 \pgfusepath{stroke}
22923 \endpgfscope
22924 \fi
22925 \fi
22926 }%
22927 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
22928 \pgf@circ@count@a=\numpins
22929 \pgfmathloop
22930 \ifnum\pgf@circ@count@a>0
22931 % we will create two anchors per pin: the "normal one" like `pin 1` for the
22932 % electrical contact, and the "border one" like `bpin 1` for labels.
22933 % they will coincide if `external pins width` is set to 0.
22934 % see the helper function above the start of the shape definition (by Jonathan P. Spratte)
22935 \expandafter\pgf@circ@make@dippin@anchor\expandafter{\the\pgf@circ@count@a}%
22936 \advance\pgf@circ@count@a by -1\relax
22937 \repeatpgfmathloop
22938 }%
22939 }
22940
22941 % QFP (quad flat package) chips
22942 % helper macro to set the anchors inside a loop (to expand the current count)
22943 \pgfutil@protected\def\pgf@circ@make@qfppin@anchor#1%
22944 {%
22945 \expandafter\gdef\csname pgf@anchor@qfpchip@pin #1\endcsname
22946 {%
22947 \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
22948 {\pgf@circ@qfppinanchor{#1}{1}}
22949 {\pgf@circ@qfppinanchor{#1}{0}}%
22950 }%
22951 \expandafter\gdef\csname pgf@anchor@qfpchip@bpin #1\endcsname
22952 {\pgf@circ@qfppinanchor{#1}{0}}%
22953 }
22954
22955 \pgfdeclareshape{qfpchip}{
22956 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
22957 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22958 \savedmacro\numpins{%
22959 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
22960 \def\numpins{\the\pgf@circ@count@a}
22961 }
22962 \savedmacro\pgf@circ@pins@list
22963 {% some magic here, thanks to Jonathan P. Spratte
22964 \pgfkeysgetvalue
22965 {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
22966 \expandafter\pgf@circ@set@list
22967 \expandafter\pgf@circ@pins@list
22968 \expandafter{\pgf@circ@temp}%
22969 }%
22970 \savedanchor\centerpoint{%
22971 \pgf@x=-.5\wd\pgfnodeparttextbox%
22972 \pgf@y=-.5\ht\pgfnodeparttextbox%
22973 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
22974 }%
22975 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
22976 \anchor{center}{\origin}
22977 \anchor{text}{\centerpoint}% to adjust text
22978 \saveddimen\height{%
22979 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22980 \pgfmathsetlength\pgf@x{((\numpins+2)
22981 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
22982 }%
22983 \saveddimen\width{%
22984 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22985 \pgfmathsetlength\pgf@x{((\numpins+2)
22986 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
22987 }%
22988 \saveddimen{\chipspacing}{
22989 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22990 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
22991 \saveddimen{\extshift}{
22992 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22993 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
22994 % standard anchors
22995 \savedanchor\northwest{%
22996 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22997 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
22998 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
22999 \pgf@x=-\pgf@y
23000 }
23001 \anchor{dot}{\northwest
23002 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
23003 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
23004 }
23005 \anchor{nw}{\northwest}
23006 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
23007 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
23008 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
23009 \anchor{north west}{\northwest}
23010 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
23011 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
23012 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
23013 \anchor{n}{\northwest\pgf@x=0pt }
23014 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
23015 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23016 \anchor{w}{\northwest\pgf@y=0pt }
23017 \anchor{north}{\northwest\pgf@x=0pt }
23018 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
23019 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23020 \anchor{west}{\northwest\pgf@y=0pt }
23021 % start drawing
23022 \backgroundpath{%
23023 \northwest
23024 \pgf@circ@res@up = \pgf@y
23025 \pgf@circ@res@down = -\pgf@y
23026 \pgf@circ@res@right = -\pgf@x
23027 \pgf@circ@res@left = \pgf@x
23028 \pgf@circ@scaled@Rlen=\scaledRlen
23029 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
23030 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
23031 \pgfscope% (for the line width)
23032 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
23033 %% upside mark
23034 \ifpgf@circuit@chip@topmark
23035 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
23036 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
23037 \else
23038 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
23039 \fi
23040 %% rest of the shape
23041 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
23042 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
23043 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
23044 \pgfpathclose
23045 \pgf@circ@draworfill
23046 % Adding the pin number
23047 \pgfsetcolor{\ctikzvalof{color}}
23048 \ifpgf@circuit@chip@shownumbers
23049 \pgf@circ@count@a=\numpins%
23050 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
23051 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
23052 \ifpgf@circuit@chip@straightnumbers
23053 \pgfgettransformentries\a\b\temp\temp\temp\temp
23054 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
23055 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
23056 \else
23057 \pgfmathsetmacro{\rot}{0}
23058 \pgfmathsetmacro{\quadrant}{0}
23059 \fi
23060 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
23061 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
23062 \pgfmathloop%
23063 \ifnum\pgf@circ@count@a>0
23064 \ifcase\quadrant % rotation 0
23065 % left
23066 \pgf@circ@count@c=\pgf@circ@count@a
23067 \pgftext[left,
23068 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23069 rotate=\rot]{\mytext}
23070 % bottom
23071 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
23072 \pgftext[bottom,
23073 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
23074 rotate=\rot]{\mytext}
23075 % right
23076 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23077 \pgftext[right,
23078 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23079 rotate=\rot]{\mytext}
23080 % top
23081 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
23082 \pgftext[top,
23083 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
23084 rotate=\rot]{\mytext}
23085 \or % rotation -90
23086 % left
23087 \pgf@circ@count@c=\pgf@circ@count@a
23088 \pgftext[top,
23089 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23090 rotate=\rot]{\mytext}
23091 % bottom
23092 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
23093 \pgftext[left,
23094 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
23095 rotate=\rot]{\mytext}
23096 % right
23097 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23098 \pgftext[bottom,
23099 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23100 rotate=\rot]{\mytext}
23101 % top
23102 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
23103 \pgftext[right,
23104 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
23105 rotate=\rot]{\mytext}
23106 \or %rotation 180
23107 % left
23108 \pgf@circ@count@c=\pgf@circ@count@a
23109 \pgftext[right,
23110 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23111 rotate=\rot]{\mytext}
23112 % bottom
23113 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
23114 \pgftext[top,
23115 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
23116 rotate=\rot]{\mytext}
23117 % right
23118 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23119 \pgftext[left,
23120 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23121 rotate=\rot]{\mytext}
23122 % top
23123 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
23124 \pgftext[bottom,
23125 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
23126 rotate=\rot]{\mytext}
23127 \or % rotation +90
23128 % left
23129 \pgf@circ@count@c=\pgf@circ@count@a
23130 \pgftext[bottom,
23131 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23132 rotate=\rot]{\mytext}
23133 % bottom
23134 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
23135 \pgftext[right,
23136 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
23137 rotate=\rot]{\mytext}
23138 % right
23139 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23140 \pgftext[top,
23141 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23142 rotate=\rot]{\mytext}
23143 % top
23144 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
23145 \pgftext[left,
23146 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
23147 rotate=\rot]{\mytext}
23148 \fi
23149 \advance\pgf@circ@count@a-1\relax%
23150 \repeatpgfmathloop
23151 \fi
23152 \endpgfscope
23153 \ifdim\pgf@circ@res@other>0pt
23154 \ifpgfcirc@draw@input@leads
23155 \pgfscope
23156 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
23157 \pgf@circ@count@a=\numpins%
23158 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
23159 \pgfmathloop%
23160 \ifnum\pgf@circ@count@a>0
23161 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
23162 \ifnum\padfrac>0
23163 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
23164 % left side pads
23165 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
23166 {%
23167 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23168 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23169 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23170 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23171 }{}%
23172 % bottom side pads
23173 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
23174 {%
23175 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
23176 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
23177 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
23178 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
23179 }{}%
23180 % right side pads
23181 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
23182 {%
23183 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23184 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23185 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23186 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp+\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23187 }{}%
23188 % top side pads
23189 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
23190 {%
23191 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
23192 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
23193 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
23194 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@temp+\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
23195 }{}%
23196 \else
23197 % left side pins
23198 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
23199 {%
23200 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23201 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23202 }{}%
23203 % bottom side pins
23204 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
23205 {%
23206 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
23207 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down-\pgf@circ@res@other}}
23208 }{}%
23209 % right side pins
23210 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
23211 {%
23212 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23213 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23214 }{}%
23215 % top side pins
23216 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
23217 {%
23218 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
23219 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up+\pgf@circ@res@other}}
23220 }{}%
23221 \fi
23222 \advance\pgf@circ@count@a-1\relax%
23223 \repeatpgfmathloop
23224 \pgfusepath{stroke}
23225 \endpgfscope
23226 \fi
23227 \fi
23228 }%
23229 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
23230 % and is executed just before a node is drawn.
23231 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
23232 % Start with the maximum pin number and go backwards.
23233 \pgf@circ@count@a=\numpins%
23234 \pgfmathloop%
23235 \ifnum\pgf@circ@count@a>0
23236 \expandafter\pgf@circ@make@qfppin@anchor\expandafter{\the\pgf@circ@count@a}%
23237 \advance\pgf@circ@count@a-1\relax%
23238 \repeatpgfmathloop%
23239 }%
23240 }
23241
23242 %% anchors for DIP
23243 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
23244 \c@pgf@countc=\numpins\relax
23245 \divide\c@pgf@countc by 2
23246 \ifnum #1 > \the\c@pgf@countc
23247 % right side
23248 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
23249 \else
23250 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
23251 \fi
23252 }
23253
23254 %% anchors for QFP
23255 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
23256 \c@pgf@countc=\numpins\relax
23257 \divide\c@pgf@countc by 4
23258 \ifnum #1 > \the\c@pgf@countc
23259 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
23260 \ifnum #1 > \the\c@pgf@countb
23261 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
23262 \ifnum #1 > \the\c@pgf@countb
23263 % 3*npins/4 < pin, top side
23264 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
23265 \else
23266 % 2*npins/4 < pin <= 3*npins/4, right side
23267 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
23268 \fi
23269 \else
23270 % npins/4 < pin <= 2*npins/4, bottom side
23271 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
23272 \fi
23273 \else
23274 % <= npins/4, left side
23275 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
23276 \fi
23277 }% %>>>
23278
23279 %% Nodes definition for rotaryswitch%<<<
23280
23281 %%%%%%%%%%%%%%%%%
23282 %% Rotary Switch
23283 %%%%%%%%%%%%%%%%%
23284
23285 \pgfdeclareshape{rotaryswitch}
23286 {
23287 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
23288 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23289 \savedanchor\northeast{%
23290 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23291 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
23292 % the magic number is 0.25/cos(35)
23293 % try to recalculate it for the actual switch
23294 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
23295 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
23296 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
23297 \edef\r{\ctikzvalof{nodes width}}
23298 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
23299 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
23300 }
23301 \savedanchor\northwest{%
23302 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23303 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
23304 % the magic number is 0.25/cos(35)
23305 % try to recalculate it for the actual switch
23306 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
23307 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
23308 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
23309 \edef\r{\ctikzvalof{nodes width}}
23310 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
23311 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
23312 }
23313 \savedanchor\central{%
23314 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23315 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
23316 % the magic number is 0.25/cos(35)
23317 % try to recalculate it for the actual switch
23318 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
23319 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
23320 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
23321 \edef\r{\ctikzvalof{nodes width}}
23322 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
23323 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
23324 }
23325 % external square limits
23326 \savedanchor\extnorthwest{%
23327 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23328 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
23329 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
23330 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
23331 \pgf@x=2.5\pgf@x % external square size
23332 \pgf@y=-\pgf@x %square thing when angle=180?
23333 }
23334 \saveddimen{\width}{
23335 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23336 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
23337 % radius of the connector
23338 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
23339 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
23340 % shapename
23341 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
23342 % shape type
23343 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
23344 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
23345 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
23346 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
23347 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
23348 % mid of the lever, to stack switches
23349 %\anchor{mid}{\midlever}
23350 \anchor{mid}{\northwest
23351 \pgf@circ@res@temp=-\pgf@x
23352 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
23353 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
23354 }
23355 %
23356 % Notice that the "in" anchors must mimic "ext center", otherwise they are
23357 % wrong for angles > 90 degrees!
23358 %
23359 % center anchors
23360 \anchor{cin}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
23361 % horizontal angles
23362 \anchor{in}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius}
23363 \anchor{ain}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius}
23364
23365 \anchor{center}{ \central \pgf@y=0pt }
23366 \anchor{east}{ \northeast \pgf@y=0pt }
23367 \anchor{west}{ \northwest \pgf@y=0pt }
23368 \anchor{south}{ \central \pgf@y=-\pgf@y }
23369 \anchor{north}{ \central }
23370 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
23371 \anchor{north east}{ \northeast }
23372 \anchor{north west}{ \northwest }
23373 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
23374
23375 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
23376 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
23377 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
23378 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
23379 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
23380 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
23381 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
23382 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
23383 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
23384
23385 \backgroundpath{
23386 \pgfsetcolor{\ctikzvalof{color}}
23387 \pgf@circ@res@right = \width
23388 \pgf@circ@res@left = -\width
23389
23390 \pgfscope %wiper
23391 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
23392 \pgf@circ@res@temp=\radius\relax
23393 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
23394 \pgfsetlinewidth{2\pgf@circ@res@temp}
23395 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
23396 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
23397 \pgfsetroundcap\pgfusepath{draw}
23398 \endpgfscope
23399
23400 \ifpgf@circ@rotaryarrow
23401 \pgfscope % arrow
23402 \pgfcirc@set@arrows{switch}{\ifpgf@circ@rotaryarrow@ccw latexslim\fi}{\ifpgf@circ@rotaryarrow@cw latexslim\fi}
23403 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
23404 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
23405 \pgftransformrotate{\wiper}
23406 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
23407 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
23408 \ifpgf@circ@rotaryarrow@ccw
23409 \ifpgf@circ@rotaryarrow@cw
23410 % both here, maintain values
23411 \relax
23412 \else
23413 % only ccw: remove end arrow
23414 \pgfsetarrowsend{}
23415 \fi
23416 \else
23417 \ifpgf@circ@rotaryarrow@cw
23418 % only cw: remove start arrow
23419 \pgfsetarrowsstart{}
23420 \else
23421 % none: shouldn't happen
23422 \relax
23423 \fi
23424 \fi
23425 \pgfusepath{draw}
23426 \endpgfscope
23427 \fi
23428
23429 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
23430 \pgf@circ@count@a=\channels\relax
23431 \pgfmathsetmacro{\currenta}{-\angle}
23432 \pgfmathloop%
23433 \ifnum\pgf@circ@count@a>0
23434 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
23435 \pgfscope
23436 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
23437 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
23438 \endpgfscope
23439 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
23440 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
23441 \advance\pgf@circ@count@a by -1\relax%
23442 \repeatpgfmathloop
23443
23444 \pgfscope % input
23445 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
23446 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
23447 \endpgfscope
23448 }
23449 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
23450 % and is executed just before a node is drawn.
23451 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
23452 % Start with the maximum pin number and go backwards.
23453 \pgf@circ@count@a=\channels\relax
23454 \pgfmathloop%
23455 \ifnum\pgf@circ@count@a>0
23456 % we will create two anchors per pin: the "normal one" like `pin 1` for the
23457 % electrical contact, and the "border one" like `bpin 1` for labels.
23458 % they will coincide if `external pins width` is set to 0.
23459 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
23460 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
23461 }
23462 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
23463 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
23464 }
23465 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
23466 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
23467 }
23468 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
23469 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}%
23470 }
23471 \advance\pgf@circ@count@a by -1\relax%
23472 \repeatpgfmathloop%
23473 }%
23474 }
23475
23476 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
23477 \pgf@circ@res@temp=\width
23478 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
23479 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
23480 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
23481 \advance\pgf@x by -\pgf@circ@res@temp
23482 }
23483
23484 \def\pgf@circ@rotarysqanchor#1{% external square anchors
23485 \pgf@circ@res@temp=\width
23486 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
23487 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
23488 \advance\pgf@x by -\pgf@circ@res@temp
23489 }% %>>>
23490
23491 %%%%%%%%%%%%%%%%%%%%%%%%%%
23492 % Seven segments displays
23493 %%%%%%%%%%%%%%%%%%%%%%%%%%
23494
23495 % Definitions for seven segment displays by RGtti%<<<1
23496
23497 \newif\ifpgf@circ@sevenseg@dot
23498 \newif\ifpgf@circ@sevenseg@box
23499 \def\pgf@circ@sevenseg@dotstate{empty}
23500 \ctikzset{seven seg/.is family}
23501 \ctikzset{seven seg/dot/.is choice}
23502 % none means no dot, not space for it. Empty means no dot, but space
23503 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
23504 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
23505 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
23506 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
23507 %
23508 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
23509 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
23510 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
23511 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
23512 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
23513 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
23514 \ctikzset{seven seg/box/.is choice}
23515 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
23516 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
23517
23518 \ctikzset{seven seg/bits/.initial=0000000}
23519
23520 \ctikzset{seven seg/value/.code={%
23521 \edef\@@tmp{#1}%
23522 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
23523 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
23524 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
23525 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
23526 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
23527 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
23528 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
23529 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
23530 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
23531 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
23532 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
23533 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
23534 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
23535 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
23536 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
23537 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
23538 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
23539 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
23540 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
23541 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
23542 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
23543 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
23544 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
23545 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
23546 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
23547 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
23548 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
23549 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
23550 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
23551 }}
23552
23553 \tikzset{%
23554 seven segment val/.style args={#1dot#2box#3}{%
23555 shape=bare7seg,
23556 /tikz/circuitikz/seven seg/value=#1,
23557 /tikz/circuitikz/seven seg/dot=#2,
23558 /tikz/circuitikz/seven seg/box=#3,
23559 },
23560 seven segment bits/.style args={#1dot#2box#3}{%
23561 shape=bare7seg,
23562 /tikz/circuitikz/seven seg/bits=#1,
23563 /tikz/circuitikz/seven seg/dot=#2,
23564 /tikz/circuitikz/seven seg/box=#3,
23565 },
23566 }
23567 %%>>>
23568
23569 %% Nodes definitions for 7-segment display%<<<
23570 \pgfdeclareshape{bare7seg}{
23571 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
23572 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23573 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
23574 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
23575 \ifpgf@circ@sevenseg@dot
23576 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
23577 \else
23578 \pgf@x=0pt
23579 \fi
23580 }
23581 % The object extension is more or less (-width/2,-width) to (width/2,width)
23582 % and adjusted for line thickness (both sides) and eventually the dot
23583 \saveddimen{\width}{
23584 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23585 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
23586 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
23587 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
23588 \savedanchor{\southwest}{% both negative
23589 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23590 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
23591 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
23592 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
23593 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
23594 }
23595 \savedanchor{\northeast}{% both positive
23596 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23597 \ifpgf@circ@sevenseg@dot
23598 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
23599 \else
23600 \pgf@circ@res@other=0pt
23601 \fi
23602 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
23603 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
23604 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
23605 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
23606 }
23607 \savedanchor{\topright}{% anchor without the box sep and the thickness
23608 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23609 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
23610 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
23611 }
23612 \anchor{center}{\pgfpointorigin}
23613 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
23614 \anchor{north east}{\northeast}
23615 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
23616 \anchor{south west}{\southwest}
23617 \anchor{north}{\northeast\pgf@x=0pt}
23618 \anchor{east}{\northeast\pgf@y=0pt}
23619 \anchor{south}{\southwest\pgf@x=0pt}
23620 \anchor{west}{\southwest\pgf@y=0pt}
23621 \anchor{a}{\topright\pgf@x=0pt}
23622 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
23623 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
23624 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
23625 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23626 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23627 \anchor{g}{\pgfpointorigin}
23628 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
23629 \behindbackgroundpath{%
23630 \southwest % I do not want the dot here, it will stick out
23631 \pgf@circ@res@up = -\pgf@y
23632 \pgf@circ@res@down = \pgf@y
23633 \pgf@circ@res@right = \pgf@x
23634 \pgf@circ@res@left = -\pgf@x
23635 \pgfscope
23636 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
23637 \pgfsetcolor{\ctikzvalof{color}}
23638 \pgfpathrectanglecorners%
23639 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
23640 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
23641 \ifpgf@circ@sevenseg@box
23642 \pgf@circ@draworfill
23643 \else
23644 \pgf@circ@maybefill
23645 \fi
23646 \endpgfscope
23647 \edef\bits{\ctikzvalof{seven seg/bits}}
23648 \pgfscope
23649 \pfg@circ@sseg@drawbits{\bits}
23650 \endpgfscope
23651 \pgfscope
23652 \ifpgf@circ@sevenseg@dot
23653 \pgf@circ@sseg@drawdots
23654 \fi
23655 \endpgfscope
23656 }
23657 }
23658
23659 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
23660 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
23661 }
23662 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
23663 \ifnum #1 > 0\relax
23664 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
23665 \else
23666 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
23667 \fi
23668 \pgfpathmoveto{\pgfpoint{#2}{#3}}
23669 \pgfpathlineto{\pgfpoint{#4}{#5}}
23670 \pgfusepath{draw}
23671 }
23672 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
23673 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
23674 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
23675 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
23676 % \pgfsetroundcap
23677 \pgfsetarrowsstart{Triangle Cap[]}
23678 \pgfsetarrowsend{Triangle Cap[]}
23679 % segments
23680 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
23681 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
23682 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
23683 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
23684 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
23685 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
23686 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
23687 }
23688 \def\pgf@circ@sseg@drawdots{% dots
23689 \edef\what{empty}
23690 \ifx\what\pgf@circ@sevenseg@dotstate
23691 % do nothing
23692 \else
23693 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
23694 \edef\what{off}
23695 \ifx\what\pgf@circ@sevenseg@dotstate
23696 % dot off
23697 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
23698 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
23699 \else
23700 % dot on
23701 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
23702 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
23703 \fi
23704 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
23705 \pgfusepath{draw,fill}
23706 \fi
23707 }
23708 % %>>>
23709
23710 %%%%%%%%%%%%%%%%%%%%%%%%
23711 %% Flip-flops and muxdemuxes
23712 %%%%%%%%%%%%%%%%%%%%%%%%
23713
23714 % Settings for flip flops and muxdemxes%<<<1
23715
23716 %% flip-flop specific keys (most others are the same as chips)
23717
23718 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
23719 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
23720 \ctikzset{multipoles/flipflop/width/.initial=1.2}
23721 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
23722 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
23723
23724 %% muxdemuxes keys
23725
23726 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
23727 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
23728 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
23729 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
23730 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
23731 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
23732 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
23733 \ctikzset{multipoles/muxdemux/NL/.initial=8}
23734 \ctikzset{multipoles/muxdemux/NR/.initial=1}
23735 \ctikzset{multipoles/muxdemux/NB/.initial=3}
23736 \ctikzset{multipoles/muxdemux/NT/.initial=0}
23737 \ctikzset{multipoles/muxdemux/square pins/.initial=0}%
23738 %>>>
23739
23740 %% Node shapes definitions for flip flops%<<<
23741
23742 % Flip flops are a specialized kind of dipchip.
23743 % they have a class by themselves
23744
23745 %% flip flop definitions --- by default empty
23746 %% pin texts
23747 \ctikzset{multipoles/flipflop/t1/.initial={}}
23748 \ctikzset{multipoles/flipflop/t2/.initial={}}
23749 \ctikzset{multipoles/flipflop/t3/.initial={}}
23750 \ctikzset{multipoles/flipflop/t4/.initial={}}
23751 \ctikzset{multipoles/flipflop/t5/.initial={}}
23752 \ctikzset{multipoles/flipflop/t6/.initial={}}
23753 \ctikzset{multipoles/flipflop/tu/.initial={}}
23754 \ctikzset{multipoles/flipflop/td/.initial={}}
23755 % pin clock wedge flags
23756 \ctikzset{multipoles/flipflop/c1/.initial={0}}
23757 \ctikzset{multipoles/flipflop/c2/.initial={0}}
23758 \ctikzset{multipoles/flipflop/c3/.initial={0}}
23759 \ctikzset{multipoles/flipflop/c4/.initial={0}}
23760 \ctikzset{multipoles/flipflop/c5/.initial={0}}
23761 \ctikzset{multipoles/flipflop/c6/.initial={0}}
23762 \ctikzset{multipoles/flipflop/cu/.initial={0}}
23763 \ctikzset{multipoles/flipflop/cd/.initial={0}}
23764 % pin negation circle flags
23765 \ctikzset{multipoles/flipflop/n1/.initial={0}}
23766 \ctikzset{multipoles/flipflop/n2/.initial={0}}
23767 \ctikzset{multipoles/flipflop/n3/.initial={0}}
23768 \ctikzset{multipoles/flipflop/n4/.initial={0}}
23769 \ctikzset{multipoles/flipflop/n5/.initial={0}}
23770 \ctikzset{multipoles/flipflop/n6/.initial={0}}
23771 \ctikzset{multipoles/flipflop/nu/.initial={0}}
23772 \ctikzset{multipoles/flipflop/nd/.initial={0}}
23773
23774
23775 % Thanks to @marmot
23776 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
23777
23778 % default set of flip flops
23779 \tikzset{
23780 % async
23781 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
23782 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
23783 % sync
23784 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
23785 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
23786 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
23787 % additional features
23788 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
23789 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
23790 }
23791
23792 %
23793 % commodity macro to draw the clock wedges. They leave the size of the
23794 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
23795 %
23796 \def\pgf@circ@do@wedge@left{
23797 \pgf@circ@res@temp=0pt\relax
23798 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
23799 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}}
23800 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23801 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}}
23802 \pgfusepath{stroke}
23803 \pgf@circ@res@temp=\wedge
23804 \fi
23805 }
23806 \def\pgf@circ@do@wedge@right{
23807 \pgf@circ@res@temp=0pt\relax
23808 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
23809 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step+\wedge}}
23810 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\wedge}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23811 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step-\wedge}}
23812 \pgfusepath{stroke}
23813 \pgf@circ@res@temp=-\wedge
23814 \fi
23815 }
23816 \def\pgf@circ@do@wedge@up{
23817 \pgf@circ@res@temp=0pt\relax
23818 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
23819 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
23820 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
23821 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
23822 \pgfusepath{stroke}
23823 \pgf@circ@res@temp=-\wedge
23824 \fi
23825 }
23826 \def\pgf@circ@do@wedge@down{
23827 \pgf@circ@res@temp=0pt\relax
23828 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
23829 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
23830 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
23831 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
23832 \pgfusepath{stroke}
23833 \pgf@circ@res@temp=\wedge
23834 \fi
23835 }
23836 % generic flip-flop shape
23837 \pgfdeclareshape{flipflop}{
23838 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
23839 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23840 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
23841 \savedmacro\numpins{\def\numpins{6}}
23842 \savedanchor\centerpoint{%
23843 \pgf@x=-.5\wd\pgfnodeparttextbox%
23844 \pgf@y=-.5\ht\pgfnodeparttextbox%
23845 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
23846 }%
23847 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
23848 \anchor{center}{\origin}
23849 \anchor{text}{\centerpoint}% to adjust text
23850 \saveddimen\height{%
23851 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23852 \pgfmathsetlength\pgf@x{((\numpins)
23853 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
23854 }%
23855 \saveddimen{\chipspacing}{
23856 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23857 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
23858 \saveddimen{\width}{
23859 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23860 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
23861 \saveddimen{\extshift}{
23862 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23863 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
23864 % standard anchors
23865 \savedanchor\northwest{%
23866 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23867 \pgfmathsetlength\pgf@y{0.5*((\numpins)
23868 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
23869 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
23870 }
23871 \anchor{dot}{\northwest
23872 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
23873 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
23874 }
23875 \anchor{nw}{\northwest}
23876 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
23877 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
23878 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
23879 \anchor{north west}{\northwest}
23880 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
23881 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
23882 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
23883 \anchor{n}{\northwest\pgf@x=0pt }
23884 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
23885 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23886 \anchor{w}{\northwest\pgf@y=0pt }
23887 \anchor{north}{\northwest\pgf@x=0pt }
23888 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
23889 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23890 \anchor{west}{\northwest\pgf@y=0pt }
23891 % upper and lower pin
23892 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
23893 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
23894 \anchor{bup}{\northwest\pgf@x=0pt }
23895 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23896 % start drawing
23897 \backgroundpath{%
23898 \northwest
23899 \pgf@circ@res@up = \pgf@y
23900 \pgf@circ@res@down = -\pgf@y
23901 \pgf@circ@res@right = -\pgf@x
23902 \pgf@circ@res@left = \pgf@x
23903 \pgf@circ@scaled@Rlen=\scaledRlen
23904 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
23905 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
23906 \pgfsetcolor{\ctikzvalof{color}}
23907 \pgfscope% (for the line width)
23908 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
23909 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
23910 \pgf@circ@draworfill
23911 \pgfusepath{stroke}%
23912 \endpgfscope
23913 % Adding the pin number
23914 \pgf@circ@count@a=\numpins\relax
23915 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
23916 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
23917 \ifpgf@circuit@chip@straightnumbers
23918 \pgfgettransformentries\a\b\temp\temp\temp\temp
23919 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
23920 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
23921 \else
23922 \pgfmathsetmacro{\rot}{0}
23923 \pgfmathsetmacro{\quadrant}{0}
23924 \fi
23925 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
23926 % text
23927 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
23928 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
23929 \pgf@circ@strut\space}
23930 % \typeout{TEXT\space\mytext}
23931 \pgfmathloop%
23932 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
23933 \pgf@circ@res@temp=0pt\relax
23934 \ifnum\pgf@circ@count@a>0
23935 \ifcase\quadrant % rotation 0
23936 % left
23937 \pgf@circ@count@c=\pgf@circ@count@a
23938 \pgf@circ@do@wedge@left
23939 % \typeout{TEXT Left Q1\space\mytext}
23940 \pgftext[left,
23941 at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23942 rotate=\rot]{\mytext}
23943 % right
23944 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23945 \pgf@circ@do@wedge@right
23946 \pgftext[right,
23947 at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23948 rotate=\rot]{\mytext}
23949 \or % rotation -90
23950 % left
23951 \pgf@circ@count@c=\pgf@circ@count@a
23952 \pgf@circ@do@wedge@left
23953 \pgftext[top,
23954 at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23955 rotate=\rot]{\mytext}
23956 % right
23957 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23958 \pgf@circ@do@wedge@right
23959 \pgftext[bottom,
23960 at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23961 rotate=\rot]{\mytext}
23962 \or %rotation 180
23963 % left
23964 \pgf@circ@count@c=\pgf@circ@count@a
23965 \pgf@circ@do@wedge@left
23966 \pgftext[right,
23967 at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23968 rotate=\rot]{\mytext}
23969 % right
23970 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23971 \pgf@circ@do@wedge@right
23972 \pgftext[left,
23973 at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23974 rotate=\rot]{\mytext}
23975 \or % rotation +90
23976 % left
23977 \pgf@circ@count@c=\pgf@circ@count@a
23978 \pgf@circ@do@wedge@left
23979 \pgftext[bottom,
23980 at=\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23981 rotate=\rot]{\mytext}
23982 % right
23983 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23984 \pgf@circ@do@wedge@right
23985 \pgftext[top,
23986 at=\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@temp}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
23987 rotate=\rot]{\mytext}
23988 \fi
23989 \advance\pgf@circ@count@a-1\relax%
23990 \repeatpgfmathloop
23991 % Now the up and down text
23992 % up
23993 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
23994 \pgf@circ@do@wedge@up
23995 \ifcase\quadrant % rotation 0
23996 \pgftext[top,
23997 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
23998 rotate=\rot]{\mytext}
23999 \or % rotation -90
24000 \pgftext[right,
24001 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
24002 rotate=\rot]{\mytext}
24003 \or %rotation 180
24004 \pgftext[bottom,
24005 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
24006 rotate=\rot]{\mytext}
24007 \or % rotation +90
24008 \pgftext[left,
24009 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
24010 rotate=\rot]{\mytext}
24011 \fi
24012 % down
24013 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
24014 \pgf@circ@do@wedge@down
24015 \ifcase\quadrant % rotation 0
24016 \pgftext[bottom,
24017 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
24018 rotate=\rot]{\mytext}
24019 \or % rotation -90
24020 \pgftext[left,
24021 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
24022 rotate=\rot]{\mytext}
24023 \or %rotation 180
24024 \pgftext[top,
24025 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
24026 rotate=\rot]{\mytext}
24027 \or % rotation +90
24028 \pgftext[right,
24029 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
24030 rotate=\rot]{\mytext}
24031 \fi
24032 % external pins
24033 \ifdim\pgf@circ@res@other>0pt
24034 \pgfscope
24035 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
24036 \pgf@circ@count@a=\numpins\relax
24037 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
24038 \pgfmathloop%
24039 \ifnum\pgf@circ@count@a>0
24040 % left side pins
24041 \pgf@circ@count@c=\pgf@circ@count@a
24042 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
24043 %% Or'ing tests in core TeX is tough
24044 \edef\@@or{0}
24045 % Just expand the key the minimum needed
24046 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
24047 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
24048 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
24049 \ifnum\@@tmp>0\edef\@@or{1}\fi
24050 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
24051 \ifnum\@@tmp>0\edef\@@or{1}\fi
24052 \ifnum\@@or>0
24053 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24054 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24055 \pgfusepath{stroke}
24056 \fi
24057 % right side pins
24058 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24059 \edef\@@or{0}
24060 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
24061 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
24062 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
24063 \ifnum\@@tmp>0\edef\@@or{1}\fi
24064 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
24065 \ifnum\@@tmp>0\edef\@@or{1}\fi
24066 % \typeout{TEST\space\@@tmp\space\@@x}
24067 \ifnum\@@or>0
24068 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24069 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@other}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24070 \pgfusepath{stroke}
24071 \fi
24072 \advance\pgf@circ@count@a by -1\relax%
24073 \repeatpgfmathloop
24074 % up side
24075 \edef\@@or{0}
24076 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
24077 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
24078 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
24079 \ifnum\@@tmp>0\edef\@@or{1}\fi
24080 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
24081 \ifnum\@@tmp>0\edef\@@or{1}\fi
24082 % \typeout{TEST\space\@@tmp\space\@@x}
24083 \ifnum\@@or>0
24084 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
24085 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
24086 \pgfusepath{stroke}
24087 \fi
24088 % down side
24089 \edef\@@or{0}
24090 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
24091 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
24092 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
24093 \ifnum\@@tmp>0\edef\@@or{1}\fi
24094 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
24095 \ifnum\@@tmp>0\edef\@@or{1}\fi
24096 % \typeout{TEST\space\@@tmp\space\@@x}
24097 \ifnum\@@or>0
24098 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
24099 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
24100 \pgfusepath{stroke}
24101 \fi
24102 \endpgfscope
24103 \fi % external pin width >0
24104 %
24105 % draw "inverting" circles on outputs, they must be last
24106 %
24107 \pgfscope
24108 \ifpgf@circuit@ieeelogicport
24109 \def\@@notcirc{notcirc}
24110 \else
24111 \ifpgf@circ@european@port@circle@ieee
24112 \def\@@notcirc{notcirc}
24113 \else
24114 \def\@@notcirc{ocirc}
24115 \fi
24116 \fi
24117 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
24118 \pgf@circ@count@a=\numpins\relax
24119 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
24120 \pgfmathloop%
24121 \ifnum\pgf@circ@count@a>0
24122 % left side pins
24123 \pgf@circ@count@c=\pgf@circ@count@a
24124 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
24125 \ifnum\@@tmp>0\pgfscope
24126 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24127 \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
24128 \endpgfscope\fi
24129 % right side pins
24130 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24131 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
24132 \ifnum\@@tmp>0\pgfscope
24133 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24134 \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
24135 \endpgfscope\fi
24136 \advance\pgf@circ@count@a by -1\relax%
24137 \repeatpgfmathloop
24138 % up side
24139 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
24140 \ifnum\@@tmp>0\pgfscope
24141 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
24142 \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
24143 \endpgfscope\fi
24144 % down side
24145 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
24146 \ifnum\@@tmp>0\pgfscope
24147 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
24148 \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
24149 \endpgfscope\fi
24150 \endpgfscope
24151 }%
24152 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
24153 % and is executed just before a node is drawn.
24154 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
24155 % Start with the maximum pin number and go backwards.
24156 \pgf@circ@count@a=\numpins\relax
24157 \pgfmathloop%
24158 \ifnum\pgf@circ@count@a>0
24159 % we will create two anchors per pin: the "normal one" like `pin 1` for the
24160 % electrical contact, and the "border one" like `bpin 1` for labels.
24161 % they will coincide if `external pins width` is set to 0.
24162 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
24163 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
24164 }
24165 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
24166 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
24167 }
24168 \advance\pgf@circ@count@a by -1\relax%
24169 \repeatpgfmathloop%
24170 }%
24171 }
24172 % %>>>
24173
24174 %% Node shapes for mux-demuxes%<<<
24175
24176 %
24177 % MUX-DEMUXES
24178 %
24179 % Thanks to @marmot
24180 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
24181 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
24182 \tikzset{one bit adder/.style={muxdemux,
24183 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
24184 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
24185 \tikzset{ALU/.style={muxdemux,
24186 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
24187 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
24188
24189 %generic mux-demux shape
24190
24191 % helper macros to set the anchors inside a loop (to expand the current count)
24192 % left
24193 \pgfutil@protected\def\pgf@circ@make@muxdemux@L@anchor#1%
24194 {%
24195 \expandafter\gdef\csname pgf@anchor@muxdemux@lpin #1\endcsname
24196 {%
24197 \pgf@circ@if@num@in@list\pgf@circ@Lpins@list{#1}
24198 {\pgf@circ@muxdemux@L@anchor{#1}{1}}
24199 {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
24200 }%
24201 \expandafter\gdef\csname pgf@anchor@muxdemux@blpin #1\endcsname
24202 {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
24203 }
24204 % right
24205 \pgfutil@protected\def\pgf@circ@make@muxdemux@R@anchor#1%
24206 {%
24207 \expandafter\gdef\csname pgf@anchor@muxdemux@rpin #1\endcsname
24208 {%
24209 \pgf@circ@if@num@in@list\pgf@circ@Rpins@list{#1}
24210 {\pgf@circ@muxdemux@R@anchor{#1}{1}}
24211 {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
24212 }%
24213 \expandafter\gdef\csname pgf@anchor@muxdemux@brpin #1\endcsname
24214 {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
24215 }
24216 % bottom
24217 \pgfutil@protected\def\pgf@circ@make@muxdemux@B@anchor#1%
24218 {%
24219 \expandafter\gdef\csname pgf@anchor@muxdemux@bpin #1\endcsname
24220 {%
24221 \pgf@circ@if@num@in@list\pgf@circ@Bpins@list{#1}
24222 {\pgf@circ@muxdemux@B@anchor{#1}{1}}
24223 {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
24224 }%
24225 \expandafter\gdef\csname pgf@anchor@muxdemux@bbpin #1\endcsname
24226 {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
24227 }
24228 % top
24229 \pgfutil@protected\def\pgf@circ@make@muxdemux@T@anchor#1%
24230 {%
24231 \expandafter\gdef\csname pgf@anchor@muxdemux@tpin #1\endcsname
24232 {%
24233 \pgf@circ@if@num@in@list\pgf@circ@Tpins@list{#1}
24234 {\pgf@circ@muxdemux@T@anchor{#1}{1}}
24235 {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
24236 }%
24237 \expandafter\gdef\csname pgf@anchor@muxdemux@btpin #1\endcsname
24238 {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
24239 }
24240
24241
24242 \pgfdeclareshape{muxdemux}{
24243 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
24244 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
24245 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
24246 % pins on the four sides
24247 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
24248 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
24249 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
24250 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
24251 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
24252 % pin lists
24253 \savedmacro\pgf@circ@Lpins@list
24254 {%
24255 \pgfkeysgetvalue
24256 {\circuitikzbasekey/multipoles/draw only left pins}\pgf@circ@temp
24257 \expandafter\pgf@circ@set@list
24258 \expandafter\pgf@circ@Lpins@list
24259 \expandafter{\pgf@circ@temp}%
24260 }%
24261 \savedmacro\pgf@circ@Rpins@list
24262 {%
24263 \pgfkeysgetvalue
24264 {\circuitikzbasekey/multipoles/draw only right pins}\pgf@circ@temp
24265 \expandafter\pgf@circ@set@list
24266 \expandafter\pgf@circ@Rpins@list
24267 \expandafter{\pgf@circ@temp}%
24268 }%
24269 \savedmacro\pgf@circ@Tpins@list
24270 {%
24271 \pgfkeysgetvalue
24272 {\circuitikzbasekey/multipoles/draw only top pins}\pgf@circ@temp
24273 \expandafter\pgf@circ@set@list
24274 \expandafter\pgf@circ@Tpins@list
24275 \expandafter{\pgf@circ@temp}%
24276 }%
24277 \savedmacro\pgf@circ@Bpins@list
24278 {%
24279 \pgfkeysgetvalue
24280 {\circuitikzbasekey/multipoles/draw only bottom pins}\pgf@circ@temp
24281 \expandafter\pgf@circ@set@list
24282 \expandafter\pgf@circ@Bpins@list
24283 \expandafter{\pgf@circ@temp}%
24284 }%
24285 % topleft and topright sizes
24286 \savedanchor{\topleft}{%
24287 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24288 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
24289 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
24290 }
24291 \savedanchor{\topright}{%
24292 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24293 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
24294 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
24295 }
24296 \savedanchor{\insetnortheast}{%
24297 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24298 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
24299 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
24300 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
24301 }
24302 \saveddimen{\insethright}{
24303 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24304 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
24305 \saveddimen{\extshift}{
24306 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24307 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
24308 \savedanchor{\northwest}{%
24309 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24310 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
24311 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
24312 }
24313 \anchor{nw}{\northwest}
24314 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
24315 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
24316 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
24317 \anchor{north west}{\northwest}
24318 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
24319 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
24320 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
24321 \anchor{n}{\northwest\pgf@x=0pt }
24322 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24323 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24324 \anchor{w}{\northwest\pgf@y=0pt }
24325 \anchor{north}{\northwest\pgf@x=0pt }
24326 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24327 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24328 \anchor{west}{\northwest\pgf@y=0pt }
24329 \anchor{center}{\pgfpointorigin}
24330 \anchor{top right}{\topright}
24331 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
24332 \anchor{right}{\topright\pgf@y=0pt\relax}
24333 \anchor{top left}{\topleft}
24334 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
24335 \anchor{left}{\topleft\pgf@y=0pt\relax}
24336 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
24337 \divide\pgf@y by 2 \pgf@x=0pt\relax}
24338 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
24339 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
24340 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
24341 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
24342 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
24343 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
24344 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
24345 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
24346 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
24347 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
24348 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
24349 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
24350 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
24351 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
24352 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
24353 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
24354 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
24355 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
24356 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
24357 \divide\pgf@y by 2
24358 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
24359 \divide\pgf@y by 2 \pgf@x=0pt\relax}
24360 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
24361 \divide\pgf@y by 2
24362 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
24363 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
24364 \anchor{text}{%
24365 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24366 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
24367 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
24368 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
24369 \pgf@y=-.5\ht\pgfnodeparttextbox%
24370 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
24371 }%
24372 \backgroundpath{%
24373 \topleft
24374 \pgf@circ@res@up = \pgf@y
24375 \pgf@circ@res@down = -\pgf@y
24376 \pgf@circ@res@left = \pgf@x
24377 \topright
24378 \pgf@circ@res@other = \pgf@y
24379 \pgf@circ@res@right = \pgf@x
24380 \insetnortheast
24381 \pgf@circ@res@step = \pgf@x
24382 \pgf@circ@res@temp = \pgf@y
24383 %
24384 % external block
24385 %
24386 \pgfscope% (for the line width)
24387 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
24388 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
24389 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
24390 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
24391 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
24392 % inset, starting down
24393 \ifdim\pgf@circ@res@temp>0pt % inset
24394 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
24395 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
24396 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
24397 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
24398 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
24399 \fi
24400 \pgfpathclose
24401 \pgf@circ@draworfill
24402 \endpgfscope
24403 % now we have to draw the pins, if needed
24404 \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent
24405 % Ok, we have to draw the leads (a.k.a. pins)
24406 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
24407 % We mimic the anchors here --- probably there is a better way
24408 % left pins
24409 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
24410 \pgf@circ@count@a=\NL\relax
24411 \pgf@circ@count@b=\NL \divide\pgf@circ@count@b by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate
24412 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
24413 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
24414 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
24415 % we have to check oddity
24416 \ifodd\NL
24417 \ifnum\NL=1
24418 % only centerpin, step should not be used, but anyway...
24419 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
24420 \else
24421 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
24422 \fi
24423 \else
24424 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
24425 \fi
24426 \else % no inset
24427 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
24428 \fi
24429 \pgfmathloop%
24430 \ifnum\pgf@circ@count@a>0
24431 %%%%% check if we want to draw this pin
24432 \pgf@circ@if@num@in@list\pgf@circ@Lpins@list\pgf@circ@count@a{%
24433 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
24434 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
24435 % for lower pins we have to shift them down
24436 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
24437 \ifodd\NL
24438 % odd number of pins
24439 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
24440 % centerpin!
24441 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
24442 \ifnum\squarepins>0
24443 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
24444 \else
24445 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
24446 \fi
24447 \else
24448 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
24449 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a+1)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
24450 \fi
24451 \else
24452 % even numer of pins: just go down
24453 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
24454 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
24455 \fi
24456 \else
24457 % nothing need for #1<=NL/2
24458 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24459 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24460 \fi
24461 \else
24462 % no inset
24463 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24464 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24465 \fi
24466 %%%%%
24467 }{}% close the pin list check
24468 \advance\pgf@circ@count@a by -1\relax%
24469 \repeatpgfmathloop\fi%
24470 % right pins
24471 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
24472 \pgfmathloop%
24473 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
24474 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
24475 \ifnum\pgf@circ@count@a>0
24476 %%%%% check if we want to draw this pin
24477 \pgf@circ@if@num@in@list\pgf@circ@Rpins@list\pgf@circ@count@a{%
24478 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24479 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24480 }{}%
24481 \advance\pgf@circ@count@a by -1\relax%
24482 \repeatpgfmathloop\fi%
24483 % bottom pins
24484 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
24485 \pgfmathloop%
24486 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
24487 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
24488 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
24489 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step}
24490 \ifnum\pgf@circ@count@a>0
24491 %%%%% check if we want to draw this pin
24492 \pgf@circ@if@num@in@list\pgf@circ@Bpins@list\pgf@circ@count@a{%
24493 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24494 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
24495 \ifnum\squarepins>0
24496 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24497 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
24498 \else
24499 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24500 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
24501 \fi
24502 }{}%
24503 \advance\pgf@circ@count@a by -1\relax%
24504 \repeatpgfmathloop\fi%
24505 % top pins
24506 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
24507 \pgfmathloop%
24508 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
24509 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
24510 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
24511 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@res@down-\pgf@circ@res@up)/(\pgf@circ@res@right-\pgf@circ@res@left)*\pgf@circ@res@step}
24512 \ifnum\pgf@circ@count@a>0
24513 %%%%% check if we want to draw this pin
24514 \pgf@circ@if@num@in@list\pgf@circ@Tpins@list\pgf@circ@count@a{%
24515 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24516 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
24517 \ifnum\squarepins>0
24518 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24519 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
24520 \else
24521 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24522 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
24523 \fi
24524 }{}%
24525 \advance\pgf@circ@count@a by -1\relax%
24526 \repeatpgfmathloop\fi%
24527 % end drawing pins; stroke them
24528 \pgfusepath{stroke}
24529 \endpgfscope\fi\fi
24530 }
24531 % let's start adding anchors
24532 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
24533 % left side anchors
24534 \pgf@circ@count@a=\NL\relax
24535 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
24536 \pgfmathloop%
24537 \ifnum\pgf@circ@count@a>0
24538 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
24539 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
24540 % external leads, and the "border one" like `blpin 1` for internal ones.
24541 % they will coincide if `external pins width` is set to 0.
24542 \expandafter\pgf@circ@make@muxdemux@L@anchor\expandafter{\the\pgf@circ@count@a}%
24543 \advance\pgf@circ@count@a by -1\relax%
24544 \repeatpgfmathloop%
24545 % right anchors
24546 \pgf@circ@count@a=\NR\relax
24547 \pgfmathloop%
24548 \ifnum\pgf@circ@count@a>0
24549 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
24550 % external leads, and the "border one" like `brpin 1` for internal ones.
24551 % they will coincide if `external pins width` is set to 0.
24552 \expandafter\pgf@circ@make@muxdemux@R@anchor\expandafter{\the\pgf@circ@count@a}%
24553 \advance\pgf@circ@count@a by -1\relax%
24554 \repeatpgfmathloop%
24555 % bottom anchors
24556 \pgf@circ@count@a=\NB\relax
24557 \pgfmathloop%
24558 \ifnum\pgf@circ@count@a>0
24559 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
24560 % external leads, and the "border one" like `bbpin 1` for internal ones.
24561 % they will coincide if `external pins width` is set to 0.
24562 \expandafter\pgf@circ@make@muxdemux@B@anchor\expandafter{\the\pgf@circ@count@a}%
24563 \advance\pgf@circ@count@a by -1\relax%
24564 \repeatpgfmathloop%
24565 % top anchors
24566 \pgf@circ@count@a=\NT\relax
24567 \pgfmathloop%
24568 \ifnum\pgf@circ@count@a>0
24569 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
24570 % external leads, and the "border one" like `btpin 1` for internal ones.
24571 % they will coincide if `external pins width` is set to 0.
24572 \expandafter\pgf@circ@make@muxdemux@T@anchor\expandafter{\the\pgf@circ@count@a}%
24573 \advance\pgf@circ@count@a by -1\relax%
24574 \repeatpgfmathloop%
24575 }%
24576 }
24577
24578 %% left anchors for muxdemux
24579
24580 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24581 \topleft
24582 \pgf@xa=\pgf@x
24583 \pgf@ya=\pgf@y
24584 \insetnortheast
24585 \pgf@xb=\pgf@x
24586 \pgf@yb=\pgf@y
24587 \ifnum#1>\NL
24588 \PackageError{circuitikz}{%
24589 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
24590 which has been defined with \NL\space left pins%
24591 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
24592 \fi
24593 \pgf@circ@count@a=\NL \divide\pgf@circ@count@a by 2 % see https://tex.stackexchange.com/questions/146523/why-does-numexpr-integer-division-round-rather-than-truncate
24594 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
24595 \ifnum\NL>1
24596 \ifdim\pgf@yb>0pt % check if we have an inset
24597 % we have to check oddity
24598 \ifodd\NL
24599 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
24600 \else
24601 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
24602 \fi
24603 \else % no inset
24604 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
24605 \fi
24606 \ifdim\pgf@yb>0pt % check if we have an inset
24607 \ifnum#1>\pgf@circ@count@a\relax
24608 % for lower pins we have to shift them down
24609 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
24610 \ifodd\NL
24611 % odd number of pins
24612 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
24613 % centerpin!
24614 \ifnum#2=0\relax
24615 \pgfpoint{\pgf@xb}{0pt}
24616 \else
24617 \ifnum\squarepins>0
24618 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
24619 \else
24620 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
24621 \fi
24622 \fi
24623 \else
24624 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
24625 \fi
24626 \else
24627 % even numer of pins: just go down
24628 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
24629 \fi
24630 \else
24631 % nothing need for #1<=NL/2
24632 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
24633 \fi
24634 \else
24635 % no inset
24636 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
24637 \fi
24638 \else
24639 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
24640 \fi
24641 }
24642
24643 % right anchors
24644 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24645 \topright
24646 \pgf@xa=\pgf@x
24647 \pgf@ya=\pgf@y
24648 \ifnum#1>\NR
24649 \PackageError{circuitikz}{%
24650 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
24651 which has been defined with \NR\space right pins%
24652 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
24653 \fi
24654 \ifnum\NR>1
24655 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
24656 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
24657 \else
24658 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
24659 \fi
24660 }
24661
24662 % bottom anchors
24663 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24664 \topleft
24665 \pgf@xa=\pgf@x
24666 \pgf@ya=\pgf@y
24667 \topright
24668 \pgf@xb=\pgf@x
24669 \pgf@yb=\pgf@y
24670 \ifnum#1>\NB
24671 \PackageError{circuitikz}{%
24672 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
24673 which has been defined with \NB\space bottom pins%
24674 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
24675 \fi
24676 \ifnum\NB>0
24677 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
24678 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
24679 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
24680 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
24681 \ifnum#2=0\relax
24682 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
24683 \else
24684 \ifnum\squarepins>0\relax
24685 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
24686 \else
24687 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
24688 \fi
24689 \fi
24690 \else
24691 % should not happen, give the same as pin 1 anyway
24692 \ifnum#2=0\relax
24693 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
24694 \else
24695 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
24696 \fi
24697 \fi
24698 }
24699
24700 % top anchors
24701 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24702 \topleft
24703 \pgf@xa=\pgf@x
24704 \pgf@ya=\pgf@y
24705 \topright
24706 \pgf@xb=\pgf@x
24707 \pgf@yb=\pgf@y
24708 \ifnum#1>\NT
24709 \PackageError{circuitikz}{%
24710 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
24711 which has been defined with \NT\space top pins%
24712 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
24713 \fi
24714 \ifnum\NT>0
24715 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
24716 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
24717 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
24718 \ifnum#2=0\relax
24719 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
24720 \else
24721 \ifnum\squarepins>0
24722 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
24723 \else
24724 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
24725 \fi
24726 \fi
24727 \else
24728 % should not happen, give the same as pin 1 anyway
24729 \ifnum#2=0\relax
24730 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
24731 \else
24732 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
24733 \fi
24734 \fi
24735 }
24736 % %>>>
24737
24738 % vim: set fdm=marker fmr=%<<<,%>>>:
24739 %%%---------- close: tex/pgfcircmultipoles
24740
24741 %%%%%%%%%%% Springe nach tex/pgfcirclabel
24742 %%%---------- open: tex/pgfcirclabel.tex
24743 % Copyright 2018-2026 by Romano Giannetti
24744 % Copyright 2015-2026 by Stefan Lindner
24745 % Copyright 2013-2026 by Stefan Erhardt
24746 % Copyright 2007-2026 by Massimo Redaelli
24747 %
24748 % This file may be distributed and/or modified
24749 %
24750 % 1. under the LaTeX Project Public License and/or
24751 % 2. under the GNU Public License.
24752 %
24753 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
24754
24755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24756 %% Bipole label positioning
24757
24758 %% bipole labels and annotation extra style
24759
24760 \ctikzset{bipole label style/.style={}}
24761 \tikzset{bipole label style/.code={
24762 \ctikzset{bipole label style/.style={#1}}
24763 }}
24764 \tikzset{bipole label append style/.code={
24765 \ctikzset{bipole label style/.append style={#1}}
24766 }}
24767 \ctikzset{bipole annotation style/.style={}}
24768 \tikzset{bipole annotation style/.code={
24769 \ctikzset{bipole annotation style/.style={#1}}
24770 }}
24771 \tikzset{bipole annotation append style/.code={
24772 \ctikzset{bipole annotation style/.append style={#1}}
24773 }}
24774
24775 \ctikzset{label distance/.initial={0pt}}
24776 \ctikzset{annotation distance/.initial={0pt}}
24777
24778 %% Options
24779 \ctikzset{label/.style = { l={#1} } }
24780 \ctikzset{l/.code = {
24781 \pgfkeys{/tikz/circuitikz/bipole/label/name={#1}}
24782 \ctikzsetvalof{bipole/label/unit}{}
24783 \ifpgf@circ@siunitx
24784 \pgf@circ@handleSI{#1}
24785 \ifpgf@circ@siunitx@res
24786 \edef\pgf@temp{\pgf@circ@handleSI@val}
24787 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
24788 \edef\pgf@temp{\pgf@circ@handleSI@unit}
24789 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
24790 \else
24791 \fi
24792 \else
24793 \fi
24794 }}
24795
24796 \ctikzset{label above/.code = {
24797 l={#1},
24798 \circuitikzbasekey/bipole/label/position=90 }
24799 }
24800
24801 \ctikzset{l^/.style = {
24802 l={#1},
24803 \circuitikzbasekey/bipole/label/position=90 }
24804 }
24805
24806 \ctikzset{label below/.code = {
24807 l={#1},
24808 \circuitikzbasekey/bipole/label/position=-90 }
24809 }
24810
24811 \ctikzset{l_/.style = {
24812 l={#1},
24813 \circuitikzbasekey/bipole/label/position=-90 }
24814 }
24815
24816 \ctikzset{annotation/.style = { a={#1} } }
24817 \ctikzset{a/.code = {
24818 \pgfkeys{/tikz/circuitikz/bipole/annotation/name={#1}}
24819 \ctikzsetvalof{bipole/annotation/unit}{}
24820 \ifpgf@circ@siunitx
24821 \pgf@circ@handleSI{#1}
24822 \ifpgf@circ@siunitx@res
24823 \edef\pgf@temp{\pgf@circ@handleSI@val}
24824 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
24825 \edef\pgf@temp{\pgf@circ@handleSI@unit}
24826 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
24827 \else
24828 \fi
24829 \else
24830 \fi
24831 }}
24832
24833 \ctikzset{annotation above/.code = {
24834 a={#1},
24835 \circuitikzbasekey/bipole/annotation/position=90 }
24836 }
24837
24838 \ctikzset{a^/.style = {
24839 a={#1},
24840 \circuitikzbasekey/bipole/annotation/position=90 }
24841 }
24842
24843 \ctikzset{annotation below/.code = {
24844 a={#1},
24845 \circuitikzbasekey/bipole/annotation/position=-90 }
24846 }
24847 \ctikzset{a_/.style = {
24848 a={#1},
24849 \circuitikzbasekey/bipole/annotation/position=-90 }
24850 }
24851
24852 % This is to adjust spacing for the labels so that they are not cramped on components
24853 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
24854
24855 \def\pgf@circ@drawlabels#1{
24856 \pgfextra{
24857 % This function will be called with argument #1 equal
24858 % to "label" or "annotation" form pgfcircpath.tex.
24859 % pgf@circ@direction is the direction of the path,
24860 % its value is set in pgfcircpath.tex
24861 \pgfmathsubtract{\pgf@circ@direction}{90}
24862 \pgfmathround{\pgfmathresult} % avoid precision loss errors
24863 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24864
24865 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
24866 \ifnum \pgf@circ@temp < 0
24867 \pgfmathadd{\pgf@circ@labanc}{180}
24868 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24869 \fi
24870 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
24871 %
24872 % normalize the angle values
24873 %
24874 \pgfmathmod{\pgf@circ@labanc}{360}
24875 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24876 %
24877 \ifpgf@circuit@bipole@inverted
24878 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
24879 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24880 \fi
24881 %
24882 \ifnum \ctikzvalof{mirror value} = -1
24883 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
24884 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24885 \fi
24886 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
24887 }
24888 %Firstly, place a coordinate directly at the edge of the shape
24889 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (pgfcirc@labelcoor)
24890 %now decide, which labels should be drawn
24891 \pgfextra{
24892 \edef\pgf@temp{\ctikzvalof{label/align}}
24893 \def\pgf@circ@temp{straight}
24894 }
24895 \ifx\pgf@temp\pgf@circ@temp %straight
24896 \pgf@circ@drawreglabels{#1}
24897 \else
24898 \pgfextra{\def\pgf@circ@temp{rotate}}
24899 \ifx\pgf@temp\pgf@circ@temp %rotate
24900 \pgf@circ@drawrotlabels{#1}
24901 \else% smart
24902 \pgf@circ@drawsmartlabels{#1}
24903 \fi
24904 \fi
24905 }
24906
24907
24908 \def\pgf@circ@drawsmartlabels#1{
24909 \pgfextra{
24910 \pgfmathmod{\pgf@circ@direction}{90}
24911 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24912 }
24913 \ifnum \pgfcircmathresult > 20
24914 \ifnum \pgfcircmathresult < 70
24915 \pgf@circ@drawrotlabels{#1}
24916 \else
24917 \pgf@circ@drawreglabels{#1}
24918 \fi
24919 \else
24920 \pgf@circ@drawreglabels{#1}
24921 \fi
24922 }
24923
24924
24925 \def\pgf@circ@drawrotlabels#1{
24926 \pgfextra{
24927 % scale the distances in function of zoom, so that they are not
24928 % dependent on it but on font size. Thanks to @marmot
24929 % https://tex.stackexchange.com/a/476018/38080
24930 % the coefficient is adjusted so that the distance is more or less
24931 % the same for rotated labels and straight ones (although it will
24932 % depend on the font, so it's not exact).
24933 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
24934 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
24935 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
24936 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale}
24937 \ifnum \ctikzvalof{bipole/#1/position}>0
24938 %we need some more space for placement below, due to mid-anchor
24939 \else % we do not have <= in \ifnum...
24940 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
24941 \fi
24942 %Calculate rotation of the label from direction and strip decimals
24943 \pgfmathsetmacro{\pgfcirclabrot}{round(\pgf@circ@direction)}
24944 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfcirclabrot\pgf@nil}
24945 % rotate the label at second or third quadrant:
24946 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
24947 \pgfmathsubtract{\pgf@circ@direction}{180}
24948 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24949 %invert the space relationships due to rotated strings
24950 \ifnum \ctikzvalof{bipole/#1/position}>0
24951 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
24952 \fi
24953 \fi\fi
24954 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}%
24955 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}%
24956 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{\pgfcirclabrot}%
24957 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{mid}%
24958 }
24959 % reset cm is not working correctly here
24960 % relative ++ movement disrupt to[] +()
24961 ($(pgfcirc@labelcoor)+(\pgf@circ@labposangle:\the\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
24962 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
24963 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
24964 }
24965
24966 \def\pgf@circ@drawreglabels#1{
24967 %Now calculate all shape positions
24968 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
24969 %All points between will be addressed by angled-anchors:
24970 \pgfextra{
24971 % scale ex-distance to make it independent on scale
24972 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
24973 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
24974 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
24975 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
24976 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale}
24977 \pgfmathadd{\pgf@circ@labanc}{90}
24978 \pgfmathround{\pgfmathresult}
24979 \def\pgf@circ@labanctext{\pgf@circ@labanc}
24980 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24981 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
24982 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24983 }
24984 %Values around 90 are at both y-axis
24985 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
24986 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
24987 \ifnum \pgf@circ@labpos > 180
24988 \ifnum \ctikzvalof{bipole/#1/position} > 0
24989 \pgfextra{\def\pgf@circ@labanctext{mid west}}
24990 \else
24991 \pgfextra{\def\pgf@circ@labanctext{mid east}}
24992 \fi
24993 \else
24994 \ifnum \ctikzvalof{bipole/#1/position} > 0
24995 \pgfextra{\def\pgf@circ@labanctext{mid east}}
24996 \else
24997 \pgfextra{\def\pgf@circ@labanctext{mid west}}
24998 \fi
24999 \fi
25000 \fi\fi
25001 %Values between -5 and 5 are at pos /neg x-axis
25002 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
25003 \ifnum \ctikzvalof{bipole/#1/position} < 0
25004 \ifnum \pgf@circ@labanc > 90
25005 % using base coordinate instead of south to naturally align
25006 % symbols with descendants; but this invalidate the effect of
25007 % the inner sep, so recover it by shifting the anchor
25008 % reset cm is not working sometime, use @marmot solution
25009 % see https://tex.stackexchange.com/a/476018/38080
25010 % notice that relative ++ movement disrupt to[] +()
25011 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
25012 \pgfextra{\def\pgf@circ@labanctext{base}}%base
25013 \else
25014 \pgfextra{\def\pgf@circ@labanctext{north}}%north
25015 \fi
25016 \else
25017 \ifnum \pgf@circ@labanc < 90
25018 % shift, as above
25019 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
25020 \pgfextra{\def\pgf@circ@labanctext{base}}%base
25021 \else
25022 \ifnum \pgf@circ@labanc > 180
25023 % this shouldn't happen, but somehow it does (270 degree anchors)
25024 % shift, as above
25025 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
25026 \pgfextra{\def\pgf@circ@labanctext{base}}%base
25027 \else
25028 \pgfextra{\def\pgf@circ@labanctext{north}}%north
25029 \fi
25030 \fi
25031 \fi
25032 \fi\fi
25033 \pgfextra{%
25034 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{0}%
25035 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{\pgf@circ@labanctext}%
25036 }
25037 (pgfcirc@labelcoor) node[anchor=\pgf@circ@labanctext,
25038 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
25039 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
25040 }
25041 }
25042
25043 \def\pgf@circ@finallabels#1{%
25044 \edef\pgf@temp{}%
25045 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
25046 \ifx\pgf@temp\pgf@circ@temp%
25047 \ctikzvalof{bipole/#1/name}%
25048 \else%
25049 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
25050 \fi%
25051 }
25052
25053
25054 %%%% Stacked labels
25055 %
25056 % stacked labels by Romano Giannetti [email protected]
25057 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
25058 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
25059 %
25060 % labels are in a tabular, globally aligned:
25061 % vertically with key l2 valign (default c)
25062 % c: center t: top b: bottom
25063 % horizontally with key l2 align (default l)
25064 % l: left c: centered r: right
25065 % you can switch sides using l2_=... and l2^=...
25066 % syntax is l2_ = line1 and line2 (same for l2^)
25067 %
25068 \ctikzset{%
25069 l2 valign/.store in=\pgfcirc@ltwo@valign, l2 valign=c,
25070 l2 halign/.store in=\pgfcirc@ltwo@halign, l2 halign=l,
25071 }
25072 \ctikzset{l2base/.code n args={2}{
25073 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
25074 \bgroup
25075 \setlength{\tabcolsep}{2pt}%
25076 \def\pgfcirc@ltwo@tabu{\tabular[\pgfcirc@ltwo@valign]}%
25077 \expandafter\pgfcirc@ltwo@tabu\expandafter{\pgfcirc@ltwo@halign}%
25078 #1\\ #2%
25079 \endtabular
25080 \egroup
25081 }%
25082 }}
25083 \ctikzset{l2/.style args={#1and#2}{
25084 l2base={#1}{#2},
25085 \circuitikzbasekey/bipole/label/position=90 }
25086 }
25087 \ctikzset{l2 above/.style args={#1and#2}{
25088 l2base={#1}{#2},
25089 \circuitikzbasekey/bipole/label/position=90 }
25090 }
25091 \ctikzset{l2^/.style args={#1and#2}{
25092 l2base={#1}{#2},
25093 \circuitikzbasekey/bipole/label/position=90 }
25094 }
25095 \ctikzset{l2 below/.style args={#1and#2}{
25096 l2base={#1}{#2},
25097 \circuitikzbasekey/bipole/label/position=-90 }
25098 }
25099 \ctikzset{l2_/.style args={#1and#2}{
25100 l2base={#1}{#2},
25101 \circuitikzbasekey/bipole/label/position=-90 }
25102 }
25103 %
25104 % the same for annotations
25105 %
25106 \ctikzset{%
25107 a2 valign/.store in=\pgfcirc@atwo@valign, a2 valign=c,
25108 a2 halign/.store in=\pgfcirc@atwo@halign, a2 halign=r,
25109 }
25110 \ctikzset{a2base/.code n args={2}{
25111 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=%
25112 \bgroup
25113 \setlength{\tabcolsep}{2pt}%
25114 \def\pgfcirc@atwo@tabu{\tabular[\pgfcirc@atwo@valign]}%
25115 \expandafter\pgfcirc@atwo@tabu\expandafter{\pgfcirc@atwo@halign}%
25116 #1\\ #2%
25117 \endtabular
25118 \egroup
25119 }%
25120 }}
25121 \ctikzset{a2/.style args={#1and#2}{
25122 a2base={#1}{#2},
25123 \circuitikzbasekey/bipole/annotation/position=-90 }
25124 }
25125 \ctikzset{a2 above/.style args={#1and#2}{
25126 a2base={#1}{#2},
25127 \circuitikzbasekey/bipole/annotation/position=-90 }
25128 }
25129 \ctikzset{a2^/.style args={#1and#2}{
25130 a2base={#1}{#2},
25131 \circuitikzbasekey/bipole/annotation/position=-90 }
25132 }
25133 \ctikzset{a2 below/.style args={#1and#2}{
25134 a2base={#1}{#2},
25135 \circuitikzbasekey/bipole/annotation/position=90 }
25136 }
25137 \ctikzset{a2_/.style args={#1and#2}{
25138 a2base={#1}{#2},
25139 \circuitikzbasekey/bipole/annotation/position=90 }
25140 }
25141
25142 %%%---------- close: tex/pgfcirclabel
25143 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
25144 %%%---------- open: tex/pgfcircvoltage.tex
25145 % Copyright 2018-2026 by Romano Giannetti
25146 % Copyright 2015-2026 by Stefan Lindner
25147 % Copyright 2013-2026 by Stefan Erhardt
25148 % Copyright 2007-2026 by Massimo Redaelli
25149 %
25150 % This file may be distributed and/or modified
25151 %
25152 % 1. under the LaTeX Project Public License and/or
25153 % 2. under the GNU Public License.
25154 %
25155 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
25156
25157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25158 %% Voltage management
25159
25160 %% styles%<<<
25161 \ctikzset{bipole voltage style/.style={}}
25162 \tikzset{bipole voltage style/.code={
25163 \ctikzset{bipole voltage style/.style={#1}}
25164 }}
25165 \tikzset{bipole voltage append style/.code={
25166 \ctikzset{bipole voltage style/.append style={#1}}
25167 }}
25168
25169 \ctikzset{v^>/.style = {
25170 v={#1},
25171 \circuitikzbasekey/bipole/voltage/direction = forward,
25172 \circuitikzbasekey/bipole/voltage/position = above
25173 }
25174 }
25175
25176 \ctikzset{v^</.style = {
25177 v={#1},
25178 \circuitikzbasekey/bipole/voltage/direction = backward,
25179 \circuitikzbasekey/bipole/voltage/position = above
25180 }
25181 }
25182
25183 \ctikzset{v_>/.style = {
25184 v={#1},
25185 \circuitikzbasekey/bipole/voltage/direction = forward,
25186 \circuitikzbasekey/bipole/voltage/position = below
25187 }
25188 }
25189
25190 \ctikzset{v_</.style = {
25191 v={#1},
25192 \circuitikzbasekey/bipole/voltage/direction = backward,
25193 \circuitikzbasekey/bipole/voltage/position = below
25194 }
25195 }
25196
25197 \ctikzset{v_/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = below} }
25198 \ctikzset{v^/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = above} }
25199 \ctikzset{v>/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward} }
25200 \ctikzset{v</.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = backward} }%
25201
25202 \newif\ifpgfcirc@do@v@symbols\pgfcirc@do@v@symbolstrue
25203 \ctikzset{no v symbols/.code={\pgfcirc@do@v@symbolsfalse}}
25204 \ctikzset{v symbols/.code={\pgfcirc@do@v@symbolstrue}}
25205
25206 % Default position varies whether the component is a voltage source
25207 % or not
25208 \ctikzset{v/.code = {
25209 \pgfcirc@has@vtrue
25210 \ifpgf@circuit@bipole@override@source@vif
25211 \pgf@circuit@bipole@isvoltagefalse
25212 \pgf@circuit@bipole@iscurrentfalse
25213 \fi
25214 \ifpgf@circuit@bipole@isvoltage
25215 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
25216 \circuitikzbasekey/bipole/voltage/direction=forward}
25217 \else
25218 \ifpgf@circ@oldvoltagedirection
25219 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
25220 \circuitikzbasekey/bipole/voltage/direction=backward}
25221 \else
25222 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
25223 \circuitikzbasekey/bipole/voltage/direction=forward}
25224 \fi
25225 \fi
25226 \ifpgf@circ@oldvoltagedirection
25227 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
25228 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
25229 \circuitikzbasekey/bipole/voltage/direction=forward}
25230 \fi\fi
25231 \else
25232 \ifpgf@circuit@bipole@iscurrent
25233 \ifpgf@circuit@bipole@current@backward
25234 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
25235 \circuitikzbasekey/bipole/voltage/direction=forward}
25236 \else
25237 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
25238 \circuitikzbasekey/bipole/voltage/direction=backward}
25239 \fi\fi\fi
25240 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name={#1}}
25241 \ctikzsetvalof{bipole/voltage/label/unit}{}
25242 \ifpgf@circ@siunitx
25243 \pgf@circ@handleSI{#1}
25244 \ifpgf@circ@siunitx@res
25245 \edef\pgf@temp{\pgf@circ@handleSI@val}
25246 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
25247 \edef\pgf@temp{\pgf@circ@handleSI@unit}
25248 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
25249 \else
25250 \fi
25251 \else
25252 \fi
25253 }
25254 }
25255 % %>>>
25256
25257 % american voltage font selection and symbol definition
25258 % the default font command is {} --- nothing
25259 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
25260 %
25261 % plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex)
25262 %
25263 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
25264 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
25265
25266 %%
25267 \def\setscaledRlenforclass{%
25268 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
25269 \ifdefined\ctikzclass
25270 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
25271 \pgfkeysifdefined{\pgf@temp}
25272 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25273 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
25274 \else
25275 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
25276 \fi
25277 }
25278
25279 %% Output routine for generic bipoles%<<<
25280 % put this to true to see the voltage label coordinate anchors
25281 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
25282
25283 \def\pgf@circ@drawvoltagegeneric{
25284 \pgfextra{
25285 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
25286 \ifnum \ctikzvalof{mirror value}=-1
25287 \ifpgf@circuit@bipole@inverted
25288 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
25289 \else
25290 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
25291 \fi
25292 \else
25293 \ifpgf@circuit@bipole@inverted
25294 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
25295 \else
25296 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
25297 \fi
25298 \fi
25299 \ifpgf@circuit@bipole@voltage@below
25300 \def\pgf@circ@voltage@angle{90}
25301 \else
25302 \def\pgf@circ@voltage@angle{-90}
25303 \fi
25304 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
25305 \pgfkeysifdefined{\pgf@temp}
25306 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
25307 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
25308 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
25309 \pgfkeysifdefined{\pgf@temp}
25310 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
25311 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
25312 \edef\shiftv{\ctikzvalof{voltage/shift}}
25313 % additional per-bipole voltage shift (internal)
25314 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
25315 \pgfkeysifdefined{\pgf@temp}
25316 {
25317 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
25318 }
25319 {
25320 \edef\addvshift{0}
25321 }
25322 \newdimen{\absvshift}
25323 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
25324 % reset anchor if american and open
25325 \ifpgf@circuit@europeanvoltage
25326 \else
25327 \ifx\@@kind\@@open
25328 \def\pgf@circ@bipole@voltage@label@anchor{center}
25329 \fi
25330 \fi
25331 \ifpgf@circuit@bipole@voltage@raised
25332 \def\pgf@circ@bipole@voltage@label@anchor{center}
25333 \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
25334 \fi
25335 }
25336 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
25337 %absolute move, minimum space is length of arrowhead
25338 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorstartnode)$)
25339 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorstartnode)$)
25340 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
25341 %absolute move, minimum space is length of arrowhead
25342 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorendnode)$)
25343 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorendnode)$)
25344 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
25345 coordinate (pgfcirc@mid) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
25346
25347 \ifpgf@circuit@bipole@voltage@below
25348 % see comments for the "above" part (similar)
25349 \ifpgf@circuit@europeanvoltage
25350 \ifpgf@circuit@bipole@voltage@straight
25351 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
25352 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
25353 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vto@flat)$)
25354 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!90 : (pgfcirc@Vfrom1)$)
25355 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!-90 : (pgfcirc@Vto1)$)
25356 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
25357 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
25358 \else
25359 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
25360 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
25361 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
25362 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
25363 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
25364 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
25365 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
25366 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
25367 \fi
25368 \else
25369 % we are in case of american here
25370 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
25371 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
25372 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
25373 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
25374 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@bottom) ! \absvshift!-90 : (pgfcirc@Vdir0)$)
25375 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
25376 \ifpgf@circuit@bipole@voltage@raised
25377 % move the from and to up to the level of Vlab
25378 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
25379 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
25380 \fi
25381 \fi
25382 \else
25383 \ifpgf@circuit@europeanvoltage
25384 \ifpgf@circuit@bipole@voltage@straight
25385 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
25386 % move parallel to the component line at pgfcirc@top distance
25387 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
25388 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vto@flat)$)
25389 % add the extra distance
25390 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!-90 : (pgfcirc@Vfrom1)$)
25391 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!90 : (pgfcirc@Vto1)$)
25392 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
25393 % direction line to shift the label later
25394 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
25395 \else
25396 % european voltages here
25397 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (pgfcirc@anchorendnode)$)
25398 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (pgfcirc@anchorstartnode)$)
25399 % identify the two control points for the "arc" of the voltage
25400 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
25401 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
25402 % and shift them a bit
25403 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
25404 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
25405 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
25406 % direction line to shift the label later
25407 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
25408 \fi
25409 \else
25410 % we are in case of american here
25411 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!-90 : (pgfcirc@anchorendnode)$)
25412 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!90 : (pgfcirc@anchorstartnode)$)
25413 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
25414 % move parallel to the component line
25415 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
25416 % and add the extra distance
25417 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@top) ! \absvshift!90 : (pgfcirc@Vdir0)$)
25418 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
25419 \ifpgf@circuit@bipole@voltage@raised
25420 % move the from and to up to the level of Vlab
25421 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
25422 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
25423 \fi
25424 \fi
25425 \fi
25426 \ifx\@@kind\@@open
25427 coordinate (\pgfcirc@a@prefix-Vto) at (pgfcirc@Vto@flat)
25428 coordinate (\pgfcirc@a@prefix-Vfrom) at (pgfcirc@Vfrom@flat)
25429 \fi
25430 \ifpgf@circ@debugv
25431 node [ocirc, fill=red] at (pgfcirc@anchorstartnode) {}
25432 node [ocirc, fill=blue] at (pgfcirc@anchorendnode) {}
25433 node [ocirc, fill=green] at (\pgfcirc@a@prefix-Vto) {}
25434 node [ocirc, fill=yellow] at (\pgfcirc@a@prefix-Vfrom) {}
25435 node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {}
25436 node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {}
25437 \ifpgf@circuit@europeanvoltage
25438 \ifpgf@circuit@bipole@voltage@straight
25439 \else
25440 node [osquarepole, fill=red] at (\pgfcirc@a@prefix-Vcont1) {}
25441 node [osquarepole, fill=blue] at (\pgfcirc@a@prefix-Vcont2) {}
25442 \fi
25443 \fi
25444 \fi
25445
25446 %
25447 % Now we draw the voltage things (only if not empty --- in which case we have been
25448 % called just to set the anchors)
25449 %
25450 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
25451 \ifpgfcirc@do@v@symbols
25452 \ifpgf@circuit@europeanvoltage
25453 \ifpgf@circuit@bipole@voltage@straight
25454 \ifpgf@circuit@bipole@voltage@backward
25455 (\pgfcirc@a@prefix-Vto) --(\pgfcirc@a@prefix-Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
25456 \else
25457 (\pgfcirc@a@prefix-Vfrom) --(\pgfcirc@a@prefix-Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
25458 \fi
25459 \else
25460 \ifpgf@circuit@bipole@voltage@backward
25461 (\pgfcirc@a@prefix-Vto) .. controls (\pgfcirc@a@prefix-Vcont2) and (\pgfcirc@a@prefix-Vcont1) ..
25462 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
25463 (\pgfcirc@a@prefix-Vfrom)
25464 \else
25465 (\pgfcirc@a@prefix-Vfrom) .. controls (\pgfcirc@a@prefix-Vcont1) and (\pgfcirc@a@prefix-Vcont2) ..
25466 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
25467 (\pgfcirc@a@prefix-Vto)
25468 \fi
25469 \fi
25470 \else % american
25471 \ifpgf@circuit@bipole@voltage@backward
25472 \ifpgf@circ@oldvoltagedirection
25473 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
25474 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
25475 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
25476 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
25477 \else
25478 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
25479 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
25480 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
25481 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
25482 \fi
25483 \else
25484 \ifpgf@circ@oldvoltagedirection
25485 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
25486 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
25487 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
25488 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
25489 \else
25490 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
25491 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
25492 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
25493 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
25494 \fi
25495 \fi
25496 \fi
25497 \fi % closing the ...symbol
25498 \fi % Closing the ...ifempty
25499 }
25500 % %>>>
25501
25502 %% Output routine for voltage sources%<<<
25503 \def\pgf@circ@drawvoltagegenerator{
25504 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
25505 % it's not perfect, but I can't find the way to do it correctly...
25506 \pgfextra{
25507 \edef\shiftv{\ctikzvalof{voltage/shift}}
25508 % distance along the 60-120 axis
25509 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}
25510 \pgfkeysifdefined{\pgf@temp}
25511 {
25512 \edef\bumpa{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}}
25513 }
25514 {
25515 \edef\bumpa{\ctikzvalof{voltage/bump a}}
25516 }
25517 % additional per-bipole voltage shift (internal)
25518 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
25519 \pgfkeysifdefined{\pgf@temp}
25520 {
25521 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
25522 }
25523 {
25524 \edef\addvshift{0}
25525 }
25526 \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
25527 }
25528 \ifpgf@circuit@bipole@voltage@below
25529 coordinate (pgfcirc@Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
25530 coordinate (pgfcirc@Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
25531 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! -90: (pgfcirc@Vto0) $)
25532 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! 90: (pgfcirc@Vfrom0) $)
25533 \else
25534 coordinate (pgfcirc@Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
25535 coordinate (pgfcirc@Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
25536 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! 90: (pgfcirc@Vto0) $)
25537 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! -90: (pgfcirc@Vfrom0) $)
25538 \fi
25539 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
25540 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
25541 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
25542 \ifpgfcirc@do@v@symbols
25543 \ifpgf@circuit@europeanvoltage
25544 \ifpgf@circuit@bipole@voltage@backward
25545 (\pgfcirc@a@prefix-Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vfrom)
25546 \else
25547 (\pgfcirc@a@prefix-Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vto)
25548 \fi
25549 \else% american voltage
25550 \ifpgf@circuit@bipole@voltageoutsideofsymbol
25551 % if it is a battery, must put + and -
25552
25553 \ifpgf@circ@fixbatteries
25554 \ifpgf@circuit@bipole@voltage@backward
25555 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
25556 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
25557 \else
25558 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
25559 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
25560 \fi
25561 \else
25562 \ifpgf@circuit@bipole@voltage@backward
25563 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
25564 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
25565 \else
25566 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
25567 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
25568 \fi
25569 \fi
25570 \fi
25571 \fi
25572 \fi % closes ... ifsymbol
25573 \fi % closes ...ifempty
25574 }
25575 % %>>>
25576
25577 %% Output routine (main entry point) %<<<
25578 %% this is the entry point
25579 %%
25580 %% locally used dimensions
25581 \newdimen{\pgfcirc@labelshift}
25582 \newif\ifpgfcirc@v@curved % helper if --- true only if voltages are curved
25583 \def\pgf@circ@drawvoltage{% node name
25584 \pgfextra{%
25585 % set the helper if...curved
25586 \ifpgf@circuit@europeanvoltage
25587 \ifpgf@circuit@bipole@voltage@straight
25588 \pgfcirc@v@curvedfalse
25589 \else
25590 \pgfcirc@v@curvedtrue
25591 \fi
25592 \else
25593 \pgfcirc@v@curvedfalse
25594 \fi
25595 % \typeout{V routine called with prefix: \pgfcirc@a@prefix}
25596 % Label anchors WARNING: indentation is probably wrong
25597 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
25598 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
25599 \ifpgf@circuit@bipole@voltage@below
25600 \def\pgf@circ@bipole@voltage@label@anchor{north west}
25601 \else
25602 \def\pgf@circ@bipole@voltage@label@anchor{south east}
25603 \fi
25604 \fi\fi
25605 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
25606 \ifpgf@circuit@bipole@voltage@below
25607 \def\pgf@circ@bipole@voltage@label@anchor{west}
25608 \else
25609 \def\pgf@circ@bipole@voltage@label@anchor{east}
25610 \fi
25611 \fi\fi
25612 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
25613 \ifpgf@circuit@bipole@voltage@below
25614 \def\pgf@circ@bipole@voltage@label@anchor{south west}
25615 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
25616 \fi
25617 \fi\fi
25618 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
25619 \ifpgf@circuit@bipole@voltage@below
25620 \def\pgf@circ@bipole@voltage@label@anchor{south}
25621 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
25622 \fi
25623 \fi\fi
25624 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
25625 \ifpgf@circuit@bipole@voltage@below
25626 \def\pgf@circ@bipole@voltage@label@anchor{south east}
25627 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
25628 \fi
25629 \fi\fi
25630 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
25631 \ifpgf@circuit@bipole@voltage@below
25632 \def\pgf@circ@bipole@voltage@label@anchor{east}
25633 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
25634 \fi
25635 \fi\fi
25636 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
25637 \ifpgf@circuit@bipole@voltage@below
25638 \def\pgf@circ@bipole@voltage@label@anchor{north east}
25639 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
25640 \fi
25641 \fi\fi
25642 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
25643 \ifpgf@circuit@bipole@voltage@below
25644 \def\pgf@circ@bipole@voltage@label@anchor{north}
25645 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
25646 \fi
25647 \fi\fi
25648 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
25649 \ifpgf@circuit@bipole@voltage@below
25650 \def\pgf@circ@bipole@voltage@label@anchor{north}
25651 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
25652 \fi
25653 \fi\fi
25654
25655 % export anchor position (if not needed, is always the same macro)
25656 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor}
25657 % this must be set *before* changing for mirroring and inverting; in that case
25658 % the xscale/yscale parameters take it into account
25659 \ifpgf@circuit@bipole@voltage@below
25660 \def\pgf@circ@bipole@voltage@label@where{-90}
25661 \else
25662 \def\pgf@circ@bipole@voltage@label@where{90}
25663 \fi
25664
25665 % magic to counteract the scale and yscale effects (there should be a better way...)
25666 \ifnum \ctikzvalof{mirror value}=-1
25667 \ifpgf@circuit@bipole@voltage@below
25668 \pgf@circuit@bipole@voltage@belowfalse
25669 \else
25670 \pgf@circuit@bipole@voltage@belowtrue
25671 \fi
25672 \fi
25673
25674 \ifpgf@circuit@bipole@inverted
25675 \ifpgf@circuit@bipole@voltage@below
25676 \pgf@circuit@bipole@voltage@belowfalse
25677 \else
25678 \pgf@circuit@bipole@voltage@belowtrue
25679 \fi
25680 \fi
25681
25682 % take into account scaling
25683 \setscaledRlenforclass
25684 % set the macro for detecting open
25685 \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
25686 % start voltage label adjustment
25687 \ifpgf@circuit@europeanvoltage
25688 \ifpgf@circuit@bipole@voltage@straight
25689 % check for straight
25690 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
25691 \pgfkeysifdefined{\pgf@temp}{%
25692 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}%
25693 % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist}
25694 }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}}
25695 \ifpgf@circ@debugv\edef\whichtypeshift{STR}\fi
25696 % do not labelshift for legacy straight open; 1.4 makes the shift null
25697 \ifx\@@kind\@@open\ifpgf@adjust@open@voltage\else\edef\labeldist{1.4}\fi\fi
25698 \else
25699 % check for european
25700 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
25701 \pgfkeysifdefined{\pgf@temp}{%
25702 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}%
25703 % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist}
25704 }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}}
25705 \ifpgf@circ@debugv\edef\whichtypeshift{EUR}\fi
25706 \fi
25707 \else
25708 % check for american
25709 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}
25710 \pgfkeysifdefined{\pgf@temp}{%
25711 \ifpgf@circuit@bipole@voltage@raised
25712 % do not apply the shift if we are using raised american style
25713 \edef\labeldist{1.4}% default value
25714 \else
25715 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
25716 \fi
25717 % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist}
25718 }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}}
25719 \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi
25720 \fi
25721 % find the height of the bipole or use a default value
25722 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
25723 \pgfkeysifdefined{\pgf@temp}
25724 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
25725 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
25726 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
25727 \ifpgf@circuit@bipole@isvoltage
25728 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.2)*\partheight}
25729 \else
25730 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.4)*\partheight}
25731 \fi
25732 % the value for the european was by default 1.4
25733 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
25734 % stop the detection of open if I do not want special treatment
25735 \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi
25736 % \typeout{KIND\space\@@kind}
25737 }%end pgfextra
25738
25739 \ifpgf@circuit@bipole@isvoltage
25740 \pgf@circ@drawvoltagegenerator
25741 % add fake cont1 and cont2 anchors for export
25742 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
25743 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
25744 \else
25745 \pgf@circ@drawvoltagegeneric
25746 \fi
25747 % % debugging
25748 % \pgfextra{%
25749 % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc@eushift\space AL:\the\pgfcirc@alshift\space
25750 % DIRECTION:\pgf@circ@bipole@voltage@label@where}
25751 % \pgf@circ@debugvtrue}
25752
25753 % move a bit if requested
25754 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$)
25755
25756 % check for the case of american AND open
25757 \ifpgf@circuit@europeanvoltage
25758 \else
25759 \ifx\@@kind\@@open
25760 % override pgfcirc@Vlab
25761 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
25762 \fi
25763 \fi
25764
25765 \ifpgf@circ@debugv
25766 node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {}
25767 node [odiamondpole, color=red] at (pgfcirc@Vdir) {}
25768 node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir)
25769 {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where}
25770 \fi
25771
25772 % put the node only if it's not empty
25773 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
25774 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
25775 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
25776 at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}}
25777 \fi
25778
25779 \ifpgfcirc@v@curved\else
25780 % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom
25781 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
25782 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
25783 \fi
25784 % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...)
25785 \ifpgf@circuit@bipole@voltage@backward
25786 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto}
25787 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2}
25788 \fi
25789
25790 }%end drawvoltages
25791
25792 % %>>>
25793
25794 %% these should be arguably moved to every component definition...
25795
25796 % special cases for voltage positions%<<<1
25797 % the KIND is the node name without SHAPE
25798 % See the definition above for meaning
25799 % if bipoles/KIND/voltage/straight label distance is not defined, it uses the height
25800 % if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance)
25801 %
25802 \ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4}
25803 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
25804 %
25805 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
25806 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
25807 %
25808 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
25809 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
25810 %
25811 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
25812 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
25813 %
25814 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
25815 %
25816 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
25817 \ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8}
25818 %
25819 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6}
25820 %
25821 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
25822 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8}
25823 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
25824 \ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8}
25825 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
25826 \ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8}
25827 %
25828 \ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2}
25829 %
25830 \ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5}
25831 \ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0}
25832 \ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5}
25833 \ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0}
25834 \ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0}
25835 \ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2}
25836 \ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0}
25837 \ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2}
25838 \ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8}
25839 \ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8}
25840 \ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8}
25841 \ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8}
25842 %
25843 \ctikzset{bipoles/short/voltage/american label distance/.initial=2.8}
25844 \ctikzset{bipoles/open/voltage/distance from node/.initial=0.3}
25845 %
25846 \ctikzset{bipoles/battery/voltage/bump a/.initial=1.4}
25847 \ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2}
25848 \ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2}
25849 %%>>>
25850
25851 % vim: set fdm=marker fmr=%<<<,%>>>:
25852 %%%---------- close: tex/pgfcircvoltage
25853 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
25854 %%%---------- open: tex/pgfcirccurrent.tex
25855 % Copyright 2018-2026 by Romano Giannetti
25856 % Copyright 2015-2026 by Stefan Lindner
25857 % Copyright 2013-2026 by Stefan Erhardt
25858 % Copyright 2007-2026 by Massimo Redaelli
25859 %
25860 % This file may be distributed and/or modified
25861 %
25862 % 1. under the LaTeX Project Public License and/or
25863 % 2. under the GNU Public License.
25864 %
25865 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
25866
25867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25868 %% Current handling
25869
25870 %% styles
25871 \ctikzset{bipole current style/.style={}}
25872 \tikzset{bipole current style/.code={
25873 \ctikzset{bipole current style/.style={#1}}
25874 }}
25875 \tikzset{bipole current append style/.code={
25876 \ctikzset{bipole current style/.append style={#1}}
25877 }}
25878
25879 %% Options
25880 \ctikzset{i^>/.style = {
25881 i={#1},
25882 \circuitikzbasekey/bipole/current/direction = forward,
25883 \circuitikzbasekey/bipole/current/x position = after,
25884 \circuitikzbasekey/bipole/current/y position = above
25885 }
25886 }
25887
25888 \ctikzset{i_>/.style = {
25889 i={#1},
25890 \circuitikzbasekey/bipole/current/direction = forward,
25891 \circuitikzbasekey/bipole/current/x position = after,
25892 \circuitikzbasekey/bipole/current/y position = below
25893 }
25894 }
25895
25896 \ctikzset{i>^/.style = {
25897 i={#1},
25898 \circuitikzbasekey/bipole/current/direction = forward,
25899 \circuitikzbasekey/bipole/current/x position = before,
25900 \circuitikzbasekey/bipole/current/y position = above
25901 }
25902 }
25903
25904 \ctikzset{i>_/.style = {
25905 i={#1},
25906 \circuitikzbasekey/bipole/current/direction = forward,
25907 \circuitikzbasekey/bipole/current/x position = before,
25908 \circuitikzbasekey/bipole/current/y position = below
25909 }
25910 }
25911
25912 \ctikzset{i^</.style = {
25913 i={#1},
25914 \circuitikzbasekey/bipole/current/direction = backward,
25915 \circuitikzbasekey/bipole/current/x position = after,
25916 \circuitikzbasekey/bipole/current/y position = above
25917 }
25918 }
25919
25920 \ctikzset{i_</.style = {
25921 i={#1},
25922 \circuitikzbasekey/bipole/current/direction = backward,
25923 \circuitikzbasekey/bipole/current/x position = after,
25924 \circuitikzbasekey/bipole/current/y position = below
25925 }
25926 }
25927
25928 \ctikzset{i<^/.style = {
25929 i={#1},
25930 \circuitikzbasekey/bipole/current/direction = backward,
25931 \circuitikzbasekey/bipole/current/x position = before,
25932 \circuitikzbasekey/bipole/current/y position = above
25933 }
25934 }
25935
25936 \ctikzset{i<_/.style = {
25937 i={#1},
25938 \circuitikzbasekey/bipole/current/direction = backward,
25939 \circuitikzbasekey/bipole/current/x position = before,
25940 \circuitikzbasekey/bipole/current/y position = below
25941 }
25942 }
25943
25944 \newif\ifpgfcirc@do@i@symbols\pgfcirc@do@i@symbolstrue
25945 \ctikzset{no i symbols/.code={\pgfcirc@do@i@symbolsfalse}}
25946 \ctikzset{i symbols/.code={\pgfcirc@do@i@symbolstrue}}
25947
25948 \ctikzset{i/.code = {
25949 \pgfcirc@has@itrue
25950 \ifpgf@circuit@bipole@override@source@vif
25951 \pgf@circuit@bipole@isvoltagefalse
25952 \pgf@circuit@bipole@iscurrentfalse
25953 \fi
25954 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
25955 \circuitikzbasekey/bipole/current/x position = after,
25956 \circuitikzbasekey/bipole/current/y position = above }
25957 \pgfkeys{/tikz/circuitikz/bipole/current/label/name={#1}}
25958 \ctikzsetvalof{bipole/current/label/unit}{}
25959 \ifpgf@circ@siunitx
25960 \pgf@circ@handleSI{#1}
25961 \ifpgf@circ@siunitx@res
25962 \edef\pgf@temp{\pgf@circ@handleSI@val}
25963 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
25964 \edef\pgf@temp{\pgf@circ@handleSI@unit}
25965 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
25966 \else
25967 \fi
25968 \else
25969 \fi
25970 %reverse current direction for voltage sources
25971 \ifpgf@circ@oldvoltagedirection\else
25972 \ifpgf@circuit@bipole@isvoltage
25973 \ifpgf@circuit@bipole@voltage@backward
25974 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
25975 \circuitikzbasekey/bipole/current/x position = after,
25976 \circuitikzbasekey/bipole/current/y position = below }
25977 \else
25978 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
25979 \circuitikzbasekey/bipole/current/x position = before,
25980 \circuitikzbasekey/bipole/current/y position = above }
25981 \fi\fi\fi
25982 }
25983 }
25984
25985 \ifpgf@circ@oldvoltagedirection
25986 \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward } }
25987 \else
25988 \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
25989 \fi
25990 \ctikzset{i_/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = below } }
25991 \ctikzset{i>/.style = {i={#1}, \circuitikzbasekey/bipole/current/direction = forward } }
25992 \ctikzset{i^/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = above } }
25993
25994 %% Output routine
25995 \def\pgf@circ@drawcurrent{
25996 \pgfextra{
25997 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
25998 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
25999
26000 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
26001 \ifpgf@circuit@bipole@current@below
26002 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
26003 \fi
26004 \fi\fi
26005 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
26006 \ifpgf@circuit@bipole@current@below
26007 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
26008 \fi
26009 \fi\fi
26010 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
26011 \ifpgf@circuit@bipole@current@below
26012 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
26013 \fi
26014 \fi\fi
26015 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
26016 \ifpgf@circuit@bipole@current@below
26017 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
26018 \fi
26019 \fi\fi
26020 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
26021 \ifpgf@circuit@bipole@current@below
26022 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
26023 \fi
26024 \fi\fi
26025 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
26026 \ifpgf@circuit@bipole@current@below
26027 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
26028 \fi
26029 \fi\fi
26030 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
26031 \ifpgf@circuit@bipole@current@below
26032 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
26033 \fi
26034 \fi\fi
26035 \ifnum\pgfcircmathresult <5
26036 \ifpgf@circuit@bipole@current@below
26037 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
26038 \fi
26039 \fi
26040 \ifnum\pgfcircmathresult >355
26041 \ifpgf@circuit@bipole@current@below
26042 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
26043 \fi
26044 \fi
26045 % export anchor position (if not needed, is always the same macro)
26046 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir}
26047
26048 \ifpgf@circuit@bipole@current@below
26049 \def\pgf@circ@bipole@current@label@where{-90}
26050 \else
26051 \def\pgf@circ@bipole@current@label@where{+90}
26052 \fi
26053 }
26054
26055 %
26056 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
26057 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
26058 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
26059 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
26060 \else% normal bipole or source
26061 \ifpgf@circuit@bipole@current@before
26062 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
26063 coordinate (\pgfcirc@a@prefix-Ito) at (pgfcirc@anchorstartnode)
26064 \else
26065 coordinate (\pgfcirc@a@prefix-Ifrom) at (pgfcirc@anchorendnode)
26066 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
26067 \fi
26068 \fi
26069 \ifpgf@circuit@bipole@current@backward
26070 \pgfextra{
26071 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
26072 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26073 }
26074 \fi
26075 coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$)
26076 % export the current direction
26077 \pgfextra{\expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Iarrow-direction\endcsname{\pgf@circ@rounded@dir}}
26078 % if the current label is not empty (in which case we have already all the anchors)
26079 \pgf@circ@ifkeyempty{bipole/current/label/name}\else
26080 % put the arrow node
26081 % if we do not want the arrow, just put an empty node (needed to maintain the exact same distances)
26082 \ifpgfcirc@do@i@symbols
26083 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
26084 \else
26085 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center,
26086 circuitikz/phantom@currarrow](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
26087 \fi
26088 % put the label
26089 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
26090 (\ctikzvalof{bipole/name}current)
26091 at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}}
26092 \fi % end ifempty
26093 \ifpgf@circuit@bipole@current@backward
26094 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito}
26095 \fi
26096 }
26097
26098 %%%---------- close: tex/pgfcirccurrent
26099 %%%%%%%%%%% Springe nach tex/pgfcircflow
26100 %%%---------- open: tex/pgfcircflow.tex
26101 % Copyright 2018-2026 by Romano Giannetti
26102 % Copyright 2015-2026 by Stefan Lindner
26103 % Copyright 2013-2026 by Stefan Erhardt
26104 % Copyright 2007-2026 by Massimo Redaelli
26105 %
26106 % This file may be distributed and/or modified
26107 %
26108 % 1. under the LaTeX Project Public License and/or
26109 % 2. under the GNU Public License.
26110 %
26111 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
26112
26113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26114 %% flow handling
26115
26116
26117 %% styles
26118 \ctikzset{bipole flow style/.style={}}
26119 \tikzset{bipole flow style/.code={
26120 \ctikzset{bipole flow style/.style={#1}}
26121 }}
26122 \tikzset{bipole flow append style/.code={
26123 \ctikzset{bipole flow style/.append style={#1}}
26124 }}
26125
26126 %% Options
26127 \ctikzset{f^>/.style = {
26128 f={#1},
26129 \circuitikzbasekey/bipole/flow/direction = forward,
26130 \circuitikzbasekey/bipole/flow/x position = after,
26131 \circuitikzbasekey/bipole/flow/y position = above
26132 }
26133 }
26134
26135 \ctikzset{f_>/.style = {
26136 f={#1},
26137 \circuitikzbasekey/bipole/flow/direction = forward,
26138 \circuitikzbasekey/bipole/flow/x position = after,
26139 \circuitikzbasekey/bipole/flow/y position = below
26140 }
26141 }
26142
26143 \ctikzset{f>^/.style = {
26144 f={#1},
26145 \circuitikzbasekey/bipole/flow/direction = forward,
26146 \circuitikzbasekey/bipole/flow/x position = before,
26147 \circuitikzbasekey/bipole/flow/y position = above
26148 }
26149 }
26150
26151 \ctikzset{f>_/.style = {
26152 f={#1},
26153 \circuitikzbasekey/bipole/flow/direction = forward,
26154 \circuitikzbasekey/bipole/flow/x position = before,
26155 \circuitikzbasekey/bipole/flow/y position = below
26156 }
26157 }
26158
26159 \ctikzset{f^</.style = {
26160 f={#1},
26161 \circuitikzbasekey/bipole/flow/direction = backward,
26162 \circuitikzbasekey/bipole/flow/x position = after,
26163 \circuitikzbasekey/bipole/flow/y position = above
26164 }
26165 }
26166
26167 \ctikzset{f_</.style = {
26168 f={#1},
26169 \circuitikzbasekey/bipole/flow/direction = backward,
26170 \circuitikzbasekey/bipole/flow/x position = after,
26171 \circuitikzbasekey/bipole/flow/y position = below
26172 }
26173 }
26174
26175 \ctikzset{f<^/.style = {
26176 f={#1},
26177 \circuitikzbasekey/bipole/flow/direction = backward,
26178 \circuitikzbasekey/bipole/flow/x position = before,
26179 \circuitikzbasekey/bipole/flow/y position = above
26180 }
26181 }
26182
26183 \ctikzset{f<_/.style = {
26184 f={#1},
26185 \circuitikzbasekey/bipole/flow/direction = backward,
26186 \circuitikzbasekey/bipole/flow/x position = before,
26187 \circuitikzbasekey/bipole/flow/y position = below
26188 }
26189 }
26190
26191 \ctikzset{f</.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = backward} }
26192 \ctikzset{f_/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = below } }
26193 \ctikzset{f>/.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = forward } }
26194 \ctikzset{f^/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = above } }
26195
26196 \newif\ifpgfcirc@do@f@symbols\pgfcirc@do@f@symbolstrue
26197 \ctikzset{no f symbols/.code={\pgfcirc@do@f@symbolsfalse}}
26198 \ctikzset{f symbols/.code={\pgfcirc@do@f@symbolstrue}}
26199
26200 \ctikzset{f/.code = {
26201 \pgfcirc@has@ftrue
26202 \ifpgf@circuit@bipole@override@source@vif
26203 \pgf@circuit@bipole@isvoltagefalse
26204 \pgf@circuit@bipole@iscurrentfalse
26205 \fi
26206 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
26207 \circuitikzbasekey/bipole/flow/x position = after,
26208 \circuitikzbasekey/bipole/flow/y position = above }
26209 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name={#1}}
26210 \ctikzsetvalof{bipole/flow/label/unit}{}
26211 \ifpgf@circ@siunitx
26212 \pgf@circ@handleSI{#1}
26213 \ifpgf@circ@siunitx@res
26214 \edef\pgf@temp{\pgf@circ@handleSI@val}
26215 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
26216 \edef\pgf@temp{\pgf@circ@handleSI@unit}
26217 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
26218 \else
26219 \fi
26220 \else
26221 \fi
26222 }
26223 }
26224
26225 %% Output routine
26226
26227 \def\pgf@circ@drawflow{
26228 \pgfextra{
26229 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
26230 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
26231
26232 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
26233 \ifpgf@circuit@bipole@flow@below
26234 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
26235 \fi
26236 \fi\fi
26237 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
26238 \ifpgf@circuit@bipole@flow@below
26239 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
26240 \fi
26241 \fi\fi
26242 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
26243 \ifpgf@circuit@bipole@flow@below
26244 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
26245 \fi
26246 \fi\fi
26247 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
26248 \ifpgf@circuit@bipole@flow@below
26249 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
26250 \fi
26251 \fi\fi
26252 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
26253 \ifpgf@circuit@bipole@flow@below
26254 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
26255 \fi
26256 \fi\fi
26257 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
26258 \ifpgf@circuit@bipole@flow@below
26259 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
26260 \fi
26261 \fi\fi
26262 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
26263 \ifpgf@circuit@bipole@flow@below
26264 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
26265 \fi
26266 \fi\fi
26267 \ifnum\pgfcircmathresult <5
26268 \ifpgf@circuit@bipole@flow@below
26269 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
26270 \fi
26271 \fi
26272 \ifnum\pgfcircmathresult >355
26273 \ifpgf@circuit@bipole@flow@below
26274 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
26275 \fi
26276 \fi
26277
26278 \ifpgf@circuit@bipole@flow@below
26279 \def\pgf@circ@bipole@flow@label@where{-90}
26280 \else
26281 \def\pgf@circ@bipole@flow@label@where{+90}
26282 \fi
26283 % export anchor position (if not needed, is always the same macro)
26284 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir}
26285 }
26286
26287 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
26288 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
26289 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
26290 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
26291 \else% normal bipole or source
26292 \ifpgf@circuit@bipole@flow@before
26293 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
26294 coordinate (pgfcirc@Fto@flat) at (pgfcirc@anchorstartnode)
26295 \else
26296 coordinate (pgfcirc@Ffrom@flat) at (pgfcirc@anchorendnode)
26297 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
26298 \fi
26299 \fi
26300 \pgfextra{
26301 \newdimen{\absfshift}
26302 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
26303 \absfshift=\flow@offset
26304 \ifpgf@circuit@bipole@flow@backward
26305 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
26306 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26307 \fi
26308 }
26309 \ifpgf@circuit@bipole@flow@below
26310 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$)
26311 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$)
26312 \else
26313 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$)
26314 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$)
26315 \fi
26316 coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$)
26317 \pgfextra{
26318 \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape!
26319 }
26320 coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$)
26321 coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $)
26322 %
26323 % coordinate (\pgfcirc@a@prefix-Fpos) at
26324 % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$)
26325 % export the flow direction
26326 \pgfextra{\expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Farrow-direction\endcsname{\pgf@circ@rounded@dir}}
26327 % if the flow label is not empty (in which case we have already all the anchors)
26328 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else
26329 % the flow arrow is really a node "flowarrow", not a real arrow
26330 \ifpgfcirc@do@f@symbols
26331 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
26332 \else
26333 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center,
26334 circuitikz/phantom@flowarrow](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
26335 \fi
26336 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
26337 (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}}
26338 \fi
26339 % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above
26340 \ifpgf@circuit@bipole@flow@backward
26341 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto}
26342 \fi
26343
26344 }
26345
26346 %%%---------- close: tex/pgfcircflow
26347
26348 \ifpgf@circ@siunitx
26349 \RequirePackage{xstring}[2009/03/13]
26350 %\expandafter\let\csname angstrom\endcsname\relax
26351 \RequirePackage{siunitx}
26352 \fi
26353
26354 %% This should be executed *after* all the options!
26355 %
26356 % Remove the warning; nobody cares.
26357 %
26358 % \AtEndOfPackage{%
26359 % \ifpgf@circ@explicitvdir\else
26360 % \PackageWarningNoLine{circuitikz}{%
26361 % You did not specify one of the voltage directions:\MessageBreak
26362 % \space\space oldvoltagedirection, nooldvoltagedirection, \MessageBreak
26363 % \space\space RPvoltages or EFvoltages \MessageBreak
26364 % Default directions may have changed, \MessageBreak
26365 % please check the manual%
26366 % }
26367 % \fi
26368 % }
26369
26370 \newenvironment{circuitikz}{\begin{tikzpicture}}{\end{tikzpicture}}
26371 %override (unused) circuitikz environment for compability to externalization)
26372 \let\circuitikz\tikzpicture
26373 \let\endcircuitikz\endtikzpicture
26374
26375 \endinput