Debian Codegraph @

texmf-dist/tex/context/third/circuitikz/t-circuitikz-1.4.6.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 \def\pgfcircversion{1.4.6-827ff2b}
14 \def\pgfcircversiondate{2022/02/04}
15 \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
16
17 \usemodule[tikz]
18
19 \startmodule[circuitikzgit]
20 \usetikzlibrary[calc]
21 \usetikzlibrary[arrows.meta, bending]
22 \usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1)
23
24 \unprotect
25
26 \edef\tikzatcode{\the\catcode`\@}
27 \edef\tikzbarcode{\the\catcode`\|}
28 \edef\tikzexclaimcode{\the\catcode`\!}
29 \catcode`\@=11
30 \catcode`\|=12
31 \catcode`\!=12
32
33 %%%%%%%%%%% Springe nach tex/pgfcirc.defines
34 %%%---------- open: tex/pgfcirc.defines.tex
35 % Copyright 2018-2026 by Romano Giannetti
36 % Copyright 2015-2026 by Stefan Lindner
37 % Copyright 2013-2026 by Stefan Erhardt
38 % Copyright 2007-2026 by Massimo Redaelli
39 %
40 % This file may be distributed and/or modified
41 %
42 % 1. under the LaTeX Project Public License and/or
43 % 2. under the GNU Public License.
44 %
45 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
46 %
47 % This file has folding marks for vim (See last line).
48 %
49
50 %
51 % This file is loaded *before* the options for the package are executed, mainly
52 % for the following three ifs
53 %
54 % these three ifs are fundamental for the package loading options;
55 % do not move away
56 \newif\ifpgf@circ@siunitx
57 \newif\ifpgf@circ@siunitx@res
58 \newif\ifpgf@circuit@compat
59
60 %% Key managements%<<<1
61
62 \long\def\pgf@circ@comment#1{}
63
64 \def\circuitikzbasekey{/tikz/circuitikz}
65
66 \pgfkeys{\circuitikzbasekey/.is family}
67
68 \def\circuitikzset{\expandafter\pgfqkeys\expandafter{\circuitikzbasekey}}
69 \let\ctikzset\circuitikzset
70 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
71 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
72
73 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
74 %%>>>
75
76 %% Temporary Counters and dimensions%<<<1
77 %% Temporary Counters
78 \newcount\pgf@circ@count@a
79 \newcount\pgf@circ@count@b
80 \newcount\pgf@circ@count@c
81 %%%%%%%%%%%%
82 %% Dimensions
83 % coordinate
84 \newdimen\pgf@circ@res@up
85 \newdimen\pgf@circ@res@down
86 \newdimen\pgf@circ@res@zero
87 \newdimen\pgf@circ@res@left
88 \newdimen\pgf@circ@res@right
89 \newdimen\pgf@circ@res@other
90 \newdimen\pgf@circ@res@step
91 \newdimen\pgf@circ@res@temp
92 % Base len for all circuitikz
93 \newdimen\pgf@circ@Rlen
94 % scaled length for internal use in scalable shapes
95 \newdimen\pgf@circ@scaled@Rlen
96 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
97 \pgf@circ@Rlen = 1.4cm
98 % by default scale is 1.0
99 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
100 % inital thickness
101 \newdimen \pgfstartlinewidth
102 %%>>>
103
104 % arrow tips macros and utilities %<<<1
105
106 % the default arrow is latexslim, which has been ported over old arrows library (deprecated)
107 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
108 % this was the original definition of latex' tips, renamed to avoid clashes
109 %
110 \pgfarrowsdeclare{latexslim}{latexslim}
111 {
112 \pgfutil@tempdima=0.28pt%
113 \advance\pgfutil@tempdima by.3\pgflinewidth%
114 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
115 \pgfarrowsrightextend{+6\pgfutil@tempdima}
116 }
117 {
118 \pgfutil@tempdima=0.28pt%
119 \advance\pgfutil@tempdima by.3\pgflinewidth%
120 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
121 \pgfpathcurveto
122 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
123 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
124 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
125 \pgfpathcurveto
126 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
127 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
128 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
129 \pgfpathcurveto
130 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
131 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
132 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
133 \pgfpathclose
134 \pgfusepathqfill
135 }
136
137 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
138
139 % select the arrows using available defaults.
140 \def\pgfcirc@arrow@default{default}
141 % choose the arrows to use. Use #2 and #3 if the key is equal to "default"
142 % arguments: type, default start, default end
143 \def\pgfcirc@set@arrows#1#2#3{%
144 \pgfkeysifdefined{\circuitikzbasekey/#1 start arrow}%
145 {\edef\@@start{\ctikzvalof{#1 start arrow}}}%
146 {\edef\@@start{\pgfcirc@arrow@default}}
147 \pgfkeysifdefined{\circuitikzbasekey/#1 end arrow}%
148 {\edef\@@end{\ctikzvalof{#1 end arrow}}}%
149 {\edef\@@end{\pgfcirc@arrow@default}}
150 \ifx\@@start\pgfcirc@arrow@default
151 \pgfsetarrowsstart{#2}%
152 \else
153 \pgfsetarrowsstart{\@@start}%
154 \fi
155 \ifx\@@end\pgfcirc@arrow@default
156 \pgfsetarrowsend{#3}%
157 \else
158 \pgfsetarrowsend{\@@end}%
159 \fi
160 }
161
162 \def\pgf@circ@declare@family@arrows#1{%
163 \ctikzset{#1 start arrow/.initial={default}}
164 \ctikzset{#1 end arrow/.initial={default}}
165 \tikzset{#1 start arrow/.style={\circuitikzbasekey/#1 start arrow={##1}}}
166 \tikzset{#1 end arrow/.style={\circuitikzbasekey/#1 end arrow={##1}}}
167 }
168 %%>>>
169
170 %% Macros to do things depending on the class%<<<1
171
172 \def\pgf@circ@setifdefinedfill#1#2{%
173 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
174 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
175 \ifdefined\ctikzclass
176 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
177 {% yes, it's defined
178 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
179 \ifx\@@tmp\@@none % but it's none
180 \pgfusepath{#2}%
181 \else
182 \pgfsetfillcolor{\@@tmp}%
183 \pgfusepath{#1}%
184 \fi
185 }{% the class is defined but the fill key not; use #2
186 \pgfusepath{#2}%
187 }
188 \else
189 \pgfusepath{#2}%
190 \fi
191 }
192
193 %% Macro to fill or draw
194
195 \def\pgf@circ@draworfill{%
196 \ifx\tikz@fillcolor\pgfutil@empty
197 \pgf@circ@setifdefinedfill{draw,fill}{draw}
198 \else
199 \pgfsetfillcolor{\tikz@fillcolor}
200 \pgfusepath{draw, fill}
201 \fi
202 }
203
204 \def\pgf@circ@draworfillandclip{%
205 \ifx\tikz@fillcolor\pgfutil@empty
206 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
207 \pgfusepath{draw, clip}
208 \else
209 \pgfsetfillcolor{\tikz@fillcolor}
210 \pgfusepath{draw, clip, fill}
211 \fi
212 }
213
214 \def\pgf@circ@maybefill{%
215 \ifx\tikz@fillcolor\pgfutil@empty
216 \pgf@circ@setifdefinedfill{fill}{discard}
217 \else
218 \pgfsetfillcolor{\tikz@fillcolor}
219 \pgfusepath{fill}
220 \fi
221 }
222
223 %% Macros for setting linewidth
224 % #1 is the legacy class (bipoles, tripoles) etc
225 % #2 is the reference linewidth
226 \def\pgf@circ@setlinewidth#1#2{%
227 \ifdefined\ctikzclass
228 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
229 {% yes, it's defined
230 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
231 \ifx\@@tmp\@@none % but it's none
232 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
233 \else
234 \pgfsetlinewidth{\@@tmp #2}%
235 \fi
236 }{ % key not defined, do the legacy thing
237 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
238 }% Ok, do nothing
239 \else % no class
240 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
241 \fi
242 }
243 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
244 \ctikzset{none/thickness/.initial=1.0} % do not touch
245
246 % set thickness relative to current thickness if exists class and key
247 \def\pgf@circ@set@relative@thickness#1{%
248 \ifdefined\ctikzclass
249 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/#1}
250 {% yes, it's defined
251 \pgfsetlinewidth{\ctikzvalof{\ctikzclass/#1}\pgflinewidth}%
252 }{}
253 \fi
254 }
255
256 % auxiliary macro to reset some thing in paths, for background images.
257 % use with care and ALWAYS inside a \pgfscope, see here:
258 % https://matrix.to/#/!NuxCISwYQJuyWwNsEI:matrix.org/$vQO6luq1F66LJ79dERmaqKI46qMBcjStqYCPi725uZE?via=matrix.org&via=2krueger.de&via=im.f3l.de
259 % Thanks to @muzimuzhi
260 %
261 \def\pgf@circ@reset@arrows{%
262 \pgfsetshortenstart{+0pt}\pgfsetshortenend{+0pt}\pgfsetarrows{-}%
263 }
264 \def\pgf@circ@reset@rounded{%
265 \pgfsetcornersarced{\pgfpointorigin}%
266 }
267 \def\pgf@circ@reset@arrows@rounded{%
268 \pgf@circ@reset@arrows\pgf@circ@reset@rounded
269 }
270
271 %%>>>
272
273 %% font changes compatible with plain/LaTeX/ConTeXt%<<<1
274 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
275
276 \ifpgfutil@format@is@latex
277 \long\def\pgf@circ@font@tiny{\tiny}
278 \long\def\pgf@circ@font@small{\small}
279 \long\def\pgf@circ@font@bold{\textbf}
280 \long\def\pgf@circ@font@boldmath{\boldmath}
281 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
282 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
283 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
284 \else\ifpgfutil@format@is@plain
285 \long\def\pgf@circ@font@tiny{\fiverm}
286 \long\def\pgf@circ@font@small{\sevenrm}
287 \long\def\pgf@circ@font@bold#1{{\bf#1}}
288 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
289 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
290 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
291 \long\def\pgf@circ@font@twelve{\twelverm} %
292 \else\ifpgfutil@format@is@context
293 \long\def\pgf@circ@font@tiny{\tfxx}
294 \long\def\pgf@circ@font@small{\tfx}
295 \long\def\pgf@circ@font@bold{\bold}
296 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
297 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
298 \long\def\pgf@circ@font@tenbm{\normal\bold}%
299 \long\def\pgf@circ@font@twelve{\tfa} %
300 \fi\fi\fi
301
302
303 %
304 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
305 %
306 % this is needed to avoid problems with \ConTeXt
307 \ifcsname normalunexpanded\endcsname
308 \let\pgfcircutil@unexpanded\normalunexpanded
309 \else
310 \let\pgfcircutil@unexpanded\unexpanded
311 \fi
312 % minimally expand a pgfkey to check if it's {}/undefined or filled.
313 \def\unexpandedvalueof#1{%
314 \pgfcircutil@unexpanded\expandafter\expandafter
315 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
316 \def\pgf@circ@valueof@chk#1{%
317 \ifx\relax#1%
318 \expandafter\pgfutil@firstoftwo
319 \else
320 \expandafter\pgfutil@secondoftwo
321 \fi
322 {{}}% #1 is \relax, so consider empty
323 {\expandafter{#1}}% otherwise, leave the key after one more expansion
324 }%
325 %>>>
326
327 %% Generic macro for defining a bipole shape%<<<
328 % #1 - additional anchors
329 % #2 - lower y-size of the bipole (from the center).
330 % #3 - #shape is the name of the shape
331 % #4 - upper y-size of the bipole (from the center)
332 % #5 - width of the bipole
333 % #6 - macros drawing the bipole
334 %
335 \long\def\pgfcircdeclarebipole{%
336 \pgfcircdeclarebipolescaled{default}}
337
338 %% Generic macro for defining a bipole shape
339 % #1 - scale factor
340 % #2 - additional anchors
341 % #3 - lower y-size of the bipole (from the center).
342 % #4 - #shape is the name of the shape
343 % #5 - upper y-size of the bipole (from the center)
344 % #6 - width of the bipole
345 % #7 - macros drawing the bipole
346 %
347 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
348 \pgfdeclareshape{#4shape}{
349 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
350 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
351 \savedanchor{\northeast}{
352 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
353 \pgf@y=#5\pgf@circ@scaled@Rlen
354 \pgf@y=.5\pgf@y
355 \pgf@x=#6\pgf@circ@scaled@Rlen
356 \pgf@x=.5\pgf@x
357 }
358 \savedanchor{\northeastborder}{
359 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
360 \pgf@y=#5\pgf@circ@scaled@Rlen
361 \pgf@y=.5\pgf@y
362 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
363 \pgf@x=#6\pgf@circ@scaled@Rlen
364 \pgf@x=.5\pgf@x
365 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
366 }
367 \savedanchor{\southwestborder}{
368 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
369 \pgf@y=-#3\pgf@circ@scaled@Rlen
370 \pgf@y=.5\pgf@y
371 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
372 \pgf@x=-#6\pgf@circ@scaled@Rlen
373 \pgf@x=.5\pgf@x
374 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
375 }
376 \savedanchor{\southwest}{
377 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
378 \pgf@y=-#3\pgf@circ@scaled@Rlen
379 \pgf@y=.5\pgf@y
380 \pgf@x=-#6\pgf@circ@scaled@Rlen
381 \pgf@x=.5\pgf@x
382 }
383 \savedanchor{\centerpoint}{
384 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
385 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
386 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
387 \pgfpointorigin
388 \pgf@y=\pgf@circ@res@up
389 \advance\pgf@y by\pgf@circ@res@down
390 \pgf@y=.5\pgf@y
391 }
392 \anchor{center}{\pgfpointorigin}
393 \anchor{n}{
394 \northeast
395 \pgf@x=0cm
396 }
397 \anchor{north east}{
398 \northeast
399 }
400 \anchor{north west}{
401 \northeast
402 \pgf@x=-\pgf@x
403 }
404 \anchor{ne}{
405 \northeast
406 }
407 \anchor{nw}{
408 \northeast
409 \pgf@x=-\pgf@x
410 }
411 \anchor{e}{
412 \northeast
413 \pgf@y=0cm
414 }
415 \anchor{s}{
416 \southwest
417 \pgf@x=0cm
418 }
419 \anchor{south east}{
420 \southwest
421 \pgf@x=-\pgf@x
422 }
423 \anchor{south west}{
424 \southwest
425 }
426 \anchor{se}{
427 \southwest
428 \pgf@x=-\pgf@x
429 }
430 \anchor{sw}{
431 \southwest
432 }
433 \anchor{w}{
434 \southwest
435 \pgf@y=0cm
436 }
437 \anchor{north}{
438 \northeast
439 \pgf@x=0cm
440 }
441 \anchor{east}{
442 \northeast
443 \pgf@y=0cm
444 }
445 \anchor{south}{
446 \southwest
447 \pgf@x=0cm
448 }
449 \anchor{west}{
450 \southwest
451 \pgf@y=0cm
452 }
453 \anchor{right}{
454 \northeast
455 \pgf@y=0cm
456 }
457 \anchor{above}{
458 \northeast
459 \pgf@x=0cm
460 }
461 \anchor{left}{
462 \southwest
463 \pgf@y=0cm
464 }
465 \anchor{below}{
466 \southwest
467 \pgf@x=0cm
468 }
469 \anchor{a}{
470 \northeast
471 \pgf@y=0cm
472 }
473 \anchor{b}{
474 \southwest
475 \pgf@y=0cm
476 }
477 \savedanchor{\textanchor}{%
478 \pgf@y=\ht\pgfnodeparttextbox
479 \pgf@x=-.5\wd\pgfnodeparttextbox
480 }
481 \anchor{text}{
482 \textanchor
483 }
484 \anchorborder{%
485 \ifpgf@circuit@bipole@inverted
486 \pgf@circ@res@left=-\pgf@x
487 \pgf@circ@res@up=-\pgf@y
488 \else
489 \pgf@circ@res@left=\pgf@x
490 \pgf@circ@res@up=\pgf@y
491 \fi
492 \ifdim\pgf@circ@res@up>0cm
493 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder}
494 \else
495 \southwestborder
496 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
497 \fi
498 }
499
500 #2
501
502 \backgroundpath{
503 \pgfsetcolor{\ctikzvalof{color}}
504
505 \northeast
506 \pgf@circ@res@up = \pgf@y
507 \pgf@circ@res@zero = 0cm
508 \pgf@circ@res@left = -\pgf@x
509 \pgf@circ@res@right = \pgf@x
510 \southwest
511 \pgf@circ@res@down = \pgf@y
512 \pgf@circ@scaled@Rlen=\scaledRlen
513 \pgfstartlinewidth=\pgflinewidth
514 % no rounded corners nor default arrows on bipole's bodies
515 \pgf@circ@reset@arrows@rounded
516 #7
517
518 \pgfsetlinewidth{\pgfstartlinewidth}
519 }
520 }
521 }% %>>>
522
523 %% anchor adjustment macros%<<<
524
525 % Extend the border anchor position by the specified factors on the right-top (north east corner)
526 % and the left-down (southwest border). Argument must be number (possibly decimal) without sign
527
528 \def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down
529 \anchorborder{%
530 \ifpgf@circuit@bipole@inverted
531 \pgf@circ@res@left=-\pgf@x
532 \pgf@circ@res@up=-\pgf@y
533 \else
534 \pgf@circ@res@left=\pgf@x
535 \pgf@circ@res@up=\pgf@y
536 \fi
537 \ifdim\pgf@circ@res@up>0cm
538 \northeastborder
539 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}}
540 \else
541 \southwestborder
542 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}}
543 \fi
544 }
545 }
546
547 % Just up and down (very common)
548 \def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}}% %>>>
549
550 % text position in some component.%<<<1
551 % (added with ieeestd logic ports. Maybe to be extended to other components,
552 % like amplifiers)
553 %
554 \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
555 \tikzset{component text/.is choice}%
556 \tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
557 \tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
558 \ctikzset{component text/.is choice}%
559 \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
560 \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
561 \ctikzset{left text distance/.initial=0.3em}%
562 %>>>
563
564 % voltage direction options%<<<1
565
566 \newif\ifpgf@circ@oldvoltagedirection % default false
567 \newif\ifpgf@circ@explicitvdir
568 \newif\ifpgf@circ@fixbatteries
569
570 \ctikzset{voltage dir/.is choice}
571 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
572 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
573 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
574 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
575 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}%
576 %>>>
577
578 % bipole definitions for path component and text decorations%%<<<1
579 %
580 % Option "t=*" for nodes
581 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
582 %
583 \ctikzset{bipole/.is family}
584 \ctikzset{bipole/kind/.initial=}
585 \ctikzset{bipole/name/.initial=}
586 \newif\ifpgf@circuit@bipole@isvoltage
587 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
588 \newif\ifpgf@circuit@bipole@override@source@vif
589 \ctikzset{bipole/override source vif/.is if=pgf@circuit@bipole@override@source@vif}
590 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
591 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
592 \newif\ifpgf@circuit@bipole@strokedsymbol
593 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
594 \newif\ifpgf@circuit@bipole@iscurrent
595 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
596
597 \ctikzset{bipole/voltage/.is family}
598 \newif\ifpgf@circuit@bipole@voltage@backward
599 \ctikzset{bipole/voltage/direction/.is choice}
600 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
601 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
602 \newif\ifpgf@circuit@bipole@voltage@below
603 \ctikzset{bipole/voltage/position/.is choice}
604 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
605 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
606
607 \ctikzset{bipole/voltage/label/unit/.initial=}
608 \ctikzset{bipole/voltage/label/name/.initial=}
609
610 \ctikzset{bipole/current/.is family}
611 \newif\ifpgf@circuit@bipole@current@backward
612 \ctikzset{bipole/current/direction/.is choice}
613 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
614 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
615 \newif\ifpgf@circuit@bipole@current@before
616 \ctikzset{bipole/current/x position/.is choice}
617 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
618 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
619 \newif\ifpgf@circuit@bipole@current@below
620 \ctikzset{bipole/current/y position/.is choice}
621 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
622 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
623 \ctikzset{bipole/current/label/unit/.initial=}
624 \ctikzset{bipole/current/label/name/.initial=}
625
626 \ctikzset{bipole/flow/.is family}
627 \newif\ifpgf@circuit@bipole@flow@backward
628 \ctikzset{bipole/flow/direction/.is choice}
629 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
630 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
631 \newif\ifpgf@circuit@bipole@flow@before
632 \ctikzset{bipole/flow/x position/.is choice}
633 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
634 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
635 \newif\ifpgf@circuit@bipole@flow@below
636 \ctikzset{bipole/flow/y position/.is choice}
637 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
638 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
639 \ctikzset{bipole/flow/label/unit/.initial=}
640 \ctikzset{bipole/flow/label/name/.initial=}
641 \ctikzset{flow/distance/.initial = .5}
642 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
643
644 \ctikzset{bipole/label/.is family}
645 \ctikzset{bipole/label/position/.initial=90}
646 \ctikzset{bipole/label/unit/.initial=}
647 \ctikzset{bipole/label/name/.initial=}
648 \ctikzset{bipole/annotation/.is family}
649 \ctikzset{bipole/annotation/position/.initial=-90}
650 \ctikzset{bipole/annotation/unit/.initial=}
651 \ctikzset{bipole/annotation/name/.initial=}
652
653
654 \ctikzset{label/align/.is choice}
655 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
656 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
657 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
658 %%>>>
659
660 % traditional styles %<<<1
661 %
662 \ctikzset{thickness/.initial=2}
663 \ctikzset{color/.initial=black}
664 \pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
665 \ctikzset{bipoles/border margin/.initial=1.1}
666 \ctikzset{bipoles/thickness/.initial=2}
667 \ctikzset{tripoles/thickness/.initial=2}
668 \ctikzset{quadpoles/thickness/.initial=2}
669 \ctikzset{nodes width/.initial=.04}
670 %%>>>
671
672 % Styles definitions and macros%<<<1
673
674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
675 %% main style definitions
676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
677
678 % load a style file: search ctikzstyle-NAME.tex in path
679 \def\ctikzloadstyle#1{%
680 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
681 \tikzerror{I did not find the circuitikz style #1}}%
682 }
683
684 % load and enact a style
685 \def\ctikzsetstyle#1{%
686 \ctikzloadstyle{#1}%
687 \tikzset{#1 circuit style}%
688 }
689
690 % global style parameters
691 \ctikzset{default/scale/.initial=1.0} % do not touch
692 \ctikzset{default/fill/.initial=none} % do not touch
693 \ctikzset{default/thickness/.initial=none} % do not touch
694 % default is use as the generic default style for bipoles
695
696 % mostly bipoles:
697
698 \ctikzset{resistors/scale/.initial=1.0}
699 \ctikzset{resistors/fill/.initial=none}
700 \ctikzset{resistors/thickness/.initial=none}
701 \ctikzset{resistors/modifier thickness/.initial=1}% relative to main thickness
702
703 \ctikzset{capacitors/scale/.initial=1.0}
704 \ctikzset{capacitors/fill/.initial=none}
705 \ctikzset{capacitors/thickness/.initial=none}
706 \ctikzset{capacitors/modifier thickness/.initial=1}
707
708 \ctikzset{inductors/scale/.initial=1.0}
709 \ctikzset{inductors/fill/.initial=none}
710 \ctikzset{inductors/thickness/.initial=none}
711 \ctikzset{inductors/modifier thickness/.initial=1}
712
713 \ctikzset{diodes/scale/.initial=1.0}
714 \ctikzset{diodes/fill/.initial=none}
715 \ctikzset{diodes/thickness/.initial=none}
716
717 \ctikzset{batteries/scale/.initial=1.0}
718 \ctikzset{batteries/fill/.initial=none}
719 \ctikzset{batteries/thickness/.initial=none}
720
721 \ctikzset{sources/scale/.initial=1.0}
722 \ctikzset{sources/fill/.initial=none}
723 \ctikzset{sources/thickness/.initial=none}
724
725 \ctikzset{csources/scale/.initial=1.0}
726 \ctikzset{csources/fill/.initial=none}
727 \ctikzset{csources/thickness/.initial=none}
728
729 \ctikzset{instruments/scale/.initial=1.0}
730 \ctikzset{instruments/fill/.initial=none}
731 \ctikzset{instruments/thickness/.initial=none}
732
733 \ctikzset{mechanicals/scale/.initial=1.0}
734 \ctikzset{mechanicals/fill/.initial=none}
735 \ctikzset{mechanicals/thickness/.initial=none}
736
737 \ctikzset{misc/scale/.initial=1.0}
738 \ctikzset{misc/fill/.initial=none}
739 \ctikzset{misc/thickness/.initial=none}
740
741 \ctikzset{blocks/scale/.initial=1.0}
742 \ctikzset{blocks/fill/.initial=none}
743 \ctikzset{blocks/thickness/.initial=none}
744
745 % mostly nodes
746
747 \ctikzset{grounds/scale/.initial=1.0}
748 \ctikzset{grounds/fill/.initial=none}
749 \ctikzset{grounds/thickness/.initial=none}
750
751 \ctikzset{power supplies/scale/.initial=1.0}
752 \ctikzset{power supplies/fill/.initial=none}
753 \ctikzset{power supplies/thickness/.initial=none}
754
755 \ctikzset{transistors/scale/.initial=1.0}
756 \ctikzset{transistors/fill/.initial=none}
757 \ctikzset{transistors/thickness/.initial=none}
758 \ctikzset{transistors/modifier thickness/.initial=1}% relative to main thickness
759
760 \ctikzset{tubes/scale/.initial=1.0}
761 \ctikzset{tubes/fill/.initial=none}
762 \ctikzset{tubes/thickness/.initial=none}
763
764 \ctikzset{RF/scale/.initial=1.0}
765 \ctikzset{RF/fill/.initial=none}
766 \ctikzset{RF/thickness/.initial=none}
767
768 \ctikzset{electromechanicals/scale/.initial=1.0}
769 \ctikzset{electromechanicals/fill/.initial=none}
770 \ctikzset{electromechanicals/thickness/.initial=none}
771
772 % transformers go with inductors
773 \ctikzset{amplifiers/scale/.initial=1.0}
774 \ctikzset{amplifiers/fill/.initial=none}
775 \ctikzset{amplifiers/thickness/.initial=none}
776
777 \ctikzset{switches/scale/.initial=1.0}
778 \ctikzset{switches/fill/.initial=none}
779 \ctikzset{switches/thickness/.initial=none}
780
781 \ctikzset{logic ports/scale/.initial=1.0}
782 \ctikzset{logic ports/fill/.initial=none}
783 \ctikzset{logic ports/thickness/.initial=none}
784
785 \ctikzset{flipflops/scale/.initial=1.0}
786 \ctikzset{flipflops/fill/.initial=none}
787 \ctikzset{flipflops/thickness/.initial=none}
788
789 \ctikzset{muxdemuxes/scale/.initial=1.0}
790 \ctikzset{muxdemuxes/fill/.initial=none}
791 \ctikzset{muxdemuxes/thickness/.initial=none}
792
793 \ctikzset{chips/scale/.initial=1.0}
794 \ctikzset{chips/fill/.initial=none}
795 \ctikzset{chips/thickness/.initial=none}
796
797 \ctikzset{displays/scale/.initial=1.0}
798 \ctikzset{displays/fill/.initial=none}
799 \ctikzset{displays/thickness/.initial=none}
800 %
801 % general styles
802 %
803 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
804 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
805 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
806 %%>>>
807
808 % voltage and current options%<<<1
809 %
810 \ctikzset{current arrow scale/.initial=16}
811 \ctikzset{current/distance/.initial = .5}
812
813 \newif\ifpgf@circuit@europeancurrent
814 \newif\ifpgf@circuit@europeanvoltage
815 \newif\ifpgf@circuit@bipole@voltage@straight
816 \newif\ifpgf@circuit@bipole@voltage@raised
817
818 \ctikzset{voltage/.is choice}
819 %
820 % straight is expected to be a subset of european, so disable it in american style
821 %
822 \ctikzset{voltage/american/.code = {%
823 \pgf@circuit@europeanvoltagefalse
824 \pgf@circuit@bipole@voltage@straightfalse
825 \pgf@circuit@bipole@voltage@raisedfalse
826 }}
827 \ctikzset{voltage/raised/.code = {%
828 \pgf@circuit@europeanvoltagefalse
829 \pgf@circuit@bipole@voltage@straightfalse
830 \pgf@circuit@bipole@voltage@raisedtrue
831 }}
832 \ctikzset{voltage/european/.code = {%
833 \pgf@circuit@europeanvoltagetrue
834 \pgf@circuit@bipole@voltage@straightfalse
835 \pgf@circuit@bipole@voltage@raisedfalse
836 }}
837 \ctikzset{voltage/straight/.code = {%
838 \pgf@circuit@europeanvoltagetrue
839 \pgf@circuit@bipole@voltage@straighttrue
840 \pgf@circuit@bipole@voltage@raisedfalse
841 }}
842 \ctikzset{voltage/curved/.code = {%
843 \pgf@circuit@europeanvoltagetrue
844 \pgf@circuit@bipole@voltage@straightfalse
845 \pgf@circuit@bipole@voltage@raisedfalse
846 }}
847 % are these used?
848 \ctikzset{current/.is choice}
849 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
850 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
851
852 % this is left for backward compatibility...
853 \ctikzset{straight/.is choice}
854 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
855 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
856 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
857 %
858 % voltage is used also to set parameters, apart for the /.is choice
859 % above. I hope it is ok --- would be a mess otherwise
860 %
861 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
862 \ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
863 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
864 %
865 % keys for exporting voltage, current, flow anchors
866 %
867 \newif\ifpgfcirc@has@v\pgfcirc@has@vfalse
868 \newif\ifpgfcirc@has@f\pgfcirc@has@ffalse
869 \newif\ifpgfcirc@has@i\pgfcirc@has@ifalse
870 \def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname}
871 \def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname}
872 %
873 % shaping the +/- sign, see pgfcircvoltage.tex
874 \ctikzset{voltage/american font/.initial={}}
875 \ctikzset{voltage/american plus/.initial={$+$}}
876 \ctikzset{voltage/american minus/.initial={$-$}}
877 % here we start the voltage adjustments for special components.
878 % default values:
879 %
880 % this is the distance of the "point" marking the voltage along the line
881 % 0.0 is on the external nodes of the to path
882 % 1.0 is cramped on the object
883 % this can be overriden component by component
884 \ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1
885 %
886 % this is the distance from the line (perpendicular to) where the voltage is drawn.
887 % It is global, and not adjustable by component (use the "label distance" or locally
888 % if you need it)
889 \ctikzset{voltage/distance from line/.initial=.08}% in \pgf@circ@scaled@Rlen units
890 %
891 % bend paramenters for european arc. You can override them component-based
892 \ctikzset{voltage/bump b/.initial=1.5}
893 %
894 % generator voltages symbols or arrows (always straight) are put along the
895 % 60 ... 120 angles of the symbol (don't ask why). The distance here is on the
896 % center..angle line. It's called bump a because I don't know...
897 %
898 \ctikzset{voltage/bump a/.initial=1.2}
899 %
900 % these are the label distances FROM the drawings.
901 % You can override them component by component.
902 \ctikzset{voltage/european label distance/.initial=1.4}
903 \ctikzset{voltage/straight label distance/.initial=1.4}
904 \ctikzset{voltage/american label distance/.initial=1.4}
905 % american open voltage adjusting
906 %
907 \newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue
908 \ctikzset{open voltage position/.is choice}
909 \ctikzset{open voltage position/center/.code={\pgf@adjust@open@voltagetrue}}
910 \ctikzset{open voltage position/legacy/.code={\pgf@adjust@open@voltagefalse}}
911 % bad names, kept for compatibility, don't use
912 \ctikzset{american open voltage/.is choice}
913 \ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}}
914 \ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}}
915 %
916 % voltage and current styles
917 %
918 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
919 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
920 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
921 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
922 \tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
923 \tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}}
924 %%>>>
925
926 % vim: set fdm=marker fmr=%<<<,%>>>:
927 %%%---------- close: tex/pgfcirc.defines
928 %%%%%%%%%%% Springe nach tex/pgfcircutils
929 %%%---------- open: tex/pgfcircutils.tex
930 % Copyright 2018-2026 by Romano Giannetti
931 % Copyright 2015-2026 by Stefan Lindner
932 % Copyright 2013-2026 by Stefan Erhardt
933 % Copyright 2007-2026 by Massimo Redaelli
934 %
935 % This file may be distributed and/or modified
936 %
937 % 1. under the LaTeX Project Public License and/or
938 % 2. under the GNU Public License.
939 %
940 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
941
942 \def\pgf@circ@handleSI#1{
943 \noexpandarg
944 \def\pgf@temp{}
945 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
946 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
947
948 \ifnum\pgf@circ@handleSI@unit@len=0
949 \pgf@circ@siunitx@resfalse
950 \else
951 \IfEndWith{#1}{>}{
952 \pgf@circ@siunitx@restrue
953 \noexpandarg
954 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
955 %\typeout{si |#1|}
956 }{
957 \pgf@circ@siunitx@resfalse
958 %\typeout{no si |#1|}
959 }
960 \fi
961 }
962
963 \def\pgf@circ@ifkeyempty#1{
964 \pgfextra{
965 \ctikzset{#1/.get=\pgf@circ@temp}
966 \edef\pgf@temp{}
967 }
968 \ifx\pgf@circ@temp\pgf@temp
969 }
970
971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
972 %% Math routines
973
974 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
975
976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
977 %% useful commands
978
979 \ifpgfutil@format@is@latex
980 %% flipping text
981 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
982 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
983 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
984 % text mode overbar
985 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
986 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
987 \else\ifpgfutil@format@is@plain
988 % text mode overbar
989 % but really circuitikz will not work in plain...
990 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
991 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
992 \else\ifpgfutil@format@is@context
993 %% flipping text
994 \def\ctikzflipx#1{\mirror{#1}}
995 \def\ctikzflipy#1{\mirror{\rotate[rotation=180]{#1}}}
996 \def\ctikzflipxy#1{\rotate[rotation=180]{#1}}
997 % text mode overbar
998 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
999 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
1000 \fi\fi\fi
1001
1002 %%%%%%%%%%%%%%%%%%%%%%%%%%%
1003 %% switch to use fpu in reciprocal scale transformations
1004 %%
1005 %% this code has been contributed by Schrödinger's cat
1006 %% https://tex.stackexchange.com/a/529159/38080
1007 %%
1008 %% Use the official key to use the fpu if installed, see
1009 %% https://github.com/pgf-tikz/pgf/issues/861
1010 %%
1011 %% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080
1012 %% Thanks to Henri Menke for a faster approach https://github.com/circuitikz/circuitikz/commit/00966c45c42b464fab5429f89f2b7fb414e9b3f7#commitcomment-54592494
1013 %%
1014 \pgfkeysifdefined{/pgf/fpu/install only/.@cmd}{%
1015 \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}%
1016 }{%
1017 \pgfkeysifdefined{/pgf/use fpu reciprocal/.@cmd}{% use stock one
1018 }{
1019 \pgfqkeys{/pgf}{use fpu reciprocal/.code={%
1020 \def\pgfmathreciprocal@##1{%
1021 \begingroup
1022 \pgfmathfloatparsenumber{##1}%
1023 \pgfmathfloatreciprocal@{\pgfmathresult}%
1024 \pgfmathfloattofixed@{\pgfmathresult}%
1025 \pgfmath@smuggleone\pgfmathresult
1026 \endgroup
1027 }}}}%
1028 }
1029
1030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1031 %% subcircuits (experimental)
1032 %%
1033 %% introduced by Romano Giannetti around April 2021
1034 %% changes suggested by Jonathan P. Spratte
1035 %%
1036 \newbox\ctikz@scratchbox
1037 \pgfutil@protected\def\ctikzsubcircuitdef#1#2#3{%
1038 \expandafter\gdef\csname #1@Anchor\endcsname{}%
1039 \expandafter\gdef\csname #1@setanchors\endcsname{%
1040 \setbox\ctikz@scratchbox=\hbox{%
1041 \tikzpicture
1042 \draw (0,0) \csname#1\endcsname{T-#1}{};
1043 \foreach [count=\i] \anchor in {#2}
1044 % reference anchor is -center
1045 \draw (0,{2-\i/2}) let \p1 = ($(T-#1-subckt@reference)-(T-#1-\anchor)$) in
1046 node[right]{\anchor: \x1,\y1 \expandafter\xdef\csname #1@Anchor\anchor\endcsname{++(\x1,\y1)}};
1047 \endtikzpicture
1048 }%
1049 }%
1050 \expandafter\gdef\csname#1\endcsname##1##2{%
1051 \csname #1@Anchor##2\endcsname coordinate(##1-subckt@reference)#3%
1052 }%
1053 }
1054 \long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname}
1055
1056
1057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1058 %% Basic utility macros
1059 %%
1060 %% Functions provided here are:
1061 %% \pgf@circ@ifempty{<argument>}{<true>}{<false>}
1062 %% Tests whether <argument> is completely empty.
1063 %% \pgf@circ@ifblank{<argument>}{<true>}{<false>}
1064 %% Tests whether <argument> is either empty or only contains spaces.
1065 %% \pgf@circ@trimspaces@do{<argument>}{<next>}
1066 %% Trims at most one space from either end of <argument> and forwards the
1067 %% result to <next> as <next>{<trimmed argument>}
1068
1069 % these two are pretty standard code
1070 \long\def\pgf@circ@ifempty#1%
1071 {%
1072 \if\relax\detokenize{#1}\relax
1073 \expandafter\pgfutil@firstoftwo
1074 \else
1075 \expandafter\pgfutil@secondoftwo
1076 \fi
1077 }
1078 \long\def\pgf@circ@ifblank#1%
1079 {%
1080 \if\relax\detokenize\expandafter{\pgfutil@gobble#1.}\relax
1081 \expandafter\pgfutil@firstoftwo
1082 \else
1083 \expandafter\pgfutil@secondoftwo
1084 \fi
1085 }
1086
1087 % \pgfutil@trimspaces needs two expansions. The first expansion we'll do during
1088 % the definition.
1089 \def\pgf@circ@trimspaces@do#1%
1090 {%
1091 \def\pgf@circ@trimspaces@do##1%
1092 {\expandafter\pgf@circ@trimspaces@do@\expandafter{#1}}%
1093 }
1094 \expandafter\pgf@circ@trimspaces@do\expandafter{\pgfutil@trimspaces{#1}}
1095 \def\pgf@circ@trimspaces@do@#1#2{#2{#1}}
1096
1097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1098 %% list handling
1099 %%
1100 %% Contribution by Jonathan P. Spratte (blame him!)
1101 %%
1102 %% The list implementation here has a few limitations. Those are:
1103 %% 1. not long, so no \par in the lists (but many used functions in pgfutil
1104 %% aren't long as well)
1105 %% 2. list elements can't contain a Q with category code 3 (but the used
1106 %% function \pgfutil@trimspaces doesn't support them as well, and this
1107 %% should be a very rare token anyway)
1108 %% 3. list elements can't contain the token \pgf@circ@set@list as that is used
1109 %% as the end marker
1110 %% 4. currently these lists are meant for numeric data (hence only
1111 %% \pgf@circ@if@num@in@list is provided as a test), as a result there is
1112 %% another limitation for the data here. If the list element contains no
1113 %% hyphen '-', the element will be stored without further processing
1114 %% 'as-is' (well, after trimming spaces). If there is a hyphen we assume
1115 %% well-behaved input data and will interpret this as a num-range without
1116 %% further tests.
1117 %%
1118 %% Functions provided here are:
1119 %% \pgf@circ@set@list<macro>{<csv-list>}
1120 %% Parses the <csv-list> and stores the result inside <macro> (local
1121 %% assignment). If a num-range given as <start - stop> (with or without
1122 %% spaces) is found it will be expanded to <start>,<start+1>,...,<stop>.
1123 %% \pgf@circ@if@num@in@list<macro>{<value>}{<true>}{<false>}
1124 %% Checks whether <value> (numeric value, evaluated once with \numexpr) is
1125 %% found inside the list stored in <macro>. There are two special cases: If
1126 %% <macro> is undefined <false> is executed. If the list contains only one
1127 %% element and that is `all' <true> is executed.
1128
1129 % set the catcode of our marker
1130 \chardef\pgf@circ@temp=\the\catcode`\Q
1131 \catcode`\Q=3
1132
1133 % lists will have the structure
1134 % <marker><element 1><marker>...<element n><marker>
1135 % As marker we use a Q with category 3. Under the assumption that no list
1136 % element does ever contain that token we can set the elements without braces,
1137 % allowing us to use \pgfutil@in@ to search for elements (see above). The other
1138 % token that isn't allowed to show up in the list is \pgf@circ@set@list, that we
1139 % use as another marker during parsing.
1140 % The other big restriction in this implementation is that lists can't contain a
1141 % \par (but \pgfutil@in@ doesn't support that anyway so there is not much
1142 % sense in supporting it here)
1143 \pgfutil@protected\def\pgf@circ@set@list#1#2%
1144 {%
1145 % clear the error flag
1146 \let\pgf@circ@error@marker\pgf@circ@undefined
1147 % set the list
1148 \edef#1%
1149 {Q\pgf@circ@set@list@sanitize#2,\pgf@circ@set@list,\pgf@circ@set@list}%
1150 % there was an error, throw the error message, recovery was already done by
1151 % ignoring the offending elements.
1152 \ifx\pgf@circ@error@marker\relax
1153 \begingroup
1154 \newlinechar`\^^J
1155 \pgfutil@packageerror{circuitikz}
1156 {%
1157 Unallowed marker found in list^^J%
1158 \pgfutil@unexpanded{#2}.^^J%
1159 Offending elements were ignored.%
1160 }
1161 {Lists can't contain a Q with category code 3}%
1162 \endgroup
1163 \fi
1164 }
1165 % just a utility for the <marker> test
1166 \def\pgf@circ@set@list@gobbletomarker#1Q{}
1167 % quick way to check whether list parsing is done by gobbling up to a marker, in
1168 % this case the marker is \pgf@circ@set@list
1169 \def\pgf@circ@set@list@sanitize@checkend#1\pgf@circ@set@list{}
1170 % will only be called after the last element is handled, will gobble the
1171 % remainder of the current sanitizing step
1172 \def\pgf@circ@set@list@sanitize@end\pgf@circ@set@list#1\pgf@circ@set@list{}
1173 % grabs the next list element, checks whether we're done, and if not sanitizes
1174 % it (meaning stripping spaces from either end and placing the <marker>).
1175 \def\pgf@circ@set@list@sanitize#1,%
1176 {%
1177 \pgf@circ@set@list@sanitize@checkend
1178 #1\pgf@circ@set@list@sanitize@end\pgf@circ@set@list
1179 \pgf@circ@set@list@sanitize@a{#1}%
1180 }
1181 % testing whether a list element contains the used <marker> expandably, if it
1182 % does set the flag, else continue sanitizing.
1183 \def\pgf@circ@set@list@sanitize@a#1%
1184 {%
1185 \expandafter\pgf@circ@ifempty\expandafter
1186 % if this is empty no marker was found
1187 {\pgf@circ@set@list@gobbletomarker#1Q}
1188 {%
1189 \pgf@circ@ifblank{#1}
1190 {}% ignore blank entries
1191 {\pgf@circ@trimspaces@do{#1}\pgf@circ@set@list@sanitize@b}%
1192 }
1193 {%
1194 % panic, there was a marker found in a list element. We'll recover by
1195 % ignoring the current element after setting a flag. When we do
1196 % \csname ...\endcsname on an undefined macro name TeX will let that
1197 % macro to relax and we exploit this to expandable set a flag and
1198 % gobbling the result.
1199 \expandafter\pgfutil@gobble\csname pgf@circ@error@marker\endcsname
1200 }%
1201 % get the next element
1202 \pgf@circ@set@list@sanitize
1203 }
1204 % we'll protect any element from further expanding using \unexpanded and place
1205 % the marker after the element, and ignore empty/blank elements
1206 \def\pgf@circ@set@list@sanitize@b#1%
1207 {%
1208 \expandafter\pgf@circ@ifempty\expandafter
1209 % if this is empty no hyphen is found
1210 {\pgf@circ@gobbletohyphen#1-}
1211 {\pgfutil@unexpanded{#1}Q}
1212 {\pgf@circ@set@list@parse@range{#1}}%
1213 }
1214 \def\pgf@circ@gobbletohyphen#1-{}
1215 \def\pgf@circ@set@list@parse@range#1{\pgf@circ@set@list@parse@range@a#1Q}
1216 \def\pgf@circ@set@list@parse@range@a#1-#2Q%
1217 {%
1218 \expandafter\pgf@circ@set@list@parse@range@b
1219 \the\numexpr#1\expandafter Q\the\numexpr#2Q%
1220 }
1221 \def\pgf@circ@set@list@parse@range@b#1Q#2Q%
1222 {%
1223 \ifnum#1<#2
1224 % expand to the range from #1 to #2 (inclusive)
1225 \pgf@circ@set@list@range{#1}{#2}%
1226 \else
1227 \ifnum#2<#1
1228 % if #2 is smaller than #1 just swap the order
1229 \pgf@circ@set@list@range{#2}{#1}%
1230 \else
1231 % last case, they are equal, so just put the result here
1232 #1Q%
1233 \fi
1234 \fi
1235 }
1236 \def\pgf@circ@set@list@parse@range@norange#1Q#2{\pgfutil@unexpanded{#2}Q}
1237 \def\pgf@circ@set@list@range#1#2%
1238 {%
1239 #1Q%
1240 \ifnum#1<#2
1241 \expandafter\pgfutil@secondoftwo
1242 \fi
1243 \pgfutil@gobble
1244 {\expandafter\pgf@circ@set@list@range\expandafter{\the\numexpr#1+1}{#2}}%
1245 }
1246
1247 % flag for special value
1248 \def\pgf@circ@all@flag{QallQ}
1249 \pgfutil@protected\def\pgf@circ@if@num@in@list#1#2%
1250 {%
1251 % test whether the list macro is defined, if it isn't result is false
1252 \pgfutil@ifx\pgf@circ@undefined#1%
1253 {\pgfutil@secondoftwo}
1254 {%
1255 % test whether the list macro is just the special value 'all', if so
1256 % true, else search (and start that by evaluating a numexpr)
1257 \pgfutil@ifx\pgf@circ@all@flag#1%
1258 {\pgfutil@firstoftwo}
1259 {%
1260 \expandafter\pgf@circ@if@num@in@list@a\expandafter
1261 {\the\numexpr#2}%
1262 #1%
1263 }%
1264 }%
1265 }
1266 % next step is expanding the list macro
1267 \pgfutil@protected\def\pgf@circ@if@num@in@list@a#1#2%
1268 {\expandafter\pgf@circ@if@num@in@list@b\expandafter{#2}{#1}}
1269 % now use \pgfutil@in@ to check whether there is the searched list element
1270 \pgfutil@protected\def\pgf@circ@if@num@in@list@b#1#2%
1271 {%
1272 \begingroup
1273 % put the <marker> around the number to make sure only full matches are
1274 % found. \pgfutil@in@ will set \ifpgfutil@in@ to true if it finds a match
1275 \pgfutil@in@{Q#2Q}{#1}%
1276 \expandafter
1277 \endgroup
1278 \ifpgfutil@in@
1279 \expandafter\pgfutil@firstoftwo
1280 \else
1281 \expandafter\pgfutil@secondoftwo
1282 \fi
1283 }
1284
1285 % reset the catcode of Q
1286 \catcode`\Q=\pgf@circ@temp
1287
1288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289 %% temporary fix for old TikZ versions (remove me)
1290 %%
1291 %% All blame to Romano Giannetti for this code!
1292 %%
1293 %% This tries to be smart and provide \pgfutil@unexpanded and \pgfutil@ifx if
1294 %% PGF doesn't provide them.
1295
1296 \ifx\pgfutil@unexpanded\pgf@circ@undefined
1297 \ifpgfutil@format@is@context
1298 \let\pgfutil@unexpanded\normalunexpanded
1299 \else
1300 \let\pgfutil@unexpanded\unexpanded
1301 \fi
1302 \fi
1303
1304 \ifx\pgfutil@ifx\pgf@circ@undefined
1305 \long\def\pgfutil@ifx#1#2{%
1306 \ifx#1#2%
1307 \expandafter\pgfutil@firstoftwo
1308 \else
1309 \expandafter\pgfutil@secondoftwo
1310 \fi}
1311 \fi
1312
1313 %%
1314 %% generic tunable arrow for components that have no "variable" thing
1315 %%
1316 \def\ctikztunablearrow{\pgfutil@ifnextchar[{\ctikztunablearrow@full}{\ctikztunablearrow@simple}}%
1317 \def\ctikztunablearrow@simple{\ctikztunablearrow@full[]}%
1318 \def\ctikztunablearrow@full[#1]#2#3#4#5{%
1319 % add tunable arrow to a component
1320 % relative thickness, relative length, rotation from axis, name of the component
1321 \scope
1322 \draw
1323 \pgfextra{\pgfcirc@set@arrows{tunable}{}{latexslim}
1324 \pgfsetlinewidth{#2\pgflinewidth}} [#1]
1325 let \p1=($(#5.north east)-(#5.south west)$), \p2=($(#5.east)-(#5.west)$),
1326 \n1 = {veclen(\x1,\y1)},
1327 \n2 = {atan2(\y2,\x2)} in
1328 % node[above]{\n1, \n2}
1329 (#5.center) ++({\n2+(#4)}:{-0.5*(\n1)*(#3)}) -- ++({\n2+(#4)}:{(\n1)*(#3)});
1330 \endscope
1331 }
1332 %%%---------- close: tex/pgfcircutils
1333 %%%%%%%%%%% Springe nach tex/pgfcircpath
1334 %%%---------- open: tex/pgfcircpath.tex
1335 % Copyright 2018-2026 by Romano Giannetti
1336 % Copyright 2015-2026 by Stefan Lindner
1337 % Copyright 2013-2026 by Stefan Erhardt
1338 % Copyright 2007-2026 by Massimo Redaelli
1339 %
1340 % This file may be distributed and/or modified
1341 %
1342 % 1. under the LaTeX Project Public License and/or
1343 % 2. under the GNU Public License.
1344 %
1345 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
1346
1347
1348 \def\pgf@circ@direction{0.0}
1349
1350 % swap two coordinates
1351 \def\pgfcirc@swap@coordinates#1#2{%
1352 coordinate (pgfcirc@tmp@swap) at (#1)
1353 coordinate (#1) at (#2)
1354 coordinate (#2) at (pgfcirc@tmp@swap)
1355 }
1356
1357 % Names
1358 \ctikzset{name/.style = { n={#1} } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
1359 \ctikzset{n/.code = {
1360 \pgfkeys{/tikz/circuitikz/bipole/name={#1}}
1361 }}
1362
1363 % Reflect the node along
1364 \ctikzset{mirrored/.is choice}
1365 \ctikzset{mirror value/.initial=1}
1366 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
1367 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
1368 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
1369
1370 % Invert node along path
1371 \ctikzset{inverted/.is choice}
1372 \ctikzset{invert value/.initial=1}
1373 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
1374 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
1375 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
1376 \newif\ifpgf@circuit@bipole@inverted
1377 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
1378
1379 \newif\ifpgf@circuit@bipole@voltage@backward
1380 \ctikzset{bipole/voltage/direction/.is choice}
1381 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
1382 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
1383
1384 % Initialize paths
1385 \def\pgfcircresetpath{
1386 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
1387 bipole/inverted=false, bipole/kind=,
1388 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
1389 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
1390 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
1391 bipole/current/y position=above, bipole/current/direction=forward,
1392 mirrored=false
1393 }
1394 }
1395
1396 %
1397 % expandable IF for the extra nodes (thanks to Henri Menke)
1398 % see https://chat.stackexchange.com/transcript/message/56560808#56560808
1399 %
1400 \def\pgfcirc@if@has@i{%
1401 \ifpgfcirc@has@i
1402 \expandafter\pgfutil@firstoftwo
1403 \else
1404 \expandafter\pgfutil@secondoftwo
1405 \fi}
1406 \def\pgfcirc@if@has@v{%
1407 \ifpgfcirc@has@v
1408 \expandafter\pgfutil@firstoftwo
1409 \else
1410 \expandafter\pgfutil@secondoftwo
1411 \fi}
1412 \def\pgfcirc@if@has@f{%
1413 \ifpgfcirc@has@f
1414 \expandafter\pgfutil@firstoftwo
1415 \else
1416 \expandafter\pgfutil@secondoftwo
1417 \fi}
1418
1419
1420
1421 %% Generic bipole path
1422 \def\pgf@circ@bipole@path#1#2{
1423 % Create a bipole path from the shapes defined with \pgfcircdeclarebipole
1424 % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape"
1425 % appended to the main (path-style) name
1426 % #1 path-style node name
1427 % #2 the argument passed from the to-path structure; don't touch
1428 %
1429 % Example:
1430 % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
1431 %
1432 \pgf@circ@bipole@path@base{shape}{}{#1}{#2}
1433 }
1434 %%
1435 %% ultra-generic bipole path
1436 %% I am not sure what the last argument is needed for, but don't touch it or everything explodes
1437 %%
1438 \def\pgf@circ@bipole@path@base#1#2#3#4{%
1439 %
1440 % Create a path-style component based on a node-style shape
1441 % #1: postfix to be added to the name path to obtain the main shape name
1442 % #2: text to be passed as text to the node
1443 % #3: name of the bipole component
1444 % #4: this will be filled by the argument of the to-path
1445 %
1446 \pgfextra{
1447 \ctikzset{bipole/kind = #3}
1448 \edef\pgf@temp{\ctikzvalof{bipole/name}}
1449 \def\pgf@circ@temp{}
1450 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
1451 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
1452 \ctikzset{bipole/name = pgfcirc@#3\pgf@circ@rand} % create it (re-usage should not create problem, but...)
1453 \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing
1454 \else
1455 \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors
1456 \fi
1457 }
1458 % save start and stop values
1459 % notice that we DO NOT MOVE the path position at all!
1460 coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart)
1461 coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget)
1462 \pgfextra{
1463 % find the direction (angle) of the path
1464 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
1465 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
1466 \edef\pgf@circ@direction{\pgfmathresult}
1467 % the global macro pgfcirc@whatever-direction is accessible as \ctikzgetdirection{whatever}
1468 % this gives access to the element path direction
1469 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction}
1470 }
1471 % position the component in the middle of the path. We DO NOT MOVE the current position!
1472 node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value},
1473 xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name})
1474 at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2}
1475 % set start and end labels
1476 \ifpgf@circuit@bipole@inverted
1477 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
1478 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
1479 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
1480 \else
1481 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.right)
1482 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.left)
1483 \fi
1484 \else
1485 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
1486 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
1487 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
1488 \else
1489 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.left)
1490 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.right)
1491 \fi
1492 \fi
1493 % draw the leads unless it's an open circuit
1494 % stop at the component
1495 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
1496 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
1497 \else
1498 % it is important to start the path with -- to have correct line joins!
1499 -- (pgfcirc@anchorstartnode)
1500 \fi
1501 % Add all the "ornaments": labels, annotations, voltages, currents and flows
1502 \drawpoles
1503 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
1504 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
1505 % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a
1506 % it should be logically safe for older version too --- even if TikZ reverted the change
1507 % use explandable ifs too, thanks to Henri Menke
1508 {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}%
1509 {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}%
1510 {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}%
1511 % finish the path from the component to the final target
1512 % you never know --- re-set \pgf@temp to detect open
1513 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
1514 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
1515 (\tikztotarget)
1516 \else
1517 (pgfcirc@anchorendnode) -- (\tikztotarget)
1518 \fi
1519 % reset internal circuit keys
1520 \pgfextra{\pgfcircresetpath}
1521 %draw pending nodes an path
1522 \tikztonodes
1523 }
1524
1525 %% Macros for path and style activation for bipoles or path-style
1526
1527 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
1528 \def\compattikzset#1{%
1529 % \typeout{BIPOLEDEF:\space \detokenize{#1}}%
1530 \tikzset{\comnpatname#1}}
1531 %
1532 % this is used for components that are mainly node-style but have a path-style form
1533 %
1534 \def\pgfcirc@node@to@path#1#2#3{%
1535 % add a path-style component based on a node-style one without mangling the name
1536 % of the shape.
1537 % #1: node-type shape name (existing)
1538 % #2: path-type name (to be created)
1539 % #3: additional options to add to the path style
1540 %
1541 \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}%
1542 \compattikzset{#2/.style = {\circuitikzbasekey,
1543 /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1},
1544 #3}}%
1545 \ctikzset{bipoles/#1/height/.initial=1}%
1546 }
1547 %
1548 % this one is for normal definition: path to style, directly
1549 % the first parameter (#1) here is l,v,i (l=..., v=..., i=...)
1550 % the last parameter are options to be inserted in the "to path" definition
1551 %
1552 \def\pgfcirc@path@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@#2@path to style #3
1553 \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\csname pgf@circ@#2@path\endcsname, #1={##1}}}%
1554 }
1555 % this one create a alias style from a node definition
1556 \def\pgfcirc@node@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@bipole@path{#2} to style #3
1557 \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\pgf@circ@bipole@path{#2}, #1={##1}}}%
1558 }
1559 % this create an alias style
1560 \def\pgfcirc@style@to@style#1#2{% alias style #1 to style #2
1561 \compattikzset{#2/.style={\comnpatname #1={##1}}}%
1562 }
1563 % this create an alias style, changing the labelling
1564 \def\pgfcirc@style@to@style@label#1#2#3{% alias style #1 to style #2
1565 \compattikzset{#2/.style={\comnpatname #1, #3={##1}}}%
1566 }
1567 % create a bipole
1568 \def\pgfcirc@activate@bipole#1#2#3#4{% path name, base node name, style name
1569 \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}%
1570 \pgfcirc@path@to@style{#1}{#2}{#4}{}% no options here, let's see
1571 }
1572 \def\pgfcirc@activate@bipole@simple#1#2{\pgfcirc@activate@bipole{#1}{#2}{#2}{#2}}
1573 % create a bipole with options
1574 \def\pgfcirc@activate@bipole@opt#1#2#3#4#5{% path name, base node name, style name
1575 \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}%
1576 \pgfcirc@path@to@style{#1}{#2}{#4}{#5}% no options here, let's see
1577 }
1578 \def\pgfcirc@activate@bipole@simple@opt#1#2#3{\pgfcirc@activate@bipole@opt{#1}{#2}{#2}{#2}{#3}}
1579
1580
1581 %% New system, for simple object
1582 %% \pgfcirc@activate@bipole@simple{l}{mass}
1583 %% New system, different names
1584 %% The old system is the following
1585 %% 1 - define just the pgf@circ@path@whatever#1
1586 %% (see for example the variable one)
1587 %% 2 - set the style
1588 %% \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l={#1}}}
1589
1590 %% Path definition with the new mechanism have been moved to where the nodes
1591 %% are defined.
1592
1593 %% Handling of terminals%<<<
1594
1595 \ctikzset{bipole/nodes/.is family}
1596 \ctikzset{bipole/nodes/left/.initial=none}
1597 \ctikzset{bipole/nodes/right/.initial=none}
1598 \tikzset{bipole nodes/.style n args={2}{%
1599 \circuitikzbasekey/bipole/nodes/left=#1,
1600 \circuitikzbasekey/bipole/nodes/right=#2
1601 }
1602 }
1603
1604 %% Easily usable styles
1605
1606 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1607 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1608 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
1609 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1610 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
1611 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1612 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1613 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
1614 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
1615 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
1616 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1617 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
1618 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
1619 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1620 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1621
1622 % rectjoinfill workarounds
1623
1624 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
1625 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
1626 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
1627 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
1628 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1629 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1630 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1631 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1632 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
1633
1634 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
1635
1636 \def\drawpoles{
1637 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
1638 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
1639 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
1640 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
1641 }
1642 % %>>>
1643
1644 %%
1645 %% Definition of path for transistors
1646 %%
1647 % Transistor like bipoles
1648
1649 \def\pgf@circ@trans@path#1#2{
1650 \pgfextra{
1651 \edef\pgf@temp{\ctikzvalof{bipole/name}}
1652 \def\pgf@circ@temp{#2}
1653 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
1654 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
1655 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
1656 \fi
1657 }
1658 \ifpgf@circuit@bipole@inverted
1659 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
1660 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
1661 \else
1662 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
1663 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
1664 \fi
1665 \pgfextra{
1666 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
1667 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
1668 \pgfmathadd{\pgfmathresult}{-90}
1669 \pgfmathround{\pgfmathresult}
1670 \edef\pgf@circ@direction{\pgfmathresult}
1671 }
1672 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
1673 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
1674 (\ctikzvalof{bipole/name}) {}
1675 node {\ctikzvalof{bipole/label/name}}
1676 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
1677 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
1678 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
1679 \else
1680 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
1681 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
1682 \fi
1683 \drawpoles
1684 \pgfextra{
1685 \pgfcircresetpath
1686 }
1687 (\tikztotarget) \tikztonodes % and go on!
1688 }
1689
1690 \def\pgf@circ@definetranspath#1{
1691 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
1692 }
1693
1694 %
1695 % vim: set fdm=marker fmr=%<<<,%>>>:
1696 %%%---------- close: tex/pgfcircpath
1697
1698 %%%%%%%%%%% Springe nach tex/pgfcircshapes
1699 %%%---------- open: tex/pgfcircshapes.tex
1700 % Copyright 2018-2026 by Romano Giannetti
1701 % Copyright 2015-2026 by Stefan Lindner
1702 % Copyright 2013-2026 by Stefan Erhardt
1703 % Copyright 2007-2026 by Massimo Redaelli
1704 %
1705 % This file may be distributed and/or modified
1706 %
1707 % 1. under the LaTeX Project Public License and/or
1708 % 2. under the GNU Public License.
1709 %
1710 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
1711
1712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1713 %% Other shapes
1714
1715 %% Nothing
1716
1717 \pgfdeclareshape{emptyshape}{
1718 \savedanchor{\northeast}{%
1719 \pgf@x=.5\wd\pgfnodeparttextbox%
1720 \pgf@y=.5\ht\pgfnodeparttextbox%
1721 }
1722 \anchor{north}{\northeast\pgf@x=0cm\relax}
1723 \anchor{east}{\northeast\pgf@y=0cm\relax}
1724 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
1725 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
1726 \anchor{north east}{\northeast}
1727 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
1728 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
1729 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
1730 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
1731 \anchor{center}{
1732 \pgfpointorigin
1733 }
1734 }
1735 %
1736 % Provision for changing opacity. Only expert use, see the manual.
1737 %
1738 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
1739 \tikzset{open poles opacity/.code={%
1740 \ctikzset{poles/open fill opacity=#1}%
1741 }}
1742 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
1743 \tikzset{full poles opacity/.code={%
1744 \ctikzset{poles/full fill opacity=#1}%
1745 }}
1746
1747 %
1748 % Provision for changing default background
1749 %
1750
1751 \ctikzset{open poles fill/.initial={white}}
1752
1753 %% Full terminal
1754
1755 \pgfdeclareshape{circ}{
1756 \anchor{center}{
1757 \pgfpointorigin
1758 }
1759 \savedanchor\northwest{%
1760 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
1761 \pgf@x=-\pgf@y
1762 }
1763 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
1764 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1765 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1766 \anchor{west}{ \northwest \pgf@y=0pt }
1767 \anchor{w}{ \northwest \pgf@y=0pt }
1768 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1769 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1770 \anchor{north}{ \northwest \pgf@x=0pt }
1771 \anchor{n}{ \northwest \pgf@x=0pt }
1772 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
1773 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
1774 \anchor{north west}{ \northwest }
1775 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
1776 \anchorborder{
1777 \pgf@circ@res@left=\pgf@x
1778 \pgf@circ@res@up=\pgf@y
1779 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
1780 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
1781 }
1782 \behindforegroundpath{
1783 \pgfscope
1784 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
1785 \pgfsetcolor{\ctikzvalof{color}}
1786 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
1787 \pgfusepath{draw,fill}
1788 \endpgfscope
1789 }
1790 }
1791
1792 %% Empty round terminal
1793
1794 \pgfdeclareshape{ocirc}{
1795 \anchor{center}{
1796 \pgfpointorigin
1797 }
1798 \savedanchor\northwest{%
1799 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
1800 \pgf@x=-\pgf@y
1801 }
1802 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
1803 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1804 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1805 \anchor{west}{ \northwest \pgf@y=0pt }
1806 \anchor{w}{ \northwest \pgf@y=0pt }
1807 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1808 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1809 \anchor{north}{ \northwest \pgf@x=0pt }
1810 \anchor{n}{ \northwest \pgf@x=0pt }
1811 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
1812 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
1813 \anchor{north west}{ \northwest }
1814 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
1815 \anchorborder{
1816 \pgf@circ@res@left=\pgf@x
1817 \pgf@circ@res@up=\pgf@y
1818 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
1819 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
1820 }
1821 \behindforegroundpath{
1822 \pgfscope
1823 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
1824 \pgfsetcolor{\ctikzvalof{color}}
1825 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
1826 \ifx\tikz@fillcolor\pgfutil@empty
1827 % set the default fill color to white
1828 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
1829 % ...but override it if the class is defined!
1830 % note that this element has no class, but will inherit it when used
1831 % into another component
1832 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
1833 \else
1834 \pgfsetfillcolor{\tikz@fillcolor}
1835 \fi
1836 \pgfusepath{draw,fill}
1837 \endpgfscope
1838 }
1839 }
1840
1841 %% Diamond terminal
1842
1843 \pgfdeclareshape{diamondpole}{
1844 \anchor{center}{
1845 \pgfpointorigin
1846 }
1847 \savedanchor\northwest{%
1848 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
1849 \pgf@x=-\pgf@y
1850 }
1851 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
1852 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1853 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1854 \anchor{west}{ \northwest \pgf@y=0pt }
1855 \anchor{w}{ \northwest \pgf@y=0pt }
1856 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1857 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1858 \anchor{north}{ \northwest \pgf@x=0pt }
1859 \anchor{n}{ \northwest \pgf@x=0pt }
1860 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
1861 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
1862 \anchor{north west}{ \northwest }
1863 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
1864 \anchorborder{
1865 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
1866 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
1867 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
1868 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
1869 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
1870 \pgfextracty{\pgf@circ@res@up}{\northwest}
1871 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
1872 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
1873 \pgfpointintersectionoflines
1874 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
1875 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
1876 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
1877 \pgf@x=\@@switchx\pgf@x
1878 \pgf@y=\@@switchy\pgf@y
1879 }
1880 \behindforegroundpath{
1881 \pgfscope
1882 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
1883 \pgftransformrotate{45}
1884 \pgfpathrectanglecorners
1885 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
1886 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
1887 \pgfsetcolor{\ctikzvalof{color}}
1888 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
1889 \pgfusepath{draw,fill}
1890 \endpgfscope
1891 }
1892 }
1893
1894 %% Diamond terminal, unfilled
1895
1896 \pgfdeclareshape{odiamondpole}{
1897 \anchor{center}{
1898 \pgfpointorigin
1899 }
1900 \savedanchor\northwest{%
1901 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
1902 \pgf@x=-\pgf@y
1903 }
1904 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
1905 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1906 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1907 \anchor{west}{ \northwest \pgf@y=0pt }
1908 \anchor{w}{ \northwest \pgf@y=0pt }
1909 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1910 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1911 \anchor{north}{ \northwest \pgf@x=0pt }
1912 \anchor{n}{ \northwest \pgf@x=0pt }
1913 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
1914 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
1915 \anchor{north west}{ \northwest }
1916 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
1917 \anchorborder{
1918 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
1919 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
1920 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
1921 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
1922 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
1923 \pgfextracty{\pgf@circ@res@up}{\northwest}
1924 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
1925 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
1926 \pgfpointintersectionoflines
1927 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
1928 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
1929 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
1930 \pgf@x=\@@switchx\pgf@x
1931 \pgf@y=\@@switchy\pgf@y
1932 }
1933 \behindforegroundpath{
1934 \pgfscope
1935 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
1936 \pgftransformrotate{45}
1937 \pgfpathrectanglecorners
1938 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
1939 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
1940 \pgfsetcolor{\ctikzvalof{color}}
1941 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
1942 \ifx\tikz@fillcolor\pgfutil@empty
1943 % set the default fill color to white
1944 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
1945 % ...but override it if the class is defined!
1946 % note that this element has no class, but will inherit it when used
1947 % into another component
1948 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
1949 \else
1950 \pgfsetfillcolor{\tikz@fillcolor}
1951 \fi
1952 \pgfusepath{draw,fill}
1953 \endpgfscope
1954 }
1955 }
1956
1957 %% square terminal, filled
1958
1959 \pgfdeclareshape{squarepole}{
1960 \anchor{center}{
1961 \pgfpointorigin
1962 }
1963 \savedanchor\northwest{%
1964 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
1965 \pgf@x=-\pgf@y
1966 }
1967 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
1968 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1969 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
1970 \anchor{west}{ \northwest \pgf@y=0pt }
1971 \anchor{w}{ \northwest \pgf@y=0pt }
1972 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1973 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
1974 \anchor{north}{ \northwest \pgf@x=0pt }
1975 \anchor{n}{ \northwest \pgf@x=0pt }
1976 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
1977 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
1978 \anchor{north west}{ \northwest }
1979 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
1980 \anchorborder{
1981 \pgf@xa=\pgf@x
1982 \pgf@ya=\pgf@y
1983 \pgfextracty{\pgf@circ@res@up}{\northwest}
1984 \pgfpointborderrectangle
1985 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
1986 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
1987 }
1988 \behindforegroundpath{
1989 \pgfscope
1990 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
1991 \pgfpathrectanglecorners
1992 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
1993 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
1994 \pgfsetcolor{\ctikzvalof{color}}
1995 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
1996 \pgfusepath{draw,fill}
1997 \endpgfscope
1998 }
1999 }
2000 %% square terminal, unfilled
2001
2002 \pgfdeclareshape{osquarepole}{
2003 \anchor{center}{
2004 \pgfpointorigin
2005 }
2006 \savedanchor\northwest{%
2007 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2008 \pgf@x=-\pgf@y
2009 }
2010 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2011 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2012 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2013 \anchor{west}{ \northwest \pgf@y=0pt }
2014 \anchor{w}{ \northwest \pgf@y=0pt }
2015 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2016 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2017 \anchor{north}{ \northwest \pgf@x=0pt }
2018 \anchor{n}{ \northwest \pgf@x=0pt }
2019 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2020 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2021 \anchor{north west}{ \northwest }
2022 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2023 \anchorborder{
2024 \pgf@xa=\pgf@x
2025 \pgf@ya=\pgf@y
2026 \pgfextracty{\pgf@circ@res@up}{\northwest}
2027 \pgfpointborderrectangle
2028 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2029 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2030 }
2031 \behindforegroundpath{
2032 \pgfscope
2033 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2034 \pgfpathrectanglecorners
2035 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2036 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2037 \pgfsetcolor{\ctikzvalof{color}}
2038 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2039 \ifx\tikz@fillcolor\pgfutil@empty
2040 % set the default fill color to white
2041 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2042 % ...but override it if the class is defined!
2043 % note that this element has no class, but will inherit it when used
2044 % into another component
2045 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2046 \else
2047 \pgfsetfillcolor{\tikz@fillcolor}
2048 \fi
2049 \pgfusepath{draw,fill}
2050 \endpgfscope
2051 }
2052 }
2053 % BNC connector
2054
2055 \pgfdeclareshape{bnc}{
2056 \anchor{center}{
2057 \pgfpointorigin
2058 }
2059 % BNC size is 2.5 times the size of the internal "ocirc"
2060 \savedanchor\northwest{%
2061 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2062 \pgf@y=2.5\pgf@y
2063 \pgf@x=-\pgf@y
2064 }
2065 % center is on the opening
2066 \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2067 \anchor{zero}{ \pgfpointorigin }
2068 \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2069 \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2070 % geo-anchors
2071 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2072 \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2073 \anchor{west}{ \northwest \pgf@y=0pt }
2074 \anchor{left}{ \northwest \pgf@y=0pt }
2075 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2076 \anchor{north}{ \northwest \pgf@x=0pt }
2077 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2078 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2079 \anchor{north west}{ \northwest }
2080 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2081 % put the node text above and centered
2082 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
2083 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
2084 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
2085 }
2086 }
2087 \anchorborder{
2088 \pgf@circ@res@left=\pgf@x
2089 \pgf@circ@res@up=\pgf@y
2090 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2091 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2092 }
2093 \behindforegroundpath{
2094 \pgfextracty{\pgf@circ@res@other}{\northwest}
2095 \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen
2096 \pgfscope
2097 \pgfstartlinewidth=\pgflinewidth
2098 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
2099 \pgfsetcolor{\ctikzvalof{color}}
2100 % external circle
2101 \pgfscope
2102 % clipping path: first a rectangle bigger then the shape
2103 % to avoid problems with the line thickness
2104 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
2105 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
2106 % next the opening to the right
2107 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
2108 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
2109 % do the difference and clip before drawing
2110 \pgfseteorule
2111 \pgfusepath{clip}
2112 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
2113 \pgfusepath{draw}
2114 \endpgfscope
2115 % internal circle
2116 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
2117 \pgf@circ@draworfill
2118 % and the contact line to the right
2119 \pgfsetlinewidth{\pgfstartlinewidth}
2120 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2121 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
2122 \pgfusepath{draw}
2123 \endpgfscope
2124 }
2125 }
2126
2127 %% Fill for correct rectangular joins
2128
2129 \pgfdeclareshape{rectjoinfill}{
2130 \savedanchor{\northeast}{%
2131 \pgf@x=.5\pgflinewidth%
2132 \pgf@y=.5\pgflinewidth%
2133 }
2134 \anchor{north}{\northeast\pgf@x=0cm\relax}
2135 \anchor{east}{\northeast\pgf@y=0cm\relax}
2136 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2137 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2138 \anchor{north east}{\northeast}
2139 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2140 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2141 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2142 \anchor{center}{
2143 \pgfpointorigin
2144 }
2145 \anchorborder{
2146 \pgf@circ@res@left=\pgf@x
2147 \pgf@circ@res@up=\pgf@y
2148 }
2149 \behindforegroundpath{
2150 \pgfscope
2151 \pgfpathrectanglecorners
2152 {\pgfpoint{0}{.5\pgflinewidth}}
2153 {\pgfpoint{0}{-.5\pgflinewidth}}
2154 \pgfsetcolor{\ctikzvalof{color}}
2155 \pgfusepath{draw,fill}
2156 \endpgfscope
2157 }
2158 }
2159
2160 %% transistor arrow
2161
2162 \def\pgf@circ@find@linescale{
2163 % find the scale inverse of the scale factor: line width do not scale
2164 % with scale=..., transform shape so we have to counteract it.
2165 \iftikz@fullytransformed % this is true if `transform shape` is active
2166 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
2167 % Note that this trick is not working inside a `spy` environment...
2168 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
2169 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
2170 \else
2171 \pgfmathsetmacro{\@@factor}{1.0}
2172 \fi
2173 }
2174
2175 \pgfdeclareshape{trarrow}{%
2176 % this arrow is only filled but grows with the linewidth, more or less
2177 % like currarrow do
2178 \savedanchor{\northeast}{%
2179 \pgf@circ@res@step = \pgf@circ@Rlen
2180 \pgf@circ@find@linescale
2181 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2182 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
2183 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2184 }
2185 % The arrow size should be more or less the same of a currarrow, which is
2186 % both filled and stroke, for backward output compatibility (more or less)
2187 %
2188 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
2189 % |-\__ currarrow as the tip at (W,0)
2190 % | | and the upper tail at (-0.7*W, 0.8*W)
2191 % | \__ it then "overshoot" do to the linew width L
2192 % | \__ xangle \alpha
2193 % ---0------->
2194 %
2195 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
2196 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
2197 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
2198 %
2199 \savedanchor{\northwest}{%
2200 \pgf@circ@res@step = \pgf@circ@Rlen
2201 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2202 \pgf@circ@find@linescale
2203 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
2204 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2205 }
2206 \savedanchor{\tip}{%
2207 \pgf@circ@res@step = \pgf@circ@Rlen
2208 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2209 \pgf@circ@find@linescale
2210 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
2211 }
2212 \anchor{north}{\northeast\pgf@x=0cm\relax}
2213 \anchor{east}{\northeast\pgf@y=0cm\relax}
2214 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2215 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2216 \anchor{north east}{\northeast}
2217 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2218 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2219 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2220 \anchor{center}{
2221 \pgfpointorigin
2222 }
2223 \anchor{tip}{
2224 \tip
2225 }
2226 \anchor{btip}{% this anchor is behind the tip of half a linewidth
2227 \tip
2228 \pgf@circ@find@linescale
2229 \pgf@circ@res@temp=\@@factor\pgflinewidth
2230 \advance\pgf@x by -.5\pgf@circ@res@temp
2231 }
2232 \behindforegroundpath{
2233 \pgfscope
2234 \northwest
2235 \pgf@circ@res@up=\pgf@y
2236 \pgf@circ@res@left=\pgf@x
2237 \tip
2238 \pgf@circ@res@step = \pgf@x
2239 %
2240 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2241 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
2242 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2243 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
2244 \pgfpathclose
2245 \pgfsetcolor{\ctikzvalof{color}}
2246 \pgfusepath{fill} % just fill
2247 \endpgfscope
2248 }
2249 }
2250
2251 %% Current arrow
2252
2253 %% we need a phantom version of this shape for advanced v-i-f
2254 %% use strange names to keep ot private
2255 \newif\ifpgfcirc@really@draw@currarrow\pgfcirc@really@draw@currarrowtrue
2256 \ctikzset{phantom@currarrow/.code=\pgfcirc@really@draw@currarrowfalse}
2257 \ctikzset{normal@currarrow/.code=\pgfcirc@really@draw@currarrowtrue}
2258
2259 \pgfdeclareshape{currarrow}{
2260 \savedanchor{\northeast}{%
2261 \pgf@circ@res@step = \pgf@circ@Rlen
2262 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2263 \pgf@x=.5\pgf@circ@res@step
2264 \pgf@y=\pgf@x%
2265 }
2266 \anchor{north}{\northeast\pgf@x=0cm\relax}
2267 \anchor{east}{\northeast\pgf@y=0cm\relax}
2268 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2269 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2270 \anchor{north east}{\northeast}
2271 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2272 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2273 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2274 \anchor{center}{
2275 \pgfpointorigin
2276 }
2277 \anchor{tip}{
2278 \pgfpointorigin
2279 \pgf@circ@res@step = \pgf@circ@Rlen
2280 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2281 \pgf@x =\pgf@circ@res@step
2282 }
2283 \behindforegroundpath{
2284 \pgfscope
2285 \ifpgfcirc@really@draw@currarrow
2286 \pgf@circ@reset@arrows@rounded
2287 \pgf@circ@res@step = \pgf@circ@Rlen
2288 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2289
2290 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
2291 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2292 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2293 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2294 \pgfpathclose
2295 \pgfsetcolor{\ctikzvalof{color}}
2296 \pgfusepath{draw,fill}
2297 \fi
2298 \endpgfscope
2299 }
2300 }
2301
2302 %% Flow arrow
2303 %% we need a phantom version of this shape for advanced v-i-f
2304 %% use strange names to keep ot private
2305 \newif\ifpgfcirc@really@draw@flowarrow\pgfcirc@really@draw@flowarrowtrue
2306 \ctikzset{phantom@flowarrow/.code=\pgfcirc@really@draw@flowarrowfalse}
2307 \ctikzset{normal@flowarrow/.code=\pgfcirc@really@draw@vlowarrowtrue}
2308
2309 \pgfdeclareshape{flowarrow}{
2310 \savedanchor{\northeast}{%
2311 \pgf@circ@res@step = \pgf@circ@Rlen
2312 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2313 \pgf@y=.5\pgf@circ@res@step
2314 \pgf@circ@res@step = \pgf@circ@Rlen
2315 \divide \pgf@circ@res@step by 4
2316 \pgf@x=\pgf@circ@res@step%
2317 }
2318 \anchor{north}{\northeast\pgf@x=0cm\relax}
2319 \anchor{east}{\northeast\pgf@y=0cm\relax}
2320 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2321 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2322 \anchor{north east}{\northeast}
2323 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2324 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2325 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2326 \anchor{text}{% text centered above
2327 \pgfpointorigin
2328 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
2329 }
2330 \anchor{center}{
2331 \pgfpointorigin
2332 }
2333 \anchor{tip}{
2334 \pgfpointorigin
2335 \pgf@circ@res@step = \pgf@circ@Rlen
2336 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2337 \pgf@x =\pgf@circ@res@step
2338 }
2339 \behindforegroundpath{
2340 \pgfscope
2341 \ifpgfcirc@really@draw@flowarrow
2342 \pgf@circ@reset@arrows@rounded
2343 \pgf@circ@res@step = \pgf@circ@Rlen
2344 \divide \pgf@circ@res@step by 4
2345 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
2346 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2347 \pgfsetcolor{\ctikzvalof{color}}
2348 \pgfusepath{draw}
2349 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
2350 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
2351 \fi
2352 \endpgfscope
2353 }
2354 }
2355
2356 %% Input arrow
2357
2358 \pgfdeclareshape{inputarrow}{
2359 \savedanchor{\northeast}{% this is really not northeast, really -northwest
2360 \pgf@circ@res@step = \pgf@circ@Rlen
2361 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2362 \pgf@y=.5\pgf@circ@res@step
2363 \pgf@x=1.7\pgf@circ@res@step
2364 }
2365 \anchor{north}{\northeast\pgf@x=0cm\relax}
2366 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
2367 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2368 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2369 \anchor{north east}{\northeast\pgf@x=0cm\relax}
2370 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2371 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
2372 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2373 \savedanchor{\tip}{
2374 \pgfpointorigin
2375 }
2376 \anchor{center}{
2377 \tip
2378 }
2379 \anchor{tip}{
2380 \tip
2381 }
2382 \behindforegroundpath{
2383
2384 \pgfscope
2385 \pgf@circ@reset@arrows@rounded
2386 \pgf@circ@res@step = \pgf@circ@Rlen
2387 \divide \pgf@circ@res@step by 16
2388 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
2389 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2390 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
2391 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2392 \pgfpathclose
2393 \pgfsetcolor{\ctikzvalof{color}}
2394 \pgfusepath{fill}
2395 \endpgfscope
2396 }
2397 }
2398
2399
2400 %% box
2401
2402 \pgfdeclareshape{box}{
2403 \anchor{center}{
2404 \pgfpointorigin
2405 }
2406 \behindforegroundpath{
2407
2408 \pgfscope
2409 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
2410 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2411 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2412 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2413 \pgf@circ@draworfill
2414 \endpgfscope
2415 }
2416 }
2417
2418 %% box scaled with blocks
2419
2420 \pgfdeclareshape{blockbox}{
2421 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
2422 \anchor{center}{
2423 \pgfpointorigin
2424 }
2425 \behindforegroundpath{
2426 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
2427 \pgfscope
2428 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
2429 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2430 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2431 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2432 \pgf@circ@draworfill
2433 \endpgfscope
2434 }
2435 }
2436
2437 % full nodes for wire crossing
2438
2439 \pgfdeclareshape{jump crossing}
2440 {
2441 \savedanchor\northwest{%
2442 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2443 \pgf@y=.5\pgf@y
2444 \pgf@x=-\pgf@y
2445 }
2446 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2447 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2448 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2449 \anchor{west}{ \northwest \pgf@y=0pt }
2450 \anchor{w}{ \northwest \pgf@y=0pt }
2451 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2452 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2453 \anchor{north}{ \northwest \pgf@x=0pt }
2454 \anchor{n}{ \northwest \pgf@x=0pt }
2455 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2456 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2457 \anchor{north west}{ \northwest }
2458 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2459 \behindbackgroundpath{
2460 \northwest
2461 \pgf@circ@res@up = \pgf@y
2462 \pgf@circ@res@down = -\pgf@y
2463 \pgf@circ@res@right = -\pgf@x
2464 \pgf@circ@res@left = \pgf@x
2465 % horizontal jumper
2466 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2467 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
2468 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
2469 \pgfsetbeveljoin
2470 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2471 % vertical, broken path
2472 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2473 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
2474 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
2475 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2476 \pgfusepath{draw}
2477
2478 }
2479 }
2480 \pgfdeclareshape{plain crossing}
2481 {
2482 \savedanchor\northwest{%
2483 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2484 \pgf@y=.5\pgf@y
2485 \pgf@x=-\pgf@y
2486 }
2487 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2488 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2489 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2490 \anchor{west}{ \northwest \pgf@y=0pt }
2491 \anchor{w}{ \northwest \pgf@y=0pt }
2492 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2493 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2494 \anchor{north}{ \northwest \pgf@x=0pt }
2495 \anchor{n}{ \northwest \pgf@x=0pt }
2496 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2497 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2498 \anchor{north west}{ \northwest }
2499 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2500 \behindbackgroundpath{
2501 \northwest
2502 \pgf@circ@res@up = \pgf@y
2503 \pgf@circ@res@down = -\pgf@y
2504 \pgf@circ@res@right = -\pgf@x
2505 \pgf@circ@res@left = \pgf@x
2506 % horizontal jumper
2507 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2508 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2509 % vertical, broken path
2510 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2511 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
2512 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
2513 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2514 \pgfusepath{draw}
2515
2516 }
2517 }
2518
2519 %%%---------- close: tex/pgfcircshapes
2520 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
2521 %%%---------- open: tex/pgfcircmonopoles.tex
2522 % Copyright 2018-2026 by Romano Giannetti
2523 % Copyright 2015-2026 by Stefan Lindner
2524 % Copyright 2013-2026 by Stefan Erhardt
2525 % Copyright 2007-2026 by Massimo Redaelli
2526 %
2527 % This file may be distributed and/or modified
2528 %
2529 % 1. under the LaTeX Project Public License and/or
2530 % 2. under the GNU Public License.
2531 %
2532 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2533
2534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2535 %% Monopoles
2536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2537
2538 %%%%%%%%%%%%%
2539 %% Grounds
2540 %%%%%%%%%%%%%
2541
2542
2543 % grounds and power supplies%<<<1
2544
2545 \ctikzset{monopoles/.is family}
2546 \ctikzset{monopoles/ground/width/.initial=.25}
2547 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
2548 \ctikzset{monopoles/ground/thickness/.initial=2}
2549 \ctikzset{monopoles/rground/thickness/.initial=2}
2550 \ctikzset{monopoles/tground/thickness/.initial=3}
2551 \ctikzset{monopoles/vcc/width/.initial=.2}
2552 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
2553 \ctikzset{monopoles/vee/arrow/.initial=legacy}
2554 \ctikzset{monopoles/match/width/.initial=.4}
2555 \ctikzset{monopoles/chassis/width/.initial=.25}
2556 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
2557 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
2558 \ctikzset{monopoles/antenna/width/.initial=.25}
2559 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
2560 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
2561 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
2562 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
2563 \ctikzset{monopoles/txantenna/width/.initial=.25}
2564 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
2565 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
2566 \ctikzset{monopoles/rxantenna/width/.initial=.25}
2567 \ctikzset{monopoles/bareantenna/width/.initial=.25}
2568 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
2569 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
2570 \ctikzset{monopoles/waves/width/.initial=0.5}%
2571 %>>>
2572
2573 %% Node shapes for grounds and power supply%<<<
2574
2575 %% Ground symbol
2576 % #1 -> name
2577 % #2 -> width
2578 % #3 -> depth
2579 % #4 -> code
2580 \long\def\pgf@circ@declareground#1#2#3#4{
2581 \pgfdeclareshape{#1}{
2582 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
2583 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2584 \savedanchor{\southeast}{
2585 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2586 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2587 \pgf@x=#2\pgf@x
2588 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2589 \pgf@y=-#3\pgf@y
2590 }
2591 \anchor{north}{\pgfpointorigin}
2592 \anchor{north east}{\southeast\pgf@y=0pt\relax}
2593 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
2594 \anchor{south east}{\southeast}
2595 \anchor{south}{\southeast\pgf@x=0pt\relax}
2596 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
2597 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
2598 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
2599 \anchor{left}{\pgfpointorigin}
2600 \anchor{right}{\pgfpointorigin}
2601 \anchor{center}{\pgfpointorigin}
2602 \behindforegroundpath{
2603 \pgf@circ@scaled@Rlen=\scaledRlen
2604 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
2605 \pgfscope
2606 \pgfstartlinewidth=\pgflinewidth
2607 #4
2608 \endpgfscope
2609 }
2610 }
2611 }
2612
2613
2614 \pgf@circ@declareground{ground}{0.6}{1.6}{
2615 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
2616 \pgfpathmoveto{\pgfpointorigin}
2617 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
2618 \pgfusepath{draw}
2619 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2620 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2621 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2622 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2623 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2624 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2625 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2626 \pgfusepath{draw}
2627 }
2628
2629 \pgf@circ@declareground{tlground}{0.6}{0.4}{
2630 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2631 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
2632 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
2633 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
2634 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
2635 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
2636 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
2637 \pgfusepath{draw}
2638 }
2639
2640
2641 \pgf@circ@declareground{rground}{0.6}{1}{
2642 \pgfpathmoveto{\pgfpointorigin}
2643 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
2644 \pgfusepath{draw}
2645
2646 \pgfstartlinewidth=\pgflinewidth
2647 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
2648
2649 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2650 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2651 \pgfsetroundcap\pgfusepath{draw}
2652 }
2653
2654 \pgf@circ@declareground{tground}{0.6}{0}{
2655 \pgfpathmoveto{\pgfpointorigin}
2656 \pgfusepath{draw}
2657
2658 \pgfstartlinewidth=\pgflinewidth
2659 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
2660
2661 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
2662 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
2663 \pgfusepath{draw}
2664 }
2665
2666 \pgf@circ@declareground{sground}{0.6}{1.8}{
2667 \pgfpathmoveto{\pgfpointorigin}
2668 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
2669 \pgfusepath{draw}
2670
2671 \pgfstartlinewidth=\pgflinewidth
2672 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2673
2674 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2675 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
2676 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
2677 \pgfpathclose
2678 \pgf@circ@draworfill
2679 }
2680
2681 % noiseless ground
2682 \pgf@circ@declareground{nground}{0.9}{1.6}{
2683 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
2684 \pgfpathmoveto{\pgfpointorigin}
2685 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
2686 \pgfusepath{draw}
2687 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2688 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2689 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2690 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2691 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2692 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2693 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2694 \pgfusepath{draw}
2695 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
2696 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
2697 \pgfusepath{draw}
2698 }
2699
2700 % protective ground
2701 \pgf@circ@declareground{pground}{0.9}{1.8}{
2702 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2703 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
2704 \pgf@circ@draworfill
2705 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
2706 \pgfpathmoveto{\pgfpointorigin}
2707 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
2708 \pgfusepath{draw}
2709 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2710 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2711 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2712 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2713 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
2714 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2715 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
2716 \pgfusepath{draw}
2717 }
2718
2719 % chassis ground
2720 \pgf@circ@declareground{cground}{1}{2}{
2721 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
2722 \pgfpathmoveto{\pgfpointorigin}
2723 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
2724 \pgfusepath{draw}
2725 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
2726 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
2727 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
2728 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
2729 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
2730 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
2731 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
2732 \pgfusepath{draw}
2733 }
2734
2735 % Contributed by @fotesan https://github.com/fotesan
2736 % european ground
2737 \pgf@circ@declareground{eground}{1.1}{1.7}{
2738 \pgfpathmoveto{\pgfpointorigin}
2739 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
2740 \pgfusepath{draw}
2741
2742 \pgfstartlinewidth=\pgflinewidth
2743 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
2744
2745 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
2746 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
2747 \pgfusepath{draw}
2748
2749 \pgfsetlinewidth{\pgfstartlinewidth}
2750 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
2751 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2752 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
2753 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2754 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
2755 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2756 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
2757 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2758 \pgfusepath{draw}
2759 }
2760
2761 \pgf@circ@declareground{eground2}{1.1}{1.7}{
2762 \pgfpathmoveto{\pgfpointorigin}
2763 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
2764 \pgfusepath{draw}
2765
2766 \pgfstartlinewidth=\pgflinewidth
2767 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
2768
2769 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
2770 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
2771 \pgfusepath{draw}
2772
2773 \pgfsetlinewidth{\pgfstartlinewidth}
2774 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
2775 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2776 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
2777 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2778 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
2779 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
2780 \pgfusepath{draw}
2781 }
2782
2783 %%%%%%%%%%%%%%%%%%
2784 %% Power supplies
2785 %%%%%%%%%%%%%%%%%%
2786
2787 % Vcc
2788 \pgfdeclareshape{vcc}{
2789 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
2790 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2791 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
2792 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
2793 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
2794 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
2795 }
2796 \savedanchor{\northeast}{%
2797 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2798 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
2799 \pgf@x=.5\pgf@circ@res@step
2800 \pgf@y=3\pgf@x%
2801 }
2802 \anchor{north}{\northeast\pgf@x=0cm\relax}
2803 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
2804 \anchor{south}{\pgfpointorigin}
2805 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
2806 \anchor{north east}{\northeast}
2807 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2808 \anchor{south east}{\northeast\pgf@y=0pt\relax}
2809 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
2810 \anchor{center}{\pgfpointorigin}
2811 \anchor{left}{\pgfpointorigin}
2812 \anchor{right}{\pgfpointorigin}
2813 \anchor{text}{
2814 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2815 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
2816 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
2817 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
2818 \pgf@x=0pt
2819 \pgf@y=2\pgf@circ@res@step
2820 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
2821 \pgf@x=-.5\wd\pgfnodeparttextbox
2822 }
2823 \behindforegroundpath{
2824 \pgf@circ@scaled@Rlen=\scaledRlen
2825 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
2826 \pgfscope
2827 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
2828 \ifx\pgf@temp\pgf@circ@temp
2829 \pgfstartlinewidth=\pgflinewidth
2830 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2831
2832 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2833 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
2834 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2835 \pgfusepath{draw}
2836
2837 \pgfsetlinewidth{\pgfstartlinewidth}
2838 \else
2839 \pgfsetarrowsend{\pgf@circ@temp}
2840 \fi
2841 \pgfpathmoveto{\pgfpointorigin}
2842 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
2843 \pgfusepath{draw}
2844 \endpgfscope
2845 }
2846 }
2847
2848 % Vee
2849 \pgfdeclareshape{vee}{
2850 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
2851 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2852 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
2853 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
2854 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
2855 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
2856 }
2857 \savedanchor{\northeast}{%
2858 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2859 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
2860 \pgf@x=.5\pgf@circ@res@step
2861 \pgf@y=-3\pgf@x%
2862 }
2863 \anchor{south}{\northeast\pgf@x=0cm\relax}
2864 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
2865 \anchor{north}{\pgfpointorigin}
2866 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
2867 \anchor{south east}{\northeast}
2868 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
2869 \anchor{north east}{\northeast\pgf@y=0pt\relax}
2870 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
2871 \anchor{center}{\pgfpointorigin}
2872 \anchor{left}{\pgfpointorigin}
2873 \anchor{right}{\pgfpointorigin}
2874 \anchor{text}{
2875 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2876 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
2877 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
2878 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
2879 \pgf@x=0pt
2880 \pgf@y=-2\pgf@circ@res@step
2881 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
2882 \pgf@x=-.5\wd\pgfnodeparttextbox
2883 }
2884
2885 \behindforegroundpath{
2886 \pgf@circ@scaled@Rlen=\scaledRlen
2887 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
2888 \pgfscope
2889 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
2890 \ifx\pgf@temp\pgf@circ@temp
2891
2892 \pgfstartlinewidth=\pgflinewidth
2893 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2894
2895 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2896 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
2897 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2898 \pgfusepath{draw}
2899 \pgfsetlinewidth{\pgfstartlinewidth}
2900 \else
2901 \pgfsetarrowsend{\pgf@circ@temp}
2902 \fi
2903 \pgfpathmoveto{\pgfpointorigin}
2904 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
2905 \pgfusepath{draw}
2906 \endpgfscope
2907 }
2908 }% %>>>
2909
2910
2911 %% This are strange, and probably wrong FIXME
2912 % \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
2913 % \compattikzset{vss/.style = {\comnpatname vee = #1}}
2914 \pgfcirc@style@to@style{vcc}{vdd}
2915 \pgfcirc@style@to@style{vee}{vss}
2916
2917
2918 %%%%%%%%%%%%%%
2919 %% RF bipoles and monopoles
2920 %%%%%%%%%%%%%%
2921
2922 %% RF bipoles and monopoles settings %<<<1
2923 \ctikzset{bipoles/mstline/height/.initial=0.3}
2924 \ctikzset{bipoles/mstline/width/.initial=1.2}
2925 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
2926 \ctikzset{monopoles/msport/width/.initial=.5}
2927 \ctikzset{monopoles/msrstub/height/.initial=1.0}
2928 \ctikzset{monopoles/msrstub/width/.initial=0.6}%
2929 %>>>
2930
2931 %% Node shapes for RF bipoles%<<<
2932
2933 \pgfcircdeclarebipolescaled{RF}
2934 {}
2935 {\ctikzvalof{bipoles/tline/height}}
2936 {tline}
2937 {\ctikzvalof{bipoles/tline/height}}
2938 {\ctikzvalof{bipoles/tline/width}}
2939 {
2940 \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
2941 \pgfscope
2942 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2943 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
2944 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
2945 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
2946 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
2947 \pgfpatharc{-90}{90}{\pgf@circ@res@step and \pgf@circ@res@up}
2948 \pgf@circ@draworfill
2949 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
2950 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
2951 \pgfusepath{stroke}
2952 \endpgfscope
2953 \pgfsetlinewidth{\pgfstartlinewidth}
2954 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
2955 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2956 \pgfusepath{stroke}
2957 }
2958
2959 % microstrip transmission line
2960 \pgfcircdeclarebipolescaled{RF}
2961 {}
2962 {\ctikzvalof{bipoles/mstline/height}}
2963 {mstline}
2964 {\ctikzvalof{bipoles/mstline/height}}
2965 {\ctikzvalof{bipoles/mstline/width}}
2966 {
2967 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
2968 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2969 \pgf@circ@draworfill
2970 }% %>>>
2971
2972 %% Path definitions for RF path objects%<<<
2973 \pgfcirc@activate@bipole@simple{l}{mstline}
2974 \pgfcirc@activate@bipole@simple{l}{tline}
2975 \pgfcirc@style@to@style{tline}{transmission line}
2976 \pgfcirc@style@to@style{tline}{TL}
2977 % %>>>
2978
2979 %% Node shapes for RF monopoles%<<<
2980
2981 % Legacy tlinestub
2982 % Contributed by Leonardo Azzinnari
2983 \pgfdeclareshape{tlinestub}{
2984 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
2985 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
2986 \savedanchor{\northeast}{%
2987 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
2988 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
2989 \pgf@x=1.2\pgf@circ@res@step
2990 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
2991 \pgf@y=.2\pgf@circ@res@step%
2992 }
2993 % the center is on the left side of the shape for facility of usage
2994 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
2995 \anchor{east}{\northeast\pgf@y=0cm\relax}
2996 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
2997 \anchor{west}{\pgfpointorigin}
2998 \anchor{north east}{\northeast}
2999 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3000 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3001 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3002 \anchor{center}{\pgfpointorigin}
3003 % this is not exact, but it's better than nothing
3004 \anchor{text}{\northeast\pgf@xa=\pgf@x\pgf@ya=\pgf@y
3005 \pgfpoint{\dimexpr-.5\wd\pgfnodeparttextbox+.8\pgf@xa}
3006 {\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@ya}}
3007 \behindforegroundpath{
3008 \pgfstartlinewidth=\pgflinewidth
3009
3010 \pgf@circ@scaled@Rlen=\scaledRlen
3011 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width}\pgf@circ@scaled@Rlen
3012
3013 \pgfscope
3014 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3015 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3016 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3017 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3018 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3019 \pgfpatharc{90}{-90}{-0.125\pgf@circ@res@step and -0.25\pgf@circ@res@step}
3020 \pgf@circ@draworfill
3021 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3022 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3023 \pgfusepath{stroke}
3024 \endpgfscope
3025 \pgfpathmoveto{\pgfpointorigin}
3026 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3027 \pgfusepath{draw}
3028 }
3029 }
3030
3031 %% New antennas without tails
3032
3033 % main body of antennas
3034 \def\pgf@circ@antennabody{%
3035 \pgfstartlinewidth=\pgflinewidth
3036 \pgf@circ@scaled@Rlen=\scaledRlen
3037 \pgfsetcolor{\ctikzvalof{color}}
3038 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3039 \pgfscope
3040 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3041 \pgfpathmoveto{\pgfpointorigin}
3042 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3043 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3044 \pgfsetbeveljoin
3045 \pgfpathclose
3046 \pgf@circ@draworfill
3047 \endpgfscope
3048 \pgfsetlinewidth{\pgfstartlinewidth}
3049 \pgfpathmoveto{\pgfpointorigin}
3050 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3051 \pgfusepath{draw}
3052 }
3053
3054 % Waves for the antennas.
3055 \def\pgf@circ@antennawaves{%
3056 \pgfscope
3057 % define a triangle for clipping the waves
3058 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3059 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3060 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3061 \pgfpathclose
3062 \pgfusepath{clip}
3063 % ...and build the waves as clipped circles
3064 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3065 \pgfmathloop%
3066 \ifnum\pgf@circ@count@a>2
3067 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3068 \advance\pgf@circ@count@a-1\relax%
3069 \repeatpgfmathloop
3070 \pgfusepath{draw}
3071 \endpgfscope
3072 }
3073
3074 % additional shape with the waves
3075 \pgfdeclareshape{waves}{
3076 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3077 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3078 \anchor{center}{\pgfpointorigin}
3079 \savedanchor{\northeast}{
3080 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3081 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3082 \pgf@x=\pgf@circ@res@step
3083 \pgf@y=\pgf@circ@res@step
3084 }
3085 \anchor{text}{
3086 \northeast
3087 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3088 }
3089 \anchor{top}{\northeast\pgf@x=0pt}
3090 \anchor{right}{\northeast\pgf@y=0pt}
3091 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3092 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3093 \anchor{north}{\northeast\pgf@x=0pt}
3094 \anchor{north east}{\northeast}
3095 \anchor{east}{\northeast\pgf@y=0pt}
3096 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3097 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3098 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3099 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3100 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3101 \behindforegroundpath{
3102 \pgf@circ@scaled@Rlen=\scaledRlen
3103 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3104 \pgf@circ@res@step=0.5\pgf@circ@res@step
3105 \pgfsetcolor{\ctikzvalof{color}}
3106 \pgfscope
3107 % define a triangle for clipping the waves
3108 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3109 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
3110 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
3111 \pgfpathclose
3112 \pgfusepath{clip}
3113 % ...and build the waves as clipped circles
3114 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3115 \pgfmathloop%
3116 \ifnum\c@pgf@counta>1
3117 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3118 \advance\c@pgf@counta-1\relax%
3119 \repeatpgfmathloop
3120 \pgfusepath{draw}
3121 \endpgfscope
3122 }
3123 }
3124
3125 % the three types of antennas: simple, TX, RX. Notice that you can flip them...
3126
3127 \pgfdeclareshape{bareantenna}{
3128 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3129 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3130 \anchor{center}{\pgfpointorigin}
3131 \savedanchor{\northeast}{
3132 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3133 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3134 \pgf@x=\pgf@circ@res@step
3135 \pgf@y=2\pgf@circ@res@step
3136 }
3137 \anchor{text}{
3138 \northeast
3139 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3140 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3141 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3142 }
3143 \anchor{top}{\northeast\pgf@x=0pt}
3144 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3145 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3146 \anchor{bottom}{\pgfpointorigin}
3147 \anchor{north}{\northeast\pgf@x=0pt}
3148 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3149 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3150 \anchor{south}{\pgfpointorigin}
3151 \anchor{north east}{\northeast}
3152 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3153 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3154 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3155 \behindforegroundpath{
3156 \pgf@circ@antennabody
3157 }
3158 }
3159
3160 \pgfdeclareshape{bareTXantenna}{
3161 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3162 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3163 \anchor{center}{\pgfpointorigin}
3164 \savedanchor{\northeast}{
3165 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3166 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3167 \pgf@x=\pgf@circ@res@step
3168 \pgf@y=2\pgf@circ@res@step
3169 }
3170 \savedanchor{\savedwaves}{
3171 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3172 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3173 \pgf@x=4.2\pgf@circ@res@step
3174 \pgf@y=\pgf@circ@res@step
3175 }
3176 \anchor{text}{
3177 \northeast
3178 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3179 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3180 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
3181 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3182 }
3183 \anchor{waves}{\savedwaves}
3184 \anchor{top}{\northeast\pgf@x=0pt}
3185 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3186 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3187 \anchor{bottom}{\pgfpointorigin}
3188 \anchor{north}{\northeast\pgf@x=0pt}
3189 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3190 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3191 \anchor{south}{\pgfpointorigin}
3192 \anchor{north east}{\northeast}
3193 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3194 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3195 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3196 \behindforegroundpath{
3197 \pgf@circ@antennabody
3198 \pgf@circ@antennawaves
3199 }
3200 }
3201
3202 \pgfdeclareshape{bareRXantenna}{
3203 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3204 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3205 \anchor{center}{\pgfpointorigin}
3206 \savedanchor{\northeast}{
3207 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3208 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3209 \pgf@x=\pgf@circ@res@step
3210 \pgf@y=2\pgf@circ@res@step
3211 }
3212 \savedanchor{\savedwaves}{
3213 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3214 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3215 \pgf@x=-4.2\pgf@circ@res@step
3216 \pgf@y=\pgf@circ@res@step
3217 }
3218 \anchor{text}{
3219 \northeast
3220 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3221 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3222 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3223 }
3224 \anchor{waves}{\savedwaves}
3225 \anchor{top}{\northeast\pgf@x=0pt}
3226 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3227 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3228 \anchor{bottom}{\pgfpointorigin}
3229 \anchor{north}{\northeast\pgf@x=0pt}
3230 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3231 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3232 \anchor{south}{\pgfpointorigin}
3233 \anchor{north east}{\northeast}
3234 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3235 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3236 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3237 \behindforegroundpath{
3238 \pgf@circ@antennabody
3239 \pgftransformxshift{-5.2\pgf@circ@res@step}
3240 \pgf@circ@antennawaves
3241 }
3242 }
3243
3244 %%% dynodes (see https://github.com/circuitikz/circuitikz/issues/469)
3245 \ctikzset{monopoles/dynode/width/.initial=0.4}
3246 \ctikzset{monopoles/dynode/height/.initial=0.8}
3247 \ctikzset{monopoles/dynode/arc pos/.initial=0.5}
3248 \ctikzset{monopoles/dynode/arc angle/.initial=30}
3249 \ctikzset{monopoles/dynode/top width/.initial=1.0}
3250
3251 \pgfdeclareshape{dynode}{
3252 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
3253 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3254 \anchor{center}{\pgfpointorigin}
3255 \savedanchor{\northeast}{
3256 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3257 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
3258 \pgf@x=0.5\pgf@x
3259 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3260 }
3261 \savedanchor{\arcpos}{% bottom part of the arc pos
3262 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3263 \pgf@x=0pt
3264 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3265 \pgf@y=\ctikzvalof{monopoles/dynode/arc pos}\pgf@y
3266 }
3267 \savedanchor{\topright}{%
3268 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3269 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
3270 \pgf@x=\ctikzvalof{monopoles/dynode/top width}\pgf@x
3271 \pgf@x=0.5\pgf@x
3272 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
3273 }
3274 \anchor{arc}{\arcpos}
3275 \anchor{top right}{\topright}
3276 \anchor{top left}{\topright\pgf@x=-\pgf@x}
3277 \anchor{text}{
3278 \northeast
3279 \advance\pgf@x by 4pt\relax
3280 \pgf@y=\dimexpr0.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3281 }
3282 \anchor{top}{\northeast\pgf@x=0pt}
3283 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3284 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3285 \anchor{bottom}{\pgfpointorigin}
3286 \anchor{north}{\northeast\pgf@x=0pt}
3287 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3288 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3289 \anchor{south}{\pgfpointorigin}
3290 \anchor{north east}{\northeast}
3291 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3292 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3293 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3294 \behindforegroundpath{
3295 \pgfstartlinewidth=\pgflinewidth
3296 \pgf@circ@scaled@Rlen=\scaledRlen
3297 \pgfsetcolor{\ctikzvalof{color}}
3298 \northeast
3299 \pgf@circ@res@right=\pgf@x
3300 \pgf@circ@res@up=\pgf@y
3301 \arcpos
3302 \pgf@circ@res@step=\pgf@y
3303 % top
3304 \pgfscope
3305 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3306 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
3307 \pgfpathlineto{\pgfpoint{\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
3308 \pgfusepath{draw}
3309 \endpgfscope
3310 % arc
3311 \edef\@@angle{\ctikzvalof{monopoles/dynode/arc angle}}
3312 \ifnum90=\@@angle\else % avoid divisions by zero
3313 % radius
3314 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right/cos(\@@angle)}
3315 % start angle y position
3316 \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@step+\pgf@circ@res@other*(1-sin(\@@angle))}
3317 \pgfsetlinewidth{\pgfstartlinewidth}
3318 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@step}}
3319 \pgfpatharc{-180+\@@angle}{-\@@angle}{\pgf@circ@res@other}
3320 \fi
3321 % tail
3322 \pgfpathmoveto{\pgfpointorigin}
3323 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3324 \pgfusepath{draw}
3325 }
3326 }
3327 % Microstrip monopoles
3328
3329 \pgfdeclareshape{mslstub}{
3330 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3331 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3332 \savedanchor{\southeast}{
3333 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3334 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3335 \pgf@x=.5\pgf@x
3336 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3337 \pgf@y=-.5\pgf@y
3338 }
3339 \savedanchor{\northwest}{
3340 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3341 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3342 \pgf@x=-.5\pgf@x
3343 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3344 \pgf@y=.5\pgf@y
3345 }
3346 \anchor{north}{\northwest\pgf@x=0pt\relax}
3347 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3348 \anchor{east}{\southeast\pgf@y=0pt\relax}
3349 \anchor{south east}{\southeast}
3350 \anchor{south}{\southeast\pgf@x=0pt\relax}
3351 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3352 \anchor{west}{\northwest\pgf@y=0pt\relax}
3353 \anchor{north west}{\northwest}
3354 %
3355 \anchor{center}{\northwest\pgf@y=0pt\relax}
3356 \anchor{left}{\northwest\pgf@y=0pt\relax}
3357 \anchor{right}{\southeast\pgf@y=0pt\relax}
3358 % put the node text above and centered
3359 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3360 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3361 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3362 }
3363 }
3364 \behindbackgroundpath{
3365 \pgfextracty{\pgf@circ@res@up}{\northwest}
3366 \pgfextractx{\pgf@circ@res@right}{\southeast}
3367 \pgfextractx{\pgf@circ@res@left}{\northwest}
3368 \pgfextracty{\pgf@circ@res@down}{\southeast}
3369 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3370 \pgfstartlinewidth=\pgflinewidth
3371 \pgfscope
3372 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3373 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3374 \pgf@circ@draworfill
3375 \endpgfscope
3376 }
3377 }
3378
3379 \pgfdeclareshape{msrstub}{
3380 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3381 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3382 \savedanchor{\southeast}{
3383 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3384 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3385 \pgf@x=.5\pgf@x
3386 \pgf@y=0pt\relax
3387 }
3388 \savedanchor{\northwest}{
3389 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3390 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
3391 \pgf@x=-.5\pgf@x
3392 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
3393 \pgf@y=.5\pgf@y
3394 }
3395 \anchor{north}{\northwest\pgf@x=0pt\relax}
3396 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3397 \anchor{east}{\southeast\pgf@y=0pt\relax}
3398 \anchor{south east}{\southeast}
3399 \anchor{south}{\southeast\pgf@x=0pt\relax}
3400 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3401 \anchor{west}{\northwest\pgf@y=0pt\relax}
3402 \anchor{north west}{\northwest}
3403 %
3404 \anchor{center}{\pgfpointorigin}
3405 \anchor{left}{\pgfpointorigin}
3406 \anchor{right}{\pgfpointorigin}
3407 % put the node text above and centered
3408 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3409 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3410 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3411 }
3412 }
3413 \behindbackgroundpath{
3414 \pgfextracty{\pgf@circ@res@up}{\northwest}
3415 \pgfextractx{\pgf@circ@res@right}{\southeast}
3416 \pgfextractx{\pgf@circ@res@left}{\northwest}
3417 \pgfextracty{\pgf@circ@res@down}{\southeast}
3418 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
3419 \pgfstartlinewidth=\pgflinewidth
3420 \pgfscope
3421 \pgfpathmoveto{\pgfpointorigin}
3422 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3423 \pgfusepath{draw}
3424 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3425 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
3426 \pgfpatharc{135}{45}{\pgf@circ@res@step}
3427 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
3428 \pgfpatharc{45}{135}{\pgf@circ@res@up}
3429 \pgfclosepath
3430 \pgf@circ@draworfill
3431 \endpgfscope
3432 }
3433 }
3434
3435 \pgfdeclareshape{msport}{
3436 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3437 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3438 \savedanchor{\southeast}{
3439 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3440 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3441 \pgf@x=.5\pgf@x
3442 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3443 \pgf@y=-.5\pgf@y
3444 }
3445 \savedanchor{\northwest}{
3446 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3447 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
3448 \pgf@x=-.5\pgf@x
3449 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3450 \pgf@y=.5\pgf@y
3451 }
3452 \anchor{north}{\northwest\pgf@x=0pt\relax}
3453 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3454 \anchor{east}{\southeast\pgf@y=0pt\relax}
3455 \anchor{south east}{\southeast}
3456 \anchor{south}{\southeast\pgf@x=0pt\relax}
3457 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3458 \anchor{west}{\northwest\pgf@y=0pt\relax}
3459 \anchor{north west}{\northwest}
3460 %
3461 \anchor{center}{\northwest\pgf@y=0pt\relax}
3462 \anchor{left}{\northwest\pgf@y=0pt\relax}
3463 \anchor{right}{\southeast\pgf@y=0pt\relax}
3464 % put the node text above and centered
3465 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3466 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3467 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3468 }
3469 }
3470 \behindbackgroundpath{
3471 \pgfextracty{\pgf@circ@res@up}{\northwest}
3472 \pgfextractx{\pgf@circ@res@right}{\southeast}
3473 \pgfextractx{\pgf@circ@res@left}{\northwest}
3474 \pgfextracty{\pgf@circ@res@down}{\southeast}
3475 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
3476 \pgfstartlinewidth=\pgflinewidth
3477 \pgfscope
3478 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3479 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3480 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
3481 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
3482 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3483 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
3484 \pgfpathclose
3485 \pgf@circ@draworfill
3486 \endpgfscope
3487 }
3488 }
3489
3490 % Legacy antennas (with tails)
3491 \def\pgf@circ@shift@antenna@xy#1#2{%
3492 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
3493 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
3494 \relax}
3495
3496 % Legacy antenna
3497 \pgfdeclareshape{antenna}{
3498 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3499 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3500 \anchor{center}{\pgfpointorigin}
3501 \savedanchor{\northeast}{
3502 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3503 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3504 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3505 \pgf@y=4\pgf@circ@res@step
3506 }
3507 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
3508 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
3509 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
3510 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
3511 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
3512 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
3513 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
3514 \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}}
3515 \anchor{text}{
3516 \northeast
3517 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
3518 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
3519 }
3520 \behindforegroundpath{
3521 \pgfstartlinewidth=\pgflinewidth
3522 \pgf@circ@scaled@Rlen=\scaledRlen
3523 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3524
3525 \pgftransformxshift{ -4\pgf@circ@res@step }
3526
3527 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3528 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3529
3530 \pgfusepath{draw}
3531
3532 \pgfscope
3533 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3534 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3535 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3536 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3537 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3538 \pgfsetcolor{\ctikzvalof{color}}
3539 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3540 \pgfusepath{draw}
3541 \endpgfscope
3542 \pgfsetlinewidth{\pgfstartlinewidth}
3543
3544 }
3545 }
3546
3547 % Legacy TX antenna
3548 \pgfdeclareshape{txantenna}{
3549 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3550 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3551 \anchor{center}{\pgfpointorigin}
3552 \savedanchor{\northeast}{
3553 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3554 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3555 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3556 \pgf@y=4\pgf@circ@res@step
3557 }
3558 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
3559 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
3560 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
3561 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
3562 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
3563 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
3564 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
3565 \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}}
3566 \anchor{text}{
3567 \northeast
3568 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
3569 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
3570 }
3571 \behindforegroundpath{
3572 \pgfstartlinewidth=\pgflinewidth
3573 \pgf@circ@scaled@Rlen=\scaledRlen
3574 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
3575
3576 \pgfpathmoveto{\pgfpointorigin}
3577 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
3578 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3579 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3580
3581 \pgfusepath{draw}
3582
3583 \pgfscope
3584 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3585 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3586 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3587 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3588 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3589 \pgfsetcolor{\ctikzvalof{color}}
3590 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3591 \pgfusepath{draw}
3592 \endpgfscope
3593 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
3594 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
3595 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
3596 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
3597 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
3598 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
3599 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
3600 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
3601 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
3602 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
3603 \pgfusepath{draw}
3604 \pgfsetlinewidth{\pgfstartlinewidth}
3605
3606 }
3607 }
3608
3609 % Legacy RX antenna
3610 \pgfdeclareshape{rxantenna}{
3611 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3612 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3613 \anchor{center}{\pgfpointorigin}
3614 \savedanchor{\northeast}{
3615 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3616 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
3617 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
3618 \pgf@y=4\pgf@circ@res@step
3619 }
3620 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
3621 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
3622 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
3623 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
3624 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
3625 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
3626 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
3627 \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}}
3628 \anchor{text}{
3629 \northeast
3630 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
3631 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
3632 }
3633 \behindforegroundpath{
3634 \pgfstartlinewidth=\pgflinewidth
3635 \pgf@circ@scaled@Rlen=\scaledRlen
3636 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
3637
3638 \pgfpathmoveto{\pgfpointorigin}
3639 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
3640 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
3641 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3642
3643 \pgfusepath{draw}
3644
3645 \pgfscope
3646 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3647 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3648 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
3649 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3650 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
3651 \pgfsetcolor{\ctikzvalof{color}}
3652 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3653 \pgfusepath{draw}
3654 \endpgfscope
3655
3656 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
3657 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
3658 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
3659 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
3660 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
3661 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
3662 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
3663 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
3664 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
3665 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
3666 \pgfusepath{draw}
3667 \pgfsetlinewidth{\pgfstartlinewidth}
3668 }
3669 }
3670
3671 % Legacy match
3672 \pgfdeclareshape{match}{
3673 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3674 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3675 \savedanchor{\northeast}{%
3676 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3677 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
3678 \pgf@x=2\pgf@circ@res@step
3679 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
3680 \pgf@y=.5\pgf@circ@res@step%
3681 }
3682 % the center is on the left side of the shape for facility of usage
3683 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3684 \anchor{east}{\northeast\pgf@y=0cm\relax}
3685 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
3686 \anchor{west}{\pgfpointorigin}
3687 \anchor{north east}{\northeast}
3688 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3689 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3690 \anchor{south west}{\pgfpointorigin}
3691 \anchor{center}{
3692 \pgfpointorigin
3693 }
3694 \anchor{text}{
3695 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3696 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
3697 \pgf@x=1.5\pgf@x
3698 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
3699 \pgf@y=-1.5\ht\pgfnodeparttextbox
3700 }
3701 \behindforegroundpath{
3702 \pgf@circ@scaled@Rlen=\scaledRlen
3703 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
3704
3705 \pgfscope
3706 \pgfpathmoveto{\pgfpointorigin}
3707 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
3708 \pgfusepath{draw}
3709
3710 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
3711 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
3712 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
3713 \pgfusepath{fill}
3714
3715 \pgfsetlinewidth{\pgfstartlinewidth}
3716 \endpgfscope
3717 }
3718 }
3719 % %>>>
3720
3721 % vim: set fdm=marker fmr=%<<<,%>>>:
3722 %%%---------- close: tex/pgfcircmonopoles
3723 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
3724 %%%---------- open: tex/pgfcircbipoles.tex
3725 % Copyright 2018-2026 by Romano Giannetti
3726 % Copyright 2015-2026 by Stefan Lindner
3727 % Copyright 2013-2026 by Stefan Erhardt
3728 % Copyright 2007-2026 by Massimo Redaelli
3729 %
3730 % This file may be distributed and/or modified
3731 %
3732 % 1. under the LaTeX Project Public License and/or
3733 % 2. under the GNU Public License.
3734 %
3735 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
3736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3737 %% Standard bipole shapes declarations
3738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3739
3740 %% Generic macro and flags for bipoles %<<<
3741 % Fixing tunable directions
3742 \newif\ifpgf@circ@fixtunable@dir
3743 \ctikzset{bipoles/fix tunable direction/.is if=pgf@circ@fixtunable@dir}
3744 \ctikzset{bipoles/fix tunable direction=true}
3745 % choosing several arrows
3746 \pgf@circ@declare@family@arrows{tunable}
3747 \pgf@circ@declare@family@arrows{wiper}
3748 \pgf@circ@declare@family@arrows{switch}
3749 \pgf@circ@declare@family@arrows{gto gate}
3750
3751 %>>>
3752
3753
3754 %%%%%%%%%%%%%%%%%%%%%%%%
3755 % Resistive components: generics, resistors, wires
3756 %%%%%%%%%%%%%%%%%%%%%%%%
3757
3758 %% Definitions for resistive components %<<<
3759
3760 % Zig Zag resistors
3761 \ctikzset{resistors/zigs/.initial=3}
3762 \ctikzset{resistors/width/.code={%
3763 \ctikzset{bipoles/resistor/width=#1}%
3764 \ctikzset{bipoles/vresistor/width=#1}%
3765 \ctikzset{bipoles/potentiometer/width=#1}%
3766 \ctikzset{bipoles/resistivesens/width=#1}%
3767 \ctikzset{bipoles/photoresistor/width=#1}%
3768 \ctikzset{bipoles/thermistor/width=#1}%
3769 \ctikzset{bipoles/thermistorntc/width=#1}%
3770 \ctikzset{bipoles/thermistorptc/width=#1}%
3771 \ctikzset{bipoles/varistor/width=#1}%
3772 \ctikzset{bipoles/generic/width=#1}%
3773 \ctikzset{bipoles/generic potentiometer/width=#1}%
3774 \ctikzset{bipoles/ageneric/width=#1}%
3775 \ctikzset{bipoles/tgeneric/width=#1}%
3776 }}
3777 \ctikzset{wiper pos/.code={%
3778 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
3779 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
3780 }}
3781 % zigzag resistor
3782 \ctikzset{bipoles/resistor/height/.initial=.3}
3783 \ctikzset{bipoles/resistor/width/.initial=.8}
3784 \ctikzset{bipoles/potentiometer/height/.initial=.8}
3785 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
3786 \ctikzset{bipoles/potentiometer/width/.initial=.8}
3787 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
3788 \ctikzset{bipoles/vresistor/height/.initial=.6}
3789 \ctikzset{bipoles/vresistor/width/.initial=.8}
3790 \ctikzset{bipoles/resistivesens/height/.initial=.6}
3791 \ctikzset{bipoles/resistivesens/width/.initial=.8}
3792 % square resistors
3793 \ctikzset{bipoles/photoresistor/height/.initial=.6}
3794 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
3795 \ctikzset{bipoles/photoresistor/width/.initial=.8}
3796 \ctikzset{bipoles/thermistor/main/.initial=.7}
3797 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
3798 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
3799 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
3800 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
3801 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
3802 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
3803 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
3804 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
3805 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
3806 \ctikzset{bipoles/thermistor/width/.initial=.8}
3807 \ctikzset{bipoles/varistor/main/.initial=.7}
3808 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
3809 \ctikzset{bipoles/varistor/width/.initial=.8}
3810 \ctikzset{bipoles/generic/height/.initial=.30}
3811 \ctikzset{bipoles/generic/width/.initial=.80}
3812 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
3813 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
3814 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
3815 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
3816 \ctikzset{bipoles/ageneric/height/.initial=.30}
3817 \ctikzset{bipoles/tgeneric/height/.initial=.70}
3818 \ctikzset{bipoles/tgeneric/width/.initial=.80}
3819 \ctikzset{bipoles/ageneric/width/.initial=.80}
3820 \ctikzset{bipoles/memristor/height/.initial=.30}
3821 \ctikzset{bipoles/memristor/wave height/.initial=.5}
3822 \ctikzset{bipoles/memristor/width/.initial=.80}
3823
3824 \newif\ifpgf@circuit@europeanresistor
3825 \ctikzset{resistor/.is choice}
3826 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
3827 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
3828 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
3829 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}%
3830
3831 % wires (open, shorts, ...)
3832
3833 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
3834 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
3835 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
3836 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
3837 \ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning
3838 \ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning
3839 % multiwire
3840 \ctikzset{bipoles/multiwire/height/.initial=0.4}
3841 \ctikzset{bipoles/multiwire/width/.initial=0.2}
3842 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
3843 % crossing wires
3844 \ctikzset{bipoles/crossing/size/.initial=.2}
3845
3846 %%>>>
3847
3848 %% Shapes for generic, resistives and wires components %<<<
3849 %% Short circuit
3850
3851 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
3852 %%% natural length is zero.
3853 \pgfcircdeclarebipole
3854 {% fix the anchor border to add a bit of space for voltage and labels
3855 % it uses the dummy width and height
3856 \anchorborder{%
3857 \ifpgf@circuit@bipole@inverted
3858 \pgf@circ@res@left=-\pgf@x
3859 \pgf@circ@res@up=-\pgf@y
3860 \else
3861 \pgf@circ@res@left=\pgf@x
3862 \pgf@circ@res@up=\pgf@y
3863 \fi
3864 \ifdim\pgf@circ@res@up>0cm
3865 \pgf@x=\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
3866 \pgf@y=\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
3867 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
3868 {\pgfpoint{\pgf@x}{\pgf@y}}
3869 \else
3870 \pgf@x=-\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
3871 \pgf@y=-\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
3872 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
3873 {\pgfpoint{-\pgf@x}{-\pgf@y}}
3874 \fi
3875 }
3876 }
3877 {0}
3878 {short}
3879 {0}
3880 {0}
3881 {}
3882
3883 %% Open circuit
3884 \pgfcircdeclarebipole
3885 {}
3886 {\ctikzvalof{bipoles/open/height}}
3887 {open}
3888 {\ctikzvalof{bipoles/open/height}}
3889 {\ctikzvalof{bipoles/open/width}}
3890 {}
3891
3892 % multiwire(s)
3893 \pgfcircdeclarebipole
3894 {}
3895 {\ctikzvalof{bipoles/multiwire/height}}
3896 {multiwire}
3897 {\ctikzvalof{bipoles/multiwire/height}}
3898 {\ctikzvalof{bipoles/multiwire/width}}
3899 {
3900 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
3901 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3902 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3903 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3904 \pgfusepath{draw}
3905 }
3906
3907 \pgfcircdeclarebipole
3908 {}
3909 {\ctikzvalof{bipoles/multiwire/height}}
3910 {bmultiwire}
3911 {\ctikzvalof{bipoles/multiwire/height}}
3912 {\ctikzvalof{bipoles/multiwire/width}}
3913 {
3914 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
3915 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
3916 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3917 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
3918 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
3919 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3920 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3921 \pgfusepath{draw}
3922 }
3923
3924 \pgfcircdeclarebipole
3925 {}
3926 {\ctikzvalof{bipoles/multiwire/height}}
3927 {tmultiwire}
3928 {\ctikzvalof{bipoles/multiwire/height}}
3929 {\ctikzvalof{bipoles/multiwire/width}}
3930 {
3931 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
3932 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
3933 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3934 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
3935 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
3936 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}}
3937 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}}
3938 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3939 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3940 \pgfusepath{draw}
3941 }
3942
3943 %%%%%%%%%%%%%%%%
3944 %% Crossing
3945 %%%%%%%%%%%%%%%%
3946
3947 %% crossing bipole (but see also nodes)
3948 \pgfcircdeclarebipole
3949 {}
3950 {\ctikzvalof{bipoles/crossing/size}}
3951 {crossing}
3952 {\ctikzvalof{bipoles/crossing/size}}
3953 {\ctikzvalof{bipoles/crossing/size}}{
3954 \pgfscope
3955 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
3956 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
3957 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
3958 \pgfsetbeveljoin
3959 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
3960 \pgfusepath{draw}
3961 \endpgfscope
3962 }
3963 %
3964 %
3965 %% Generic bipole - used as resistor by some
3966 \pgfcircdeclarebipolescaled{resistors}
3967 {}
3968 {\ctikzvalof{bipoles/generic/height}}
3969 {generic}
3970 {\ctikzvalof{bipoles/generic/height}}
3971 {\ctikzvalof{bipoles/generic/width}}
3972 {
3973 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3974 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3975 \pgf@circ@draworfill
3976 }
3977
3978 %
3979 % generic crossed, suggested by Radványi Patrik Tamás <[email protected]>
3980 % inherit "generic" properties
3981 %
3982 \pgfcircdeclarebipolescaled{resistors}
3983 {}
3984 {\ctikzvalof{bipoles/generic/height}}
3985 {xgeneric}
3986 {\ctikzvalof{bipoles/generic/height}}
3987 {\ctikzvalof{bipoles/generic/width}}
3988 {
3989 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3990 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3991 \pgf@circ@draworfill
3992 % cross it
3993 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
3994 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3995 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
3996 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
3997 \pgfusepath{draw}
3998 }
3999 %% Generic empty tunable
4000 \pgfcircdeclarebipolescaled{resistors}
4001 {}
4002 {\ctikzvalof{bipoles/tgeneric/height}}
4003 {tgeneric}
4004 {\ctikzvalof{bipoles/tgeneric/height}}
4005 {\ctikzvalof{bipoles/tgeneric/width}}
4006 {
4007 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
4008 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4009 \pgf@circ@draworfill
4010 \pgfscope
4011 \pgf@circ@set@relative@thickness{modifier thickness}
4012 \pgfcirc@set@arrows{tunable}{}{latexslim}
4013 \ifpgf@circ@fixtunable@dir
4014 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4015 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4016 \else
4017 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4018 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4019 \fi
4020 \pgfusepath{draw}
4021 \endpgfscope
4022 }
4023
4024 %% Generic asymmetric bipole
4025 \pgfcircdeclarebipolescaled{resistors}
4026 {}
4027 {\ctikzvalof{bipoles/ageneric/height}}
4028 {ageneric}
4029 {\ctikzvalof{bipoles/ageneric/height}}
4030 {\ctikzvalof{bipoles/ageneric/width}}
4031 {
4032 \pgfscope
4033 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4034 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4035 \pgf@circ@draworfill
4036 \endpgfscope
4037
4038 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4039 \pgfusepath{stroke,fill}
4040 }
4041
4042 %% Memristor
4043 \pgfcircdeclarebipolescaled{resistors}
4044 {}
4045 {\ctikzvalof{bipoles/memristor/height}}
4046 {memristor}
4047 {\ctikzvalof{bipoles/memristor/height}}
4048 {\ctikzvalof{bipoles/memristor/width}}
4049 {
4050 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4051 \divide \pgf@circ@res@step by 14
4052
4053 \pgfscope
4054 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4055 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4056 \pgf@circ@draworfill
4057 \endpgfscope
4058 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4059 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
4060 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4061 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4062 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4063 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4064 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4065 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4066 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
4067 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
4068
4069 \pgfusepath{draw}
4070
4071 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4072 \pgfusepath{stroke,fill}
4073 }
4074
4075 %% Photoresistor
4076 \pgfcircdeclarebipolescaled{resistors}
4077 {}
4078 {\ctikzvalof{bipoles/photoresistor/height 2}}
4079 {photoresistor}
4080 {\ctikzvalof{bipoles/photoresistor/height}}
4081 {\ctikzvalof{bipoles/photoresistor/width}}
4082 {
4083 \pgfscope
4084 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
4085 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4086 \pgf@circ@draworfill
4087 \endpgfscope
4088
4089 \pgfscope
4090 \pgfsetarrowsend{latexslim}
4091 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
4092 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4093 \pgfusepath{draw}
4094 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
4095 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4096 \pgfusepath{draw}
4097 \endpgfscope
4098 }
4099
4100
4101
4102 %% Thermistor
4103 \pgfcircdeclarebipolescaled{resistors}
4104 {% anchor for labelling the type of dependency
4105 \anchor{label}{%
4106 \southwest
4107 \pgf@x=0.4\pgf@x
4108 \pgf@y=1.2\pgf@y
4109 }%
4110 \pgfcirc@border@extend@updown{1}{1.2}
4111 }
4112 {\ctikzvalof{bipoles/thermistor/height}}
4113 {thermistor}
4114 {\ctikzvalof{bipoles/thermistor/height}}
4115 {\ctikzvalof{bipoles/thermistor/width}}
4116 {
4117 \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}}
4118 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4119 \pgf@circ@draworfill
4120 \pgf@circ@set@relative@thickness{modifier thickness}
4121 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4122 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4123 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4124 \pgfusepath{draw}
4125 }
4126
4127 %% Thermistor PTC
4128 \pgfcircdeclarebipolescaled{resistors}
4129 {}
4130 {\ctikzvalof{bipoles/thermistorptc/height 2}}
4131 {thermistorptc}
4132 {\ctikzvalof{bipoles/thermistorptc/height}}
4133 {\ctikzvalof{bipoles/thermistorptc/width}}
4134 {
4135 \pgfscope
4136 \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}}
4137 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4138 \pgf@circ@draworfill
4139 \pgf@circ@set@relative@thickness{modifier thickness}
4140 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4141 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4142 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4143 \pgfusepath{draw}
4144 \endpgfscope
4145
4146 \pgfsetlinewidth{\pgfstartlinewidth}
4147 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4148 \pgfsetarrowsend{latexslim}
4149 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4150 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4151 \pgfusepath{draw}
4152 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4153 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4154 \pgfusepath{draw}
4155 }
4156
4157 %% Thermistor NTC
4158 \pgfcircdeclarebipolescaled{resistors}
4159 {}
4160 {\ctikzvalof{bipoles/thermistorntc/height 2}}
4161 {thermistorntc}
4162 {\ctikzvalof{bipoles/thermistorntc/height}}
4163 {\ctikzvalof{bipoles/thermistorntc/width}}
4164 {
4165 \pgfscope
4166 \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}}
4167 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4168 \pgf@circ@draworfill
4169 \pgf@circ@set@relative@thickness{modifier thickness}
4170 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4171 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4172 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4173 \pgfusepath{draw}
4174 \endpgfscope
4175
4176 \pgfsetlinewidth{\pgfstartlinewidth}
4177 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4178 \pgfsetarrowsend{latexslim}
4179 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4180 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4181 \pgfusepath{draw}
4182 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4183 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4184 \pgfusepath{draw}
4185 }
4186
4187 %% Varistor
4188 \pgfcircdeclarebipolescaled{resistors}
4189 {
4190 \pgfcirc@border@extend@updown{1}{1.4}
4191 }
4192 {\ctikzvalof{bipoles/varistor/height}}
4193 {varistor}
4194 {\ctikzvalof{bipoles/varistor/height}}
4195 {\ctikzvalof{bipoles/varistor/width}}
4196 {
4197 \pgfscope
4198 \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}}
4199 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4200 \pgf@circ@draworfill
4201 \pgf@circ@set@relative@thickness{modifier thickness}
4202 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4203 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
4204 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4205 \pgfusepath{draw}
4206 \endpgfscope
4207
4208 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
4209 }
4210
4211 %% Generic tunable
4212 \pgfcircdeclarebipolescaled{resistors}
4213 {
4214 \savedanchor{\wiper}{
4215 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4216 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
4217 \pgf@y=.5\pgf@ya
4218 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
4219 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
4220 }
4221 \anchor{wiper}{\wiper}
4222 \anchor{W}{\wiper}
4223 }
4224 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
4225 {genericpotentiometer}
4226 {\ctikzvalof{bipoles/generic potentiometer/height}}
4227 {\ctikzvalof{bipoles/generic potentiometer/width}}
4228 {
4229
4230 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4231 \divide \pgf@circ@res@step by 14
4232
4233 \pgfscope
4234 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4235 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4236 \pgf@circ@draworfill
4237 \endpgfscope
4238 \pgfscope
4239 %\pgfsetlinewidth{\pgfstartlinewidth}
4240 \pgfcirc@set@arrows{wiper}{}{latexslim}
4241 \pgfextractx{\pgf@circ@res@other}{\wiper}
4242 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4243 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4244 \pgfusepath{draw}
4245 \endpgfscope
4246 }
4247
4248 %% Zig-zag resistors
4249 \def\pgf@circ@zigzag#1{%
4250 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
4251
4252 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4253 \pgf@circ@res@other = \pgf@circ@res@left
4254 \pgf@circ@count@a=\zigs\relax
4255 % first half zig
4256 \advance\pgf@circ@res@other by \pgf@circ@res@step
4257 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4258 \pgfmathloop%
4259 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
4260 \ifnum\pgf@circ@count@a>0
4261 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4262 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4263 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4264 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4265 \repeatpgfmathloop%
4266 % last zig and a half
4267 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4268 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4269 \advance\pgf@circ@res@other by \pgf@circ@res@step
4270 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
4271 \pgfsetbeveljoin
4272 \pgfusepath{draw}
4273 }
4274
4275 %% Resistor
4276 \pgfcircdeclarebipolescaled{resistors}
4277 {
4278 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4279 }
4280 {\ctikzvalof{bipoles/resistor/height}}
4281 {resistor}
4282 {\ctikzvalof{bipoles/resistor/height}}
4283 {\ctikzvalof{bipoles/resistor/width}}
4284 {
4285 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4286 \pgftransformationadjustments
4287 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4288 \pgf@circ@zigzag{1}
4289 }
4290
4291
4292 %% Variable resistor
4293 \pgfcircdeclarebipolescaled{resistors}
4294 {
4295 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4296 }
4297 {\ctikzvalof{bipoles/vresistor/height}}
4298 {vresistor}
4299 {\ctikzvalof{bipoles/vresistor/height}}
4300 {\ctikzvalof{bipoles/vresistor/width}}
4301 {
4302 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4303 \pgftransformationadjustments
4304 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4305 \pgf@circ@zigzag{.5}
4306
4307 \pgfscope
4308 \pgf@circ@set@relative@thickness{modifier thickness}
4309 \pgfcirc@set@arrows{tunable}{}{latexslim}
4310 \ifpgf@circ@fixtunable@dir
4311 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4312 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4313 \else
4314 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4315 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4316 \fi
4317 \pgfusepath{draw}
4318 \endpgfscope
4319 }
4320
4321 %% Potentiometer
4322 \pgfcircdeclarebipolescaled{resistors}
4323 {
4324 \savedanchor{\wiper}{
4325 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4326 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
4327 \pgf@y=.5\pgf@ya
4328 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
4329 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
4330 }
4331 \anchor{wiper}{\wiper}
4332 \anchor{W}{\wiper}
4333 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4334 }
4335 {\ctikzvalof{bipoles/potentiometer/height 2}}
4336 {potentiometer}
4337 {\ctikzvalof{bipoles/potentiometer/height}}
4338 {\ctikzvalof{bipoles/potentiometer/width}}
4339 {
4340 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4341 \pgftransformationadjustments
4342 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4343 \pgf@circ@zigzag{1}
4344
4345 \pgfscope
4346 %\pgfsetlinewidth{\pgfstartlinewidth}
4347 \pgf@circ@set@relative@thickness{modifier thickness}
4348 \pgfcirc@set@arrows{wiper}{}{latexslim}
4349 \pgfextractx{\pgf@circ@res@other}{\wiper}
4350 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4351 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4352 \pgfusepath{draw}
4353 \endpgfscope
4354 }
4355
4356 %% Resistive sensor
4357 \pgfcircdeclarebipolescaled{resistors}
4358 {% anchor for labelling the type of dependency
4359 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
4360 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4361 }
4362 {\ctikzvalof{bipoles/resistivesens/height}}
4363 {resistivesens}
4364 {\ctikzvalof{bipoles/resistivesens/height}}
4365 {\ctikzvalof{bipoles/resistivesens/width}}
4366 {%
4367 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4368 \pgftransformationadjustments
4369 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4370 \pgf@circ@zigzag{.5}
4371
4372 \pgfscope
4373 \pgf@circ@set@relative@thickness{modifier thickness}
4374 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4375 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4376 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}}
4377 \pgfusepath{draw}
4378 \endpgfscope
4379 }% %>>>
4380
4381 %% Paths for resistive components: generic, resistors and wires% %<<<
4382
4383 %% GENERICS
4384 \def\pgf@circ@empty@path#1{}
4385 \pgfcirc@activate@bipole@simple{l}{generic}
4386 \pgfcirc@activate@bipole@simple{l}{ageneric}
4387 \pgfcirc@activate@bipole@simple{l}{tgeneric}
4388 \pgfcirc@activate@bipole@simple{l}{xgeneric}
4389 \pgfcirc@activate@bipole@simple{l}{fullgeneric}
4390 \pgfcirc@activate@bipole@simple{l}{tfullgeneric}
4391 \pgfcirc@activate@bipole@simple{l}{short}
4392 \pgfcirc@activate@bipole@simple{l}{open}
4393
4394 %% wires and crossings
4395
4396 \pgfcirc@activate@bipole@simple{l}{crossing}
4397 \pgfcirc@style@to@style{crossing}{xing}
4398 \pgfcirc@activate@bipole@simple{l}{multiwire}
4399 \pgfcirc@activate@bipole@simple{l}{bmultiwire}
4400 \pgfcirc@activate@bipole@simple{l}{tmultiwire}
4401
4402 % automatically switching path --- to be defined manually
4403 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
4404 \pgfcirc@path@to@style{l}{resistor}{resistor}{}
4405 \pgfcirc@node@to@style{l}{resistor}{american resistor}{}
4406 \pgfcirc@node@to@style{l}{generic}{european resistor}{}
4407 \pgfcirc@style@to@style{resistor}{R}
4408
4409 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
4410 \pgfcirc@path@to@style{l}{vresistor}{variable resistor}{}
4411 \pgfcirc@node@to@style{l}{vresistor}{variable american resistor}{}
4412 \pgfcirc@node@to@style{l}{tgeneric}{variable european resistor}{}
4413 \pgfcirc@style@to@style{variable resistor}{vR}
4414
4415 \def\pgf@circ@resistivesens@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
4416 \pgfcirc@path@to@style{l}{resistivesens}{resistive sensor}{}
4417 \pgfcirc@node@to@style{l}{resistivesens}{american resistive sensor}{}
4418 \pgfcirc@node@to@style{l}{thermistor}{european resistive sensor}{}
4419 \pgfcirc@style@to@style{resistive sensor}{sR}
4420
4421 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
4422 \pgfcirc@path@to@style{l}{potentiometer}{potentiometer}{}
4423 \pgfcirc@node@to@style{l}{potentiometer}{american potentiometer}{}
4424 \pgfcirc@node@to@style{l}{genericpotentiometer}{european potentiometer}{}
4425 \pgfcirc@style@to@style{potentiometer}{pR}
4426
4427 \pgfcirc@activate@bipole@simple{l}{thermistor}
4428 \pgfcirc@style@to@style{thermistor}{thR}
4429 \pgfcirc@activate@bipole{l}{thermistorptc}{thermistorptc}{thermistor ptc}
4430 \pgfcirc@style@to@style{thermistor ptc}{thRp}
4431 \pgfcirc@activate@bipole{l}{thermistorntc}{thermistorntc}{thermistor ntc}
4432 \pgfcirc@style@to@style{thermistor ntc}{thRn}
4433 \pgfcirc@activate@bipole@simple{l}{photoresistor}
4434 \pgfcirc@style@to@style{photoresistor}{phR}
4435 \pgfcirc@activate@bipole@simple{l}{varistor}
4436 \pgfcirc@activate@bipole@simple{l}{memristor}
4437 \pgfcirc@style@to@style{memristor}{Mr}%
4438 % %>>>
4439
4440 %%%%%%%%%%%%%%
4441 %% Capacitors
4442 %%%%%%%%%%%%%
4443
4444 %% Definitions for Capacitors%<<<1
4445 \ctikzset{bipoles/capacitor/height/.initial=.6}
4446 \ctikzset{bipoles/capacitor/width/.initial=.2}
4447 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
4448 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
4449 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
4450 %%% pcapacitor is deprecated
4451 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
4452 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
4453 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
4454 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
4455 \ctikzset{bipoles/ccapacitor/width/.initial=.2}
4456 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
4457 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
4458 \ctikzset{bipoles/vcapacitor/width/.initial=.2}
4459 \ctikzset{bipoles/vcapacitor/tunable width/.initial=3}
4460 \ctikzset{bipoles/vcapacitor/capacitor width/.code={%
4461 \pgfutil@packagewarning{circuitikz}{vcapacitor/capacitor width deprecated; ignored}%
4462 }}% deprecated
4463 % piezoelectric (double size by default)
4464 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
4465 \ctikzset{bipoles/piezoelectric/width/.initial=.4}%
4466 % constant phase element (double size by default)
4467 \ctikzset{bipoles/cpe/height/.initial=.6}
4468 \ctikzset{bipoles/cpe/width/.initial=.4}
4469 %
4470 % style settings
4471 %
4472 \ctikzset{capacitors/width/.code={%
4473 \pgfmathsetmacro{\pgfcirc@@double}{2*#1}%
4474 \ctikzset{bipoles/.cd,
4475 capacitor/width=#1, ecapacitor/width=#1, ccapacitor/width=#1,
4476 vcapacitor/width=#1,
4477 piezoelectric/width=\pgfcirc@@double,
4478 cpe/width=\pgfcirc@@double,
4479 }}}
4480 \ctikzset{capacitors/height/.code={%
4481 \ctikzset{bipoles/.cd,
4482 capacitor/height=#1, ecapacitor/height=#1, ccapacitor/height=#1,
4483 vcapacitor/height=#1,
4484 piezoelectric/height=#1,
4485 cpe/height=#1,
4486 }}}
4487 \def\pgfcirc@maybe@fill@straight@capacitor{%
4488 \pgfscope
4489 \pgfpathrectanglecorners
4490 {\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4491 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4492 \pgf@circ@maybefill
4493 \endpgfscope
4494 }
4495 %>>>
4496
4497 %% Shapes for capacitors%<<<
4498 %% Plain Capacitor
4499 \pgfcircdeclarebipolescaled{capacitors}
4500 {}
4501 {\ctikzvalof{bipoles/capacitor/height}}
4502 {capacitor}
4503 {\ctikzvalof{bipoles/capacitor/height}}
4504 {\ctikzvalof{bipoles/capacitor/width}}
4505 {
4506 \pgfcirc@maybe@fill@straight@capacitor
4507
4508 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4509 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4510 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4511
4512 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4513 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4514 \pgfusepath{draw}
4515
4516 }
4517
4518 %% Capacitive sensor
4519 \pgfcircdeclarebipolescaled{capacitors}
4520 {
4521 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
4522 \pgfcirc@border@extend@full{2.6}{1}{4.4}{1.2}
4523 }
4524 {\ctikzvalof{bipoles/capacitor/height}}
4525 {capacitivesens}
4526 {\ctikzvalof{bipoles/capacitor/height}}
4527 {\ctikzvalof{bipoles/capacitor/width}}
4528 {
4529 \pgfcirc@maybe@fill@straight@capacitor
4530 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4531 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4532 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4533
4534 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4535 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4536 \pgfusepath{draw}
4537 \pgfscope
4538 \pgf@circ@set@relative@thickness{modifier thickness}
4539 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
4540 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
4541 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
4542 \pgfusepath{draw}
4543 \endpgfscope
4544 }
4545
4546 %% Polar Capacitor (DEPRECATED)
4547 \pgfcircdeclarebipolescaled{capacitors}
4548 {}
4549 {\ctikzvalof{bipoles/pcapacitor/height}}
4550 {polarcapacitor}
4551 {\ctikzvalof{bipoles/pcapacitor/height}}
4552 {\ctikzvalof{bipoles/pcapacitor/width}}
4553 {
4554
4555 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4556
4557 \pgfutil@packagewarning{circuitikz}{polar capacitor has been deprecated; change to curved capacitor (see manual)}%
4558
4559 \pgfscope
4560 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
4561 \pgftransformrotate{-90}
4562 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
4563 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
4564 \pgfusepath{draw}
4565 \endpgfscope
4566
4567 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4568 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4569 \pgfusepath{draw}
4570 }
4571
4572
4573 %% Curved capacitor
4574 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
4575 % for a rationale
4576 %
4577 \pgfcircdeclarebipolescaled{capacitors}
4578 {}
4579 {\ctikzvalof{bipoles/ccapacitor/height}}
4580 {ccapacitor}
4581 {\ctikzvalof{bipoles/ccapacitor/height}}
4582 {\ctikzvalof{bipoles/ccapacitor/width}}
4583 {
4584 \pgfscope
4585 \pgfscope
4586 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4587 \pgftransformrotate{-90}
4588 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
4589 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}}
4590 \pgftransformrotate{90}
4591 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4592 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4593 \pgfpathclose{}
4594 \pgf@circ@maybefill
4595 \endpgfscope
4596 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4597 \pgfscope
4598 % \pgfsetcolor{red}
4599 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4600 \pgftransformrotate{-90}
4601 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
4602 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}}
4603 \pgfusepath{draw}
4604 \endpgfscope
4605 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4606 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4607 \pgfusepath{draw}
4608 \endpgfscope
4609 % extend wire to the curved capacitor
4610 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}{0pt}}
4611 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4612 \pgfusepath{draw}
4613 }
4614
4615 %% Electrolytic Capacitor
4616 \pgfcircdeclarebipolescaled{capacitors}
4617 {}
4618 {\ctikzvalof{bipoles/ecapacitor/height}}
4619 {ecapacitor}
4620 {\ctikzvalof{bipoles/ecapacitor/height}}
4621 {\ctikzvalof{bipoles/ecapacitor/width}}
4622 {
4623 \pgfsetrectcap
4624 % % % Draw plus pole
4625 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4627 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
4628 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
4629 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4630 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4631 \pgf@circ@draworfill
4632 % % Draw minus pole
4633 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4634 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
4635 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
4636 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4637 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4638 \pgfsetfillcolor{\ctikzvalof{color}}
4639 \pgfusepath{draw,fill}
4640 \pgfsetfillcolor{\ctikzvalof{color}}
4641 % % plus pole annotation
4642 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
4643 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
4644 }
4645
4646 %% Variable Capacitor
4647 \pgfcircdeclarebipolescaled{capacitors}
4648 {}
4649 {\ctikzvalof{bipoles/vcapacitor/height}}
4650 {vcapacitor}
4651 {\ctikzvalof{bipoles/vcapacitor/height}}
4652 {\ctikzvalof{bipoles/vcapacitor/width}}
4653 {
4654 \pgfcirc@maybe@fill@straight@capacitor
4655 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/tunable width} \pgf@circ@res@right
4656
4657 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4658 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}}
4659 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@down}}
4660
4661 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4662 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4663 \pgfusepath{draw}
4664
4665 \pgfscope
4666 \pgf@circ@set@relative@thickness{modifier thickness}
4667 \pgfcirc@set@arrows{tunable}{}{latexslim}
4668 \ifpgf@circ@fixtunable@dir
4669 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
4670 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
4671 \else
4672 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
4673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
4674 \fi
4675 \pgfusepath{draw}
4676 \endpgfscope
4677
4678 \pgfsetlinewidth{\pgfstartlinewidth}
4679 \pgfusepath{draw}
4680 }
4681
4682
4683 %% Piezoelectric Element
4684
4685 \pgfcircdeclarebipolescaled{capacitors}
4686 {}
4687 {\ctikzvalof{bipoles/piezoelectric/height}}
4688 {piezoelectric}
4689 {\ctikzvalof{bipoles/piezoelectric/height}}
4690 {\ctikzvalof{bipoles/piezoelectric/width}}
4691 {
4692 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
4693 % \divide \pgf@circ@res@step by 5
4694
4695 %% Outer markings
4696 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4697 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4698 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4699
4700 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4701 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4702 \pgfusepath{draw}
4703
4704 %% Inner Box
4705 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
4706 \pgfscope
4707 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4708 \pgfpathrectanglecorners
4709 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
4710 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
4711 \pgf@circ@draworfill
4712 \endpgfscope
4713 }
4714
4715 % Ferroelectric capacitor, suggested by Mayeul Cantan
4716 % (see https://github.com/circuitikz/circuitikz/issues/515)
4717 \pgfcircdeclarebipolescaled{capacitors}
4718 {
4719 \anchor{curve right}{\southwest\pgf@x=-1.8\pgf@x\pgf@y=\pgf@y}%
4720 \anchor{curve left}{\southwest\pgf@x=1.8\pgf@x\pgf@y=-\pgf@y}%
4721 \anchor{kink right}{\southwest\pgf@x=-1.8\pgf@x\pgf@y=0.5\pgf@y}%
4722 \anchor{kink left}{\southwest\pgf@x=1.8\pgf@x\pgf@y=-0.5\pgf@y}%
4723 \pgfcirc@border@extend@full{1.8}{1}{1.8}{1}
4724 }
4725 {\ctikzvalof{bipoles/capacitor/height}}
4726 {ferrocap}
4727 {\ctikzvalof{bipoles/capacitor/height}}
4728 {\ctikzvalof{bipoles/capacitor/width}}
4729 {
4730 \pgfcirc@maybe@fill@straight@capacitor
4731
4732 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4733 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4734 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4735
4736 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4737 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4738 \pgfusepath{draw}
4739 \pgfscope
4740 \pgf@circ@set@relative@thickness{modifier thickness}
4741 \pgfsetcornersarced{\pgfpoint{0.2\pgf@circ@res@right}{0.2\pgf@circ@res@up}}
4742 \pgfpathmoveto{\pgfpoint{-1.8\pgf@circ@res@right}{\pgf@circ@res@up}}
4743 \pgfpathlineto{\pgfpoint{-1.8\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
4744 \pgfpathlineto{\pgfpoint{1.8\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
4745 \pgfpathlineto{\pgfpoint{1.8\pgf@circ@res@right}{\pgf@circ@res@down}}
4746 \pgfusepath{draw}
4747 \endpgfscope
4748 }
4749
4750 %% Constant phase element
4751 \pgfcircdeclarebipolescaled{capacitors}
4752 {}
4753 {\ctikzvalof{bipoles/cpe/height}}
4754 {cpe}
4755 {\ctikzvalof{bipoles/cpe/height}}
4756 {\ctikzvalof{bipoles/cpe/width}}
4757 {
4758 \pgfscope
4759 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4760 \pgfpathlineto{\pgfpointorigin}
4761 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4762 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
4763 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4764 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4765 \pgfpathclose
4766 \pgf@circ@maybefill
4767 \endpgfscope
4768
4769 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4770 \pgfpathlineto{\pgfpointorigin}
4771 \pgfusepath{draw}
4772 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4773 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4774 \pgfpathlineto{\pgfpointorigin}
4775 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4776
4777 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4779 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
4780 \pgfusepath{draw}
4781 }
4782
4783 % %>>>
4784
4785 %% Paths for capacitors%<<<
4786 \pgfcirc@activate@bipole@simple{l}{capacitor}
4787 \pgfcirc@style@to@style{capacitor}{C}
4788 \pgfcirc@activate@bipole@simple{l}{ecapacitor}
4789 \pgfcirc@style@to@style{ecapacitor}{eC}
4790 \pgfcirc@style@to@style{ecapacitor}{elko}
4791 \pgfcirc@activate@bipole{l}{polarcapacitor}{polarcapacitor}{polar capacitor}
4792 %% polar capacitor is deprecated, use curved capacitor instead
4793 \pgfcirc@style@to@style{polar capacitor}{pC}
4794 \pgfcirc@activate@bipole{l}{ccapacitor}{ccapacitor}{curved capacitor}
4795 \pgfcirc@style@to@style{curved capacitor}{cC}
4796 \pgfcirc@activate@bipole{l}{vcapacitor}{vcapacitor}{variable capacitor}
4797 \pgfcirc@style@to@style{variable capacitor}{vC}
4798 \pgfcirc@activate@bipole@simple{l}{piezoelectric}
4799 \pgfcirc@style@to@style{piezoelectric}{PZ}
4800 \pgfcirc@activate@bipole{l}{capacitivesens}{capacitivesens}{capacitive sensor}
4801 \pgfcirc@style@to@style{capacitive sensor}{sC}
4802 \pgfcirc@activate@bipole@simple{l}{ferrocap}
4803 \pgfcirc@style@to@style{ferrocap}{feC}
4804 \pgfcirc@activate@bipole@simple{l}{cpe}
4805 % %>>>
4806
4807 %%%%%%%%%%%%%%%
4808 %% Inductors
4809 %%%%%%%%%%%%%%%
4810
4811 % Definitions of Inductors%<<<1
4812
4813 \ctikzset{inductors/coils/.code={%
4814 \ctikzset{bipoles/cuteinductor/coils=#1}%
4815 \ctikzset{bipoles/cutechoke/coils=#1}%
4816 \ctikzset{bipoles/americaninductor/coils=#1}%
4817 \ctikzset{bipoles/vcuteinductor/coils=#1}%
4818 \ctikzset{bipoles/vamericaninductor/coils=#1}%
4819 }}
4820 \ctikzset{inductors/width/.code={%
4821 \ctikzset{bipoles/cuteinductor/width=#1}%
4822 \ctikzset{bipoles/cutechoke/width=#1}%
4823 \ctikzset{bipoles/americaninductor/width=#1}%
4824 \ctikzset{bipoles/vcuteinductor/width=#1}%
4825 \ctikzset{bipoles/vamericaninductor/width=#1}%
4826 \ctikzset{bipoles/fullgeneric/width=#1}%
4827 \ctikzset{bipoles/tfullgeneric/width=#1}%
4828 }}
4829 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
4830 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
4831 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
4832 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
4833 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
4834 %% Cute choke settings
4835 \ctikzset{bipoles/cutechoke/height/.initial=.3}
4836 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
4837 \ctikzset{bipoles/cutechoke/width/.initial=.6}
4838 \ctikzset{bipoles/cutechoke/coils/.initial=5}
4839 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
4840 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
4841 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
4842 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
4843 \newif\ifpgf@circuit@bipole@twolineschoke
4844 \pgf@circuit@bipole@twolineschokefalse
4845 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
4846 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
4847 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
4848 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
4849 %
4850 % generic core anchor settings
4851 \ctikzset{bipoles/inductors/core distance/.initial={2pt}}
4852 \def\pgfcir@basic@core@anchors{%
4853 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
4854 \anchor{core east}{%
4855 \northeast\advance\pgf@y by\coredistance
4856 }
4857 \anchor{core west}{%
4858 \northeast\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
4859 }
4860 }
4861 %
4862 \ctikzset{bipoles/americaninductor/height/.initial=.3}
4863 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
4864 \ctikzset{bipoles/americaninductor/width/.initial=.8}
4865 \ctikzset{bipoles/americaninductor/coils/.initial=4}
4866 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
4867 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
4868 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
4869 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
4870 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
4871 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
4872 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
4873 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
4874 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
4875 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
4876 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
4877 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
4878 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
4879 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
4880 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
4881 \ctikzset{inductor/.is choice}
4882 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
4883 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
4884 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
4885
4886 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
4887 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
4888 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
4889 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
4890 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
4891
4892 %%>>>
4893
4894 %% Shapes for inductors%<<<
4895 %% cute inductor
4896 \pgfcircdeclarebipolescaled{inductors}
4897 {
4898 \savedanchor{\midtap}{%
4899 \pgf@x=0pt\relax
4900 \pgfmathsetlength{\pgf@y}{%
4901 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4902 \ctikzvalof{bipoles/cuteinductor/height} :% even
4903 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4904 *\pgf@circ@scaled@Rlen/2
4905 }
4906 }
4907 \anchor{midtap}{\midtap}
4908 \pgfcir@basic@core@anchors
4909 }
4910 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
4911 {cuteinductor}
4912 {\ctikzvalof{bipoles/cuteinductor/height}}
4913 {\ctikzvalof{bipoles/cuteinductor/width}}
4914 {
4915 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4916 \pgftransformationadjustments
4917
4918 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
4919 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
4920
4921
4922 \pgfmathsetlength{\pgf@circ@res@step}
4923 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
4924
4925 \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
4926 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
4927 {
4928 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4929 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
4930 }
4931 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4932 \pgfsetbuttcap
4933 \pgfsetbeveljoin
4934 \pgfusepath{stroke}
4935 }
4936
4937 %% cute inductive sensor
4938 \pgfcircdeclarebipolescaled{inductors}
4939 {% anchor for labelling the type of dependency
4940 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
4941 \savedanchor{\midtap}{%
4942 \pgf@x=0pt\relax
4943 \pgfmathsetlength{\pgf@y}{%
4944 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4945 \ctikzvalof{bipoles/cuteinductor/height} :% even
4946 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4947 *\pgf@circ@scaled@Rlen/2
4948 }
4949 }
4950 \anchor{midtap}{\midtap}
4951 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
4952 \pgfcir@basic@core@anchors
4953 }
4954 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
4955 {scuteinductor}
4956 {\ctikzvalof{bipoles/cuteinductor/height}}
4957 {\ctikzvalof{bipoles/cuteinductor/width}}
4958 {
4959 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4960 \pgftransformationadjustments
4961
4962 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
4963 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
4964
4965
4966 \pgfmathsetlength{\pgf@circ@res@step}
4967 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
4968
4969 \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
4970 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
4971 {
4972 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4973 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
4974 }
4975 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
4976 \pgfsetbuttcap
4977 \pgfsetbeveljoin
4978 \pgfusepath{stroke}
4979 \pgfscope
4980 \pgf@circ@set@relative@thickness{modifier thickness}
4981 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
4982 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
4983 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
4984 \pgfusepath{draw}
4985 \endpgfscope
4986 }
4987
4988 %% cute choke
4989 \pgfcircdeclarebipolescaled{inductors}
4990 {
4991 \savedanchor{\midtap}{%
4992 \pgf@x=0pt\relax
4993 \pgfmathsetlength{\pgf@y}{%
4994 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
4995 \ctikzvalof{bipoles/cuteinductor/height} :% even
4996 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
4997 *\pgf@circ@scaled@Rlen/2
4998 }
4999 }
5000 \anchor{midtap}{\midtap}
5001 }
5002 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
5003 {cutechoke}
5004 {\ctikzvalof{bipoles/cutechoke/height}}
5005 {\ctikzvalof{bipoles/cutechoke/width}}
5006 {
5007 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5008 \pgftransformationadjustments
5009
5010 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5011 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
5012
5013
5014 \pgfmathsetlength{\pgf@circ@res@step}
5015 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
5016
5017 \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
5018 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
5019 {
5020 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5021 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5022 }
5023 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5024 \pgfsetbuttcap
5025 \pgfsetbeveljoin
5026 \pgfusepath{stroke}
5027
5028 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5029 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5030 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5031 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5032 \pgfusepath{stroke}
5033
5034 \ifpgf@circuit@bipole@twolineschoke
5035 \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}}
5036 \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}}
5037 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5038 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5039 \pgfusepath{stroke}
5040 \fi
5041 }
5042
5043 %% variable cute inductor
5044 \pgfcircdeclarebipolescaled{inductors}
5045 {
5046 \savedanchor{\midtap}{%
5047 \pgf@x=0pt\relax
5048 \pgfmathsetlength{\pgf@y}{%
5049 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5050 \ctikzvalof{bipoles/cuteinductor/height} :% even
5051 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5052 *\pgf@circ@scaled@Rlen/2
5053 }
5054 }
5055 \anchor{midtap}{\midtap}
5056 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5057 \anchor{core east}{%
5058 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance
5059 }
5060 \anchor{core west}{%
5061 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5062 }
5063 }
5064 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
5065 {vcuteinductor}
5066 {\ctikzvalof{bipoles/vcuteinductor/height}}
5067 {\ctikzvalof{bipoles/vcuteinductor/width}}
5068 {
5069 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5070 \pgftransformationadjustments
5071
5072 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5073 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
5074
5075
5076 \pgfmathsetlength{\pgf@circ@res@step}
5077 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
5078
5079 \pgfscope
5080 \pgf@circ@set@relative@thickness{modifier thickness}
5081 \pgfcirc@set@arrows{tunable}{}{latexslim}
5082 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5083 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5084 \pgfusepath{draw}
5085 \endpgfscope
5086
5087 \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
5088 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
5089 {
5090 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5091 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
5092 }
5093 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5094 \pgfsetbuttcap
5095 \pgfsetbeveljoin
5096 \pgfusepath{stroke}
5097 }
5098
5099 %% american inductor
5100 \pgfcircdeclarebipolescaled{inductors}
5101 {
5102 \savedanchor{\midtap}{%
5103 \pgf@x=0pt\relax
5104 \pgfmathsetlength{\pgf@y}{%
5105 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5106 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5107 0) %odd
5108 *\pgf@circ@scaled@Rlen/2
5109 }
5110 }
5111 \anchor{midtap}{\midtap}
5112 \pgfcir@basic@core@anchors
5113 }
5114 {\ctikzvalof{bipoles/americaninductor/height 2}}
5115 {americaninductor}
5116 {\ctikzvalof{bipoles/americaninductor/height}}
5117 {\ctikzvalof{bipoles/americaninductor/width}}
5118 {
5119 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5120 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5121 \pgftransformationadjustments
5122 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5123 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5124 \divide \pgf@circ@res@step by 2
5125 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5126
5127 \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
5128 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5129 {
5130 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5131 }
5132 \pgfsetbuttcap
5133 \pgfsetbeveljoin
5134 \pgfusepath{stroke}
5135 }
5136
5137
5138 %% american inductive sensor
5139 \pgfcircdeclarebipolescaled{inductors}
5140 {% anchor for labelling the type of dependency
5141 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5142 \savedanchor{\midtap}{%
5143 \pgf@x=0pt\relax
5144 \pgfmathsetlength{\pgf@y}{%
5145 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5146 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5147 0) %odd
5148 *\pgf@circ@scaled@Rlen/2
5149 }
5150 }
5151 \anchor{midtap}{\midtap}
5152 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
5153 \pgfcir@basic@core@anchors
5154 }
5155 {\ctikzvalof{bipoles/americaninductor/height 2}}
5156 {samericaninductor}
5157 {\ctikzvalof{bipoles/americaninductor/height}}
5158 {\ctikzvalof{bipoles/americaninductor/width}}
5159 {
5160 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5161 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5162 \pgftransformationadjustments
5163 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5164 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5165 \divide \pgf@circ@res@step by 2
5166 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5167
5168 \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
5169 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5170 {
5171 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5172 }
5173 \pgfsetbuttcap
5174 \pgfsetbeveljoin
5175 \pgfusepath{stroke}
5176 \pgfscope
5177 \pgf@circ@set@relative@thickness{modifier thickness}
5178 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5179 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5180 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5181 \pgfusepath{draw}
5182 \endpgfscope
5183 }
5184
5185 %% variable american inductor
5186 \pgfcircdeclarebipolescaled{inductors}
5187 {
5188 \savedanchor{\midtap}{%
5189 \pgf@x=0pt\relax
5190 \pgfmathsetlength{\pgf@y}{%
5191 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
5192 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
5193 0) %odd
5194 *\pgf@circ@scaled@Rlen/2
5195 }
5196 }
5197 \anchor{midtap}{\midtap}
5198 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5199 \anchor{core east}{%
5200 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance
5201 }
5202 \anchor{core west}{%
5203 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5204 }
5205 }
5206 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
5207 {vamericaninductor}
5208 {\ctikzvalof{bipoles/vamericaninductor/height}}
5209 {\ctikzvalof{bipoles/vamericaninductor/width}}
5210 {
5211 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
5212 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5213 \pgftransformationadjustments
5214 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5215 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
5216 \divide \pgf@circ@res@step by 2
5217 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
5218
5219 \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
5220 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
5221 {
5222 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5223 }
5224 \pgfsetbuttcap
5225 \pgfsetbeveljoin
5226 \pgfusepath{stroke}
5227
5228 \pgfscope
5229 \pgf@circ@set@relative@thickness{modifier thickness}
5230 \pgfcirc@set@arrows{tunable}{}{latexslim}
5231 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5232 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5233 \pgfusepath{draw}
5234 \endpgfscope
5235 }
5236
5237 %% Generic bipole, filled - used as inductor by some
5238 \pgfcircdeclarebipolescaled{inductors}
5239 {
5240 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5241 \pgfcir@basic@core@anchors
5242 }
5243 {\ctikzvalof{bipoles/fullgeneric/height}}
5244 {fullgeneric}
5245 {\ctikzvalof{bipoles/fullgeneric/height}}
5246 {\ctikzvalof{bipoles/fullgeneric/width}}
5247 {
5248 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5249 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5250
5251 \pgfusepath{draw,fill}
5252 }
5253
5254 %% Generic sensor, filled - used as inductive sensor by some
5255 \pgfcircdeclarebipolescaled{inductors}
5256 {% anchor for labelling the type of dependency
5257 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
5258 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5259 \pgfcirc@border@extend@full{1}{2}{1}{2}
5260 \pgfcir@basic@core@anchors
5261 }
5262 {\ctikzvalof{bipoles/fullgeneric/height}}
5263 {sfullgeneric}
5264 {\ctikzvalof{bipoles/fullgeneric/height}}
5265 {\ctikzvalof{bipoles/fullgeneric/width}}
5266 {
5267
5268 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5269 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5270 \pgfusepath{draw,fill}
5271 \pgfscope
5272 \pgf@circ@set@relative@thickness{modifier thickness}
5273 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
5274 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
5275 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
5276 \pgfusepath{draw}
5277 \endpgfscope
5278 }
5279
5280 %% Generic full tunable
5281 \pgfcircdeclarebipolescaled{inductors}
5282 {
5283 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5284 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5285 \anchor{core east}{%
5286 \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance
5287 }
5288 \anchor{core west}{%
5289 \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance\pgf@x=-\pgf@x
5290 }
5291 }
5292 {\ctikzvalof{bipoles/tfullgeneric/height}}
5293 {tfullgeneric}
5294 {\ctikzvalof{bipoles/tfullgeneric/height}}
5295 {\ctikzvalof{bipoles/tfullgeneric/width}}
5296 {
5297 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
5298 \divide \pgf@circ@res@step by 14
5299
5300 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
5301 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5302 \pgfusepath{draw,fill}
5303
5304 \pgfscope
5305 \pgf@circ@set@relative@thickness{modifier thickness}
5306 \pgfcirc@set@arrows{tunable}{}{latexslim}
5307 \ifpgf@circ@fixtunable@dir
5308 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5309 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5310 \else
5311 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5312 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5313 \fi
5314 \pgfusepath{draw}
5315 \endpgfscope
5316 }
5317 % %>>>
5318
5319 %% Paths for Inductors%<<<
5320 %% these are complex because of the three-way set
5321 %% should be simplified
5322 \def\pgf@circ@inductor@path#1{%
5323 \pgfextra{
5324 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
5325 \def\pgf@temp{european}%
5326 }
5327 \ifx\pgf@temp\pgf@circ@temp%
5328 \pgf@circ@europeaninductor@path{#1}%
5329 \else%
5330 \pgfextra{ \def\pgf@temp{cute} }%
5331 \ifx\pgf@temp\pgf@circ@temp%
5332 \pgf@circ@cuteinductor@path{#1}%
5333 \else%
5334 \pgf@circ@americaninductor@path{#1}%
5335 \fi%
5336 \fi%
5337 }
5338 \pgfcirc@path@to@style{l}{inductor}{inductor}{}
5339 \pgfcirc@style@to@style{inductor}{L}
5340 \pgfcirc@activate@bipole{l}{europeaninductor}{fullgeneric}{european inductor}
5341 \pgfcirc@activate@bipole{l}{americaninductor}{americaninductor}{american inductor}
5342 \pgfcirc@activate@bipole{l}{cuteinductor}{cuteinductor}{cute inductor}
5343
5344 \def\pgf@circ@vinductor@path#1{
5345 \pgfextra{
5346 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
5347 \def\pgf@temp{european}%
5348 }
5349 \ifx\pgf@temp\pgf@circ@temp%
5350 \pgf@circ@veuropeaninductor@path{#1}%
5351 \else%
5352 \pgfextra{ \def\pgf@temp{cute} }%
5353 \ifx\pgf@temp\pgf@circ@temp%
5354 \pgf@circ@vcuteinductor@path{#1}%
5355 \else%
5356 \pgf@circ@vamericaninductor@path{#1}%
5357 \fi%
5358 \fi%
5359 }
5360 \pgfcirc@path@to@style{l}{vinductor}{variable inductor}{}
5361 \pgfcirc@style@to@style{variable inductor}{vL}
5362 \pgfcirc@activate@bipole{l}{veuropeaninductor}{tfullgeneric}{variable european inductor}
5363 \pgfcirc@activate@bipole{l}{vamericaninductor}{vamericaninductor}{variable american inductor}
5364 \pgfcirc@activate@bipole{l}{vcuteinductor}{vcuteinductor}{variable cute inductor}
5365
5366 \def\pgf@circ@inductivesens@path#1{%
5367 \pgfextra{
5368 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
5369 \def\pgf@temp{european}%
5370 }
5371 \ifx\pgf@temp\pgf@circ@temp%
5372 \pgf@circ@europeaninductivesens@path{#1}%
5373 \else%
5374 \pgfextra{ \def\pgf@temp{cute} }%
5375 \ifx\pgf@temp\pgf@circ@temp%
5376 \pgf@circ@cuteinductivesens@path{#1}%
5377 \else%
5378 \pgf@circ@americaninductivesens@path{#1}%
5379 \fi%
5380 \fi%
5381 }
5382 \pgfcirc@path@to@style{l}{inductivesens}{inductive sensor}{}
5383 \pgfcirc@style@to@style{inductive sensor}{sL}
5384 \pgfcirc@activate@bipole{l}{europeaninductivesens}{sfullgeneric}{european inductive sensor}
5385 \pgfcirc@activate@bipole{l}{americaninductivesens}{samericaninductor}{american inductive sensor}
5386 \pgfcirc@activate@bipole{l}{cuteinductivesens}{scuteinductor}{cute inductive sensor}
5387
5388 \pgfcirc@activate@bipole{l}{cutechoke}{cutechoke}{cute choke}
5389 % %>>>
5390
5391 %%%%%%%%%%%
5392 %% Sources (batteries, independent, dependents and so on
5393 %%%%%%%%%%%
5394
5395 % Definitions for Sources%<<<1
5396
5397 \ctikzset{bipoles/esource/height/.initial=.60}
5398 \ctikzset{bipoles/esource/width/.initial=.60}
5399 \ctikzset{bipoles/pvsource/height/.initial=.60}
5400 \ctikzset{bipoles/pvsource/width/.initial=.60}
5401 \ctikzset{bipoles/pvmodule/height/.initial=.60}
5402 \ctikzset{bipoles/pvmodule/width/.initial=1.20}
5403 \ctikzset{bipoles/isource/height/.initial=.60}
5404 \ctikzset{bipoles/isource/width/.initial=.60}
5405 \ctikzset{bipoles/oosource/height/.initial=.60}
5406 \ctikzset{bipoles/oosource/width/.initial=.60}
5407 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
5408 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
5409 \ctikzset{bipoles/dcisource/angle/.initial=80}
5410 \ctikzset{bipoles/dcisource/height/.initial=.60}
5411 \ctikzset{bipoles/dcisource/width/.initial=.60}
5412 \ctikzset{bipoles/dcvsource/height/.initial=.60}
5413 \ctikzset{bipoles/dcvsource/width/.initial=.60}
5414 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
5415 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
5416 \ctikzset{bipoles/isourceam/height/.initial=.60}
5417 \ctikzset{bipoles/isourceam/width/.initial=.60}
5418 \ctikzset{bipoles/vsource/height/.initial=.60}
5419 \ctikzset{bipoles/vsource/width/.initial=.60}
5420 \ctikzset{bipoles/vsourceam/height/.initial=.60}
5421 \ctikzset{bipoles/vsourceam/width/.initial=.60}
5422 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
5423 \ctikzset{bipoles/isourcesin/height/.initial=.60}
5424 \ctikzset{bipoles/isourcesin/width/.initial=.60}
5425 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
5426 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
5427 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
5428 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
5429 \ctikzset{bipoles/cisource/height/.initial=.7}
5430 \ctikzset{bipoles/cisource/width/.initial=.7}
5431 \ctikzset{bipoles/cisourceam/height/.initial=.7}
5432 \ctikzset{bipoles/cisourceam/width/.initial=.7}
5433 \ctikzset{bipoles/ecsource/height/.initial=.7}
5434 \ctikzset{bipoles/ecsource/width/.initial=.7}
5435 \ctikzset{bipoles/cvsource/height/.initial=.7}
5436 \ctikzset{bipoles/cvsource/width/.initial=.7}
5437 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
5438 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
5439 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
5440 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
5441 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
5442 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
5443 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
5444 \ctikzset{bipoles/battery/height/.initial=.6}
5445 \ctikzset{bipoles/battery/width/.initial=.3}
5446 \ctikzset{bipoles/battery1/height/.initial=.6}
5447 \ctikzset{bipoles/battery1/width/.initial=.3}
5448 \ctikzset{bipoles/battery2/height/.initial=.6}
5449 \ctikzset{bipoles/battery2/width/.initial=.3}
5450 % noise sources
5451 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
5452
5453 % for special symbols in the sources: sin, square, triangle, delta, wye, zig, etc.
5454 \ctikzset{sources/symbol/thickness/.initial={1}}
5455 \ctikzset{csources/symbol/thickness/.initial={1}}
5456 \ctikzset{sources/symbol/rotate/.initial={90}}
5457 \ctikzset{csources/symbol/rotate/.initial={90}}
5458
5459 % % % ootransformer
5460 \ctikzset{bipoles/oosourcetrans/height/.initial=.6}
5461 \ctikzset{bipoles/oosourcetrans/width/.initial=.6}
5462 \ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
5463 \ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
5464 \ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
5465
5466 % % % oootransformer
5467 \ctikzset{bipoles/ooosource/height/.initial=.6}
5468 \ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
5469 \ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
5470 \ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
5471
5472 % % % primary windings
5473 \newif\ifpgf@circ@prim@delta
5474 \newif\ifpgf@circ@prim@wye
5475 \newif\ifpgf@circ@prim@zig
5476 \pgfkeys{tikz/prim/.is choice}
5477 \pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}}
5478 \pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}}
5479 \pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}}
5480
5481 % % % secondary windings
5482 \newif\ifpgf@circ@sec@delta
5483 \newif\ifpgf@circ@sec@wye
5484 \newif\ifpgf@circ@sec@zig
5485 \pgfkeys{tikz/sec/.is choice}
5486 \pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}}
5487 \pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}}
5488 \pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}}
5489
5490 % % % tertiary windings (ooosource)
5491 \newif\ifpgf@circ@tert@delta
5492 \newif\ifpgf@circ@tert@wye
5493 \newif\ifpgf@circ@tert@zig
5494 \pgfkeys{tikz/tert/.is choice}
5495 \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}}
5496 \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}}
5497 \pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}%
5498
5499 %%>>>
5500
5501 %% Nodes definitions for sources%<<<
5502
5503 %% Battery
5504 \pgfcircdeclarebipolescaled{batteries}
5505 {}
5506 {\ctikzvalof{bipoles/battery/height}}
5507 {battery}
5508 {\ctikzvalof{bipoles/battery/height}}
5509 {\ctikzvalof{bipoles/battery/width}}
5510 {
5511 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
5512 \divide \pgf@circ@res@step by 6
5513
5514 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5515
5516 \ifpgf@circ@fixbatteries
5517 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5518 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5519
5520 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5521 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5522
5523 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5524 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5525
5526 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5527 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5528 \else
5529 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5530 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5531
5532 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5533 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5534
5535 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5536 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5537
5538 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5539 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5540 \fi
5541 \pgfusepath{draw}
5542 }
5543
5544
5545 %% Battery 1 % poles with equl thickness
5546
5547 \pgfcircdeclarebipolescaled{batteries}
5548 {}
5549 {\ctikzvalof{bipoles/battery1/height}}
5550 {battery1}
5551 {\ctikzvalof{bipoles/battery1/height}}
5552 {\ctikzvalof{bipoles/battery1/width}}
5553 {
5554 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5555 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5556 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5557 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5558 \pgfusepath{draw}
5559
5560 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5561 \ifpgf@circ@fixbatteries
5562 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5563 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5564
5565 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5566 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5567 \else
5568 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5569 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5570
5571 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5572 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5573 \fi
5574 \pgfusepath{draw}
5575 }
5576
5577 %% Battery 2 % negative pole thicker
5578
5579 \pgfcircdeclarebipolescaled{batteries}
5580 {}
5581 {\ctikzvalof{bipoles/battery2/height}}
5582 {battery2}
5583 {\ctikzvalof{bipoles/battery2/height}}
5584 {\ctikzvalof{bipoles/battery2/width}}
5585 {
5586 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5587 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5588 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5589 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5590 \pgfusepath{draw}
5591
5592 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5593 \ifpgf@circ@fixbatteries
5594 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5595 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5596 \pgfusepath{draw}
5597 \pgfsetlinewidth{3\pgflinewidth}
5598 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5599 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5600 \else
5601 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5602 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5603 \pgfusepath{draw}
5604 \pgfsetlinewidth{3\pgflinewidth}
5605 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5606 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5607 \fi
5608 \pgfusepath{draw}
5609 }
5610
5611 %%%%%%%%%%%
5612 %% Round and diamond sources
5613 %%%%%%%%%%%
5614
5615 % % % symbol drawing macros (NOT for delta, wye, zig)
5616 \def\pgf@circ@sources@symbol@setup{% called in a pgfscope
5617 \edef\@@@auto{auto}\edef\@@@rotate{\ctikzvalof{\ctikzclass/symbol/rotate}}
5618 \ifx\@@@auto\@@@rotate
5619 \pgfgettransformentries\a\b\temp\temp\temp\temp
5620 \pgfmathsetmacro{\@@@rotate}{-atan2(\b,\a)}
5621 \fi
5622 \pgftransformrotate{\@@@rotate}%
5623 \pgf@circ@set@relative@thickness{symbol/thickness}%
5624 }
5625
5626 %% Independent voltage source
5627 \pgfcircdeclarebipolescaled{sources}
5628 {}
5629 {\ctikzvalof{bipoles/vsource/height}}
5630 {vsource}
5631 {\ctikzvalof{bipoles/vsource/height}}
5632 {\ctikzvalof{bipoles/vsource/width}}
5633 {
5634
5635 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5636
5637 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5638 \pgf@circ@draworfill
5639 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5640 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5641 \pgfusepath{draw}
5642 }
5643
5644 %% To change the internal symbols of the voltage source american style
5645 \ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
5646 \ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
5647 %% Independent voltage source - American style
5648 \pgfcircdeclarebipolescaled{sources}
5649 {}
5650 {\ctikzvalof{bipoles/vsourceam/height}}
5651 {vsourceAM}
5652 {\ctikzvalof{bipoles/vsourceam/height}}
5653 {\ctikzvalof{bipoles/vsourceam/width}}
5654 {
5655
5656 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5657 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5658 \pgf@circ@draworfill
5659 \pgfsetcolor{\ctikzvalof{color}}
5660 \ifpgf@circ@oldvoltagedirection
5661 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5662 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5663 \else
5664 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5665 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5666 \fi
5667 }
5668
5669 %% Independent sinusoidal voltage source
5670 \pgfcircdeclarebipolescaled{sources}
5671 {}
5672 {\ctikzvalof{bipoles/vsourcesin/height}}
5673 {vsourcesin}
5674 {\ctikzvalof{bipoles/vsourcesin/height}}
5675 {\ctikzvalof{bipoles/vsourcesin/width}}
5676 {
5677
5678 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5679 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5680 \pgf@circ@draworfill
5681
5682 \pgf@circ@res@up = .5\pgf@circ@res@up
5683 \pgfscope
5684 \pgf@circ@sources@symbol@setup
5685 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5686 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5687 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5688 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5689 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5690 \pgfusepath{draw}
5691 \endpgfscope
5692 }
5693
5694 % Square Voltage source - contributed by Alistair Kwan
5695 \pgfcircdeclarebipolescaled{sources}
5696 {}
5697 {\ctikzvalof{bipoles/vsourcesquare/height}}
5698 {vsourcesquare}
5699 {\ctikzvalof{bipoles/vsourcesquare/height}}
5700 {\ctikzvalof{bipoles/vsourcesquare/width}}
5701 {
5702 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5703 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5704 \pgf@circ@draworfill
5705 \pgf@circ@res@up = .5\pgf@circ@res@up
5706 \pgfscope
5707 \pgf@circ@sources@symbol@setup
5708 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5709 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
5710 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
5711 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5712 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5713 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5714 \pgfusepath{draw}
5715 \endpgfscope
5716 }
5717
5718 % Triangle Voltage source - contributed by Ralf Farkas
5719 \pgfcircdeclarebipolescaled{sources}
5720 {}
5721 {\ctikzvalof{bipoles/vsourcetri/height}}
5722 {vsourcetri}
5723 {\ctikzvalof{bipoles/vsourcetri/height}}
5724 {\ctikzvalof{bipoles/vsourcetri/width}}
5725 {
5726
5727 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5728 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5729 \pgf@circ@draworfill
5730
5731 \pgf@circ@res@up = .5\pgf@circ@res@up
5732 \pgfscope
5733 \pgf@circ@sources@symbol@setup
5734 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5735 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
5736 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
5737 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5738 \pgfusepath{draw}
5739 \endpgfscope
5740 }
5741
5742 %% PV Source
5743 \pgfcircdeclarebipolescaled{sources}
5744 {}
5745 {\ctikzvalof{bipoles/pvsource/height}}
5746 {pvsource}
5747 {\ctikzvalof{bipoles/pvsource/height}}
5748 {\ctikzvalof{bipoles/pvsource/width}}
5749 {
5750 \pgfpointorigin
5751 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5752 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5753 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5754 \pgf@circ@draworfill
5755
5756 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
5757 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5758 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
5759 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5760 \pgfusepath{draw}
5761
5762 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5763 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
5764 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
5765
5766 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
5767 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
5768 \pgfusepath{draw}
5769
5770 %Arrow Part
5771 \pgfscope
5772 \pgfsetarrowsend{latex}
5773 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5774 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5775 \pgfusepath{draw}
5776 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5777 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5778 \pgfusepath{draw}
5779 \endpgfscope
5780
5781 }
5782
5783 %% PV Module - contributed by Andre Alves
5784 \pgfcircdeclarebipolescaled{sources}
5785 {}
5786 {\ctikzvalof{bipoles/pvmodule/height}}
5787 {pvmodule}
5788 {\ctikzvalof{bipoles/pvmodule/height}}
5789 {\ctikzvalof{bipoles/pvmodule/width}}
5790 {
5791
5792 % Draw rectangle
5793 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5794 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5795 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5796 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5797 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5798 \pgfpathclose
5799 \pgf@circ@draworfill
5800
5801 % Draw triangle
5802 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5803 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0}}
5804 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5805 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5807 \pgf@circ@draworfill
5808
5809 \pgfusepath{draw}
5810 }
5811
5812 %% Empty Source
5813 \pgfcircdeclarebipolescaled{sources}
5814 {}
5815 {\ctikzvalof{bipoles/esource/height}}
5816 {esource}
5817 {\ctikzvalof{bipoles/esource/height}}
5818 {\ctikzvalof{bipoles/esource/width}}
5819 {
5820 \pgfpointorigin
5821 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5822 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5823 \pgf@circ@draworfill
5824 }
5825
5826 %% DC Current Source with open shape
5827 \pgfcircdeclarebipolescaled{sources}
5828 {}
5829 {\ctikzvalof{bipoles/dcisource/height}}
5830 {dcisource}
5831 {\ctikzvalof{bipoles/dcisource/height}}
5832 {\ctikzvalof{bipoles/dcisource/width}}
5833 {
5834 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5835 \pgfpathmoveto{\pgfpointorigin}
5836 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5837 \pgf@circ@maybefill
5838 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
5839 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
5840 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
5841 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
5842 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
5843 \pgfusepath{draw}
5844
5845 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
5846 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
5847 \pgfusepath{draw}
5848 \pgfscope
5849 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
5850 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
5851 \endpgfscope
5852 }
5853
5854 %% DC-Voltage source
5855 \pgfcircdeclarebipolescaled{sources}
5856 {}
5857 {\ctikzvalof{bipoles/dcvsource/height}}
5858 {dcvsource}
5859 {\ctikzvalof{bipoles/dcvsource/height}}
5860 {\ctikzvalof{bipoles/dcvsource/width}}
5861 {
5862 \pgfpointorigin
5863 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5864 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5865 \pgf@circ@draworfill
5866 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
5867 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
5868 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
5869 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
5870 \pgfusepath{draw}
5871 }
5872
5873 %% Independent current source
5874 \pgfcircdeclarebipolescaled{sources}
5875 {}
5876 {\ctikzvalof{bipoles/isource/height}}
5877 {isource}
5878 {\ctikzvalof{bipoles/isource/height}}
5879 {\ctikzvalof{bipoles/isource/width}}
5880 {
5881 \pgfpointorigin
5882 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5883 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5884 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5885 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5886 \pgf@circ@draworfill
5887 }
5888
5889 %% Independent double oo source
5890 \pgfcircdeclarebipolescaled{sources}
5891 {
5892 \anchor{centerprim}{
5893 \northeast
5894 \pgf@y=0pt\relax
5895 \pgf@x=-\ctikzvalof{bipoles/oosource/circleoffset}\pgf@x
5896 }
5897 \anchor{centersec}{
5898 \northeast
5899 \pgf@y=0pt\relax
5900 \pgf@x=\ctikzvalof{bipoles/oosource/circleoffset}\pgf@x
5901 }
5902 }
5903 {\ctikzvalof{bipoles/oosource/height}}
5904 {oosource}
5905 {\ctikzvalof{bipoles/oosource/height}}
5906 {\ctikzvalof{bipoles/oosource/width}}
5907 {
5908 \pgfpointorigin
5909 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5910 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
5911 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
5912 \pgf@circ@maybefill
5913 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
5914 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right}
5915 \pgf@circ@draworfill
5916 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
5917 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
5918 \pgfusepath{draw}
5919 }
5920
5921 % % % winding symbols
5922 \ctikzset{sources/symbol/delta scale/.initial={1}}
5923 \ctikzset{sources/symbol/wye scale/.initial={1}}
5924 \ctikzset{sources/symbol/zig scale/.initial={1}}
5925 % triangle
5926 \def\pgf@circ@delta#1{
5927 \pgfscope
5928 \pgftransformscale{-.01*\ctikzvalof{\ctikzclass/symbol/delta scale}*\pgf@circ@res@left*#1}
5929 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
5930 \pgftransformrotate{-\pgfcircmathresult}
5931
5932 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5933 \pgf@circ@set@relative@thickness{symbol/thickness}
5934 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5935 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5936 \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}}
5937 \pgfpathclose
5938 \pgfusepath{stroke}
5939 \endpgfscope
5940 }
5941
5942 % star
5943 \def\pgf@circ@wye#1{
5944 \pgfscope
5945 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/wye scale}*\pgf@circ@res@left*#1}
5946 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
5947 \pgftransformrotate{-\pgfcircmathresult}
5948
5949 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5950 \pgf@circ@set@relative@thickness{symbol/thickness}
5951 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
5952 \pgfpathlineto{\pgfpointorigin}
5953 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}}
5954 \pgfpathmoveto{\pgfpointorigin}
5955 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}}
5956 \pgfusepath{stroke}
5957 \endpgfscope
5958 }
5959
5960 % zigzag
5961 \def\pgf@circ@zig#1{
5962 \pgfscope
5963 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/zig scale}*\pgf@circ@res@left*#1}
5964 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
5965 \pgftransformrotate{-\pgfcircmathresult}
5966
5967 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5968 \pgf@circ@set@relative@thickness{symbol/thickness}
5969 \pgfpathmoveto{\pgfpointorigin}
5970 \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}}
5971 \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}}
5972
5973 \pgfpathmoveto{\pgfpointorigin}
5974 \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}}
5975 \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}}
5976
5977 \pgfpathmoveto{\pgfpointorigin}
5978 \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}}
5979 \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}}
5980 \pgfusepath{stroke}
5981 \endpgfscope
5982 }
5983
5984 % % % % round three-phase transformer
5985 \pgfcircdeclarebipolescaled{sources}
5986 {
5987 \anchor{centerprim}{
5988 \northeast
5989 \pgf@y=0pt\relax
5990 \pgf@x=-\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@x
5991 }
5992 \anchor{centersec}{
5993 \northeast
5994 \pgf@y=0pt\relax
5995 \pgf@x=\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@x
5996 }
5997 }
5998 {\ctikzvalof{bipoles/oosourcetrans/height}}
5999 {oosourcetrans}
6000 {\ctikzvalof{bipoles/oosourcetrans/height}}
6001 {\ctikzvalof{bipoles/oosourcetrans/width}}
6002 {
6003
6004 \pgfpointorigin
6005 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6006 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6007 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6008 \pgf@circ@maybefill
6009 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}}
6010 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6011 \pgf@circ@draworfill
6012 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6013 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6014 \pgfusepath{draw}
6015 % % % % draw inner symbols
6016 %%primary winding
6017 \ifpgf@circ@prim@delta
6018 \pgfscope
6019 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6020 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6021 \endpgfscope
6022
6023 \else\ifpgf@circ@prim@wye
6024 \pgfscope
6025 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6026 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6027 \endpgfscope
6028
6029 \else\ifpgf@circ@prim@zig
6030 \pgfscope
6031 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6032 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6033 \endpgfscope
6034 \fi\fi\fi
6035
6036 %%secondary winding
6037 \ifpgf@circ@sec@delta
6038 \pgfscope
6039 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6040 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6041 \endpgfscope
6042
6043 \else\ifpgf@circ@sec@wye
6044 \pgfscope
6045 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6046 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6047 \endpgfscope
6048
6049 \else\ifpgf@circ@sec@zig
6050 \pgfscope
6051 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6052 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6053 \endpgfscope
6054 \fi\fi\fi
6055 }
6056
6057
6058 % % % % ooosource for three phase transformer
6059 \pgfcircdeclarebipolescaled{sources}
6060 {
6061 \anchor{right}{
6062 \northeast
6063 \pgf@y=0pt
6064 \pgfmathparse{
6065 \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
6066 %%the sqrt must be > 0, the circles have to intersect
6067 sqrt(
6068 pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
6069 pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
6070 )
6071 }
6072 \pgf@x=\pgfmathresult\pgf@x
6073 }
6074 \anchor{east}{
6075 \northeast
6076 \pgf@y=0pt
6077 }
6078 \savedanchor{\centerprim}{
6079 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6080 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6081 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
6082 \pgf@y=0pt
6083 \pgf@x=.5\pgf@circ@res@other
6084 }
6085 \anchor{centerprim}{
6086 \centerprim
6087 }
6088 \savedanchor{\centersec}{
6089 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6090 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6091 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
6092 \pgfpointpolar{60}{.5\pgf@circ@res@other}
6093 \pgf@y=-\pgf@y
6094 \pgf@x=-\pgf@x
6095 }
6096 \anchor{centersec}{
6097 \centersec
6098 }
6099 \savedanchor{\centertert}{
6100 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6101 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6102 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
6103 \pgfpointpolar{60}{.5\pgf@circ@res@other}
6104 \pgf@y=\pgf@y
6105 \pgf@x=-\pgf@x
6106 }
6107 \anchor{centertert}{
6108 \centertert
6109 }
6110
6111 % add some anchors in case the are needed :)
6112 \anchor{prim1}{
6113 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6114 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6115 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6116 \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@res@other}}
6117 }
6118 \anchor{prim2}{
6119 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6120 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6121 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6122 \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@res@other}}
6123 }
6124 \anchor{sec1}{
6125 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6126 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6127 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6128 \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@res@other}}
6129 }
6130 \anchor{sec2}{
6131 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6132 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6133 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6134 \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@res@other}}
6135 }
6136 \anchor{sec3}{
6137 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6138 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6139 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6140 \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@res@other}}
6141 }
6142 \anchor{tert1}{
6143 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6144 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6145 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6146 \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@res@other}}
6147 }
6148 \anchor{tert2}{
6149 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6150 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6151 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6152 \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@res@other}}
6153 }
6154 \anchor{tert3}{
6155 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
6156 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
6157 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
6158 \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@res@other}}
6159 }
6160 }
6161 {\ctikzvalof{bipoles/ooosource/height}}
6162 {ooosource}
6163 {\ctikzvalof{bipoles/ooosource/height}}
6164 {\ctikzvalof{bipoles/ooosource/height}}
6165 {
6166 % \pgf@circ@res@other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf@circ@scaled@Rlen
6167
6168 % % filling
6169 % left
6170 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6171 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6172 \pgf@circ@maybefill
6173
6174 % up
6175 \pgfscope
6176 \pgfpointorigin
6177 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6178 \pgf@circ@maybefill
6179 \endpgfscope
6180 % down
6181 \pgfscope
6182 \pgfpointorigin
6183 \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6184 \pgf@circ@draworfill
6185 \endpgfscope
6186
6187 % drawing
6188 % left
6189 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6190 \pgfusepath{draw}
6191
6192 % up
6193 \pgfscope
6194 \pgfpointorigin
6195 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6196 \pgfusepath{draw}
6197 \endpgfscope
6198
6199 % % % draw inner symbols
6200
6201 % % primary winding
6202 \ifpgf@circ@prim@delta
6203 \pgfscope
6204 \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6205 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6206 \endpgfscope
6207
6208 \else\ifpgf@circ@prim@wye
6209 \pgfscope
6210 \pgftransformxshift{.6\pgf@circ@res@left}
6211 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6212 \endpgfscope
6213
6214 \else\ifpgf@circ@prim@zig
6215 \pgfscope
6216 \pgftransformxshift{.6\pgf@circ@res@left}
6217 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6218 \endpgfscope
6219 \fi\fi\fi
6220
6221 % % secondary winding
6222 \ifpgf@circ@sec@delta
6223 \pgfscope
6224 \pgfpointorigin
6225 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6226 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6227 \endpgfscope
6228
6229 \else\ifpgf@circ@sec@wye
6230 \pgfscope
6231 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6232 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6233 \endpgfscope
6234
6235 \else\ifpgf@circ@sec@zig
6236 \pgfscope
6237 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6238 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6239 \endpgfscope
6240 \fi\fi\fi
6241
6242 % % tertiary winding
6243 \ifpgf@circ@tert@delta
6244 \pgfscope
6245 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6246 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6247 \endpgfscope
6248
6249 \else\ifpgf@circ@tert@wye
6250 \pgfscope
6251 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6252 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6253 \endpgfscope
6254
6255 \else\ifpgf@circ@tert@zig
6256 \pgfscope
6257 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6258 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6259 \endpgfscope
6260 \fi\fi\fi
6261 }
6262
6263 %% Independent current source - American
6264 \pgfcircdeclarebipolescaled{sources}
6265 {}
6266 {\ctikzvalof{bipoles/isourceam/height}}
6267 {isourceAM}
6268 {\ctikzvalof{bipoles/isourceam/height}}
6269 {\ctikzvalof{bipoles/isourceam/width}}
6270 {
6271 \pgfpointorigin
6272 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6273 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6274 \pgf@circ@draworfill
6275
6276 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6277 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6278 \pgfusepath{draw}
6279 \pgfscope
6280 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6281 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6282 \endpgfscope
6283 }
6284
6285 %% Independent sinusoidal current source
6286 \pgfcircdeclarebipolescaled{sources}
6287 {}
6288 {\ctikzvalof{bipoles/isource/height}}
6289 {isourcesin}
6290 {\ctikzvalof{bipoles/isource/height}}
6291 {\ctikzvalof{bipoles/isource/width}}
6292 {
6293 \pgfpointorigin
6294 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6295 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6296 \pgf@circ@draworfill
6297
6298 \pgf@circ@res@up = .5\pgf@circ@res@up
6299 \pgfscope
6300 \pgf@circ@sources@symbol@setup
6301 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6302 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6303 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6304 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6305 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6306 \pgfusepath{draw}
6307 \endpgfscope
6308 }
6309
6310 %% Empty controlled source
6311 \pgfcircdeclarebipolescaled{csources}
6312 {}
6313 {\ctikzvalof{bipoles/ecsource/height}}
6314 {ecsource}
6315 {\ctikzvalof{bipoles/ecsource/height}}
6316 {\ctikzvalof{bipoles/ecsource/width}}
6317 {
6318
6319 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6320
6321 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6322 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6323 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6324 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6325 \pgfpathclose
6326 \pgf@circ@draworfill
6327 }
6328
6329 %% Controlled voltage source
6330 \pgfcircdeclarebipolescaled{csources}
6331 {}
6332 {\ctikzvalof{bipoles/cvsource/height}}
6333 {cvsource}
6334 {\ctikzvalof{bipoles/cvsource/height}}
6335 {\ctikzvalof{bipoles/cvsource/width}}
6336 {
6337
6338 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6339
6340 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6341 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6342 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6343 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6344 \pgfpathclose
6345 \pgf@circ@draworfill
6346
6347 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6348 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6349 \pgfusepath{draw}
6350 }
6351
6352 %% To change the internal symbols of the controlled voltage source american style
6353 \ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
6354 \ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}}
6355 %% Controlled voltage source - American
6356 \pgfcircdeclarebipolescaled{csources}
6357 {}
6358 {\ctikzvalof{bipoles/cvsourceam/height}}
6359 {cvsourceAM}
6360 {\ctikzvalof{bipoles/cvsourceam/height}}
6361 {\ctikzvalof{bipoles/cvsourceam/width}}
6362 {
6363 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6364 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6365 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6366 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6367 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6368 \pgfpathclose
6369 \pgf@circ@draworfill
6370
6371 \pgfsetcolor{\ctikzvalof{color}}
6372 \ifpgf@circ@oldvoltagedirection
6373 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6374 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6375 \else
6376 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6377 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6378 \fi
6379 }
6380
6381 %% Controlled sinusoidal voltage source
6382 \pgfcircdeclarebipolescaled{csources}
6383 {}
6384 {\ctikzvalof{bipoles/cvsourcesin/height}}
6385 {cvsourcesin}
6386 {\ctikzvalof{bipoles/cvsourcesin/height}}
6387 {\ctikzvalof{bipoles/cvsourcesin/width}}
6388 {
6389
6390 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6391
6392 \pgfscope
6393 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6394 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6395 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6396 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6397 \pgfpathclose
6398 \pgf@circ@draworfill
6399 \endpgfscope
6400
6401 \pgf@circ@res@up = .5\pgf@circ@res@up
6402 \pgfscope
6403 \pgf@circ@sources@symbol@setup
6404 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6405 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6406 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6407 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6408 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6409 \pgfusepath{draw}
6410 \endpgfscope
6411 }
6412
6413 %% Controlled sinusoidal current source
6414 \pgfcircdeclarebipolescaled{csources}
6415 {}
6416 {\ctikzvalof{bipoles/cvsourcesin/height}}
6417 {cisourcesin}
6418 {\ctikzvalof{bipoles/cvsourcesin/height}}
6419 {\ctikzvalof{bipoles/cvsourcesin/width}}
6420 {
6421
6422 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6423
6424 \pgfscope
6425 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6426 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6427 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6428 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6429 \pgfpathclose
6430 \pgf@circ@draworfill
6431 \endpgfscope
6432
6433 \pgf@circ@res@up = .5\pgf@circ@res@up
6434 \pgfscope
6435 \pgf@circ@sources@symbol@setup
6436 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6437 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6438 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6439 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6440 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6441 \pgfusepath{draw}
6442 \endpgfscope
6443 }
6444
6445 %% Controlled current source
6446 \pgfcircdeclarebipolescaled{csources}
6447 {}
6448 {\ctikzvalof{bipoles/cisource/height}}
6449 {cisource}
6450 {\ctikzvalof{bipoles/cisource/height}}
6451 {\ctikzvalof{bipoles/cisource/width}}
6452 {
6453
6454 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6455
6456 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6457 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6458 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6459 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6460 \pgfpathclose
6461 \pgf@circ@draworfill
6462
6463 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6464 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6465 \pgfusepath{draw}
6466 }
6467
6468 %% Controlled current source - American
6469 \pgfcircdeclarebipolescaled{csources}
6470 {}
6471 {\ctikzvalof{bipoles/cisourceam/height}}
6472 {cisourceAM}
6473 {\ctikzvalof{bipoles/cisourceam/height}}
6474 {\ctikzvalof{bipoles/cisourceam/width}}
6475 {
6476 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6477
6478 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6479 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6480 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6481 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6482 \pgfpathclose
6483 \pgf@circ@draworfill
6484 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6485 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6486 \pgfusepath{draw}
6487 \pgfscope
6488 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6489 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6490 \endpgfscope
6491 }
6492
6493 %% Cute Independent voltage source
6494 \pgfcircdeclarebipolescaled{sources}
6495 {}
6496 {\ctikzvalof{bipoles/vsource/height}}
6497 {vsourceC}
6498 {\ctikzvalof{bipoles/vsource/height}}
6499 {\ctikzvalof{bipoles/vsource/width}}
6500 {
6501 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6502 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6503 \pgf@circ@draworfill
6504 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6505 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6506 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6507 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6508 \pgfsetroundcap\pgfusepath{draw}
6509 }
6510
6511 %% Cute Independent current source
6512 \pgfcircdeclarebipolescaled{sources}
6513 {}
6514 {\ctikzvalof{bipoles/isource/height}}
6515 {isourceC}
6516 {\ctikzvalof{bipoles/isource/height}}
6517 {\ctikzvalof{bipoles/isource/width}}
6518 {
6519 \pgfpointorigin
6520 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6521 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6522 \pgf@circ@draworfill
6523 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6524 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6525 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6526 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6527 \pgfsetroundcap\pgfusepath{draw}
6528 }
6529
6530 %% Cute Controlled voltage source
6531 \pgfcircdeclarebipolescaled{csources}
6532 {}
6533 {\ctikzvalof{bipoles/cvsource/height}}
6534 {cvsourceC}
6535 {\ctikzvalof{bipoles/cvsource/height}}
6536 {\ctikzvalof{bipoles/cvsource/width}}
6537 {
6538 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6539 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6540 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6541 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6542 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6543 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6544 \pgf@circ@draworfill
6545 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6546 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6547 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6548 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6549 \pgfsetroundcap\pgfusepath{draw}
6550 }
6551
6552 %% Cute Controlled current source
6553 \pgfcircdeclarebipolescaled{csources}
6554 {}
6555 {\ctikzvalof{bipoles/cisource/height}}
6556 {cisourceC}
6557 {\ctikzvalof{bipoles/cisource/height}}
6558 {\ctikzvalof{bipoles/cisource/width}}
6559 {
6560 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6561 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6562 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6563 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6564 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6565 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6566 \pgf@circ@draworfill
6567 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6568 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6569 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
6570 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
6571 \pgfsetroundcap\pgfusepath{draw}
6572 }
6573
6574 %% Noise voltage source
6575 \pgfcircdeclarebipolescaled{sources}
6576 {}
6577 {\ctikzvalof{bipoles/vsource/height}}
6578 {vsourceN}
6579 {\ctikzvalof{bipoles/vsource/height}}
6580 {\ctikzvalof{bipoles/vsource/width}}
6581 {
6582 \pgfscope
6583 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6584 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6585 %
6586 \pgf@circ@scaled@Rlen=\scaledRlen
6587 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6588 \edef\pgf@noise@temp{dashed}
6589 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6590 \ifx\pgf@noise@temp\pgf@noise@fill
6591 % fillable in this case
6592 \pgf@circ@draworfillandclip
6593 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6594 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6595 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6596 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6597 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6598 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6599 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6600 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6601 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6602 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6603 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6604 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6605 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6606 %
6607 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6608 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6609 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6610 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6611 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6612 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6613 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6614 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6615 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6616 \pgfusepath{draw}
6617 \else
6618 \pgfsetfillcolor{\pgf@noise@fill}
6619 \pgfusepath{draw,fill}
6620 \fi
6621 \endpgfscope
6622 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6623 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6624 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6625 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6626 \pgfsetroundcap\pgfusepath{draw}
6627 }
6628 %% Noise current source
6629
6630 \pgfcircdeclarebipolescaled{sources}
6631 {}
6632 {\ctikzvalof{bipoles/isource/height}}
6633 {isourceN}
6634 {\ctikzvalof{bipoles/isource/height}}
6635 {\ctikzvalof{bipoles/isource/width}}
6636 {
6637 \pgfpointorigin
6638 \pgfscope
6639 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6640 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6641 %
6642 \pgf@circ@scaled@Rlen=\scaledRlen
6643 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6644 \edef\pgf@noise@temp{dashed}
6645 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6646 \ifx\pgf@noise@temp\pgf@noise@fill
6647 % fillable in this case
6648 \pgf@circ@draworfillandclip
6649 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6650 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6651 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6652 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6653 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6654 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6655 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6656 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6657 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6658 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6659 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6660 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6661 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6662 %
6663 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6664 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6665 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6666 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6667 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6668 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6669 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6670 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6671 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6672 \pgfusepath{draw}
6673 \else
6674 \pgfsetfillcolor{\pgf@noise@fill}
6675 \pgfusepath{draw,fill}
6676 \fi
6677 \endpgfscope
6678 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6679 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6680 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6681 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6682 \pgfsetroundcap\pgfusepath{draw}
6683 }
6684 % %>>>
6685
6686 %% Paths definitions for Sources%<<<
6687
6688 %% Batteries
6689
6690 \pgfcirc@activate@bipole@simple@opt{v}{battery}{\circuitikzbasekey/bipole/is voltage=true,
6691 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6692 \pgfcirc@activate@bipole@opt{v}{batteryone}{battery1}{battery1}{\circuitikzbasekey/bipole/is voltage=true,
6693 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6694 \pgfcirc@activate@bipole@opt{v}{batterytwo}{battery2}{battery2}{\circuitikzbasekey/bipole/is voltage=true,
6695 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6696 %% Sources: voltage
6697
6698 \pgfcirc@activate@bipole@opt{v}{vsource}{vsource}{european voltage source}{%
6699 \circuitikzbasekey/bipole/is voltage=true,
6700 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6701 \pgfcirc@activate@bipole@opt{v}{vsourceam}{vsourceAM}{american voltage source}{%
6702 \circuitikzbasekey/bipole/is voltage=true,
6703 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false}
6704 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi voltage source}{voltage source}
6705 \pgfcirc@style@to@style{voltage source}{vsource}
6706 \pgfcirc@style@to@style{voltage source}{V}
6707
6708 \pgfcirc@activate@bipole@opt{v}{cvsource}{cvsource}{european controlled voltage source}{%
6709 \circuitikzbasekey/bipole/is voltage=true,
6710 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6711 \pgfcirc@activate@bipole@opt{v}{cvsourceam}{cvsourceAM}{american controlled voltage source}{%
6712 \circuitikzbasekey/bipole/is voltage=true,
6713 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false}
6714 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source}{controlled voltage source}
6715 \pgfcirc@style@to@style{controlled voltage source}{cvsource}
6716 \pgfcirc@style@to@style{controlled voltage source}{controlled vsource}
6717 \pgfcirc@style@to@style{controlled voltage source}{cV}
6718
6719 \pgfcirc@activate@bipole@simple@opt{v}{esource}{%
6720 \circuitikzbasekey/bipole/is voltage=true,
6721 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6722
6723 \pgfcirc@activate@bipole@opt{v}{ecsource}{ecsource}{empty controlled source}{%
6724 \circuitikzbasekey/bipole/is voltage=true,
6725 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6726 \pgfcirc@style@to@style{empty controlled source}{ecsource}
6727
6728 \pgfcirc@activate@bipole@opt{v}{vsourcesin}{vsourcesin}{sinusoidal voltage source}{%
6729 \circuitikzbasekey/bipole/is voltage=true,
6730 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6731 \pgfcirc@style@to@style{sinusoidal voltage source}{vsourcesin}
6732 \pgfcirc@style@to@style{sinusoidal voltage source}{sV}
6733
6734 \pgfcirc@activate@bipole@opt{v}{cvsourcesin}{cvsourcesin}{controlled sinusoidal voltage source}{%
6735 \circuitikzbasekey/bipole/is voltage=true,
6736 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6737 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{cvsourcesin}
6738 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{controlled vsourcesin}
6739 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{csV}
6740
6741 \pgfcirc@activate@bipole@opt{v}{vsourcesquare}{vsourcesquare}{square voltage source}{%
6742 \circuitikzbasekey/bipole/is voltage=true,
6743 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6744 \pgfcirc@style@to@style{square voltage source}{vsourcesquare}
6745 \pgfcirc@style@to@style{square voltage source}{sqV}
6746
6747 \pgfcirc@activate@bipole@opt{v}{vsourcetri}{vsourcetri}{triangle voltage source}{%
6748 \circuitikzbasekey/bipole/is voltage=true,
6749 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6750 \pgfcirc@style@to@style{triangle voltage source}{vsourcetri}
6751 \pgfcirc@style@to@style{triangle voltage source}{tV}
6752
6753 \pgfcirc@activate@bipole@simple@opt{v}{pvsource}{%
6754 \circuitikzbasekey/bipole/is voltage=true,
6755 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6756
6757 \pgfcirc@activate@bipole@simple@opt{v}{pvmodule}{%
6758 \circuitikzbasekey/bipole/is voltage=true,
6759 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6760
6761 \pgfcirc@activate@bipole@simple@opt{v}{dcvsource}{%
6762 \circuitikzbasekey/bipole/is voltage=true,
6763 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6764
6765 \pgfcirc@activate@bipole@opt{v}{oosource}{oosource}{voosource}{%
6766 \circuitikzbasekey/bipole/is voltage=true,
6767 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6768
6769 \pgfcirc@activate@bipole@simple@opt{v}{ooosource}{%
6770 \circuitikzbasekey/bipole/is voltage=true,
6771 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6772
6773 \pgfcirc@activate@bipole@simple@opt{v}{oosourcetrans}{%
6774 \circuitikzbasekey/bipole/is voltage=true,
6775 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6776
6777 \pgfcirc@activate@bipole@opt{v}{vsourceC}{vsourceC}{cute european voltage source}{%
6778 \circuitikzbasekey/bipole/is voltage=true,
6779 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6780 \pgfcirc@style@to@style{cute european voltage source}{vsourceC}
6781 \pgfcirc@style@to@style{cute european voltage source}{ceV}
6782
6783 \pgfcirc@activate@bipole@opt{v}{cvsourceC}{cvsourceC}{cute european controlled voltage source}{%
6784 \circuitikzbasekey/bipole/is voltage=true,
6785 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6786 \pgfcirc@style@to@style{cute european controlled voltage source}{cvsourceC}
6787 \pgfcirc@style@to@style{cute european controlled voltage source}{cceV}
6788
6789 \pgfcirc@activate@bipole@opt{v}{vsourceN}{vsourceN}{noise voltage source}{%
6790 \circuitikzbasekey/bipole/is voltage=true,
6791 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6792 \pgfcirc@style@to@style{noise voltage source}{vsourceN}
6793 \pgfcirc@style@to@style{noise voltage source}{nV}
6794
6795 %% Sources: current
6796
6797 \pgfcirc@activate@bipole@opt{i}{isource}{isource}{european current source}{%
6798 \circuitikzbasekey/bipole/is current=true}
6799 \pgfcirc@activate@bipole@opt{i}{isourceam}{isourceAM}{american current source}{%
6800 \circuitikzbasekey/bipole/is current=true}
6801 \pgfcirc@style@to@style{\ifpgf@circuit@europeancurrent european \else american \fi current source}{current source}
6802 \pgfcirc@style@to@style{current source}{isource}
6803 \pgfcirc@style@to@style{current source}{I}
6804
6805 \pgfcirc@activate@bipole@opt{i}{cisource}{cisource}{european controlled current source}{%
6806 \circuitikzbasekey/bipole/is current=true}
6807 \pgfcirc@activate@bipole@opt{i}{cisourceam}{cisourceAM}{american controlled current source}{%
6808 \circuitikzbasekey/bipole/is current=true}
6809 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled current source}{controlled current source}
6810 \pgfcirc@style@to@style{controlled current source}{cisource}
6811 \pgfcirc@style@to@style{controlled current source}{controlled isource}
6812 \pgfcirc@style@to@style{controlled current source}{cI}
6813
6814 \pgfcirc@activate@bipole@opt{i}{isourcesin}{isourcesin}{sinusoidal current source}{%
6815 \circuitikzbasekey/bipole/is current=true}
6816 \pgfcirc@style@to@style{sinusoidal current source}{isourcesin}
6817 \pgfcirc@style@to@style{sinusoidal current source}{sI}
6818
6819 \pgfcirc@activate@bipole@opt{i}{cisourcesin}{cisourcesin}{controlled sinusoidal current source}{%
6820 \circuitikzbasekey/bipole/is current=true}
6821 \pgfcirc@style@to@style{controlled sinusoidal current source}{cisourcesin}
6822 \pgfcirc@style@to@style{controlled sinusoidal current source}{controlled isourcesin}
6823 \pgfcirc@style@to@style{controlled sinusoidal current source}{csI}
6824
6825 \pgfcirc@activate@bipole@simple@opt{i}{dcisource}{%
6826 \circuitikzbasekey/bipole/is current=true}
6827
6828 \pgfcirc@activate@bipole@opt{i}{oosource}{oosource}{ioosource}{%
6829 \circuitikzbasekey/bipole/is current=true}
6830
6831 \pgfcirc@activate@bipole@opt{i}{isourceC}{isourceC}{cute european current source}{%
6832 \circuitikzbasekey/bipole/is current=true}
6833 \pgfcirc@style@to@style{cute european current source}{isourceC}
6834 \pgfcirc@style@to@style{cute european current source}{ceI}
6835
6836 \pgfcirc@activate@bipole@opt{i}{cisourceC}{cisourceC}{cute european controlled current source}{%
6837 \circuitikzbasekey/bipole/is current=true}
6838 \pgfcirc@style@to@style{cute european controlled current source}{cisourceC}
6839 \pgfcirc@style@to@style{cute european controlled current source}{cceI}
6840
6841 \pgfcirc@activate@bipole@opt{i}{isourceN}{isourceN}{noise current source}{%
6842 \circuitikzbasekey/bipole/is current=true}
6843 \pgfcirc@style@to@style{noise current source}{isourceN}
6844 \pgfcirc@style@to@style{noise current source}{nI}
6845
6846 % build alias with voltage and current directions (legacy)
6847
6848 \def\pgf@temp#1{
6849 \pgfcirc@style@to@style@label{voltage source}{V#1}{v#1}
6850 \pgfcirc@style@to@style@label{controlled voltage source}{cV#1}{v#1}
6851 \pgfcirc@style@to@style@label{sinusoidal voltage source}{sV#1}{v#1}
6852 \pgfcirc@style@to@style@label{controlled sinusoidal voltage source}{csV#1}{v#1}
6853 }
6854 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
6855 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
6856 \def\pgf@temp#1{
6857 \pgfcirc@style@to@style@label{current source}{I#1}{i#1}
6858 \pgfcirc@style@to@style@label{controlled current source}{cI#1}{i#1}
6859 \pgfcirc@style@to@style@label{sinusoidal current source}{sI#1}{i#1}
6860 \pgfcirc@style@to@style@label{controlled sinusoidal current source}{csI#1}{i#1}
6861 }
6862 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
6863 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
6864 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
6865 % %>>>
6866
6867 %%%%%%%%%%%%%%
6868 %% Diodes
6869 %%%%%%%%%%%%%%
6870
6871 % Definitions for diodes%<<<1
6872
6873 \ctikzset{bipoles/diode/height/.initial=.50}
6874 \ctikzset{bipoles/diode/width/.initial=.40}
6875 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
6876 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
6877 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
6878 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
6879 \ctikzset{bipoles/varcap/height/.initial=.50}
6880 \ctikzset{bipoles/varcap/width/.initial=.45}
6881
6882 \ctikzset{tripoles/thyristor/height/.initial=1.10}
6883 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
6884 \ctikzset{tripoles/thyristor/width/.initial=1.0}
6885 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
6886 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
6887 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
6888 \ctikzset{tripoles/thyristor/gate height/.initial=0.0} % legacy 0
6889 \ctikzset{tripoles/thyristor/gate kink/.initial=1.0} % legacy 1.0
6890 \ctikzset{tripoles/thyristor/gto space up/.initial=0.5} % legacy 0.5
6891 \ctikzset{tripoles/thyristor/gto space down/.initial=0.0} % legacy 0.0
6892 \ctikzset{tripoles/thyristor/gto bar width/.initial=0.2} % legacy 0.2
6893
6894 \ctikzset{tripoles/triac/height/.initial=1.1}
6895 \ctikzset{tripoles/triac/width/.initial=1}
6896 \ctikzset{tripoles/triac/diode width left/.initial=.3}
6897 \ctikzset{tripoles/triac/diode width right/.initial=.3}
6898 \ctikzset{tripoles/triac/gate kink/.initial=1}
6899
6900 \ctikzset{thyristor style/.is choice}
6901 \ctikzset{thyristor style/legacy/.code={%
6902 \ctikzset{tripoles/thyristor/height=1.1}%
6903 \ctikzset{tripoles/thyristor/height 2=.5}%
6904 \ctikzset{tripoles/thyristor/width=1.0}%
6905 \ctikzset{tripoles/thyristor/diode height=.5}%
6906 \ctikzset{tripoles/thyristor/diode width left=.4}%
6907 \ctikzset{tripoles/thyristor/diode width right=.3}%
6908 \ctikzset{tripoles/thyristor/gate height=0.0}%
6909 \ctikzset{tripoles/thyristor/gate kink=1.0}%
6910 \ctikzset{tripoles/thyristor/gto space up=0.5}%
6911 \ctikzset{tripoles/thyristor/gto space down=0.0}%
6912 \ctikzset{tripoles/thyristor/gto bar width=0.2}%
6913 \ctikzset{tripoles/triac/gate kink=1}%
6914 }}
6915 \ctikzset{thyristor style/compact/.code={%
6916 \ctikzset{tripoles/thyristor/height=0.8}% legacy 1.1
6917 \ctikzset{tripoles/thyristor/height 2=.5}%
6918 \ctikzset{tripoles/thyristor/width=1.0}%
6919 \ctikzset{tripoles/thyristor/diode height=.5}%
6920 \ctikzset{tripoles/thyristor/diode width left=.4}%
6921 \ctikzset{tripoles/thyristor/diode width right=.4}%legacy 0.3
6922 \ctikzset{tripoles/thyristor/gate height=0.5}% legacy 0
6923 \ctikzset{tripoles/thyristor/gate kink=0.7}% legacy 1.0
6924 \ctikzset{tripoles/thyristor/gto space up=0.25}% legacy 0.5
6925 \ctikzset{tripoles/thyristor/gto space down=0.25}% legacy 0.0
6926 \ctikzset{tripoles/thyristor/gto bar width=0.2}%
6927 \ctikzset{tripoles/triac/gate kink=.7}%
6928 }}
6929
6930 %
6931 % Flipping arrows in LED and photodiodes
6932 %
6933 \newif\ifpgf@led@fliparrows
6934 \newif\ifpgf@pd@fliparrows
6935 \pgf@led@fliparrowsfalse
6936 \pgf@pd@fliparrowsfalse
6937 %
6938 % by default the arrows start (LED) and go (PD) to the anode.
6939 %
6940 \ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse}
6941 \ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse}
6942 %
6943 % but they can start form the cathode (LED) or go to it (PD)
6944 %
6945 \ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue}
6946 \ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue}
6947
6948 \newif\ifpgf@circuit@strokediode
6949 \newif\ifpgf@circuit@fulldiode
6950 \pgf@circuit@strokediodefalse
6951 \pgf@circuit@fulldiodefalse
6952
6953 \ctikzset{diode/.is choice}
6954 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
6955 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue }
6956 \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}
6957
6958 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
6959 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
6960 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
6961
6962 %%>>>
6963
6964 %% Node components for diodes %<<<1
6965
6966 %% Black generic diode
6967 \pgfcircdeclarebipolescaled{diodes}
6968 {}
6969 {\ctikzvalof{bipoles/diode/height}}
6970 {fulldiode}
6971 {\ctikzvalof{bipoles/diode/height}}
6972 {\ctikzvalof{bipoles/diode/width}}
6973 {
6974
6975 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6976
6977 \pgfscope
6978 \pgftransformxshift{\pgf@circ@res@left}
6979 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6980 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6981 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6982 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6983 \pgfusepath{draw,fill}
6984 \endpgfscope
6985 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6986 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6987 \pgfusepath{draw}
6988 }
6989
6990 %% Black Zener diode
6991 \pgfcircdeclarebipolescaled{diodes}
6992 {}
6993 {\ctikzvalof{bipoles/diode/height}}
6994 {fullzdiode}
6995 {\ctikzvalof{bipoles/diode/height}}
6996 {\ctikzvalof{bipoles/diode/width}}
6997 {
6998
6999 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7000
7001 \pgfscope
7002 \pgftransformxshift{\pgf@circ@res@left}
7003 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7004 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7005 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7006 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7007 \pgfusepath{draw,fill}
7008 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7009 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7010 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7011 \pgfusepath{draw}
7012 \endpgfscope
7013 }
7014
7015 %% Black alternative zigzag Zener diode
7016 \pgfcircdeclarebipolescaled{diodes}
7017 {% fix the anchor border
7018 \pgfcirc@border@extend@updown{1.3}{1.3}
7019 }
7020 {\ctikzvalof{bipoles/diode/height}}
7021 {fullzzdiode}
7022 {\ctikzvalof{bipoles/diode/height}}
7023 {\ctikzvalof{bipoles/diode/width}}
7024 {
7025
7026 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7027
7028 \pgfscope
7029 \pgftransformxshift{\pgf@circ@res@left}
7030 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7031 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7032 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7033 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7034 \pgfusepath{draw,fill}
7035 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
7036 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7037 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7038 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
7039 \pgfusepath{draw}
7040 \endpgfscope
7041 }
7042
7043 %% Black Schottky diode
7044 \pgfcircdeclarebipolescaled{diodes}
7045 {}
7046 {\ctikzvalof{bipoles/diode/height}}
7047 {fullsdiode}
7048 {\ctikzvalof{bipoles/diode/height}}
7049 {\ctikzvalof{bipoles/diode/width}}
7050 {
7051
7052 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7053 \pgfscope
7054 \pgftransformxshift{\pgf@circ@res@left}
7055 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7056 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7057 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7058 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7059 \pgfusepath{draw,fill}
7060
7061 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
7062 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7063 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7064 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7065 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7066 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7067 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
7068 \pgfusepath{draw}
7069 \endpgfscope
7070
7071 }
7072
7073 %% Black tunnel diode
7074 \pgfcircdeclarebipolescaled{diodes}
7075 {}
7076 {\ctikzvalof{bipoles/diode/height}}
7077 {fulltdiode}
7078 {\ctikzvalof{bipoles/diode/height}}
7079 {\ctikzvalof{bipoles/diode/width}}
7080 {
7081
7082 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7083 \pgfscope
7084 \pgftransformxshift{\pgf@circ@res@left}
7085 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7086 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7087 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7088 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7089 \pgfusepath{draw,fill}
7090
7091 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7092 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7093 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7094 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7095 \pgfusepath{draw}
7096 \endpgfscope
7097 }
7098
7099 %
7100 % draw LED arrows
7101 %
7102 \def\pgf@circ@draw@ledarrows{%
7103 \pgfsetlinewidth{\pgfstartlinewidth}
7104 \pgfsetarrowsend{latexslim}
7105 \ifpgf@led@fliparrows
7106 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
7107 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7108 \pgfusepath{draw}
7109 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
7110 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
7111 \pgfusepath{draw}
7112 \else
7113 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
7114 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
7115 \pgfusepath{draw}
7116 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
7117 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7118 \pgfusepath{draw}
7119 \fi
7120 }
7121 %
7122 % ---and photodiode arrows
7123 %
7124 \def\pgf@circ@draw@pdarrows{%
7125 \pgfsetlinewidth{\pgfstartlinewidth}
7126 \pgfsetarrowsstart{latexslim}
7127 \ifpgf@pd@fliparrows
7128 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
7129 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7130 \pgfusepath{draw}
7131 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
7132 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
7133 \pgfusepath{draw}
7134 \else
7135 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
7136 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
7137 \pgfusepath{draw}
7138 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
7139 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
7140 \pgfusepath{draw}
7141 \fi
7142 }
7143 %
7144 % --and laser diode arrows - contributed by Andre Alves
7145 %
7146 \def\pgf@circ@draw@laserarrows{%
7147 \pgfsetlinewidth{\pgfstartlinewidth}
7148 \pgfsetarrowsend{latexslim}
7149 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{1.1\pgf@circ@res@up}}
7150 \pgfpathlineto{\pgfpoint{-0.4\pgf@circ@res@right}{2.1\pgf@circ@res@up}}
7151 \pgfusepath{draw}
7152 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{1.1\pgf@circ@res@up}}
7153 \pgfpathlineto{\pgfpoint{0.2\pgf@circ@res@right}{2.1\pgf@circ@res@up}}
7154 \pgfusepath{draw}
7155 }
7156 %% Black light emitting diode
7157 \pgfcircdeclarebipolescaled{diodes}
7158 {% fix the anchor border
7159 \pgfcirc@border@extend@updown{1.8}{1}
7160 }
7161 {\ctikzvalof{bipoles/diode/height}}
7162 {fulllediode}
7163 {\ctikzvalof{bipoles/diode/height}}
7164 {\ctikzvalof{bipoles/diode/width}}
7165 {
7166
7167 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7168 \pgfscope
7169 \pgftransformxshift{\pgf@circ@res@left}
7170 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7171 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7172 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7173 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7174 \pgfusepath{draw,fill}
7175 \endpgfscope
7176 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7177 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7178 \pgfusepath{draw}
7179
7180 \pgf@circ@draw@ledarrows
7181 }
7182
7183 %% Black laser diode - contributed by Andre Alves
7184 \pgfcircdeclarebipolescaled{diodes}
7185 {% fix the anchor border
7186 \pgfcirc@border@extend@updown{1.8}{1}
7187 }
7188 {\ctikzvalof{bipoles/diode/height}}
7189 {fulllaserdiode}
7190 {\ctikzvalof{bipoles/diode/height}}
7191 {\ctikzvalof{bipoles/diode/width}}
7192 {
7193
7194 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7195 \pgfscope
7196 \pgftransformxshift{\pgf@circ@res@left}
7197 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7198 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7199 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7200 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7201 \pgfusepath{draw,fill}
7202 \endpgfscope
7203 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7204 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7205 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@up}}
7206 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@down}}
7207 \pgfusepath{draw}
7208
7209 \pgf@circ@draw@laserarrows
7210 }
7211
7212 %% Black photodiode
7213 \pgfcircdeclarebipolescaled{diodes}
7214 {% fix the anchor border
7215 \pgfcirc@border@extend@updown{1.8}{1}
7216 }
7217 {\ctikzvalof{bipoles/diode/height}}
7218 {fullpdiode}
7219 {\ctikzvalof{bipoles/diode/height}}
7220 {\ctikzvalof{bipoles/diode/width}}
7221 {
7222
7223 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7224 \pgfscope
7225 \pgftransformxshift{\pgf@circ@res@left}
7226 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7227 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7228 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7229 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7230 \pgfusepath{draw,fill}
7231 \endpgfscope
7232 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7233 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7234 \pgfusepath{draw}
7235
7236 \pgf@circ@draw@pdarrows
7237 }
7238
7239 %% Black varcap
7240 \pgfcircdeclarebipolescaled{diodes}
7241 {}
7242 {\ctikzvalof{bipoles/varcap/height}}
7243 {fullvarcap}
7244 {\ctikzvalof{bipoles/varcap/height}}
7245 {\ctikzvalof{bipoles/varcap/width}}
7246 {
7247 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7248 \pgfsetlinewidth{\pgf@circ@res@temp}
7249 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7250 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7251 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7252 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7253 \pgfusepath{draw,fill}
7254 %
7255 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7256 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7257 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7258 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7259 \pgfusepath{draw}
7260 }
7261
7262 %% Code for the diode triangle
7263 \def\pgf@circ@basicdiodeshape{
7264 % \pgfscope
7265 \pgftransformxshift{\pgf@circ@res@left}
7266 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7267 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
7268 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7269 \pgfpathclose
7270 \pgf@circ@draworfill
7271 \pgfscope
7272 % to allow filling, we need to draw explicitly the stroke here.
7273 \pgfsetlinewidth{\pgfstartlinewidth}
7274 \ifpgf@circuit@bipole@strokedsymbol
7275 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
7276 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
7277 \pgfusepath{draw}
7278 \fi
7279 \endpgfscope
7280 % \endpgfscope
7281 }
7282
7283 %% Empty generic diode
7284 \pgfcircdeclarebipolescaled{diodes}
7285 {}
7286 {\ctikzvalof{bipoles/diode/height}}
7287 {emptydiode}
7288 {\ctikzvalof{bipoles/diode/height}}
7289 {\ctikzvalof{bipoles/diode/width}}
7290 {
7291 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7292 \pgfscope
7293 \pgf@circ@basicdiodeshape
7294 \endpgfscope
7295 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7296 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7297 \pgfusepath{draw}
7298 }
7299
7300 %% Empty Zener diode
7301 \pgfcircdeclarebipolescaled{diodes}
7302 {}
7303 {\ctikzvalof{bipoles/diode/height}}
7304 {emptyzdiode}
7305 {\ctikzvalof{bipoles/diode/height}}
7306 {\ctikzvalof{bipoles/diode/width}}
7307 {
7308
7309 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7310
7311 \pgfscope
7312 \pgf@circ@basicdiodeshape
7313 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7314 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7315 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7316 \pgfusepath{draw}
7317 \endpgfscope
7318 }
7319
7320 %% Empty alternative zigzag Zener diode
7321 \pgfcircdeclarebipolescaled{diodes}
7322 {% fix the anchor border
7323 \pgfcirc@border@extend@updown{1.3}{1.3}
7324 }
7325 {\ctikzvalof{bipoles/diode/height}}
7326 {emptyzzdiode}
7327 {\ctikzvalof{bipoles/diode/height}}
7328 {\ctikzvalof{bipoles/diode/width}}
7329 {
7330
7331 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7332
7333 \pgfscope
7334 \pgf@circ@basicdiodeshape
7335 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
7336 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7337 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7338 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
7339 \pgfusepath{draw}
7340 \endpgfscope
7341 }
7342 %% Empty Schottky diode
7343 \pgfcircdeclarebipolescaled{diodes}
7344 {}
7345 {\ctikzvalof{bipoles/diode/height}}
7346 {emptysdiode}
7347 {\ctikzvalof{bipoles/diode/height}}
7348 {\ctikzvalof{bipoles/diode/width}}
7349 {
7350
7351 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7352 \pgfscope
7353 \pgf@circ@basicdiodeshape
7354 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
7355 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7356 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7357 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7358 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7359 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7360 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
7361 \pgfusepath{draw}
7362 \endpgfscope
7363
7364 }
7365
7366 %% Empty tunnel diode
7367 \pgfcircdeclarebipolescaled{diodes}
7368 {}
7369 {\ctikzvalof{bipoles/diode/height}}
7370 {emptytdiode}
7371 {\ctikzvalof{bipoles/diode/height}}
7372 {\ctikzvalof{bipoles/diode/width}}
7373 {
7374
7375 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7376 \pgfscope
7377 \pgf@circ@basicdiodeshape
7378 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7380 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7381 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7382 \pgfusepath{draw}
7383 \endpgfscope
7384 }
7385
7386 %% Empty light emitting diode
7387 \pgfcircdeclarebipolescaled{diodes}
7388 {% fix the anchor border
7389 \pgfcirc@border@extend@updown{1.8}{1}
7390 }
7391 {\ctikzvalof{bipoles/diode/height}}
7392 {emptylediode}
7393 {\ctikzvalof{bipoles/diode/height}}
7394 {\ctikzvalof{bipoles/diode/width}}
7395 {
7396
7397 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7398 \pgfscope
7399 \pgf@circ@basicdiodeshape
7400 \endpgfscope
7401 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7402 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7403 \pgfusepath{draw}
7404
7405 \pgf@circ@draw@ledarrows
7406 }
7407
7408 %% Empty laser diode - contributed by Andre Alves
7409 \pgfcircdeclarebipolescaled{diodes}
7410 {% fix the anchor border
7411 \pgfcirc@border@extend@updown{1.8}{1}
7412 }
7413 {\ctikzvalof{bipoles/diode/height}}
7414 {emptylaserdiode}
7415 {\ctikzvalof{bipoles/diode/height}}
7416 {\ctikzvalof{bipoles/diode/width}}
7417 {
7418
7419 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7420 \pgfscope
7421 \pgf@circ@basicdiodeshape
7422 \endpgfscope
7423 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7424 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7425 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@up}}
7426 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@down}}
7427 \pgfusepath{draw}
7428
7429 \pgf@circ@draw@laserarrows
7430 }
7431
7432 %% Empty photodiode
7433 \pgfcircdeclarebipolescaled{diodes}
7434 {% fix the anchor border
7435 \pgfcirc@border@extend@updown{1.8}{1}
7436 }
7437 {\ctikzvalof{bipoles/diode/height}}
7438 {emptypdiode}
7439 {\ctikzvalof{bipoles/diode/height}}
7440 {\ctikzvalof{bipoles/diode/width}}
7441 {
7442
7443 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7444 \pgfscope
7445 \pgf@circ@basicdiodeshape
7446 \endpgfscope
7447 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7448 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7449 \pgfusepath{draw}
7450
7451 \pgf@circ@draw@pdarrows
7452 }
7453
7454 %% Empty varcap
7455 \pgfcircdeclarebipolescaled{diodes}
7456 {}
7457 {\ctikzvalof{bipoles/varcap/height}}
7458 {emptyvarcap}
7459 {\ctikzvalof{bipoles/varcap/height}}
7460 {\ctikzvalof{bipoles/varcap/width}}
7461 {
7462 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7463 \pgfsetlinewidth{\pgf@circ@res@temp}
7464 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7465 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7466 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7467 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7468 \pgfpathclose
7469 \pgf@circ@draworfill
7470 \pgfscope
7471 % to allow filling, we need to draw explicitily the stroke here.
7472 \pgfsetlinewidth{\pgfstartlinewidth}
7473 \ifpgf@circuit@bipole@strokedsymbol
7474 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7475 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7476 \pgfusepath{draw}
7477 \fi
7478 \endpgfscope
7479 %
7480 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7481 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7482 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7483 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7484 \pgfusepath{draw}
7485 }
7486
7487 %% Empty bidirectionaldiode
7488 \pgfcircdeclarebipolescaled{diodes}
7489 {}
7490 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7491 {emptybidirectionaldiode}
7492 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7493 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7494 {
7495
7496 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7497
7498 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7499 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7500
7501 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7502 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7503 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7504 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7505
7506 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7507 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7508 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7509 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7510
7511 \pgf@circ@draworfill
7512
7513 \pgfsetlinewidth{\pgfstartlinewidth}
7514
7515 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7516 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7517
7518 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7519 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7520
7521 \pgfusepath{draw}
7522 }
7523
7524 %% Full bidirectionaldiode
7525 \pgfcircdeclarebipolescaled{diodes}
7526 {}
7527 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7528 {fullbidirectionaldiode}
7529 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7530 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7531 {
7532
7533 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7534
7535 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7536 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7537
7538 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7539 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7540 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7541 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7542
7543 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7544 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7545 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7546 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7547
7548 \pgfusepath{draw, fill}
7549
7550 \pgfsetlinewidth{\pgfstartlinewidth}
7551
7552 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7553 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7554
7555 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7556 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7557
7558 \pgfusepath{draw}
7559 }
7560
7561 %%% Thyristors in general
7562
7563
7564 \def\pgfcircdeclarethyristor#1#2#3#4{%name, fill (0-> black; 1-empty), gate position (1: catode, -1: anode), extra code
7565 \pgfcircdeclarebipolescaled{diodes}
7566 {
7567 \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/thyristor/gate kink}}}
7568 \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x}
7569 \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x}
7570 \anchor{anode}{\southwest\pgf@y=0cm}
7571 \anchor{cathode}{\northeast\pgf@y=0cm }
7572 }
7573 {\ctikzvalof{tripoles/thyristor/height 2}}
7574 {#1}
7575 {\ctikzvalof{tripoles/thyristor/height}}
7576 {\ctikzvalof{tripoles/thyristor/width}}
7577 {
7578 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7579 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7580
7581 \pgfscope
7582 % draw the thick parts here (shifted horizontally)
7583 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7584 % draw the basic triangle
7585 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7586
7587 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
7588 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
7589 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7590 \pgfpathclose
7591 \ifnum#2=0\relax
7592 \pgfusepath{draw,fill}
7593 \else
7594 \pgf@circ@draworfill
7595 \fi
7596 % draw the vertical bar
7597 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7598 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7599 \pgfusepath{draw}
7600 \endpgfscope
7601
7602 % back to normal linewidth
7603 % stroke if needed
7604 \ifpgf@circuit@bipole@strokedsymbol
7605 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7606 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7607 \pgfusepath{draw}
7608 \fi
7609
7610 % draw the gate thing;
7611 #4
7612
7613 % draw the leads in/out
7614 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7615 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7616
7617 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7618 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7619
7620 \pgfusepath{draw}
7621 }
7622 }
7623
7624 \def\pgfcirc@thyristor@simplegate{%
7625 \pgfpathmoveto{\pgfpoint
7626 {\pgf@circ@res@step}
7627 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7628 }
7629 \pgfpathlineto{\pgfpoint
7630 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7631 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
7632 }
7633 \pgfpathlineto{\pgfpoint
7634 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7635 {\pgf@circ@res@up}
7636 }
7637 \pgfusepath{draw}
7638 }
7639
7640 %% Black thyristor
7641 \pgfcircdeclarethyristor{fullthyristor}{0}{1}{\pgfcirc@thyristor@simplegate}
7642 %% Empty thyristor
7643 \pgfcircdeclarethyristor{emptythyristor}{1}{1}{\pgfcirc@thyristor@simplegate}
7644 %% black and empty GTO (standard: double line symbol, no arrow)
7645
7646 \def\pgfcirc@doublegate@gto@add{
7647 % connection to gate terminal
7648 \pgfpathmoveto{\pgfpoint
7649 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7650 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up -
7651 \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7652 }
7653 \pgfpathlineto{\pgfpoint
7654 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7655 {\pgf@circ@res@up}
7656 }
7657 \pgfusepath{draw}
7658 \pgfscope
7659 \pgfcirc@set@arrows{gto gate}{}{}
7660 % \pgfsetarrowsstart{latexslim}
7661 % first (lower) gto line: from body to gate
7662 \pgfpathmoveto{\pgfpoint
7663 {\pgf@circ@res@step}
7664 {(\ctikzvalof{tripoles/thyristor/gate height}-\ctikzvalof{tripoles/thyristor/gto space down})
7665 *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7666 }
7667 \pgfpathlineto{\pgfpoint
7668 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7669 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up -
7670 \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7671 }
7672 \pgfusepath{draw}
7673 % second (higher) gto line: from gate to body
7674 \pgfpathmoveto{\pgfpoint
7675 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7676 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up +
7677 \ctikzvalof{tripoles/thyristor/gto space up}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7678 }
7679 \pgfpathlineto{\pgfpoint
7680 {\pgf@circ@res@step}
7681 {(\ctikzvalof{tripoles/thyristor/gate height}+\ctikzvalof{tripoles/thyristor/gto space up})
7682 *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7683 }
7684 \pgfusepath{draw}
7685 \endpgfscope
7686 }
7687 \pgfcircdeclarethyristor{fullgto}{0}{1}{\pgfcirc@doublegate@gto@add}
7688 \pgfcircdeclarethyristor{emptygto}{1}{1}{\pgfcirc@doublegate@gto@add}
7689
7690 \def\pgfcirc@bargate@gto@add{%
7691 \pgfpathmoveto{\pgfpoint
7692 {\pgf@circ@res@step}
7693 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7694 }
7695 \pgfpathlineto{\pgfpoint
7696 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7697 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
7698 }
7699 \pgfpathlineto{\pgfpoint
7700 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
7701 {\pgf@circ@res@up}
7702 }
7703 % draw bar line.
7704 \pgfpathmoveto{\pgfpoint
7705 {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right}
7706 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
7707 }
7708 \pgfpathlineto{\pgfpoint
7709 {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right}
7710 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
7711 }
7712 \pgfusepath{draw}
7713 }
7714
7715 \pgfcircdeclarethyristor{fullgtobar}{0}{1}{\pgfcirc@bargate@gto@add}
7716 \pgfcircdeclarethyristor{emptygtobar}{1}{1}{\pgfcirc@bargate@gto@add}
7717
7718 %% Thyristors with anode-connected gate
7719
7720 \def\pgfcirc@thyristor@anodegate{%
7721 \pgfpathmoveto{\pgfpoint
7722 {\pgf@circ@res@other}
7723 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7724 }
7725 \pgfpathlineto{\pgfpoint
7726 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
7727 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
7728 }
7729 \pgfpathlineto{\pgfpoint
7730 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
7731 {\pgf@circ@res@up}
7732 }
7733 \pgfusepath{draw}
7734 }
7735
7736 %% Black PUT
7737 \pgfcircdeclarethyristor{fullput}{0}{-1}{\pgfcirc@thyristor@anodegate}
7738 %% Empty PUT
7739 \pgfcircdeclarethyristor{emptyput}{1}{-1}{\pgfcirc@thyristor@anodegate}
7740 %% black and empty GTO (standard: double line symbol, no arrow)
7741
7742 \def\pgfcirc@anodebargate@gto@add{%
7743 \pgfpathmoveto{\pgfpoint
7744 {\pgf@circ@res@other}
7745 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
7746 }
7747 \pgfpathlineto{\pgfpoint
7748 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
7749 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
7750 }
7751 \pgfpathlineto{\pgfpoint
7752 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
7753 {\pgf@circ@res@up}
7754 }
7755 % draw bar line.
7756 \pgfpathmoveto{\pgfpoint
7757 {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left}
7758 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
7759 }
7760 \pgfpathlineto{\pgfpoint
7761 {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left}
7762 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
7763 }
7764 \pgfusepath{draw}
7765 }
7766
7767 \pgfcircdeclarethyristor{fullagtobar}{0}{-1}{\pgfcirc@anodebargate@gto@add}
7768 \pgfcircdeclarethyristor{emptyagtobar}{1}{-1}{\pgfcirc@anodebargate@gto@add}
7769
7770 % Triacs
7771
7772 \def\pgfcircdeclaretriac#1#2{%name, fill (0-> black; 1-empty)
7773 \pgfcircdeclarebipolescaled{diodes}
7774 {
7775 \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/triac/gate kink}}}
7776 \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x}
7777 \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x}
7778 \anchor{anode}{\southwest\pgf@y=0cm}
7779 \anchor{cathode}{\northeast\pgf@y=0cm }
7780 }
7781 {\ctikzvalof{tripoles/triac/height}}
7782 {#1}
7783 {\ctikzvalof{tripoles/triac/height}}
7784 {\ctikzvalof{tripoles/triac/width}}
7785 {
7786 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7787
7788 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7789 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7790
7791 % diodes forms
7792 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7793 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7794 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7795 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7796
7797 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7798 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7799 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7800 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7801
7802 \ifnum#2=0\relax
7803 \pgfusepath{draw,fill}
7804 \else
7805 \pgf@circ@draworfill
7806 \fi
7807
7808 \pgfsetlinewidth{\pgfstartlinewidth}
7809
7810 % draw gate
7811 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7812 \pgfpathlineto{\pgfpoint
7813 {\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}
7814 {-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7815 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7816
7817 % draw leads
7818 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7820
7821 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7823
7824 \pgfusepath{draw}
7825
7826 }
7827 }
7828
7829 \pgfcircdeclaretriac{fulltriac}{0}
7830 \pgfcircdeclaretriac{emptytriac}{1}
7831
7832 % end of shape definitions for diodes%>>>
7833
7834 %% Paths definitions for Diodes%<<<
7835
7836 \def\pgfcirc@tmp@generatediodes#1#2{
7837 \pgfcirc@activate@bipole{l}{#1diode}{#1diode}{#1 diode}
7838 \pgfcirc@style@to@style{#1 diode}{D#2}
7839 \pgfcirc@activate@bipole{l}{#1zdiode}{#1zdiode}{#1 Zener diode}
7840 \pgfcirc@style@to@style{#1 Zener diode}{zD#2}
7841 \pgfcirc@activate@bipole{l}{#1zzdiode}{#1zzdiode}{#1 ZZener diode}
7842 \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2}
7843 \pgfcirc@activate@bipole{l}{#1sdiode}{#1sdiode}{#1 Schottky diode}
7844 \pgfcirc@style@to@style{#1 Schottky diode}{sD#2}
7845 \pgfcirc@activate@bipole{l}{#1tdiode}{#1tdiode}{#1 tunnel diode}
7846 \pgfcirc@style@to@style{#1 tunnel diode}{tD#2}
7847 \pgfcirc@activate@bipole{l}{#1lediode}{#1lediode}{#1 led}
7848 \pgfcirc@style@to@style{#1 led}{leD#2}
7849 \pgfcirc@activate@bipole{l}{#1laserdiode}{#1laserdiode}{#1 laser diode}
7850 \pgfcirc@style@to@style{#1 laser diode}{lasD#2}
7851 \pgfcirc@activate@bipole{l}{#1pdiode}{#1pdiode}{#1 photodiode}
7852 \pgfcirc@style@to@style{#1 photodiode}{pD#2}
7853 \pgfcirc@activate@bipole{l}{#1varcap}{#1varcap}{#1 varcap}
7854 \pgfcirc@style@to@style{#1 varcap}{VC#2}
7855 \pgfcirc@activate@bipole{l}{#1bidirectionaldiode}{#1bidirectionaldiode}{#1 bidirectionaldiode}
7856 \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2}
7857 \pgfcirc@activate@bipole{l}{#1thyristor}{#1thyristor}{#1 thyristor}
7858 \pgfcirc@style@to@style{#1 thyristor}{Ty#2}
7859 \pgfcirc@activate@bipole{l}{#1put}{#1put}{#1 put}
7860 \pgfcirc@style@to@style{#1 put}{PUT#2}
7861 \pgfcirc@activate@bipole{l}{#1gto}{#1gto}{#1 gto}
7862 \pgfcirc@style@to@style{#1 gto}{GTO#2}
7863 \pgfcirc@activate@bipole{l}{#1gtobar}{#1gtobar}{#1 gtobar}
7864 \pgfcirc@style@to@style{#1 gtobar}{GTOb#2}
7865 \pgfcirc@activate@bipole{l}{#1agtobar}{#1agtobar}{#1 agtobar}
7866 \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2}
7867 \pgfcirc@activate@bipole{l}{#1triac}{#1triac}{#1 triac}
7868 \pgfcirc@style@to@style{#1 triac}{Tr#2}
7869 }
7870 \pgfcirc@tmp@generatediodes{full}{*}
7871 \pgfcirc@tmp@generatediodes{empty}{o}
7872 \def\pgfcirc@tmp@generatestrokeddiodes#1#2{
7873 \pgfcirc@node@to@style{l}{emptydiode}{#1 diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7874 \pgfcirc@style@to@style{#1 diode}{D#2}
7875 \pgfcirc@node@to@style{l}{emptyzdiode}{#1 Zener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7876 \pgfcirc@style@to@style{#1 Zener diode}{zD#2}
7877 \pgfcirc@node@to@style{l}{emptyzzdiode}{#1 ZZener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7878 \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2}
7879 \pgfcirc@node@to@style{l}{emptysdiode}{#1 Schottky diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7880 \pgfcirc@style@to@style{#1 Schottky diode}{sD#2}
7881 \pgfcirc@node@to@style{l}{emptytdiode}{#1 tunnel diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7882 \pgfcirc@style@to@style{#1 tunnel diode}{tD#2}
7883 \pgfcirc@node@to@style{l}{emptylediode}{#1 led}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7884 \pgfcirc@style@to@style{#1 led}{leD#2}
7885 \pgfcirc@node@to@style{l}{emptylaserdiode}{#1 laser diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7886 \pgfcirc@style@to@style{#1 laser diode}{lasD#2}
7887 \pgfcirc@node@to@style{l}{emptypdiode}{#1 photodiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7888 \pgfcirc@style@to@style{#1 photodiode}{pD#2}
7889 \pgfcirc@node@to@style{l}{emptyvarcap}{#1 varcap}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7890 \pgfcirc@style@to@style{#1 varcap}{VC#2}
7891 \pgfcirc@node@to@style{l}{emptybidirectionaldiode}{#1 bidirectionaldiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7892 \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2}
7893 \pgfcirc@node@to@style{l}{emptythyristor}{#1 thyristor}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7894 \pgfcirc@style@to@style{#1 thyristor}{Ty#2}
7895 \pgfcirc@node@to@style{l}{emptyput}{#1 put}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7896 \pgfcirc@style@to@style{#1 put}{PUT#2}
7897 \pgfcirc@node@to@style{l}{emptygto}{#1 gto}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7898 \pgfcirc@style@to@style{#1 gto}{GTO#2}
7899 \pgfcirc@node@to@style{l}{emptygtobar}{#1 gtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7900 \pgfcirc@style@to@style{#1 gtobar}{GTOb#2}
7901 \pgfcirc@node@to@style{l}{emptyagtobar}{#1 agtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7902 \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2}
7903 \pgfcirc@node@to@style{l}{emptytriac}{#1 triac}{\circuitikzbasekey/bipole/is strokedsymbol=true}
7904 \pgfcirc@style@to@style{#1 triac}{Tr#2}
7905 }
7906 \pgfcirc@tmp@generatestrokeddiodes{stroke}{-}
7907 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
7908 % these are auto-switching styles
7909 \pgfcirc@style@to@style{\pgfcircdiodestylemacro diode}{diode}
7910 \pgfcirc@style@to@style{diode}{D}
7911 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Zener diode}{Zener diode}
7912 \pgfcirc@style@to@style{Zener diode}{zD}
7913 \pgfcirc@style@to@style{\pgfcircdiodestylemacro ZZener diode}{ZZener diode}
7914 \pgfcirc@style@to@style{ZZener diode}{zzD}
7915 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Schottky diode}{Schottky diode}
7916 \pgfcirc@style@to@style{Schottky diode}{sD}
7917 \pgfcirc@style@to@style{\pgfcircdiodestylemacro tunnel diode}{tunnel diode}
7918 \pgfcirc@style@to@style{tunnel diode}{tD}
7919 \pgfcirc@style@to@style{\pgfcircdiodestylemacro led}{led}
7920 \pgfcirc@style@to@style{led}{leD}
7921 \pgfcirc@style@to@style{\pgfcircdiodestylemacro photodiode}{photodiode}
7922 \pgfcirc@style@to@style{photodiode}{pD}
7923
7924 \pgfcirc@style@to@style{\pgfcircdiodestylemacro laser diode}{laser diode}
7925 \pgfcirc@style@to@style{laser diode}{lasD}
7926
7927 \pgfcirc@style@to@style{\pgfcircdiodestylemacro varcap}{varcap}
7928 \pgfcirc@style@to@style{varcap}{VC}
7929 \pgfcirc@style@to@style{\pgfcircdiodestylemacro bidirectionaldiode}{bidirectionaldiode}
7930 \pgfcirc@style@to@style{bidirectionaldiode}{biD}
7931 \pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor}
7932 \pgfcirc@style@to@style{thyristor}{Ty}
7933 \pgfcirc@style@to@style{\pgfcircdiodestylemacro put}{put}
7934 \pgfcirc@style@to@style{put}{PUT}
7935 \pgfcirc@style@to@style{\pgfcircdiodestylemacro gto}{gto}
7936 \pgfcirc@style@to@style{gto}{GTO}
7937 \pgfcirc@style@to@style{\pgfcircdiodestylemacro gtobar}{gtobar}
7938 \pgfcirc@style@to@style{gtobar}{GTOb}
7939 \pgfcirc@style@to@style{\pgfcircdiodestylemacro agtobar}{agtobar}
7940 \pgfcirc@style@to@style{agtobar}{aGTOb}
7941 \pgfcirc@style@to@style{\pgfcircdiodestylemacro triac}{triac}
7942 \pgfcirc@style@to@style{triac}{Tr}
7943 % %>>>
7944
7945 %%%%%%%%%%%%%
7946 %% switches and buttons
7947 %%%%%%%%%%%%%
7948
7949 %% Definitions for switches%<<<1
7950
7951 \ctikzset{bipoles/spst/height/.initial=.35}
7952 \ctikzset{bipoles/spst/width/.initial=.35}
7953 \ctikzset{bipoles/spst/depth/.initial=.2}
7954 \ctikzset{bipoles/nos/height/.initial=.3}
7955 \ctikzset{bipoles/nos/width/.initial=.35}
7956 \ctikzset{bipoles/nos/depth/.initial=.2}
7957 \ctikzset{bipoles/ncs/height/.initial=.35}
7958 \ctikzset{bipoles/ncs/width/.initial=.35}
7959 \ctikzset{bipoles/ncs/depth/.initial=.2}
7960 \ctikzset{bipoles/pushbutton/height/.initial=.5}
7961 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
7962 \ctikzset{bipoles/pushbutton/width/.initial=.50}
7963 %%% reed switch
7964 \ctikzset{bipoles/reed/height/.initial=.4}
7965 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
7966 \ctikzset{bipoles/reed/depth/.initial=.4}
7967 %% Cute switches
7968 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
7969 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
7970 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
7971 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
7972 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
7973
7974 \ctikzset{tripoles/spdt/width/.initial=.85}
7975 \ctikzset{tripoles/spdt/height/.initial=.45}
7976 \ctikzset{tripoles/spdt/margin/.initial=.45}
7977
7978 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
7979 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
7980 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
7981 %%>>>
7982
7983 %% Shapes Node for bipoles switches and similar things%<<<
7984 %% (Closing) SPST
7985 \pgfcircdeclarebipolescaled{switches}
7986 {}
7987 {\ctikzvalof{bipoles/spst/depth}}
7988 {cspst}
7989 {\ctikzvalof{bipoles/spst/height}}
7990 {\ctikzvalof{bipoles/spst/width}}
7991 {
7992 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7993 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7994 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7995 \pgfusepath{draw}
7996
7997 \pgfscope
7998 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7999 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
8000 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
8001 \pgfcirc@set@arrows{switch}{}{latexslim}
8002 \pgfsetbeveljoin
8003 \pgfusepath{draw}
8004 \endpgfscope
8005 }
8006
8007 %% Opening SPST
8008 \pgfcircdeclarebipolescaled{switches}
8009 {}
8010 {\ctikzvalof{bipoles/spst/depth}}
8011 {ospst}
8012 {\ctikzvalof{bipoles/spst/height}}
8013 {\ctikzvalof{bipoles/spst/width}}
8014 {
8015
8016 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8017 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8018 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
8019 \pgfusepath{draw}
8020
8021 \pgfscope
8022 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8023 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
8024 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
8025 \pgfcirc@set@arrows{switch}{}{latexslim}
8026 \pgfsetbeveljoin
8027 \pgfusepath{draw}
8028 \endpgfscope
8029 }
8030
8031 %% Normal open Switch
8032 \pgfcircdeclarebipolescaled{switches}
8033 {}
8034 {\ctikzvalof{bipoles/nos/depth}}
8035 {nos}
8036 {\ctikzvalof{bipoles/nos/height}}
8037 {\ctikzvalof{bipoles/nos/width}}
8038 {
8039
8040 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8041 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8042 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
8043 \pgfsetbuttcap
8044 \pgfusepath{draw}
8045 }
8046
8047 %% Normal closed Switch
8048 \pgfcircdeclarebipolescaled{switches}
8049 {}
8050 {\ctikzvalof{bipoles/ncs/depth}}
8051 {ncs}
8052 {\ctikzvalof{bipoles/ncs/height}}
8053 {\ctikzvalof{bipoles/ncs/width}}
8054 {
8055 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8056 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8057 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
8058 \pgfusepath{draw}
8059 \pgfsetlinewidth{\pgfstartlinewidth}
8060 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8061 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
8062 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
8063 \pgfusepath{draw}
8064 }
8065
8066 %% Push Button
8067 \pgfcircdeclarebipolescaled{switches}
8068 {
8069 \anchor{tip}{\northeast\pgf@x=0pt\relax}
8070 }
8071 {\ctikzvalof{bipoles/pushbutton/height 2}}
8072 {pushbutton}
8073 {\ctikzvalof{bipoles/pushbutton/height}}
8074 {\ctikzvalof{bipoles/pushbutton/width}}
8075 {
8076 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8077 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
8078 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
8079 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
8080 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
8081 \pgfusepath{draw}
8082
8083 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8084 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8085 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8086 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8087 }
8088
8089 %% Normally closed Push Button
8090 \pgfcircdeclarebipolescaled{switches}
8091 {
8092 \anchor{tip}{\northeast\pgf@x=0pt\relax}
8093 }
8094 {\ctikzvalof{bipoles/pushbutton/height 2}}
8095 {ncpushbutton}
8096 {\ctikzvalof{bipoles/pushbutton/height}}
8097 {\ctikzvalof{bipoles/pushbutton/width}}
8098 {
8099 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8100 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8101 % Warning, if the nodes will have a class, we have to touch this.
8102 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8103 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
8104 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
8105 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
8106 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
8107 \pgfusepath{draw}
8108 %
8109 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8110 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8111 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8112 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8113 }
8114 %% Push Button (normally closed but now open :-) see
8115 %% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299
8116 \pgfcircdeclarebipolescaled{switches}
8117 {
8118 \anchor{tip}{
8119 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8120 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
8121 \pgf@x=0pt\relax
8122 }
8123 }
8124 {\ctikzvalof{bipoles/pushbutton/height 2}}
8125 {pushbuttonc}
8126 {\ctikzvalof{bipoles/pushbutton/height}}
8127 {\ctikzvalof{bipoles/pushbutton/width}}
8128 {
8129 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8130 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8131 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
8132 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}
8133 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}}
8134 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
8135 \pgfusepath{draw}
8136
8137 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8138 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8139 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8140 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8141 }
8142
8143 %% Normally closed Push Button now open
8144 \pgfcircdeclarebipolescaled{switches}
8145 {
8146 \anchor{tip}{
8147 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8148 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
8149 \pgf@x=0pt\relax
8150 }
8151 }
8152 {\ctikzvalof{bipoles/pushbutton/height 2}}
8153 {ncpushbuttono}
8154 {\ctikzvalof{bipoles/pushbutton/height}}
8155 {\ctikzvalof{bipoles/pushbutton/width}}
8156 {
8157 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8158 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8159 % Warning, if the nodes will have a class, we have to touch this.
8160 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8161 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}}
8162 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}}
8163 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}}
8164 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
8165 \pgfusepath{draw}
8166 %
8167 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8168 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8169 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8170 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
8171 }
8172 %%% reed switches
8173 \pgfcircdeclarebipolescaled{switches}
8174 {}
8175 {\ctikzvalof{bipoles/reed/depth}}
8176 {reed}
8177 {\ctikzvalof{bipoles/reed/height}}
8178 {\ctikzvalof{bipoles/reed/width}}
8179 {
8180 % this is designed to be the same as a "nos".
8181 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
8182 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
8183 \pgfscope
8184 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8185 % eclosure
8186 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
8187 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
8188 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
8189 \pgfpatharc{270}{90}{\pgf@circ@res@up}
8190 \pgfpathclose
8191 \pgf@circ@draworfill
8192 % switch
8193 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
8194 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
8195 % connection lines
8196 \pgfsetbuttcap
8197 \pgfusepath{draw}
8198 \endpgfscope
8199 % connection lines
8200 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8201 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
8202 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8203 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
8204 \pgfusepath{draw}
8205 }
8206
8207 % cute switch "to" shapes help function
8208 % #1 -> name
8209 % #2 -> barposition
8210 % #3 -> arrowcode
8211 \long\def\pgfcircdeclarecutesw#1#2#3{
8212 \pgfcircdeclarebipolescaled{switches}
8213 {
8214 \savedanchor\midlever{
8215 % these values are calculated when we create the definition of the shape.
8216 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8217 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
8218 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
8219 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8220 \pgf@circ@res@down = -.5\pgf@y
8221 \pgf@circ@res@up = .5\pgf@y
8222 \pgfextracty{\pgf@circ@res@other}{#2}
8223 \pgf@x=0pt
8224 \pgf@y=.5\pgf@circ@res@other
8225 }
8226 % radius of the connector
8227 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8228 % If cnnecting nodes are scaled, we have to modify this
8229 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
8230 % shapename
8231 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
8232 % shape type
8233 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
8234 % mid of the lever, to stack switches
8235 \anchor{mid}{\midlever}
8236 \anchor{cout}{\northeast \pgf@y=0cm}
8237 \anchor{cin}{\southwest\pgf@y=0cm}
8238 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
8239 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
8240 }
8241 {\ctikzvalof{bipoles/cuteswitch/height 2}}
8242 {#1}
8243 {\ctikzvalof{bipoles/cuteswitch/height}}
8244 {\ctikzvalof{bipoles/cuteswitch/width}}{
8245 \pgfscope
8246 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8247 % If cnnecting nodes are scaled, we have to modify this
8248 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
8249 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8250 \pgfsetlinewidth{2\pgf@circ@res@temp}
8251 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8252 \pgfpathlineto{#2}
8253 \pgfsetroundcap\pgfusepath{draw}
8254 \endpgfscope
8255 \pgfscope % arrow
8256 #3
8257 \endpgfscope
8258 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8259 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
8260 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
8261 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
8262 }
8263 }
8264
8265 %% closed cute switch
8266 \pgfcircdeclarecutesw{cuteclosedswitch}
8267 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
8268 {}
8269
8270 %% open cute switch
8271 \pgfcircdeclarecutesw{cuteopenswitch}
8272 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8273 {}
8274
8275 %% closing cute switch
8276 \pgfcircdeclarecutesw{cuteclosingswitch}
8277 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8278 {
8279 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8280 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8281 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
8282 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
8283 \pgfcirc@set@arrows{switch}{}{latexslim}
8284 \pgfusepath{draw}
8285 }
8286
8287 %% opening cute switch
8288 \pgfcircdeclarecutesw{cuteopeningswitch}
8289 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
8290 {
8291 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8292 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8293 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
8294 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
8295 \pgfcirc@set@arrows{switch}{}{latexslim}
8296 \pgfusepath{draw}
8297 }
8298
8299 \pgfcircdeclarebipole{
8300 \anchor{out 1}{
8301 \northeast
8302 \pgf@y=0cm
8303 }
8304 \anchor{out 2}{
8305 \northeast
8306 \pgf@y=.8\pgf@y
8307 }
8308 }
8309 {\ctikzvalof{tripoles/toggleswitch/height 2}}
8310 {toggleswitch}
8311 {\ctikzvalof{tripoles/toggleswitch/height}}
8312 {\ctikzvalof{tripoles/toggleswitch/width}}
8313 {
8314
8315 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8316 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
8317 \pgfusepath{draw}
8318 \pgfscope
8319 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
8320 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8321 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
8322 \pgfusepath{draw}
8323 \endpgfscope
8324
8325 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8326 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
8327
8328 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
8329 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
8330 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
8331 \pgfusepath{draw}
8332
8333
8334 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
8335 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
8336 \pgfusepath{draw}
8337
8338 \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}
8339 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
8340 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
8341 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
8342 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
8343 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
8344 \pgfusepath{draw}
8345 \pgfsetdash{}{0cm}
8346 }
8347
8348 % %>>>
8349
8350 %% Shape nodes for switches (non-bipoles)%<<<
8351
8352 %%%%%%%%%%%%%
8353 %% switches
8354 %%%%%%%%%%%%%
8355
8356 % Legacy spdt
8357 \pgfdeclareshape{spdt}{
8358 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
8359 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
8360 \savedanchor\northwest{%
8361 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8362 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
8363 \pgf@y=.5\pgf@y
8364 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
8365 \pgf@x=.5\pgf@x
8366 }
8367 \anchor{left}{%
8368 \northwest
8369 \pgf@y=0pt
8370 }
8371 \anchor{in}{
8372 \northwest
8373 \pgf@y=0pt
8374 }
8375 \anchor{out 1}{
8376 \northwest
8377 \pgf@x=-\pgf@x
8378 }
8379 \anchor{out 2}{
8380 \northwest
8381 \pgf@x=-\pgf@x
8382 \pgf@y=-\pgf@y
8383 }
8384 \anchor{center}{
8385 \pgf@y=0pt
8386 \pgf@x=0pt
8387 }
8388 \anchor{east}{
8389 \northwest
8390 \pgf@y=0pt
8391 \pgf@x=-\pgf@x
8392 }
8393 \anchor{west}{
8394 \northwest
8395 \pgf@y=0pt
8396 }
8397 \anchor{south}{
8398 \northwest
8399 \pgf@x=0pt
8400 \pgf@y=-\pgf@y
8401 }
8402 \anchor{north}{
8403 \northwest
8404 \pgf@x=0pt
8405 }
8406 \anchor{south west}{
8407 \northwest
8408 \pgf@y=-\pgf@y
8409 }
8410 \anchor{north east}{
8411 \northwest
8412 \pgf@x=-\pgf@x
8413 }
8414 \anchor{north west}{
8415 \northwest
8416 }
8417 \anchor{south east}{
8418 \northwest
8419 \pgf@x=-\pgf@x
8420 \pgf@y=-\pgf@y
8421 }
8422 \backgroundpath{
8423 \pgfsetcolor{\ctikzvalof{color}}
8424
8425 \northwest
8426 \pgf@circ@res@up = \pgf@y
8427 \pgf@circ@res@down = -\pgf@y
8428 \pgf@circ@res@right = -\pgf@x
8429 \pgf@circ@res@left = \pgf@x
8430 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
8431
8432
8433 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8434 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
8435 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8436 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
8437
8438 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8439 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
8440
8441 \pgfusepath{draw}
8442
8443 \pgfscope
8444 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
8445 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
8446 \endpgfscope
8447 \pgfscope
8448 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
8449 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
8450 \endpgfscope
8451 \pgfscope
8452 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
8453 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
8454 \endpgfscope
8455
8456 \pgfscope
8457 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
8458 \pgfpathlineto{
8459 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
8460 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
8461 }
8462 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
8463 \pgfusepath{draw}
8464 \endpgfscope
8465 }
8466 }
8467
8468
8469 % cute switch "node" shapes, matching with cute "to" shapes
8470 % #1 -> name
8471 % #2 -> barposition
8472 % #3 -> arrowcode
8473 \long\def\pgfcircdeclarecutespdt#1#2#3{
8474 \pgfdeclareshape{#1}
8475 {
8476 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
8477 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
8478 \savedanchor\northwest{%
8479 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8480 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
8481 \pgf@y=.5\pgf@y
8482 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
8483 \pgf@x=.25\pgf@x
8484 }
8485 \savedanchor\midlever{
8486 % these values are calculated when we create the definition of the shape.
8487 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
8488 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
8489 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
8490 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8491 \pgf@circ@res@down = -.5\pgf@y
8492 \pgf@circ@res@up = .5\pgf@y
8493 \pgfextracty{\pgf@circ@res@other}{#2}
8494 \pgf@x=0pt
8495 \pgf@y=.5\pgf@circ@res@other
8496 }
8497 % radius of the connector
8498 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8499 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
8500 % shapename
8501 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
8502 % shape type
8503 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
8504 % mid of the lever, to stack switches
8505 \anchor{mid}{\midlever}
8506 % center anchors
8507 \anchor{cin}{ \northwest \pgf@y=0pt}
8508 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
8509 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
8510 % horizontal angles
8511 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
8512 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
8513 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
8514
8515 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
8516 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
8517 \anchor{west}{ \northwest \pgf@y=0pt }
8518 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
8519 \anchor{north}{ \northwest \pgf@x=0pt }
8520 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
8521 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
8522 \anchor{north west}{ \northwest }
8523 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
8524
8525 \backgroundpath{
8526 \pgfsetcolor{\ctikzvalof{color}}
8527 \northwest
8528 \pgf@circ@res@up = \pgf@y
8529 \pgf@circ@res@down = -\pgf@y
8530 \pgf@circ@res@right = -\pgf@x
8531 \pgf@circ@res@left = \pgf@x
8532
8533 \pgfscope
8534 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
8535 \pgf@circ@res@temp=\radius\relax
8536 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
8537 \pgfsetlinewidth{2\pgf@circ@res@temp}
8538 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8539 \pgfpathlineto{#2}
8540 \pgfsetroundcap\pgfusepath{draw}
8541 \endpgfscope
8542 \pgfscope % arrow
8543 #3
8544 \endpgfscope
8545 % terminals
8546 \pgfscope
8547 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8548 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
8549 \endpgfscope
8550 \pgfscope
8551 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8552 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
8553 \endpgfscope
8554 \pgfscope
8555 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8556 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
8557 \endpgfscope
8558
8559 }
8560 }
8561 }
8562
8563 \pgfcircdeclarecutespdt{cute spdt up}
8564 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
8565 {}
8566
8567 \pgfcircdeclarecutespdt{cute spdt mid}
8568 {\pgfpoint{\pgf@circ@res@right}{0pt}}
8569 {}
8570
8571 \pgfcircdeclarecutespdt{cute spdt down}
8572 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
8573 {}
8574
8575 \pgfcircdeclarecutespdt{cute spdt up arrow}
8576 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
8577 {
8578 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8579 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8580 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
8581 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
8582 \pgfcirc@set@arrows{switch}{}{latexslim}
8583 \pgfusepath{draw}
8584 }
8585
8586 \pgfcircdeclarecutespdt{cute spdt mid arrow}
8587 {\pgfpoint{\pgf@circ@res@right}{0pt}}
8588 {
8589 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8590 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8591 \pgfcirc@set@arrows{switch}{latexslim}{latexslim}
8592 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
8593 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
8594 \pgfusepath{draw}
8595 }
8596
8597 \pgfcircdeclarecutespdt{cute spdt down arrow}
8598 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
8599 {
8600 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8601 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
8602 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
8603 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
8604 \pgfcirc@set@arrows{switch}{}{latexslim}
8605 \pgfusepath{draw}
8606 }
8607 % %>>>
8608
8609 %% Paths Switches and buttons%<<<
8610
8611 \pgfcirc@activate@bipole{l}{cspst}{cspst}{closing switch}
8612 \pgfcirc@style@to@style{closing switch}{switch}
8613 \pgfcirc@style@to@style{closing switch}{cspst}
8614 \pgfcirc@style@to@style{switch}{spst}
8615 \pgfcirc@activate@bipole{l}{ospst}{ospst}{opening switch}
8616 \pgfcirc@style@to@style{opening switch}{ospst}
8617
8618 \pgfcirc@activate@bipole@simple{l}{nos}
8619 \pgfcirc@style@to@style{nos}{normal open switch}
8620 \pgfcirc@activate@bipole@simple{l}{ncs}
8621 \pgfcirc@style@to@style{ncs}{normal closed switch}
8622
8623 \pgfcirc@activate@bipole{l}{pushbutton}{pushbutton}{push button}
8624 \pgfcirc@style@to@style{push button}{nopb}
8625 \pgfcirc@style@to@style{push button}{normally open push button}
8626 \pgfcirc@activate@bipole{l}{ncpushbutton}{ncpushbutton}{ncpb}
8627 \pgfcirc@style@to@style{ncpb}{normally closed push button}
8628 \pgfcirc@activate@bipole{l}{pushbuttonc}{pushbuttonc}{nopbc}
8629 \pgfcirc@style@to@style{nopbc}{normally open push button closed}
8630 \pgfcirc@activate@bipole{l}{ncpushbuttono}{ncpushbuttono}{ncpbo}
8631 \pgfcirc@style@to@style{ncpbo}{normally closed push button open}
8632
8633 \pgfcirc@activate@bipole{l}{toggleswitch}{toggleswitch}{toggle switch}
8634 \pgfcirc@activate@bipole@simple{l}{reed}
8635
8636 \pgfcirc@activate@bipole{l}{cuteclosedswitch}{cuteclosedswitch}{cute closed switch}
8637 \pgfcirc@style@to@style{cute closed switch}{ccsw}
8638 \pgfcirc@activate@bipole{l}{cuteopenswitch}{cuteopenswitch}{cute open switch}
8639 \pgfcirc@style@to@style{cute open switch}{cosw}
8640 \pgfcirc@activate@bipole{l}{cuteclosingswitch}{cuteclosingswitch}{cute closing switch}
8641 \pgfcirc@style@to@style{cute closing switch}{ccgsw}
8642 \pgfcirc@activate@bipole{l}{cuteopeningswitch}{cuteopeningswitch}{cute opening switch}
8643 \pgfcirc@style@to@style{cute opening switch}{cogsw}% %>>>
8644
8645 %%%%%%%%%%%%%%%%%
8646 %% Instruments
8647 %%%%%%%%%%%%%%%%%
8648
8649 %% Definitions for Instruments %<<<1
8650 \ctikzset{bipoles/ammeter/height/.initial=.60}
8651 \ctikzset{bipoles/ammeter/width/.initial=.60}
8652 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
8653 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
8654 \ctikzset{bipoles/voltmeter/height/.initial=.60}
8655 \ctikzset{bipoles/voltmeter/width/.initial=.60}
8656 \ctikzset{bipoles/smeter/height/.initial=.60}
8657 \ctikzset{bipoles/smeter/width/.initial=.60}
8658 \ctikzset{bipoles/smeter/voltage/additional shift/.initial=1}
8659 \ctikzset{bipoles/qmeter/depth/.initial=.40}
8660 \ctikzset{bipoles/qmeter/height/.initial=.80}
8661 \ctikzset{bipoles/qmeter/width/.initial=.60}
8662 % this must be specified for each one
8663 \ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5}
8664 \ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5}
8665 \ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5}
8666 \ctikzset{bipoles/iloop/width/.initial=.40}
8667 \ctikzset{bipoles/iloop/height/.initial=.60}
8668
8669 \ctikzset{bipoles/oscope/height/.initial=.60}
8670 \ctikzset{bipoles/oscope/width/.initial=.60}
8671 \ctikzset{bipoles/oscope/voltage/additional shift/.initial=1}
8672
8673
8674 % option to not rotate the new (Romano's) instruments
8675 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
8676 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
8677 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
8678 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
8679 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
8680 %%>>>
8681
8682 %% Node shapes for instruments%<<<
8683
8684 % % METERINGSHAPE
8685 \long\def\drawmeteringcircle{
8686 \def\pgf@circ@temp{right}
8687 \ifx\tikz@res@label@pos\pgf@circ@temp
8688 \pgf@circ@res@step=-1.2\pgf@circ@res@up
8689 \else
8690 \def\pgf@circ@temp{below}
8691 \ifx\tikz@res@label@pos\pgf@circ@temp
8692 \pgf@circ@res@step=-1.2\pgf@circ@res@up
8693 \else
8694 \pgf@circ@res@step=1.2\pgf@circ@res@up
8695 \fi
8696 \fi
8697 %draw connections to circle
8698 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8699 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
8700 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
8701 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
8702 \pgfusepath{draw}
8703 %draw circle
8704 \pgfscope
8705 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8706 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
8707 \pgf@circ@draworfill
8708 \endpgfscope
8709 %draw arrow
8710 \pgfscope
8711 \pgfsetarrowsend{latex}
8712 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8713 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
8714 \pgfusepath{draw}
8715 \endpgfscope
8716 }
8717
8718 %AMPEREMETER
8719 \pgfcircdeclarebipolescaled{instruments}
8720 {}
8721 {\ctikzvalof{bipoles/ammeter/height}}
8722 {ammeter}
8723 {\ctikzvalof{bipoles/ammeter/height}}
8724 {\ctikzvalof{bipoles/ammeter/width}}
8725 {
8726 \drawmeteringcircle
8727 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
8728 }
8729 %OHMMETER
8730 \pgfcircdeclarebipolescaled{instruments}
8731 {}
8732 {\ctikzvalof{bipoles/ohmmeter/height}}
8733 {ohmmeter}
8734 {\ctikzvalof{bipoles/ohmmeter/height}}
8735 {\ctikzvalof{bipoles/ohmmeter/width}}
8736 {
8737 \drawmeteringcircle
8738 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
8739 }
8740 %VOLTMETER
8741 \pgfcircdeclarebipolescaled{instruments}
8742 {}
8743 {\ctikzvalof{bipoles/voltmeter/height}}
8744 {voltmeter}
8745 {\ctikzvalof{bipoles/voltmeter/height}}
8746 {\ctikzvalof{bipoles/voltmeter/width}}
8747 {
8748 \drawmeteringcircle
8749 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
8750
8751 }
8752
8753 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
8754 %
8755 % oscilloscope waveforms
8756
8757 \ctikzset{%
8758 bipoles/oscope/waveform/sin/.code={%
8759 \pgfpathmoveto{\pgfpoint{-0.6cm}{0cm}}
8760 \pgfpathsine{\pgfpoint{0.3cm}{0.4cm}}
8761 \pgfpathcosine{\pgfpoint{0.3cm}{-0.4cm}}
8762 \pgfpathsine{\pgfpoint{0.3cm}{-0.4cm}}
8763 \pgfpathcosine{\pgfpoint{0.3cm}{0.4cm}}
8764 \pgfusepath{draw}
8765 },
8766 bipoles/oscope/waveform/ramps/.code={%
8767 \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}}
8768 \pgfpathlineto{\pgfpoint{-0.05cm}{0.25cm}}
8769 \pgfpathlineto{\pgfpoint{-0.05cm}{-0.25cm}}
8770 \pgfpathlineto{\pgfpoint{0.65cm}{0.25cm}}
8771 \pgfpathlineto{\pgfpoint{0.65cm}{-0.25cm}}
8772 \pgfusepath{draw}
8773 },
8774 bipoles/oscope/waveform/square/.code={%
8775 \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}}
8776 \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}}
8777 \pgfpathlineto{\pgfpoint{-0.6cm}{0.25cm}}
8778 \pgfpathlineto{\pgfpoint{0cm}{0.25cm}}
8779 \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}}
8780 \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}}
8781 \pgfpathlineto{\pgfpoint{0.6cm}{0.25cm}}
8782 \pgfpathlineto{\pgfpoint{0.75cm}{0.25cm}}
8783 \pgfusepath{draw}
8784 },
8785 bipoles/oscope/waveform/triangle/.code={%
8786 \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}}
8787 \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}}
8788 \pgfpathlineto{\pgfpoint{-0.3cm}{0.25cm}}
8789 \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}}
8790 \pgfpathlineto{\pgfpoint{0.3cm}{0.25cm}}
8791 \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}}
8792 \pgfpathlineto{\pgfpoint{0.75cm}{0cm}}
8793 \pgfusepath{draw}
8794 },
8795 bipoles/oscope/waveform/zero/.code={
8796 \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}}
8797 \pgfpathlineto{\pgfpoint{0.75cm}{0cm}}
8798 \pgfusepath{draw}
8799 },%
8800 bipoles/oscope/waveform/lissajous/.code={%
8801 \pgfpathellipse{\pgfpoint{0cm}{0cm}}
8802 {\pgfpoint{0.5cm}{0.35cm}}{\pgfpoint{-0.3cm}{0.2cm}}
8803 \pgfusepath{draw}
8804 },
8805 bipoles/oscope/waveform/none/.code={},%
8806 }
8807 % default waveform (backward compatible)
8808 \ctikzset{bipoles/oscope/waveform/.initial=ramps}
8809
8810 \pgfcircdeclarebipolescaled{instruments}
8811 {
8812 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
8813 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
8814 % put the node text above and centered
8815 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
8816 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
8817 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8818 }
8819 }
8820 }
8821 {\ctikzvalof{bipoles/oscope/height}}
8822 {oscope}
8823 {\ctikzvalof{bipoles/oscope/height}}
8824 {\ctikzvalof{bipoles/oscope/width}}
8825 {
8826 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8827 \pgfextracty{\pgf@circ@res@up}{\northeast}
8828 \pgfextractx{\pgf@circ@res@right}{\northeast}
8829 \pgfextractx{\pgf@circ@res@left}{\southwest}
8830 \pgfextracty{\pgf@circ@res@down}{\southwest}
8831 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
8832 \pgfscope
8833 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
8834 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8835 \pgf@circ@draworfill
8836 \endpgfscope
8837 % get the rotation
8838 \ifpgf@circuit@straightinstruments
8839 \pgfgettransformentries\a\b\temp\temp\temp\temp
8840 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8841 \else
8842 \edef\rot{0}
8843 \fi
8844 % and unrotate the scope
8845 \pgfscope
8846 \pgftransformrotate{\rot}
8847 % grid
8848 \pgfscope
8849 \pgfsetlinewidth{0.5\pgfstartlinewidth}
8850 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
8851 % the "almost one" make the grid complete most of the time --- beware of antialiasing
8852 \pgfpathgrid[stepx=0.995\pgf@circ@res@step, stepy=0.995\pgf@circ@res@step]%
8853 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
8854 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
8855 \pgfsetstrokeopacity{0.5}
8856 \pgfusepath{draw}
8857 \endpgfscope
8858 % function displayed
8859 \pgfscope
8860 \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm}
8861 \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm}
8862 \pgftransformxscale{\@@scalex}
8863 \pgftransformyscale{\@@scaley}
8864 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8865 \pgfkeys{\circuitikzbasekey/bipoles/oscope/waveform/\ctikzvalof{bipoles/oscope/waveform}}
8866 \endpgfscope
8867 \endpgfscope
8868 }
8869 % generic round meter with always horizontal text, no arrow
8870 \pgfcircdeclarebipolescaled{instruments}
8871 {}
8872 {\ctikzvalof{bipoles/esource/height}}
8873 {rmeter}
8874 {\ctikzvalof{bipoles/esource/height}}
8875 {\ctikzvalof{bipoles/esource/width}}
8876 {
8877 \pgfpointorigin
8878 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8879 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8880 \pgf@circ@draworfill
8881 % draw the text label
8882 % get the rotation
8883 \ifpgf@circuit@straightinstruments
8884 \pgfgettransformentries\a\b\temp\temp\temp\temp
8885 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8886 \else
8887 \edef\rot{0}
8888 \fi
8889 % and unrotate the scope
8890 \pgfscope
8891 \pgfsetcolor{\ctikzvalof{color}}
8892 \pgftransformrotate{\rot}
8893 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
8894 \endpgfscope
8895 }
8896
8897 % generic round meter with always horizontal text, with arrow
8898 \pgfcircdeclarebipolescaled{instruments}
8899 {}
8900 {\ctikzvalof{bipoles/esource/height}}
8901 {rmeterwa}
8902 {\ctikzvalof{bipoles/esource/height}}
8903 {\ctikzvalof{bipoles/esource/width}}
8904 {
8905 \pgfpointorigin
8906 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8907 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8908 \pgf@circ@draworfill
8909 % draw the text label
8910 % get the rotation
8911 \ifpgf@circuit@straightinstruments
8912 \pgfgettransformentries\a\b\temp\temp\temp\temp
8913 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8914 \else
8915 \edef\rot{0}
8916 \fi
8917 % and unrotate the scope
8918 \pgfscope
8919 \pgftransformrotate{\rot}
8920 \pgfsetcolor{\ctikzvalof{color}}
8921 \pgfsetlinewidth{\pgfstartlinewidth}
8922 % arrow: create a center hole to have better visual
8923 \pgfscope
8924 % clipping path: first a rectangle bigger then the shape
8925 % to avoid problems with the line thickness
8926 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8927 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8928 % next open a circle into it
8929 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
8930 % do the difference and clip before drawing
8931 \pgfseteorule
8932 \pgfusepath{clip}
8933 \pgfsetarrowsend{latexslim}
8934 % the arrow is better if it has a bit of breath and it's not 45º
8935 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
8936 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
8937 \pgfusepath{draw}
8938 \endpgfscope
8939 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
8940 \endpgfscope
8941 }
8942
8943 % generic square meter with always horizontal text
8944 \pgfcircdeclarebipolescaled{instruments}
8945 {
8946 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
8947 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
8948 % put the node text above and centered
8949 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
8950 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
8951 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8952 }
8953 }
8954 }
8955 {\ctikzvalof{bipoles/smeter/height}}
8956 {smeter}
8957 {\ctikzvalof{bipoles/smeter/height}}
8958 {\ctikzvalof{bipoles/smeter/width}}
8959 {
8960 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8961 \pgfextracty{\pgf@circ@res@up}{\northeast}
8962 \pgfextractx{\pgf@circ@res@right}{\northeast}
8963 \pgfextractx{\pgf@circ@res@left}{\southwest}
8964 \pgfextracty{\pgf@circ@res@down}{\southwest}
8965 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
8966 \pgfscope
8967 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
8968 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8969 \pgf@circ@draworfill
8970 \endpgfscope
8971 % get the rotation
8972 \ifpgf@circuit@straightinstruments
8973 \pgfgettransformentries\a\b\temp\temp\temp\temp
8974 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
8975 \else
8976 \edef\rot{0}
8977 \fi
8978 % and unrotate the scope
8979 \pgfscope
8980 \pgftransformrotate{\rot}
8981 % the metering window
8982 \pgfscope
8983 \def\@starta{105}\def\@stopa{75}
8984 \pgfsetlinewidth{\pgfstartlinewidth}
8985 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
8986 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
8987 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
8988 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
8989 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
8990 \pgfclosepath
8991 \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}}
8992 \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}}
8993 \pgfusepath{draw}
8994 \endpgfscope
8995 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
8996 \endpgfscope
8997 }
8998
8999 % probes qucs style:
9000 % #1 : name
9001 % #2 : extra code
9002 \long\def\pgfcirc@qucsprobe#1#2{
9003 \pgfcircdeclarebipolescaled{instruments}
9004 {
9005 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
9006 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
9007 % put the node text above and centered
9008 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
9009 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
9010 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
9011 }
9012 }
9013 }
9014 {\ctikzvalof{bipoles/qmeter/depth}}
9015 {#1}
9016 {\ctikzvalof{bipoles/qmeter/height}}
9017 {\ctikzvalof{bipoles/qmeter/width}}
9018 {
9019 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9020 \pgfextracty{\pgf@circ@res@up}{\northeast}
9021 \pgfextractx{\pgf@circ@res@right}{\northeast}
9022 \pgfextractx{\pgf@circ@res@left}{\southwest}
9023 \pgfextracty{\pgf@circ@res@down}{\southwest}
9024 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
9025 \pgfscope
9026 \pgfscope
9027 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
9028 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9029 \pgf@circ@draworfill
9030 \endpgfscope
9031 \def\@starta{103}\def\@stopa{77}
9032 \pgfsetlinewidth{\pgfstartlinewidth}
9033 \pgfscope
9034 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
9035 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
9036 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
9037 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
9038 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
9039 \pgfclosepath
9040 \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}}
9041 \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}}
9042 \pgfusepath{draw}
9043 \pgf@circ@draworfill
9044 \endpgfscope
9045 #2
9046 \endpgfscope
9047 }
9048 }
9049
9050 \pgfcirc@qucsprobe{qiprobe}{
9051 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9052 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9053 \pgfusepath{draw}
9054 \pgfnode{currarrow}{center}{}{}{}
9055 }
9056
9057 \pgfcirc@qucsprobe{qvprobe}{
9058 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
9059 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9060 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
9061 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
9062 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
9063 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9064 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
9065 \pgfusepath{draw}
9066 \pgfscope
9067 % "+" and "-", drawn so that they scale correctly
9068 \pgfsetlinewidth{2\pgfstartlinewidth}
9069 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
9070 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
9071 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
9072 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
9073 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
9074 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
9075 \pgfusepath{draw}
9076 \endpgfscope
9077 }
9078
9079 \pgfcirc@qucsprobe{qpprobe}{
9080 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9081 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9082 \pgfusepath{draw}
9083 \pgfnode{currarrow}{center}{}{}{}
9084 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
9085 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
9086 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
9087 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
9088 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
9089 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
9090 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
9091 \pgfusepath{draw}
9092 \pgfscope
9093 % "+" and "-", drawn so that they scale correctly
9094 \pgfsetlinewidth{2\pgfstartlinewidth}
9095 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
9096 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
9097 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
9098 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
9099 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
9100 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
9101 \pgfusepath{draw}
9102 \endpgfscope
9103 }
9104
9105 % current loop for oscope and similar: stylized
9106 \pgfcircdeclarebipolescaled{instruments}
9107 {
9108 \anchor{i}{\northeast\pgf@x=0pt\relax}
9109 \anchor{text}{
9110 \pgfextracty{\pgf@circ@res@up}{\northeast}
9111 \pgfextractx{\pgf@circ@res@left}{\northeast}
9112 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
9113 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
9114 }
9115 }
9116 }
9117 {\ctikzvalof{bipoles/iloop/height}}
9118 {iloop}
9119 {\ctikzvalof{bipoles/iloop/height}}
9120 {\ctikzvalof{bipoles/iloop/width}}
9121 {
9122 \pgfextracty{\pgf@circ@res@up}{\northeast}
9123 \pgfextractx{\pgf@circ@res@right}{\northeast}
9124 \pgf@circ@res@down=-\pgf@circ@res@up
9125 \pgf@circ@res@left=-\pgf@circ@res@right
9126 \pgfscope
9127 \pgfstartlinewidth=\pgflinewidth
9128 \pgfsetcolor{\ctikzvalof{color}}
9129 % external ellipse
9130 \pgfscope
9131 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9132 % clipping path: first a rectangle bigger then the shape
9133 % to avoid problems with the line thickness
9134 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
9135 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
9136 % next the opening to the left
9137 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
9138 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
9139 % do the difference and clip before drawing
9140 \pgfseteorule
9141 \pgfusepath{clip}
9142 \pgfpathellipse{\pgfpointorigin}{
9143 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
9144 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
9145 \pgfusepath{draw}
9146 \endpgfscope
9147 % internal wire
9148 \pgfsetlinewidth{\pgfstartlinewidth}
9149 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9150 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
9151 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
9152 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9153 % and the contact line up
9154 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
9155 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
9156 \pgfusepath{draw}
9157 \endpgfscope
9158 }
9159
9160 % current loop for oscope and similar: real (double connection)
9161 \pgfcircdeclarebipolescaled{instruments}
9162 {
9163 \anchor{i+}{
9164 \pgfextracty{\pgf@circ@res@up}{\northeast}
9165 \pgfextractx{\pgf@circ@res@right}{\northeast}
9166 \pgf@circ@res@step=0.4\pgf@circ@res@right
9167 \pgf@circ@res@other=0.8\pgf@circ@res@up
9168 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
9169 \pgf@y=\pgf@circ@res@up
9170 }
9171 \anchor{i-}{
9172 \pgfextracty{\pgf@circ@res@up}{\northeast}
9173 \pgfextractx{\pgf@circ@res@right}{\northeast}
9174 \pgf@circ@res@step=0.4\pgf@circ@res@right
9175 \pgf@circ@res@other=0.8\pgf@circ@res@up
9176 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
9177 \pgf@y=\pgf@circ@res@up
9178 }
9179 \anchor{text}{
9180 \pgfextracty{\pgf@circ@res@up}{\northeast}
9181 \pgfextractx{\pgf@circ@res@left}{\northeast}
9182 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
9183 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
9184 }
9185 }
9186 }
9187 {\ctikzvalof{bipoles/iloop/height}}
9188 {iloop2}
9189 {\ctikzvalof{bipoles/iloop/height}}
9190 {\ctikzvalof{bipoles/iloop/width}}
9191 {
9192 \pgfextracty{\pgf@circ@res@up}{\northeast}
9193 \pgfextractx{\pgf@circ@res@right}{\northeast}
9194 \pgf@circ@res@down=-\pgf@circ@res@up
9195 \pgf@circ@res@left=-\pgf@circ@res@right
9196 % must be the same than internal i+ and i- anchors definition
9197 \pgf@circ@res@step=0.4\pgf@circ@res@right
9198 \pgf@circ@res@other=0.8\pgf@circ@res@up
9199 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
9200 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
9201 \pgfscope
9202 \pgfstartlinewidth=\pgflinewidth
9203 \pgfsetcolor{\ctikzvalof{color}}
9204 % external ellipse
9205 \pgfscope
9206 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
9207 % clipping path: first a rectangle bigger then the shape
9208 % to avoid problems with the line thickness
9209 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
9210 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
9211 % next the opening to the left
9212 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
9213 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
9214 % do the difference and clip before drawing
9215 \pgfseteorule
9216 \pgfusepath{clip}
9217 \pgfpathmoveto{\@plus}
9218 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
9219 \pgfusepath{draw}
9220 \endpgfscope
9221 % internal wire
9222 \pgfsetlinewidth{\pgfstartlinewidth}
9223 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9224 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
9225 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
9226 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9227 % and the contact line up
9228 % I use ...left and ---right as temporal lengths here to avoid defining more
9229 \pgfextractx{\pgf@circ@res@left}{\@plus}
9230 \pgfextractx{\pgf@circ@res@right}{\@minus}
9231 \pgfpathmoveto{\@plus}
9232 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9233 \pgfpathmoveto{\@minus}
9234 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9235 \pgfusepath{draw}
9236 \endpgfscope
9237 }
9238 % %>>>
9239
9240 % Path definitions for Instruments%<<<
9241
9242 \pgfcirc@activate@bipole@simple{l}{ammeter}
9243 \pgfcirc@activate@bipole@simple{l}{ohmmeter}
9244 \pgfcirc@activate@bipole@simple{l}{voltmeter}
9245 \pgfcirc@activate@bipole@simple{l}{oscope}
9246 \pgfcirc@activate@bipole@simple{l}{rmeter}
9247 \pgfcirc@activate@bipole@simple{l}{rmeterwa}
9248 \pgfcirc@activate@bipole@simple{l}{smeter}
9249 \pgfcirc@activate@bipole@simple{l}{iloop}
9250 % \pgfcirc@activate@bipole@simple{l}{iloop2} that was wrong
9251 \pgfcirc@activate@bipole{l}{ilooptwo}{iloop2}{iloop2}
9252 \pgfcirc@activate@bipole@simple{l}{qvprobe}
9253 \pgfcirc@activate@bipole@simple{l}{qiprobe}
9254 \pgfcirc@activate@bipole@simple{l}{qpprobe}
9255 % %>>>
9256
9257 %%%%%%%%%%%%%%%%%%%%%%%
9258 %% MECHANICAL SYMBOLS
9259 %%%%%%%%%%%%%%%%%%%%%%%
9260
9261 %% Settings for Mechanical section%<<<1
9262 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
9263 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
9264 \ctikzset{bipoles/spring/height/.initial=.5}
9265 \ctikzset{bipoles/spring/width/.initial=.5}
9266 \ctikzset{bipoles/inerter/height/.initial=.7}
9267 \ctikzset{bipoles/inerter/width/.initial=.175}
9268 \ctikzset{bipoles/mass/height/.initial=.55}
9269 \ctikzset{bipoles/mass/box height/.initial=.4}
9270 \ctikzset{bipoles/mass/width/.initial=.5}
9271
9272 \ctikzset{bipoles/damper/height/.initial=.35}
9273 \ctikzset{bipoles/damper/length/.initial=.3}
9274 \ctikzset{bipoles/damper/width/.initial=.4}
9275 %%>>>
9276
9277 %% Node shapes Mechanical analog system%<<<
9278 %% mechanical capacitance - stiffness/spring
9279
9280 \pgfcircdeclarebipolescaled{mechanicals}
9281 {}
9282 {\ctikzvalof{bipoles/spring/height}}
9283 {spring}
9284 {\ctikzvalof{bipoles/spring/height}}
9285 {\ctikzvalof{bipoles/spring/width}}{
9286 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9287 \pgftransformationadjustments
9288
9289 \pgfmathsetlength{\pgf@circ@res@step}
9290 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
9291
9292 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
9293 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
9294 \pgf@circ@res@other = \pgf@circ@res@left
9295 \advance\pgf@circ@res@other by \pgf@circ@res@step
9296 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9297 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9298 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9299 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9300 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9301 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9302 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9303 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9304 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9305 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9306 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9307 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9308 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9309 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9310 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9311 \advance\pgf@circ@res@other by \pgf@circ@res@step
9312 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
9313 \pgfsetbuttcap
9314 \pgfsetbeveljoin
9315 \pgfusepath{stroke}
9316 }
9317
9318 %% mechanical capacitance - inerter
9319 \pgfcircdeclarebipolescaled{mechanicals}
9320 {}
9321 {\ctikzvalof{bipoles/inerter/height}}
9322 {inerter}
9323 {\ctikzvalof{bipoles/inerter/height}}
9324 {\ctikzvalof{bipoles/inerter/width}}
9325 {
9326 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9327 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9328 \pgf@circ@draworfill
9329 }
9330
9331
9332 %% mechanical inductance - mass
9333 \pgfcircdeclarebipolescaled{mechanicals}
9334 {}
9335 {\ctikzvalof{bipoles/mass/box height}}
9336 {mass}
9337 {\ctikzvalof{bipoles/mass/height}}
9338 {\ctikzvalof{bipoles/mass/width}}
9339 {
9340 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9341 \pgftransformationadjustments
9342 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9343 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
9344 \pgf@circ@draworfill
9345
9346 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9347 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9348 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9349 \pgfsetrectcap
9350 \pgfsetmiterjoin
9351 \pgfusepath{stroke}
9352 }
9353
9354 %% mechanical resistor - damper
9355 \pgfcircdeclarebipolescaled{mechanicals}
9356 {}
9357 {\ctikzvalof{bipoles/damper/height}}
9358 {damper}
9359 {\ctikzvalof{bipoles/damper/height}}
9360 {\ctikzvalof{bipoles/damper/width}}
9361 {
9362 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9363 \pgf@circ@maybefill
9364
9365 % line into the damper
9366 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9367 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9368 {\pgf@circ@res@zero}}
9369 \pgfusepath{stroke}
9370
9371 % damper box
9372 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9373 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9374 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9375 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9376 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9377
9378 \pgfsetrectcap
9379 \pgfsetmiterjoin
9380 \pgfusepath{stroke}
9381
9382 % damper vertical element
9383 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9384 {.8\pgf@circ@res@down}}
9385 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9386 {.8\pgf@circ@res@up}}
9387 \pgfsetbuttcap
9388 \pgfusepath{stroke}
9389
9390 }
9391 %% mechanical viscoelastic element, suggested by @alex
9392 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
9393 \pgfcircdeclarebipolescaled{mechanicals}
9394 {} % extra anchors
9395 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
9396 {viscoe} % name
9397 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
9398 {\ctikzvalof{bipoles/damper/width}} % width
9399 { % draw the bipole
9400 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9401 \pgf@circ@maybefill
9402
9403 % spring into the damper
9404 \pgfscope
9405 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9406 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9407 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
9408 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
9409 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
9410 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
9411 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
9412 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
9413 \pgfusepath{stroke}
9414 \endpgfscope
9415 % damper box
9416 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9417 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9418 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9419 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9420 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9421
9422 \pgfsetrectcap
9423 \pgfsetmiterjoin
9424 \pgfusepath{stroke}
9425
9426 % damper vertical element
9427 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9428 {.8\pgf@circ@res@down}}
9429 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9430 {.8\pgf@circ@res@up}}
9431 \pgfsetbuttcap
9432 \pgfusepath{stroke}
9433
9434 }
9435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9436 %% electromechanical device (motor/generator)
9437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9438
9439 \pgfdeclareshape{elmech}
9440 {
9441 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
9442 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
9443 \savedanchor\northwest{
9444 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9445 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
9446 \pgf@y=.5\pgf@y
9447 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
9448 \pgf@x=.5\pgf@x
9449 }
9450 \anchor{center}{
9451 \pgfpointorigin
9452 }
9453 \anchor{text}{
9454 \pgfpointorigin
9455 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
9456 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
9457 }
9458 \anchor{left}{%
9459 \northwest
9460 \pgf@y=0pt
9461 }
9462 \anchor{right}{%
9463 \northwest
9464 \pgf@y=0pt
9465 \pgf@x=-\pgf@x
9466 }
9467 \anchor{top}{
9468 \northwest
9469 \pgf@x=0pt
9470 }
9471 \anchor{pathstart}{
9472 \northwest
9473 \pgf@x=0pt
9474 }
9475 \anchor{pathend}{
9476 \northwest
9477 \pgf@x=0pt
9478 \pgf@y=-\pgf@y
9479 }
9480 \anchor{bottom}{
9481 \northwest
9482 \pgf@x=0pt
9483 \pgf@y=-\pgf@y
9484 }
9485 \anchor{center}{
9486 \pgf@y=0pt
9487 \pgf@x=0pt
9488 }
9489 \anchor{east}{
9490 \northwest
9491 \pgf@y=0pt
9492 \pgf@x=-\pgf@x
9493 }
9494 \anchor{west}{
9495 \northwest
9496 \pgf@y=0pt
9497 }
9498 \anchor{south}{
9499 \northwest
9500 \pgf@x=0pt
9501 \pgf@y=-\pgf@y
9502 }
9503 \anchor{north}{
9504 \northwest
9505 \pgf@x=0pt
9506 }
9507 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
9508 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
9509 \anchor{north west}{ \northwest }
9510 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
9511 \anchorborder{%
9512 \@tempdima=\pgf@x\@tempdimb=\pgf@y
9513 \northwest\pgf@circ@res@other=-\pgf@x
9514 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
9515 }
9516 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
9517 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
9518 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
9519 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
9520 \anchor{block up right}{
9521 \northwest
9522 % remember that pgf@x is negative
9523 % center of the block is at 0.5*H+W*cos(30)/2
9524 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
9525 \pgf@x=-0.5\pgf@x
9526 }
9527 \anchor{block up left}{
9528 \northwest
9529 % remember that pgf@x is negative
9530 % center of the block is at 0.5*H+W*cos(30)/2
9531 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
9532 \pgf@x=0.5\pgf@x
9533 }
9534 \anchor{block down right}{
9535 \northwest
9536 % remember that pgf@x is negative
9537 % center of the block is at 0.5*H+W*cos(30)/2
9538 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
9539 \pgf@y=-\pgf@y
9540 \pgf@x=-0.5\pgf@x
9541 }
9542 \anchor{block down left}{
9543 \northwest
9544 % remember that pgf@x is negative
9545 % center of the block is at 0.5*H+W*cos(30)/2
9546 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
9547 \pgf@y=-\pgf@y
9548 \pgf@x=0.5\pgf@x
9549 }
9550 \behindbackgroundpath{
9551 \pgfsetcolor{\ctikzvalof{color}}
9552 \pgf@circ@scaled@Rlen=\scaledRlen
9553 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
9554 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
9555 \pgfscope
9556 \pgfstartlinewidth=\pgflinewidth
9557 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9558 \pgfscope % clip the bar: whole size minus the circle
9559 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
9560 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
9561 \pgfseteorule
9562 \pgfusepath{clip}
9563 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
9564 \pgfsetfillcolor{\ctikzvalof{color}}
9565 \pgfusepath{fill, draw}
9566 \endpgfscope
9567 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
9568 \ifx\tikz@fillcolor\pgfutil@empty
9569 % set the default fill color to white
9570 \pgfsetfillcolor{white}
9571 % ...but override it if the class is defined!
9572 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
9573 \else
9574 \pgfsetfillcolor{\tikz@fillcolor}
9575 \pgfusepath{draw, fill}
9576 \fi
9577 \endpgfscope
9578 }
9579 }
9580
9581 % %>>>
9582
9583 %% Path definitions for Mechanical%<<<
9584
9585 \pgf@circ@definetranspath{elmech}
9586 \pgfcirc@activate@bipole@simple{l}{spring}
9587 \pgfcirc@activate@bipole@simple{l}{inerter}
9588 \pgfcirc@activate@bipole@simple{l}{mass}
9589 \pgfcirc@activate@bipole@simple{l}{damper}
9590 \pgfcirc@activate@bipole@simple{l}{viscoe}
9591 % %>>>
9592
9593 %%%%%%%%%%%%%%%%%%%%%%%%%
9594 %% Miscellaneous bipoles
9595 %%%%%%%%%%%%%%%%%%%%%%%%%
9596
9597 % settings for microphone, loudspeaker, fuses and misc%<<<1
9598
9599 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
9600 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
9601 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
9602 \ctikzset{bipoles/mic/height/.initial=1.2}
9603 \ctikzset{bipoles/mic/depth/.initial=.1}
9604 \ctikzset{bipoles/mic/width/.initial=.8}%
9605
9606 % arresters, fuses, lamps, etc
9607
9608 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
9609 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
9610 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
9611 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
9612 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
9613 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
9614 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
9615 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
9616 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
9617 \ctikzset{bipoles/fuse/height/.initial=.20}
9618 \ctikzset{bipoles/fuse/width/.initial=.50}
9619 \ctikzset{bipoles/afuse/height/.initial=.20}
9620 \ctikzset{bipoles/afuse/width/.initial=.50}
9621 \ctikzset{bipoles/lamp/height/.initial=.60}
9622 \ctikzset{bipoles/lamp/width/.initial=.60}
9623 \ctikzset{bipoles/bulb/height/.initial=.8}
9624 \ctikzset{bipoles/bulb/width/.initial=.8}
9625 \ctikzset{bipoles/tline/height/.initial=.3}
9626 \ctikzset{bipoles/tline/width/.initial=.6}
9627 \ctikzset{bipoles/squid/height/.initial=.60}
9628 \ctikzset{bipoles/squid/width/.initial=.60}
9629 \ctikzset{bipoles/barrier/height/.initial=.60}
9630 \ctikzset{bipoles/barrier/width/.initial=.60}
9631 \ctikzset{bipoles/openbarrier/gap/.initial=0.5}
9632 \ctikzset{bipoles/thermocouple/height/.initial=.250}
9633 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
9634 \ctikzset{bipoles/thermocouple/width/.initial=.140}
9635 \newif\ifpgf@circuit@europeangfsurgearrester
9636 \ctikzset{gas filled surge arrester choice/.is choice}
9637 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
9638 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
9639
9640 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
9641 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
9642 %%>>>
9643
9644 %% Node shapes for miscellaneous symbols %<<<
9645 %% loudspeaker and microphone
9646
9647 \pgfcircdeclarebipolescaled{misc}
9648 {}
9649 {\ctikzvalof{bipoles/loudspeaker/depth}}
9650 {loudspeaker}
9651 {\ctikzvalof{bipoles/loudspeaker/height}}
9652 {\ctikzvalof{bipoles/loudspeaker/width}}{
9653
9654 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
9655 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9656 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
9657 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
9658 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
9659 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
9660 \pgfpathclose
9661 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9662 \pgf@circ@draworfill
9663 }
9664
9665 \pgfcircdeclarebipolescaled{misc}
9666 {}
9667 {\ctikzvalof{bipoles/mic/depth}}
9668 {mic}
9669 {\ctikzvalof{bipoles/mic/height}}
9670 {\ctikzvalof{bipoles/mic/width}}{
9671
9672 \pgfscope
9673 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9674 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
9675 \pgf@circ@draworfill
9676 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}}
9677 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
9678 \pgfusepath{draw}
9679 \endpgfscope
9680 \pgfscope
9681 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9682 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
9683 % 0.25358 is 0.6-0.4*cos(30)
9684 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
9685 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
9686 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
9687 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9688 \pgfusepath{draw}
9689
9690 \pgfusepath{draw}
9691 \endpgfscope
9692 }
9693
9694 %% european gas filled surge arrester
9695 \pgfcircdeclarebipolescaled{misc}
9696 {}
9697 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
9698 {european gas filled surge arrester}
9699 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
9700 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
9701 {
9702
9703 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9704 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9705
9706 \pgf@circ@draworfill
9707
9708 \pgfscope
9709 \pgfsetarrowsend{latexslim}
9710 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9711 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
9712 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9713 \pgfusepath{draw}
9714
9715 \endpgfscope
9716 }
9717
9718 %% american gas filled surge arrester
9719 \pgfcircdeclarebipolescaled{misc}
9720 {}
9721 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
9722 {american gas filled surge arrester}
9723 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
9724 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
9725
9726 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9727 \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up
9728 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
9729 \pgfusepath{draw}
9730
9731 \pgfscope
9732 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9733 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
9734 \pgf@circ@draworfill
9735 \endpgfscope
9736
9737 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
9738 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9739 \pgfusepath{draw}
9740
9741 \pgfscope
9742 \pgfsetarrowsend{latex}
9743
9744 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9745 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
9746 \pgfusepath{draw}
9747
9748 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9749 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
9750 \pgfusepath{draw}
9751 \endpgfscope{}
9752
9753 \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}
9754 \pgfusepath{fill}
9755 }
9756
9757 %% thermocouple
9758 \pgfcircdeclarebipolescaled{misc}
9759 {}
9760 {\ctikzvalof{bipoles/thermocouple/height 2}}
9761 {thermocouple}
9762 {\ctikzvalof{bipoles/thermocouple/height}}
9763 {\ctikzvalof{bipoles/thermocouple/width}}
9764 {
9765 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
9766 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
9767 \pgfusepath{draw}
9768 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
9769 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9770 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
9771 \pgfusepath{draw}
9772 \pgfsetlinewidth{\pgfstartlinewidth}
9773 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
9774 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
9775 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
9776 \pgfusepath{draw}
9777 }
9778
9779 %% fuse
9780 \pgfcircdeclarebipolescaled{misc}
9781 {}
9782 {\ctikzvalof{bipoles/fuse/height}}
9783 {fuse}
9784 {\ctikzvalof{bipoles/fuse/height}}
9785 {\ctikzvalof{bipoles/fuse/width}}
9786 {
9787 \pgfscope
9788 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9789 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9790 \pgf@circ@draworfill
9791 \endpgfscope
9792
9793 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
9794 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
9795 \pgfusepath{draw}
9796
9797 }
9798
9799 %% asymmetric fuse
9800 \pgfcircdeclarebipolescaled{misc}
9801 {}
9802 {\ctikzvalof{bipoles/afuse/height}}
9803 {afuse}
9804 {\ctikzvalof{bipoles/afuse/height}}
9805 {\ctikzvalof{bipoles/afuse/width}}
9806 {
9807 \pgfscope
9808 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9809 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9810 \pgf@circ@draworfill
9811 \endpgfscope
9812
9813 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
9814 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
9815 \pgfusepath{draw}
9816
9817 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9818 \pgfusepath{stroke,fill}
9819 }
9820
9821 %% SQUID added by Cor Molenaar 5 March 2010
9822 \pgfcircdeclarebipolescaled{misc}
9823 {}
9824 {\ctikzvalof{bipoles/squid/height}}
9825 {squid}
9826 {\ctikzvalof{bipoles/squid/height}}
9827 {\ctikzvalof{bipoles/squid/width}}
9828 {
9829 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9830
9831 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
9832 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
9833 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
9834 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
9835 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
9836 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
9837 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
9838 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
9839 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
9840
9841 \pgfusepath{draw}
9842 }
9843
9844 % Generic barrier added by Cor Molenaar 5 March 2010
9845 \pgfcircdeclarebipolescaled{misc}
9846 {}
9847 {\ctikzvalof{bipoles/barrier/height}}
9848 {barrier}
9849 {\ctikzvalof{bipoles/barrier/height}}
9850 {\ctikzvalof{bipoles/barrier/width}}
9851 {
9852 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9853
9854 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
9855 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
9856 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
9857 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
9858 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
9859 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
9860
9861 \pgfusepath{draw}
9862 }
9863
9864 %
9865 % open version of the barrier symbol
9866 % suggested by Radványi Patrik Tamás <[email protected]>
9867 %
9868 \pgfcircdeclarebipolescaled{misc}
9869 {}
9870 {\ctikzvalof{bipoles/barrier/height}}
9871 {openbarrier}
9872 {\ctikzvalof{bipoles/barrier/height}}
9873 {\ctikzvalof{bipoles/barrier/width}}
9874 {
9875 % this is set with normal wire linewidth
9876 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9877 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}}
9878 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9879 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}}
9880 \pgfusepath{draw}
9881
9882 % do the cross part
9883 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9884
9885 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
9886 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
9887 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
9888 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
9889
9890 \pgfusepath{draw}
9891 }
9892 %% Lamp
9893 \pgfcircdeclarebipolescaled{misc}
9894 {}
9895 {\ctikzvalof{bipoles/lamp/height}}
9896 {lamp}
9897 {\ctikzvalof{bipoles/lamp/height}}
9898 {\ctikzvalof{bipoles/lamp/width}}
9899 {
9900 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9901
9902 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
9903 \pgf@circ@draworfill
9904 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
9905 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
9906 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
9907 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
9908 \pgfusepath{draw}
9909 }
9910
9911 %% bulb
9912 \pgfcircdeclarebipolescaled{misc}
9913 {}
9914 {\ctikzvalof{bipoles/bulb/height}}
9915 {bulb}
9916 {\ctikzvalof{bipoles/bulb/height}}
9917 {\ctikzvalof{bipoles/bulb/width}}
9918 {%
9919 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9920 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
9921 \pgf@circ@draworfill
9922 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9923 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
9924 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
9925 \pgfsetbeveljoin
9926 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9927 \pgfusepath{draw}
9928 }% %>>>
9929
9930 %% Path definitions for Miscellaneous%<<<
9931
9932 \pgfcirc@activate@bipole@simple{l}{lamp}
9933 \pgfcirc@activate@bipole@simple{l}{bulb}
9934 \pgfcirc@activate@bipole@simple{l}{squid}
9935 \pgfcirc@activate@bipole@simple{l}{barrier}
9936 \pgfcirc@activate@bipole@simple{l}{openbarrier}
9937 \pgfcirc@activate@bipole@simple{l}{thermocouple}
9938 \pgfcirc@activate@bipole@simple{l}{fuse}
9939 \pgfcirc@activate@bipole{l}{afuse}{afuse}{asymmetric fuse}
9940 \pgfcirc@style@to@style{asymmetric fuse}{afuse}
9941 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
9942 \pgfcirc@activate@bipole{l}{europeangfsurgearrester}{european gas filled surge arrester}{european gas filled surge arrester}
9943 \pgfcirc@activate@bipole{l}{americangfsurgearrester}{american gas filled surge arrester}{american gas filled surge arrester}
9944 \pgfcirc@path@to@style{l}{gfsurgearrester}{gas filled surge arrester}{}
9945 \pgfcirc@path@to@style{l}{gfsurgearrester}{gf surge arrester}{}
9946 \pgfcirc@activate@bipole@simple{l}{mic}
9947 \pgfcirc@activate@bipole@simple{l}{loudspeaker}
9948 % %>>>
9949
9950 % end of pgfcircbipoles.tex
9951 % vim: set fdm=marker fmr=%<<<,%>>>:
9952 %%%---------- close: tex/pgfcircbipoles
9953 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
9954 %%%---------- open: tex/pgfcirctripoles.tex
9955 % Copyright 2018-2026 by Romano Giannetti
9956 % Copyright 2015-2026 by Stefan Lindner
9957 % Copyright 2013-2026 by Stefan Erhardt
9958 % Copyright 2007-2026 by Massimo Redaelli
9959 %
9960 % This file may be distributed and/or modified
9961 %
9962 % 1. under the LaTeX Project Public License and/or
9963 % 2. under the GNU Public License.
9964 %
9965 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
9966
9967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9968 %% Tripoles
9969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9970
9971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9972 %% Logic Ports
9973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9974
9975 %% Settings for Logic ports%<<<1
9976 %% beware that the third option is in IEEE ports in pgfcircmultipoles.tex
9977
9978 % switches for logic gates
9979 %
9980 \pgfkeys{/tikz/number inputs/.initial=0}
9981 \pgfkeys{/tikz/number inputs/.default=0}
9982
9983 \newif\ifpgf@circuit@europeanlogicport
9984 \ctikzset{logic ports/.is choice}
9985 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
9986 \tikzset{and port/.style={shape=european and port}}%
9987 \tikzset{or port/.style={shape=european or port}}%
9988 \tikzset{xor port/.style={shape=european xor port}}%
9989 \tikzset{buffer port/.style={shape=european buffer port}}%
9990 \tikzset{not port/.style={shape=european not port}}%
9991 \tikzset{nand port/.style={shape=european nand port}}%
9992 \tikzset{nor port/.style={shape=european nor port}}%
9993 \tikzset{xnor port/.style={shape=european xnor port}}%
9994 % there is no Schmitt ports in european style (yet)
9995 \tikzset{schmitt port/.style={shape=schmitt}}%
9996 \tikzset{invschmitt port/.style={shape=invschmitt}}%
9997 }}
9998 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
9999 \tikzset{and port/.style={shape=american and port}}%
10000 \tikzset{or port/.style={shape=american or port}}%
10001 \tikzset{xor port/.style={shape=american xor port}}%
10002 \tikzset{buffer port/.style={shape=american buffer port}}%
10003 \tikzset{not port/.style={shape=american not port}}%
10004 \tikzset{nand port/.style={shape=american nand port}}%
10005 \tikzset{nor port/.style={shape=american nor port}}%
10006 \tikzset{xnor port/.style={shape=american xnor port}}%
10007 \tikzset{schmitt port/.style={shape=schmitt}}%
10008 \tikzset{invschmitt port/.style={shape=invschmitt}}%
10009 }}
10010
10011 \ctikzset{logic ports origin/.is choice}
10012 \ctikzset{logic ports origin/legacy/.code={
10013 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
10014 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
10015 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
10016 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
10017 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
10018 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
10019 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
10020 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
10021 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
10022 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
10023 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
10024 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
10025 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
10026 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
10027 }%
10028 }
10029 \ctikzset{logic ports origin/center/.code={%
10030 \ctikzset{tripoles/american and port/origin/.initial=0}%
10031 \ctikzset{tripoles/american nand port/origin/.initial=0}%
10032 \ctikzset{tripoles/american nor port/origin/.initial=0}%
10033 \ctikzset{tripoles/american or port/origin/.initial=0}%
10034 \ctikzset{tripoles/american xor port/origin/.initial=0}%
10035 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
10036 \ctikzset{tripoles/european and port/origin/.initial=0}%
10037 \ctikzset{tripoles/european nand port/origin/.initial=0}%
10038 \ctikzset{tripoles/european or port/origin/.initial=0}%
10039 \ctikzset{tripoles/european nor port/origin/.initial=0}%
10040 \ctikzset{tripoles/european xor port/origin/.initial=0}%
10041 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
10042 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
10043 \ctikzset{tripoles/european not port/origin/.initial=0}%
10044 }%
10045 }
10046
10047 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
10048 \ctikzset{american or shape/.is choice}
10049 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
10050 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
10051
10052 \newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue
10053 \ctikzset{logic ports draw input leads/.is choice}
10054 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}}
10055 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}}
10056 \tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}}
10057 \tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}}
10058
10059 \newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue
10060 \ctikzset{logic ports draw output leads/.is choice}
10061 \ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}}
10062 \ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}}
10063 \tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}}
10064 \tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}}
10065
10066 \ctikzset{logic ports draw leads/.is choice}
10067 \ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
10068 \ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
10069 \tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
10070 \tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
10071
10072 % adding a different style of xnor port
10073 % see https://github.com/circuitikz/circuitikz/issues/467
10074 \ctikzset{european xnor style/.is choice}
10075 \ctikzset{european xnor style/default/.code={%
10076 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}%
10077 }
10078 \ctikzset{european xnor style/direct/.code={%
10079 \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}%
10080 }
10081
10082
10083 % old, legacy keys that should be killed over
10084 \ctikzset{bipoles/buffer/height/.initial=1}
10085 \ctikzset{bipoles/buffer/width/.initial=1}
10086 \ctikzset{bipoles/not port/width/.initial=1}
10087 \ctikzset{bipoles/not port/height/.initial=.8}
10088 \ctikzset{bipoles/not port/circle width/.initial=.15}
10089
10090 \ctikzset{tripoles/american and port/width/.initial=1.1}
10091 \ctikzset{tripoles/american and port/height/.initial=.8}
10092 \ctikzset{tripoles/american and port/port width/.initial=.7}
10093 \ctikzset{tripoles/american and port/input height/.initial=.5}
10094 \ctikzset{tripoles/american nand port/width/.initial=1.1}
10095 \ctikzset{tripoles/american nand port/height/.initial=.8}
10096 \ctikzset{tripoles/american nand port/port width/.initial=.7}
10097 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
10098 \ctikzset{tripoles/american nand port/input height/.initial=.5}
10099 \ctikzset{tripoles/american or port/width/.initial=1.1}
10100 \ctikzset{tripoles/american or port/height/.initial=.8}
10101 \ctikzset{tripoles/american or port/port width/.initial=.7}
10102 \ctikzset{tripoles/american or port/input height/.initial=.5}
10103 \ctikzset{tripoles/american or port/input skip/.initial=.25}
10104 \ctikzset{tripoles/american or port/aaa/.initial=.6}
10105 \ctikzset{tripoles/american or port/bbb/.initial=.4}
10106 \ctikzset{tripoles/american or port/ccc/.initial=.5}
10107 \ctikzset{tripoles/american or port/ddd/.initial=.0}
10108 \ctikzset{tripoles/american nor port/width/.initial=1.1}
10109 \ctikzset{tripoles/american nor port/height/.initial=.8}
10110 \ctikzset{tripoles/american nor port/port width/.initial=.7}
10111 \ctikzset{tripoles/american nor port/input height/.initial=.5}
10112 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
10113 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
10114 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
10115 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
10116 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
10117 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
10118 \ctikzset{tripoles/american xor port/width/.initial=1.1}
10119 \ctikzset{tripoles/american xor port/height/.initial=.8}
10120 \ctikzset{tripoles/american xor port/port width/.initial=.7}
10121 \ctikzset{tripoles/american xor port/input height/.initial=.5}
10122 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
10123 \ctikzset{tripoles/american xor port/distance/.initial=.1}
10124 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
10125 \ctikzset{tripoles/american xnor port/height/.initial=.8}
10126 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
10127 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
10128 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
10129 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
10130 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
10131 \ctikzset{tripoles/american and port/origin/.initial=0.8}
10132 \ctikzset{tripoles/american and port/inputs/.initial=2}
10133 % variable number of inputs
10134 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
10135 \ctikzset{tripoles/american nand port/inputs/.initial=2}
10136 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
10137 \ctikzset{tripoles/american nor port/inputs/.initial=2}
10138 \ctikzset{tripoles/american nor port/angle/.initial=70}
10139 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
10140 \ctikzset{tripoles/american or port/origin/.initial=0.8}
10141 \ctikzset{tripoles/american or port/inputs/.initial=2}
10142 \ctikzset{tripoles/american or port/angle/.initial=70}
10143 \ctikzset{tripoles/american or port/inner/.initial=0.3}
10144 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
10145 \ctikzset{tripoles/american xor port/inputs/.initial=2}
10146 \ctikzset{tripoles/american xor port/angle/.initial=70}
10147 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
10148 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
10149 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
10150 \ctikzset{tripoles/american xnor port/angle/.initial=70}
10151 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
10152
10153 \ctikzset{tripoles/european and port/width/.initial=1.4}
10154 \ctikzset{tripoles/european and port/height/.initial=.65}
10155 \ctikzset{tripoles/european and port/reserved/.initial=.6}
10156 \ctikzset{tripoles/european and port/input height/.initial=.6}
10157 \ctikzset{tripoles/european or port/width/.initial=1.4}
10158 \ctikzset{tripoles/european or port/height/.initial=.65}
10159 \ctikzset{tripoles/european or port/reserved/.initial=.6}
10160 \ctikzset{tripoles/european or port/input height/.initial=.6}
10161 \ctikzset{tripoles/european xor port/width/.initial=1.4}
10162 \ctikzset{tripoles/european xor port/height/.initial=.65}
10163 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
10164 \ctikzset{tripoles/european xor port/input height/.initial=.6}
10165 \ctikzset{tripoles/european nand port/width/.initial=1.4}
10166 \ctikzset{tripoles/european nand port/not height/.initial=.3}
10167 \ctikzset{tripoles/european nand port/not width/.initial=.8}
10168 \ctikzset{tripoles/european nand port/height/.initial=.65}
10169 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
10170 \ctikzset{tripoles/european nand port/input height/.initial=.6}
10171 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
10172 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
10173 \ctikzset{tripoles/european buffer port/not width/.initial=.8}
10174 \ctikzset{tripoles/european buffer port/height/.initial=.65}
10175 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
10176 \ctikzset{tripoles/european buffer port/input height/.initial=0}
10177 \ctikzset{tripoles/european not port/width/.initial=1.4}
10178 \ctikzset{tripoles/european not port/not height/.initial=.3}
10179 \ctikzset{tripoles/european not port/not width/.initial=.8}
10180 \ctikzset{tripoles/european not port/height/.initial=.65}
10181 \ctikzset{tripoles/european not port/reserved/.initial=.6}
10182 \ctikzset{tripoles/european not port/input height/.initial=0}
10183 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
10184 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
10185 \ctikzset{tripoles/european xnor port/not width/.initial=.8}
10186 \ctikzset{tripoles/european xnor port/height/.initial=.65}
10187 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
10188 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
10189 \ctikzset{tripoles/european nor port/width/.initial=1.4}
10190 \ctikzset{tripoles/european nor port/not height/.initial=.3}
10191 \ctikzset{tripoles/european nor port/not width/.initial=.8}
10192 \ctikzset{tripoles/european nor port/height/.initial=.65}
10193 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
10194 \ctikzset{tripoles/european nor port/input height/.initial=.6}
10195 % variable number of inputs
10196 \ctikzset{tripoles/european and port/origin/.initial=0.8}
10197 \ctikzset{tripoles/european and port/inputs/.initial=2}
10198 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
10199 \ctikzset{tripoles/european nand port/inputs/.initial=2}
10200 \ctikzset{tripoles/european or port/origin/.initial=0.8}
10201 \ctikzset{tripoles/european or port/inputs/.initial=2}
10202 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
10203 \ctikzset{tripoles/european nor port/inputs/.initial=2}
10204 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
10205 \ctikzset{tripoles/european xor port/inputs/.initial=2}
10206 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
10207 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
10208 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
10209 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
10210 \ctikzset{tripoles/european not port/origin/.initial=0.8}
10211 \ctikzset{tripoles/european not port/inputs/.initial=1}%
10212 %%% parameters that are not used anymore after multi-input
10213 %%% gates --- left for compatibility of source code.
10214 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
10215 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
10216 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
10217 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
10218 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
10219 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
10220 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
10221 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
10222 %%>>>
10223
10224 %% Node shapes for Logic ports%<<<
10225 %%
10226 %% Code from John Kormylo at tex.stackexchange.com
10227 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
10228 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
10229 %%
10230
10231 \newcount\pgf@circ@res@count% reserve global register
10232
10233 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
10234 {%
10235 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10236 \step
10237 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10238 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10239 }%
10240
10241 % #1 = \pgfmathcounter #2=type #3 specificic port
10242 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
10243 \def\pgf@circ@logicport@baseinput#1#2#3%
10244 {%
10245 % and and nand
10246 \ifnum #2=1\relax
10247 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10248 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10249 \step
10250 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10251 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10252 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
10253 \fi
10254 % or and nor
10255 \ifnum #2=2\relax
10256 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10257 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10258 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10259 \step
10260 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10261 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10262 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
10263 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10264 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10265 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10266 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10267 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10268 \pgf@circ@res@temp=\pgf@y
10269 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10270 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10271 \pgf@x=\pgf@circ@res@other
10272 \fi
10273 % xor and xnor
10274 \ifnum #2=3\relax
10275 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10276 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10277 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10278 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
10279 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10280 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10281 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10282 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10283 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10284 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
10285 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10286 % this compensates for the effect of the line width on the gap between the arcs
10287 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10288 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10289
10290 \step
10291 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10292 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10293 \pgf@circ@res@temp=\pgf@y
10294 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10295 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10296 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10297 \pgf@x=\pgf@circ@res@other
10298 \fi
10299 % european
10300 \ifnum #2=4\relax
10301 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10302 \pgfextractx{\pgf@circ@res@other}{\left}%
10303 \step
10304 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10305 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10306 \pgf@x=\pgf@circ@res@other
10307 \fi
10308 }%
10309
10310 %%% american
10311 \long\def\pgfcircdeclarelogicport#1#2#3{%
10312 \pgfdeclareshape{american #1 port}%
10313 {%
10314 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10315 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10316 \savedmacro\resize{% automatic
10317 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10318 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10319 \pgf@circ@res@up = .5\pgf@circ@res@up
10320 \pgf@circ@res@down = -\pgf@circ@res@up
10321 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
10322 \pgf@circ@res@right = .5\pgf@circ@res@right
10323 \pgf@circ@res@left = -\pgf@circ@res@right
10324 }%
10325 \savedmacro\inputs{% get number of inputs
10326 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
10327 \ifnum\pgf@circ@res@count=0
10328 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
10329 \fi
10330 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
10331 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
10332 \def\inputs{\the\pgf@circ@res@count}%
10333 }%
10334 \savedanchor\step{% 1/2 gap at edges
10335 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10336 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10337 \divide\pgf@circ@res@step by \pgf@circ@res@count
10338 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
10339 }%
10340 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10341 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10342 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
10343 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
10344 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
10345
10346 \anchor{center}{\origin}% for backwards compatibility
10347 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
10348
10349 % create input anchors
10350 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
10351 \pgfmathloop%
10352 \ifnum\pgfmathcounter>\pgf@circ@res@count%
10353 \else%
10354 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
10355 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
10356 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
10357 }%
10358 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
10359 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
10360 }%
10361 %}{}%
10362 \repeatpgfmathloop%
10363 }
10364
10365 \anchor{out}{\northeast\pgf@y=0pt}
10366 \anchor{bout}{\right\pgf@y=0pt}
10367
10368
10369 \anchor{left}{\left}% edges of component minus leads
10370 \anchor{right}{\right}
10371
10372 \anchor{north east}{\northeast}% see \Compass macro
10373 \anchor{south west}{\southwest}
10374 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10375 \pgfpoint{0cm}{\pgf@circ@res@up}}
10376 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10377 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10378 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10379 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
10380 \pgfpoint{\pgf@circ@res@left}{0cm}}
10381 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10382 \pgfpoint{0cm}{\pgf@circ@res@down}}
10383 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10384 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10385 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10386 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
10387 \pgfpoint{\pgf@circ@res@right}{0cm}}
10388
10389 \backgroundpath{
10390 \pgfsetcolor{\ctikzvalof{color}}
10391 #3
10392 }
10393 }
10394 }
10395 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10396 \pgfcircdeclarelogicport{and}{1}{
10397 \pgfextracty{\pgf@circ@res@temp}{\step}%
10398 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10399 \pgf@circ@res@count = \inputs\relax
10400 \ifpgfcirc@draw@input@leads
10401 %input leads
10402 \loop\ifnum\pgf@circ@res@count>0
10403 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10404 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10405 \pgfpathlineto{\pgfpoint
10406 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
10407 {\pgf@circ@res@temp}}
10408 \advance\pgf@circ@res@count by -1
10409 \repeat
10410 \fi
10411 % output lead
10412 \ifpgfcirc@draw@output@leads
10413 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10414 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}}
10415 \pgfusepath{draw}
10416 \fi
10417
10418
10419 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10420 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
10421
10422 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10423 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10424 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
10425 \pgfpathclose
10426 \pgf@circ@draworfill
10427 }
10428 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10429 \pgfcircdeclarelogicport{nand}{1}{
10430 \pgfextracty{\pgf@circ@res@temp}{\step}%
10431 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10432 \pgf@circ@res@count = \inputs\relax
10433 \ifpgfcirc@draw@input@leads
10434 %input leads
10435 \loop\ifnum\pgf@circ@res@count>0
10436 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10437 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10438 \pgfpathlineto{\pgfpoint
10439 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
10440 {\pgf@circ@res@temp}}
10441 \advance\pgf@circ@res@count by -1
10442 \repeat
10443 \fi
10444
10445 \ifpgfcirc@draw@output@leads
10446 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10447 \pgfpathlineto{\pgfpoint
10448 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
10449 \pgfusepath{draw}
10450 \fi
10451 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10452 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
10453 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
10454 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10455
10456 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10457 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10458 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
10459 \pgfpathclose
10460
10461 \pgfpathellipse
10462 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
10463 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10464 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10465
10466 \pgf@circ@draworfill
10467 }
10468 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10469 \pgfcircdeclarelogicport{nor}{2}{
10470 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
10471 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
10472 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10473 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10474 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
10475 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10476
10477 \pgfextracty{\pgf@circ@res@temp}{\step}%
10478 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10479 \pgf@circ@res@count = \inputs\relax
10480 \ifpgfcirc@draw@input@leads
10481 %input leads
10482 \loop\ifnum\pgf@circ@res@count>0
10483 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10484 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10485 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10486 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10487 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10488 \advance\pgf@circ@res@count by -1
10489 \repeat
10490 \fi
10491
10492 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
10493 \ifpgfcirc@draw@output@leads
10494 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10495 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10496 \pgfusepath{draw}
10497 \fi
10498
10499 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10500
10501 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
10502 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
10503 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10504 \advance\pgf@circ@res@other by -\pgf@circ@res@step
10505
10506 % main shape
10507 \ifpgfcirc@roundy@or@shapes
10508 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10509 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10510 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10511 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10512 \pgfpathclose
10513 \else
10514 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10515 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10516 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10517 \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}}
10518 \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}}
10519 \pgfpathclose
10520 \fi
10521
10522 % not dot
10523 \pgfpathellipse
10524 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
10525 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10526 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10527
10528 \pgf@circ@draworfill
10529 }
10530 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10531 \pgfcircdeclarelogicport{or}{2}{
10532 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
10533 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
10534 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10535 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10536 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
10537 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10538
10539 \pgfextracty{\pgf@circ@res@temp}{\step}%
10540 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10541 \pgf@circ@res@count = \inputs\relax
10542 \ifpgfcirc@draw@input@leads
10543 %input leads
10544 \loop\ifnum\pgf@circ@res@count>0
10545 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10546 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10547 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10548 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10549 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10550 \advance\pgf@circ@res@count by -1
10551 \repeat
10552 \fi
10553
10554 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
10555 \ifpgfcirc@draw@output@leads
10556 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10557 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10558 \pgfusepath{draw}
10559 \fi
10560
10561 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10562
10563 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
10564
10565 % main shape
10566 \ifpgfcirc@roundy@or@shapes
10567 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10568 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10569 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10570 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10571 \pgfpathclose
10572 \else
10573 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10574 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10575 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10576 \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}}
10577 \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}}
10578 \pgfpathclose
10579 \fi
10580
10581 \pgf@circ@draworfill
10582 }
10583 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10584 \pgfcircdeclarelogicport{xor}{3}{
10585 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
10586 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
10587 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10588 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10589 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
10590 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10591 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
10592 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10593 % this compensates for the effect of the line width on the gap between the arcs
10594 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10595 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10596
10597 \pgfextracty{\pgf@circ@res@temp}{\step}%
10598 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10599 \pgf@circ@res@count = \inputs\relax
10600 \ifpgfcirc@draw@input@leads
10601 %input leads
10602 \loop\ifnum\pgf@circ@res@count>0
10603 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10604 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10605 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10606 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10607 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10608 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10609 \advance\pgf@circ@res@count by -1
10610 \repeat
10611 \fi
10612
10613 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
10614 \ifpgfcirc@draw@output@leads
10615 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10616 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10617 \pgfusepath{draw}
10618 \fi
10619
10620 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10621
10622 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
10623
10624 % main shape
10625 \ifpgfcirc@roundy@or@shapes
10626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10627 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10628 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10629 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10630 \pgfpathclose
10631 \else
10632 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10633 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10634 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10635 \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}}
10636 \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}}
10637 \pgfpathclose
10638 \fi
10639 \pgf@circ@draworfill
10640
10641 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
10642
10643 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
10644 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
10645
10646 \pgfusepath{draw}
10647 }
10648 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10649 \pgfcircdeclarelogicport{xnor}{3}{
10650 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
10651 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
10652 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10653 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10654 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
10655 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10656 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
10657 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10658 % this compensates for the effect of the line width on the gap between the arcs
10659 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10660 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10661
10662 \pgfextracty{\pgf@circ@res@temp}{\step}%
10663 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10664 \pgf@circ@res@count = \inputs\relax
10665 \ifpgfcirc@draw@input@leads
10666 %input leads
10667 \loop\ifnum\pgf@circ@res@count>0
10668 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10669 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10670 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10671 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10672 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10674 \advance\pgf@circ@res@count by -1
10675 \repeat
10676 \fi
10677
10678 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
10679 \ifpgfcirc@draw@output@leads
10680 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10681 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10682 \pgfusepath{draw}
10683 \fi
10684
10685 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10686
10687 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
10688 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
10689 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10690 \advance\pgf@circ@res@other by -\pgf@circ@res@step
10691
10692 % main shape
10693 \ifpgfcirc@roundy@or@shapes
10694 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10695 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10696 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10697 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10698 \pgfpathclose
10699 \else
10700 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10701 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10702 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10703 \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}}
10704 \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}}
10705 \pgfpathclose
10706 \fi
10707
10708 \pgfpathellipse
10709 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
10710 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10711 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10712 \pgf@circ@draworfill
10713
10714 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
10715 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
10716
10717 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
10718 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
10719
10720 \pgfusepath{draw}
10721 }
10722
10723 %%% Original one-input ports
10724
10725 \pgfdeclareshape{american not port}{
10726 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10727 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10728 \anchor{center}{\pgfpointorigin}
10729 \savedanchor\northwest{%
10730 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10731 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
10732 \pgf@y=.5\pgf@y
10733 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
10734 \pgf@x=.5\pgf@x
10735 }
10736 \anchor{in}{
10737 \northwest
10738 \pgf@y=0pt
10739 }
10740 \anchor{in 1}{
10741 \northwest
10742 \pgf@y=0pt
10743 }
10744 \anchor{left}{
10745 \northwest
10746 \pgf@x=0.7\pgf@x
10747 \pgf@y=0pt
10748 }
10749 \anchor{bin}{
10750 \northwest
10751 \pgf@x=0.7\pgf@x
10752 \pgf@y=0pt
10753 }
10754 \anchor{bin 1}{
10755 \northwest
10756 \pgf@y=0pt
10757 \pgf@x=0.7\pgf@x
10758 }
10759 \anchor{out}{
10760 \northwest
10761 \pgf@y=0pt
10762 \pgf@x=-\pgf@x
10763 }
10764 \anchor{right}{
10765 \northwest
10766 \pgf@y=0pt
10767 \pgf@x=-0.7\pgf@x
10768 }
10769 \anchor{bout}{
10770 \northwest
10771 \pgf@y=0pt
10772 \pgf@x=-0.7\pgf@x
10773 }
10774 \anchor{center}{
10775 \pgfpointorigin
10776 }
10777 \anchor{east}{
10778 \northwest
10779 \pgf@y=0pt
10780 \pgf@x=-\pgf@x
10781 }
10782 \anchor{west}{
10783 \northwest
10784 \pgf@y=0pt
10785 }
10786 \anchor{south}{
10787 \northwest
10788 \pgf@x=0pt
10789 \pgf@y=-\pgf@y
10790 }
10791 \anchor{north}{
10792 \northwest
10793 \pgf@x=0pt
10794 }
10795 \anchor{south west}{
10796 \northwest
10797 \pgf@y=-\pgf@y
10798 }
10799 \anchor{north east}{
10800 \northwest
10801 \pgf@x=-\pgf@x
10802 }
10803 \anchor{north west}{
10804 \northwest
10805 }
10806 \anchor{south east}{
10807 \northwest
10808 \pgf@x=-\pgf@x
10809 \pgf@y=-\pgf@y
10810 }
10811 \anchorborder{% this is used when the node is used as a path element
10812 \pgf@xa=\pgf@x
10813 \pgf@ya=\pgf@y
10814 \pgfextracty{\pgf@circ@res@up}{\northwest}
10815 \pgfextractx{\pgf@circ@res@left}{\northwest}
10816 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
10817 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
10818 }
10819 \anchor{text}{%
10820 % centered and a bit to the left (it's a triangle)!
10821 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
10822 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
10823 }
10824 \backgroundpath{
10825 \pgfsetcolor{\ctikzvalof{color}}
10826
10827 \northwest
10828 \pgf@circ@res@up = \pgf@y
10829 \pgf@circ@res@down = -\pgf@y
10830 \pgf@circ@res@right = -\pgf@x
10831 \pgf@circ@res@left = \pgf@x
10832
10833 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
10834
10835 \pgfscope
10836 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10837 \pgftransformxshift{.7\pgf@circ@res@left}
10838 \pgf@circ@res@step=\pgf@circ@res@right
10839 \advance\pgf@circ@res@step by -\pgf@circ@res@left
10840 \pgf@circ@res@step=.7\pgf@circ@res@step
10841
10842 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
10843 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
10844 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
10845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
10846 \pgf@circ@draworfill
10847 \pgfpathellipse
10848 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
10849 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
10850 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
10851 \pgf@circ@draworfill
10852 \endpgfscope
10853
10854 \ifpgfcirc@draw@input@leads
10855 %input leads
10856 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10857 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
10858 \fi
10859
10860 \ifpgfcirc@draw@output@leads
10861 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10862 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
10863 \fi
10864
10865 \pgfusepath{draw}
10866 }
10867 }
10868
10869 \pgfdeclareshape{american buffer port}{
10870 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10871 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10872 \anchor{center}{\pgfpointorigin}
10873 \savedanchor\northwest{%
10874 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10875 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
10876 \pgf@y=.5\pgf@y
10877 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
10878 \pgf@x=.5\pgf@x
10879 }
10880 \anchor{in}{
10881 \northwest
10882 \pgf@y=0pt
10883 }
10884 \anchor{in 1}{
10885 \northwest
10886 \pgf@y=0pt
10887 }
10888 \anchor{left}{
10889 \northwest
10890 \pgf@x=0.7\pgf@x
10891 \pgf@y=0pt
10892 }
10893 \anchor{bin}{
10894 \northwest
10895 \pgf@x=0.7\pgf@x
10896 \pgf@y=0pt
10897 }
10898 \anchor{bin 1}{
10899 \northwest
10900 \pgf@y=0pt
10901 \pgf@x=0.7\pgf@x
10902 }
10903 \anchor{out}{
10904 \northwest
10905 \pgf@y=0pt
10906 \pgf@x=-\pgf@x
10907 }
10908 \anchor{right}{
10909 \northwest
10910 \pgf@y=0pt
10911 \pgf@x=-0.7\pgf@x
10912 }
10913 \anchor{bout}{
10914 \northwest
10915 \pgf@y=0pt
10916 \pgf@x=-0.7\pgf@x
10917 }
10918 \anchor{center}{
10919 \pgfpointorigin
10920 }
10921 \anchor{east}{
10922 \northwest
10923 \pgf@y=0pt
10924 \pgf@x=-\pgf@x
10925 }
10926 \anchor{west}{
10927 \northwest
10928 \pgf@y=0pt
10929 }
10930 \anchor{south}{
10931 \northwest
10932 \pgf@x=0pt
10933 \pgf@y=-\pgf@y
10934 }
10935 \anchor{north}{
10936 \northwest
10937 \pgf@x=0pt
10938 }
10939 \anchor{south west}{
10940 \northwest
10941 \pgf@y=-\pgf@y
10942 }
10943 \anchor{north east}{
10944 \northwest
10945 \pgf@x=-\pgf@x
10946 }
10947 \anchor{north west}{
10948 \northwest
10949 }
10950 \anchor{south east}{
10951 \northwest
10952 \pgf@x=-\pgf@x
10953 \pgf@y=-\pgf@y
10954 }
10955 \anchorborder{% this is used when the node is used as a path element
10956 \pgf@xa=\pgf@x
10957 \pgf@ya=\pgf@y
10958 \pgfextracty{\pgf@circ@res@up}{\northwest}
10959 \pgfextractx{\pgf@circ@res@left}{\northwest}
10960 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
10961 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
10962 }
10963 \anchor{text}{%
10964 % centered and a bit to the left (it's a triangle)!
10965 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
10966 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
10967 }
10968 \backgroundpath{
10969 \pgfsetcolor{\ctikzvalof{color}}
10970
10971 \northwest
10972 \pgf@circ@res@up = \pgf@y
10973 \pgf@circ@res@down = -\pgf@y
10974 \pgf@circ@res@right = -\pgf@x
10975 \pgf@circ@res@left = \pgf@x
10976
10977 \pgfscope
10978 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10979 \pgftransformxshift{.7\pgf@circ@res@left}
10980 \pgf@circ@res@step=\pgf@circ@res@right
10981 \advance\pgf@circ@res@step by -\pgf@circ@res@left
10982 \pgf@circ@res@step=.7\pgf@circ@res@step
10983
10984 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
10985 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
10986 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
10987 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
10988 \pgf@circ@draworfill
10989 \endpgfscope
10990
10991 \ifpgfcirc@draw@input@leads
10992 %input leads
10993 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10994 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
10995 \fi
10996
10997 \ifpgfcirc@draw@output@leads
10998 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10999 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11000 \fi
11001
11002 \pgfusepath{draw}
11003 }
11004 }
11005 \pgfdeclareshape{invschmitt}{
11006 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11007 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11008 \anchor{center}{\pgfpointorigin}
11009 \savedanchor\northwest{%
11010 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11011 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11012 \pgf@y=.5\pgf@y
11013 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11014 \pgf@x=.5\pgf@x
11015 }
11016 \anchor{in}{
11017 \northwest
11018 \pgf@y=0pt
11019 }
11020 \anchor{in 1}{
11021 \northwest
11022 \pgf@y=0pt
11023 }
11024 \anchor{left}{
11025 \northwest
11026 \pgf@y=0pt
11027 \pgf@x=0.7\pgf@x
11028 }
11029 \anchor{bin}{
11030 \northwest
11031 \pgf@y=0pt
11032 \pgf@x=0.7\pgf@x
11033 }
11034 \anchor{bin 1}{
11035 \northwest
11036 \pgf@y=0pt
11037 \pgf@x=0.7\pgf@x
11038 }
11039 \anchor{out}{
11040 \northwest
11041 \pgf@y=0pt
11042 \pgf@x=-\pgf@x
11043 }
11044 \anchor{right}{
11045 \northwest
11046 \pgf@y=0pt
11047 \pgf@x=-0.7\pgf@x
11048 }
11049 \anchor{bout}{
11050 \northwest
11051 \pgf@y=0pt
11052 \pgf@x=-0.7\pgf@x
11053 }
11054 \anchor{center}{
11055 \pgfpointorigin
11056 }
11057 \anchor{east}{
11058 \northwest
11059 \pgf@y=0pt
11060 \pgf@x=-\pgf@x
11061 }
11062 \anchor{west}{
11063 \northwest
11064 \pgf@y=0pt
11065 }
11066 \anchor{south}{
11067 \northwest
11068 \pgf@x=0pt
11069 \pgf@y=-\pgf@y
11070 }
11071 \anchor{north}{
11072 \northwest
11073 \pgf@x=0pt
11074 }
11075 \anchor{south west}{
11076 \northwest
11077 \pgf@y=-\pgf@y
11078 }
11079 \anchor{north east}{
11080 \northwest
11081 \pgf@x=-\pgf@x
11082 }
11083 \anchor{north west}{
11084 \northwest
11085 }
11086 \anchor{south east}{
11087 \northwest
11088 \pgf@x=-\pgf@x
11089 \pgf@y=-\pgf@y
11090 }
11091 \anchorborder{% this is used when the node is used as a path element
11092 \pgf@xa=\pgf@x
11093 \pgf@ya=\pgf@y
11094 \pgfextracty{\pgf@circ@res@up}{\northwest}
11095 \pgfextractx{\pgf@circ@res@left}{\northwest}
11096 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11097 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11098 }
11099 \anchor{text}{%
11100 % centered and a bit to the left (it's a triangle)!
11101 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11102 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11103 }
11104 \backgroundpath{
11105 \pgfsetcolor{\ctikzvalof{color}}
11106
11107 \northwest
11108 \pgf@circ@res@up = \pgf@y
11109 \pgf@circ@res@down = -\pgf@y
11110 \pgf@circ@res@right = -\pgf@x
11111 \pgf@circ@res@left = \pgf@x
11112
11113 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11114
11115 \pgfscope
11116 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11117 \pgftransformxshift{.7\pgf@circ@res@left}
11118 \pgf@circ@res@step=\pgf@circ@res@right
11119 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11120 \pgf@circ@res@step=.7\pgf@circ@res@step
11121
11122 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11123 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11124 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11125 \pgfpathclose
11126 \pgf@circ@draworfill
11127 \pgfpathellipse
11128 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11129 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11130 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11131 \pgf@circ@draworfill
11132 \endpgfscope
11133
11134 \ifpgfcirc@draw@input@leads
11135 %input leads
11136 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11137 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11138 \fi
11139
11140 \ifpgfcirc@draw@output@leads
11141 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11142 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11143 \fi
11144 \pgfusepath{draw}
11145 %draw inner shape
11146
11147 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11148
11149 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11150 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11151 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11152 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11153 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11154 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11155 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11156 \pgfusepath{draw}
11157
11158 }
11159 }
11160
11161 \pgfdeclareshape{schmitt}{
11162 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11163 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11164 \anchor{center}{\pgfpointorigin}
11165 \savedanchor\northwest{%
11166 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11167 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11168 \pgf@y=.5\pgf@y
11169 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11170 \pgf@x=.5\pgf@x
11171 }
11172 \anchor{in}{
11173 \northwest
11174 \pgf@y=0pt
11175 }
11176 \anchor{in 1}{
11177 \northwest
11178 \pgf@y=0pt
11179 }
11180 \anchor{left}{
11181 \northwest
11182 \pgf@y=0pt
11183 \pgf@x=0.7\pgf@x
11184 }
11185 \anchor{bin}{
11186 \northwest
11187 \pgf@y=0pt
11188 \pgf@x=0.7\pgf@x
11189 }
11190 \anchor{bin 1}{
11191 \northwest
11192 \pgf@y=0pt
11193 \pgf@x=0.7\pgf@x
11194 }
11195 \anchor{out}{
11196 \northwest
11197 \pgf@y=0pt
11198 \pgf@x=-\pgf@x
11199 }
11200 \anchor{right}{
11201 \northwest
11202 \pgf@y=0pt
11203 \pgf@x=-.7\pgf@x
11204 }
11205 \anchor{bout}{
11206 \northwest
11207 \pgf@y=0pt
11208 \pgf@x=-.7\pgf@x
11209 }
11210 \anchor{center}{
11211 \pgfpointorigin
11212 }
11213 \anchor{east}{
11214 \northwest
11215 \pgf@y=0pt
11216 \pgf@x=-\pgf@x
11217 }
11218 \anchor{west}{
11219 \northwest
11220 \pgf@y=0pt
11221 }
11222 \anchor{south}{
11223 \northwest
11224 \pgf@x=0pt
11225 \pgf@y=-\pgf@y
11226 }
11227 \anchor{north}{
11228 \northwest
11229 \pgf@x=0pt
11230 }
11231 \anchor{south west}{
11232 \northwest
11233 \pgf@y=-\pgf@y
11234 }
11235 \anchor{north east}{
11236 \northwest
11237 \pgf@x=-\pgf@x
11238 }
11239 \anchor{north west}{
11240 \northwest
11241 }
11242 \anchor{south east}{
11243 \northwest
11244 \pgf@x=-\pgf@x
11245 \pgf@y=-\pgf@y
11246 }
11247 \anchorborder{% this is used when the node is used as a path element
11248 \pgf@xa=\pgf@x
11249 \pgf@ya=\pgf@y
11250 \pgfextracty{\pgf@circ@res@up}{\northwest}
11251 \pgfextractx{\pgf@circ@res@left}{\northwest}
11252 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11253 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
11254 }
11255 \anchor{text}{%
11256 % centered and a bit to the left (it's a triangle)!
11257 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
11258 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11259 }
11260 \backgroundpath{
11261 \pgfsetcolor{\ctikzvalof{color}}
11262
11263
11264 \northwest
11265 \pgf@circ@res@up = \pgf@y
11266 \pgf@circ@res@down = -\pgf@y
11267 \pgf@circ@res@right = -\pgf@x
11268 \pgf@circ@res@left = \pgf@x
11269
11270 \pgfscope
11271 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11272 \pgftransformxshift{.7\pgf@circ@res@left}
11273 \pgf@circ@res@step=\pgf@circ@res@right
11274 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11275 \pgf@circ@res@step=.7\pgf@circ@res@step
11276
11277 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11278 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11279 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11280 \pgfpathclose
11281 \pgf@circ@draworfill
11282 \endpgfscope
11283
11284 \ifpgfcirc@draw@input@leads
11285 %input leads
11286 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11287 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11288 \fi
11289
11290 \ifpgfcirc@draw@output@leads
11291 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11292 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
11293 \fi
11294 \pgfusepath{draw}
11295 %draw inner shape
11296
11297 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11298
11299 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11300 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11301 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11302 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11303 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11304 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11305 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11306 \pgfusepath{draw}
11307
11308 }
11309 }
11310
11311
11312 %%% start european logic ports, from John Kormylo
11313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11314 %%
11315
11316 % #1 - name
11317 % #2 - text inside
11318 % #3 - number of inputs
11319 % #4 = is it a not?
11320 %
11321 % option to add a circle for not-output, see
11322 % https://github.com/circuitikz/circuitikz/issues/385
11323 %
11324 \newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
11325 \newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse
11326 \ctikzset{tripoles/european not shape/.initial=ocirc}
11327 \ctikzset{tripoles/european not symbol/.is choice}
11328 \ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
11329 \ctikzset{tripoles/european not symbol/circle/.code={%
11330 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
11331 \ctikzset{tripoles/european not symbol/ieee circle/.code={%
11332 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
11333
11334 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
11335 \pgfdeclareshape{european #1 port}
11336 {
11337 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11338 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11339 \saveddimen{\boutshift}{%
11340 \edef\pgf@temp{not}
11341 \edef\pgf@circ@temp{#4}
11342 \ifx\pgf@temp\pgf@circ@temp % is a not
11343 \ifpgf@circ@european@port@circle
11344 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11345 \edef\pgf@temp{ocirc}
11346 \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
11347 \ifx\pgf@temp\pgf@circ@temp % it's ocirc
11348 \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
11349 \else % it's ieee not circ
11350 \pgf@circ@notradius % defined together with ieeestd ports
11351 \pgf@x=2\pgf@circ@res@temp
11352 \fi
11353 \else
11354 \pgf@x=0pt
11355 \fi
11356 \else
11357 \pgf@x=0pt
11358 \fi
11359 }
11360 \savedmacro\resize{% automatic
11361 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11362 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11363 \pgf@circ@res@up = .5\pgf@circ@res@up
11364 \pgf@circ@res@down = -\pgf@circ@res@up
11365 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
11366 \pgf@circ@res@right = .5\pgf@circ@res@right
11367 \pgf@circ@res@left = -\pgf@circ@res@right
11368 }%
11369 \savedmacro\inputs{% get number of inputs
11370 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
11371 \ifnum\pgf@circ@res@count=0
11372 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
11373 \fi
11374 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
11375 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
11376 \def\inputs{\the\pgf@circ@res@count}%
11377 }%
11378 \savedanchor\step{% 1/2 gap at edges
11379 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11380 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11381 \divide\pgf@circ@res@step by #3
11382 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
11383 }%
11384 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
11385 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
11386 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11387 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
11388 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
11389
11390 \anchor{center}{\origin}% for backwards compatibility
11391 % the text anchor overlaps the logic symbol
11392 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
11393 % create input anchors
11394 \ifnum#3=1\relax
11395 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11396 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11397 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11398 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11399 \else
11400 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
11401 \pgfmathloop%
11402 \ifnum\pgfmathcounter>#3%
11403 \else%
11404 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
11405 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
11406 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
11407 }%
11408 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
11409 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
11410 }%
11411 %}{}%
11412 \repeatpgfmathloop%
11413 }
11414 \fi
11415 \anchor{out}{\northeast\pgf@y=0pt}
11416 \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
11417
11418 \anchor{left}{\left}% edges of component minus leads
11419 \anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
11420
11421 \anchor{north east}{\northeast}% see \Compass macro
11422 \anchor{south west}{\southwest}
11423 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11424 \pgfpoint{0cm}{\pgf@circ@res@up}}
11425 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11426 \pgfextractx{\pgf@circ@res@left}{\southwest}%
11427 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11428 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
11429 \pgfpoint{\pgf@circ@res@left}{0cm}}
11430 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11431 \pgfpoint{0cm}{\pgf@circ@res@down}}
11432 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11433 \pgfextractx{\pgf@circ@res@right}{\northeast}%
11434 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11435 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
11436 \pgfpoint{\pgf@circ@res@right}{0cm}}
11437
11438 \anchorborder{% this is used when the node is used as a path element
11439 \pgf@xa=\pgf@x
11440 \pgf@ya=\pgf@y
11441 \pgfextracty{\pgf@circ@res@up}{\northeast}
11442 \pgfextractx{\pgf@circ@res@right}{\northeast}
11443 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
11444 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11445 }
11446 \backgroundpath{
11447 \pgfsetcolor{\ctikzvalof{color}}
11448 \pgfstartlinewidth=\pgflinewidth
11449 \pgfscope
11450 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11451 \pgfpathrectanglecorners
11452 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
11453 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
11454 \pgf@circ@draworfill
11455 \endpgfscope
11456 \ifpgfcirc@draw@input@leads
11457 %input leads
11458 \ifnum#3=1\relax
11459 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
11460 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11461 \else
11462 \pgfextracty{\pgf@circ@res@temp}{\step}%
11463 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11464 %\pgf@circ@res@count = #3\relax% redundant
11465 \loop\ifnum\pgf@circ@res@count>0
11466 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11467 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11468 \pgfpathlineto{\pgfpoint
11469 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
11470 {\pgf@circ@res@temp}}
11471 \advance\pgf@circ@res@count by -1
11472 \repeat
11473 \fi
11474 \pgfusepath{draw}
11475 \fi
11476 %
11477 \ifpgfcirc@draw@output@leads
11478 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11479 \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
11480 \pgfusepath{draw}
11481 \fi
11482 %
11483 \edef\pgf@temp{not}
11484 \edef\pgf@circ@temp{#4}
11485 \ifx\pgf@temp\pgf@circ@temp % is a not
11486 \ifpgf@circ@european@port@circle
11487 \pgfscope
11488 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11489 \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
11490 % reset linewidth for IEEE ports, otherwise they will multiply...
11491 \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
11492 \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
11493 \endpgfscope
11494 \else
11495 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
11496 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
11497 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
11498 \pgfusepath{draw}
11499 \fi
11500 \fi
11501 %
11502 \pgfpathmoveto{\pgfpointorigin}
11503 \pgftext{#2}
11504 }
11505 }
11506 }
11507 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
11508 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
11509 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
11510 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
11511 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
11512 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
11513 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
11514 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
11515
11516 %% end european logic ports
11517 % %>>>
11518
11519 %% IEEE standard logic ports module%<<<
11520
11521 %%
11522 %% Original multi-input code from John Kormylo at tex.stackexchange.com
11523 %% Help by TheTeXnician <[email protected]>
11524 %% Suggested idea and example code by Jason Sachs <[email protected]>
11525 %% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
11526 %% Most of the code, all errors and bugs by Romano Giannetti <[email protected]>
11527 %% Everything is in the same place here --- more or less; first step to move towards
11528 %% a module interface for circutikz
11529 %%
11530
11531 % base settings for ieeestd ports.
11532
11533 \ctikzset{ieeestd ports/.is family}
11534 % baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
11535 % the value of 0.4 is the standard pin distance for a port with height=num pins
11536 % and matches the chip distance
11537 \ctikzset{ieeestd ports/baselen/.initial=0.4}
11538 % these are in term of baselen; width depends on height (fixed proportions)
11539 \ctikzset{ieeestd ports/height/.initial=2}
11540 \ctikzset{ieeestd ports/pin length/.initial=0.7}
11541 % the standard "not" circle should be 1/6.5 of height (diameter);
11542 % so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
11543 \ctikzset{ieeestd ports/not radius/.initial=0.154}
11544 \ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
11545 % the suggested xnor distance is is 1.24, so 1.25/3.25/2
11546 % xor/xnor leads go full in in IEEE; let this be optional
11547 \ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
11548 \ctikzset{ieeestd ports/xor leads in/.initial=1}%
11549 %
11550 % base size of a small external schmitt symbol
11551 %
11552 \ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
11553 %
11554 % input management
11555 % we are using the same /tikz/number inputs than the legacy ports
11556 %
11557 \tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
11558 %
11559 % integrate with the other logic ports
11560 %
11561 %
11562 \newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse
11563 \ctikzset{logic ports/ieee/.code= {%
11564 \pgf@circuit@ieeelogicporttrue
11565 \pgf@circuit@europeanlogicportfalse
11566 \tikzset{and port/.style={shape=ieeestd and port}}%
11567 \tikzset{or port/.style={shape=ieeestd or port}}%
11568 \tikzset{xor port/.style={shape=ieeestd xor port}}%
11569 \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
11570 \tikzset{not port/.style={shape=ieeestd not port}}%
11571 \tikzset{nand port/.style={shape=ieeestd nand port}}%
11572 \tikzset{nor port/.style={shape=ieeestd nor port}}%
11573 \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
11574 \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
11575 \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}%
11576 }}
11577 % add code to be compatible with the other ports
11578 \ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}}
11579 \ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}}
11580 \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
11581 %
11582 % the base angle for the or port. See the drawings. This will not change with height
11583 %
11584 \pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
11585 % \typeout{ANGLE-IS\space\pgf@circ@orangle}
11586 \def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
11587 {%
11588 \ifnum#1>\inputs
11589 \PackageError{circuitikz}{%
11590 You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
11591 which has been defined with \inputs\space pins%
11592 }{Please check the manual about logic ports; if you press return I'll try to continue}
11593 \fi
11594 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
11595 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
11596 \pgf@circ@res@step=\pind
11597 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
11598 \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
11599 }%
11600
11601 % #1 = \pgfmathcounter #2=type
11602 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
11603 \def\pgf@circ@ieeeport@baseinput#1#2%
11604 {%
11605 \ifnum#1>\inputs
11606 \PackageError{circuitikz}{%
11607 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
11608 which has been defined with \inputs\space pins%
11609 }{Please check the manual about logic ports; if you press return I'll try to continue}
11610 \fi
11611 % Find the vertical position (this is the same for any port)
11612 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
11613 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
11614 % rack (extended) pins; they are the same for all the ports
11615 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
11616 % above: 1..K (included)
11617 % below: inputs-K..inputs
11618 % Find the pins on the rack; they are 1...
11619 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
11620 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
11621 % border anchors for rack should be ok
11622 \pgfextractx{\pgf@circ@res@left}{\topleft}
11623 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
11624 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
11625 % we have finished if we are in the rack
11626 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
11627 % we are on the inner ports; we have to do the hard work here
11628 % and and nand
11629 \ifnum #2=1
11630 \relax % It's an and/nand, all border ports are on the rack line
11631 \fi
11632 % or and nor
11633 \ifnum #2=2
11634 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
11635 \fi
11636 % xor and xnor
11637 \ifnum #2=3\relax
11638 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
11639 \fi
11640 \fi\fi
11641 }%
11642 % inner base ports for xor types port
11643 % #1 = \pgfmathcounter #2=type
11644 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
11645 \def\pgf@circ@ieeeport@innerbaseinput#1%
11646 {%
11647 \ifnum#1>\inputs
11648 \PackageError{circuitikz}{%
11649 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
11650 which has been defined with \inputs\space pins%
11651 }{Please check the manual about logic ports; if you press return I'll try to continue}
11652 \fi
11653 % Find the vertical position (this is the same for any port)
11654 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
11655 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
11656 % rack (extended) pins; they are the same for all the ports
11657 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
11658 % above: 1..K (included)
11659 % below: inputs-K..inputs
11660 % Find the pins on the rack; they are 1...
11661 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
11662 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
11663 % border anchors for rack should be ok
11664 \pgfextractx{\pgf@circ@res@left}{\topleft}
11665 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
11666 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
11667 % we have finished if we are in the rack
11668 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
11669 % we are on the inner ports; we have to do the hard work here
11670 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
11671 \fi\fi
11672 }%
11673
11674 %%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
11675 \def\pgf@circ@ieeestd@baselen{%
11676 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11677 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
11678 }
11679 \def\pgf@circ@ieeestd@stdH{%
11680 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11681 \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
11682 \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
11683 }
11684 \def\pgf@circ@ieeestd@pinlen{%
11685 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11686 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
11687 \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
11688 }
11689 \def\pgf@circ@ieeestd@xorbar{%
11690 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
11691 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
11692 \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
11693 }
11694 %% Not circle
11695 \def\pgf@circ@notradius{
11696 \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
11697 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
11698 % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
11699 }
11700 %% Find (in ...@other) the height of the rack
11701 \def\pgf@circ@findrackH{%
11702 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
11703 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
11704 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
11705 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
11706 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
11707 \pgf@circ@ieeestd@stdH
11708 \multiply\pgf@circ@res@temp by 2\relax% full height
11709 \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
11710 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
11711 % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
11712 }
11713 %%
11714 \def\pgf@circ@find@ieeeport@up{% leave it in up
11715 % Normal port limits
11716 \pgf@circ@ieeestd@stdH
11717 \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
11718 % rack top size
11719 \pgf@circ@findrackH
11720 \ifdim\pgf@circ@res@other > \pgf@circ@res@up
11721 \pgf@circ@res@up=\pgf@circ@res@other
11722 \else
11723 \fi
11724 }
11725 \def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
11726 % Normal port limits
11727 \pgf@circ@ieeestd@stdH
11728 \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
11729 \pgf@circ@res@right=\pgf@circ@res@left % save the border value
11730 \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
11731 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
11732 % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
11733 % this is the normal left border
11734 % For the or or xor port, the limit can be the pointy thing (in case the
11735 % pinlen is zero or too small)
11736 % add to the body margin the or/nor peak:
11737 \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
11738 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
11739 \advance\pgf@circ@res@right by \pgf@circ@res@other
11740 % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
11741 \fi
11742 % add to the body margin the xor/xnor distance
11743 \ifnum #1 = 3\relax% "xor" or "xnor" gates.
11744 \pgf@circ@ieeestd@xorbar
11745 \advance\pgf@circ@res@right by \pgf@circ@res@temp
11746 % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
11747 \fi
11748 % and if this exceeds the normal margin, this is it
11749 % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
11750 \ifdim \pgf@circ@res@right > \pgf@circ@res@left
11751 \pgf@circ@res@left=\pgf@circ@res@right
11752 \fi
11753 % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
11754 \pgf@circ@res@left=-\pgf@circ@res@left
11755 }
11756 \def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
11757 % Normal port limits
11758 \pgf@circ@ieeestd@stdH
11759 \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
11760 \pgf@circ@notradius
11761 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
11762 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
11763 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
11764 \pgf@circ@res@right=\pgf@circ@res@other
11765 \fi
11766 }
11767 \def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
11768 % Normal port limits
11769 \pgf@circ@ieeestd@stdH
11770 % notice 0.8660254 is cos(30)
11771 \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
11772 \pgf@circ@notradius
11773 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
11774 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
11775 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
11776 \pgf@circ@res@right=\pgf@circ@res@other
11777 \fi
11778 }
11779
11780
11781 %%% ieeestd multi-input ports
11782 %%% #1: name
11783 %%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
11784 %%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
11785 %%% #4: drawing for the port
11786 \long\def\pgfcircdeclareieeeport#1#2#3#4{%
11787 \pgfdeclareshape{ieeestd #1 port}%
11788 {%
11789 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11790 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11791 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
11792 \saveddimen{\baselen}{%
11793 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
11794 }
11795 \saveddimen{\stdH}{% This is HALF the height of the inner port
11796 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
11797 }
11798 \saveddimen{\notdiameter}{
11799 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
11800 }
11801 \saveddimen{\pind}{% pin distance;
11802 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
11803 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
11804 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
11805 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
11806 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
11807 \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
11808 \divide\pgf@x by \pgf@circ@count@b
11809 }
11810 \saveddimen{\pinlen}{%
11811 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
11812 }
11813 \saveddimen{\xorbar}{%
11814 \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
11815 }
11816 % anchors for the body (no pins included here)
11817 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
11818 \pgf@circ@ieeestd@stdH
11819 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
11820 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
11821 }
11822 \savedanchor{\topleft}{%
11823 \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
11824 \pgf@circ@ieeestd@stdH
11825 \pgf@circ@res@other=0pt\relax
11826 \ifnum #2 = 2\relax% "or" or "nor" gates.
11827 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
11828 \fi
11829 \ifnum #2 = 3\relax% "xor" or "xnor" gates.
11830 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
11831 +\pgf@circ@res@right}
11832 \fi
11833 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
11834 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
11835 }
11836 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
11837 \pgf@circ@ieeestd@stdH
11838 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
11839 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
11840 }
11841 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
11842 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
11843 \pgf@circ@ieeestd@stdH
11844 % #3 is =1 if the port is a negated output one
11845 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
11846 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
11847 }
11848 % geographical anchors --- must be rectangulars!
11849 \savedanchor{\northwest}{%
11850 \pgf@circ@find@ieeeport@up
11851 \pgf@circ@find@ieeeport@left{#2}
11852 % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
11853 \pgf@x=\pgf@circ@res@left
11854 \pgf@y=\pgf@circ@res@up
11855 }
11856 \savedanchor{\southwest}{%
11857 \pgf@circ@find@ieeeport@up
11858 \pgf@circ@find@ieeeport@left{#2}
11859 \pgf@x=\pgf@circ@res@left
11860 \pgf@y=-\pgf@circ@res@up
11861 }
11862 \savedanchor{\southeast}{%
11863 \pgf@circ@find@ieeeport@up
11864 \pgf@circ@find@ieeeport@right{#3}
11865 \pgf@x=\pgf@circ@res@right
11866 \pgf@y=-\pgf@circ@res@up
11867 }
11868 \savedanchor{\northeast}{%
11869 \pgf@circ@find@ieeeport@up
11870 \pgf@circ@find@ieeeport@right{#3}
11871 \pgf@x=\pgf@circ@res@right
11872 \pgf@y=\pgf@circ@res@up
11873 }
11874 \savedmacro\inputs{% get number of inputs
11875 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
11876 \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
11877 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
11878 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
11879 \def\inputs{\the\pgf@circ@count@a}%
11880 }%
11881 \savedmacro\inners{% get number of "inner" inputs (for racks)
11882 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
11883 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
11884 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
11885 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
11886 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
11887 % \typeout{INNER is \the\pgf@circ@count@b}%
11888 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
11889 \def\inners{\the\pgf@circ@count@b}%
11890 }%
11891 \anchor{center}{\pgfpointorigin}
11892 \anchor{text}{
11893 \ifpgf@circ@center@text
11894 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
11895 \else
11896 \pgf@circ@ieeestd@stdH
11897 \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
11898 \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
11899 \fi
11900 }
11901 % create input anchors
11902 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
11903 \pgf@circ@count@a=\inputs
11904 \pgfmathloop%
11905 \ifnum\pgfmathcounter>\pgf@circ@count@a%
11906 \else%
11907 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
11908 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
11909 \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
11910 }%
11911 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
11912 \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
11913 }%
11914 \ifnum #2 = 3\relax % xor/xnor inner border pins
11915 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
11916 \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
11917 }%
11918 \fi
11919 %}{}%
11920 \repeatpgfmathloop%
11921 }
11922 % output anchor
11923 \anchor{out}{%
11924 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
11925 \advance\pgf@circ@res@other by\pinlen
11926 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
11927 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
11928 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
11929 \fi
11930 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
11931 }
11932 \anchor{bout}{\bottomright\pgf@y=0pt}
11933
11934 \anchor{body right}{\bodyright\pgf@y=0pt}
11935 \anchor{right}{\bottomright\pgf@y=0pt}
11936 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
11937 \anchor{left}{% central edge of the component
11938 \bodyleft\pgf@y=0pt
11939 \ifnum #2=3\relax
11940 \advance\pgf@x by -\xorbar
11941 \fi
11942 }
11943 \anchor{up}{%
11944 \bodyleft
11945 \ifnum #2 > 1 % pointy shapes
11946 \pgf@circ@ieeestd@stdH
11947 % horizontal coordinate where the right semicircle starts
11948 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
11949 % vertical drop of the circle at the above coordinate
11950 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
11951 \advance \pgf@y by -\pgf@circ@res@step
11952 \fi
11953 \pgf@x=0pt
11954 }
11955 \anchor{down}{%
11956 \bodyleft
11957 \ifnum #2 > 1 % pointy shapes
11958 \pgf@circ@ieeestd@stdH
11959 % horizontal coordinate where the right semicircle starts
11960 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
11961 % vertical drop of the circle at the above coordinate
11962 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
11963 \advance \pgf@y by -\pgf@circ@res@step
11964 \fi
11965 \pgf@y=-\pgf@y\pgf@x=0pt
11966 }
11967
11968 % geographical anchors
11969 \anchor{nw}{\northwest}
11970 \anchor{ne}{\northeast}
11971 \anchor{se}{\southeast}
11972 \anchor{sw}{\southwest}
11973 \anchor{north west}{\northwest}
11974 \anchor{north east}{\northeast}
11975 \anchor{south east}{\southeast}
11976 \anchor{south west}{\southwest}
11977 % over 0,0 even if asymmetric
11978 % will break if the geocoords are not rectangular
11979 \anchor{n}{\northwest\pgf@x=0pt\relax}
11980 \anchor{e}{\northeast\pgf@y=0pt\relax}
11981 \anchor{s}{\southwest\pgf@x=0pt\relax}
11982 \anchor{w}{\northwest\pgf@y=0pt\relax}
11983 \anchor{north}{\northwest\pgf@x=0pt\relax}
11984 \anchor{east}{\northeast\pgf@y=0pt\relax}
11985 \anchor{south}{\southwest\pgf@x=0pt\relax}
11986 \anchor{west}{\northwest\pgf@y=0pt\relax}
11987
11988 \backgroundpath{
11989 \pgfscope
11990 \pgfsetcolor{\ctikzvalof{color}}
11991 #4
11992 \endpgfscope
11993 % output lead:
11994 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
11995 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
11996 \advance\pgf@circ@res@other by \pinlen\relax
11997 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
11998 \ifpgfcirc@draw@output@leads
11999 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12000 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12001 \pgfusepath{draw}
12002 \fi
12003 \fi
12004 \ifnum #3=1\relax\pgfscope
12005 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
12006 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
12007 \endpgfscope\fi
12008 }
12009 }
12010 }
12011
12012 %%% #1 direct name #2 negated name #3 type #4 drawing (without output)
12013 \long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
12014 \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
12015 \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
12016 }
12017 %
12018 % ieeestd "and" and "nand"
12019 %
12020 \pgfcircdeclareieeeportpair{and}{nand}{1}{%
12021 \pgf@circ@count@a = \inputs\relax
12022 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
12023 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
12024 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12025 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
12026 \ifpgfcirc@draw@input@leads
12027 %input leads --- all the same for AND ports
12028 \loop\ifnum\pgf@circ@count@a>0
12029 \advance\pgf@circ@res@temp by -\pind
12030 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12031 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
12032 \advance\pgf@circ@count@a by -1
12033 \repeat
12034 \fi
12035 \pgfusepath{draw}
12036 %% Body. let's start from the top left
12037 \pgfscope
12038 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12039 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
12040 \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
12041 \pgfpatharc{90}{-90}{\stdH}
12042 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
12043 \pgfpathclose
12044 \pgf@circ@draworfill
12045 % rack now; skip if not needed.
12046 % \typeout{WHAT\space \inputs\space \inners}
12047 \ifnum\inputs>\inners
12048 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12049 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
12050 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
12051 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12052 \pgfusepath{draw}
12053 \fi
12054 \endpgfscope
12055 }
12056 %
12057 % or/nor and xor/xnor are practically the same. Let factor out everything
12058 % the argument #1 is put just before the drawing of the inner pins
12059 % the argument #2 is put after the drawing of the body
12060 %
12061 \long\def\pgf@circ@ieeeport@orxor#1#2{%
12062 \pgf@circ@count@a = \inputs\relax
12063 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
12064 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
12065 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12066 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
12067 % rack (extended) pins; they are the same for all the ports
12068 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
12069 % above: 1..K (included)
12070 % below: inputs-K..inputs
12071 % Find the pins on the rack; they are 1...
12072 \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
12073 \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
12074 \ifpgfcirc@draw@input@leads
12075 %input leads --- for or ports
12076 \loop\ifnum\pgf@circ@count@a>0
12077 \pgfextractx{\pgf@circ@res@right}{\topleft}
12078 \advance\pgf@circ@res@temp by -\pind
12079 % this is the height; let's find the "right" position
12080 \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
12081 % inner pins
12082 % \typeout{INNER\space\pgf@circ@count@a}
12083 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
12084 % hook for xor/xnor
12085 #1
12086 \fi\fi
12087 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
12088 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
12089 \pgfusepath{draw}
12090 \advance\pgf@circ@count@a by -1
12091 \repeat
12092 \fi
12093 %% Body. let's start from the top left
12094 \pgfscope
12095 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12096 % it should start here, but with this trick the close comes out better.
12097 % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
12098 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
12099 \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
12100 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
12101 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
12102 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
12103 %% this should be 2 and 2; but the round part is not a perfect circle that way
12104 %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
12105 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
12106 \pgfpathclose
12107 \pgf@circ@draworfill
12108 % hook for xor/xnor
12109 #2
12110 % rack now; skip if not needed.
12111 % \typeout{WHAT\space \inputs\space \inners}
12112 \ifnum\inputs>\inners
12113 \pgfextractx{\pgf@circ@res@left}{\topleft}
12114 \pgfextracty{\pgf@circ@res@down}{\topleft}
12115 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12116 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
12117 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
12118 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12119 \pgfusepath{draw}
12120 \fi
12121 \endpgfscope
12122 }
12123 %
12124 % ieeestd "or" and "nor"
12125 %
12126 \pgfcircdeclareieeeportpair{or}{nor}{2}{%
12127 \pgf@circ@ieeeport@orxor{}{}
12128 }
12129 \pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
12130 \pgf@circ@ieeeport@orxor{
12131 \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
12132 \ifnum\@@tmp=0\relax
12133 % move pin start to the left to leave the xor gap free (not standard)
12134 \advance\pgf@circ@res@right by -\xorbar
12135 \fi
12136 }{%
12137 % add the xor/xnor bar
12138 \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
12139 % see the comment on the main body about the 2.2
12140 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
12141 \pgfusepath{draw}
12142 }
12143 }
12144 %
12145 % Buffer and inverters
12146 %
12147 % #1: name
12148 % #2: polarity
12149 % #3: content
12150 \long\def\pgfcircdeclareieeebufferport#1#2#3{%
12151 \pgfdeclareshape{ieeestd #1 port}%
12152 {%
12153 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12154 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12155 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
12156 \saveddimen{\baselen}{%
12157 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
12158 }
12159 \saveddimen{\stdH}{% This is HALF the height of the inner port
12160 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
12161 }
12162 \saveddimen{\notdiameter}{
12163 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
12164 }
12165 \saveddimen{\pinlen}{%
12166 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
12167 }
12168 % anchors for the body (no pins included here)
12169 % Notice that 0.8660254 is cos(30)
12170 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
12171 \pgf@circ@ieeestd@stdH
12172 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
12173 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12174 }
12175 \savedanchor{\topleft}{%
12176 \pgf@circ@ieeestd@stdH
12177 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
12178 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12179 }
12180 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
12181 \pgf@circ@ieeestd@stdH
12182 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
12183 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12184 }
12185 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
12186 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
12187 \pgf@circ@ieeestd@stdH
12188 % #2 is =1 if the port is a negated output one
12189 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
12190 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
12191 }
12192 % geographical anchors --- must be rectangulars!
12193 \savedanchor{\northwest}{%
12194 \pgf@circ@ieeestd@stdH
12195 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
12196 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
12197 }
12198 \savedanchor{\southwest}{%
12199 \pgf@circ@ieeestd@stdH
12200 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
12201 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
12202 }
12203 \savedanchor{\southeast}{%
12204 \pgf@circ@ieeestd@stdH
12205 \pgf@circ@res@up=\pgf@circ@res@temp
12206 \pgf@circ@find@ieeeport@not@right{#2}
12207 \pgf@x=\pgf@circ@res@right
12208 \pgf@y=-\pgf@circ@res@up
12209 }
12210 \savedanchor{\northeast}{%
12211 \pgf@circ@ieeestd@stdH
12212 \pgf@circ@res@up=\pgf@circ@res@temp
12213 \pgf@circ@find@ieeeport@not@right{#2}
12214 \pgf@x=\pgf@circ@res@right
12215 \pgf@y=\pgf@circ@res@up
12216 }
12217 \anchor{center}{\pgfpointorigin}
12218 \anchor{text}{
12219 \ifpgf@circ@center@text
12220 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12221 \else
12222 \pgf@circ@ieeestd@stdH
12223 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12224 \fi
12225 }
12226 % input anchors
12227 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
12228 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
12229 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
12230 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
12231 % output anchors
12232 \anchor{out}{%
12233 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
12234 \advance\pgf@circ@res@other by\pinlen
12235 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
12236 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
12237 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
12238 \fi
12239 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
12240 }
12241 \anchor{bout}{\bottomright\pgf@y=0pt}
12242
12243 \anchor{body right}{\bodyright\pgf@y=0pt}
12244 \anchor{right}{\bottomright\pgf@y=0pt}
12245 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
12246 \anchor{left}{\bodyleft\pgf@y=0pt}
12247 \anchor{up}{%
12248 \bodyleft
12249 \pgf@y=+0.5\pgf@y\pgf@x=0pt
12250 }
12251 \anchor{down}{%
12252 \bodyleft
12253 \pgf@y=-0.5\pgf@y\pgf@x=0pt
12254 }
12255 % this is for when it's used as a bipole
12256 % we use the enclosing rectangle (see below)
12257 \anchorborder{%
12258 %% This (commented out) is the correct border anchor. But if we use the correct
12259 %% border anchor there is no horizontal space for the label ;-) because
12260 %% the triangle is too steep. So we will use a simple square border
12261 %%
12262 %% find the border anchor of a triangle (like a not port or an
12263 %% amplifier) ---
12264 %%
12265 %% -----^ up
12266 %% I --- |
12267 %% I -|--
12268 %%left I | --- right
12269 %% ----I-----|-------I-----
12270 %%
12271 %%
12272 %\pgf@xa=\pgf@x
12273 %% it's simmetrical w/ vertical side, use only positive y
12274 %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
12275 %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
12276 %\pgfextracty{\pgf@circ@res@up}{\bodyleft}
12277 %\pgfextractx{\pgf@circ@res@left}{\bodyleft}
12278 %\pgfextractx{\pgf@circ@res@right}{\bodyright}
12279 %% limit angle for the left (vertical) side
12280 %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)}
12281 %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)}
12282 %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)}
12283 %% find the border
12284 %\ifnum\@@leftside>0
12285 % % vertical side
12286 % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12287 % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12288 %\else
12289 % % triangle upper line
12290 % \pgfpointintersectionoflines
12291 % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
12292 % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}}
12293 %\fi
12294 %% readjust y sign
12295 %\pgf@y=\@@switchy\pgf@y
12296 %
12297 % this is the square border to position the path label with a bit of horizontal space
12298 %
12299 \pgf@xa=\pgf@x
12300 \pgf@ya=\pgf@y
12301 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12302 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12303 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12304 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12305 }
12306 % geographical anchors
12307 \anchor{nw}{\northwest}
12308 \anchor{ne}{\northeast}
12309 \anchor{se}{\southeast}
12310 \anchor{sw}{\southwest}
12311 \anchor{north west}{\northwest}
12312 \anchor{north east}{\northeast}
12313 \anchor{south east}{\southeast}
12314 \anchor{south west}{\southwest}
12315 % over 0,0 even if asymmetric
12316 % will break if the geocoords are not rectangular
12317 \anchor{n}{\northwest\pgf@x=0pt\relax}
12318 \anchor{e}{\northeast\pgf@y=0pt\relax}
12319 \anchor{s}{\southwest\pgf@x=0pt\relax}
12320 \anchor{w}{\northwest\pgf@y=0pt\relax}
12321 \anchor{north}{\northwest\pgf@x=0pt\relax}
12322 \anchor{east}{\northeast\pgf@y=0pt\relax}
12323 \anchor{south}{\southwest\pgf@x=0pt\relax}
12324 \anchor{west}{\northwest\pgf@y=0pt\relax}
12325
12326 \backgroundpath{
12327 \pgfscope
12328 \pgfsetcolor{\ctikzvalof{color}}
12329 #3
12330 \endpgfscope
12331 % output lead:
12332 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
12333 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
12334 \advance\pgf@circ@res@other by \pinlen\relax
12335 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
12336 \ifpgfcirc@draw@output@leads
12337 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12338 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12339 \pgfusepath{draw}
12340 \fi
12341 \fi
12342 \ifnum #2=1\relax\pgfscope
12343 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
12344 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
12345 \endpgfscope\fi
12346 }
12347 }
12348 }
12349
12350 %%% #1 direct name #2 negated name #3 drawing (without output)
12351 \long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
12352 \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
12353 \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
12354 }
12355
12356 \pgfcircdeclareieeebufferportpair{buffer}{not}{%
12357 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12358 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12359 \pgfextractx{\pgf@circ@res@right}{\bodyright}
12360 % \draw input pin
12361 \ifpgfcirc@draw@input@leads
12362 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12363 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
12364 \pgfusepath{draw}
12365 \fi
12366 \pgfscope
12367 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12368 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12369 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12370 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12371 \pgfpathclose
12372 \pgf@circ@draworfill
12373 \endpgfscope
12374 }
12375
12376 \pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{%
12377 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12378 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12379 \pgfextractx{\pgf@circ@res@right}{\bodyright}
12380 % \draw input pin
12381 \ifpgfcirc@draw@input@leads
12382 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12383 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
12384 \pgfusepath{draw}
12385 \fi
12386 \pgfscope
12387 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12388 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12389 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12390 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12391 \pgfpathclose
12392 \pgf@circ@draworfill
12393 \endpgfscope
12394 % draw schmitt symbol in normal line thickness
12395 \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
12396 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
12397 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
12398 \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
12399 \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
12400 \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
12401 \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
12402 \pgfusepath{draw}
12403 }
12404
12405
12406 \pgfdeclareshape{schmitt symbol}{
12407 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12408 \anchor{center}{\pgfpointorigin}
12409 \savedanchor\northwest{%
12410 \pgf@circ@ieeestd@stdH
12411 \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
12412 \pgf@x=-1.5\pgf@y
12413 }
12414 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
12415 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
12416 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
12417 \anchor{west}{\northwest\pgf@y=0pt}
12418 \anchor{w}{\northwest \pgf@y=0pt}
12419 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
12420 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
12421 \anchor{north}{\northwest\pgf@x=0pt}
12422 \anchor{n}{\northwest\pgf@x=0pt}
12423 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
12424 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
12425 \anchor{north west}{\northwest}
12426 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
12427 \backgroundpath{
12428 \pgfscope
12429 \pgfsetcolor{\ctikzvalof{color}}
12430 \pgfextractx{\pgf@circ@res@left}{\northwest}
12431 \pgfextracty{\pgf@circ@res@up}{\northwest}
12432 \pgf@circ@res@left=0.7\pgf@circ@res@left
12433 \pgf@circ@res@up=0.7\pgf@circ@res@up
12434 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12435 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
12436 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
12437 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12438 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
12439 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
12440 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12441 \pgfusepath{draw}
12442 \endpgfscope
12443 }
12444 }
12445
12446 \pgfdeclareshape{notcirc}{
12447 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12448 \anchor{center}{\pgfpointorigin}
12449 \savedanchor\northwest{%
12450 \pgf@circ@notradius
12451 \pgf@y=\pgf@circ@res@temp
12452 \pgf@x=-\pgf@y
12453 }
12454 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
12455 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
12456 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
12457 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
12458 \anchor{left}{\northwest\pgf@y=0pt}
12459 \anchor{west}{\northwest\pgf@y=0pt}
12460 \anchor{w}{\northwest \pgf@y=0pt}
12461 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
12462 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
12463 \anchor{north}{\northwest\pgf@x=0pt}
12464 \anchor{n}{\northwest\pgf@x=0pt}
12465 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
12466 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
12467 \anchor{north west}{\northwest}
12468 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
12469 \anchorborder{
12470 \pgf@circ@res@left=\pgf@x
12471 \pgf@circ@res@up=\pgf@y
12472 \northwest\pgf@circ@res@temp=\pgf@y
12473 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
12474 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
12475 }
12476 \behindforegroundpath{
12477 \pgfscope
12478 \northwest\pgf@circ@res@temp=\pgf@y
12479 \pgfsetcolor{\ctikzvalof{color}}
12480 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12481 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
12482 \ifx\tikz@fillcolor\pgfutil@empty
12483 % set the default fill color to white
12484 \pgfsetfillcolor{white}
12485 % ...but override it if the class is defined!
12486 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
12487 \else
12488 \pgfsetfillcolor{\tikz@fillcolor}
12489 \fi
12490 \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
12491 \pgfusepath{draw,fill}
12492 \endpgfscope
12493 }
12494 }
12495
12496 %%%% Transmission gates
12497 % tgates are only ieee style for now
12498 \tikzset{%
12499 tgate/.style ={shape=ieee tgate},
12500 double tgate/.style ={shape=ieee double tgate},
12501 }
12502 \ctikzset{tgate scale/.initial=0.7}
12503 % Buffer and inverters
12504 %
12505 % #1: name
12506 % #2: 1: one-not, 2:double-not
12507 % #3: content
12508 \long\def\pgfcircdeclareieeetgate#1#2#3{%
12509 \pgfdeclareshape{ieee #1}%
12510 {%
12511 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12512 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12513 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
12514 \saveddimen{\baselen}{%
12515 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
12516 }
12517 \saveddimen{\stdH}{% This is HALF the height of the inner port
12518 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
12519 }
12520 \saveddimen{\notdiameter}{
12521 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
12522 }
12523 \saveddimen{\notradius}{
12524 \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp
12525 }
12526 \saveddimen{\pinlen}{%
12527 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
12528 }
12529 % anchors for the body (no pins included here)
12530 % Notice that 0.8660254 is cos(30)
12531 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
12532 \pgf@circ@ieeestd@stdH
12533 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12534 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12535 }
12536 \savedanchor{\topleft}{%
12537 \pgf@circ@ieeestd@stdH
12538 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12539 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12540 }
12541 \savedanchor{\bodyright}{%
12542 \pgf@circ@ieeestd@stdH
12543 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12544 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12545 }
12546 \savedanchor{\bottomright}{% Here it is the same as \bodyright
12547 \pgf@circ@ieeestd@stdH
12548 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12549 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12550 }
12551 % geographical anchors --- must be rectangulars!
12552 \savedanchor{\northwest}{%
12553 \pgf@circ@ieeestd@stdH
12554 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12555 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12556 }
12557 \savedanchor{\southwest}{%
12558 \pgf@circ@ieeestd@stdH
12559 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12560 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12561 }
12562 \savedanchor{\southeast}{%
12563 \pgf@circ@ieeestd@stdH
12564 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12565 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12566 }
12567 \savedanchor{\northeast}{%
12568 \pgf@circ@ieeestd@stdH
12569 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12570 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
12571 }
12572 \anchor{center}{\pgfpointorigin}
12573 \anchor{text}{
12574 \ifpgf@circ@center@text
12575 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12576 \else
12577 \pgf@circ@ieeestd@stdH
12578 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
12579 \fi
12580 }
12581 % input anchors
12582 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
12583 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
12584 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
12585 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
12586 % gates
12587 \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y
12588 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
12589 \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y
12590 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}}
12591 % gate (up) (2.1547 = 1+1/cos(30)
12592 \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y
12593 \pgf@x=0pt\relax
12594 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
12595 \ifdim\pinlen>\pgf@circ@res@temp
12596 \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}
12597 \else
12598 \pgf@y=\pgf@circ@res@temp
12599 \fi
12600 }
12601 \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y
12602 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}}
12603
12604 % output anchors
12605 \anchor{out}{%
12606 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
12607 \advance\pgf@circ@res@other by\pinlen
12608 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
12609 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
12610 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
12611 \fi
12612 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
12613 }
12614 \anchor{bout}{\bottomright\pgf@y=0pt}
12615
12616 \anchor{body right}{\bodyright\pgf@y=0pt}
12617 \anchor{right}{\bottomright\pgf@y=0pt}
12618 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
12619 \anchor{left}{\bodyleft\pgf@y=0pt}
12620 \anchor{up}{%
12621 \bodyleft
12622 \pgf@x=0pt
12623 \ifnum#2=1\relax
12624 \pgf@y=0pt
12625 \else
12626 \pgf@y=.5\pgf@y
12627 \fi
12628 \advance\pgf@y by \notdiameter
12629 }
12630 \anchor{down}{%
12631 \bodyleft
12632 \pgf@x=0pt
12633 \ifnum#2=1\relax
12634 \pgf@y=0pt
12635 \else
12636 \pgf@y=-.5\pgf@y
12637 \fi
12638 }
12639 % this is for when it's used as a bipole
12640 % we use the enclosing rectangle (see below)
12641 \anchorborder{%
12642 %
12643 % this is the square border to position the path label with a bit of horizontal space
12644 %
12645 \pgf@xa=\pgf@x
12646 \pgf@ya=\pgf@y
12647 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12648 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12649 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
12650 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
12651 }
12652 % geographical anchors
12653 \anchor{nw}{\northwest}
12654 \anchor{ne}{\northeast}
12655 \anchor{se}{\southeast}
12656 \anchor{sw}{\southwest}
12657 \anchor{north west}{\northwest}
12658 \anchor{north east}{\northeast}
12659 \anchor{south east}{\southeast}
12660 \anchor{south west}{\southwest}
12661 % over 0,0 even if asymmetric
12662 % will break if the geocoords are not rectangular
12663 \anchor{n}{\northwest\pgf@x=0pt\relax}
12664 \anchor{e}{\northeast\pgf@y=0pt\relax}
12665 \anchor{s}{\southwest\pgf@x=0pt\relax}
12666 \anchor{w}{\northwest\pgf@y=0pt\relax}
12667 \anchor{north}{\northwest\pgf@x=0pt\relax}
12668 \anchor{east}{\northeast\pgf@y=0pt\relax}
12669 \anchor{south}{\southwest\pgf@x=0pt\relax}
12670 \anchor{west}{\northwest\pgf@y=0pt\relax}
12671
12672 \backgroundpath{
12673 \pgfscope
12674 \pgfsetcolor{\ctikzvalof{color}}
12675 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
12676 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
12677 \pgfextractx{\pgf@circ@res@right}{\bodyright}
12678 % \draw input pins
12679 \ifpgfcirc@draw@input@leads
12680 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12681 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
12682 % gate (down)
12683 \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}}
12684 \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
12685 % gate (up) (2.1547 = 1+1/cos(30)
12686 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
12687 \ifdim\pinlen>\pgf@circ@res@temp
12688 \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}}
12689 \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}}
12690 \fi
12691 \pgfusepath{draw}
12692 \fi
12693 #3
12694 \endpgfscope
12695 % output lead:
12696 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
12697 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
12698 \advance\pgf@circ@res@other by \pinlen\relax
12699 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
12700 \ifpgfcirc@draw@output@leads
12701 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12702 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12703 \pgfusepath{draw}
12704 \fi
12705 \fi
12706 }
12707 }
12708 }
12709
12710 \pgfcircdeclareieeetgate{tgate}{1}{%
12711 \pgfscope
12712 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12713 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12714 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
12715 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12716 \pgfpathclose
12717 \pgf@circ@draworfill
12718 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12719 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
12720 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
12721 \pgfpathclose
12722 \pgf@circ@draworfill
12723 \endpgfscope
12724 \pgfscope
12725 % 1.1547 is 1/cos(30)
12726 \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}}
12727 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
12728 \endpgfscope
12729 }
12730
12731 \pgfcircdeclareieeetgate{double tgate}{2}{%
12732 \pgfscope
12733 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12734 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12735 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
12736 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12737 \pgfpathclose
12738 \pgf@circ@draworfill
12739 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12740 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
12741 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12742 \pgfpathclose
12743 \pgf@circ@draworfill
12744 % bottom triangles
12745 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
12746 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
12747 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12748 \pgfpathclose
12749 \pgf@circ@draworfill
12750 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
12751 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
12752 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12753 \pgfpathclose
12754 \pgf@circ@draworfill
12755 \endpgfscope
12756 \pgfscope
12757 % 1.1547 is 1/cos(30)
12758 \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}}
12759 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
12760 \endpgfscope
12761 }% %>>>
12762
12763 %% Path-style definitions for logical ports%<<<
12764 %
12765 % create path-style element for one input --- one output logical ports
12766 %
12767 \def\pgfcirc@port@node@to@path#1#2{%
12768 %
12769 % add a logic port path style component --- we need to suppress leads
12770 % and use the correct center
12771 %
12772 \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}%
12773 }
12774 \pgfcirc@port@node@to@path{not port}{inline not}
12775 \pgfcirc@port@node@to@path{buffer port}{inline buffer}
12776 \pgfcirc@port@node@to@path{schmitt port}{inline schmitt}
12777 \pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt}
12778
12779 \pgfcirc@port@node@to@path{tgate}{inline tgate}
12780 \pgfcirc@port@node@to@path{double tgate}{inline double tgate}
12781 % %>>>
12782
12783 %%%%%%%%%%%%%%%%%%%%%%%%
12784 %% Transistors
12785 %%%%%%%%%%%%%%%%%%%%%%%%
12786
12787 % Settings for Transistors %<<<1
12788
12789 \newif\ifpgf@circuit@trans@depletiontype
12790 \pgf@circuit@trans@depletiontypefalse
12791
12792 \newif\ifpgf@circuit@mos@arrows
12793 \ctikzset{tripoles/mos style/.is choice}
12794 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
12795 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
12796 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
12797 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
12798
12799 % Fixed label positions
12800 \newif\ifpgf@circuit@transisors@fixlabels
12801 \pgf@circuit@transisors@fixlabelstrue
12802 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
12803 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
12804 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
12805 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
12806
12807 % Option solderdot for fet
12808 \newif\ifpgf@circuit@fet@solderdot
12809 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
12810 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
12811 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
12812 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
12813
12814 % Option bodydiode for fet
12815 \newif\ifpgf@circuit@fet@bodydiode
12816 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
12817 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
12818 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
12819 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
12820
12821 % Option draw fet without gate connection
12822 \newif\ifpgf@circuit@bpt@drawgate
12823 \pgf@circuit@bpt@drawgatetrue
12824 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
12825 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
12826 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
12827 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
12828
12829 % Option draw bpt with schottky base
12830 \newif\ifpgf@circuit@bpt@schottky
12831 \pgf@circuit@bpt@schottkyfalse
12832 \pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
12833 \ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
12834 \pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
12835 \ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
12836 \ctikzset{tripoles/schottky base size/.initial=0.05}
12837
12838 % Option to add ferroelectric symbol
12839 \newif\ifpgf@circuit@tr@ferroel
12840 \pgf@circuit@tr@ferroelfalse
12841 \pgfkeys{/tikz/ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}}
12842 \ctikzset{ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}}
12843 \pgfkeys{/tikz/no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}}
12844 \ctikzset{no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}}
12845
12846
12847 % Option draw bpt without base connection
12848 \newif\ifpgf@circuit@bpt@drawbase
12849 \pgf@circuit@bpt@drawbasetrue
12850 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
12851 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
12852 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
12853 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
12854
12855 % Option draw bpt with optical input
12856 \newif\ifpgf@circuit@bpt@drawphoto
12857 \pgf@circuit@bpt@drawphotofalse
12858 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
12859 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
12860 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
12861 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
12862
12863 % Option draw fet without bulk connection -- Added by Burak Kelleci
12864 \newif\ifpgf@circuit@bpt@drawbulk
12865 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
12866 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
12867 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
12868 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
12869
12870 % Option draw pmos with empty circle
12871 \newif\ifpgf@circuit@pmos@emptycircle
12872 \pgf@circuit@pmos@emptycirclefalse
12873 \ctikzset{tripoles/pmos style/.is choice}
12874 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
12875 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
12876 % Option draw pmos with no circle
12877 \newif\ifpgf@circuit@pmos@nocircle
12878 \pgf@circuit@pmos@nocirclefalse
12879 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
12880 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
12881 % back to normal
12882 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
12883 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
12884 % arrows at the end, the correct way
12885 \newif\ifpgf@circuit@trans@arrowatend
12886 \pgf@circuit@trans@arrowatendfalse
12887 \ctikzset{transistors/arrow pos/.is choice}
12888 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
12889 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
12890
12891 \newif\ifpgf@circuit@trans@ntype
12892 \pgf@circuit@trans@ntypetrue %default true
12893 %\newif\ifpgf@circuit@trans@ptype
12894 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
12895 \ctikzset{tripoles/nmos/width/.initial=.7}
12896 \ctikzset{tripoles/nmos/gate height/.initial=.35}
12897 \ctikzset{tripoles/nmos/base height/.initial=.5}
12898 \ctikzset{tripoles/nmos/conn height/.initial=0}
12899 \ctikzset{tripoles/nmos/height/.initial=1.1}
12900 \ctikzset{tripoles/nmos/base width/.initial=.5}
12901 \ctikzset{tripoles/nmos/gate width/.initial=.62}
12902 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
12903 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
12904 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
12905 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
12906 \ctikzset{tripoles/nmos/curr direction/.initial=1}
12907
12908 \ctikzset{tripoles/pmos/width/.initial=.7}
12909 \ctikzset{tripoles/pmos/gate height/.initial=.35}
12910 \ctikzset{tripoles/pmos/base height/.initial=.5}
12911 \ctikzset{tripoles/pmos/conn height/.initial=0}
12912 \ctikzset{tripoles/pmos/height/.initial=1.1}
12913 \ctikzset{tripoles/pmos/base width/.initial=.5}
12914 \ctikzset{tripoles/pmos/gate width/.initial=.62}
12915 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
12916 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
12917 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
12918 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
12919 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
12920
12921 \ctikzset{tripoles/nmosd/width/.initial=.7}
12922 \ctikzset{tripoles/nmosd/gate height/.initial=.35}
12923 \ctikzset{tripoles/nmosd/base height/.initial=.5}
12924 \ctikzset{tripoles/nmosd/conn height/.initial=0}
12925 \ctikzset{tripoles/nmosd/height/.initial=1.1}
12926 \ctikzset{tripoles/nmosd/base width/.initial=.5}
12927 \ctikzset{tripoles/nmosd/gate width/.initial=.62}
12928 \ctikzset{tripoles/nmosd/arrow pos/.initial=.6}
12929 \ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3}
12930 \ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3}
12931 \ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6}
12932 \ctikzset{tripoles/nmosd/curr direction/.initial=1}
12933 \ctikzset{tripoles/nmosd/depletion width/.initial=.1}
12934 \ctikzset{tripoles/nmosd/depletion color/.initial=default}
12935
12936 \ctikzset{tripoles/pmosd/width/.initial=.7}
12937 \ctikzset{tripoles/pmosd/gate height/.initial=.35}
12938 \ctikzset{tripoles/pmosd/base height/.initial=.5}
12939 \ctikzset{tripoles/pmosd/conn height/.initial=0}
12940 \ctikzset{tripoles/pmosd/height/.initial=1.1}
12941 \ctikzset{tripoles/pmosd/base width/.initial=.5}
12942 \ctikzset{tripoles/pmosd/gate width/.initial=.62}
12943 \ctikzset{tripoles/pmosd/arrow pos/.initial=.4}
12944 \ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3}
12945 \ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3}
12946 \ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6}
12947 \ctikzset{tripoles/pmosd/curr direction/.initial=-1}
12948 \ctikzset{tripoles/pmosd/depletion width/.initial=.1}
12949 \ctikzset{tripoles/pmosd/depletion color/.initial=default}
12950 \ctikzset{tripoles/hemt/width/.initial=.7}
12951 \ctikzset{tripoles/hemt/gate height/.initial=.35}
12952 \ctikzset{tripoles/hemt/base height/.initial=.5}
12953 \ctikzset{tripoles/hemt/conn height/.initial=0}
12954 \ctikzset{tripoles/hemt/height/.initial=1.1}
12955 \ctikzset{tripoles/hemt/base width/.initial=.5}
12956 \ctikzset{tripoles/hemt/gate width/.initial=.5}% the horizontal position is the same
12957 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
12958 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
12959 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
12960 \ctikzset{tripoles/hemt/curr direction/.initial=1}
12961
12962 \ctikzset{tripoles/nfet/width/.initial=.7}
12963 \ctikzset{tripoles/nfet/gate height/.initial=.35}
12964 \ctikzset{tripoles/nfet/base height/.initial=.5}
12965 \ctikzset{tripoles/nfet/conn height/.initial=0}
12966 \ctikzset{tripoles/nfet/height/.initial=1.1}
12967 \ctikzset{tripoles/nfet/base width/.initial=.5}
12968 \ctikzset{tripoles/nfet/gate width/.initial=.62}
12969 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
12970 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
12971 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
12972 \ctikzset{tripoles/nfet/curr direction/.initial=1}
12973
12974 \ctikzset{tripoles/pfet/width/.initial=.7}
12975 \ctikzset{tripoles/pfet/gate height/.initial=.35}
12976 \ctikzset{tripoles/pfet/base height/.initial=.5}
12977 \ctikzset{tripoles/pfet/conn height/.initial=0}
12978 \ctikzset{tripoles/pfet/height/.initial=1.1}
12979 \ctikzset{tripoles/pfet/base width/.initial=.5}
12980 \ctikzset{tripoles/pfet/gate width/.initial=.62}
12981 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
12982 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
12983 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
12984 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
12985
12986 \ctikzset{tripoles/nfetd/width/.initial=.7}
12987 \ctikzset{tripoles/nfetd/gate height/.initial=.35}
12988 \ctikzset{tripoles/nfetd/base height/.initial=.5}
12989 \ctikzset{tripoles/nfetd/conn height/.initial=0}
12990 \ctikzset{tripoles/nfetd/height/.initial=1.1}
12991 \ctikzset{tripoles/nfetd/base width/.initial=.5}
12992 \ctikzset{tripoles/nfetd/gate width/.initial=.62}
12993 \ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3}
12994 \ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3}
12995 \ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6}
12996 \ctikzset{tripoles/nfetd/curr direction/.initial=1}
12997
12998 \ctikzset{tripoles/pfetd/width/.initial=.7}
12999 \ctikzset{tripoles/pfetd/gate height/.initial=.35}
13000 \ctikzset{tripoles/pfetd/base height/.initial=.5}
13001 \ctikzset{tripoles/pfetd/conn height/.initial=0}
13002 \ctikzset{tripoles/pfetd/height/.initial=1.1}
13003 \ctikzset{tripoles/pfetd/base width/.initial=.5}
13004 \ctikzset{tripoles/pfetd/gate width/.initial=.62}
13005 \ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3}
13006 \ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3}
13007 \ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6}
13008 \ctikzset{tripoles/pfetd/curr direction/.initial=-1}
13009
13010 \ctikzset{tripoles/nigfete/width/.initial=.7}
13011 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
13012 \ctikzset{tripoles/nigfete/base height/.initial=.5}
13013 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
13014 \ctikzset{tripoles/nigfete/height/.initial=1.1}
13015 \ctikzset{tripoles/nigfete/base width/.initial=.5}
13016 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
13017 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
13018 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
13019 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
13020 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
13021
13022 \ctikzset{tripoles/nigfetd/width/.initial=.7}
13023 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
13024 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
13025 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
13026 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
13027 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
13028 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
13029 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
13030 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
13031 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
13032 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
13033
13034 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
13035 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
13036 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
13037 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
13038 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
13039 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
13040 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
13041 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
13042 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
13043 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
13044 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
13045
13046 \ctikzset{tripoles/pigfete/width/.initial=.7}
13047 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
13048 \ctikzset{tripoles/pigfete/base height/.initial=.5}
13049 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
13050 \ctikzset{tripoles/pigfete/height/.initial=1.1}
13051 \ctikzset{tripoles/pigfete/base width/.initial=.5}
13052 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
13053 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
13054 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
13055 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
13056 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
13057
13058 \ctikzset{tripoles/pigfetd/width/.initial=.7}
13059 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
13060 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
13061 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
13062 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
13063 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
13064 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
13065 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
13066 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
13067 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
13068 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
13069
13070 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
13071 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
13072 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
13073 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
13074 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
13075 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
13076 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
13077 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
13078 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
13079 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
13080 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
13081
13082 \ctikzset{tripoles/npn/width/.initial=.6}
13083 \ctikzset{tripoles/npn/base height/.initial=.45}
13084 \ctikzset{tripoles/npn/base height 2/.initial=.15}
13085 \ctikzset{tripoles/npn/base height/.initial=.4}
13086 \ctikzset{tripoles/npn/conn height/.initial=0}
13087 \ctikzset{tripoles/npn/height/.initial=1.1}
13088 \ctikzset{tripoles/npn/base width/.initial=.5}
13089 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
13090 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
13091 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
13092 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
13093 \ctikzset{tripoles/npn/curr direction/.initial=1}
13094
13095 \ctikzset{tripoles/pnp/width/.initial=.6}
13096 \ctikzset{tripoles/pnp/base height/.initial=.45}
13097 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
13098 \ctikzset{tripoles/pnp/base height/.initial=.4}
13099 \ctikzset{tripoles/pnp/conn height/.initial=0}
13100 \ctikzset{tripoles/pnp/height/.initial=1.1}
13101 \ctikzset{tripoles/pnp/base width/.initial=.5}
13102 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
13103 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
13104 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
13105 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
13106 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
13107
13108 \ctikzset{tripoles/pigbt/width/.initial=.6}
13109 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
13110 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
13111 \ctikzset{tripoles/pigbt/base height/.initial=.4}
13112 \ctikzset{tripoles/pigbt/outer base height/.initial=.4}
13113 \ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
13114 \ctikzset{tripoles/pigbt/conn height/.initial=0}
13115 \ctikzset{tripoles/pigbt/height/.initial=1.1}
13116 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
13117 \ctikzset{tripoles/pigbt/base width/.initial=.5}
13118 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
13119 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
13120 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
13121 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
13122
13123 \ctikzset{tripoles/nigbt/width/.initial=.6}
13124 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
13125 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
13126 \ctikzset{tripoles/nigbt/base height/.initial=.4}
13127 \ctikzset{tripoles/nigbt/outer base height/.initial=.4}
13128 \ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
13129 \ctikzset{tripoles/nigbt/conn height/.initial=0}
13130 \ctikzset{tripoles/nigbt/height/.initial=1.1}
13131 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
13132 \ctikzset{tripoles/nigbt/base width/.initial=.5}
13133 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
13134 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
13135 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
13136 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
13137
13138 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
13139 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
13140 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
13141 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
13142 \ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
13143 \ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
13144 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
13145 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
13146 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
13147 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
13148 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
13149 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
13150 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
13151 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
13152
13153 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
13154 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
13155 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
13156 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
13157 \ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
13158 \ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
13159 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
13160 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
13161 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
13162 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
13163 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
13164 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
13165 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
13166 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
13167
13168 \ctikzset{tripoles/igbt/outer base height/.code={
13169 \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
13170 \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
13171 \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
13172 \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
13173 \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
13174 \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
13175 }}
13176 \ctikzset{tripoles/igbt/outer base thickness/.code={
13177 \ctikzset{tripoles/nigbt/outer base thickness=#1}
13178 \ctikzset{tripoles/pigbt/outer base thickness=#1}
13179 \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
13180 \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
13181 }}
13182
13183 \ctikzset{tripoles/njfet/width/.initial=.7}
13184 \ctikzset{tripoles/njfet/gate height/.initial=.5}
13185 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
13186 \ctikzset{tripoles/njfet/gate width/.initial=.5}
13187 \ctikzset{tripoles/njfet/base width/.initial=.5}
13188 \ctikzset{tripoles/njfet/conn height/.initial=.35}% at the exterior
13189 \ctikzset{tripoles/njfet/union height/.initial=.35}% at the gate
13190 \ctikzset{tripoles/njfet/conn kink/.initial=1}% 1=no kink
13191 \ctikzset{tripoles/njfet/height/.initial=1.1}
13192 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
13193 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
13194 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
13195 \ctikzset{tripoles/njfet/curr direction/.initial=1}
13196
13197 \ctikzset{tripoles/pjfet/width/.initial=.7}
13198 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
13199 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
13200 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
13201 \ctikzset{tripoles/pjfet/base width/.initial=.5}
13202 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
13203 \ctikzset{tripoles/pjfet/union height/.initial=.35}% at the gate
13204 \ctikzset{tripoles/pjfet/conn kink/.initial=1}% 1=no kink
13205 \ctikzset{tripoles/pjfet/height/.initial=1.1}
13206 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
13207 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
13208 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
13209 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
13210
13211 \ctikzset{tripoles/nujt/width/.initial=.7}
13212 \ctikzset{tripoles/nujt/gate height/.initial=.5}
13213 \ctikzset{tripoles/nujt/gate height 2/.initial=.35}
13214 \ctikzset{tripoles/nujt/gate width/.initial=.5}
13215 \ctikzset{tripoles/nujt/base width/.initial=.5}
13216 \ctikzset{tripoles/nujt/conn height/.initial=.35}
13217 \ctikzset{tripoles/nujt/union height/.initial=0}% at the gate
13218 \ctikzset{tripoles/nujt/conn kink/.initial=.82}% to match the circle position
13219 \ctikzset{tripoles/nujt/height/.initial=1.1}
13220 \ctikzset{tripoles/nujt/bodydiode scale/.initial=.3}
13221 \ctikzset{tripoles/nujt/bodydiode distance/.initial=.3}
13222 \ctikzset{tripoles/nujt/bodydiode conn/.initial=.6}
13223 \ctikzset{tripoles/nujt/curr direction/.initial=1}
13224
13225 \ctikzset{tripoles/pujt/width/.initial=.7}
13226 \ctikzset{tripoles/pujt/gate height/.initial=.5}
13227 \ctikzset{tripoles/pujt/gate height 2/.initial=.35}
13228 \ctikzset{tripoles/pujt/gate width/.initial=.5}
13229 \ctikzset{tripoles/pujt/base width/.initial=.5}
13230 \ctikzset{tripoles/pujt/conn height/.initial=.35}
13231 \ctikzset{tripoles/pujt/union height/.initial=0}% at the gate
13232 \ctikzset{tripoles/pujt/conn kink/.initial=.82}% to match the circle position
13233 \ctikzset{tripoles/pujt/height/.initial=1.1}
13234 \ctikzset{tripoles/pujt/bodydiode scale/.initial=.3}
13235 \ctikzset{tripoles/pujt/bodydiode distance/.initial=.3}
13236 \ctikzset{tripoles/pujt/bodydiode conn/.initial=.6}
13237 \ctikzset{tripoles/pujt/curr direction/.initial=-1}
13238
13239 \ctikzset{tripoles/isfet/width/.initial=1}
13240 \ctikzset{tripoles/isfet/gate height/.initial=.35}
13241 \ctikzset{tripoles/isfet/base height/.initial=.5}
13242 \ctikzset{tripoles/isfet/height/.initial=1.1}
13243 \ctikzset{tripoles/isfet/base width/.initial=.3}
13244 \ctikzset{tripoles/isfet/gate width/.initial=.5}
13245 \ctikzset{tripoles/isfet/conn height/.initial=0}
13246 \ctikzset{tripoles/isfet/wave width/.initial=.16}
13247 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
13248 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
13249 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
13250 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
13251 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
13252 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
13253 \ctikzset{tripoles/isfet/curr direction/.initial=1}
13254 %
13255 % graphene FET
13256 %
13257 \ctikzset{tripoles/pgfet/width/.initial=.6}
13258 \ctikzset{tripoles/pgfet/gate height/.initial=.5}
13259 \ctikzset{tripoles/pgfet/gate height 2/.initial=0.25} % must be "gate height"/2
13260 \ctikzset{tripoles/pgfet/base height/.initial=.5} % must be "gate height"
13261 \ctikzset{tripoles/pgfet/outer base height/.initial=.25} % must be "gate height 2"
13262 \ctikzset{tripoles/pgfet/outer base thickness/.initial=1}
13263 \ctikzset{tripoles/pgfet/conn height/.initial=0}
13264 \ctikzset{tripoles/pgfet/height/.initial=1.1}
13265 \ctikzset{tripoles/pgfet/gate width/.initial=.5}
13266 \ctikzset{tripoles/pgfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width)
13267 \ctikzset{tripoles/pgfet/bodydiode scale/.initial=.3}
13268 \ctikzset{tripoles/pgfet/bodydiode distance/.initial=.6}
13269 \ctikzset{tripoles/pgfet/bodydiode conn/.initial=.6}
13270 \ctikzset{tripoles/pgfet/curr direction/.initial=-1}
13271
13272 \ctikzset{tripoles/ngfet/width/.initial=.6}
13273 \ctikzset{tripoles/ngfet/gate height/.initial=.5}
13274 \ctikzset{tripoles/ngfet/gate height 2/.initial=0.25} % must be "gate height"/2
13275 \ctikzset{tripoles/ngfet/base height/.initial=.5} % must be "gate height"
13276 \ctikzset{tripoles/ngfet/outer base height/.initial=.25} % must be "gate height 2"
13277 \ctikzset{tripoles/ngfet/outer base thickness/.initial=1}
13278 \ctikzset{tripoles/ngfet/conn height/.initial=0}
13279 \ctikzset{tripoles/ngfet/height/.initial=1.1}
13280 \ctikzset{tripoles/ngfet/gate width/.initial=.5}
13281 \ctikzset{tripoles/ngfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width)
13282 \ctikzset{tripoles/ngfet/bodydiode scale/.initial=.3}
13283 \ctikzset{tripoles/ngfet/bodydiode distance/.initial=.6}
13284 \ctikzset{tripoles/ngfet/bodydiode conn/.initial=.6}
13285 \ctikzset{tripoles/ngfet/curr direction/.initial=1}
13286 %
13287 % multi-emitter and multi-collector BJTs by Romano Giannetti
13288 %
13289 \ctikzset{tripoles/bjt/emitters/.initial=1}
13290 \ctikzset{tripoles/bjt/collectors/.initial=1}
13291 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
13292 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
13293 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
13294 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
13295 \ctikzset{tripoles/bjt/multi height/.initial=.5}
13296 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
13297 %
13298 \ctikzset{tripoles/bjt/width/.initial=.3}
13299 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
13300 \ctikzset{tripoles/bjt/base height/.initial=1.1}
13301 \ctikzset{tripoles/bjt/height/.initial=.4}
13302 \ctikzset{tripoles/bjt/base width/.initial=1}
13303 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
13304 % do NOT touch these two!
13305 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
13306 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
13307
13308
13309 %
13310 % definitions for transistor circles
13311 %
13312 \ctikzset{transistor circle/.is family}
13313 \ctikzset{transistor circle/relative thickness/.initial=1}
13314 \ctikzset{transistor circle/color/.initial=default}
13315 \ctikzset{transistor circle/dash/.initial=none}
13316 \ctikzset{transistor circle/scale circle radius/.initial=1}
13317 \ctikzset{transistor circle/default base in/.initial=0.9}
13318 \ctikzset{transistor circle/njfet base in/.initial=1.05}
13319 \ctikzset{transistor circle/pjfet base in/.initial=1.05}
13320 \ctikzset{transistor circle/isfet base in/.initial=0.65}
13321
13322 \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse
13323 \ctikzset{tr circle/.is if=pgf@circ@trcircle}
13324 \tikzset{tr circle/.is if=pgf@circ@trcircle}
13325 %%>>>
13326
13327 %% definitions of transistor shapes%<<<
13328 %
13329 % add a circle to the transistor:
13330 %
13331 \def\pgfcirc@transistorcircle{
13332 \ifpgf@circ@trcircle
13333 \pgfscope
13334 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13335 \pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth}
13336 \edef\@@none{none}\edef\@@default{default}
13337 \edef\@@tmp{\ctikzvalof{transistor circle/color}}
13338 \ifx\@@tmp\@@default\else
13339 \pgfsetcolor{\@@tmp}
13340 \fi
13341 \edef\@@tmp{\ctikzvalof{transistor circle/dash}}
13342 \ifx\@@tmp\@@none\else
13343 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
13344 \fi
13345 % radius of the circle
13346 % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2}
13347 % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp}
13348 \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius}
13349 \pgf@circ@draworfill
13350 \endpgfscope
13351 \fi
13352 }
13353
13354 % add a ferroelectric squish to transistors
13355
13356 \def\pgfcirc@ferroelectric#1#2{% #1 -> transistor type, #2 horizontal enlargment (prop to ...@left),
13357 \ifpgf@circuit@tr@ferroel\pgfscope
13358 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13359 \pgf@circ@set@relative@thickness{modifier thickness}
13360 % base-gate center and width of the sigmoid
13361 \pgfmathsetlength{\pgf@circ@res@other}
13362 {0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width}-(#2))*\pgf@circ@res@left}
13363 \pgfmathsetlength{\pgf@circ@res@temp}
13364 {1.2*abs(\ctikzvalof{tripoles/#1/gate width}-\ctikzvalof{tripoles/#1/base width}+0.5*(#2))*\pgf@circ@res@left}
13365 \pgfsetcornersarced{\pgfpoint{-0.2\pgf@circ@res@temp}{-0.2\pgf@circ@res@temp}}
13366 \pgfpathmoveto{\pgfpoint
13367 {\pgf@circ@res@other+\pgf@circ@res@temp}
13368 {1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}}
13369 \pgfpathlineto{\pgfpoint
13370 {\pgf@circ@res@other+\pgf@circ@res@temp}
13371 {0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}}
13372 \pgfpathlineto{\pgfpoint
13373 {\pgf@circ@res@other-\pgf@circ@res@temp}
13374 {0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}}
13375 \pgfpathlineto{\pgfpoint
13376 {\pgf@circ@res@other-\pgf@circ@res@temp}
13377 {1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}}
13378 \pgfusepath{draw}
13379 \endpgfscope\fi
13380 }
13381
13382 \ctikzset{tr gap fill/.initial=none}
13383 \tikzset{tr gap fill/.style={\circuitikzbasekey/tr gap fill={#1}}}
13384 % fill the gap in relevant transistors
13385 \def\pgfcirc@fillgategap#1{% #1 transistor type
13386 \edef\@@@none{none}\edef\@@@color{\ctikzvalof{tr gap fill}}% always exists
13387 \ifx\@@@none\@@@color\relax\else
13388 \begingroup % save the value of @res: other, step, temp
13389 \edef\@@@doit{1}% draw it, set to zero if we give up
13390 % ok, we have the color here. we have to get center position, with and height
13391 % normally is gate height; but in igbt is outer base height (grrrr)
13392 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/outer base height}{
13393 % yes, it's an IGBT
13394 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/outer base height}*\pgf@circ@res@up}
13395 }{
13396 %no. Let's try with gate height
13397 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate height}{
13398 % yes, go for it
13399 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/gate height}*\pgf@circ@res@up}
13400 }{
13401 %no, give up, let value to 0
13402 \edef\@@@doit{0}
13403 }
13404 }
13405 % now we have to find x1 and x2: these are base width and gate width
13406 % if do not have one of that, bail out.
13407 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{
13408 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{tripoles/#1/gate width}*\pgf@circ@res@left}
13409 }{
13410 \edef\@@@doit{0}
13411 }
13412 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/base width}{
13413 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}
13414 }{
13415 \edef\@@@doit{0}
13416 }
13417 % if found, draw it.
13418 \ifnum\@@@doit>0\relax
13419 \pgfscope
13420 \pgfsetfillcolor{\@@@color}
13421 \pgfsetcolor{\@@@color}
13422 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@other}}
13423 \pgfusepath{fill, draw}
13424 \endpgfscope
13425 \fi
13426 \endgroup
13427 \fi
13428 }
13429
13430 \long\def\pgfcircdeclaretransistor#1#2#3{
13431 \pgfdeclareshape{#1}
13432 {
13433 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
13434 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13435 \savedmacro{\circlebase}{
13436 \pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}%
13437 {% yes, we have it
13438 \edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}%
13439 }{% no, use default
13440 \edef\circlebase{\ctikzvalof{transistor circle/default base in}}
13441 }}
13442 % \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}}
13443 \saveddimen{\extrabodydiodelen}{
13444 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13445 \ifpgf@circuit@fet@bodydiode
13446 % try to put the text to the right of the flyback diode
13447 \pgfmathsetlength{\pgf@x}{(
13448 \ctikzvalof{tripoles/#1/bodydiode distance}*
13449 \ctikzvalof{tripoles/#1/width} +
13450 \ctikzvalof{tripoles/#1/bodydiode scale}*
13451 \ctikzvalof{bipoles/diode/height}/2
13452 )*\pgf@circ@scaled@Rlen}
13453 \else
13454 \pgf@x=0pt\relax
13455 \fi
13456 }
13457 \savedmacro{\scalecircleradius}{
13458 \edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}}
13459 }
13460 \saveddimen{\circleradius}{
13461 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13462 % repeat the extrabodydiodelen (grrr)
13463 \ifpgf@circuit@fet@bodydiode
13464 % try to put the text to the right of the flyback diode
13465 \pgfmathsetlength{\pgf@circ@res@other}{(
13466 \ctikzvalof{tripoles/#1/bodydiode distance}*
13467 \ctikzvalof{tripoles/#1/width} +
13468 \ctikzvalof{tripoles/#1/bodydiode scale}*
13469 \ctikzvalof{bipoles/diode/height}/2
13470 )*\pgf@circ@scaled@Rlen}
13471 \else
13472 \pgf@circ@res@other=0pt\relax
13473 \fi
13474 % left
13475 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13476 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
13477 % northeast
13478 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
13479 \pgf@yb=.5\pgf@yb
13480 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
13481 %
13482 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
13483 % find the radius of the circle
13484 \pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
13485 }
13486 \saveddimen{\circleleft}{
13487 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13488 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13489 \pgf@x=\circlebase\pgf@xa
13490 }
13491 \anchor{circle center}{
13492 \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius
13493 }
13494 \savedanchor{\centergap}{% this is the center position between gate and base
13495 % get "left"
13496 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13497 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13498 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{
13499 % yes, we have a separated gate
13500 \pgfmathsetlength{\pgf@x}
13501 {0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width})*\pgf@xa}
13502 }{
13503 % no, use just the base
13504 \pgfmathsetlength{\pgf@x}
13505 {\ctikzvalof{tripoles/#1/base width}*\pgf@xa}
13506 }
13507 \pgf@y=0pt\relax
13508 }
13509 \anchor{centergap}{\centergap}
13510 \anchor{center}{
13511 \pgfpointorigin
13512 }
13513 \savedanchor\northeast{% upper right
13514 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13515 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
13516 \pgf@y=.5\pgf@y
13517 \pgf@x=0pt
13518 }
13519 \savedanchor\left{%center left
13520 \pgf@y=0pt
13521 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13522 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13523 }
13524 \savedanchor\right{
13525 \pgf@x=0pt\pgf@y=0pt
13526 \ifpgf@circ@trcircle
13527 % repeat the \circleradius computation (GRRRR)
13528 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13529 % repeat the extrabodydiodelen (grrr)
13530 \ifpgf@circuit@fet@bodydiode
13531 % try to put the text to the right of the flyback diode
13532 \pgfmathsetlength{\pgf@circ@res@other}{(
13533 \ctikzvalof{tripoles/#1/bodydiode distance}*
13534 \ctikzvalof{tripoles/#1/width} +
13535 \ctikzvalof{tripoles/#1/bodydiode scale}*
13536 \ctikzvalof{bipoles/diode/height}/2
13537 )*\pgf@circ@scaled@Rlen}
13538 \else
13539 \pgf@circ@res@other=0pt\relax
13540 \fi
13541 % left
13542 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13543 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
13544 % northeast
13545 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
13546 \pgf@yb=.5\pgf@yb
13547 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
13548 %
13549 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
13550 % find the radius of the circle
13551 \pgfmathsetlength{\pgf@circ@res@other}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
13552 % repeat the circleleft computation
13553 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
13554 \pgf@xb=\circlebase\pgf@xa
13555 \pgfmathsetlength{\pgf@x}{\pgf@xb+2*\pgf@circ@res@other}
13556 \fi
13557 }
13558 \anchor{text}{
13559 \northeast
13560 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13561 \ifpgf@circuit@transisors@fixlabels
13562 \ifpgf@circuit@fet@bodydiode
13563 \advance \pgf@x by \extrabodydiodelen
13564 \fi
13565 \ifpgf@circ@trcircle
13566 \left\pgf@xa=\pgf@x
13567 \pgfmathsetlength{\pgf@x}{\circleleft+2*\circleradius}
13568 % \advance \pgf@x by \circleradius
13569 \fi
13570 % add a bit of space to avoid central (substrate) terminal if drawn
13571 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
13572 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13573 \else
13574 \pgf@y=.7\pgf@y
13575 \pgf@x= \pgf@circ@scaled@Rlen
13576 \pgf@x=0.1\pgf@x
13577 \fi
13578 }
13579 \anchor{pathstart}{ % south
13580 \northeast
13581 \pgf@y=-\pgf@y
13582 }
13583 \anchor{pathend}{
13584 \northeast
13585 }
13586 \anchor{north}{
13587 \northeast
13588 \pgf@circ@res@step=\pgf@y
13589 \left
13590 \pgf@y=\pgf@circ@res@step
13591 \pgf@x=.5\pgf@x
13592 }
13593 \anchor{west}{
13594 \left
13595 }
13596 \anchor{left}{
13597 \left
13598 }
13599 \anchor{east}{
13600 \northeast
13601 \pgf@y=0pt
13602 }
13603 \anchor{right}{
13604 \right
13605 }
13606 \anchor{south}{
13607 \northeast
13608 \pgf@circ@res@step=\pgf@y
13609 \left
13610 \pgf@y=-\pgf@circ@res@step
13611 \pgf@x=.5\pgf@x
13612 }
13613 \anchor{south west}{
13614 \northeast
13615 \pgf@circ@res@step=\pgf@y
13616 \left
13617 \pgf@y=-\pgf@circ@res@step
13618 }
13619 \anchor{north east}{
13620 \northeast
13621 }
13622 \anchor{north west}{
13623 \northeast
13624 \pgf@circ@res@step=\pgf@y
13625 \left
13626 \pgf@y=\pgf@circ@res@step
13627 }
13628 \anchor{south east}{
13629 \northeast
13630 \pgf@y=-\pgf@y
13631 }
13632 \anchor{B}{
13633 \northeast
13634 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13635 \left
13636 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13637 }
13638 \anchor{base}{
13639 \northeast
13640 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13641 \left
13642 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13643 }
13644 \anchor{bulk}{ %added by Burak Kelleci
13645 \northeast
13646 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13647 \right
13648 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13649 }
13650 \anchor{nobulk}{ %added by Burak Kelleci
13651 \left
13652 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
13653 }
13654 \anchor{G}{
13655 \northeast
13656 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13657 \left
13658 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13659 }
13660 \anchor{gate}{
13661 \northeast
13662 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
13663 \left
13664 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
13665 }
13666 \anchor{nobase}{
13667 \left
13668 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
13669 }
13670 \anchor{circle base}{
13671 \left
13672 \pgf@x=\circlebase\pgf@x
13673 }
13674 \anchor{nogate}{
13675 \left
13676 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
13677 }
13678 \anchor{E}{
13679 \northeast
13680 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13681 }
13682 \anchor{emitter}{
13683 \northeast
13684 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13685 }
13686 \anchor{C}{
13687 \northeast
13688 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13689 }
13690 \anchor{collector}{
13691 \northeast
13692 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13693 }
13694 \anchor{S}{
13695 \northeast
13696 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13697 }
13698 \anchor{source}{
13699 \northeast
13700 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13701 }
13702 \anchor{D}{
13703 \northeast
13704 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13705 }
13706 \anchor{drain}{
13707 \northeast
13708 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13709 }
13710 \anchor{body C in}{
13711 \northeast
13712 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13713 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
13714 }
13715 \anchor{circle C}{
13716 \left
13717 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
13718 \northeast
13719 \pgf@xb=\pgf@x %this is #2 of the circle
13720 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
13721 % the base of the triangle is x_2 - x_1 - r
13722 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
13723 % so let's go with the height
13724 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
13725 % finally, direction
13726 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
13727 }
13728 \anchor{circle E}{
13729 \left
13730 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
13731 \northeast
13732 \pgf@xb=\pgf@x %this is #2 of the circle
13733 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
13734 % the base of the triangle is x_2 - x_1 - r
13735 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
13736 % so let's go with the height
13737 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
13738 % finally, direction
13739 % finally, direction
13740 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
13741 }
13742 \anchor{body E in}{
13743 \northeast
13744 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13745 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
13746 }
13747 \anchor{body C out}{
13748 \northeast
13749 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13750 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
13751 \pgf@y=\pgf@ya
13752 \left
13753 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
13754 \pgf@y=\pgf@ya
13755 }
13756 \anchor{body E out}{
13757 \northeast
13758 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
13759 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
13760 \pgf@y=\pgf@ya
13761 \left
13762 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
13763 \pgf@y=\pgf@ya
13764 }
13765 #2
13766 \backgroundpath{
13767 \pgftransformationadjustments
13768 \pgfsetcolor{\ctikzvalof{color}}
13769 %
13770 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
13771 \pgf@circuit@trans@ntypetrue
13772 \else
13773 \pgf@circuit@trans@ntypefalse
13774 \fi
13775 \northeast
13776 \pgf@circ@res@up = \pgf@y
13777 \pgf@circ@res@down = -\pgf@y
13778 \pgf@circ@res@right = \pgf@x
13779 \left
13780 \pgf@circ@res@left = \pgf@x
13781 \pgf@circ@scaled@Rlen=\scaledRlen
13782 %
13783 #3
13784 % BODY DIODE
13785 \ifpgf@circuit@fet@bodydiode
13786 \drawbodydiode{#1}
13787 \fi
13788 %
13789 }
13790 }
13791 }
13792
13793 \long\def\drawbodydiode#1{
13794 \pgfscope
13795 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
13796 \pgftransformrotate{90}
13797 % diode scale and bodydiode scale interacts. We want the size of the diode
13798 % proportional to the transistor, so we will:
13799 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
13800 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
13801 \pgftransformscale{\@@BDscale}
13802 \ifpgf@circuit@fulldiode
13803 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
13804 \else
13805 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
13806 \fi
13807 \endpgfscope
13808 % Draw stroke line
13809 \ifpgf@circuit@strokediode
13810 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
13811 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
13812 \pgfusepath{stroke}
13813 \fi
13814 %Draw upper connection to body diode
13815 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
13816 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
13817 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
13818 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
13819 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
13820 \pgfusepath{draw}
13821 \pgfscope
13822 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
13823 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
13824 \pgftransformscale{0.5}
13825 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
13826 \endpgfscope{}
13827 %Draw lower connection to body diode
13828 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
13829 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
13830 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
13831 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
13832 \pgfusepath{draw}
13833 \pgfscope
13834 \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
13835 \pgftransformscale{0.5}
13836 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
13837 \endpgfscope
13838 }
13839
13840 \long\def\declarebpt#1{
13841 \pgfcircdeclaretransistor{#1}{
13842 \anchor{inner up}{
13843 \northeast
13844 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
13845 }
13846 \anchor{inner down}{
13847 \northeast
13848 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
13849 }
13850 }{
13851
13852 % add the circle if requested (before everything else, so we can fill it)
13853 \pgfcirc@transistorcircle
13854
13855 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13856 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13857 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
13858 \pgfpathlineto{\pgfpoint
13859 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13860 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
13861 \pgfusepath{draw}
13862
13863 % drawing base
13864 \pgfscope
13865 \pgfpathmoveto{\pgfpoint
13866 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13867 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
13868 \pgfpathlineto{\pgfpoint
13869 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13870 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
13871 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13872 \ifpgf@circuit@bpt@schottky
13873 % upper
13874 \pgfpathmoveto{\pgfpoint
13875 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13876 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
13877 \pgfpathlineto{\pgfpoint
13878 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13879 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
13880 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
13881 \pgfpathlineto{\pgfpoint
13882 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
13883 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
13884 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
13885 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
13886 \pgfpathlineto{\pgfpoint
13887 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
13888 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
13889 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
13890 % % lower
13891 \pgfpathmoveto{\pgfpoint
13892 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13893 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
13894 \pgfpathlineto{\pgfpoint
13895 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13896 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
13897 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
13898 \pgfpathlineto{\pgfpoint
13899 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
13900 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
13901 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
13902 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
13903 \pgfpathlineto{\pgfpoint
13904 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
13905 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
13906 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
13907 \fi
13908 \pgfusepath{draw}
13909 \endpgfscope
13910
13911 \pgfpathmoveto{\pgfpoint
13912 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13913 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
13914 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13915 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
13916 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13917 \pgfusepath{draw}
13918 %draw arrow depending on type of transistor
13919 \pgfscope
13920 \pgfslopedattimetrue
13921 \pgfallowupsidedownattimetrue
13922 \pgfresetnontranslationattimefalse
13923 \edef\@@anchor{center}
13924 \ifpgf@circuit@trans@ntype
13925 \ifpgf@circuit@trans@arrowatend
13926 \edef\@@anchor{btip}
13927 \pgftransformlineattime{1.0}{%
13928 \pgfpoint%
13929 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13930 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
13931 }{%
13932 \pgfpoint{\pgf@circ@res@right}%
13933 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
13934 }
13935 \else
13936 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
13937 \pgfpoint%
13938 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13939 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
13940 }{%
13941 \pgfpoint{\pgf@circ@res@right}%
13942 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
13943 }
13944 \fi
13945 \else % p-type
13946 \ifpgf@circuit@trans@arrowatend
13947 \edef\@@anchor{tip}
13948 \pgftransformlineattime{1.0}{%
13949 \pgfpoint{\pgf@circ@res@right}%
13950 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
13951 }{%
13952 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13953 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
13954 }
13955 \else
13956 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
13957 \pgfpoint{\pgf@circ@res@right}%
13958 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
13959 }{%
13960 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
13961 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
13962 }
13963 \fi
13964 \fi
13965 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13966 \endpgfscope
13967
13968 \ifpgf@circuit@bpt@drawphoto
13969 \pgfscope
13970 \pgfsetarrowsstart{latexslim}
13971 \pgfpathmoveto{\pgfpointadd{\pgfpoint
13972 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13973 {\pgf@circ@res@up+\pgf@circ@res@down}}
13974 {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
13975 \pgfpathlineto{\pgfpointadd{\pgfpoint
13976 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13977 {\pgf@circ@res@up+\pgf@circ@res@down}}
13978 {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}}
13979 \pgfusepath{draw}
13980 \pgfpathmoveto{\pgfpointadd{\pgfpoint
13981 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13982 {\pgf@circ@res@up+\pgf@circ@res@down}}
13983 {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}}
13984 \pgfpathlineto{\pgfpointadd{\pgfpoint
13985 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13986 {\pgf@circ@res@up+\pgf@circ@res@down}}
13987 {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
13988 \pgfusepath{draw}
13989 \endpgfscope
13990 \else
13991 \ifpgf@circuit@bpt@drawbase
13992 \pgfpathmoveto{\pgfpoint
13993 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
13994 {\pgf@circ@res@up+\pgf@circ@res@down}}
13995 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
13996 \pgfusepath{draw}
13997 \fi
13998 \fi
13999 }
14000 }
14001
14002 \declarebpt{npn}
14003 \declarebpt{pnp}
14004 %
14005 % multi-emitter and multi-collector BJTs by Romano Giannetti
14006 %
14007 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
14008 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
14009 \pgfextracty{\pgf@circ@res@other}{\basedimension}
14010 \ifnum\cdir>0 % NPN, above
14011 \pgfpoint{\pgf@circ@res@temp}{%
14012 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
14013 \else % PNP, below
14014 \pgfpoint{\pgf@circ@res@temp}{%
14015 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
14016 \fi
14017 }
14018 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
14019 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
14020 \pgfextracty{\pgf@circ@res@other}{\basedimension}
14021 \ifnum\cdir<0 % PNP, above
14022 \pgfpoint{\pgf@circ@res@temp}{%
14023 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
14024 \else % PNP, below
14025 \pgfpoint{\pgf@circ@res@temp}{%
14026 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
14027 \fi
14028 }
14029
14030 \long\def\declarebjt#1{
14031 \pgfdeclareshape{bjt#1}{
14032 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
14033 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14034 % \cdir is 1 for npn, -1 for pnp
14035 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
14036 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
14037 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
14038 % step up or down for the additional C/Es
14039 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
14040 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
14041 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
14042 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
14043 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
14044 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
14045 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14046 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
14047 \pgf@y=.5\pgf@y
14048 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
14049 \pgf@x=.5\pgf@x
14050 }
14051 \savedanchor\northeast{% upper right
14052 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14053 \pgfmathsetlength{\pgf@circ@res@step}{%
14054 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
14055 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14056 \ifnum\cdir> 0
14057 \edef\numup{\numC}\edef\numdown{\numE}
14058 \else
14059 \edef\numup{\numE}\edef\numdown{\numC}
14060 \fi
14061 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
14062 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
14063 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14064 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
14065 \pgf@x=.5\pgf@x
14066 }
14067 \savedanchor\southeast{% lower right
14068 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14069 \pgfmathsetlength{\pgf@circ@res@step}{%
14070 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
14071 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14072 \ifnum\cdir> 0
14073 \edef\numup{\numC}\edef\numdown{\numE}
14074 \else
14075 \edef\numup{\numE}\edef\numdown{\numC}
14076 \fi
14077 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
14078 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
14079 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14080 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
14081 \pgf@x=.5\pgf@x
14082 }
14083 \savedanchor\southwest{% lower left
14084 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14085 \pgfmathsetlength{\pgf@circ@res@step}{%
14086 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
14087 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14088 \ifnum\cdir> 0
14089 \edef\numup{\numC}\edef\numdown{\numE}
14090 \else
14091 \edef\numup{\numE}\edef\numdown{\numC}
14092 \fi
14093 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
14094 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
14095 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14096 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
14097 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14098 }
14099 \anchor{center}{\pgfpointorigin}
14100 \anchor{north}{\northeast\pgf@x=0cm\relax}
14101 \anchor{east}{\northeast\pgf@y=0cm\relax}
14102 \anchor{south}{\southwest\pgf@x=0cm\relax}
14103 \anchor{west}{\southwest\pgf@y=0cm}
14104 \anchor{north east}{\northeast}
14105 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
14106 \anchor{south west}{\southwest}
14107 \anchor{south east}{\southeast}
14108
14109 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
14110 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
14111 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
14112 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
14113 % center of the base "bar"
14114 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
14115 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
14116 }
14117 % geometrical centers
14118 \anchor{vcenter}{\pgf@x=0cm\relax
14119 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
14120 }
14121 \anchor{gcenter}{%
14122 \northeast\pgf@xa=0.5\pgf@x
14123 \southwest\advance\pgf@xa by 0.5\pgf@x
14124 \pgf@x=\pgf@xa
14125 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
14126 }
14127 % external connections
14128 \anchor{E}{
14129 \ifnum\cdir>0% npn, emitter down
14130 \southeast
14131 \else
14132 \northeast
14133 \fi
14134 }% first emitter
14135 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
14136 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
14137 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
14138
14139 \backgroundpath{
14140 \pgftransformationadjustments
14141 \pgfsetcolor{\ctikzvalof{color}}
14142 %
14143 % set the type and up and down number of connections
14144 %
14145 \ifnum\cdir> 0
14146 \pgf@circuit@trans@ntypetrue
14147 \edef\numup{\numC}
14148 \edef\numdown{\numE}
14149 \else
14150 \pgf@circuit@trans@ntypefalse
14151 \edef\numup{\numE}
14152 \edef\numdown{\numC}
14153 \fi
14154 \basedimension
14155 \pgf@circ@res@up = \pgf@y
14156 \pgf@circ@res@down = -\pgf@y
14157 \pgf@circ@res@right = \pgf@x
14158 \pgf@circ@res@left = -\pgf@x
14159 \pgf@circ@scaled@Rlen=\scaledRlen
14160 \pgf@circ@res@step=\multistep
14161 %
14162 % set arrow positions options
14163 %
14164 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
14165 \ifpgf@circuit@trans@arrowatend
14166 \edef\@@pos{1.0}
14167 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
14168 \edef\@@anchor{btip}
14169 \else
14170 \edef\@@anchor{tip}
14171 \fi
14172 \fi
14173 %
14174 % Drawing upper connections
14175 %
14176 \pgfscope
14177 \pgf@circ@count@a=\numup\relax
14178 \pgfmathloop%
14179 \ifnum\pgf@circ@count@a>0
14180 \advance\pgf@circ@count@a-1\relax
14181 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
14182 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
14183 \pgfpathmoveto{\pgfpoint
14184 {\pgf@circ@res@right}%
14185 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
14186 \pgfpathlineto{\pgfpoint
14187 {\pgf@circ@res@right}%
14188 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
14189 \else
14190 \pgfpathmoveto{\pgfpoint
14191 {\pgf@circ@res@right}%
14192 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
14193 \fi
14194 \pgfpathlineto{\pgfpoint
14195 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
14196 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
14197 \pgfsetroundcap % better when connecting to sloped lines
14198 \pgfusepath{draw}
14199 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
14200 \pgfscope
14201 \pgfslopedattimetrue
14202 \pgfallowupsidedownattimetrue
14203 \pgfresetnontranslationattimefalse
14204 \pgftransformlineattime{\@@pos}{%
14205 \pgfpoint
14206 {\pgf@circ@res@right}%
14207 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
14208 }{\pgfpoint
14209 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
14210 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
14211 }
14212 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14213 \endpgfscope
14214 \fi
14215 \repeatpgfmathloop
14216 \endpgfscope
14217 %
14218 % Drawing base
14219 %
14220 \pgfscope
14221 \pgfpathmoveto{\pgfpoint
14222 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14223 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
14224 \pgfpathlineto{\pgfpoint
14225 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14226 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
14227 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14228 \ifpgf@circuit@bpt@schottky
14229 % upper
14230 \pgfpathmoveto{\pgfpoint
14231 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14232 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
14233 \pgfpathlineto{\pgfpoint
14234 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14235 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
14236 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14237 \pgfpathlineto{\pgfpoint
14238 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
14239 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14240 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
14241 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14242 \pgfpathlineto{\pgfpoint
14243 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
14244 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14245 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
14246 % lower
14247 \pgfpathmoveto{\pgfpoint
14248 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14249 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
14250 \pgfpathlineto{\pgfpoint
14251 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14252 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
14253 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14254 \pgfpathlineto{\pgfpoint
14255 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
14256 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14257 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
14258 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
14259 \pgfpathlineto{\pgfpoint
14260 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
14261 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
14262 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
14263 \fi
14264 \pgfsetroundcap % I like it more...
14265 \pgfusepath{draw}
14266 \endpgfscope
14267 %
14268 % draw base external connection
14269 %
14270 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
14271 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
14272 \pgfusepath{draw}
14273 %
14274 % Drawing lower connections
14275 %
14276 \pgfscope
14277 \pgf@circ@count@a=\numdown\relax
14278 \pgfmathloop%
14279 \ifnum\pgf@circ@count@a>0
14280 \advance\pgf@circ@count@a-1\relax
14281 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
14282 \pgfpathmoveto{\pgfpoint
14283 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
14284 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
14285 \pgfpathlineto{\pgfpoint
14286 {\pgf@circ@res@right}
14287 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
14288 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
14289 \pgfpathlineto{\pgfpoint
14290 {\pgf@circ@res@right}
14291 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
14292 \fi
14293 \pgfsetroundcap % better when connecting to sloped lines
14294 \pgfusepath{draw}
14295 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
14296 \pgfscope
14297 \pgfslopedattimetrue
14298 \pgfallowupsidedownattimetrue
14299 \pgfresetnontranslationattimefalse
14300 \pgftransformlineattime{\@@pos}{%
14301 \pgfpoint
14302 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
14303 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
14304 }{\pgfpoint
14305 {\pgf@circ@res@right}%
14306 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
14307 }
14308 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14309 \endpgfscope
14310 \fi
14311 \repeatpgfmathloop
14312 \endpgfscope
14313 }
14314 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
14315 % and is executed just before a node is drawn.
14316 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
14317 % Start with the maximum collector number and go backwards.
14318 \pgf@circ@count@a=\numC\relax
14319 \pgfmathloop%
14320 \ifnum\pgf@circ@count@a>0
14321 % we will create two anchors per pin: the "normal one" like `pin 1` for the
14322 % electrical contact, and the "border one" like `bpin 1` for labels.
14323 % they will coincide if `external pins width` is set to 0.
14324 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
14325 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
14326 }
14327 \advance\pgf@circ@count@a by -1\relax%
14328 \repeatpgfmathloop%
14329 % and emitters
14330 \pgf@circ@count@a=\numE\relax
14331 \pgfmathloop%
14332 \ifnum\pgf@circ@count@a>0
14333 % we will create two anchors per pin: the "normal one" like `pin 1` for the
14334 % electrical contact, and the "border one" like `bpin 1` for labels.
14335 % they will coincide if `external pins width` is set to 0.
14336 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
14337 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
14338 }
14339 \advance\pgf@circ@count@a by -1\relax%
14340 \repeatpgfmathloop%
14341 }%
14342 }
14343 }
14344
14345 \declarebjt{npn}
14346 \declarebjt{pnp}
14347
14348 % end of multi-bjts
14349
14350 \long\def\declareigbt#1{
14351 \pgfcircdeclaretransistor{#1}{
14352 \anchor{inner up}{
14353 \northeast
14354 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
14355 }
14356 \anchor{inner down}{
14357 \northeast
14358 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
14359 }
14360 \anchor{nobase}{
14361 \left
14362 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
14363 }
14364 }
14365 {
14366 % add the circle if requested (before everything else, so we can fill it)
14367 \pgfcirc@transistorcircle
14368 % fill the gap color if requested
14369 \pgfcirc@fillgategap{#1}
14370 %draw upper connection
14371 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14372 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14373 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
14374 \pgfpathlineto{\pgfpoint
14375 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14376 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
14377 \pgfusepath{draw}
14378
14379 %draw thicker gate lines
14380 \pgfscope
14381 \pgfscope
14382 \pgfpathmoveto{\pgfpoint
14383 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14384 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14385 \pgfpathlineto{\pgfpoint
14386 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14387 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14388 % set the normal thickness
14389 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14390 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
14391 \pgfsetlinewidth{\@@extrat\pgflinewidth}
14392 \pgfusepath{draw}
14393 \endpgfscope
14394 \pgfpathmoveto{\pgfpoint
14395 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14396 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14397 \pgfpathlineto{\pgfpoint
14398 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14399 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14400 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14401 \pgfusepath{draw}
14402 \endpgfscope
14403 %draw lower connection
14404 \pgfpathmoveto{\pgfpoint
14405 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14406 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
14407 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14408 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
14409 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14410 \pgfusepath{draw}
14411 %draw arrow depending on type of transistor
14412 \pgfscope
14413 \pgfslopedattimetrue
14414 \pgfallowupsidedownattimetrue
14415 \pgfresetnontranslationattimefalse
14416 \ifpgf@circuit@trans@arrowatend
14417 \ifpgf@circuit@trans@ntype
14418 \edef\@@anchor{btip}\edef\@@pos{1.0}
14419 \else
14420 \edef\@@anchor{tip}\edef\@@pos{1.0}
14421 \fi
14422 \else
14423 \edef\@@anchor{center}\edef\@@pos{0.5}
14424 \fi
14425 \ifpgf@circuit@trans@ntype
14426 \pgftransformlineattime{\@@pos}{%
14427 \pgfpoint%
14428 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14429 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
14430 }{%
14431 \pgfpoint{\pgf@circ@res@right}%
14432 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
14433 }
14434 \else
14435 \pgftransformlineattime{\@@pos}{%
14436 \pgfpoint{\pgf@circ@res@right}%
14437 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
14438 }{%
14439 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14440 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
14441 }
14442 \fi
14443 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14444 \endpgfscope
14445 %draw gate
14446 \ifpgf@circuit@bpt@drawgate
14447 \ifpgf@circuit@trans@ntype
14448 \pgfpathmoveto{\pgfpoint
14449 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14450 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14451 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
14452 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14453 \else
14454 \pgfpathmoveto{\pgfpoint
14455 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14456 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
14457 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
14458 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
14459 \fi
14460 \fi
14461 \pgfusepath{draw}
14462 }
14463 }
14464
14465 \declareigbt{pigbt}
14466 \declareigbt{nigbt}
14467 \declareigbt{Lnigbt}
14468 \declareigbt{Lpigbt}
14469
14470 % Graphene FET, See https://github.com/circuitikz/circuitikz/issues/496
14471 \long\def\declaregfet#1{
14472 \pgfcircdeclaretransistor{#1}{
14473 \anchor{inner up}{
14474 \northeast
14475 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
14476 }
14477 \anchor{inner down}{
14478 \northeast
14479 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
14480 }
14481 \anchor{outer hex up}{
14482 \left
14483 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
14484 \northeast
14485 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
14486 \pgf@x=-\pgf@xa
14487 }
14488 \anchor{outer hex down}{
14489 \left
14490 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
14491 \northeast
14492 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
14493 \pgf@y=-\pgf@y
14494 \pgf@x=-\pgf@xa
14495 }
14496 \anchor{inner hex up}{
14497 \left
14498 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
14499 \northeast
14500 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
14501 \pgf@x=\pgf@xa
14502 }
14503 \anchor{inner hex down}{
14504 \left
14505 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
14506 \northeast
14507 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
14508 \pgf@y=-\pgf@y
14509 \pgf@x=\pgf@xa
14510 }
14511 \anchor{right}{
14512 \northeast\pgf@y=0pt\relax
14513 \pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}*
14514 \ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen}
14515 \advance \pgf@x by \pgf@xa
14516 }
14517 \anchor{text}{% need a different text: no circle, shift to the right
14518 \northeast
14519 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14520 \ifpgf@circuit@transisors@fixlabels
14521 \ifpgf@circuit@fet@bodydiode
14522 \advance \pgf@x by \extrabodydiodelen
14523 \else
14524 \pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}*
14525 \ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen}
14526 \advance \pgf@x by \pgf@xa
14527 \fi
14528 % no circle for gfets
14529 % add a bit of space to avoid central (substrate) terminal if drawn
14530 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
14531 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14532 \else
14533 \pgf@y=.7\pgf@y
14534 \pgf@x= \pgf@circ@scaled@Rlen
14535 \pgf@x=0.1\pgf@x
14536 \fi
14537 }
14538 }
14539 {
14540 % no circle for gfets (clearly!)
14541 %draw upper connection to hexagon
14542 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14543 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14544 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
14545 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
14546 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
14547 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14548 \pgfusepath{draw}
14549 % draw (fillable) hexagon
14550 \pgfscope
14551 \pgfpathmoveto{\pgfpoint
14552 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14553 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
14554 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14555 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
14556 \pgfpathlineto{\pgfpoint
14557 {-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14558 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
14559 \pgfpathlineto{\pgfpoint
14560 {-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14561 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
14562 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14563 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
14564 \pgfpathlineto{\pgfpoint
14565 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14566 {-\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
14567 \pgfpathclose
14568 \pgf@circ@draworfill
14569 \endpgfscope
14570 %draw thicker gate lines
14571 \pgfscope
14572 \pgfscope
14573 \pgfpathmoveto{\pgfpoint
14574 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14575 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14576 \pgfpathlineto{\pgfpoint
14577 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14578 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14579 % set the normal thickness
14580 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14581 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
14582 \pgfsetlinewidth{\@@extrat\pgflinewidth}
14583 \pgfusepath{draw}
14584 \endpgfscope
14585 \pgfpathmoveto{\pgfpoint
14586 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14587 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14588 \pgfpathlineto{\pgfpoint
14589 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
14590 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
14591 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14592 \pgfusepath{draw}
14593 \endpgfscope
14594 %draw arrow depending on type of transistor
14595 \pgfscope
14596 \pgfslopedattimetrue
14597 \pgfallowupsidedownattimetrue
14598 \pgfresetnontranslationattimefalse
14599 \ifpgf@circuit@trans@arrowatend
14600 \ifpgf@circuit@trans@ntype
14601 \edef\@@anchor{btip}\edef\@@pos{1.0}
14602 \else
14603 \edef\@@anchor{tip}\edef\@@pos{1.0}
14604 \fi
14605 \else
14606 \edef\@@anchor{center}\edef\@@pos{0.5}
14607 \fi
14608 \ifpgf@circuit@trans@ntype
14609 \pgftransformlineattime{\@@pos}{%
14610 \pgfpoint%
14611 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14612 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
14613 }{%
14614 \pgfpoint{\pgf@circ@res@right}%
14615 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
14616 }
14617 \else
14618 \pgftransformlineattime{\@@pos}{%
14619 \pgfpoint{\pgf@circ@res@right}%
14620 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
14621 }{%
14622 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
14623 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
14624 }
14625 \fi
14626 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
14627 \endpgfscope
14628 %draw gate
14629 \ifpgf@circuit@trans@ntype
14630 \pgfpathmoveto{\pgfpoint
14631 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14632 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14633 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
14634 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
14635 \else
14636 \pgfpathmoveto{\pgfpoint
14637 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
14638 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
14639 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
14640 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
14641 \fi
14642 \pgfusepath{draw}
14643 }
14644 }
14645
14646 \declaregfet{pgfet}
14647 \declaregfet{ngfet}
14648
14649 % Plain MOSes
14650
14651 \pgfcircdeclaretransistor{nmos}{
14652 \anchor{inner up}{
14653 \northeast
14654 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
14655 }
14656 \anchor{inner down}{
14657 \northeast
14658 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
14659 }
14660 }{%
14661 % add the circle if requested (before everything else, so we can fill it)
14662 \pgfcirc@transistorcircle
14663 % fill the gap color if requested
14664 \pgfcirc@fillgategap{nmos}
14665
14666 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14667 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14668 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
14669 \pgfpathlineto{\pgfpoint
14670 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14671 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
14672
14673 \pgfpathmoveto{\pgfpoint
14674 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14675 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
14676 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14677 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
14678 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14679 \pgfusepath{draw}
14680
14681 \pgfscope
14682 \pgfpathmoveto{\pgfpoint
14683 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14684 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
14685 \pgfpathlineto{\pgfpoint
14686 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14687 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
14688 \pgfpathmoveto{\pgfpoint
14689 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
14690 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
14691 \pgfpathlineto{\pgfpoint
14692 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
14693 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
14694 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14695 \pgfusepath{draw}
14696 \endpgfscope
14697 \ifpgf@circuit@mos@arrows
14698 \pgfscope
14699 \ifpgf@circuit@trans@arrowatend
14700 \pgftransformshift{\pgfpoint
14701 {\pgf@circ@res@right}%
14702 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
14703 }
14704 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
14705 \else
14706 \pgfslopedattimetrue
14707 \pgfallowupsidedownattimetrue
14708 \pgfresetnontranslationattimefalse
14709 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
14710 \pgfpoint%
14711 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
14712 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
14713 }{%
14714 \pgfpoint
14715 {\pgf@circ@res@right}%
14716 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
14717 }
14718 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
14719 \fi
14720 \endpgfscope
14721 \fi
14722
14723 \ifpgf@circuit@bpt@drawgate
14724 \pgfpathmoveto{\pgfpoint
14725 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
14726 {\pgf@circ@res@up+\pgf@circ@res@down}}
14727 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
14728 \pgfusepath{draw}
14729 \fi
14730
14731 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
14732 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
14733 {\pgf@circ@res@up+\pgf@circ@res@down}}
14734 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
14735 {\pgf@circ@res@up+\pgf@circ@res@down}}
14736 \pgfusepath{draw}
14737 \fi
14738
14739 \pgfcirc@ferroelectric{nmos}{0}
14740 }
14741
14742 \pgfcircdeclaretransistor{pmos}{
14743 \anchor{inner up}{
14744 \northeast
14745 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
14746 }
14747 \anchor{inner down}{
14748 \northeast
14749 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
14750 }
14751 }{%
14752 % add the circle if requested (before everything else, so we can fill it)
14753 \pgfcirc@transistorcircle
14754 % fill the gap color if requested
14755 \pgfcirc@fillgategap{nmos}
14756
14757 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14758 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14759 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
14760 \pgfpathlineto{\pgfpoint
14761 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
14762 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
14763 \pgfusepath{draw}
14764
14765 \ifpgf@circuit@mos@arrows
14766 \pgfscope
14767 \ifpgf@circuit@trans@arrowatend
14768 \pgftransformshift{\pgfpoint
14769 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
14770 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
14771 }
14772 \pgftransformrotate{180}
14773 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
14774 \else
14775 \pgfslopedattimetrue
14776 \pgfallowupsidedownattimetrue
14777 \pgfresetnontranslationattimefalse
14778 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
14779 \pgfpoint%
14780 {\pgf@circ@res@right}%
14781 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
14782 }{%
14783 \pgfpoint
14784 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
14785 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
14786 }
14787 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
14788 \fi
14789 \endpgfscope
14790 \fi
14791
14792 \pgfscope
14793 \pgfpathmoveto{\pgfpoint
14794 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
14795 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
14796 \pgfpathlineto{\pgfpoint
14797 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
14798 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
14799 \pgfpathmoveto{\pgfpoint
14800 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
14801 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
14802 \pgfpathlineto{\pgfpoint
14803 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
14804 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
14805 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14806 \pgfusepath{draw}
14807 \endpgfscope
14808
14809 \pgfpathmoveto{\pgfpoint
14810 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
14811 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
14812 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14813 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
14814 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14815
14816
14817 \pgfusepath{draw}
14818 \ifpgf@circuit@bpt@drawgate
14819 \pgfpathmoveto{\pgfpoint
14820 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
14821 {\pgf@circ@res@up+\pgf@circ@res@down}}
14822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
14823 \pgfusepath{draw}
14824 \fi
14825
14826 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
14827 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
14828 {\pgf@circ@res@up+\pgf@circ@res@down}}
14829 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
14830 {\pgf@circ@res@up+\pgf@circ@res@down}}
14831 \pgfusepath{draw}
14832 \fi
14833
14834 \ifpgf@circuit@pmos@nocircle\else
14835 % we are not scaling the circle with the MOS --- I think it's better to have it
14836 % coherent with the poles/nodes of the rest of the circuit.
14837 \pgfpathcircle{\pgfpoint
14838 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
14839 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
14840 \ifpgf@circuit@pmos@emptycircle
14841 \pgfsetfillcolor{white}
14842 \fi
14843 \pgfusepath{draw,fill}
14844 \fi
14845
14846 \pgfcirc@ferroelectric{pmos}{0}
14847 }
14848
14849 %%% depletion MOSFET (simplified symbols)
14850
14851 \long\def\pgfcirc@filldraw@depletion#1{%
14852 \ifx\tikz@fillcolor\pgfutil@empty
14853 % if there is no explicit fill check the specific key
14854 \edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}%
14855 \ifx\@@tmp\@@none % if it's none
14856 \pgfusepath{draw}%
14857 \else
14858 \edef\@@default{default}%
14859 \ifx\@@tmp\@@default % fill with the pen color
14860 \pgfusepath{draw, fill}%
14861 \else
14862 \pgfsetfillcolor{\@@tmp}%
14863 \pgfusepath{draw, fill}%
14864 \fi
14865 \fi
14866 \else
14867 \pgfsetfillcolor{\tikz@fillcolor}%
14868 \pgfusepath{draw, fill}%
14869 \fi
14870 }
14871
14872 \pgfcircdeclaretransistor{nmosd}{
14873 \anchor{inner up}{
14874 \northeast
14875 \pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
14876 }
14877 \anchor{inner down}{
14878 \northeast
14879 \pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
14880 }
14881 \anchor{nobulk}{ %override
14882 \left
14883 \pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x
14884 \pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x
14885 \advance\pgf@x by -\pgf@circ@res@temp
14886 }
14887 }{%
14888 % draw depletion channel
14889 % add the circle if requested (before everything else, so we can fill it)
14890 \pgfcirc@transistorcircle
14891 % fill the gap color if requested
14892 \pgfcirc@fillgategap{nmos}
14893 \pgfscope
14894 \pgfpathrectanglecorners
14895 {\pgfpoint
14896 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
14897 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
14898 {\pgfpoint
14899 {(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left}
14900 {-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
14901 \pgfcirc@filldraw@depletion{nmosd}
14902 \endpgfscope
14903 % draw drain and source terminals
14904 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14905 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
14906 \pgfpathlineto{\pgfpoint
14907 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
14908 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
14909
14910 \pgfpathmoveto{\pgfpoint
14911 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
14912 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
14913 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
14914 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
14915 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
14916 \pgfusepath{draw}
14917
14918 \pgfscope
14919 \pgfpathmoveto{\pgfpoint
14920 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
14921 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}}
14922 \pgfpathlineto{\pgfpoint
14923 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
14924 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}}
14925 \pgfpathmoveto{\pgfpoint
14926 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
14927 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
14928 \pgfpathlineto{\pgfpoint
14929 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
14930 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
14931 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14932 \pgfusepath{draw}
14933 \endpgfscope
14934 \ifpgf@circuit@mos@arrows
14935 \pgfscope
14936 \ifpgf@circuit@trans@arrowatend
14937 \pgftransformshift{\pgfpoint
14938 {\pgf@circ@res@right}%
14939 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}%
14940 }
14941 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
14942 \else
14943 \pgfslopedattimetrue
14944 \pgfallowupsidedownattimetrue
14945 \pgfresetnontranslationattimefalse
14946 \pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{%
14947 \pgfpoint%
14948 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}%
14949 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
14950 }{%
14951 \pgfpoint
14952 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
14953 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
14954 }
14955 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
14956 \fi
14957 \endpgfscope
14958 \fi
14959
14960 \ifpgf@circuit@bpt@drawgate
14961 \pgfpathmoveto{\pgfpoint
14962 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
14963 {\pgf@circ@res@up+\pgf@circ@res@down}}
14964 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
14965 \pgfusepath{draw}
14966 \fi
14967
14968 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
14969 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
14970 {\pgf@circ@res@up+\pgf@circ@res@down}}
14971 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
14972 {\pgf@circ@res@up+\pgf@circ@res@down}}
14973 \pgfusepath{draw}
14974 \fi
14975
14976 \pgfcirc@ferroelectric{nmosd}{\ctikzvalof{tripoles/nmosd/depletion width}}
14977 }
14978
14979 \pgfcircdeclaretransistor{pmosd}{
14980 \anchor{inner up}{
14981 \northeast
14982 \pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
14983 }
14984 \anchor{inner down}{
14985 \northeast
14986 \pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
14987 }
14988 \anchor{nobulk}{ %override
14989 \left
14990 \pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x
14991 \pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x
14992 \advance\pgf@x by -\pgf@circ@res@temp
14993 }
14994 }{%
14995 % add the circle if requested (before everything else, so we can fill it)
14996 \pgfcirc@transistorcircle
14997 % fill the gap color if requested
14998 \pgfcirc@fillgategap{nmos}
14999 % draw depletion channel
15000 \pgfscope
15001 \pgfpathrectanglecorners
15002 {\pgfpoint
15003 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15004 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15005 {\pgfpoint
15006 {(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left}
15007 {-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15008 \pgfcirc@filldraw@depletion{pmosd}
15009 \endpgfscope
15010 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15011 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15012 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15013 \pgfpathlineto{\pgfpoint
15014 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15015 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15016 \pgfusepath{draw}
15017
15018 \ifpgf@circuit@mos@arrows
15019 \pgfscope
15020 \ifpgf@circuit@trans@arrowatend
15021 \pgftransformshift{\pgfpoint
15022 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
15023 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
15024 }
15025 \pgftransformrotate{180}
15026 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
15027 \else
15028 \pgfslopedattimetrue
15029 \pgfallowupsidedownattimetrue
15030 \pgfresetnontranslationattimefalse
15031 \pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{%
15032 \pgfpoint%
15033 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
15034 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
15035 }{%
15036 \pgfpoint
15037 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}%
15038 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
15039 }
15040 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
15041 \fi
15042 \endpgfscope
15043 \fi
15044
15045 \pgfscope
15046 \pgfpathmoveto{\pgfpoint
15047 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15048 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}}
15049 \pgfpathlineto{\pgfpoint
15050 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15051 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}}
15052 \pgfpathmoveto{\pgfpoint
15053 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
15054 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
15055 \pgfpathlineto{\pgfpoint
15056 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
15057 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
15058 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15059 \pgfusepath{draw}
15060 \endpgfscope
15061
15062 \pgfpathmoveto{\pgfpoint
15063 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
15064 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
15065 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15066 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
15067 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15068
15069
15070 \pgfusepath{draw}
15071 \ifpgf@circuit@bpt@drawgate
15072 \pgfpathmoveto{\pgfpoint
15073 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
15074 {\pgf@circ@res@up+\pgf@circ@res@down}}
15075 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
15076 \pgfusepath{draw}
15077 \fi
15078
15079 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
15080 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
15081 {\pgf@circ@res@up+\pgf@circ@res@down}}
15082 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
15083 {\pgf@circ@res@up+\pgf@circ@res@down}}
15084 \pgfusepath{draw}
15085 \fi
15086
15087 \ifpgf@circuit@pmos@nocircle\else
15088 % we are not scaling the circle with the MOS --- I think it's better to have it
15089 % coherent with the poles/nodes of the rest of the circuit.
15090 \pgfpathcircle{\pgfpoint
15091 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
15092 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
15093 \ifpgf@circuit@pmos@emptycircle
15094 \pgfsetfillcolor{white}
15095 \fi
15096 \pgfusepath{draw,fill}
15097 \fi
15098
15099 \pgfcirc@ferroelectric{pmosd}{\ctikzvalof{tripoles/pmosd/depletion width}}
15100 }
15101 %% HEMT FET Transistor
15102 \pgfcircdeclaretransistor{hemt}{
15103 \anchor{inner up}{
15104 \northeast
15105 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
15106 }
15107 \anchor{inner down}{
15108 \northeast
15109 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
15110 }
15111 }{%
15112 % add the circle if requested (before everything else, so we can fill it)
15113 \pgfcirc@transistorcircle
15114 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15115 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15116 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
15117 \pgfpathlineto{\pgfpoint
15118 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15119 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
15120
15121 \pgfpathmoveto{\pgfpoint
15122 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15123 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
15124 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15125 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
15126 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15127 \pgfusepath{draw}
15128
15129 \pgfscope
15130 \pgfpathmoveto{\pgfpoint
15131 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15132 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
15133 \pgfpathlineto{\pgfpoint
15134 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15135 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
15136 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15137 \pgfusepath{draw}
15138 \endpgfscope
15139
15140 \ifpgf@circuit@bpt@drawgate
15141 \pgfpathmoveto{\pgfpoint
15142 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
15143 {\pgf@circ@res@up+\pgf@circ@res@down}}
15144 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
15145 \pgfusepath{draw}
15146 \fi
15147 }
15148
15149 \long\def\drawfetcore#1{
15150 \pgftransformationadjustments
15151 % add the circle if requested (before everything else, so we can fill it)
15152 \pgfcirc@transistorcircle
15153 % fill the gap color if requested
15154 \pgfcirc@fillgategap{#1}
15155
15156 %top connection
15157 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15158 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15159 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
15160 \pgfpathlineto{\pgfpoint
15161 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15162 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
15163 \pgfusepath{draw}
15164 \pgfscope
15165 \pgfpathmoveto{\pgfpoint
15166 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15167 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
15168 \ifpgf@circuit@trans@depletiontype
15169 \pgfpathlineto{\pgfpoint
15170 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15171 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
15172 \else
15173
15174 \pgfpathlineto{\pgfpoint
15175 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15176 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
15177 \pgfpathmoveto{\pgfpoint
15178 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15179 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
15180 \pgfpathlineto{\pgfpoint
15181 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15182 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
15183 \pgfpathmoveto{\pgfpoint
15184 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15185 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
15186 \pgfpathlineto{\pgfpoint
15187 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15188 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
15189 \fi
15190 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15191 \pgfusepath{draw}
15192 \endpgfscope
15193 %Bulk connection line
15194 \pgfpathmoveto{\pgfpoint
15195 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15196 {\pgf@circ@res@up+\pgf@circ@res@down}}
15197 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
15198 {\pgf@circ@res@up+\pgf@circ@res@down}}
15199
15200 %bottom connection
15201 \pgfpathmoveto{\pgfpoint
15202 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
15203 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
15204 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15205 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
15206 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15207 \pgfusepath{draw}
15208
15209 %draw thick gate line
15210 \pgfscope
15211 \pgfpathmoveto{\pgfpoint
15212 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15213 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15214 \pgfpathlineto{\pgfpoint
15215 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15216 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15217 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15218 \pgfusepath{draw}
15219 \endpgfscope
15220
15221 % arrows
15222 \pgfscope
15223 \pgfslopedattimetrue
15224 \pgfallowupsidedownattimetrue
15225 \pgfresetnontranslationattimefalse
15226 \ifpgf@circuit@trans@arrowatend
15227 \ifpgf@circuit@trans@ntype
15228 \edef\@@anchor{tip}
15229 \edef\@@pos{1.0}
15230 \else
15231 \edef\@@anchor{btip}
15232 \edef\@@pos{0.0}
15233 \fi
15234 \else
15235 \edef\@@anchor{center}\edef\@@pos{0.6}
15236 \fi
15237 \pgftransformlineattime{\@@pos}{%
15238 \pgfpoint
15239 {\pgf@circ@res@right}%
15240 {\pgf@circ@res@up+\pgf@circ@res@down}%
15241 }{%
15242 \pgfpoint%
15243 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
15244 {\pgf@circ@res@up+\pgf@circ@res@down}%
15245 }
15246 \ifpgf@circuit@trans@ntype
15247 \else
15248 \pgftransformrotate{180}
15249 \fi
15250 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
15251 \endpgfscope
15252
15253 % GATE CONNECTION
15254 \ifpgf@circuit@bpt@drawgate
15255 \ifpgf@circuit@trans@ntype
15256 \pgfpathmoveto{\pgfpoint
15257 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15258 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
15259 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
15260 \else
15261 \pgfpathmoveto{\pgfpoint
15262 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15263 {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
15264 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
15265 \fi
15266 \pgfusepath{draw}
15267 \fi
15268
15269 \pgfcirc@ferroelectric{#1}{0}
15270
15271 }
15272
15273 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3
15274 {\pgfcircdeclaretransistor{#1}{
15275 \anchor{bulk}{\left\pgf@x=0pt}
15276 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
15277 \anchor{inner up}{
15278 \northeast
15279 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
15280 }
15281 \anchor{inner down}{
15282 \northeast
15283 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
15284 }
15285 #2
15286 }
15287 {#3}
15288 }
15289
15290 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
15291 \pgf@circuit@trans@depletiontypefalse
15292 \drawfetcore{nfet}
15293 }
15294
15295 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
15296 \pgf@circuit@trans@depletiontypefalse
15297 \drawfetcore{pfet}
15298 }
15299
15300 \pgfdeclaretransistorwrapperaddbulk{nfetd}{}{%
15301 \pgf@circuit@trans@depletiontypetrue
15302 \drawfetcore{nfetd}
15303 }
15304
15305 \pgfdeclaretransistorwrapperaddbulk{pfetd}{}{%
15306 \pgf@circuit@trans@depletiontypetrue
15307 \drawfetcore{pfetd}
15308 }
15309 % N-CHANNEL IGFET ENHANCEMENT TYPE
15310 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
15311 \pgf@circuit@trans@depletiontypefalse
15312 \drawfetcore{nigfete}
15313
15314 % SOURCE CONNECTION
15315 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15316 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
15317 \pgfusepath{draw}
15318
15319 % SOLDER DOT at source-bulk connection
15320 \ifpgf@circuit@fet@solderdot
15321 \pgfscope
15322 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15323 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
15324 \pgfnode{circ}{center}{}{}{}
15325 \endpgfscope{}
15326 \fi
15327 }
15328
15329 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
15330 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
15331 \pgf@circuit@trans@depletiontypefalse
15332 \drawfetcore{nigfetebulk}
15333 % SOLDER DOT at source-bulk connection
15334 \ifpgf@circuit@fet@solderdot
15335 \pgfscope
15336 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15337 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
15338 \pgfnode{circ}{center}{}{}{}
15339 \endpgfscope{}
15340 \fi
15341 }
15342
15343 % N-CHANNEL IGFET DEPLETION TYPE
15344 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
15345 \pgf@circuit@trans@depletiontypetrue
15346 \drawfetcore{nigfetd}
15347
15348 % SOURCE CONNECTION
15349 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15350 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
15351 \pgfusepath{draw}
15352
15353 % SOLDER DOT at source-bulk connection
15354 \ifpgf@circuit@fet@solderdot
15355 \pgfscope
15356 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15357 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
15358 \pgfnode{circ}{center}{}{}{}
15359 \endpgfscope{}
15360 \fi
15361 }
15362
15363 % P-CHANNEL IGFET ENHANCEMENT TYPE
15364 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
15365 \pgf@circuit@trans@depletiontypefalse
15366 \drawfetcore{pigfete}
15367 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15368
15369 % SOURCE CONNECTION
15370 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15371 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15372 \pgfusepath{draw}
15373
15374
15375 % SOLDER DOT at source-bulk connection
15376 \ifpgf@circuit@fet@solderdot
15377 \pgfscope
15378 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15379 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
15380 \pgfnode{circ}{center}{}{}{}
15381 \endpgfscope
15382 \fi
15383 }
15384
15385 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
15386 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
15387 \pgf@circuit@trans@depletiontypefalse
15388 \drawfetcore{pigfetebulk}
15389 }
15390
15391 % P-CHANNEL IGFET DEPLETION TYPE
15392 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
15393 \pgf@circuit@trans@depletiontypetrue
15394 \drawfetcore{pigfetd}
15395
15396 % SOURCE CONNECTION
15397 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15398 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15399 \pgfusepath{draw}
15400
15401
15402 % SOLDER DOT at source-bulk connection
15403 \ifpgf@circuit@fet@solderdot
15404 \pgfscope
15405 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15406 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
15407 \pgfnode{circ}{center}{}{}{}
15408 \endpgfscope{}
15409 \fi
15410 }
15411
15412 %%% uni-junction transistors: jfets, ujts
15413
15414 \long\def\pgfcircdeclarejunctiontransistor#1#2#3{% name, extra anchors, extra draw
15415 \pgfcircdeclaretransistor{#1}{
15416 \anchor{inner up}{
15417 \northeast
15418 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
15419 }
15420 \anchor{inner down}{
15421 \northeast
15422 \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
15423 }
15424 \anchor{kink}{
15425 \northeast
15426 \pgf@ya=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
15427 \left
15428 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
15429 \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x
15430 }
15431 % extra anchors (or override)
15432 #2
15433 }{%
15434 % add the circle if requested (before everything else, so we can fill it)
15435 \pgfcirc@transistorcircle
15436
15437 % get direction
15438 \edef\@@dir{\ctikzvalof{tripoles/#1/curr direction}}
15439
15440 % draw drain/source connections: up
15441 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15442 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15443 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
15444 \pgfpathlineto{\pgfpoint
15445 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15446 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
15447
15448 % down
15449 \pgfpathmoveto{\pgfpoint
15450 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15451 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
15452 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15453 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
15454 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15455 \pgfusepath{draw}
15456
15457 \pgfscope
15458 \pgfpathmoveto{\pgfpoint
15459 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15460 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
15461 \pgfpathlineto{\pgfpoint
15462 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
15463 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
15464 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15465 \pgfusepath{draw}
15466 \endpgfscope
15467
15468 % arrow
15469 \pgfscope
15470 \pgfslopedattimetrue
15471 \pgfallowupsidedownattimetrue
15472 \pgfresetnontranslationattimefalse
15473 \ifpgf@circuit@trans@arrowatend
15474 \ifnum\@@dir>0
15475 \edef\@@anchor{tip}\edef\@@pos{1.0}
15476 \else
15477 \edef\@@anchor{btip}\edef\@@pos{1.0}
15478 \fi
15479 \else
15480 \ifnum\@@dir>0
15481 \edef\@@anchor{center}\edef\@@pos{0.6}
15482 \else
15483 \edef\@@anchor{center}\edef\@@pos{0.4}
15484 \fi
15485 \fi
15486 % find x1, x2 and y for the base arrow
15487 \ifnum\@@dir>0
15488 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left
15489 \pgf@circ@res@other=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left
15490 \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@down
15491 \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down
15492 \else
15493 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left
15494 \pgf@circ@res@other=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left
15495 \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up
15496 \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@up
15497 \fi
15498 %
15499 % gate line (called emitter in UJT)
15500 %
15501 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}}
15502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
15503 %
15504 % horizontal gate line
15505 %
15506 \ifpgf@circuit@bpt@drawgate
15507 \ifnum\@@dir>0
15508 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}}
15509 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
15510 \else
15511 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
15512 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
15513 \fi
15514 \fi
15515 \pgfusepath{draw}
15516 %
15517 % gate arrows (called emitter in UJT)
15518 %
15519 \pgftransformlineattime{\@@pos}{%
15520 \pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}
15521 }{%
15522 \pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}
15523 }
15524 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
15525 %
15526 % gate line (called emitter in UJT)
15527 %
15528 \endpgfscope
15529
15530 % extra drawings
15531 #3
15532 }
15533 }
15534
15535 % NJFET and PJFET
15536
15537 \pgfcircdeclarejunctiontransistor{njfet}{}{}
15538 \pgfcircdeclarejunctiontransistor{pjfet}{}{}
15539
15540 \def\@ujtanchoroverride#1{
15541 \savedanchor{\ujtrealemitter}{
15542 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15543 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
15544 \pgf@y=.5\pgf@y %north anchor height
15545 % kink AND conn height, they're the same
15546 \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
15547 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
15548 % horizontal
15549 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen % left
15550 \ifpgf@circuit@bpt@drawgate\else
15551 \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x
15552 \fi
15553 }
15554 \anchor{E}{\ujtrealemitter}
15555 \anchor{emitter}{\ujtrealemitter}
15556 \anchor{B2}{\northeast\pgf@y=-\pgf@y}
15557 \anchor{B1}{\northeast}
15558 }
15559
15560
15561 \pgfcircdeclarejunctiontransistor{nujt}{\@ujtanchoroverride{nujt}}{}
15562 \pgfcircdeclarejunctiontransistor{pujt}{\@ujtanchoroverride{pujt}}{}
15563
15564
15565 \pgfdeclaretransistorwrapperaddbulk{isfet}{
15566 }{%
15567 % add the circle if requested (before everything else, so we can fill it)
15568 \pgfcirc@transistorcircle
15569 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15570 % DRAIN CONNECTION
15571 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15572 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
15573 % DRAIN
15574 \pgfpathlineto{\pgfpoint
15575 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15576 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
15577 \pgfusepath{draw}
15578
15579 % GATE, DEPLETION TYPE
15580 \pgfscope %% added
15581 \pgfpathmoveto{\pgfpoint
15582 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15583 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
15584 \pgfpathlineto{\pgfpoint
15585 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15586 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
15587 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
15588 \pgfusepath{draw} %% added
15589 \endpgfscope %% added
15590
15591 % BULK
15592 \pgfpathmoveto{\pgfpoint
15593 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15594 {\pgf@circ@res@up+\pgf@circ@res@down}}
15595 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
15596 {\pgf@circ@res@up+\pgf@circ@res@down}}
15597
15598 % SOURCE
15599 \pgfpathmoveto{\pgfpoint
15600 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
15601 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
15602 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
15603 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
15604 % SOURCE CONNECTION
15605 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15606 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
15607 \pgfusepath{draw}
15608
15609 % SOLDER DOT at source-bulk connection
15610 \ifpgf@circuit@fet@solderdot
15611 \pgfscope
15612 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
15613 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
15614 \pgfnode{circ}{center}{}{}{}
15615 \endpgfscope{}
15616 \fi
15617 % ARROW
15618 \pgfscope
15619 \pgfslopedattimetrue
15620 \pgfallowupsidedownattimetrue
15621 \pgfresetnontranslationattimefalse
15622 \ifpgf@circuit@trans@arrowatend
15623 \edef\@@anchor{tip}\edef\@@pos{1.0}
15624 \else
15625 \edef\@@anchor{center}\edef\@@pos{0.6}
15626 \fi
15627 \pgftransformlineattime{\@@pos}{%
15628 \pgfpoint
15629 {\pgf@circ@res@right}%
15630 {\pgf@circ@res@up+\pgf@circ@res@down}%
15631 }{%
15632 \pgfpoint%
15633 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
15634 {\pgf@circ@res@up+\pgf@circ@res@down}%
15635 }
15636 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
15637 \endpgfscope
15638 \pgfusepath{draw}
15639
15640 % Wavy lines
15641 \pgfscope
15642 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
15643 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15644 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15645 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15646 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15647 \pgfusepath{draw}
15648
15649 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
15650 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15651 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15652 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15653 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15654 \pgfusepath{draw}
15655
15656 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
15657 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15658 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15659 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15660 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
15661 \pgfusepath{draw}
15662 \endpgfscope
15663 }
15664
15665 % end of transistors
15666 % %>>>
15667
15668 %% Transistor's path definitions%<<<
15669
15670 \pgf@circ@definetranspath{nmos}
15671 \pgf@circ@definetranspath{pmos}
15672 \pgf@circ@definetranspath{nmosd}
15673 \pgf@circ@definetranspath{pmosd}
15674 \pgf@circ@definetranspath{hemt}
15675 \pgf@circ@definetranspath{npn}
15676 \pgf@circ@definetranspath{pnp}
15677 \pgf@circ@definetranspath{nfet}
15678 \pgf@circ@definetranspath{nigfete}
15679 \pgf@circ@definetranspath{nigfetd}
15680 \pgf@circ@definetranspath{nigfetebulk}
15681 \pgf@circ@definetranspath{pfet}
15682 \pgf@circ@definetranspath{pigfete}
15683 \pgf@circ@definetranspath{pigfetd}
15684 \pgf@circ@definetranspath{pigfetebulk}
15685 \pgf@circ@definetranspath{njfet}
15686 \pgf@circ@definetranspath{pjfet}
15687 \pgf@circ@definetranspath{pigbt}
15688 \pgf@circ@definetranspath{nigbt}
15689 \pgf@circ@definetranspath{Lpigbt}
15690 \pgf@circ@definetranspath{Lnigbt}% %>>>
15691
15692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15693 %% Amplifiers
15694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15695
15696 % Settings for Amplifiers%<<<1
15697 %
15698 % switches for op amps
15699 % changing input polarity
15700 %
15701 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
15702 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
15703 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
15704 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
15705 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
15706 %
15707 % changing output polarity (for fully diff objects)
15708 %
15709 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
15710 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
15711 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
15712 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
15713 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
15714
15715 % Operational amplifier
15716 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
15717 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
15718 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
15719 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
15720 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
15721 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
15722
15723 % Fully differential operational amplifier
15724 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
15725 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
15726 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
15727 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
15728 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
15729 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
15730 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
15731
15732 \ctikzset{tripoles/en amp/width/.initial=1.7}
15733 \ctikzset{tripoles/en amp/port width/.initial=.7}
15734 \ctikzset{tripoles/en amp/height/.initial=1.6}
15735 \ctikzset{tripoles/en amp/input height/.initial=.3}
15736 \ctikzset{tripoles/en amp/up pos/.initial=.45}
15737 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
15738 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
15739 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
15740 \tikzset{
15741 en amp text/.code = {%
15742 \ctikzsetvalof{tripoles/en amp/text}{#1}%
15743 },
15744 en amp text A/.code = {%
15745 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
15746 },
15747 }
15748
15749 % Transconductance amplifier
15750 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
15751 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
15752 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
15753 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
15754 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
15755 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
15756 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
15757
15758 % Instrumentation amplifier
15759 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
15760 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
15761 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
15762 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
15763 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
15764 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
15765 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
15766 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
15767
15768 % Instrumentation amplifier with differential output
15769 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
15770 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
15771 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
15772 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
15773 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
15774 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
15775 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
15776 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
15777 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
15778
15779 % Instrumentation amplifier with gain resistor terminals
15780 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
15781 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
15782 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
15783 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
15784 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
15785 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
15786 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
15787 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
15788 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
15789
15790 % Plain amplifier
15791 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
15792 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
15793 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
15794 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
15795 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
15796
15797 % changing fonts and symbols of amplifiers
15798 \ctikzset{amplifiers/symbol font/.code={%
15799 \ctikzset{tripoles/inst amp ra/font=#1}%
15800 \ctikzset{tripoles/fd inst amp/font=#1}%
15801 \ctikzset{tripoles/inst amp/font=#1}%
15802 \ctikzset{tripoles/gm amp/font=#1}%
15803 \ctikzset{tripoles/en amp/font=#1}%
15804 \ctikzset{tripoles/fd op amp/font=#1}%
15805 \ctikzset{tripoles/op amp/font=#1}%
15806 }}
15807 \ctikzset{amplifiers/plus/.initial={$+$}}
15808 \ctikzset{amplifiers/minus/.initial={$-$}}
15809 \tikzset{amp symbol font/.code={%
15810 \ctikzset{amplifiers/symbol font={#1}}%
15811 }
15812 }
15813 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
15814 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
15815 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
15816 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
15817 %%>>>
15818
15819 %% Nodes for amplifiers%<<<
15820 %% operational and instrumentation amplifiers
15821
15822 \pgfdeclareshape{op amp}
15823 {
15824 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15825 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15826 \anchor{center}{\pgfpointorigin}
15827 \savedanchor\northwest{%
15828 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15829 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
15830 \pgf@y=.5\pgf@y
15831 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
15832 \pgf@x=.5\pgf@x
15833 }
15834 \savedanchor\left{%
15835 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15836 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
15837 \pgf@x=.5\pgf@x
15838 \pgf@y=0pt
15839 }
15840 \anchor{south}{
15841 \northwest
15842 \pgf@y=-\pgf@y
15843 \pgf@x=0pt
15844 }
15845 \anchor{north}{
15846 \northwest
15847 \pgf@x=0pt
15848 }
15849 \savedanchor\left{%
15850 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15851 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
15852 \pgf@x=.5\pgf@x
15853 \pgf@y=0pt
15854 }
15855 \savedanchor\inOneFixed{%
15856 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15857 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
15858 \pgf@y=.5\pgf@y
15859 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
15860 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
15861 \pgf@x=.5\pgf@x
15862 }
15863 \anchor{in up}{
15864 \inOneFixed
15865 }
15866 \anchor{in down}{
15867 \inOneFixed
15868 \pgf@y=-\pgf@y
15869 }
15870 \savedanchor\inOne{%
15871 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15872 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
15873 \pgf@y=.5\pgf@y
15874 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
15875 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
15876 \pgf@x=.5\pgf@x
15877 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15878 }
15879 \anchor{-}{
15880 \inOne
15881 }
15882 \anchor{+}{
15883 \inOne
15884 \pgf@y=-\pgf@y
15885 }
15886 \savedanchor\up{%
15887 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15888 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
15889 \pgf@y=.5\pgf@y
15890 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
15891 \pgf@x=.5\pgf@x
15892 \pgf@circ@res@up = \pgf@y
15893 \pgf@circ@res@right = -\pgf@x
15894 \pgf@circ@res@left = \pgf@x
15895 \pgfpointlineattime{
15896 \ctikzvalof{tripoles/op amp/up pos}}{
15897 \pgfpoint{
15898 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
15899 {\pgf@circ@res@up}}
15900 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
15901 }
15902 \anchor{up}{
15903 \up
15904 }
15905 \anchor{down}{
15906 \up
15907 \pgf@y=-\pgf@y
15908 }
15909 \anchor{out}{
15910 \northwest
15911 \pgf@y=0pt
15912 \pgf@x=-\pgf@x
15913 }
15914 \anchor{west}{
15915 \left
15916 }
15917 \anchor{east}{
15918 \left
15919 \pgf@x=-\pgf@x
15920 }
15921
15922 % support for border anchors
15923 \savedanchor\leftedge{%
15924 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15925 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
15926 \pgf@x=.5\pgf@x
15927 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
15928 \pgf@y=0pt
15929 }
15930 \anchor{leftedge}{\leftedge}
15931 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15932 \anchor{bin up}{
15933 \inOneFixed
15934 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15935 }
15936 \anchor{bin down}{
15937 \inOneFixed
15938 \pgf@y=-\pgf@y
15939 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15940 }
15941 \anchor{b-}{
15942 \inOne
15943 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15944 }
15945 \anchor{b+}{
15946 \inOne
15947 \pgf@y=-\pgf@y
15948 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15949 }
15950 \anchor{bout}{
15951 \leftedge
15952 \pgf@y=0pt
15953 \pgf@x=-\pgf@x
15954 }
15955 % end border anchors
15956 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15957 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15958 \anchor{north west}{ \northwest }
15959 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15960
15961 \anchor{text}{
15962 \ifpgf@circ@center@text
15963 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15964 \else
15965 \leftedge
15966 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15967 \fi
15968 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15969 }
15970
15971 \backgroundpath{
15972 \pgfsetcolor{\ctikzvalof{color}}
15973
15974 \northwest
15975 \pgf@circ@res@up = \pgf@y
15976 \pgf@circ@res@down = -\pgf@y
15977 \pgf@circ@res@right = -\pgf@x
15978 \pgf@circ@res@left = \pgf@x
15979 \pgf@circ@scaled@Rlen=\scaledRlen
15980
15981 % Triangle
15982 \pgfscope
15983 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15984 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
15985 \pgf@circ@res@step=\pgf@circ@res@right
15986 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15987 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
15988
15989 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15990 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15991 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15992 \pgfpathclose
15993 \pgf@circ@draworfill
15994 \endpgfscope
15995
15996 % Negative input terminal
15997 \pgfpathmoveto{\pgfpoint
15998 {\pgf@circ@res@left}
15999 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
16000 \pgfpathlineto{\pgfpoint
16001 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
16002 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
16003 \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}
16004
16005 % Positive input terminal
16006 \pgfpathmoveto{\pgfpoint
16007 {\pgf@circ@res@left}
16008 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
16009 \pgfpathlineto{\pgfpoint
16010 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
16011 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
16012 \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}
16013
16014 % Output terminal
16015 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16016 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
16017 \pgfsetrectcap
16018 \pgfusepath{draw}
16019 }
16020 }
16021
16022 % Op amp shape as in european standard EN 60617
16023 \pgfdeclareshape{en amp}
16024 {
16025 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16026 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16027 \anchor{center}{\pgfpointorigin}
16028 \savedanchor\northwest{%
16029 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16030 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
16031 \pgf@y=.5\pgf@y
16032 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16033 \pgf@x=.5\pgf@x
16034 }
16035 \savedanchor\left{%
16036 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16037 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16038 \pgf@x=.5\pgf@x
16039 \pgf@y=0pt
16040 }
16041 \anchor{south}{
16042 \northwest
16043 \pgf@y=-\pgf@y
16044 \pgf@x=0pt
16045 }
16046 \anchor{north}{
16047 \northwest
16048 \pgf@x=0pt
16049 }
16050 \savedanchor\inOneFixed{%
16051 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16052 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
16053 \pgf@y=.5\pgf@y
16054 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
16055 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16056 \pgf@x=.5\pgf@x
16057 }
16058 \anchor{in up}{
16059 \inOneFixed
16060 }
16061 \anchor{in down}{
16062 \inOneFixed
16063 \pgf@y=-\pgf@y
16064 }
16065 \savedanchor\inOne{%
16066 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16067 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
16068 \pgf@y=.5\pgf@y
16069 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
16070 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16071 \pgf@x=.5\pgf@x
16072 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16073 }
16074 \anchor{-}{
16075 \inOne
16076 }
16077 \anchor{+}{
16078 \inOne
16079 \pgf@y=-\pgf@y
16080 }
16081 \anchor{up}{
16082 \northwest
16083 \pgf@x=0pt
16084 }
16085 \anchor{down}{
16086 \northwest
16087 \pgf@x=0pt
16088 \pgf@y=-\pgf@y
16089 }
16090 \anchor{out}{
16091 \northwest
16092 \pgf@y=0pt
16093 \pgf@x=-\pgf@x
16094 }
16095 \anchor{west}{
16096 \left
16097 }
16098 \anchor{east}{
16099 \left
16100 \pgf@x=-\pgf@x
16101 }
16102 % support for border anchors
16103 \savedanchor\leftedge{%
16104 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16105 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
16106 \pgf@x=.5\pgf@x
16107 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
16108 \pgf@y=0pt
16109 }
16110 \anchor{leftedge}{\leftedge}
16111 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16112 \anchor{bin up}{
16113 \inOneFixed
16114 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16115 }
16116 \anchor{bin down}{
16117 \inOneFixed
16118 \pgf@y=-\pgf@y
16119 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16120 }
16121 \anchor{b-}{
16122 \inOne
16123 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16124 }
16125 \anchor{b+}{
16126 \inOne
16127 \pgf@y=-\pgf@y
16128 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16129 }
16130 \anchor{bout}{
16131 \leftedge
16132 \pgf@y=0pt
16133 \pgf@x=-\pgf@x
16134 }
16135 % end border anchors
16136 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16137 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16138 \anchor{north west}{ \northwest }
16139 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16140 \anchor{text}{
16141 \ifpgf@circ@center@text
16142 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16143 \else
16144 \leftedge
16145 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16146 \fi
16147 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16148 }
16149
16150 \backgroundpath{
16151 \pgfsetcolor{\ctikzvalof{color}}
16152 \northwest
16153 \pgf@circ@res@up = \pgf@y
16154 \pgf@circ@res@down = -\pgf@y
16155 \pgf@circ@res@right = -\pgf@x
16156 \pgf@circ@res@left = \pgf@x
16157 \pgf@circ@scaled@Rlen=\scaledRlen
16158
16159 \pgfscope
16160 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16161 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
16162 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
16163 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
16164 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
16165 \pgfpathclose
16166 \pgf@circ@draworfill
16167 \endpgfscope
16168
16169 \pgfpathmoveto{\pgfpoint
16170 {\pgf@circ@res@left}
16171 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
16172 \pgfpathlineto{\pgfpoint
16173 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
16174 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
16175 \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}
16176
16177 \pgfpathmoveto{\pgfpoint
16178 {\pgf@circ@res@left}
16179 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
16180 \pgfpathlineto{\pgfpoint
16181 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
16182 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
16183 \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}
16184
16185 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16186 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
16187 \pgfsetrectcap
16188 \pgfusepath{draw}
16189
16190
16191 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
16192 % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$}
16193 }
16194 }
16195
16196 % Fully differential output op amp
16197 % Contributed by Kristofer M. Monisit
16198 \pgfdeclareshape{fd op amp}
16199 {
16200 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16201 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16202 \anchor{center}{\pgfpointorigin}
16203 \savedanchor\northwest{%
16204 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16205 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16206 \pgf@y=.5\pgf@y
16207 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16208 \pgf@x=.5\pgf@x
16209 }
16210 \savedanchor\outline{%
16211 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16212 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16213 \pgf@y=.5\pgf@y
16214 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16215 \pgf@x=.5\pgf@x
16216 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
16217 }
16218 \anchor{south}{
16219 \northwest
16220 \pgf@y=-\pgf@y\pgf@x=0pt\relax
16221 }
16222 \anchor{north}{
16223 \northwest\pgf@x=0pt\relax
16224 }
16225 \savedanchor\left{%
16226 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16227 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16228 \pgf@x=.5\pgf@x
16229 \pgf@y=0pt
16230 }
16231 \savedanchor\inOneFixed{%
16232 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16233 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16234 \pgf@y=.5\pgf@y
16235 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
16236 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16237 \pgf@x=.5\pgf@x
16238 }
16239 \anchor{in up}{
16240 \inOneFixed
16241 }
16242 \anchor{in down}{
16243 \inOneFixed
16244 \pgf@y=-\pgf@y
16245 }
16246 \savedanchor\inOne{%
16247 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16248 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16249 \pgf@y=.5\pgf@y
16250 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
16251 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16252 \pgf@x=.5\pgf@x
16253 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16254 }
16255 \anchor{-}{
16256 \inOne
16257 }
16258 \anchor{+}{
16259 \inOne
16260 \pgf@y=-\pgf@y
16261 }
16262 \savedanchor\up{%
16263 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16264 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
16265 \pgf@y=.5\pgf@y
16266 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16267 \pgf@x=.5\pgf@x
16268 \pgf@circ@res@up = \pgf@y
16269 \pgf@circ@res@right = -\pgf@x
16270 \pgf@circ@res@left = \pgf@x
16271 \pgfpointlineattime{
16272 \ctikzvalof{tripoles/fd op amp/up pos}}{
16273 \pgfpoint{
16274 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
16275 {\pgf@circ@res@up}}
16276 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
16277 }
16278 \anchor{up}{
16279 \up
16280 }
16281 \anchor{down}{
16282 \up
16283 \pgf@y=-\pgf@y
16284 }
16285 \anchor{out up}{
16286 \northwest
16287 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
16288 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16289 }
16290 \anchor{out down}{
16291 \northwest
16292 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
16293 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16294 }
16295 \anchor{out +}{
16296 \outline
16297 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
16298 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16299 }
16300 \anchor{out -}{
16301 \outline
16302 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
16303 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16304 }
16305 % support for border anchors
16306 \savedanchor\leftedge{%
16307 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16308 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
16309 \pgf@x=.5\pgf@x
16310 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16311 \pgf@y=0pt
16312 }
16313 \anchor{leftedge}{\leftedge}
16314 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16315 \anchor{bin up}{
16316 \inOneFixed
16317 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16318 }
16319 \anchor{bin down}{
16320 \inOneFixed
16321 \pgf@y=-\pgf@y
16322 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16323 }
16324 \anchor{b-}{
16325 \inOne
16326 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16327 }
16328 \anchor{b+}{
16329 \inOne
16330 \pgf@y=-\pgf@y
16331 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16332 }
16333 \anchor{bout}{
16334 \leftedge
16335 \pgf@y=0pt
16336 \pgf@x=-\pgf@x
16337 }
16338 \anchor{bout +}{
16339 \outline
16340 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
16341 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
16342 {\pgfpoint{\pgf@xa}{0pt}}
16343 {\pgfpoint{0pt}{\pgf@ya}}
16344 }
16345 \anchor{bout -}{
16346 \outline
16347 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
16348 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
16349 {\pgfpoint{\pgf@xa}{0pt}}
16350 {\pgfpoint{0pt}{\pgf@ya}}
16351 \pgf@y=-\pgf@y
16352 }
16353 \anchor{bout up}{
16354 \northwest
16355 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
16356 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
16357 {\pgfpoint{\pgf@xa}{0pt}}
16358 {\pgfpoint{0pt}{\pgf@ya}}
16359 }
16360 \anchor{bout down}{
16361 \northwest
16362 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
16363 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
16364 {\pgfpoint{\pgf@xa}{0pt}}
16365 {\pgfpoint{0pt}{\pgf@ya}}
16366 \pgf@y=-\pgf@y
16367 }
16368 % end border anchors
16369 \anchor{west}{
16370 \left
16371 }
16372 \anchor{east}{
16373 \left
16374 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16375 }
16376 \anchor{out}{% should not be used
16377 \left
16378 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
16379 }
16380 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16381 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
16382 \anchor{north west}{ \northwest }
16383 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
16384 \anchor{text}{
16385 \ifpgf@circ@center@text
16386 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16387 \else
16388 \leftedge
16389 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16390 \fi
16391 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16392 }
16393 \backgroundpath{
16394 \pgfsetcolor{\ctikzvalof{color}}
16395
16396 \northwest
16397 \pgf@circ@res@up = \pgf@y
16398 \pgf@circ@res@down = -\pgf@y
16399 \pgf@circ@res@right = -\pgf@x
16400 \pgf@circ@res@left = \pgf@x
16401 \pgf@circ@scaled@Rlen=\scaledRlen
16402
16403 % Triangle
16404 % Includes output terminals in the traingular shape
16405 % to ensure that diagonal joins are properly displayed
16406 % we first draw the main triangle and the leads with normal thickness,
16407 % and the redraw the main triangle with the component shape
16408 \pgfscope
16409 % shift origin a bit to ease calculations
16410 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
16411 \pgf@circ@res@step=\pgf@circ@res@right
16412 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16413 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
16414
16415 % Initial point (right vertex)
16416 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16417
16418 % Negative output terminal
16419 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
16420 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
16421 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
16422
16423 % Top vertex
16424 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16425
16426 % Bottom vertex
16427 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16428
16429 % Positive output terminal
16430 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
16431 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
16432 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
16433
16434 % Right vertex
16435 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16436
16437 \pgfpathclose
16438 \pgfusepath{stroke}
16439
16440 % ok, now we'll redraw the triangle with the class specific
16441 % thickness and optionally fill
16442
16443 \pgfscope
16444 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
16445
16446 % Initial point (right vertex)
16447 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
16448 % Top vertex
16449 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16450 % Bottom vertex
16451 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16452
16453 \pgfpathclose
16454 \pgf@circ@draworfill
16455 \endpgfscope % thick and fill
16456 \endpgfscope % shift
16457
16458 % Negative input terminal
16459 \pgfpathmoveto{\pgfpoint
16460 {\pgf@circ@res@left}
16461 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
16462 \pgfpathlineto{\pgfpoint
16463 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
16464 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
16465 \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}
16466
16467 % Positive input terminal
16468 \pgfpathmoveto{\pgfpoint
16469 {\pgf@circ@res@left}
16470 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
16471 \pgfpathlineto{\pgfpoint
16472 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
16473 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
16474 \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}
16475
16476 % Negative output terminal label
16477 \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}
16478
16479 % Positive output terminal label
16480 \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}
16481
16482 \pgfsetrectcap
16483 \pgfusepath{draw}
16484 }
16485 }
16486
16487
16488 % Instrumentation amplifier with differential output
16489 \pgfdeclareshape{fd inst amp}
16490 {
16491 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16492 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16493 % when tikz calls the anchor it wants the relative position in the lengths
16494 % \pgf@x \pgf@y
16495 % \pgfpoint* functions set that variables
16496 % anchors are visible outside and run on use
16497 \anchor{center}{\pgfpointorigin}
16498 % savedanchors are internals and run on node creation (not use)
16499 % bounding-box top left
16500 \savedanchor\northwest{%
16501 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16502 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16503 \pgf@y=.5\pgf@y
16504 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16505 \pgf@x=.5\pgf@x
16506 }
16507 \anchor{nw}{
16508 \northwest
16509 }
16510 \anchor{south}{
16511 \northwest
16512 \pgf@y=-\pgf@y\pgf@x=0pt\relax
16513 }
16514 \anchor{north}{
16515 \northwest\pgf@x=0pt\relax
16516 }
16517 \savedanchor\left{%
16518 \pgf@y=0pt
16519 }
16520 \anchor{leftedge}
16521 {\left
16522 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
16523 }
16524 \savedanchor\inOneFixed{%
16525 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16526 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16527 \pgf@y=.5\pgf@y
16528 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
16529 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16530 \pgf@x=.5\pgf@x
16531 }
16532 \anchor{in up}{
16533 \inOneFixed
16534 }
16535 \anchor{in down}{
16536 \inOneFixed
16537 \pgf@y=-\pgf@y
16538 }
16539 \savedanchor\inOne{%
16540 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16541 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16542 \pgf@y=.5\pgf@y
16543 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
16544 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16545 \pgf@x=.5\pgf@x
16546 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16547 }
16548 \anchor{-}{
16549 \inOne
16550 }
16551 \anchor{+}{
16552 \inOne
16553 \pgf@y=-\pgf@y
16554 }
16555 \savedanchor\up{%
16556 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16557 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16558 \pgf@y=.5\pgf@y
16559 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16560 \pgf@x=.5\pgf@x
16561 \pgf@circ@res@up = \pgf@y
16562 \pgf@circ@res@right = -\pgf@x
16563 \pgf@circ@res@left = \pgf@x
16564 \pgfpointlineattime{
16565 \ctikzvalof{tripoles/fd inst amp/up pos}}{
16566 \pgfpoint{
16567 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
16568 {\pgf@circ@res@up}}
16569 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
16570 }
16571 \anchor{up}{
16572 \up
16573 }
16574 \anchor{down}{
16575 \up
16576 \pgf@y=-\pgf@y
16577 }
16578 % reference voltage input anchors.
16579 \savedanchor\refv{%
16580 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16581 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16582 \pgf@y=.5\pgf@y
16583 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16584 \pgf@x=.5\pgf@x
16585 \pgf@circ@res@up = \pgf@y
16586 \pgf@circ@res@right = -\pgf@x
16587 \pgf@circ@res@left = \pgf@x
16588 \pgfpointlineattime{
16589 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
16590 \pgfpoint{
16591 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
16592 {\pgf@circ@res@up}}
16593 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
16594 }
16595 % we need both because they are normally drawn under the amp, and if you
16596 % mirror it vertically you need them
16597 \anchor{refv up}{
16598 \refv
16599 }
16600 \anchor{refv down}{
16601 \refv
16602 \pgf@y=-\pgf@y
16603 }
16604 \savedanchor\outport{
16605 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16606 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16607 \pgf@y=.5\pgf@y
16608 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
16609 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16610 \pgf@x=-.5\pgf@x
16611 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
16612 }
16613 \anchor{out}{
16614 \outport
16615 \pgf@y=0pt
16616 }
16617 \anchor{out +}{
16618 \outport
16619 }
16620 \anchor{out -}{
16621 \outport
16622 \pgf@y=-\pgf@y
16623 }
16624 \savedanchor\outportfixed{
16625 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16626 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
16627 \pgf@y=.5\pgf@y
16628 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
16629 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16630 \pgf@x=-.5\pgf@x
16631 }
16632 \anchor{out up}{
16633 \outportfixed
16634 }
16635 \anchor{out down}{
16636 \outportfixed
16637 \pgf@y=-\pgf@y
16638 }
16639 % support for border anchors
16640 \savedanchor\leftedge{%
16641 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16642 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
16643 \pgf@x=.5\pgf@x
16644 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
16645 \pgf@y=0pt
16646 }
16647 \anchor{leftedge}{\leftedge}
16648 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16649 \anchor{bin up}{
16650 \inOneFixed
16651 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16652 }
16653 \anchor{bin down}{
16654 \inOneFixed
16655 \pgf@y=-\pgf@y
16656 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16657 }
16658 \anchor{b-}{
16659 \inOne
16660 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16661 }
16662 \anchor{b+}{
16663 \inOne
16664 \pgf@y=-\pgf@y
16665 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16666 }
16667 \anchor{bout}{
16668 \leftedge
16669 \pgf@x=-\pgf@x \pgf@y=0pt
16670 }
16671 \anchor{bout +}{
16672 \outport
16673 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
16674 }
16675 \anchor{bout -}{
16676 \outport
16677 \pgf@y=-\pgf@y
16678 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
16679 }
16680 \anchor{bout up}{
16681 \outportfixed
16682 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
16683 }
16684 \anchor{bout down}{
16685 \outportfixed
16686 \pgf@y=-\pgf@y
16687 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
16688 }
16689 % end border anchors
16690 %
16691 \anchor{west}{
16692 \left
16693 }
16694 \anchor{east}{
16695 \left
16696 \pgf@x=-\pgf@x
16697 }
16698 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16699 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16700 \anchor{north west}{ \northwest }
16701 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16702 \anchor{text}{
16703 \ifpgf@circ@center@text
16704 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16705 \else
16706 \leftedge
16707 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16708 \fi
16709 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16710 }
16711
16712 % let's start drawing the component
16713 \backgroundpath{
16714 \pgfsetcolor{\ctikzvalof{color}}
16715 %
16716 \northwest
16717 \pgf@circ@res@up = \pgf@y
16718 \pgf@circ@res@down = -\pgf@y
16719 \pgf@circ@res@right = -\pgf@x
16720 \pgf@circ@res@left = \pgf@x
16721 \pgf@circ@scaled@Rlen=\scaledRlen
16722 % main component, normally in thicker lines
16723 \pgfscope
16724 \newdimen\pgf@circ@res@right@double
16725 \pgf@circ@res@right@double=2\pgf@circ@res@right
16726
16727 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16728 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
16729 \pgf@circ@res@step=\pgf@circ@res@right
16730 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16731 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
16732 %first point (near output)
16733 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
16734 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
16735 \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}}
16736 % and then to the input "front up", "down", to the output short side "down"
16737 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
16738 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
16739 \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}}
16740 % ...and close
16741 \pgfpathclose
16742 \pgf@circ@draworfill
16743 \endpgfscope
16744
16745 % input terminal up
16746 \pgfpathmoveto{\pgfpoint
16747 {\pgf@circ@res@left}
16748 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
16749 %
16750 \pgfpathlineto{\pgfpoint
16751 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
16752 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
16753 %
16754 \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}
16755
16756 % input terminal down
16757 \pgfpathmoveto{\pgfpoint
16758 {\pgf@circ@res@left}
16759 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
16760 %
16761 \pgfpathlineto{\pgfpoint
16762 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
16763 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
16764 \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}
16765
16766 % output leads down and up
16767 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
16768 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
16769 \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}
16770
16771 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
16772 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
16773 \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}
16774 %
16775 \pgfsetrectcap
16776 \pgfusepath{draw}
16777 }
16778 }
16779
16780 % Transconductance amplifier (Transkonduktanzverstärker)
16781 \pgfdeclareshape{gm amp}
16782 {
16783 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16784 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16785 \anchor{center}{\pgfpointorigin}
16786 \savedanchor\northwest{%
16787 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16788 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
16789 \pgf@y=.5\pgf@y
16790 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
16791 \pgf@x=.5\pgf@x
16792 }
16793 \anchor{south}{
16794 \northwest
16795 \pgf@y=-\pgf@y
16796 }
16797 \anchor{north}{
16798 \northwest
16799 }
16800 \savedanchor\left{%
16801 \pgf@y=0pt
16802 }
16803 \anchor{leftedge}
16804 {\left
16805 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
16806 }
16807 \savedanchor\inOneFixed{%
16808 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16809 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
16810 \pgf@y=.5\pgf@y
16811 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
16812 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
16813 \pgf@x=.5\pgf@x
16814 }
16815 \anchor{in up}{
16816 \inOneFixed
16817 }
16818 \anchor{in down}{
16819 \inOneFixed
16820 \pgf@y=-\pgf@y
16821 }
16822 \savedanchor\inOne{%
16823 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16824 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
16825 \pgf@y=.5\pgf@y
16826 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
16827 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
16828 \pgf@x=.5\pgf@x
16829 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
16830 }
16831 \anchor{-}{
16832 \inOne
16833 }
16834 \anchor{+}{
16835 \inOne
16836 \pgf@y=-\pgf@y
16837 }
16838 \savedanchor\up{%
16839 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16840 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
16841 \pgf@y=.5\pgf@y
16842 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
16843 \pgf@x=.5\pgf@x
16844 \pgf@circ@res@up = \pgf@y
16845 \pgf@circ@res@right = -\pgf@x
16846 \pgf@circ@res@left = \pgf@x
16847 \pgfpointlineattime{
16848 \ctikzvalof{tripoles/gm amp/up pos}}{
16849 \pgfpoint{
16850 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
16851 {\pgf@circ@res@up}}
16852 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
16853 }
16854 \anchor{up}{
16855 \up
16856 }
16857 \anchor{down}{
16858 \up
16859 \pgf@y=-\pgf@y
16860 }
16861 \anchor{out}{
16862 \northwest
16863 \pgf@y=0pt
16864 \pgf@x=-\pgf@x
16865 }
16866 % support for border anchors
16867 \savedanchor\leftedge{%
16868 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16869 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
16870 \pgf@x=.5\pgf@x
16871 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
16872 \pgf@y=0pt
16873 }
16874 \anchor{leftedge}{\leftedge}
16875 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
16876 \anchor{bin up}{
16877 \inOneFixed
16878 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16879 }
16880 \anchor{bin down}{
16881 \inOneFixed
16882 \pgf@y=-\pgf@y
16883 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16884 }
16885 \anchor{b-}{
16886 \inOne
16887 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16888 }
16889 \anchor{b+}{
16890 \inOne
16891 \pgf@y=-\pgf@y
16892 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
16893 }
16894 \anchor{bout}{
16895 \leftedge
16896 \pgf@y=0pt
16897 \pgf@x=-\pgf@x
16898 }
16899 % end border anchors
16900 \anchor{west}{
16901 \left
16902 }
16903 \anchor{east}{
16904 \left
16905 \pgf@x=-\pgf@x
16906 }
16907 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
16908 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
16909 \anchor{north west}{ \northwest }
16910 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
16911
16912 \anchor{text}{
16913 \ifpgf@circ@center@text
16914 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
16915 \else
16916 \leftedge
16917 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
16918 \fi
16919 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16920 }
16921 \backgroundpath{
16922 \pgfsetcolor{\ctikzvalof{color}}
16923
16924 \northwest
16925 \pgf@circ@res@up = \pgf@y
16926 \pgf@circ@res@down = -\pgf@y
16927 \pgf@circ@res@right = -\pgf@x
16928 \pgf@circ@res@left = \pgf@x
16929 \pgf@circ@scaled@Rlen=\scaledRlen
16930
16931 \pgfscope
16932 \newdimen\pgf@circ@res@right@double
16933 \pgf@circ@res@right@double=2\pgf@circ@res@right
16934
16935 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16936 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
16937 \pgf@circ@res@step=\pgf@circ@res@right
16938 \advance\pgf@circ@res@step by -\pgf@circ@res@left
16939 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
16940 %Umrandung:
16941 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
16942 \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
16943 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
16944 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
16945 \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
16946 \pgfpathclose
16947 \pgf@circ@draworfill
16948 \endpgfscope
16949
16950 \pgfpathmoveto{\pgfpoint
16951 {\pgf@circ@res@left}
16952 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
16953 \pgfpathlineto{\pgfpoint
16954 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
16955 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
16956 \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}
16957
16958
16959 \pgfpathmoveto{\pgfpoint
16960 {\pgf@circ@res@left}
16961 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
16962 \pgfpathlineto{\pgfpoint
16963 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
16964 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
16965 \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}
16966
16967 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
16968 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
16969 \pgfsetrectcap
16970 \pgfusepath{draw}
16971
16972 }
16973 }
16974
16975 % Instrumentation amplifier
16976 \pgfdeclareshape{inst amp}
16977 {
16978 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
16979 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16980 % when tikz calls the anchor it wants the relative position in the lengths
16981 % \pgf@x \pgf@y
16982 % \pgfpoint* functions set that variables
16983 % anchors are visible outside and run on use
16984 \anchor{center}{\pgfpointorigin}
16985 % savedanchors are internals and run on node creation (not use)
16986 % bounding-box top left
16987 \savedanchor\northwest{%
16988 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16989 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
16990 \pgf@y=.5\pgf@y
16991 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
16992 \pgf@x=.5\pgf@x
16993 }
16994 \anchor{nw}{
16995 \northwest
16996 }
16997 \anchor{south}{
16998 \northwest
16999 \pgf@y=-\pgf@y
17000 }
17001 \anchor{north}{
17002 \northwest
17003 }
17004 \savedanchor\left{%
17005 \pgf@y=0pt
17006 }
17007 \anchor{leftedge}
17008 {\left
17009 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
17010 }
17011 \savedanchor\inOneFixed{%
17012 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17013 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17014 \pgf@y=.5\pgf@y
17015 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
17016 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17017 \pgf@x=.5\pgf@x
17018 }
17019 \anchor{in up}{
17020 \inOneFixed
17021 }
17022 \anchor{in down}{
17023 \inOneFixed
17024 \pgf@y=-\pgf@y
17025 }
17026 \savedanchor\inOne{%
17027 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17028 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17029 \pgf@y=.5\pgf@y
17030 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
17031 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17032 \pgf@x=.5\pgf@x
17033 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17034 }
17035 \anchor{-}{
17036 \inOne
17037 }
17038 \anchor{+}{
17039 \inOne
17040 \pgf@y=-\pgf@y
17041 }
17042 \savedanchor\up{%
17043 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17044 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17045 \pgf@y=.5\pgf@y
17046 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17047 \pgf@x=.5\pgf@x
17048 \pgf@circ@res@up = \pgf@y
17049 \pgf@circ@res@right = -\pgf@x
17050 \pgf@circ@res@left = \pgf@x
17051 \pgfpointlineattime{
17052 \ctikzvalof{tripoles/inst amp/up pos}}{
17053 \pgfpoint{
17054 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17055 {\pgf@circ@res@up}}
17056 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
17057 }
17058 \anchor{up}{
17059 \up
17060 }
17061 \anchor{down}{
17062 \up
17063 \pgf@y=-\pgf@y
17064 }
17065 % reference voltage input anchors.
17066 \savedanchor\refv{%
17067 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17068 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
17069 \pgf@y=.5\pgf@y
17070 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17071 \pgf@x=.5\pgf@x
17072 \pgf@circ@res@up = \pgf@y
17073 \pgf@circ@res@right = -\pgf@x
17074 \pgf@circ@res@left = \pgf@x
17075 \pgfpointlineattime{
17076 \ctikzvalof{tripoles/inst amp/refv pos}}{
17077 \pgfpoint{
17078 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17079 {\pgf@circ@res@up}}
17080 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
17081 }
17082 % we need both because they are normally drawn under the amp, and if you
17083 % mirror it vertically you need them
17084 \anchor{refv up}{
17085 \refv
17086 }
17087 \anchor{refv down}{
17088 \refv
17089 \pgf@y=-\pgf@y
17090 }
17091 \anchor{out}{
17092 \northwest
17093 \pgf@y=0pt
17094 \pgf@x=-\pgf@x
17095 }
17096 % support for border anchors
17097 \savedanchor\leftedge{%
17098 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17099 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
17100 \pgf@x=.5\pgf@x
17101 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
17102 \pgf@y=0pt
17103 }
17104 \anchor{leftedge}{\leftedge}
17105 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
17106 \anchor{bin up}{
17107 \inOneFixed
17108 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17109 }
17110 \anchor{bin down}{
17111 \inOneFixed
17112 \pgf@y=-\pgf@y
17113 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17114 }
17115 \anchor{b-}{
17116 \inOne
17117 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17118 }
17119 \anchor{b+}{
17120 \inOne
17121 \pgf@y=-\pgf@y
17122 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17123 }
17124 \anchor{bout}{
17125 \leftedge
17126 \pgf@y=0pt
17127 \pgf@x=-\pgf@x
17128 }
17129 % end border anchors
17130 \anchor{west}{
17131 \left
17132 }
17133 \anchor{east}{
17134 \left
17135 \pgf@x=-\pgf@x
17136 }
17137 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17138 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17139 \anchor{north west}{ \northwest }
17140 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17141
17142 \anchor{text}{
17143 \ifpgf@circ@center@text
17144 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17145 \else
17146 \leftedge
17147 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
17148 \fi
17149 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17150 }
17151
17152 % let's start drawing the component
17153 \backgroundpath{
17154 \pgfsetcolor{\ctikzvalof{color}}
17155 %
17156 \northwest
17157 \pgf@circ@res@up = \pgf@y
17158 \pgf@circ@res@down = -\pgf@y
17159 \pgf@circ@res@right = -\pgf@x
17160 \pgf@circ@res@left = \pgf@x
17161 \pgf@circ@scaled@Rlen=\scaledRlen
17162
17163 % main component, normally in thicker lines
17164 \pgfscope
17165 \newdimen\pgf@circ@res@right@double
17166 \pgf@circ@res@right@double=2\pgf@circ@res@right
17167
17168 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17169 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17170 \pgf@circ@res@step=\pgf@circ@res@right
17171 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17172 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
17173 %first point (near output)
17174 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
17175 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
17176 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
17177 % and then to the input "front up", "down", to the output short side "down"
17178 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17179 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17180 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
17181 % ...and close
17182 \pgfpathclose
17183 \pgf@circ@draworfill
17184 \endpgfscope
17185
17186 % Negative input terminal
17187 \pgfpathmoveto{\pgfpoint
17188 {\pgf@circ@res@left}
17189 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
17190 %
17191 \pgfpathlineto{\pgfpoint
17192 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17193 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
17194 %
17195 \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}
17196
17197 % Positive input terminal
17198 \pgfpathmoveto{\pgfpoint
17199 {\pgf@circ@res@left}
17200 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
17201 %
17202 \pgfpathlineto{\pgfpoint
17203 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
17204 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
17205 \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}
17206
17207 % Output terminal
17208 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17209 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
17210 %
17211 \pgfsetrectcap
17212 \pgfusepath{draw}
17213 }
17214 }
17215
17216 % Instrumentation amplifier with terminals for gain resistance between inputs
17217 \pgfdeclareshape{inst amp ra}
17218 {
17219 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17220 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17221 \anchor{center}{\pgfpointorigin}
17222 % bounding-box top left
17223 \savedanchor\northwest{%
17224 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17225 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17226 \pgf@y=.5\pgf@y
17227 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17228 \pgf@x=.5\pgf@x
17229 }
17230 \anchor{nw}{
17231 \northwest
17232 }
17233 \anchor{south}{
17234 \northwest
17235 \pgf@y=-\pgf@y\pgf@x=0pt\relax
17236 }
17237 \anchor{north}{
17238 \northwest\pgf@x=0pt\relax
17239 }
17240 \savedanchor\left{%
17241 \pgf@y=0pt
17242 }
17243 \anchor{leftedge}
17244 {\left
17245 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
17246 }
17247 % inputs (+-)
17248 \savedanchor\inOneFixed{%
17249 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17250 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17251 \pgf@y=.5\pgf@y
17252 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
17253 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17254 \pgf@x=.5\pgf@x
17255 }
17256 \anchor{in up}{
17257 \inOneFixed
17258 }
17259 \anchor{in down}{
17260 \inOneFixed
17261 \pgf@y=-\pgf@y
17262 }
17263 \savedanchor\inOne{%
17264 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17265 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17266 \pgf@y=.5\pgf@y
17267 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
17268 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17269 \pgf@x=.5\pgf@x
17270 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17271 }
17272 \anchor{-}{
17273 \inOne
17274 }
17275 \anchor{+}{
17276 \inOne
17277 \pgf@y=-\pgf@y
17278 }
17279 % R ampli anchors. They are by default at 20% more than R-length distance
17280 % you can change that with the `ra pos` key (use 0.5 for one-R).
17281 \savedanchor\raOneFixed{%
17282 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17283 \pgf@y=\pgf@circ@scaled@Rlen
17284 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
17285 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17286 \pgf@x=.5\pgf@x
17287 }
17288 \anchor{ra up}{
17289 \raOneFixed
17290 }
17291 \anchor{ra down}{
17292 \raOneFixed
17293 \pgf@y=-\pgf@y
17294 }
17295 \savedanchor\raOne{%
17296 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17297 \pgf@y=\pgf@circ@scaled@Rlen
17298 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
17299 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17300 \pgf@x=.5\pgf@x
17301 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17302 }
17303 \anchor{ra-}{
17304 \raOne
17305 }
17306 \anchor{ra+}{
17307 \raOne
17308 \pgf@y=-\pgf@y
17309 }
17310 % power supplies
17311 \savedanchor\up{%
17312 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17313 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17314 \pgf@y=.5\pgf@y
17315 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17316 \pgf@x=.5\pgf@x
17317 \pgf@circ@res@up = \pgf@y
17318 \pgf@circ@res@right = -\pgf@x
17319 \pgf@circ@res@left = \pgf@x
17320 \pgfpointlineattime{
17321 \ctikzvalof{tripoles/inst amp ra/up pos}}{
17322 \pgfpoint{
17323 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17324 {\pgf@circ@res@up}}
17325 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
17326 }
17327 \anchor{up}{
17328 \up
17329 }
17330 \anchor{down}{
17331 \up
17332 \pgf@y=-\pgf@y
17333 }
17334 % reference voltage input anchors.
17335 \savedanchor\refv{%
17336 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17337 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
17338 \pgf@y=0.5\pgf@y
17339 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17340 \pgf@x=0.5\pgf@x
17341 \pgf@circ@res@up = \pgf@y
17342 \pgf@circ@res@right = -\pgf@x
17343 \pgf@circ@res@left = \pgf@x
17344 \pgfpointlineattime{
17345 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
17346 \pgfpoint{
17347 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17348 {\pgf@circ@res@up}}
17349 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
17350 }
17351 % we need both because they are normally drawn under the amp, and if you
17352 % mirror it vertically you need them
17353 \anchor{refv up}{
17354 \refv
17355 }
17356 \anchor{refv down}{
17357 \refv
17358 \pgf@y=-\pgf@y
17359 }
17360 \anchor{out}{
17361 \northwest
17362 \pgf@y=0pt
17363 \pgf@x=-\pgf@x
17364 }
17365 % support for border anchors
17366 \savedanchor\leftedge{%
17367 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17368 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
17369 \pgf@x=.5\pgf@x
17370 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
17371 \pgf@y=0pt
17372 }
17373 \anchor{leftedge}{\leftedge}
17374 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
17375 \anchor{bin up}{
17376 \inOneFixed
17377 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17378 }
17379 \anchor{bin down}{
17380 \inOneFixed
17381 \pgf@y=-\pgf@y
17382 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17383 }
17384 \anchor{b-}{
17385 \inOne
17386 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17387 }
17388 \anchor{b+}{
17389 \inOne
17390 \pgf@y=-\pgf@y
17391 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17392 }
17393 \anchor{bra up}{
17394 \raOneFixed
17395 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17396 }
17397 \anchor{bra down}{
17398 \raOneFixed
17399 \pgf@y=-\pgf@y
17400 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17401 }
17402 \anchor{bra-}{
17403 \raOne
17404 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17405 }
17406 \anchor{bra+}{
17407 \raOne
17408 \pgf@y=-\pgf@y
17409 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17410 }
17411 \anchor{bout}{
17412 \leftedge
17413 \pgf@y=0pt
17414 \pgf@x=-\pgf@x
17415 }
17416 % end border anchors
17417 \anchor{west}{
17418 \left
17419 }
17420 \anchor{east}{
17421 \left
17422 \pgf@x=-\pgf@x
17423 }
17424 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17425 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17426 \anchor{north west}{ \northwest }
17427 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17428
17429 \anchor{text}{
17430 \ifpgf@circ@center@text
17431 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17432 \else
17433 \leftedge
17434 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
17435 \fi
17436 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17437 }
17438
17439 % drawing of the component
17440 \backgroundpath{
17441 \pgfsetcolor{\ctikzvalof{color}}
17442
17443 \northwest
17444 \pgf@circ@res@up = \pgf@y
17445 \pgf@circ@res@down = -\pgf@y
17446 \pgf@circ@res@right = -\pgf@x
17447 \pgf@circ@res@left = \pgf@x
17448 \pgf@circ@scaled@Rlen=\scaledRlen
17449
17450 \newdimen\pgf@circ@res@right@double
17451 \pgf@circ@res@right@double=2\pgf@circ@res@right
17452
17453 % main component, normally in thicker lines
17454 \pgfscope
17455 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17456 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17457 \pgf@circ@res@step=\pgf@circ@res@right
17458 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17459 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
17460 %primer punto: la linea de salida (lado componente)
17461 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
17462 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
17463 \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}}
17464 % and then to the input "front up", "down", to the output short side "down"
17465 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17466 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17467 \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}}
17468 % ...and close
17469 \pgfpathclose
17470 \pgf@circ@draworfill
17471 \endpgfscope
17472
17473 % ra terminal -
17474 \pgfpathmoveto{\pgfpoint
17475 {\pgf@circ@res@left}
17476 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
17477 %
17478 \pgfpathlineto{\pgfpoint
17479 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17480 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
17481 % ra terminal +
17482 \pgfpathmoveto{\pgfpoint
17483 {\pgf@circ@res@left}
17484 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
17485 %
17486 \pgfpathlineto{\pgfpoint
17487 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17488 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
17489
17490 % Negative input terminal
17491 \pgfpathmoveto{\pgfpoint
17492 {\pgf@circ@res@left}
17493 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
17494 %
17495 \pgfpathlineto{\pgfpoint
17496 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17497 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
17498 %
17499 \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}
17500
17501 % Positive input terminal
17502 \pgfpathmoveto{\pgfpoint
17503 {\pgf@circ@res@left}
17504 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
17505 %
17506 \pgfpathlineto{\pgfpoint
17507 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
17508 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
17509 \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}
17510
17511 % Output terminal
17512 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17513 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
17514 %
17515 \pgfsetrectcap
17516 \pgfusepath{draw}
17517 }
17518 }
17519
17520 % Buffer
17521 % Contributed by Danilo Piazzalunga
17522 \pgfdeclareshape{buffer}
17523 {
17524 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17525 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17526 \anchor{center}{\pgfpointorigin}
17527 \savedanchor\northwest{%
17528 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17529 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
17530 \pgf@y=.5\pgf@y
17531 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
17532 \pgf@x=.5\pgf@x
17533 }
17534 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
17535 \anchor{west}{ \northwest \pgf@y=0pt }
17536 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
17537 \anchor{north}{ \northwest \pgf@x=0pt }
17538 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17539 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17540 \anchor{north west}{ \northwest }
17541 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17542 \savedanchor\left{%
17543 \pgf@y=0pt
17544 }
17545 \anchor{in}{
17546 \northwest
17547 \pgf@y=0pt
17548 }
17549 \anchor{out}{
17550 \northwest
17551 \pgf@y=0pt
17552 \pgf@x=-\pgf@x
17553 }
17554 \anchor{bin}{
17555 \northwest
17556 \pgf@y=0pt
17557 \pgf@x=0.7\pgf@x
17558 }
17559 \anchor{bout}{
17560 \northwest
17561 \pgf@y=0pt
17562 \pgf@x=-0.7\pgf@x
17563 }
17564
17565 \anchor{text}{
17566 \ifpgf@circ@center@text
17567 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17568 \else
17569 \northwest
17570 \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
17571 \fi
17572 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17573 }
17574
17575 \backgroundpath{
17576 \pgfsetcolor{\ctikzvalof{color}}
17577
17578 \northwest
17579 \pgf@circ@res@up = \pgf@y
17580 \pgf@circ@res@down = -\pgf@y
17581 \pgf@circ@res@right = -\pgf@x
17582 \pgf@circ@res@left = \pgf@x
17583 \pgf@circ@scaled@Rlen=\scaledRlen
17584 \pgfscope
17585 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17586 \pgftransformxshift{.7\pgf@circ@res@left}
17587 \pgf@circ@res@step=\pgf@circ@res@right
17588 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17589 \pgf@circ@res@step=.7\pgf@circ@res@step
17590
17591 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
17592 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17593 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17594 \pgfpathclose
17595 \pgf@circ@draworfill
17596 \endpgfscope
17597
17598 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
17599 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
17600
17601 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17602 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
17603
17604 \pgfusepath{draw}
17605 }
17606 }
17607
17608 % plain amplifier, no symbols
17609 \pgfdeclareshape{plain amp}
17610 {
17611 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17612 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17613 \anchor{center}{\pgfpointorigin}
17614 \savedanchor\northwest{%
17615 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17616 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17617 \pgf@y=.5\pgf@y
17618 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17619 \pgf@x=.5\pgf@x
17620 }
17621 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
17622 \anchor{west}{ \northwest \pgf@y=0pt }
17623 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
17624 \anchor{north}{ \northwest \pgf@x=0pt }
17625 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17626 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17627 \anchor{north west}{ \northwest }
17628 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17629 \savedanchor\left{%
17630 \pgf@y=0pt
17631 }
17632 \savedanchor\inOne{%
17633 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17634 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17635 \pgf@y=.5\pgf@y
17636 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
17637 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17638 \pgf@x=.5\pgf@x
17639 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
17640 }
17641 \savedanchor\inOneFixed{%
17642 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17643 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17644 \pgf@y=.5\pgf@y
17645 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
17646 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17647 \pgf@x=.5\pgf@x
17648 }
17649 \anchor{-}{
17650 \inOne
17651 }
17652 \anchor{+}{
17653 \inOne
17654 \pgf@y=-\pgf@y
17655 }
17656 \anchor{in up}{
17657 \inOneFixed
17658 }
17659 \anchor{in down}{
17660 \inOneFixed
17661 \pgf@y=-\pgf@y
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/plain amp/width}\pgf@circ@scaled@Rlen
17667 \pgf@x=.5\pgf@x
17668 \pgf@x = \ctikzvalof{tripoles/plain amp/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{bout}{
17692 \leftedge
17693 \pgf@y=0pt
17694 \pgf@x=-\pgf@x
17695 }
17696 % end border anchors
17697 \savedanchor\up{%
17698 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17699 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17700 \pgf@y=.5\pgf@y
17701 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17702 \pgf@x=.5\pgf@x
17703 \pgf@circ@res@up = \pgf@y
17704 \pgf@circ@res@right = -\pgf@x
17705 \pgf@circ@res@left = \pgf@x
17706 \pgfpointlineattime{
17707 \ctikzvalof{tripoles/plain amp/up pos}}{
17708 \pgfpoint{
17709 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
17710 {\pgf@circ@res@up}}
17711 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
17712 }
17713 \anchor{up}{
17714 \up
17715 }
17716 \anchor{down}{
17717 \up
17718 \pgf@y=-\pgf@y
17719 }
17720 \anchor{out}{
17721 \northwest
17722 \pgf@y=0pt
17723 \pgf@x=-\pgf@x
17724 }
17725
17726 \anchor{text}{
17727 \ifpgf@circ@center@text
17728 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17729 \else
17730 \leftedge
17731 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
17732 \fi
17733 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17734 }
17735
17736 \backgroundpath{
17737 \pgfsetcolor{\ctikzvalof{color}}
17738
17739 \northwest
17740 \pgf@circ@res@up = \pgf@y
17741 \pgf@circ@res@down = -\pgf@y
17742 \pgf@circ@res@right = -\pgf@x
17743 \pgf@circ@res@left = \pgf@x
17744
17745 \pgfscope
17746 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17747 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
17748 \pgf@circ@res@step=\pgf@circ@res@right
17749 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17750 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
17751
17752 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
17753 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17754 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17755 \pgfpathclose
17756 \pgf@circ@draworfill
17757 \endpgfscope
17758 \pgfpathmoveto{\pgfpoint
17759 {\pgf@circ@res@left}
17760 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
17761 \pgfpathlineto{\pgfpoint
17762 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
17763 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
17764
17765
17766 \pgfpathmoveto{\pgfpoint
17767 {\pgf@circ@res@left}
17768 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
17769 \pgfpathlineto{\pgfpoint
17770 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
17771 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
17772
17773 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17774 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
17775
17776 \pgfusepath{draw}
17777 }
17778 }
17779
17780 % plain amplifier, no symbols, one input
17781 \pgfdeclareshape{plain mono amp}
17782 {
17783 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
17784 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17785 \anchor{center}{\pgfpointorigin}
17786 \savedanchor\northwest{%
17787 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17788 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17789 \pgf@y=.5\pgf@y
17790 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17791 \pgf@x=.5\pgf@x
17792 }
17793 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
17794 \anchor{west}{ \northwest \pgf@y=0pt }
17795 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
17796 \anchor{north}{ \northwest \pgf@x=0pt }
17797 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
17798 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
17799 \anchor{north west}{ \northwest }
17800 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
17801 \savedanchor\left{%
17802 \pgf@y=0pt
17803 }
17804 \savedanchor\inOne{%
17805 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17806 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17807 \pgf@x=.5\pgf@x
17808 \pgf@y=0pt\relax
17809 }
17810 \anchor{in}{
17811 \inOne
17812 }
17813 % support for border anchors
17814 \savedanchor\leftedge{%
17815 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17816 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17817 \pgf@x=.5\pgf@x
17818 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
17819 \pgf@y=0pt
17820 }
17821 \anchor{leftedge}{\leftedge}
17822 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
17823 \anchor{bin}{
17824 \inOne
17825 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
17826 }
17827 \anchor{bout}{
17828 \leftedge
17829 \pgf@y=0pt
17830 \pgf@x=-\pgf@x
17831 }
17832 % end border anchors
17833 \savedanchor\up{%
17834 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17835 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
17836 \pgf@y=.5\pgf@y
17837 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
17838 \pgf@x=.5\pgf@x
17839 \pgf@circ@res@up = \pgf@y
17840 \pgf@circ@res@right = -\pgf@x
17841 \pgf@circ@res@left = \pgf@x
17842 \pgfpointlineattime{
17843 \ctikzvalof{tripoles/plain amp/up pos}}{
17844 \pgfpoint{
17845 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
17846 {\pgf@circ@res@up}}
17847 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
17848 }
17849 \anchor{up}{
17850 \up
17851 }
17852 \anchor{down}{
17853 \up
17854 \pgf@y=-\pgf@y
17855 }
17856 \anchor{out}{
17857 \northwest
17858 \pgf@y=0pt
17859 \pgf@x=-\pgf@x
17860 }
17861
17862 \anchor{text}{
17863 \ifpgf@circ@center@text
17864 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
17865 \else
17866 \leftedge
17867 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
17868 \fi
17869 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17870 }
17871 \backgroundpath{
17872 \pgfsetcolor{\ctikzvalof{color}}
17873
17874 \northwest
17875 \pgf@circ@res@up = \pgf@y
17876 \pgf@circ@res@down = -\pgf@y
17877 \pgf@circ@res@right = -\pgf@x
17878 \pgf@circ@res@left = \pgf@x
17879
17880 \pgfscope
17881 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17882 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
17883 \pgf@circ@res@step=\pgf@circ@res@right
17884 \advance\pgf@circ@res@step by -\pgf@circ@res@left
17885 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
17886
17887 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
17888 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
17889 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
17890 \pgfpathclose
17891 \pgf@circ@draworfill
17892 \endpgfscope
17893 \pgfpathmoveto{\pgfpoint
17894 {\pgf@circ@res@left}
17895 {0pt}}
17896 \pgfpathlineto{\pgfpoint
17897 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
17898 {0pt}}
17899
17900 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17901 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
17902
17903 \pgfusepath{draw}
17904 }
17905 }% %>>>
17906
17907 %%%%%%%%%%%%%%%%%%%%%%%%%%%
17908 %% Tubes and magnetron
17909 %%%%%%%%%%%%%%%%%%%%%%%%
17910
17911 % Settings Electronic tubes: diodetube, triode, tetrode and pentode%<<<1
17912 \ctikzset{tubes/width/.initial=1} % relative width
17913 \ctikzset{tubes/height/.initial=1.4} % relative height
17914 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
17915 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
17916 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
17917 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
17918 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
17919 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
17920 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
17921 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
17922 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
17923 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
17924 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
17925 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
17926 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
17927
17928 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
17929
17930 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
17931 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
17932 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
17933 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
17934 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
17935 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
17936 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
17937 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
17938 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}%
17939 %>>>
17940
17941 %% Node shapes for tubes & co%<<<
17942
17943 %%%%%%%%%%%%%%%%%%%
17944 %% Magnetron
17945 %%%%%%%%%%%%%%%%%%%
17946
17947 \pgfdeclareshape{magnetron}
17948 {
17949 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
17950 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17951 \savedanchor\northwest{
17952 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17953 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
17954 \pgf@y=.5\pgf@y
17955 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
17956 \pgf@x=.5\pgf@x
17957 }
17958 \anchor{center}{
17959 \pgfpointorigin
17960 }
17961 \anchor{anode}{
17962 \northwest
17963 \pgf@x=0pt
17964 \pgf@y=-\pgf@y
17965 }
17966 \anchor{cathode1}{
17967 \northwest
17968 \pgf@circ@res@step=\pgf@y
17969 \pgfmathparse{cos(105)}
17970 \pgf@x=\pgfmathresult\pgf@circ@res@step
17971 \pgfmathparse{sin(105)}
17972 \pgf@y=\pgfmathresult\pgf@circ@res@step
17973 %\pgfpointorigin
17974 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
17975 }
17976 \anchor{cathode2}{
17977 \northwest
17978 \pgf@circ@res@step=\pgf@y
17979 \pgfmathparse{cos(75)}
17980 \pgf@x=\pgfmathresult\pgf@circ@res@step
17981 \pgfmathparse{sin(75)}
17982 \pgf@y=\pgfmathresult\pgf@circ@res@step
17983 %\pgfpointorigin
17984 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
17985 }
17986 \anchor{text}{
17987 \pgfpointorigin
17988 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
17989 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
17990 }
17991 \anchor{left}{%
17992 \northwest
17993 \pgf@y=0pt
17994 }
17995 \anchor{right}{%
17996 \northwest
17997 \pgf@y=0pt
17998 \pgf@x=-\pgf@x
17999 }
18000 \anchor{top}{
18001 \northwest
18002 \pgf@x=0pt
18003 }
18004 \anchor{pathstart}{
18005 \northwest
18006 \pgf@x=0pt
18007 }
18008 \anchor{pathend}{
18009 \northwest
18010 \pgf@x=0pt
18011 \pgf@y=-\pgf@y
18012 }
18013 \anchor{bottom}{
18014 \northwest
18015 \pgf@x=0pt
18016 \pgf@y=-\pgf@y
18017 }
18018 \anchor{center}{
18019 \pgf@y=0pt
18020 \pgf@x=0pt
18021 }
18022 \anchor{east}{
18023 \northwest
18024 \pgf@y=0pt
18025 \pgf@x=-\pgf@x
18026 }
18027 \anchor{west}{
18028 \northwest
18029 \pgf@y=0pt
18030 }
18031 \anchor{south}{
18032 \northwest
18033 \pgf@x=0pt
18034 \pgf@y=-\pgf@y
18035 }
18036 \anchor{north}{
18037 \northwest
18038 \pgf@x=0pt
18039 }
18040 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18041 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
18042 \anchor{north west}{ \northwest }
18043 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
18044 \backgroundpath{
18045 \pgfsetcolor{\ctikzvalof{color}}
18046 \pgf@circ@scaled@Rlen=\scaledRlen
18047 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
18048 \northwest
18049 \pgf@circ@res@up = \pgf@y
18050 \pgf@circ@res@down = -\pgf@y
18051 \pgf@circ@res@right = -\pgf@x
18052 \pgf@circ@res@left = \pgf@x
18053 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
18054
18055 \pgfscope
18056 \pgfstartlinewidth=\pgflinewidth
18057 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
18058 %create outer circle
18059 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
18060 \pgf@circ@draworfill
18061 %create chambers
18062 \foreach \angle in {45,135,225,315}{
18063 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
18064 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
18065 }
18066 \pgfsetroundcap
18067 \pgfusepath{draw}
18068 \pgfscope
18069 %draw connection from outside
18070 %anode
18071 \pgfsetlinewidth{\pgfstartlinewidth}
18072 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
18073 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
18074 %cathodes
18075 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
18076 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
18077 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
18078 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
18079 \pgfsetbuttcap
18080 \pgfusepath{draw}
18081 \endpgfscope
18082 %create cathode
18083 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
18084 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
18085 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
18086 \pgfusepath{draw}
18087 %create anode
18088 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
18089 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
18090
18091 \pgfsetbuttcap
18092 \pgfusepath{draw}
18093 \endpgfscope
18094 }
18095 }
18096
18097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18098 % Electronic tubes, submitted by J. op den Brouw
18099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18100
18101 % Draw tube outline
18102 \def\pgf@circ@tubes@drawtube{%
18103 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
18104 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18105 \pgfutil@tempdima=\pgf@circ@res@right
18106 \advance\pgfutil@tempdima by -\pgf@circ@res@up
18107 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
18108 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
18109 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
18110 \pgfpatharc{270}{90}{\pgf@circ@res@up}
18111 \else
18112 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
18113 \pgfutil@tempdima=\pgf@circ@res@up
18114 \advance\pgfutil@tempdima by -\pgf@circ@res@right
18115 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
18116 \pgfpatharc{180}{0}{\pgf@circ@res@right}
18117 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
18118 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
18119 \fi
18120 \pgfpathclose
18121 }
18122
18123 %% The diode (tube), triode, tetrode and pentode only differ in the
18124 %% number of grids. So we construct a generic declare function in
18125 %% which we can put code for the grid anchors and grid drawing code
18126 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
18127 \long\def\pgfcircdeclaretube#1#2#3{%
18128 \pgfdeclareshape{#1}{
18129 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
18130 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18131 \anchor{center}{
18132 \pgfpointorigin
18133 }
18134 \savedanchor\northwest{%
18135 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18136 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
18137 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
18138 % x and y should be half the Rlen
18139 \pgf@y=\pgf@circ@res@up
18140 \pgf@y=.5\pgf@y
18141 \pgf@x=-\pgf@circ@res@right
18142 \pgf@x=.5\pgf@x
18143 }
18144 \anchor{north} {%
18145 \northwest
18146 \pgf@x=0pt
18147 }
18148 \anchor{east}{%
18149 \northwest
18150 \pgf@x=-\pgf@x
18151 \pgf@y=0pt
18152 }
18153 \anchor{south}{%
18154 \northwest
18155 \pgf@y=-\pgf@y
18156 \pgf@x=0pt
18157 }
18158 \anchor{west}{%
18159 \northwest
18160 \pgf@y=0pt
18161 }
18162 \anchor{north west}{%
18163 \northwest
18164 }
18165 \anchor{north east}{%
18166 \northwest
18167 \pgf@x=-\pgf@x
18168 }
18169 \anchor{south east}{
18170 \northwest
18171 \pgf@x=-\pgf@x
18172 \pgf@y=-\pgf@y
18173 }
18174 \anchor{south west}{
18175 \northwest
18176 \pgf@y=-\pgf@y
18177 }
18178 \anchor{anode} {%
18179 \northwest
18180 \pgf@x=0pt
18181 }
18182 \anchor{cathode}{%
18183 \northwest
18184 \pgf@y=-\pgf@y
18185 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
18186 }
18187 \anchor{cathode 1}{%
18188 \northwest
18189 \pgf@y=-\pgf@y
18190 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
18191 }
18192 \anchor{cathode 2}{%
18193 \northwest
18194 \pgf@y=-\pgf@y
18195 \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x
18196 }
18197 \anchor{filament 1}{%
18198 \northwest
18199 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
18200 \pgf@x=\pgfmathresult\pgf@x
18201 \pgf@y=-\pgf@y
18202 }
18203 \anchor{filament 2}{%
18204 \northwest
18205 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
18206 \pgf@x=-\pgfmathresult\pgf@x
18207 \pgf@y=-\pgf@y
18208 }
18209
18210 % Extra anchors
18211 #2
18212
18213 \backgroundpath{
18214 \pgfscope
18215 % Line width for tripoles
18216 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18217 \pgf@circ@scaled@Rlen=\scaledRlen
18218
18219 % Setup to draw tube
18220 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
18221 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
18222 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
18223 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18224
18225 % Tube outline
18226 \pgf@circ@tubes@drawtube
18227
18228 % Setup to draw grid, filament, anode and cathode
18229 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
18230 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
18231 \pgf@circ@res@up=0.5\pgf@circ@res@up
18232 \pgf@circ@res@right=0.5\pgf@circ@res@right
18233
18234 % Tube fill color (if any)
18235 \pgf@circ@draworfill
18236
18237 % Grid drawing
18238 #3
18239
18240 % Filament (is not drawn by default)
18241 \ifpgf@circuit@tubes@filament
18242 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
18243 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
18244 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
18245 \pgf@xa=\pgfmathresult\pgf@circ@res@right
18246 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
18247 \pgf@ya=\pgfmathresult\pgf@circ@res@up
18248 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
18249 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
18250 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
18251 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
18252 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
18253 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
18254 \pgf@circuit@tubes@filamentfalse
18255 \fi
18256
18257 % Anode (or plate)
18258 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
18259 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
18260 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
18261 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
18262
18263 % Cathode
18264 \ifpgf@circuit@tubes@nocathode
18265 \pgf@circuit@tubes@nocathodefalse
18266 \else
18267 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
18268 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
18269 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
18270 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
18271 \ifpgf@circuit@tubes@fullcathode
18272 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
18273 \pgf@circuit@tubes@fullcathodefalse
18274 \else
18275 \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}}
18276 \fi
18277 \fi
18278
18279 % Draw the background
18280 \pgfusepath{draw}
18281 \endpgfscope
18282 }
18283 }
18284 }
18285
18286 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
18287
18288 \pgfcircdeclaretube{triode}
18289 {
18290 \anchor{grid} {% should not be used
18291 \northwest
18292 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
18293 }
18294 \anchor{control} {%
18295 \northwest
18296 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
18297 }
18298 }
18299 {
18300 % Grid protrusion
18301 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18302 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
18303 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
18304 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
18305 % Grid dashes: calculations
18306 \pgf@xb=2\pgf@circ@res@right
18307 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
18308 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
18309 \multiply\pgf@circ@count@a by 2\relax
18310 \advance\pgf@circ@count@a by 1\relax
18311 \advance\pgf@circ@res@step by -\pgf@xa
18312 \divide\pgf@circ@res@step by \pgf@circ@count@a
18313 % Grid dashes: draw
18314 \pgf@circ@res@temp=\pgf@xa
18315 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
18316 \loop
18317 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18318 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
18319 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18320 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
18321 \advance\pgf@circ@count@a by-1
18322 \ifnum\pgf@circ@count@a>0\relax
18323 \repeat
18324 }
18325
18326 \pgfcircdeclaretube{tetrode}
18327 {
18328 \anchor{grid} {% should not be used
18329 \northwest
18330 \pgfutil@tempdima=\pgf@y
18331 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18332 \pgf@y=0.5\pgf@y
18333 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18334 }
18335 \anchor{control} {%
18336 \northwest
18337 \pgfutil@tempdima=\pgf@y
18338 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18339 \pgf@y=0.5\pgf@y
18340 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18341 }
18342 \anchor{screen} {%
18343 \northwest
18344 \pgfutil@tempdima=\pgf@y
18345 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
18346 \pgf@y=0.5\pgf@y
18347 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18348 }
18349 }
18350 {
18351 % Grid x/y points
18352 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18353 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
18354 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
18355 \pgfutil@tempdimb=-\pgfutil@tempdima
18356 \pgfutil@tempdima=0.5\pgfutil@tempdima
18357 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18358 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
18359 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18360 % Grid protrusion
18361 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
18362 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
18363 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
18364 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
18365 % Grid dashes: calculations
18366 \pgf@xb=2\pgf@circ@res@right
18367 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
18368 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
18369 \multiply\pgf@circ@count@a by 2\relax
18370 \advance\pgf@circ@count@a by 1\relax
18371 \advance\pgf@circ@res@step by -\pgf@xa
18372 \divide\pgf@circ@res@step by \pgf@circ@count@a
18373 % Grid dashes: draw
18374 \pgf@circ@res@temp=\pgf@xa
18375 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
18376 \loop
18377 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18378 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
18379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
18380 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
18381 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
18382 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18383 \advance\pgf@circ@count@a by-1
18384 \ifnum\pgf@circ@count@a>0\relax
18385 \repeat
18386 }
18387
18388 \pgfcircdeclaretube{pentode}
18389 {
18390 \anchor{grid} {% should not be used
18391 \northwest
18392 \pgfutil@tempdima=\pgf@y
18393 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18394 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18395 }
18396 \anchor{control} {%
18397 \northwest
18398 \pgfutil@tempdima=\pgf@y
18399 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18400 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18401 }
18402 \anchor{screen} {%
18403 \northwest
18404 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
18405 }
18406 \anchor{suppressor} {%
18407 \northwest
18408 \pgfutil@tempdima=\pgf@y
18409 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
18410 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18411 }
18412 }
18413 {
18414 % Grid x/y points
18415 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18416 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
18417 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
18418 \pgfutil@tempdimb=-\pgfutil@tempdima
18419 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18420 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18421 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18422 % Grid protrusion
18423 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
18424 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
18425 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
18426 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
18427 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
18428 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
18429 % Grid dashes: calculations
18430 \pgf@xb=2\pgf@circ@res@right
18431 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
18432 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
18433 \multiply\pgf@circ@count@a by 2\relax
18434 \advance\pgf@circ@count@a by 1\relax
18435 \advance\pgf@circ@res@step by -\pgf@xa
18436 \divide\pgf@circ@res@step by \pgf@circ@count@a
18437 % Grid dashes: draw
18438 \pgf@circ@res@temp=\pgf@xa
18439 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
18440 \loop
18441 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18442 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
18443 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
18444 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
18445 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
18446 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
18447 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
18448 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18449 \advance\pgf@circ@count@a by-1
18450 \ifnum\pgf@circ@count@a>0\relax
18451 \repeat
18452 }
18453
18454 \pgfcircdeclaretube{pentode suppressor to cathode}
18455 {
18456 \anchor{grid} {% should not be used
18457 \northwest
18458 \pgfutil@tempdima=\pgf@y
18459 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18460 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18461 }
18462 \anchor{control} {%
18463 \northwest
18464 \pgfutil@tempdima=\pgf@y
18465 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
18466 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
18467 }
18468 \anchor{screen} {%
18469 \northwest
18470 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
18471 }
18472 }
18473 {
18474 % Grid x/y points
18475 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
18476 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
18477 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
18478 \pgfutil@tempdimb=-\pgfutil@tempdima
18479 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18480 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18481 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
18482 % Grid protrusion
18483 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
18484 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
18485 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
18486 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
18487 % Grid dashes: calculations
18488 \pgf@xb=2\pgf@circ@res@right
18489 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
18490 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
18491 \multiply\pgf@circ@count@a by 2\relax
18492 \advance\pgf@circ@count@a by 1\relax
18493 \advance\pgf@circ@res@step by -\pgf@xa
18494 \divide\pgf@circ@res@step by \pgf@circ@count@a
18495 % Grid dashes: draw
18496 \pgf@circ@res@temp=\pgf@xa
18497 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
18498 \loop
18499 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18500 \ifnum\pgf@circ@count@a>1\relax
18501 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
18502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
18503 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
18504 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
18505 \fi
18506 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
18507 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
18508 \advance\pgf@circ@res@temp by\pgf@circ@res@step
18509 \advance\pgf@circ@count@a by-1
18510 \ifnum\pgf@circ@count@a>0\relax
18511 \repeat
18512 % Grid: connection from suppressor to cathode
18513 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
18514 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
18515 \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}}
18516
18517 }% %>>>
18518
18519 % vim: set fdm=marker fmr=%<<<,%>>>:
18520 %%%---------- close: tex/pgfcirctripoles
18521 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
18522 %%%---------- open: tex/pgfcircquadpoles.tex
18523 % Copyright 2018-2026 by Romano Giannetti
18524 % Copyright 2015-2026 by Stefan Lindner
18525 % Copyright 2013-2026 by Stefan Erhardt
18526 % Copyright 2007-2026 by Massimo Redaelli
18527 %
18528 % This file may be distributed and/or modified
18529 %
18530 % 1. under the LaTeX Project Public License and/or
18531 % 2. under the GNU Public License.
18532 %
18533 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
18534
18535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18536 %% Quadripoles
18537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18538
18539
18540 % Setting for Transformers and similar quadpoles%<<<1
18541
18542 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
18543 \ctikzset{quadpoles/transformer/width/.initial=1.5}
18544 \ctikzset{quadpoles/transformer/width1/.initial=.4}
18545 \ctikzset{quadpoles/transformer/height/.initial=1.5}
18546 \ctikzset{quadpoles/transformer/height1/.initial=.8}
18547 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
18548 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
18549 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
18550 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
18551 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
18552 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
18553 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
18554 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
18555 \ctikzset{quadpoles/fourport/width/.initial=1.3}
18556 \ctikzset{quadpoles/fourport/height/.initial=1.3}
18557 \ctikzset{quadpoles/coupler/width/.initial=1.3}
18558 \ctikzset{quadpoles/coupler/height/.initial=1.3}
18559 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
18560 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
18561
18562
18563 \ctikzset{quadpoles style/.is choice}
18564 \ctikzset{quadpoles style/inward/.code={% default value
18565 \ctikzset{quadpoles/transformer/inner=0.4}%
18566 \ctikzset{quadpoles/transformer/width=1.5}%
18567 \ctikzset{quadpoles/transformer core/inner=0.4}%
18568 \ctikzset{quadpoles/transformer core/width=1.5}%
18569 \ctikzset{quadpoles/gyrator/inner=0.4}%
18570 \ctikzset{quadpoles/gyrator/width=1.5}%
18571 }%
18572 }
18573 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
18574 \ctikzset{quadpoles/transformer/inner=1}%
18575 \ctikzset{quadpoles/transformer/width=0.6}%
18576 \ctikzset{quadpoles/transformer core/inner=1}%
18577 \ctikzset{quadpoles/transformer core/width=0.6}%
18578 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
18579 \ctikzset{quadpoles/gyrator/width=0.6}%
18580 }%
18581 }
18582 %%>>>
18583
18584 %% Node shapes for quadpoles (basically transformers)%<<<
18585
18586 \long\def\pgfcircdeclarequadpole#1#2#3{
18587 \pgfdeclareshape{#1}
18588 {
18589 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
18590 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18591 % shapename
18592 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
18593 \anchor{center}{
18594 \northwest
18595 \pgf@x=0pt
18596 \pgf@y=0pt
18597 }
18598 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
18599 \savedanchor\northwest{%
18600 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18601 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
18602 \pgf@y=.5\pgf@y
18603 \pgf@x=.5\pgf@circ@scaled@Rlen
18604 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
18605 }
18606 %% we define the upper right (positive coord) dot (which is B1)
18607 \savedanchor{\innerdot}{%
18608 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18609 \pgf@xa=.5\pgf@circ@scaled@Rlen
18610 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
18611 % by default use the cute inductor size
18612 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
18613 % check if it's american
18614 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
18615 \edef\pgf@temp{american}
18616 \ifx\pgf@circ@temp\pgf@temp
18617 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
18618 \fi
18619 % check if it's european
18620 \edef\pgf@temp{european}
18621 \ifx\pgf@circ@temp\pgf@temp
18622 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
18623 \fi
18624 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
18625 }
18626 \savedanchor{\outerdot}{%
18627 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18628 \pgf@xa=.5\pgf@circ@scaled@Rlen
18629 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
18630 % by default use the cute inductor size
18631 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
18632 % check if it's american
18633 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
18634 \edef\pgf@temp{american}
18635 \ifx\pgf@circ@temp\pgf@temp
18636 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
18637 \fi
18638 % check if it's european
18639 \edef\pgf@temp{european}
18640 \ifx\pgf@circ@temp\pgf@temp
18641 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
18642 \fi
18643 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
18644 }
18645 \anchor{A2}{
18646 \northwest
18647 \pgf@y=-\pgf@y
18648 }
18649 \anchor{B1}{
18650 \northwest
18651 \pgf@x=-\pgf@x
18652 }
18653 \anchor{A1}{
18654 \northwest
18655 }
18656 \anchor{B2}{
18657 \northwest
18658 \pgf@x=-\pgf@x
18659 \pgf@y=-\pgf@y
18660 }
18661 %% dot's anchors
18662 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
18663 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
18664 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18665 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18666 \anchor{inner dot B1}{\innerdot}
18667 \anchor{outer dot B1}{\outerdot}
18668 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
18669 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
18670 % geographical
18671 \anchor{north}{
18672 \northwest
18673 \pgf@x=0pt
18674 }
18675 \anchor{south}{
18676 \northwest
18677 \pgf@x=0pt
18678 \pgf@y=-\pgf@y
18679 }
18680 \anchor{west}{
18681 \northwest
18682 \pgf@y=0pt
18683 }
18684 \anchor{east}{
18685 \northwest
18686 \pgf@y=0pt
18687 \pgf@x=-\pgf@x
18688 }
18689 \anchor{south west}{
18690 \northwest
18691 \pgf@y=-\pgf@y
18692 }
18693 \anchor{north east}{
18694 \northwest
18695 \pgf@x=-\pgf@x
18696 }
18697 \anchor{north west}{
18698 \northwest
18699 }
18700 \anchor{south east}{
18701 \northwest
18702 \pgf@x=-\pgf@x
18703 \pgf@y=-\pgf@y
18704 }
18705 \anchor{base}{
18706 \northwest
18707 \pgf@x=0pt
18708 }
18709 #3
18710 \backgroundpath{
18711 \pgfsetcolor{\ctikzvalof{color}}
18712
18713 \northwest
18714 \pgf@circ@res@up = \pgf@y
18715 \pgf@circ@res@down = -\pgf@y
18716 \pgf@circ@res@right = -\pgf@x
18717 \pgf@circ@res@left = \pgf@x
18718 #2
18719 }
18720 }
18721 }
18722
18723
18724 \def\pgf@circ@drawtransformerbasicanchor{
18725 \ctikzvalof{quadpoles/trans/height}
18726 \anchor{AA2}{
18727 \northwest
18728 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
18729 \pgf@x=.7\pgf@x
18730 \pgf@y=-\pgf@y
18731 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
18732 }
18733 \anchor{BB1}{
18734 \northwest
18735 \pgf@x=-\pgf@x
18736 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
18737 \pgf@x=.7\pgf@x
18738 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
18739 }
18740 \anchor{AA1}{
18741 \northwest
18742 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
18743 \pgf@x=.7\pgf@x
18744 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
18745 }
18746 \anchor{BB2}{
18747 \northwest
18748 \pgf@x=-\pgf@x
18749 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
18750 \pgf@x=.7\pgf@x
18751 \pgf@y=-\pgf@y
18752 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
18753 }
18754 }
18755
18756 %% Null styles that can be used to change individually the L1 and L2
18757 %% inductors of the transformer.
18758
18759 \ctikzset{transformer L1/.style={}}
18760 \ctikzset{transformer L2/.style={}}
18761
18762 \def\pgf@circ@drawtransformerbasicbody{
18763 \pgfscope
18764 \pgfslopedattimetrue
18765 \pgfallowupsidedownattimetrue
18766 \pgftransformlineattime{.5}{%
18767 \pgfpoint%
18768 {\stretto\pgf@circ@res@left}%
18769 {\pgf@circ@res@up}%
18770 }{%
18771 \pgfpoint
18772 {\stretto\pgf@circ@res@left}%
18773 {\pgf@circ@res@down}%
18774 }
18775
18776 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
18777 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
18778 \def\pgf@temp{european}%
18779 \ifx\pgf@temp\pgf@circ@temp%
18780 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
18781 \else%
18782 \def\pgf@temp{cute}
18783 \ifx\pgf@temp\pgf@circ@temp%
18784 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
18785 \else%
18786 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
18787 \fi%
18788 \fi%
18789
18790
18791 \endpgfscope
18792 \pgfscope
18793 \pgfslopedattimetrue
18794 \pgfallowupsidedownattimetrue
18795 \pgftransformlineattime{.5}{%
18796 \pgfpoint%
18797 {\stretto\pgf@circ@res@right}%
18798 {\pgf@circ@res@down}%
18799 }{%
18800 \pgfpoint
18801 {\stretto\pgf@circ@res@right}%
18802 {\pgf@circ@res@up}%
18803 }
18804
18805 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
18806 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
18807 \def\pgf@temp{european}%
18808 \ifx\pgf@temp\pgf@circ@temp%
18809 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
18810 \else%
18811 \def\pgf@temp{cute}
18812 \ifx\pgf@temp\pgf@circ@temp%
18813 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
18814 \else%
18815 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
18816 \fi%
18817 \fi%
18818
18819 \endpgfscope
18820
18821 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
18822 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
18823 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
18824
18825 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
18826 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
18827 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
18828
18829 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
18830 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
18831 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
18832
18833 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
18834 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
18835 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
18836
18837 \pgfusepath{draw}
18838
18839 }
18840
18841
18842 \pgfcircdeclarequadpole{transformer}{
18843 \pgf@circ@drawtransformerbasicbody
18844 }{\pgf@circ@drawtransformerbasicanchor}
18845
18846 \pgfcircdeclarequadpole{transformer core}{
18847
18848 \pgf@circ@drawtransformerbasicbody
18849
18850 % use the chocke line thickness
18851 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
18852
18853 % Find the distance from center for the lines representing the core
18854 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
18855 % of the whole component, now as a fraction of the distance between coils, to be
18856 % compatible with the quadpoles "inner" style.
18857 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
18858
18859 \pgfmoveto{\pgfpoint%
18860 {\pgf@circ@res@other}%
18861 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
18862 }
18863 \pgflineto{
18864 \pgfpoint%
18865 {\pgf@circ@res@other}%
18866 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
18867 }
18868
18869 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
18870 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
18871 \pgfmoveto{\pgfpoint%
18872 {\pgf@circ@res@other}%
18873 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
18874 }
18875 \pgflineto{
18876 \pgfpoint%
18877 {\pgf@circ@res@other}%
18878 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
18879 }
18880
18881 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
18882 \pgfusepath{draw}
18883 }{\pgf@circ@drawtransformerbasicanchor}
18884
18885
18886 \pgfcircdeclarequadpole{gyrator}{
18887
18888 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
18889 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
18890 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
18891 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
18892
18893 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
18894 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
18895 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
18896 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
18897
18898 \pgfusepath{draw}
18899
18900 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
18901 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
18902 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
18903 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
18904 \pgfpathclose
18905 \pgf@circ@draworfill
18906
18907 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
18908 \pgfpatharc{90}{270}{\pgf@circ@res@other}
18909 \pgfpathclose
18910 \pgf@circ@draworfill
18911 }{}
18912 % %>>>
18913
18914 %%%%%%%%%%%%%%%%%%%
18915 %% Block diagrams
18916 %%%%%%%%%%%%%%%%%%%
18917
18918 % Definitions and options for blocks (twoports and so)%<<<1
18919
18920 \ctikzset{bipoles/twoport/width/.initial=.7}
18921 \ctikzset{bipoles/twoport/height/.initial=.7}
18922 \ctikzset{bipoles/twoport/text/.initial=}
18923 \ctikzset{bipoles/twoportsplit/width/.initial=.7}
18924 \ctikzset{bipoles/twoport/text in/.initial=}
18925 \ctikzset{bipoles/twoport/text out/.initial=}
18926 \ctikzset{text/.style={t=#1}}
18927 \ctikzset{t/.code={%
18928 \ctikzsetvalof{bipoles/twoport/text}{#1}%
18929 }}
18930 \ctikzset{text in/.style={t1=#1}}
18931 \ctikzset{t1/.code={%
18932 \ctikzsetvalof{bipoles/twoport/text in}{#1}%
18933 }}
18934 \ctikzset{text out/.style={t2=#1}}
18935 \ctikzset{t2/.code={%
18936 \ctikzsetvalof{bipoles/twoport/text out}{#1}%
18937 }}
18938 \ctikzset{bipoles/vco/width/.initial=.7}
18939 \ctikzset{bipoles/bandpass/width/.initial=.7}
18940 \ctikzset{bipoles/bandstop/width/.initial=.7}
18941 \ctikzset{bipoles/highpass/width/.initial=.7}
18942 \ctikzset{bipoles/highpass2/width/.initial=.7}
18943 \ctikzset{bipoles/lowpass/width/.initial=.7}
18944 \ctikzset{bipoles/lowpass2/width/.initial=.7}
18945 \ctikzset{bipoles/allpass/width/.initial=.7}
18946 \ctikzset{bipoles/adc/width/.initial=.7}
18947 \ctikzset{bipoles/dac/width/.initial=.7}
18948 \ctikzset{bipoles/dsp/width/.initial=.7}
18949 \ctikzset{bipoles/fft/width/.initial=.7}
18950 \ctikzset{bipoles/amp/width/.initial=.7}
18951 \ctikzset{bipoles/vamp/width/.initial=.7}
18952 \ctikzset{bipoles/piattenuator/width/.initial=.7}
18953 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
18954 \ctikzset{bipoles/tattenuator/width/.initial=.7}
18955 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
18956 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
18957 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
18958 \ctikzset{bipoles/detector/width/.initial=.7}
18959 \ctikzset{tripoles/mixer/width/.initial=0.7}
18960 \ctikzset{tripoles/adder/width/.initial=0.7}
18961 \ctikzset{tripoles/circulator/width/.initial=.7}
18962 \ctikzset{tripoles/oscillator/width/.initial=.7}
18963
18964 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
18965 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
18966
18967 \ctikzset{tripoles/splitter/height/.initial=1.3}
18968 \ctikzset{tripoles/splitter/width/.initial=1.3}
18969
18970 \ctikzset{tripoles/mzm/height/.initial=1.3}
18971 \ctikzset{tripoles/mzm/width/.initial=1.3}
18972
18973 % Option ">" for twoports
18974 \newif\ifpgf@circuit@inputarrow
18975 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
18976 \ctikzset{inputarrow/.is choice}
18977 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
18978 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
18979
18980 % Option "boxed" for nodes and twoports
18981 \newif\ifpgf@circuit@boxed
18982 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}}
18983 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}}
18984 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}}
18985 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}}
18986
18987 % Option "dashed" for nodes and twoports
18988 \newif\ifpgf@circuit@dashed
18989 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
18990 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}%
18991
18992 % powerelectronic blocks
18993 \ctikzset{bipoles/sacdc/width/.initial=.7}
18994 \ctikzset{bipoles/sdcac/width/.initial=.7}
18995 \ctikzset{bipoles/sdcdc/width/.initial=.7}
18996 \ctikzset{bipoles/tacdc/width/.initial=.7}
18997 \ctikzset{bipoles/tdcac/width/.initial=.7}
18998 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
18999
19000 %>>>
19001
19002 %% Node shapes definition for path-style block diagrams%<<<
19003
19004 %% Draw the two-port fillable box
19005 \def\pgf@circ@twoportbox{
19006 \pgfscope
19007 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
19008 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
19009 \pgf@circ@draworfill
19010 \endpgfscope
19011 }
19012
19013 %% Generic two port box
19014 \pgfcircdeclarebipolescaled{blocks}
19015 {}
19016 {\ctikzvalof{bipoles/twoport/height}}
19017 {twoport}
19018 {\ctikzvalof{bipoles/twoport/height}}
19019 {\ctikzvalof{bipoles/twoport/width}}
19020 {
19021 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
19022 \divide \pgf@circ@res@step by 2
19023
19024 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19025 \pgf@circ@res@other = \pgf@circ@res@left
19026 \advance\pgf@circ@res@other by \pgf@circ@res@step
19027 \ifpgf@circuit@dashed
19028 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19029 \fi
19030 % draw outer box
19031 \pgf@circ@twoportbox
19032 \ifpgf@circuit@inputarrow
19033 {
19034 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19035 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19036 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19037 }
19038 \fi
19039
19040 % rotate inner symbol
19041 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19042 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19043 \pgftransformrotate{270}
19044 \fi\fi
19045 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
19046 \pgftransformrotate{180}
19047 \fi\fi
19048 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
19049 \pgftransformrotate{90}
19050 \fi\fi
19051
19052 % draw inner symbol
19053 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
19054
19055 }
19056
19057 %% twoport split
19058 \pgfcircdeclarebipolescaled{blocks}
19059 {}
19060 {\ctikzvalof{bipoles/twoportsplit/width}}
19061 {twoportsplit}
19062 {\ctikzvalof{bipoles/twoportsplit/width}}
19063 {\ctikzvalof{bipoles/twoportsplit/width}}
19064 {
19065 \pgf@circ@res@step = \ctikzvalof{bipoles/twoportsplit/width}\pgf@circ@scaled@Rlen
19066 \divide \pgf@circ@res@step by 2
19067
19068 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19069 \pgf@circ@res@other = \pgf@circ@res@left
19070 \advance\pgf@circ@res@other by \pgf@circ@res@step
19071
19072 \ifpgf@circuit@dashed
19073 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19074 \fi
19075
19076 % draw outer box
19077 \pgf@circ@twoportbox
19078
19079 \ifpgf@circuit@inputarrow
19080 {
19081 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19082 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19083 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19084 }
19085 \fi
19086
19087 %get texts
19088 \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}}
19089 \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}}
19090
19091 % rotate inner symbol
19092 \def\texti{\pgfcirc@tin}
19093 \def\textii{\pgfcirc@tout}
19094 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19095 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19096 \def\texti{\pgfcirc@tout}
19097 \def\textii{\pgfcirc@tin}
19098 \pgftransformrotate{270}
19099 \fi\fi
19100 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19101 \def\texti{\pgfcirc@tout}
19102 \def\textii{\pgfcirc@tin}
19103 \pgftransformrotate{180}
19104 \fi\fi
19105 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
19106 \pgftransformrotate{90}
19107 \def\texti{\pgfcirc@tin}
19108 \def\textii{\pgfcirc@tout}
19109 \fi\fi
19110
19111 % draw inner symbol
19112 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19113 \pgfsetarrows{-} %never draw arrows
19114 \pgfsetlinewidth{\pgfstartlinewidth}
19115 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19116 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
19117 \pgfusepath{draw}
19118
19119 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\texti}
19120 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textii}
19121 }
19122
19123 %% voltage controled oscillator
19124 \pgfcircdeclarebipolescaled{blocks}
19125 {}
19126 {\ctikzvalof{bipoles/vco/width}}
19127 {vco}
19128 {\ctikzvalof{bipoles/twoport/width}}
19129 {\ctikzvalof{bipoles/vco/width}}
19130 {
19131 \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen
19132 \divide \pgf@circ@res@step by 2
19133
19134 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19135 \pgf@circ@res@other = \pgf@circ@res@left
19136 \advance\pgf@circ@res@other by \pgf@circ@res@step
19137
19138 \ifpgf@circuit@dashed
19139 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19140 \fi
19141 % draw circle
19142 \pgfscope
19143 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
19144 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
19145 \pgf@circ@draworfill
19146 \endpgfscope
19147 \ifpgf@circuit@inputarrow
19148 {
19149 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19150 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19151 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19152 }
19153 \fi
19154
19155 % rotate inner symbol
19156 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19157 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19158 \pgftransformrotate{270}
19159 \fi\fi
19160 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19161 \pgftransformrotate{180}
19162 \fi\fi
19163 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19164 \pgftransformrotate{90}
19165 \fi\fi
19166
19167 % draw inner sine waves
19168 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19169 \pgfsetlinewidth{\pgfstartlinewidth}
19170 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
19171 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19172 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19173 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19174 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19175 \pgfusepath{draw}
19176 }
19177
19178 %% bandpass filter
19179 \pgfcircdeclarebipolescaled{blocks}
19180 {}
19181 {\ctikzvalof{bipoles/bandpass/width}}
19182 {bandpass}
19183 {\ctikzvalof{bipoles/bandpass/width}}
19184 {\ctikzvalof{bipoles/bandpass/width}}
19185 {
19186
19187 \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen
19188 \divide \pgf@circ@res@step by 2
19189
19190 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19191 \pgf@circ@res@other = \pgf@circ@res@left
19192 \advance\pgf@circ@res@other by \pgf@circ@res@step
19193
19194 \ifpgf@circuit@dashed
19195 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19196 \fi
19197
19198 % draw outer box
19199 \pgf@circ@twoportbox
19200
19201 \ifpgf@circuit@inputarrow
19202 {
19203 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19204 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19205 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19206 }
19207 \fi
19208
19209 % rotate inner symbol
19210 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19211 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19212 \pgftransformrotate{270}
19213 \fi\fi
19214 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19215 \pgftransformrotate{180}
19216 \fi\fi
19217 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19218 \pgftransformrotate{90}
19219 \fi\fi
19220
19221 % draw inner symbol
19222 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19223 \pgfsetarrows{-} %never draw arrows
19224 \pgfsetlinewidth{\pgfstartlinewidth}
19225 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19226 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19227 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19228 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19229 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19230 \pgfusepath{draw}
19231 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
19232 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
19233 \pgfusepath{draw}
19234
19235 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19236 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19237 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19238 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19239 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19240 \pgfusepath{draw}
19241
19242 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19243 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19244 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19245 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19246 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19247 \pgfusepath{draw}
19248 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
19249 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
19250 \pgfusepath{draw}
19251 }
19252
19253 %% bandstop filter
19254 \pgfcircdeclarebipolescaled{blocks}
19255 {}
19256 {\ctikzvalof{bipoles/bandstop/width}}
19257 {bandstop}
19258 {\ctikzvalof{bipoles/bandstop/width}}
19259 {\ctikzvalof{bipoles/bandstop/width}}
19260 {
19261 \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen
19262 \divide \pgf@circ@res@step by 2
19263
19264 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19265 \pgf@circ@res@other = \pgf@circ@res@left
19266 \advance\pgf@circ@res@other by \pgf@circ@res@step
19267
19268 \ifpgf@circuit@dashed
19269 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19270 \fi
19271
19272 % draw outer box
19273 \pgf@circ@twoportbox
19274
19275 \ifpgf@circuit@inputarrow
19276 {
19277 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19278 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19279 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19280 }
19281 \fi
19282
19283 % rotate inner symbol
19284 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19285 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19286 \pgftransformrotate{270}
19287 \fi\fi
19288 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
19289 \pgftransformrotate{180}
19290 \fi\fi
19291 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19292 \pgftransformrotate{90}
19293 \fi\fi
19294
19295 % draw inner symbol
19296 \pgfsetdash{}{0pt}% always draw solid line for inner symbol
19297 \pgfsetarrows{-}%never draw arrows
19298 \pgfsetlinewidth{\pgfstartlinewidth}
19299 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19300 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19301 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19302 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19303 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19304 \pgfusepath{draw}
19305
19306 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19307 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19308 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19309 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19310 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19311 \pgfusepath{draw}
19312 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
19313 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
19314 \pgfusepath{draw}
19315
19316 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19317 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19318 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19319 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19320 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19321 \pgfusepath{draw}
19322 }
19323
19324 %% highpass filter
19325 \pgfcircdeclarebipolescaled{blocks}
19326 {}
19327 {\ctikzvalof{bipoles/highpass/width}}
19328 {highpass}
19329 {\ctikzvalof{bipoles/highpass/width}}
19330 {\ctikzvalof{bipoles/highpass/width}}
19331 {
19332 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen
19333 \divide \pgf@circ@res@step by 2
19334
19335 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19336 \pgf@circ@res@other = \pgf@circ@res@left
19337 \advance\pgf@circ@res@other by \pgf@circ@res@step
19338
19339 \ifpgf@circuit@dashed
19340 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19341 \fi
19342
19343 % draw outer box
19344 \pgf@circ@twoportbox
19345
19346 \ifpgf@circuit@inputarrow
19347 {
19348 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19349 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19350 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19351 }
19352 \fi
19353
19354 % rotate inner symbol
19355 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19356 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19357 \pgftransformrotate{270}
19358 \fi\fi
19359 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19360 \pgftransformrotate{180}
19361 \fi\fi
19362 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19363 \pgftransformrotate{90}
19364 \fi\fi
19365
19366 % draw inner symbol
19367 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19368 \pgfsetarrows{-} %never draw arrows
19369 \pgfsetlinewidth{\pgfstartlinewidth}
19370 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19371 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19372 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19373 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19374 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19375 \pgfusepath{draw}
19376
19377 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19378 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19379 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19380 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19381 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19382 \pgfusepath{draw}
19383 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
19384 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
19385 \pgfusepath{draw}
19386
19387 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19388 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19389 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19390 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19391 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19392 \pgfusepath{draw}
19393 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
19394 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
19395 \pgfusepath{draw}
19396 }
19397
19398 %% highpass2 filter ---simplyfied with just two waves
19399 \pgfcircdeclarebipolescaled{blocks}
19400 {}
19401 {\ctikzvalof{bipoles/highpass2/width}}
19402 {highpass2}
19403 {\ctikzvalof{bipoles/highpass2/width}}
19404 {\ctikzvalof{bipoles/highpass2/width}}
19405 {
19406 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass2/width}\pgf@circ@scaled@Rlen
19407 \divide \pgf@circ@res@step by 2
19408
19409 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19410 \pgf@circ@res@other = \pgf@circ@res@left
19411 \advance\pgf@circ@res@other by \pgf@circ@res@step
19412
19413 \ifpgf@circuit@dashed
19414 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19415 \fi
19416
19417 % draw outer box
19418 \pgf@circ@twoportbox
19419
19420 \ifpgf@circuit@inputarrow
19421 {
19422 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19423 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19424 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19425 }
19426 \fi
19427
19428 % rotate inner symbol
19429 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19430 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19431 \pgftransformrotate{270}
19432 \fi\fi
19433 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19434 \pgftransformrotate{180}
19435 \fi\fi
19436 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19437 \pgftransformrotate{90}
19438 \fi\fi
19439
19440 % draw inner symbol
19441 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19442 \pgfsetarrows{-} %never draw arrows
19443 \pgfsetlinewidth{\pgfstartlinewidth}
19444 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
19445 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19446 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19447 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19448 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19449 \pgfusepath{draw}
19450
19451 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
19452 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19453 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19454 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19455 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19456 \pgfusepath{draw}
19457 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19458 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@step}{-0.1\pgf@circ@res@step}}
19459 \pgfusepath{draw}
19460 }
19461
19462 %% lowpass filter
19463 \pgfcircdeclarebipolescaled{blocks}
19464 {}
19465 {\ctikzvalof{bipoles/lowpass/width}}
19466 {lowpass}
19467 {\ctikzvalof{bipoles/lowpass/width}}
19468 {\ctikzvalof{bipoles/lowpass/width}}
19469 {
19470 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen
19471 \divide \pgf@circ@res@step by 2
19472
19473 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19474 \pgf@circ@res@other = \pgf@circ@res@left
19475 \advance\pgf@circ@res@other by \pgf@circ@res@step
19476
19477 \ifpgf@circuit@dashed
19478 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19479 \fi
19480
19481 % draw outer box
19482 \pgf@circ@twoportbox
19483
19484 \ifpgf@circuit@inputarrow
19485 {
19486 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19487 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19488 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19489 }
19490 \fi
19491
19492 % rotate inner symbol
19493 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19494 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19495 \pgftransformrotate{270}
19496 \fi\fi
19497 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19498 \pgftransformrotate{180}
19499 \fi\fi
19500 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19501 \pgftransformrotate{90}
19502 \fi\fi
19503
19504 % draw inner symbol
19505 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19506 \pgfsetarrows{-} %never draw arrows
19507 \pgfsetlinewidth{\pgfstartlinewidth}
19508 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19509 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19510 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19511 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19512 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19513 \pgfusepath{draw}
19514 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
19515 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
19516 \pgfusepath{draw}
19517
19518 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19519 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19520 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19521 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19522 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19523 \pgfusepath{draw}
19524 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
19525 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
19526 \pgfusepath{draw}
19527
19528 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19529 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19530 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19531 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19532 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19533 \pgfusepath{draw}
19534 }
19535
19536 %% lowpass2 filter: simplyfied with just two waves
19537 \pgfcircdeclarebipolescaled{blocks}
19538 {}
19539 {\ctikzvalof{bipoles/lowpass2/width}}
19540 {lowpass2}
19541 {\ctikzvalof{bipoles/lowpass2/width}}
19542 {\ctikzvalof{bipoles/lowpass2/width}}
19543 {
19544 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass2/width}\pgf@circ@scaled@Rlen
19545 \divide \pgf@circ@res@step by 2
19546
19547 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19548 \pgf@circ@res@other = \pgf@circ@res@left
19549 \advance\pgf@circ@res@other by \pgf@circ@res@step
19550
19551 \ifpgf@circuit@dashed
19552 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19553 \fi
19554
19555 % draw outer box
19556 \pgf@circ@twoportbox
19557
19558 \ifpgf@circuit@inputarrow
19559 {
19560 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19561 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19562 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19563 }
19564 \fi
19565
19566 % rotate inner symbol
19567 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19568 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19569 \pgftransformrotate{270}
19570 \fi\fi
19571 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19572 \pgftransformrotate{180}
19573 \fi\fi
19574 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19575 \pgftransformrotate{90}
19576 \fi\fi
19577
19578 % draw inner symbol
19579 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19580 \pgfsetarrows{-} %never draw arrows
19581 \pgfsetlinewidth{\pgfstartlinewidth}
19582 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
19583 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19584 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19585 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19586 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19587 \pgfusepath{draw}
19588 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0.1\pgf@circ@res@step}}
19589 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19590 \pgfusepath{draw}
19591
19592 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
19593 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19594 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19595 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19596 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19597 \pgfusepath{draw}
19598 }
19599
19600 %% allpass filter
19601 \pgfcircdeclarebipolescaled{blocks}
19602 {}
19603 {\ctikzvalof{bipoles/allpass/width}}
19604 {allpass}
19605 {\ctikzvalof{bipoles/allpass/width}}
19606 {\ctikzvalof{bipoles/allpass/width}}
19607 {
19608 \pgf@circ@res@step = \ctikzvalof{bipoles/allpass/width}\pgf@circ@scaled@Rlen
19609 \divide \pgf@circ@res@step by 2
19610
19611 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19612 \pgf@circ@res@other = \pgf@circ@res@left
19613 \advance\pgf@circ@res@other by \pgf@circ@res@step
19614
19615 \ifpgf@circuit@dashed
19616 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19617 \fi
19618
19619 % draw outer box
19620 \pgf@circ@twoportbox
19621
19622 \ifpgf@circuit@inputarrow
19623 {
19624 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19625 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19626 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19627 }
19628 \fi
19629
19630 % rotate inner symbol
19631 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19632 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19633 \pgftransformrotate{270}
19634 \fi\fi
19635 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19636 \pgftransformrotate{180}
19637 \fi\fi
19638 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
19639 \pgftransformrotate{90}
19640 \fi\fi
19641
19642 % draw inner symbol
19643 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19644 \pgfsetarrows{-} %never draw arrows
19645 \pgfsetlinewidth{\pgfstartlinewidth}
19646 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
19647 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19648 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19649 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19650 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19651 \pgfusepath{draw}
19652
19653 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
19654 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19655 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19656 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19657 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19658 \pgfusepath{draw}
19659
19660 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
19661 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19662 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19663 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
19664 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
19665 \pgfusepath{draw}
19666 }
19667
19668 %% ADC
19669 \pgfcircdeclarebipolescaled{blocks}
19670 {}
19671 {\ctikzvalof{bipoles/adc/width}}
19672 {adc}
19673 {\ctikzvalof{bipoles/adc/width}}
19674 {\ctikzvalof{bipoles/adc/width}}
19675 {
19676 \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen
19677 \divide \pgf@circ@res@step by 2
19678
19679 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19680 \pgf@circ@res@other = \pgf@circ@res@left
19681 \advance\pgf@circ@res@other by \pgf@circ@res@step
19682
19683 \ifpgf@circuit@dashed
19684 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19685 \fi
19686
19687 % draw outer box
19688 \pgf@circ@twoportbox
19689
19690 \ifpgf@circuit@inputarrow
19691 {
19692 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19693 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19694 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19695 }
19696 \fi
19697
19698 % rotate inner symbol
19699 \def\texti{A}
19700 \def\textii{D}
19701 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19702 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19703 \def\texti{D}
19704 \def\textii{A}
19705 \pgftransformrotate{270}
19706 \fi\fi
19707 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19708 \def\texti{D}
19709 \def\textii{A}
19710 \pgftransformrotate{180}
19711 \fi\fi
19712 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
19713 \pgftransformrotate{90}
19714 \def\texti{A}
19715 \def\textii{D}
19716 \fi\fi
19717
19718 % draw inner symbol
19719 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19720 \pgfsetarrows{-} %never draw arrows
19721 \pgfsetlinewidth{\pgfstartlinewidth}
19722 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19723 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
19724 \pgfusepath{draw}
19725
19726 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
19727 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
19728 }
19729
19730 %% DAC
19731 \pgfcircdeclarebipolescaled{blocks}
19732 {}
19733 {\ctikzvalof{bipoles/dac/width}}
19734 {dac}
19735 {\ctikzvalof{bipoles/dac/width}}
19736 {\ctikzvalof{bipoles/dac/width}}
19737 {
19738 \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen
19739 \divide \pgf@circ@res@step by 2
19740
19741 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19742 \pgf@circ@res@other = \pgf@circ@res@left
19743 \advance\pgf@circ@res@other by \pgf@circ@res@step
19744
19745 \ifpgf@circuit@dashed
19746 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19747 \fi
19748
19749 % draw outer box
19750 \pgf@circ@twoportbox
19751
19752 \ifpgf@circuit@inputarrow
19753 {
19754 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19755 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19756 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19757 }
19758 \fi
19759
19760 % rotate inner symbol
19761 \def\texti{D}
19762 \def\textii{A}
19763 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19764 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19765 \def\texti{A}
19766 \def\textii{D}
19767 \pgftransformrotate{270}
19768 \fi\fi
19769 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
19770 \def\texti{A}
19771 \def\textii{D}
19772 \pgftransformrotate{180}
19773 \fi\fi
19774 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
19775 \pgftransformrotate{90}
19776 \def\texti{D}
19777 \def\textii{A}
19778 \fi\fi
19779
19780 % draw inner symbol
19781 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
19782 \pgfsetarrows{-} %never draw arrows
19783 \pgfsetlinewidth{\pgfstartlinewidth}
19784 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19785 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
19786 \pgfusepath{draw}
19787
19788 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
19789 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
19790 }
19791
19792 %% DSP
19793 \pgfcircdeclarebipolescaled{blocks}
19794 {}
19795 {\ctikzvalof{bipoles/dsp/width}}
19796 {dsp}
19797 {\ctikzvalof{bipoles/dsp/width}}
19798 {\ctikzvalof{bipoles/dsp/width}}
19799 {
19800 \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen
19801 \divide \pgf@circ@res@step by 2
19802
19803 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19804 \pgf@circ@res@other = \pgf@circ@res@left
19805 \advance\pgf@circ@res@other by \pgf@circ@res@step
19806
19807 \ifpgf@circuit@dashed
19808 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19809 \fi
19810
19811 % draw outer box
19812 \pgf@circ@twoportbox
19813
19814 \ifpgf@circuit@inputarrow
19815 {
19816 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19817 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19818 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19819 }
19820 \fi
19821
19822 % rotate inner symbol
19823 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19824 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19825 \pgftransformrotate{270}
19826 \fi\fi
19827 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
19828 \pgftransformrotate{180}
19829 \fi\fi
19830 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
19831 \pgftransformrotate{90}
19832 \fi\fi
19833
19834 % draw inner symbol
19835 \pgftext[center,x=0,y=0]{\textsf{DSP}}
19836 }
19837
19838 %% FFT
19839 \pgfcircdeclarebipolescaled{blocks}
19840 {}
19841 {\ctikzvalof{bipoles/fft/width}}
19842 {fft}
19843 {\ctikzvalof{bipoles/fft/width}}
19844 {\ctikzvalof{bipoles/fft/width}}
19845 {
19846 \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen
19847 \divide \pgf@circ@res@step by 2
19848
19849 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
19850 \pgf@circ@res@other = \pgf@circ@res@left
19851 \advance\pgf@circ@res@other by \pgf@circ@res@step
19852
19853 \ifpgf@circuit@dashed
19854 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19855 \fi
19856
19857 % draw outer box
19858 \pgf@circ@twoportbox
19859
19860 \ifpgf@circuit@inputarrow
19861 {
19862 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19863 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19864 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19865 }
19866 \fi
19867
19868 % rotate inner symbol
19869 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
19870 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
19871 \pgftransformrotate{270}
19872 \fi\fi
19873 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
19874 \pgftransformrotate{180}
19875 \fi\fi
19876 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
19877 \pgftransformrotate{90}
19878 \fi\fi
19879
19880 % draw inner symbol
19881 \pgftext[center,x=0,y=0]{\textsf{FFT}}
19882 }
19883
19884 %% Amplifier
19885 \pgfcircdeclarebipolescaled{blocks}
19886 {}
19887 {
19888 \ifpgf@circuit@boxed
19889 \ctikzvalof{bipoles/twoport/width}
19890 \else
19891 \ctikzvalof{bipoles/amp/width}
19892 \fi
19893 }
19894 {amp}
19895 {
19896 \ifpgf@circuit@boxed
19897 \ctikzvalof{bipoles/twoport/width}
19898 \else
19899 \ctikzvalof{bipoles/amp/width}
19900 \fi
19901 }
19902 {
19903 \ifpgf@circuit@boxed
19904 \ctikzvalof{bipoles/twoport/width}
19905 \else
19906 \ctikzvalof{bipoles/amp/width}
19907 \fi
19908 }
19909 {
19910 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
19911
19912 \ifpgf@circuit@dashed
19913 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19914 \fi
19915
19916 % draw outer box
19917 \ifpgf@circuit@boxed
19918 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
19919 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
19920 \pgf@circ@draworfill
19921 \fi
19922
19923 % draw input arrow
19924 \ifpgf@circuit@inputarrow
19925 {
19926 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19927 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19928 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19929 }
19930 \fi
19931
19932 \ifpgf@circuit@boxed
19933 \pgfsetlinewidth{\pgfstartlinewidth}
19934 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
19935 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
19936 \else
19937 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
19938 \fi
19939
19940 \pgfsetarrows{-} %never draw arrows
19941
19942 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
19943 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
19944 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
19945
19946 \pgfpathclose
19947 \pgf@circ@draworfill
19948
19949 % draw inner text
19950 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
19951 }
19952
19953
19954 %% variable amplifier
19955 \pgfcircdeclarebipolescaled{blocks}
19956 {}
19957 {
19958 \ifpgf@circuit@boxed
19959 \ctikzvalof{bipoles/twoport/width}
19960 \else
19961 \ctikzvalof{bipoles/amp/width}
19962 \fi
19963 }
19964 {vamp}
19965 {
19966 \ifpgf@circuit@boxed
19967 \ctikzvalof{bipoles/twoport/width}
19968 \else
19969 \ctikzvalof{bipoles/amp/width}
19970 \fi
19971 }
19972 {
19973 \ifpgf@circuit@boxed
19974 \ctikzvalof{bipoles/twoport/width}
19975 \else
19976 \ctikzvalof{bipoles/amp/width}
19977 \fi
19978 }
19979 {
19980 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
19981
19982 \ifpgf@circuit@dashed
19983 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
19984 \fi
19985
19986 % draw outer box
19987 \ifpgf@circuit@boxed
19988 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
19989 \fi
19990
19991 % draw input arrow
19992 \ifpgf@circuit@inputarrow
19993 {
19994 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
19995 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
19996 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
19997 }
19998 \fi
19999
20000 \ifpgf@circuit@boxed
20001 \pgfsetlinewidth{\pgfstartlinewidth}
20002 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
20003 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
20004 \else
20005 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
20006 \fi
20007
20008
20009 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20010 \pgfsetarrows{-} %never draw arrows
20011
20012 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
20013 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
20014 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
20015
20016 \pgfpathclose
20017 \pgf@circ@draworfill
20018
20019 % draw inner text
20020 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
20021
20022 % draw arrow
20023 \pgfsetlinewidth{\pgfstartlinewidth}
20024 \pgfsetarrowsend{latex}
20025 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
20026 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
20027 \pgfusepath{draw}
20028 }
20029
20030 %% pi attenuator
20031 \pgfcircdeclarebipolescaled{blocks}
20032 {}
20033 {\ctikzvalof{bipoles/piattenuator/width}}
20034 {piattenuator}
20035 {\ctikzvalof{bipoles/piattenuator/width}}
20036 {\ctikzvalof{bipoles/piattenuator/width}}
20037 {
20038 \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen
20039 \divide \pgf@circ@res@step by 2
20040
20041 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20042 \pgf@circ@res@other = \pgf@circ@res@left
20043 \advance\pgf@circ@res@other by \pgf@circ@res@step
20044
20045 \ifpgf@circuit@dashed
20046 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20047 \fi
20048
20049 % draw outer box
20050 \pgf@circ@twoportbox
20051
20052 \ifpgf@circuit@inputarrow
20053 {
20054 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20055 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20056 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20057 }
20058 \fi
20059
20060 % rotate inner symbol
20061 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20062 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20063 \pgftransformrotate{270}
20064 \fi\fi
20065 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20066 \pgftransformrotate{90}
20067 \fi\fi
20068
20069 % draw inner symbol
20070 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20071 \pgfsetarrows{-} %never draw arrows
20072 \pgfsetlinewidth{\pgfstartlinewidth}
20073 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
20074 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20075 \pgfusepath{draw}
20076 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
20077 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20078 \pgfusepath{draw}
20079 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20080 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20081 \pgfusepath{draw}
20082 }
20083
20084 %% variable pi attenuator
20085 \pgfcircdeclarebipolescaled{blocks}
20086 {}
20087 {\ctikzvalof{bipoles/vpiattenuator/width}}
20088 {vpiattenuator}
20089 {\ctikzvalof{bipoles/vpiattenuator/width}}
20090 {\ctikzvalof{bipoles/vpiattenuator/width}}
20091 {
20092 \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen
20093 \divide \pgf@circ@res@step by 2
20094
20095 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20096 \pgf@circ@res@other = \pgf@circ@res@left
20097 \advance\pgf@circ@res@other by \pgf@circ@res@step
20098
20099 \ifpgf@circuit@dashed
20100 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20101 \fi
20102
20103 % draw outer box
20104 \pgf@circ@twoportbox
20105
20106 \ifpgf@circuit@inputarrow
20107 {
20108 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20109 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20110 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20111 }
20112 \fi
20113
20114 % rotate inner symbol
20115 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20116 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20117 \pgftransformrotate{270}
20118 \fi\fi
20119 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20120 \pgftransformrotate{90}
20121 \fi\fi
20122
20123 % draw inner symbol
20124 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20125 \pgfsetarrows{-} %never draw arrows
20126 \pgfsetlinewidth{\pgfstartlinewidth}
20127 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
20128 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20129 \pgfusepath{draw}
20130 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
20131 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20132 \pgfusepath{draw}
20133 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20134 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20135 \pgfusepath{draw}
20136
20137 \pgfsetarrowsend{latex}
20138 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
20139 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
20140 \pgfusepath{draw}
20141 }
20142
20143 %% T attenuator
20144 \pgfcircdeclarebipolescaled{blocks}
20145 {}
20146 {\ctikzvalof{bipoles/tattenuator/width}}
20147 {tattenuator}
20148 {\ctikzvalof{bipoles/tattenuator/width}}
20149 {\ctikzvalof{bipoles/tattenuator/width}}
20150 {
20151 \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen
20152 \divide \pgf@circ@res@step by 2
20153
20154 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20155 \pgf@circ@res@other = \pgf@circ@res@left
20156 \advance\pgf@circ@res@other by \pgf@circ@res@step
20157
20158 \ifpgf@circuit@dashed
20159 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20160 \fi
20161
20162 % draw outer box
20163 \pgf@circ@twoportbox
20164
20165 \ifpgf@circuit@inputarrow
20166 {
20167 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20168 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20169 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20170 }
20171 \fi
20172
20173 % rotate inner symbol
20174 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20175 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20176 \pgftransformrotate{270}
20177 \fi\fi
20178 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20179 \pgftransformrotate{90}
20180 \fi\fi
20181
20182 % draw inner symbol
20183 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20184 \pgfsetarrows{-} %never draw arrows
20185 \pgfsetlinewidth{\pgfstartlinewidth}
20186 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
20187 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
20188 \pgfusepath{draw}
20189 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20190 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20191 \pgfusepath{draw}
20192 }
20193
20194 %% variable T attenuator
20195 \pgfcircdeclarebipolescaled{blocks}
20196 {}
20197 {\ctikzvalof{bipoles/vtattenuator/width}}
20198 {vtattenuator}
20199 {\ctikzvalof{bipoles/vtattenuator/width}}
20200 {\ctikzvalof{bipoles/vtattenuator/width}}
20201 {
20202 \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen
20203 \divide \pgf@circ@res@step by 2
20204
20205 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20206 \pgf@circ@res@other = \pgf@circ@res@left
20207 \advance\pgf@circ@res@other by \pgf@circ@res@step
20208
20209 \ifpgf@circuit@dashed
20210 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20211 \fi
20212
20213 % draw outer box
20214 \pgf@circ@twoportbox
20215
20216 \ifpgf@circuit@inputarrow
20217 {
20218 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20219 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20220 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20221 }
20222 \fi
20223
20224 % rotate inner symbol
20225 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20226 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20227 \pgftransformrotate{270}
20228 \fi\fi
20229 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20230 \pgftransformrotate{90}
20231 \fi\fi
20232
20233 % draw inner symbol
20234 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20235 \pgfsetarrows{-} %never draw arrows
20236 \pgfsetlinewidth{\pgfstartlinewidth}
20237 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
20238 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
20239 \pgfusepath{draw}
20240 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
20241 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
20242 \pgfusepath{draw}
20243
20244 \pgfsetarrowsend{latex}
20245 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
20246 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
20247 \pgfusepath{draw}
20248 }
20249
20250 %% phase shifter
20251 \pgfcircdeclarebipolescaled{blocks}
20252 {}
20253 {\ctikzvalof{bipoles/phaseshifter/width}}
20254 {phaseshifter}
20255 {\ctikzvalof{bipoles/phaseshifter/width}}
20256 {\ctikzvalof{bipoles/phaseshifter/width}}
20257 {
20258 \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen
20259 \divide \pgf@circ@res@step by 2
20260
20261 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20262 \pgf@circ@res@other = \pgf@circ@res@left
20263 \advance\pgf@circ@res@other by \pgf@circ@res@step
20264
20265 \ifpgf@circuit@dashed
20266 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20267 \fi
20268
20269 % draw outer box
20270 \pgf@circ@twoportbox
20271
20272 \ifpgf@circuit@inputarrow
20273 {
20274 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20275 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20276 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20277 }
20278 \fi
20279
20280 % rotate inner symbol
20281 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20282 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20283 \pgftransformrotate{270}
20284 \fi\fi
20285 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
20286 \pgftransformrotate{180}
20287 \fi\fi
20288 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20289 \pgftransformrotate{90}
20290 \fi\fi
20291
20292 % inner symbol
20293 \pgftext[center,x=0,y=0]{\Large$\varphi$}
20294 }
20295
20296 %% variable phase shifter
20297 \pgfcircdeclarebipolescaled{blocks}
20298 {}
20299 {\ctikzvalof{bipoles/phaseshifter/width}}
20300 {vphaseshifter}
20301 {\ctikzvalof{bipoles/vphaseshifter/width}}
20302 {\ctikzvalof{bipoles/vphaseshifter/width}}
20303 {
20304 \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen
20305 \divide \pgf@circ@res@step by 2
20306
20307 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20308 \pgf@circ@res@other = \pgf@circ@res@left
20309 \advance\pgf@circ@res@other by \pgf@circ@res@step
20310
20311 \ifpgf@circuit@dashed
20312 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20313 \fi
20314
20315 % draw outer box
20316 \pgf@circ@twoportbox
20317
20318 \ifpgf@circuit@inputarrow
20319 {
20320 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20321 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20322 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20323 }
20324 \fi
20325
20326 % rotate inner symbol
20327 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20328 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20329 \pgftransformrotate{270}
20330 \fi\fi
20331 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
20332 \pgftransformrotate{180}
20333 \fi\fi
20334 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20335 \pgftransformrotate{90}
20336 \fi\fi
20337
20338 % inner symbol
20339 \pgftext[center,x=0,y=0]{\Large$\varphi$}
20340
20341 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20342 \pgfsetlinewidth{\pgfstartlinewidth}
20343 \pgfsetarrowsend{latex}
20344 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
20345 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
20346 \pgfusepath{draw}
20347 }
20348
20349 %% detector
20350 \pgfcircdeclarebipolescaled{blocks}
20351 {}
20352 {\ctikzvalof{bipoles/detector/width}}
20353 {detector}
20354 {\ctikzvalof{bipoles/detector/width}}
20355 {\ctikzvalof{bipoles/detector/width}}
20356 {
20357 \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen
20358 \divide \pgf@circ@res@step by 2
20359
20360 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20361 \pgf@circ@res@other = \pgf@circ@res@left
20362 \advance\pgf@circ@res@other by \pgf@circ@res@step
20363
20364 \ifpgf@circuit@dashed
20365 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20366 \fi
20367
20368 % draw outer box
20369 \pgf@circ@twoportbox
20370
20371 \ifpgf@circuit@inputarrow
20372 {
20373 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20374 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20375 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20376 }
20377 \fi
20378
20379 % draw inner stuff
20380 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20381 \pgfsetarrows{-} %never draw arrows
20382 \pgfsetlinewidth{0.8\pgfstartlinewidth}
20383 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
20384 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
20385 \pgfusepath{draw}
20386
20387 \ifpgf@circuit@fulldiode
20388 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
20389 \pgftransformscale{\pgfmathresult}
20390 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
20391 \else
20392 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
20393 \pgftransformscale{\pgfmathresult}
20394 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
20395 \fi
20396
20397 }
20398
20399 %% single phase ac/dc converter
20400 \pgfcircdeclarebipolescaled{blocks}
20401 {
20402 \anchor{dc1}{
20403 \northeast
20404 \pgf@y=.4\pgf@y
20405 }
20406 \anchor{dc2}{
20407 \northeast
20408 \pgf@y=-.4\pgf@y
20409 }
20410 }
20411 {\ctikzvalof{bipoles/sacdc/width}}
20412 {sacdc}
20413 {\ctikzvalof{bipoles/sacdc/width}}
20414 {\ctikzvalof{bipoles/sacdc/width}}
20415 {
20416 \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen
20417 \divide \pgf@circ@res@step by 2
20418
20419 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20420 \pgf@circ@res@other = \pgf@circ@res@left
20421 \advance\pgf@circ@res@other by \pgf@circ@res@step
20422
20423 \ifpgf@circuit@dashed
20424 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20425 \fi
20426
20427 % draw outer box
20428 \pgf@circ@twoportbox
20429
20430 \ifpgf@circuit@inputarrow
20431 {
20432 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20433 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20434 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20435 }
20436 \fi
20437
20438 % rotate inner symbol
20439 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20440 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20441 \pgftransformrotate{270}
20442 \fi\fi
20443 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20444 \pgftransformrotate{180}
20445 \fi\fi
20446 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20447 \pgftransformrotate{90}
20448 \fi\fi
20449
20450 % draw inner symbol
20451 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20452 \pgfsetarrows{-} %never draw arrows
20453 \pgfsetlinewidth{\pgfstartlinewidth}
20454 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20455 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20456 \pgfusepath{draw}
20457
20458 % draw sin wave
20459 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
20460 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20461 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20462 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20463 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20464 \pgfusepath{draw}
20465
20466 % draw equal sign
20467 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
20468 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
20469 \pgfusepath{draw}
20470 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
20471 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
20472 \pgfusepath{draw}
20473 }
20474
20475
20476 %% dc/dc converter
20477 \pgfcircdeclarebipolescaled{blocks}
20478 {
20479 \anchor{dc1}{
20480 \northeast
20481 \pgf@y=.4\pgf@y
20482 \pgf@x=-\pgf@x
20483 }
20484 \anchor{dc2}{
20485 \northeast
20486 \pgf@y=-.4\pgf@y
20487 \pgf@x=-\pgf@x
20488 }
20489 }
20490 {\ctikzvalof{bipoles/sdcdc/width}}
20491 {sdcdc}
20492 {\ctikzvalof{bipoles/sdcdc/width}}
20493 {\ctikzvalof{bipoles/sdcdc/width}}
20494 {
20495 \pgf@circ@res@step = \ctikzvalof{bipoles/sdcdc/width}\pgf@circ@scaled@Rlen
20496 \divide \pgf@circ@res@step by 2
20497
20498 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20499 \pgf@circ@res@other = \pgf@circ@res@left
20500 \advance\pgf@circ@res@other by \pgf@circ@res@step
20501
20502 \ifpgf@circuit@dashed
20503 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20504 \fi
20505
20506 % draw outer box
20507 \pgf@circ@twoportbox
20508
20509 \ifpgf@circuit@inputarrow
20510 {
20511 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20512 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20513 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20514 }
20515 \fi
20516
20517 % rotate inner symbol
20518 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20519 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20520 \pgftransformrotate{270}
20521 \fi\fi
20522 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20523 \pgftransformrotate{180}
20524 \fi\fi
20525 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20526 \pgftransformrotate{90}
20527 \fi\fi
20528
20529 % draw inner symbol
20530 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20531 \pgfsetarrows{-} %never draw arrows
20532 \pgfsetlinewidth{\pgfstartlinewidth}
20533 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20534 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20535 \pgfusepath{draw}
20536
20537 % draw equal sign
20538 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
20539 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
20540 \pgfusepath{draw}
20541 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
20542 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
20543 \pgfusepath{draw}
20544
20545 % draw equal sign
20546 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
20547 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
20548 \pgfusepath{draw}
20549 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
20550 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
20551 \pgfusepath{draw}
20552 }
20553
20554
20555 %% single phase dc/ac converter
20556 \pgfcircdeclarebipolescaled{blocks}
20557 {
20558 \anchor{dc1}{
20559 \northeast
20560 \pgf@y=.4\pgf@y
20561 \pgf@x=-\pgf@x
20562 }
20563 \anchor{dc2}{
20564 \northeast
20565 \pgf@y=-.4\pgf@y
20566 \pgf@x=-\pgf@x
20567 }
20568 }
20569 {\ctikzvalof{bipoles/sdcac/width}}
20570 {sdcac}
20571 {\ctikzvalof{bipoles/sdcac/width}}
20572 {\ctikzvalof{bipoles/sdcac/width}}
20573 {
20574 \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen
20575 \divide \pgf@circ@res@step by 2
20576
20577 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20578 \pgf@circ@res@other = \pgf@circ@res@left
20579 \advance\pgf@circ@res@other by \pgf@circ@res@step
20580
20581 \ifpgf@circuit@dashed
20582 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20583 \fi
20584
20585 % draw outer box
20586 \pgf@circ@twoportbox
20587
20588 \ifpgf@circuit@inputarrow
20589 {
20590 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20591 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20592 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20593 }
20594 \fi
20595
20596 % rotate inner symbol
20597 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20598 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20599 \pgftransformrotate{270}
20600 \fi\fi
20601 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20602 \pgftransformrotate{180}
20603 \fi\fi
20604 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20605 \pgftransformrotate{90}
20606 \fi\fi
20607
20608 % draw inner symbol
20609 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20610 \pgfsetarrows{-} %never draw arrows
20611 \pgfsetlinewidth{\pgfstartlinewidth}
20612 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20613 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20614 \pgfusepath{draw}
20615
20616 % draw sin wave
20617 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
20618 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20619 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20620 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20621 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20622 \pgfusepath{draw}
20623
20624 % draw equal sign
20625 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
20626 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
20627 \pgfusepath{draw}
20628 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
20629 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
20630 \pgfusepath{draw}
20631 }
20632
20633
20634 %% threephase ac/dc converter
20635 \pgfcircdeclarebipolescaled{blocks}
20636 {
20637 \anchor{dc1}{
20638 \northeast
20639 \pgf@y=.4\pgf@y
20640 }
20641 \anchor{dc2}{
20642 \northeast
20643 \pgf@y=-.4\pgf@y
20644 }
20645 \anchor{ac1}{
20646 \northeast
20647 \pgf@y=.6\pgf@y
20648 \pgf@x=-\pgf@x
20649 }
20650 \anchor{ac2}{
20651 \northeast
20652 \pgf@y=0\pgf@y
20653 \pgf@x=-\pgf@x
20654 }
20655 \anchor{ac3}{
20656 \northeast
20657 \pgf@y=-.6\pgf@y
20658 \pgf@x=-\pgf@x
20659 }
20660 }
20661 {\ctikzvalof{bipoles/tacdc/width}}
20662 {tacdc}
20663 {\ctikzvalof{bipoles/tacdc/width}}
20664 {\ctikzvalof{bipoles/tacdc/width}}
20665 {
20666 \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen
20667 \divide \pgf@circ@res@step by 2
20668
20669 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20670 \pgf@circ@res@other = \pgf@circ@res@left
20671 \advance\pgf@circ@res@other by \pgf@circ@res@step
20672
20673 \ifpgf@circuit@dashed
20674 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20675 \fi
20676
20677 % draw outer box
20678 \pgf@circ@twoportbox
20679
20680 \ifpgf@circuit@inputarrow
20681 {
20682 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20683 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20684 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20685 }
20686 \fi
20687
20688 % rotate inner symbol
20689 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20690 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20691 \pgftransformrotate{270}
20692 \fi\fi
20693 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20694 \pgftransformrotate{180}
20695 \fi\fi
20696 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20697 \pgftransformrotate{90}
20698 \fi\fi
20699
20700 % draw inner symbol
20701 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20702 \pgfsetarrows{-} %never draw arrows
20703 \pgfsetlinewidth{\pgfstartlinewidth}
20704 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20705 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20706 \pgfusepath{draw}
20707
20708 % draw sin waves
20709 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}}
20710 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20711 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20712 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20713 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20714 \pgfusepath{draw}
20715 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
20716 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20717 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20718 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20719 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20720 \pgfusepath{draw}
20721 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}}
20722 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20723 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20724 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20725 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20726 \pgfusepath{draw}
20727
20728
20729
20730
20731 % draw equal sign
20732 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
20733 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
20734 \pgfusepath{draw}
20735 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
20736 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
20737 \pgfusepath{draw}
20738 }
20739
20740
20741 %% threephase dc/ac converter
20742 \pgfcircdeclarebipolescaled{blocks}
20743 {
20744 \anchor{dc1}{
20745 \northeast
20746 \pgf@y=.4\pgf@y
20747 \pgf@x=-\pgf@x
20748 }
20749 \anchor{dc2}{
20750 \northeast
20751 \pgf@y=-.4\pgf@y
20752 \pgf@x=-\pgf@x
20753 }
20754 \anchor{ac1}{
20755 \northeast
20756 \pgf@y=.6\pgf@y
20757 }
20758 \anchor{ac2}{
20759 \northeast
20760 \pgf@y=0\pgf@y
20761 }
20762 \anchor{ac3}{
20763 \northeast
20764 \pgf@y=-.6\pgf@y
20765 }
20766 }
20767 {\ctikzvalof{bipoles/tdcac/width}}
20768 {tdcac}
20769 {\ctikzvalof{bipoles/tdcac/width}}
20770 {\ctikzvalof{bipoles/tdcac/width}}
20771 {
20772 \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen
20773 \divide \pgf@circ@res@step by 2
20774
20775 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
20776 \pgf@circ@res@other = \pgf@circ@res@left
20777 \advance\pgf@circ@res@other by \pgf@circ@res@step
20778
20779 \ifpgf@circuit@dashed
20780 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
20781 \fi
20782
20783 % draw outer box
20784 \pgf@circ@twoportbox
20785
20786 \ifpgf@circuit@inputarrow
20787 {
20788 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
20789 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
20790 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
20791 }
20792 \fi
20793
20794 % rotate inner symbol
20795 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20796 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
20797 \pgftransformrotate{270}
20798 \fi\fi
20799 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
20800 \pgftransformrotate{180}
20801 \fi\fi
20802 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
20803 \pgftransformrotate{90}
20804 \fi\fi
20805
20806 % draw inner symbol
20807 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
20808 \pgfsetarrows{-} %never draw arrows
20809 \pgfsetlinewidth{\pgfstartlinewidth}
20810 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
20811 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
20812 \pgfusepath{draw}
20813
20814 % draw sin waves
20815 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}}
20816 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20817 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20818 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20819 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20820 \pgfusepath{draw}
20821 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
20822 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20823 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20824 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20825 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20826 \pgfusepath{draw}
20827 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}}
20828 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20829 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20830 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
20831 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
20832 \pgfusepath{draw}
20833
20834
20835
20836
20837 % draw equal sign
20838 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
20839 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
20840 \pgfusepath{draw}
20841 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
20842 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
20843 \pgfusepath{draw}
20844 }
20845 % %>>>
20846
20847 %% Path definitions for Blocks%<<<
20848
20849 \pgfcirc@activate@bipole@simple{l}{twoport}
20850 \pgfcirc@activate@bipole@simple{l}{twoportsplit}
20851 \pgfcirc@activate@bipole@simple{l}{vco}
20852 \pgfcirc@activate@bipole@simple{l}{bandpass}
20853 \pgfcirc@activate@bipole@simple{l}{bandstop}
20854 \pgfcirc@activate@bipole@simple{l}{highpass}
20855 \pgfcirc@activate@bipole@simple{l}{highpass2}
20856 \pgfcirc@activate@bipole@simple{l}{lowpass}
20857 \pgfcirc@activate@bipole@simple{l}{lowpass2}
20858 \pgfcirc@activate@bipole@simple{l}{allpass}
20859 \pgfcirc@activate@bipole@simple{l}{adc}
20860 \pgfcirc@activate@bipole@simple{l}{dac}
20861 \pgfcirc@activate@bipole@simple{l}{dsp}
20862 \pgfcirc@activate@bipole@simple{l}{fft}
20863 \pgfcirc@activate@bipole@simple{l}{amp}
20864 \pgfcirc@activate@bipole@simple{l}{vamp}
20865 \pgfcirc@activate@bipole@simple{l}{piattenuator}
20866 \pgfcirc@activate@bipole@simple{l}{vpiattenuator}
20867 \pgfcirc@activate@bipole@simple{l}{tattenuator}
20868 \pgfcirc@activate@bipole@simple{l}{vtattenuator}
20869 \pgfcirc@activate@bipole@simple{l}{phaseshifter}
20870 \pgfcirc@activate@bipole@simple{l}{vphaseshifter}
20871 \pgfcirc@activate@bipole@simple{l}{detector}
20872 \pgfcirc@activate@bipole@simple{l}{sacdc}
20873 \pgfcirc@activate@bipole@simple{l}{sdcac}
20874 \pgfcirc@activate@bipole@simple{l}{sdcdc}
20875 \pgfcirc@activate@bipole@simple{l}{tacdc}
20876 \pgfcirc@activate@bipole@simple{l}{tdcac}
20877 % %>>>
20878
20879 %% Node shapes for Block elements%<<<
20880
20881 \pgfdeclareshape{mixer}
20882 {
20883 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
20884 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20885 \savedanchor\northwest{
20886 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20887 \ifpgf@circuit@boxed
20888 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
20889 \pgf@y=.5\pgf@y
20890 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
20891 \pgf@x=.5\pgf@x
20892 \else
20893 \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
20894 \pgf@y=.5\pgf@y
20895 \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
20896 \pgf@x=.5\pgf@x
20897 \fi
20898 }
20899 \anchor{center}{
20900 \pgfpointorigin
20901 }
20902 \anchor{left}{%
20903 \northwest
20904 \pgf@y=0pt
20905 }
20906 \anchor{right}{
20907 \northwest
20908 \pgf@y=0pt
20909 \pgf@x=-\pgf@x
20910 }
20911 \anchor{1}{
20912 \northwest
20913 \pgf@y=0pt
20914 }
20915 \anchor{2}{
20916 \northwest
20917 \pgf@y=-\pgf@y
20918 \pgf@x=0pt
20919 }
20920 \anchor{3}{
20921 \northwest
20922 \pgf@y=0pt
20923 \pgf@x=-\pgf@x
20924 }
20925 \anchor{4}{
20926 \northwest
20927 \pgf@y=\pgf@y
20928 \pgf@x=0pt
20929 }
20930 \anchor{in 1}{
20931 \northwest
20932 \pgf@y=0pt
20933 }
20934 \anchor{in1}{
20935 \northwest
20936 \pgf@y=0pt
20937 }
20938 \anchor{in}{
20939 \northwest
20940 \pgf@y=0pt
20941 }
20942 \anchor{in 2}{
20943 \northwest
20944 \pgf@y=-\pgf@y
20945 \pgf@x=0pt
20946 }
20947 \anchor{in2}{
20948 \northwest
20949 \pgf@y=-\pgf@y
20950 \pgf@x=0pt
20951 }
20952 \anchor{out}{
20953 \northwest
20954 \pgf@y=0pt
20955 \pgf@x=-\pgf@x
20956 }
20957 \anchor{center}{
20958 \pgf@y=0pt
20959 \pgf@x=0pt
20960 }
20961 \anchor{east}{
20962 \northwest
20963 \pgf@y=0pt
20964 \pgf@x=-\pgf@x
20965 }
20966 \anchor{west}{
20967 \northwest
20968 \pgf@y=0pt
20969 }
20970 \anchor{south}{
20971 \northwest
20972 \pgf@x=0pt
20973 \pgf@y=-\pgf@y
20974 }
20975 \anchor{north}{
20976 \northwest
20977 \pgf@x=0pt
20978 }
20979 \anchor{e}{
20980 \northwest
20981 \pgf@y=0pt
20982 \pgf@x=-\pgf@x
20983 }
20984 \anchor{w}{
20985 \northwest
20986 \pgf@y=0pt
20987 }
20988 \anchor{s}{
20989 \northwest
20990 \pgf@x=0pt
20991 \pgf@y=-\pgf@y
20992 }
20993 \anchor{n}{
20994 \northwest
20995 \pgf@x=0pt
20996 }
20997 \anchor{down}{
20998 \northwest
20999 \pgf@x=0pt
21000 \pgf@y=-\pgf@y
21001 }
21002 \anchor{up}{
21003 \northwest
21004 \pgf@x=0pt
21005 }
21006 \anchor{south west}{
21007 \northwest
21008 \pgf@y=-\pgf@y
21009 }
21010 \anchor{north east}{
21011 \northwest
21012 \pgf@x=-\pgf@x
21013 }
21014 \anchor{north west}{
21015 \northwest
21016 }
21017 \anchor{south east}{
21018 \northwest
21019 \pgf@x=-\pgf@x
21020 \pgf@y=-\pgf@y
21021 }
21022 \anchorborder{
21023 \pgf@circ@res@left=\pgf@x
21024 \pgf@circ@res@up=\pgf@y
21025 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
21026 }{\pgfpoint{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}{\ctikzvalof{tripoles/mixer/width}*\scaledRlen/2}}
21027 }
21028 \backgroundpath{
21029 \pgfsetcolor{\ctikzvalof{color}}
21030 \pgf@circ@scaled@Rlen=\scaledRlen
21031
21032 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
21033
21034 \pgfscope
21035 \pgfstartlinewidth=\pgflinewidth
21036
21037 % draw outer box
21038 \ifpgf@circuit@boxed
21039 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
21040 \fi
21041
21042 % draw outer circle
21043 \ifpgf@circuit@boxed
21044 \pgf@circ@res@step=.7\pgf@circ@res@step
21045 \pgfsetdash{}{0pt} % draw solid circle if boxed
21046 \else
21047 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
21048 \fi
21049 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
21050 \pgf@circ@draworfill
21051
21052 % draw inner stuff
21053 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21054 \pgfsetlinewidth{\pgfstartlinewidth}
21055 \pgfpathmoveto{\pgfpointorigin}
21056 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
21057 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
21058 \pgfpathmoveto{\pgfpointorigin}
21059 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
21060 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
21061 \pgfusepath{draw}
21062
21063 \endpgfscope
21064 }
21065 }
21066
21067 \pgfdeclareshape{adder}
21068 {
21069 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21070 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21071 \savedanchor\northwest{
21072 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21073 \ifpgf@circuit@boxed
21074 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21075 \pgf@y=.5\pgf@y
21076 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21077 \pgf@x=.5\pgf@x
21078 \else
21079 \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
21080 \pgf@y=.5\pgf@y
21081 \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
21082 \pgf@x=.5\pgf@x
21083 \fi
21084 }
21085 \anchor{center}{
21086 \pgfpointorigin
21087 }
21088 \anchor{left}{%
21089 \northwest
21090 \pgf@y=0pt
21091 }
21092 \anchor{right}{
21093 \northwest
21094 \pgf@y=0pt
21095 \pgf@x=-\pgf@x
21096 }
21097 \anchor{1}{
21098 \northwest
21099 \pgf@y=0pt
21100 }
21101 \anchor{2}{
21102 \northwest
21103 \pgf@y=-\pgf@y
21104 \pgf@x=0pt
21105 }
21106 \anchor{3}{
21107 \northwest
21108 \pgf@y=0pt
21109 \pgf@x=-\pgf@x
21110 }
21111 \anchor{4}{
21112 \northwest
21113 \pgf@y=\pgf@y
21114 \pgf@x=0pt
21115 }
21116 \anchor{in 1}{
21117 \northwest
21118 \pgf@y=0pt
21119 }
21120 \anchor{in1}{
21121 \northwest
21122 \pgf@y=0pt
21123 }
21124 \anchor{in}{
21125 \northwest
21126 \pgf@y=0pt
21127 }
21128 \anchor{in 2}{
21129 \northwest
21130 \pgf@y=-\pgf@y
21131 \pgf@x=0pt
21132 }
21133 \anchor{in2}{
21134 \northwest
21135 \pgf@y=-\pgf@y
21136 \pgf@x=0pt
21137 }
21138 \anchor{out}{
21139 \northwest
21140 \pgf@y=0pt
21141 \pgf@x=-\pgf@x
21142 }
21143 \anchor{center}{
21144 \pgf@y=0pt
21145 \pgf@x=0pt
21146 }
21147 \anchor{east}{
21148 \northwest
21149 \pgf@y=0pt
21150 \pgf@x=-\pgf@x
21151 }
21152 \anchor{west}{
21153 \northwest
21154 \pgf@y=0pt
21155 }
21156 \anchor{south}{
21157 \northwest
21158 \pgf@x=0pt
21159 \pgf@y=-\pgf@y
21160 }
21161 \anchor{north}{
21162 \northwest
21163 \pgf@x=0pt
21164 }
21165 \anchor{e}{
21166 \northwest
21167 \pgf@y=0pt
21168 \pgf@x=-\pgf@x
21169 }
21170 \anchor{w}{
21171 \northwest
21172 \pgf@y=0pt
21173 }
21174 \anchor{s}{
21175 \northwest
21176 \pgf@x=0pt
21177 \pgf@y=-\pgf@y
21178 }
21179 \anchor{n}{
21180 \northwest
21181 \pgf@x=0pt
21182 }
21183 \anchor{down}{
21184 \northwest
21185 \pgf@x=0pt
21186 \pgf@y=-\pgf@y
21187 }
21188 \anchor{up}{
21189 \northwest
21190 \pgf@x=0pt
21191 }
21192 \anchor{south west}{
21193 \northwest
21194 \pgf@y=-\pgf@y
21195 }
21196 \anchor{north east}{
21197 \northwest
21198 \pgf@x=-\pgf@x
21199 }
21200 \anchor{north west}{
21201 \northwest
21202 }
21203 \anchor{south east}{
21204 \northwest
21205 \pgf@x=-\pgf@x
21206 \pgf@y=-\pgf@y
21207 }
21208 \anchorborder{
21209 \pgf@circ@res@left=\pgf@x
21210 \pgf@circ@res@up=\pgf@y
21211 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
21212 }{\pgfpoint{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}{\ctikzvalof{tripoles/adder/width}*\scaledRlen/2}}
21213 }
21214 \backgroundpath{
21215 \pgfsetcolor{\ctikzvalof{color}}
21216 \pgf@circ@scaled@Rlen=\scaledRlen
21217
21218 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
21219
21220 \pgfscope
21221 \pgfstartlinewidth=\pgflinewidth
21222
21223 % draw outer box
21224 \ifpgf@circuit@boxed
21225 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
21226 \fi
21227
21228 % draw outer circle
21229 \ifpgf@circuit@boxed
21230 \pgf@circ@res@step=.7\pgf@circ@res@step{}
21231 \pgfsetdash{}{0pt} % draw solid circle if boxed
21232 \else
21233 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
21234 \fi
21235 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
21236 \pgf@circ@draworfill
21237
21238 % draw inner stuff
21239 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21240 \pgfsetlinewidth{\pgfstartlinewidth}
21241
21242 \pgfpathmoveto{\pgfpointorigin}
21243 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
21244 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
21245 \pgfpathmoveto{\pgfpointorigin}
21246 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
21247 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
21248 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21249 \pgfusepath{draw}
21250
21251 \endpgfscope
21252 }
21253 }
21254
21255 \pgfdeclareshape{oscillator}
21256 {
21257 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21258 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21259 \savedanchor\northwest{
21260 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21261 \ifpgf@circuit@boxed
21262 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21263 \pgf@y=.5\pgf@y
21264 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21265 \else
21266 \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
21267 \pgf@y=.5\pgf@y
21268 \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
21269 \fi
21270 }
21271 \anchor{center}{
21272 \pgfpointorigin
21273 }
21274 \anchor{north}{
21275 \northwest
21276 \pgf@x=.5\pgf@x
21277 }
21278 \anchor{south}{
21279 \northwest
21280 \pgf@x=.5\pgf@x
21281 \pgf@y=-\pgf@y
21282 }
21283 \anchor{east}{
21284 \northwest
21285 \pgf@y=0pt
21286 \pgf@x=0pt
21287 }
21288 \anchor{west}{
21289 \northwest
21290 \pgf@y=0pt
21291 }
21292 \anchor{up}{
21293 \northwest
21294 \pgf@x=.5\pgf@x
21295 }
21296 \anchor{down}{
21297 \northwest
21298 \pgf@x=.5\pgf@x
21299 \pgf@y=-\pgf@y
21300 }
21301 \anchor{n}{
21302 \northwest
21303 \pgf@x=.5\pgf@x
21304 }
21305 \anchor{s}{
21306 \northwest
21307 \pgf@x=.5\pgf@x
21308 \pgf@y=-\pgf@y
21309 }
21310 \anchor{e}{
21311 \northwest
21312 \pgf@y=0pt
21313 \pgf@x=0pt
21314 }
21315 \anchor{w}{
21316 \northwest
21317 \pgf@y=0pt
21318 }
21319 \anchor{up}{
21320 \northwest
21321 \pgf@x=.5\pgf@x
21322 }
21323 \anchor{down}{
21324 \northwest
21325 \pgf@x=.5\pgf@x
21326 \pgf@y=-\pgf@y
21327 }
21328 \anchor{right}{
21329 \northwest
21330 \pgf@y=0pt
21331 \pgf@x=0pt
21332 }
21333 \anchor{left}{
21334 \northwest
21335 \pgf@y=0pt
21336 }
21337 \anchor{south west}{ \northwest \pgf@y=-\pgf@y}
21338 \anchor{north east}{ \northwest \pgf@x=0pt\relax}
21339 \anchor{north west}{ \northwest }
21340 \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
21341 \anchor{text}{
21342 \pgf@x=-2\pgf@x
21343 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
21344 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
21345 }
21346 \anchorborder{
21347 \pgf@circ@res@left=\pgf@x
21348 \pgf@circ@res@up=\pgf@y
21349 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
21350 }{\pgfpoint{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}}
21351 \pgfmathsetlength{\pgf@x}{\pgf@x-\ctikzvalof{tripoles/oscillator/width}*\scaledRlen/2}
21352 }
21353 \backgroundpath{
21354 \pgfsetcolor{\ctikzvalof{color}}
21355 \pgf@circ@scaled@Rlen=\scaledRlen
21356
21357 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
21358
21359 \pgfscope
21360 \pgfstartlinewidth=\pgflinewidth
21361
21362 \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east"
21363
21364 % draw outer box
21365 \ifpgf@circuit@boxed{}
21366 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
21367 \fi
21368
21369 % draw outer circle
21370 \ifpgf@circuit@boxed
21371 \pgf@circ@res@step=.7\pgf@circ@res@step{}
21372 \pgfsetdash{}{0pt} % draw solid circle if boxed
21373 \else
21374 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
21375 \fi
21376 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
21377 \pgf@circ@draworfill
21378
21379 % draw inner sine waves
21380 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21381 \pgfsetlinewidth{\pgfstartlinewidth}
21382 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
21383 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
21384 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
21385 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
21386 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
21387 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
21388
21389 \pgfusepath{draw}
21390
21391 \endpgfscope
21392 }
21393 }
21394
21395 \pgfdeclareshape{circulator}
21396 {
21397 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21398 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21399 \savedanchor\northwest{
21400 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21401 \ifpgf@circuit@boxed
21402 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21403 \pgf@y=.5\pgf@y
21404 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
21405 \pgf@x=.5\pgf@x
21406 \else
21407 \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
21408 \pgf@y=.5\pgf@y
21409 \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
21410 \pgf@x=.5\pgf@x
21411 \fi
21412 }
21413 \anchor{center}{
21414 \pgfpointorigin
21415 }
21416 \anchor{left}{%
21417 \northwest
21418 \pgf@y=0pt
21419 }
21420 \anchor{right}{
21421 \northwest
21422 \pgf@y=0pt
21423 \pgf@x=-\pgf@x
21424 }
21425 \anchor{1}{
21426 \northwest
21427 \pgf@y=0pt
21428 }
21429 \anchor{2}{
21430 \northwest
21431 \pgf@y=0pt
21432 \pgf@x=-\pgf@x
21433 }
21434 \anchor{3}{
21435 \northwest
21436 \pgf@y=-\pgf@y
21437 \pgf@x=0pt
21438 }
21439 \anchor{east}{
21440 \northwest
21441 \pgf@y=0pt
21442 \pgf@x=-\pgf@x
21443 }
21444 \anchor{west}{
21445 \northwest
21446 \pgf@y=0pt
21447 }
21448 \anchor{south}{
21449 \northwest
21450 \pgf@x=0pt
21451 \pgf@y=-\pgf@y
21452 }
21453 \anchor{north}{
21454 \northwest
21455 \pgf@x=0pt
21456 }
21457 \anchor{e}{
21458 \northwest
21459 \pgf@y=0pt
21460 \pgf@x=-\pgf@x
21461 }
21462 \anchor{w}{
21463 \northwest
21464 \pgf@y=0pt
21465 }
21466 \anchor{s}{
21467 \northwest
21468 \pgf@x=0pt
21469 \pgf@y=-\pgf@y
21470 }
21471 \anchor{n}{
21472 \northwest
21473 \pgf@x=0pt
21474 }
21475 \anchor{down}{
21476 \northwest
21477 \pgf@x=0pt
21478 \pgf@y=-\pgf@y
21479 }
21480 \anchor{up}{
21481 \northwest
21482 \pgf@x=0pt
21483 }
21484 \anchor{south west}{
21485 \northwest
21486 \pgf@y=-\pgf@y
21487 }
21488 \anchor{north east}{
21489 \northwest
21490 \pgf@x=-\pgf@x
21491 }
21492 \anchor{north west}{
21493 \northwest
21494 }
21495 \anchor{south east}{
21496 \northwest
21497 \pgf@x=-\pgf@x
21498 \pgf@y=-\pgf@y
21499 }
21500 \anchorborder{
21501 \pgf@circ@res@left=\pgf@x
21502 \pgf@circ@res@up=\pgf@y
21503 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
21504 }{\pgfpoint{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}{\ctikzvalof{tripoles/circulator/width}*\scaledRlen/2}}
21505 }
21506 \backgroundpath{
21507 \pgfsetcolor{\ctikzvalof{color}}
21508 \pgf@circ@scaled@Rlen=\scaledRlen
21509
21510 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
21511
21512 \pgfscope
21513 \pgfstartlinewidth=\pgflinewidth
21514
21515 % draw outer box
21516 \ifpgf@circuit@boxed
21517 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
21518 \fi
21519
21520 % draw outer circle
21521 \ifpgf@circuit@boxed{}
21522 \pgf@circ@res@step=.7\pgf@circ@res@step{}
21523 \pgfsetdash{}{0pt} % draw solid circle if boxed
21524 \else
21525 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
21526 \fi
21527 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
21528 \pgf@circ@draworfill
21529
21530 % inner arrow
21531 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21532 \pgfsetlinewidth{\pgfstartlinewidth}
21533
21534 \pgfsetarrowsend{latex}
21535 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
21536 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
21537 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
21538 \pgfusepath{draw}
21539
21540 \endpgfscope
21541 }
21542 }
21543
21544 %% gridnode
21545 \pgfdeclareshape{gridnode}
21546 {
21547 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21548 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21549 \savedanchor\northwest{
21550 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21551 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
21552 \pgf@y=.5\pgf@y
21553 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
21554 \pgf@x=.5\pgf@x
21555 }
21556 \anchor{center}{
21557 \pgfpointorigin
21558 }
21559
21560 \anchor{north}{
21561 \northwest
21562 \pgf@x=0pt
21563 }
21564 \anchor{up}{
21565 \northwest
21566 \pgf@x=0pt
21567 }
21568 \anchor{south}{
21569 \northwest
21570 \pgf@x=0pt
21571 \pgf@y=-\pgf@y
21572 }
21573 \anchor{down}{
21574 \northwest
21575 \pgf@x=0pt
21576 \pgf@y=-\pgf@y
21577 }
21578 \anchor{east}{
21579 \northwest
21580 \pgf@y=0pt
21581 \pgf@x=-\pgf@x
21582 }
21583 \anchor{right}{
21584 \northwest
21585 \pgf@y=0pt
21586 \pgf@x=-\pgf@x
21587 }
21588 \anchor{west}{
21589 \northwest
21590 \pgf@y=0pt
21591 }
21592 \anchor{left}{
21593 \northwest
21594 \pgf@y=0pt
21595 }
21596 \anchor{south west}{
21597 \northwest
21598 \pgf@y=-\pgf@y
21599 }
21600 \anchor{north east}{
21601 \northwest
21602 \pgf@x=-\pgf@x
21603 \relax
21604 }
21605 \anchor{north west}{
21606 \northwest
21607 }
21608 \anchor{south east}{
21609 \northwest
21610 \pgf@x=-\pgf@x
21611 \pgf@y=-\pgf@y
21612 }
21613 \anchor{text}{
21614 \pgf@x=-2\pgf@x
21615 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
21616 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
21617 }
21618 \backgroundpath{
21619 \pgfsetcolor{\ctikzvalof{color}}
21620 \pgf@circ@scaled@Rlen=\scaledRlen
21621
21622 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
21623
21624 \northwest
21625 \pgf@circ@res@up = \pgf@y
21626 \pgf@circ@res@down = -\pgf@y
21627 \pgf@circ@res@right = -\pgf@x
21628 \pgf@circ@res@left = \pgf@x
21629
21630 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
21631 \divide \pgf@circ@res@step by 2
21632
21633 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
21634 \pgf@circ@res@other = \pgf@circ@res@left
21635 \advance\pgf@circ@res@other by \pgf@circ@res@step
21636
21637 \ifpgf@circuit@dashed
21638 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
21639 \fi
21640
21641 % draw outer box
21642 \pgf@circ@twoportbox
21643
21644
21645 \ifpgf@circuit@inputarrow
21646 {
21647 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
21648 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
21649 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
21650 }
21651 \fi
21652
21653 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21654 \pgfsetarrows{-} %never draw arrows
21655 \pgfsetlinewidth{0.05mm}
21656
21657 % draw grid
21658 \foreach \line in {-1,-.5,...,1}
21659 {
21660 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
21661 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}}
21662
21663 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
21664 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}}
21665 }
21666
21667 %prevent from draw the inner cross twice
21668 \foreach \line in {-.5,0,...,.5}
21669 {
21670 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
21671 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}}
21672
21673 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
21674 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}}
21675 }
21676 \pgfusepath{draw}
21677 }
21678 }
21679
21680
21681 % Wilkinson divider
21682 \pgfdeclareshape{wilkinson}{
21683 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21684 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21685 \savedanchor\northwest{%
21686 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21687 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
21688 \pgf@y=.5\pgf@y
21689 \pgf@x= \pgf@circ@scaled@Rlen
21690 \pgf@x=.5\pgf@x
21691 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
21692 }
21693 \anchor{center}{
21694 \northwest
21695 \pgf@x=0pt
21696 \pgf@y=0pt
21697 }
21698 \anchor{north}{
21699 \northwest
21700 \pgf@x=0pt
21701 }
21702 \anchor{south}{
21703 \northwest
21704 \pgf@x=0pt
21705 \pgf@y=-\pgf@y
21706 }
21707 \anchor{west}{
21708 \northwest
21709 \pgf@y=0pt
21710 }
21711 \anchor{east}{
21712 \northwest
21713 \pgf@y=0pt
21714 \pgf@x=-\pgf@x
21715 }
21716 \anchor{south west}{
21717 \northwest
21718 \pgf@y=-\pgf@y
21719 }
21720 \anchor{north east}{
21721 \northwest
21722 \pgf@x=-\pgf@x
21723 }
21724 \anchor{north west}{
21725 \northwest
21726 }
21727 \anchor{south east}{
21728 \northwest
21729 \pgf@x=-\pgf@x
21730 \pgf@y=-\pgf@y
21731 }
21732 \anchor{in}{
21733 \northwest
21734 \pgf@y=0pt
21735 }
21736 \anchor{out1}{
21737 \northwest
21738 \pgf@x=-\pgf@x
21739 \pgf@y=-0.5\pgf@y
21740 }
21741 \anchor{out2}{
21742 \northwest
21743 \pgf@x=-\pgf@x
21744 \pgf@y=0.5\pgf@y
21745 }
21746 \anchor{text}{
21747 \northwest
21748 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
21749 \pgf@x=-.5\wd\pgfnodeparttextbox
21750 }
21751 \backgroundpath{
21752 \pgfsetcolor{\ctikzvalof{color}}
21753 \pgf@circ@scaled@Rlen=\scaledRlen
21754
21755 \northwest
21756 \pgf@circ@res@up = \pgf@y
21757 \pgf@circ@res@down = -\pgf@y
21758 \pgf@circ@res@right = -\pgf@x
21759 \pgf@circ@res@left = \pgf@x
21760
21761 \pgfstartlinewidth=\pgflinewidth
21762
21763 % draw outer box
21764 \pgf@circ@twoportbox
21765
21766 % draw inner stuff
21767 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21768 \pgfsetarrows{-} %never draw arrows
21769 \pgfsetlinewidth{\pgfstartlinewidth}
21770 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21771 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
21772 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
21773 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
21774 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
21775 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
21776 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
21777
21778 \pgfusepath{draw}
21779
21780 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21781 % draw inner resisitor - european or american style is recognised
21782 {
21783 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
21784 \pgftransformrotate{90}
21785
21786 % calculate size of resistor
21787 \ifpgf@circuit@europeanresistor
21788 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
21789 \pgftransformscale{\pgfmathresult}
21790 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
21791 \else
21792 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
21793 \pgftransformscale{\pgfmathresult}
21794 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
21795 \fi
21796 }
21797
21798 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
21799 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
21800
21801 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
21802 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
21803 \pgfusepath{draw}
21804
21805 }
21806 }
21807
21808 %% resistive splitter
21809 \pgfdeclareshape{splitter}{
21810 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21811 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21812 \savedanchor\northwest{%
21813 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21814 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
21815 \pgf@y=.5\pgf@y
21816 \pgf@x= \pgf@circ@scaled@Rlen
21817 \pgf@x=.5\pgf@x
21818 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
21819 }
21820 \anchor{center}{
21821 \northwest
21822 \pgf@x=0pt
21823 \pgf@y=0pt
21824 }
21825 \anchor{north}{
21826 \northwest
21827 \pgf@x=0pt
21828 }
21829 \anchor{south}{
21830 \northwest
21831 \pgf@x=0pt
21832 \pgf@y=-\pgf@y
21833 }
21834 \anchor{west}{
21835 \northwest
21836 \pgf@y=0pt
21837 }
21838 \anchor{east}{
21839 \northwest
21840 \pgf@y=0pt
21841 \pgf@x=-\pgf@x
21842 }
21843 \anchor{south west}{
21844 \northwest
21845 \pgf@y=-\pgf@y
21846 }
21847 \anchor{north east}{
21848 \northwest
21849 \pgf@x=-\pgf@x
21850 }
21851 \anchor{north west}{
21852 \northwest
21853 }
21854 \anchor{south east}{
21855 \northwest
21856 \pgf@x=-\pgf@x
21857 \pgf@y=-\pgf@y
21858 }
21859 \anchor{in}{
21860 \northwest
21861 \pgf@y=0pt
21862 }
21863 \anchor{out1}{
21864 \northwest
21865 \pgf@x=-\pgf@x
21866 \pgf@y=-0.5\pgf@y
21867 }
21868 \anchor{out2}{
21869 \northwest
21870 \pgf@x=-\pgf@x
21871 \pgf@y=0.5\pgf@y
21872 }
21873 \anchor{text}{
21874 \northwest
21875 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
21876 \pgf@x=-.5\wd\pgfnodeparttextbox
21877 }
21878 \backgroundpath{
21879 \pgfsetcolor{\ctikzvalof{color}}
21880 \pgf@circ@scaled@Rlen=\scaledRlen
21881
21882 \northwest
21883 \pgf@circ@res@up = \pgf@y
21884 \pgf@circ@res@down = -\pgf@y
21885 \pgf@circ@res@right = -\pgf@x
21886 \pgf@circ@res@left = \pgf@x
21887
21888 \pgfstartlinewidth=\pgflinewidth
21889
21890 % draw outer box
21891 \pgf@circ@twoportbox
21892
21893 % draw inner stuff
21894 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21895 \pgfsetarrows{-} %never draw arrows
21896 \pgfsetlinewidth{\pgfstartlinewidth}
21897 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
21898 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
21899 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
21900 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
21901 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
21902 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
21903 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
21904
21905 \pgfusepath{draw}
21906
21907 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
21908 % draw inner resisitors - european or american style is recognised
21909 \foreach \respt/\resang/\linepta/\lineptb in %
21910 { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/%
21911 \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},%
21912 \pgfpoint{0}{0.25\pgf@circ@res@up}/25/%
21913 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
21914 \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/%
21915 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
21916 {
21917 {
21918 \pgftransformshift{\respt}
21919 \pgftransformrotate{\resang}
21920
21921 % calculate size of resistor
21922 \ifpgf@circuit@europeanresistor
21923 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
21924 \pgftransformscale{\pgfmathresult}
21925 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
21926 \else
21927 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
21928 \pgftransformscale{\pgfmathresult}
21929 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
21930 \fi
21931 }
21932
21933 \pgfpathmoveto{\linepta}
21934 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
21935
21936 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
21937 \pgfpathlineto{\lineptb}
21938 \pgfusepath{draw}
21939 }
21940 }
21941 }
21942
21943 %% couplers generics
21944 \long\def\pgfcircdeclarefourport#1#2{
21945
21946 \pgfdeclareshape{#1}{
21947 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
21948 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21949 \anchor{center}{
21950 \northwest
21951 \pgf@x=0pt
21952 \pgf@y=0pt
21953 }
21954 \savedanchor\northwest{%
21955 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21956 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
21957 \pgf@y=.5\pgf@y
21958 \pgf@x=.5\pgf@circ@scaled@Rlen
21959 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
21960 }
21961 \anchor{north}{
21962 \northwest
21963 \pgf@x=0pt
21964 }
21965 \anchor{south}{
21966 \northwest
21967 \pgf@x=0pt
21968 \pgf@y=-\pgf@y
21969 }
21970 \anchor{west}{
21971 \northwest
21972 \pgf@y=0pt
21973 }
21974 \anchor{east}{
21975 \northwest
21976 \pgf@y=0pt
21977 \pgf@x=-\pgf@x
21978 }
21979 \anchor{south west}{
21980 \northwest
21981 \pgf@y=-\pgf@y
21982 }
21983 \anchor{north east}{
21984 \northwest
21985 \pgf@x=-\pgf@x
21986 }
21987 \anchor{north west}{
21988 \northwest
21989 }
21990 \anchor{south east}{
21991 \northwest
21992 \pgf@x=-\pgf@x
21993 \pgf@y=-\pgf@y
21994 }
21995 \anchor{port1}{
21996 \northwest
21997 \pgf@y=-0.5\pgf@y
21998 }
21999 \anchor{port2}{
22000 \northwest
22001 \pgf@x=-\pgf@x
22002 \pgf@y=-0.5\pgf@y
22003 }
22004 \anchor{port3}{
22005 \northwest
22006 \pgf@x=-\pgf@x
22007 \pgf@y=0.5\pgf@y
22008 }
22009 \anchor{port4}{
22010 \northwest
22011 \pgf@y=0.5\pgf@y
22012 }
22013 \anchor{left down}{
22014 \northwest
22015 \pgf@y=-0.5\pgf@y
22016 }
22017 \anchor{right down}{
22018 \northwest
22019 \pgf@x=-\pgf@x
22020 \pgf@y=-0.5\pgf@y
22021 }
22022 \anchor{right up}{
22023 \northwest
22024 \pgf@x=-\pgf@x
22025 \pgf@y=0.5\pgf@y
22026 }
22027 \anchor{left up}{
22028 \northwest
22029 \pgf@y=0.5\pgf@y
22030 }
22031 \anchor{1}{
22032 \northwest
22033 \pgf@y=-0.5\pgf@y
22034 }
22035 \anchor{2}{
22036 \northwest
22037 \pgf@x=-\pgf@x
22038 \pgf@y=-0.5\pgf@y
22039 }
22040 \anchor{3}{
22041 \northwest
22042 \pgf@x=-\pgf@x
22043 \pgf@y=0.5\pgf@y
22044 }
22045 \anchor{4}{
22046 \northwest
22047 \pgf@y=0.5\pgf@y
22048 }
22049
22050 \anchor{text}{
22051 \northwest
22052 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
22053 \pgf@x=-.5\wd\pgfnodeparttextbox
22054 }
22055 \backgroundpath{
22056 \pgfsetcolor{\ctikzvalof{color}}
22057
22058 \northwest
22059 \pgf@circ@res@up = \pgf@y
22060 \pgf@circ@res@down = -\pgf@y
22061 \pgf@circ@res@right = -\pgf@x
22062 \pgf@circ@res@left = \pgf@x
22063 \pgf@circ@scaled@Rlen=\scaledRlen
22064
22065 \pgfstartlinewidth=\pgflinewidth
22066
22067 % draw outer box
22068 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
22069 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
22070 \pgf@circ@draworfill
22071
22072 % draw inner stuff
22073 #2
22074
22075 % draw inner text
22076 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
22077 }
22078 }
22079 }
22080
22081 % four-port
22082 \pgfcircdeclarefourport{fourport}{}
22083
22084 % straight coupler
22085 \pgfcircdeclarefourport{coupler}{
22086 \pgfsetlinewidth{\pgfstartlinewidth}
22087 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
22088 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22089 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22090 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22091 \pgfusepath{draw}
22092
22093 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
22094 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22095 \pgfsetarrows{latex-latex}
22096 \pgfusepath{draw}
22097 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22098 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
22099 \pgfsetarrows{latex-latex}
22100 \pgfusepath{draw}
22101 }
22102
22103 % "bended" coupler
22104 \pgfcircdeclarefourport{coupler2}{
22105 \pgfsetlinewidth{\pgfstartlinewidth}
22106 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
22107 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
22108 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22109 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
22110 \pgfusepath{draw}
22111
22112 \pgfscope
22113 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
22114 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
22115 \pgfsetarrowsend{latex}
22116 \pgfusepath{draw}
22117 \endpgfscope
22118 \pgfscope
22119 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
22120 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
22121 \pgfsetarrowsend{latex}
22122 \pgfusepath{draw}
22123 \endpgfscope
22124 \pgfscope
22125 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
22126 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
22127 \pgfsetarrowsend{latex}
22128 \pgfusepath{draw}
22129 \endpgfscope
22130 \pgfscope
22131 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
22132 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
22133 \pgfsetarrowsend{latex}
22134 \pgfusepath{draw}
22135 \endpgfscope
22136 }
22137
22138 % mach zehnder modulator
22139 \pgfdeclareshape{mzm}{
22140 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
22141 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22142 \savedanchor\northwest{%
22143 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22144 \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen
22145 \pgf@y=.5\pgf@y
22146 \pgf@x= \pgf@circ@scaled@Rlen
22147 \pgf@x=.5\pgf@x
22148 \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x
22149 }
22150 \anchor{center}{
22151 \northwest
22152 \pgf@x=0pt
22153 \pgf@y=0pt
22154 }
22155 \anchor{north}{
22156 \northwest
22157 \pgf@x=0pt
22158 }
22159 \anchor{south}{
22160 \northwest
22161 \pgf@x=0pt
22162 \pgf@y=-\pgf@y
22163 }
22164 \anchor{west}{
22165 \northwest
22166 \pgf@y=0pt
22167 }
22168 \anchor{east}{
22169 \northwest
22170 \pgf@y=0pt
22171 \pgf@x=-\pgf@x
22172 }
22173 \anchor{south west}{
22174 \northwest
22175 \pgf@y=-\pgf@y
22176 }
22177 \anchor{north east}{
22178 \northwest
22179 \pgf@x=-\pgf@x
22180 }
22181 \anchor{north west}{
22182 \northwest
22183 }
22184 \anchor{south east}{
22185 \northwest
22186 \pgf@x=-\pgf@x
22187 \pgf@y=-\pgf@y
22188 }
22189 \anchor{in}{
22190 \northwest
22191 \pgf@y=0pt
22192 }
22193 \anchor{mod}{
22194 \northwest
22195 \pgf@x=0pt
22196 }
22197 \anchor{out}{
22198 \northwest
22199 \pgf@x=-\pgf@x
22200 \pgf@y=0pt
22201 }
22202 \anchor{text}{
22203 \northwest
22204 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
22205 \pgf@x=-.5\wd\pgfnodeparttextbox
22206 }
22207 \backgroundpath{
22208 \pgfsetcolor{\ctikzvalof{color}}
22209 \pgf@circ@scaled@Rlen=\scaledRlen
22210
22211 \northwest
22212 \pgf@circ@res@up = \pgf@y
22213 \pgf@circ@res@down = -\pgf@y
22214 \pgf@circ@res@right = -\pgf@x
22215 \pgf@circ@res@left = \pgf@x
22216
22217 \pgfstartlinewidth=\pgflinewidth
22218
22219 % draw outer box
22220 \pgf@circ@twoportbox
22221
22222 % draw inner stuff
22223 % rotate inner symbol
22224 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
22225 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
22226 \pgftransformrotate{270}
22227 \fi\fi
22228 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
22229 \pgftransformrotate{180}
22230 \fi\fi
22231 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
22232 \pgftransformrotate{90}
22233 \fi\fi
22234
22235 % draw inner symbol
22236 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
22237 \pgfsetarrows{-} %never draw arrows
22238 \pgfsetlinewidth{\pgfstartlinewidth}
22239 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
22240 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
22241 \pgfusepath{draw}
22242
22243 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
22244 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
22245 \pgfusepath{draw}
22246
22247 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
22248 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
22249 \pgfusepath{draw}
22250
22251 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
22252 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
22253 \pgfusepath{draw}
22254
22255 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
22256 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
22257 \pgfusepath{draw}
22258
22259 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
22260 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
22261 \pgfusepath{draw}
22262
22263 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
22264 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
22265 \pgfusepath{draw}
22266
22267 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
22268 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
22269 \pgfusepath{draw}
22270
22271 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
22272 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}}
22273 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}}
22274 \pgfusepath{draw}
22275
22276 }
22277 }
22278 % %>>>
22279
22280 % vim: set fdm=marker fmr=%<<<,%>>>:
22281 %%%---------- close: tex/pgfcircquadpoles
22282 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
22283 %%%---------- open: tex/pgfcircmultipoles.tex
22284 % Copyright 2018-2026 by Romano Giannetti
22285 % Copyright 2015-2026 by Stefan Lindner
22286 % Copyright 2013-2026 by Stefan Erhardt
22287 % Copyright 2007-2026 by Massimo Redaelli
22288 %
22289 % This file may be distributed and/or modified
22290 %
22291 % 1. under the LaTeX Project Public License and/or
22292 % 2. under the GNU Public License.
22293 %
22294 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
22295
22296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22297 %% Chips and Rotary Switches
22298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22299
22300 % Definitions for Chips and Rotary switches (multipoles) %<<<1
22301 %
22302 \ctikzset{multipoles/thickness/.initial=2}
22303 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
22304 \ctikzset{multipoles/draw only pins/.initial={all}}
22305 \ctikzset{multipoles/draw only left pins/.initial={all}}
22306 \ctikzset{multipoles/draw only right pins/.initial={all}}
22307 \ctikzset{multipoles/draw only top pins/.initial={all}}
22308 \ctikzset{multipoles/draw only bottom pins/.initial={all}}
22309 \pgfqkeys{/tikz}{draw only pins/.add code={}{\ctikzset{multipoles/draw only pins={#1}}}}
22310 \pgfqkeys{/tikz}{draw only left pins/.add code={}{\ctikzset{multipoles/draw only left pins={#1}}}}
22311 \pgfqkeys{/tikz}{draw only right pins/.add code={}{\ctikzset{multipoles/draw only right pins={#1}}}}
22312 \pgfqkeys{/tikz}{draw only top pins/.add code={}{\ctikzset{multipoles/draw only top pins={#1}}}}
22313 \pgfqkeys{/tikz}{draw only bottom pins/.add code={}{\ctikzset{multipoles/draw only bottom pins={#1}}}}
22314 % DIP (dual in line package) chips
22315 \ctikzset{multipoles/dipchip/width/.initial=1.2}
22316 \ctikzset{multipoles/dipchip/num pins/.initial=8}
22317 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
22318 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
22319 % QFP (quad flat package) chips
22320 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
22321 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
22322 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
22323 % chip numbers
22324 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
22325 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
22326 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
22327 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
22328 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
22329 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
22330 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
22331 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
22332 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
22333 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
22334 % external chip pins
22335 \ctikzset{multipoles/external pins thickness/.initial=1}
22336 \ctikzset{multipoles/external pins width/.initial=0.2}
22337 \ctikzset{multipoles/external pad fraction/.initial=0}
22338 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
22339 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
22340 % topmarks
22341 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
22342 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
22343 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
22344 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
22345 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
22346
22347 % rotary switch by Romano
22348 \ctikzset{multipoles/rotary/thickness/.initial=1}
22349 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
22350 \ctikzset{multipoles/rotary/channels/.initial=5}
22351 \ctikzset{multipoles/rotary/angle/.initial=60}
22352 \ctikzset{multipoles/rotary/wiper/.initial=20}
22353 \ctikzset{multipoles/rotary/arrow/.is choice}
22354 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
22355 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
22356 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
22357 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
22358 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
22359 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
22360 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
22361
22362 \tikzset{%
22363 rotary switch/.style args={#1in#2wiper#3}{%
22364 shape=rotaryswitch,
22365 /tikz/circuitikz/multipoles/rotary/channels=#1,
22366 /tikz/circuitikz/multipoles/rotary/angle=#2,
22367 /tikz/circuitikz/multipoles/rotary/wiper=#3,
22368 },
22369 rotary switch -/.style args={#1in#2wiper#3}{
22370 rotary switch=#1 in #2 wiper #3,
22371 /tikz/circuitikz/multipoles/rotary/arrow=none,
22372 },
22373 rotary switch <-/.style args={#1in#2wiper#3}{
22374 rotary switch=#1 in #2 wiper #3,
22375 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
22376 },
22377 rotary switch ->/.style args={#1in#2wiper#3}{
22378 rotary switch=#1 in #2 wiper #3,
22379 /tikz/circuitikz/multipoles/rotary/arrow=cw,
22380 },
22381 rotary switch <->/.style args={#1in#2wiper#3}{
22382 rotary switch=#1 in #2 wiper #3,
22383 /tikz/circuitikz/multipoles/rotary/arrow=both,
22384 },
22385 % Notice that these should be the same as the initial values of the keys
22386 rotary switch/.default={5 in 60 wiper 20},
22387 rotary switch -/.default={5 in 60 wiper 20},
22388 rotary switch <-/.default={5 in 60 wiper 20},
22389 rotary switch ->/.default={5 in 60 wiper 20},
22390 rotary switch <->/.default={5 in 60 wiper 20},
22391 }
22392 %%>>>
22393
22394 %% Nodes definitions for chips%<<<
22395
22396 %%%%%%%%%
22397 %% Chips
22398 %%%%%%%%%
22399
22400 % let's use the same shifts everywhere, no magic numbers
22401 \def\pgf@circ@dip@pin@shift{0.5}
22402 \def\pgf@circ@qfp@pin@shift{0.25}
22403
22404 % derived from https://tex.stackexchange.com/a/146753/38080
22405 % original author Mark Wibrow
22406 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
22407 % a lot of thanks to @marmot for the un-rotation hint
22408 % https://tex.stackexchange.com/a/473571/38080
22409 % modifications for 'draw only pins' by Jonathan P. Spratte
22410
22411 % DIP (dual in line package) chips
22412
22413 % helper macro to set the anchors inside a loop (to expand the current count)
22414 \pgfutil@protected\def\pgf@circ@make@dippin@anchor#1%
22415 {%
22416 \expandafter\gdef\csname pgf@anchor@dipchip@pin #1\endcsname
22417 {%
22418 \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
22419 {\pgf@circ@dippinanchor{#1}{1}}
22420 {\pgf@circ@dippinanchor{#1}{0}}%
22421 }%
22422 \expandafter\gdef\csname pgf@anchor@dipchip@bpin #1\endcsname
22423 {\pgf@circ@dippinanchor{#1}{0}}%
22424 }
22425
22426 \pgfdeclareshape{dipchip}{
22427 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
22428 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22429 \savedmacro\numpins{%
22430 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
22431 \def\numpins{\the\pgf@circ@count@a}
22432 }
22433 \savedmacro\pgf@circ@pins@list
22434 {%
22435 \pgfkeysgetvalue
22436 {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
22437 \expandafter\pgf@circ@set@list
22438 \expandafter\pgf@circ@pins@list
22439 \expandafter{\pgf@circ@temp}%
22440 }%
22441 \savedanchor\centerpoint{%
22442 \pgf@x=-.5\wd\pgfnodeparttextbox%
22443 \pgf@y=-.5\ht\pgfnodeparttextbox%
22444 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
22445 }%
22446 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
22447 \anchor{center}{\origin}
22448 \anchor{text}{\centerpoint}% to adjust text
22449 \saveddimen\height{%
22450 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22451 \pgfmathsetlength\pgf@x{((\numpins)
22452 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
22453 }%
22454 \saveddimen{\chipspacing}{
22455 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22456 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
22457 \saveddimen{\width}{
22458 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22459 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
22460 \saveddimen{\extshift}{
22461 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22462 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
22463 % standard anchors
22464 \savedanchor\northwest{%
22465 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22466 \pgfmathsetlength\pgf@y{0.5*((\numpins)
22467 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
22468 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
22469 }
22470 \anchor{dot}{\northwest
22471 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
22472 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
22473 }
22474 \anchor{nw}{\northwest}
22475 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
22476 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
22477 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
22478 \anchor{north west}{\northwest}
22479 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
22480 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
22481 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
22482 \anchor{n}{\northwest\pgf@x=0pt }
22483 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
22484 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
22485 \anchor{w}{\northwest\pgf@y=0pt }
22486 \anchor{north}{\northwest\pgf@x=0pt }
22487 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
22488 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
22489 \anchor{west}{\northwest\pgf@y=0pt }
22490 % start drawing
22491 \backgroundpath{%
22492 \northwest
22493 \pgf@circ@res@up = \pgf@y
22494 \pgf@circ@res@down = -\pgf@y
22495 \pgf@circ@res@right = -\pgf@x
22496 \pgf@circ@res@left = \pgf@x
22497 \pgf@circ@scaled@Rlen=\scaledRlen
22498 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
22499 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
22500 \pgfscope% (for the line width)
22501 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
22502 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
22503 \pgf@circ@draworfill
22504 %% upside mark
22505 \ifpgf@circuit@chip@topmark
22506 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
22507 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
22508 \fi
22509 \pgfusepath{stroke}%
22510 \pgfsetcolor{\ctikzvalof{color}}
22511 % Adding the pin number
22512 \ifpgf@circuit@chip@shownumbers
22513 \pgf@circ@count@a=\numpins\relax
22514 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
22515 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
22516 \ifpgf@circuit@chip@straightnumbers
22517 \pgfgettransformentries\a\b\temp\temp\temp\temp
22518 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
22519 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
22520 \else
22521 \pgfmathsetmacro{\rot}{0}
22522 \pgfmathsetmacro{\quadrant}{0}
22523 \fi
22524 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
22525 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
22526 \pgfmathloop%
22527 \ifnum\pgf@circ@count@a>0
22528 \ifcase\quadrant % rotation 0
22529 % left
22530 \pgf@circ@count@c=\pgf@circ@count@a
22531 \pgftext[left,
22532 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22533 rotate=\rot]{\mytext}
22534 % right
22535 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22536 \pgftext[right,
22537 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22538 rotate=\rot]{\mytext}
22539 \or % rotation -90
22540 % left
22541 \pgf@circ@count@c=\pgf@circ@count@a
22542 \pgftext[top,
22543 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22544 rotate=\rot]{\mytext}
22545 % right
22546 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22547 \pgftext[bottom,
22548 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22549 rotate=\rot]{\mytext}
22550 \or %rotation 180
22551 % left
22552 \pgf@circ@count@c=\pgf@circ@count@a
22553 \pgftext[right,
22554 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22555 rotate=\rot]{\mytext}
22556 % right
22557 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22558 \pgftext[left,
22559 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22560 rotate=\rot]{\mytext}
22561 \or % rotation +90
22562 % left
22563 \pgf@circ@count@c=\pgf@circ@count@a
22564 \pgftext[bottom,
22565 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22566 rotate=\rot]{\mytext}
22567 % right
22568 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22569 \pgftext[top,
22570 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22571 rotate=\rot]{\mytext}
22572 \fi
22573 \advance\pgf@circ@count@a-1\relax%
22574 \repeatpgfmathloop
22575 \fi
22576 \endpgfscope
22577 % draw external pins or pads
22578 \ifdim\pgf@circ@res@other>0pt
22579 \ifpgfcirc@draw@input@leads
22580 \pgfscope
22581 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
22582 \pgf@circ@count@a=\numpins\relax
22583 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
22584 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
22585 \ifnum\padfrac>0
22586 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
22587 \fi
22588 \pgfmathloop%
22589 \ifnum\pgf@circ@count@a>0
22590 % left side
22591 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
22592 {%
22593 \ifnum\padfrac>0
22594 % pads
22595 \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}}
22596 \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}}
22597 \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}}
22598 \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}}
22599 \else
22600 % pins
22601 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22602 \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}}
22603 \fi
22604 }
22605 {}%
22606 % right side
22607 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins+1-\pgf@circ@count@a}
22608 {%
22609 \ifnum\padfrac>0
22610 % pads
22611 \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}}
22612 \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}}
22613 \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}}
22614 \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}}
22615 \else
22616 % pins
22617 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22618 \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}}
22619 \fi
22620 }
22621 {}%
22622 \advance\pgf@circ@count@a by -1\relax%
22623 \repeatpgfmathloop
22624 \pgfusepath{stroke}
22625 \endpgfscope
22626 \fi
22627 \fi
22628 }%
22629 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
22630 \pgf@circ@count@a=\numpins
22631 \pgfmathloop
22632 \ifnum\pgf@circ@count@a>0
22633 % we will create two anchors per pin: the "normal one" like `pin 1` for the
22634 % electrical contact, and the "border one" like `bpin 1` for labels.
22635 % they will coincide if `external pins width` is set to 0.
22636 % see the helper function above the start of the shape definition (by Jonathan P. Spratte)
22637 \expandafter\pgf@circ@make@dippin@anchor\expandafter{\the\pgf@circ@count@a}%
22638 \advance\pgf@circ@count@a by -1\relax
22639 \repeatpgfmathloop
22640 }%
22641 }
22642
22643 % QFP (quad flat package) chips
22644 % helper macro to set the anchors inside a loop (to expand the current count)
22645 \pgfutil@protected\def\pgf@circ@make@qfppin@anchor#1%
22646 {%
22647 \expandafter\gdef\csname pgf@anchor@qfpchip@pin #1\endcsname
22648 {%
22649 \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
22650 {\pgf@circ@qfppinanchor{#1}{1}}
22651 {\pgf@circ@qfppinanchor{#1}{0}}%
22652 }%
22653 \expandafter\gdef\csname pgf@anchor@qfpchip@bpin #1\endcsname
22654 {\pgf@circ@qfppinanchor{#1}{0}}%
22655 }
22656
22657 \pgfdeclareshape{qfpchip}{
22658 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
22659 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22660 \savedmacro\numpins{%
22661 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
22662 \def\numpins{\the\pgf@circ@count@a}
22663 }
22664 \savedmacro\pgf@circ@pins@list
22665 {% some magic here, thanks to Jonathan P. Spratte
22666 \pgfkeysgetvalue
22667 {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
22668 \expandafter\pgf@circ@set@list
22669 \expandafter\pgf@circ@pins@list
22670 \expandafter{\pgf@circ@temp}%
22671 }%
22672 \savedanchor\centerpoint{%
22673 \pgf@x=-.5\wd\pgfnodeparttextbox%
22674 \pgf@y=-.5\ht\pgfnodeparttextbox%
22675 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
22676 }%
22677 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
22678 \anchor{center}{\origin}
22679 \anchor{text}{\centerpoint}% to adjust text
22680 \saveddimen\height{%
22681 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22682 \pgfmathsetlength\pgf@x{((\numpins+2)
22683 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
22684 }%
22685 \saveddimen\width{%
22686 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22687 \pgfmathsetlength\pgf@x{((\numpins+2)
22688 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
22689 }%
22690 \saveddimen{\chipspacing}{
22691 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22692 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
22693 \saveddimen{\extshift}{
22694 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22695 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
22696 % standard anchors
22697 \savedanchor\northwest{%
22698 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22699 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
22700 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
22701 \pgf@x=-\pgf@y
22702 }
22703 \anchor{dot}{\northwest
22704 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
22705 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
22706 }
22707 \anchor{nw}{\northwest}
22708 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
22709 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
22710 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
22711 \anchor{north west}{\northwest}
22712 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
22713 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
22714 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
22715 \anchor{n}{\northwest\pgf@x=0pt }
22716 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
22717 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
22718 \anchor{w}{\northwest\pgf@y=0pt }
22719 \anchor{north}{\northwest\pgf@x=0pt }
22720 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
22721 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
22722 \anchor{west}{\northwest\pgf@y=0pt }
22723 % start drawing
22724 \backgroundpath{%
22725 \northwest
22726 \pgf@circ@res@up = \pgf@y
22727 \pgf@circ@res@down = -\pgf@y
22728 \pgf@circ@res@right = -\pgf@x
22729 \pgf@circ@res@left = \pgf@x
22730 \pgf@circ@scaled@Rlen=\scaledRlen
22731 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
22732 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
22733 \pgfscope% (for the line width)
22734 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
22735 %% upside mark
22736 \ifpgf@circuit@chip@topmark
22737 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
22738 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
22739 \else
22740 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
22741 \fi
22742 %% rest of the shape
22743 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
22744 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
22745 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
22746 \pgfpathclose
22747 \pgf@circ@draworfill
22748 % Adding the pin number
22749 \pgfsetcolor{\ctikzvalof{color}}
22750 \ifpgf@circuit@chip@shownumbers
22751 \pgf@circ@count@a=\numpins%
22752 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
22753 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
22754 \ifpgf@circuit@chip@straightnumbers
22755 \pgfgettransformentries\a\b\temp\temp\temp\temp
22756 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
22757 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
22758 \else
22759 \pgfmathsetmacro{\rot}{0}
22760 \pgfmathsetmacro{\quadrant}{0}
22761 \fi
22762 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
22763 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
22764 \pgfmathloop%
22765 \ifnum\pgf@circ@count@a>0
22766 \ifcase\quadrant % rotation 0
22767 % left
22768 \pgf@circ@count@c=\pgf@circ@count@a
22769 \pgftext[left,
22770 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22771 rotate=\rot]{\mytext}
22772 % bottom
22773 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
22774 \pgftext[bottom,
22775 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
22776 rotate=\rot]{\mytext}
22777 % right
22778 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22779 \pgftext[right,
22780 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22781 rotate=\rot]{\mytext}
22782 % top
22783 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
22784 \pgftext[top,
22785 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
22786 rotate=\rot]{\mytext}
22787 \or % rotation -90
22788 % left
22789 \pgf@circ@count@c=\pgf@circ@count@a
22790 \pgftext[top,
22791 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22792 rotate=\rot]{\mytext}
22793 % bottom
22794 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
22795 \pgftext[left,
22796 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
22797 rotate=\rot]{\mytext}
22798 % right
22799 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22800 \pgftext[bottom,
22801 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22802 rotate=\rot]{\mytext}
22803 % top
22804 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
22805 \pgftext[right,
22806 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
22807 rotate=\rot]{\mytext}
22808 \or %rotation 180
22809 % left
22810 \pgf@circ@count@c=\pgf@circ@count@a
22811 \pgftext[right,
22812 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22813 rotate=\rot]{\mytext}
22814 % bottom
22815 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
22816 \pgftext[top,
22817 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
22818 rotate=\rot]{\mytext}
22819 % right
22820 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22821 \pgftext[left,
22822 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22823 rotate=\rot]{\mytext}
22824 % top
22825 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
22826 \pgftext[bottom,
22827 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
22828 rotate=\rot]{\mytext}
22829 \or % rotation +90
22830 % left
22831 \pgf@circ@count@c=\pgf@circ@count@a
22832 \pgftext[bottom,
22833 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22834 rotate=\rot]{\mytext}
22835 % bottom
22836 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
22837 \pgftext[right,
22838 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
22839 rotate=\rot]{\mytext}
22840 % right
22841 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
22842 \pgftext[top,
22843 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
22844 rotate=\rot]{\mytext}
22845 % top
22846 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
22847 \pgftext[left,
22848 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
22849 rotate=\rot]{\mytext}
22850 \fi
22851 \advance\pgf@circ@count@a-1\relax%
22852 \repeatpgfmathloop
22853 \fi
22854 \endpgfscope
22855 \ifdim\pgf@circ@res@other>0pt
22856 \ifpgfcirc@draw@input@leads
22857 \pgfscope
22858 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
22859 \pgf@circ@count@a=\numpins%
22860 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
22861 \pgfmathloop%
22862 \ifnum\pgf@circ@count@a>0
22863 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
22864 \ifnum\padfrac>0
22865 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
22866 % left side pads
22867 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
22868 {%
22869 \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}}
22870 \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}}
22871 \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}}
22872 \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}}
22873 }{}%
22874 % bottom side pads
22875 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
22876 {%
22877 \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}}
22878 \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}}
22879 \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}}
22880 \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}}
22881 }{}%
22882 % right side pads
22883 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
22884 {%
22885 \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}}
22886 \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}}
22887 \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}}
22888 \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}}
22889 }{}%
22890 % top side pads
22891 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
22892 {%
22893 \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}}
22894 \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}}
22895 \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}}
22896 \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}}
22897 }{}%
22898 \else
22899 % left side pins
22900 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
22901 {%
22902 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22903 \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}}
22904 }{}%
22905 % bottom side pins
22906 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
22907 {%
22908 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
22909 \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}}
22910 }{}%
22911 % right side pins
22912 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
22913 {%
22914 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
22915 \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}}
22916 }{}%
22917 % top side pins
22918 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
22919 {%
22920 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
22921 \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}}
22922 }{}%
22923 \fi
22924 \advance\pgf@circ@count@a-1\relax%
22925 \repeatpgfmathloop
22926 \pgfusepath{stroke}
22927 \endpgfscope
22928 \fi
22929 \fi
22930 }%
22931 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
22932 % and is executed just before a node is drawn.
22933 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
22934 % Start with the maximum pin number and go backwards.
22935 \pgf@circ@count@a=\numpins%
22936 \pgfmathloop%
22937 \ifnum\pgf@circ@count@a>0
22938 \expandafter\pgf@circ@make@qfppin@anchor\expandafter{\the\pgf@circ@count@a}%
22939 \advance\pgf@circ@count@a-1\relax%
22940 \repeatpgfmathloop%
22941 }%
22942 }
22943
22944 %% anchors for DIP
22945 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
22946 \c@pgf@countc=\numpins\relax
22947 \divide\c@pgf@countc by 2
22948 \ifnum #1 > \the\c@pgf@countc
22949 % right side
22950 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
22951 \else
22952 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
22953 \fi
22954 }
22955
22956 %% anchors for QFP
22957 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
22958 \c@pgf@countc=\numpins\relax
22959 \divide\c@pgf@countc by 4
22960 \ifnum #1 > \the\c@pgf@countc
22961 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
22962 \ifnum #1 > \the\c@pgf@countb
22963 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
22964 \ifnum #1 > \the\c@pgf@countb
22965 % 3*npins/4 < pin, top side
22966 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
22967 \else
22968 % 2*npins/4 < pin <= 3*npins/4, right side
22969 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
22970 \fi
22971 \else
22972 % npins/4 < pin <= 2*npins/4, bottom side
22973 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
22974 \fi
22975 \else
22976 % <= npins/4, left side
22977 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
22978 \fi
22979 }% %>>>
22980
22981 %% Nodes definition for rotaryswitch%<<<
22982
22983 %%%%%%%%%%%%%%%%%
22984 %% Rotary Switch
22985 %%%%%%%%%%%%%%%%%
22986
22987 \pgfdeclareshape{rotaryswitch}
22988 {
22989 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
22990 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
22991 \savedanchor\northeast{%
22992 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22993 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
22994 % the magic number is 0.25/cos(35)
22995 % try to recalculate it for the actual switch
22996 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
22997 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
22998 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
22999 \edef\r{\ctikzvalof{nodes width}}
23000 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
23001 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
23002 }
23003 \savedanchor\northwest{%
23004 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23005 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
23006 % the magic number is 0.25/cos(35)
23007 % try to recalculate it for the actual switch
23008 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
23009 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
23010 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
23011 \edef\r{\ctikzvalof{nodes width}}
23012 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
23013 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
23014 }
23015 \savedanchor\central{%
23016 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23017 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
23018 % the magic number is 0.25/cos(35)
23019 % try to recalculate it for the actual switch
23020 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
23021 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
23022 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
23023 \edef\r{\ctikzvalof{nodes width}}
23024 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
23025 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
23026 }
23027 % external square limits
23028 \savedanchor\extnorthwest{%
23029 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23030 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
23031 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
23032 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
23033 \pgf@x=2.5\pgf@x % external square size
23034 \pgf@y=-\pgf@x %square thing when angle=180?
23035 }
23036 \saveddimen{\width}{
23037 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23038 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
23039 % radius of the connector
23040 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
23041 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
23042 % shapename
23043 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
23044 % shape type
23045 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
23046 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
23047 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
23048 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
23049 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
23050 % mid of the lever, to stack switches
23051 %\anchor{mid}{\midlever}
23052 \anchor{mid}{\northwest
23053 \pgf@circ@res@temp=-\pgf@x
23054 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
23055 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
23056 }
23057 %
23058 % Notice that the "in" anchors must mimic "ext center", otherwise they are
23059 % wrong for angles > 90 degrees!
23060 %
23061 % center anchors
23062 \anchor{cin}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
23063 % horizontal angles
23064 \anchor{in}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius}
23065 \anchor{ain}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius}
23066
23067 \anchor{center}{ \central \pgf@y=0pt }
23068 \anchor{east}{ \northeast \pgf@y=0pt }
23069 \anchor{west}{ \northwest \pgf@y=0pt }
23070 \anchor{south}{ \central \pgf@y=-\pgf@y }
23071 \anchor{north}{ \central }
23072 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
23073 \anchor{north east}{ \northeast }
23074 \anchor{north west}{ \northwest }
23075 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
23076
23077 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
23078 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
23079 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
23080 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
23081 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
23082 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
23083 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
23084 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
23085 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
23086
23087 \backgroundpath{
23088 \pgfsetcolor{\ctikzvalof{color}}
23089 \pgf@circ@res@right = \width
23090 \pgf@circ@res@left = -\width
23091
23092 \pgfscope %wiper
23093 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
23094 \pgf@circ@res@temp=\radius\relax
23095 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
23096 \pgfsetlinewidth{2\pgf@circ@res@temp}
23097 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
23098 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
23099 \pgfsetroundcap\pgfusepath{draw}
23100 \endpgfscope
23101
23102 \ifpgf@circ@rotaryarrow
23103 \pgfscope % arrow
23104 \pgfcirc@set@arrows{switch}{\ifpgf@circ@rotaryarrow@ccw latexslim\fi}{\ifpgf@circ@rotaryarrow@cw latexslim\fi}
23105 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
23106 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
23107 \pgftransformrotate{\wiper}
23108 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
23109 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
23110 \ifpgf@circ@rotaryarrow@ccw
23111 \ifpgf@circ@rotaryarrow@cw
23112 % both here, maintain values
23113 \relax
23114 \else
23115 % only ccw: remove end arrow
23116 \pgfsetarrowsend{}
23117 \fi
23118 \else
23119 \ifpgf@circ@rotaryarrow@cw
23120 % only cw: remove start arrow
23121 \pgfsetarrowsstart{}
23122 \else
23123 % none: shouldn't happen
23124 \relax
23125 \fi
23126 \fi
23127 \pgfusepath{draw}
23128 \endpgfscope
23129 \fi
23130
23131 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
23132 \pgf@circ@count@a=\channels\relax
23133 \pgfmathsetmacro{\currenta}{-\angle}
23134 \pgfmathloop%
23135 \ifnum\pgf@circ@count@a>0
23136 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
23137 \pgfscope
23138 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
23139 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
23140 \endpgfscope
23141 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
23142 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
23143 \advance\pgf@circ@count@a by -1\relax%
23144 \repeatpgfmathloop
23145
23146 \pgfscope % input
23147 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
23148 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
23149 \endpgfscope
23150 }
23151 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
23152 % and is executed just before a node is drawn.
23153 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
23154 % Start with the maximum pin number and go backwards.
23155 \pgf@circ@count@a=\channels\relax
23156 \pgfmathloop%
23157 \ifnum\pgf@circ@count@a>0
23158 % we will create two anchors per pin: the "normal one" like `pin 1` for the
23159 % electrical contact, and the "border one" like `bpin 1` for labels.
23160 % they will coincide if `external pins width` is set to 0.
23161 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
23162 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
23163 }
23164 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
23165 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
23166 }
23167 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
23168 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
23169 }
23170 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
23171 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}%
23172 }
23173 \advance\pgf@circ@count@a by -1\relax%
23174 \repeatpgfmathloop%
23175 }%
23176 }
23177
23178 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
23179 \pgf@circ@res@temp=\width
23180 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
23181 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
23182 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
23183 \advance\pgf@x by -\pgf@circ@res@temp
23184 }
23185
23186 \def\pgf@circ@rotarysqanchor#1{% external square anchors
23187 \pgf@circ@res@temp=\width
23188 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
23189 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
23190 \advance\pgf@x by -\pgf@circ@res@temp
23191 }% %>>>
23192
23193 %%%%%%%%%%%%%%%%%%%%%%%%%%
23194 % Seven segments displays
23195 %%%%%%%%%%%%%%%%%%%%%%%%%%
23196
23197 % Definitions for seven segment displays by RGtti%<<<1
23198
23199 \newif\ifpgf@circ@sevenseg@dot
23200 \newif\ifpgf@circ@sevenseg@box
23201 \def\pgf@circ@sevenseg@dotstate{empty}
23202 \ctikzset{seven seg/.is family}
23203 \ctikzset{seven seg/dot/.is choice}
23204 % none means no dot, not space for it. Empty means no dot, but space
23205 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
23206 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
23207 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
23208 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
23209 %
23210 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
23211 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
23212 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
23213 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
23214 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
23215 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
23216 \ctikzset{seven seg/box/.is choice}
23217 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
23218 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
23219
23220 \ctikzset{seven seg/bits/.initial=0000000}
23221
23222 \ctikzset{seven seg/value/.code={%
23223 \edef\@@tmp{#1}%
23224 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
23225 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
23226 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
23227 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
23228 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
23229 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
23230 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
23231 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
23232 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
23233 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
23234 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
23235 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
23236 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
23237 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
23238 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
23239 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
23240 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
23241 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
23242 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
23243 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
23244 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
23245 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
23246 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
23247 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
23248 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
23249 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
23250 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
23251 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
23252 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
23253 }}
23254
23255 \tikzset{%
23256 seven segment val/.style args={#1dot#2box#3}{%
23257 shape=bare7seg,
23258 /tikz/circuitikz/seven seg/value=#1,
23259 /tikz/circuitikz/seven seg/dot=#2,
23260 /tikz/circuitikz/seven seg/box=#3,
23261 },
23262 seven segment bits/.style args={#1dot#2box#3}{%
23263 shape=bare7seg,
23264 /tikz/circuitikz/seven seg/bits=#1,
23265 /tikz/circuitikz/seven seg/dot=#2,
23266 /tikz/circuitikz/seven seg/box=#3,
23267 },
23268 }
23269 %%>>>
23270
23271 %% Nodes definitions for 7-segment display%<<<
23272 \pgfdeclareshape{bare7seg}{
23273 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
23274 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23275 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
23276 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
23277 \ifpgf@circ@sevenseg@dot
23278 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
23279 \else
23280 \pgf@x=0pt
23281 \fi
23282 }
23283 % The object extension is more or less (-width/2,-width) to (width/2,width)
23284 % and adjusted for line thickness (both sides) and eventually the dot
23285 \saveddimen{\width}{
23286 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23287 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
23288 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
23289 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
23290 \savedanchor{\southwest}{% both negative
23291 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23292 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
23293 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
23294 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
23295 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
23296 }
23297 \savedanchor{\northeast}{% both positive
23298 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23299 \ifpgf@circ@sevenseg@dot
23300 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
23301 \else
23302 \pgf@circ@res@other=0pt
23303 \fi
23304 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
23305 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
23306 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
23307 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
23308 }
23309 \savedanchor{\topright}{% anchor without the box sep and the thickness
23310 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23311 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
23312 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
23313 }
23314 \anchor{center}{\pgfpointorigin}
23315 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
23316 \anchor{north east}{\northeast}
23317 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
23318 \anchor{south west}{\southwest}
23319 \anchor{north}{\northeast\pgf@x=0pt}
23320 \anchor{east}{\northeast\pgf@y=0pt}
23321 \anchor{south}{\southwest\pgf@x=0pt}
23322 \anchor{west}{\southwest\pgf@y=0pt}
23323 \anchor{a}{\topright\pgf@x=0pt}
23324 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
23325 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
23326 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
23327 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23328 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23329 \anchor{g}{\pgfpointorigin}
23330 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
23331 \behindbackgroundpath{%
23332 \southwest % I do not want the dot here, it will stick out
23333 \pgf@circ@res@up = -\pgf@y
23334 \pgf@circ@res@down = \pgf@y
23335 \pgf@circ@res@right = \pgf@x
23336 \pgf@circ@res@left = -\pgf@x
23337 \pgfscope
23338 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
23339 \pgfsetcolor{\ctikzvalof{color}}
23340 \pgfpathrectanglecorners%
23341 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
23342 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
23343 \ifpgf@circ@sevenseg@box
23344 \pgf@circ@draworfill
23345 \else
23346 \pgf@circ@maybefill
23347 \fi
23348 \endpgfscope
23349 \edef\bits{\ctikzvalof{seven seg/bits}}
23350 \pgfscope
23351 \pfg@circ@sseg@drawbits{\bits}
23352 \endpgfscope
23353 \pgfscope
23354 \ifpgf@circ@sevenseg@dot
23355 \pgf@circ@sseg@drawdots
23356 \fi
23357 \endpgfscope
23358 }
23359 }
23360
23361 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
23362 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
23363 }
23364 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
23365 \ifnum #1 > 0\relax
23366 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
23367 \else
23368 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
23369 \fi
23370 \pgfpathmoveto{\pgfpoint{#2}{#3}}
23371 \pgfpathlineto{\pgfpoint{#4}{#5}}
23372 \pgfusepath{draw}
23373 }
23374 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
23375 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
23376 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
23377 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
23378 % \pgfsetroundcap
23379 \pgfsetarrowsstart{Triangle Cap[]}
23380 \pgfsetarrowsend{Triangle Cap[]}
23381 % segments
23382 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
23383 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
23384 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
23385 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
23386 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
23387 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
23388 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
23389 }
23390 \def\pgf@circ@sseg@drawdots{% dots
23391 \edef\what{empty}
23392 \ifx\what\pgf@circ@sevenseg@dotstate
23393 % do nothing
23394 \else
23395 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
23396 \edef\what{off}
23397 \ifx\what\pgf@circ@sevenseg@dotstate
23398 % dot off
23399 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
23400 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
23401 \else
23402 % dot on
23403 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
23404 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
23405 \fi
23406 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
23407 \pgfusepath{draw,fill}
23408 \fi
23409 }
23410 % %>>>
23411
23412 %%%%%%%%%%%%%%%%%%%%%%%%
23413 %% Flip-flops and muxdemuxes
23414 %%%%%%%%%%%%%%%%%%%%%%%%
23415
23416 % Settings for flip flops and muxdemxes%<<<1
23417
23418 %% flip-flop specific keys (most others are the same as chips)
23419
23420 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
23421 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
23422 \ctikzset{multipoles/flipflop/width/.initial=1.2}
23423 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
23424 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
23425
23426 %% muxdemuxes keys
23427
23428 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
23429 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
23430 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
23431 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
23432 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
23433 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
23434 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
23435 \ctikzset{multipoles/muxdemux/NL/.initial=8}
23436 \ctikzset{multipoles/muxdemux/NR/.initial=1}
23437 \ctikzset{multipoles/muxdemux/NB/.initial=3}
23438 \ctikzset{multipoles/muxdemux/NT/.initial=0}
23439 \ctikzset{multipoles/muxdemux/square pins/.initial=0}%
23440 %>>>
23441
23442 %% Node shapes definitions for flip flops%<<<
23443
23444 % Flip flops are a specialized kind of dipchip.
23445 % they have a class by themselves
23446
23447 %% flip flop definitions --- by default empty
23448 %% pin texts
23449 \ctikzset{multipoles/flipflop/t1/.initial={}}
23450 \ctikzset{multipoles/flipflop/t2/.initial={}}
23451 \ctikzset{multipoles/flipflop/t3/.initial={}}
23452 \ctikzset{multipoles/flipflop/t4/.initial={}}
23453 \ctikzset{multipoles/flipflop/t5/.initial={}}
23454 \ctikzset{multipoles/flipflop/t6/.initial={}}
23455 \ctikzset{multipoles/flipflop/tu/.initial={}}
23456 \ctikzset{multipoles/flipflop/td/.initial={}}
23457 % pin clock wedge flags
23458 \ctikzset{multipoles/flipflop/c1/.initial={0}}
23459 \ctikzset{multipoles/flipflop/c2/.initial={0}}
23460 \ctikzset{multipoles/flipflop/c3/.initial={0}}
23461 \ctikzset{multipoles/flipflop/c4/.initial={0}}
23462 \ctikzset{multipoles/flipflop/c5/.initial={0}}
23463 \ctikzset{multipoles/flipflop/c6/.initial={0}}
23464 \ctikzset{multipoles/flipflop/cu/.initial={0}}
23465 \ctikzset{multipoles/flipflop/cd/.initial={0}}
23466 % pin negation circle flags
23467 \ctikzset{multipoles/flipflop/n1/.initial={0}}
23468 \ctikzset{multipoles/flipflop/n2/.initial={0}}
23469 \ctikzset{multipoles/flipflop/n3/.initial={0}}
23470 \ctikzset{multipoles/flipflop/n4/.initial={0}}
23471 \ctikzset{multipoles/flipflop/n5/.initial={0}}
23472 \ctikzset{multipoles/flipflop/n6/.initial={0}}
23473 \ctikzset{multipoles/flipflop/nu/.initial={0}}
23474 \ctikzset{multipoles/flipflop/nd/.initial={0}}
23475
23476
23477 % Thanks to @marmot
23478 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
23479
23480 % default set of flip flops
23481 \tikzset{
23482 % async
23483 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
23484 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
23485 % sync
23486 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
23487 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
23488 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
23489 % additional features
23490 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
23491 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
23492 }
23493
23494 %
23495 % commodity macro to draw the clock wedges. They leave the size of the
23496 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
23497 %
23498 \def\pgf@circ@do@wedge@left{
23499 \pgf@circ@res@temp=0pt\relax
23500 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
23501 \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}}
23502 \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}}
23503 \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}}
23504 \pgfusepath{stroke}
23505 \pgf@circ@res@temp=\wedge
23506 \fi
23507 }
23508 \def\pgf@circ@do@wedge@right{
23509 \pgf@circ@res@temp=0pt\relax
23510 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
23511 \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}}
23512 \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}}
23513 \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}}
23514 \pgfusepath{stroke}
23515 \pgf@circ@res@temp=-\wedge
23516 \fi
23517 }
23518 \def\pgf@circ@do@wedge@up{
23519 \pgf@circ@res@temp=0pt\relax
23520 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
23521 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
23522 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
23523 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
23524 \pgfusepath{stroke}
23525 \pgf@circ@res@temp=-\wedge
23526 \fi
23527 }
23528 \def\pgf@circ@do@wedge@down{
23529 \pgf@circ@res@temp=0pt\relax
23530 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
23531 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
23532 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
23533 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
23534 \pgfusepath{stroke}
23535 \pgf@circ@res@temp=\wedge
23536 \fi
23537 }
23538 % generic flip-flop shape
23539 \pgfdeclareshape{flipflop}{
23540 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
23541 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23542 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
23543 \savedmacro\numpins{\def\numpins{6}}
23544 \savedanchor\centerpoint{%
23545 \pgf@x=-.5\wd\pgfnodeparttextbox%
23546 \pgf@y=-.5\ht\pgfnodeparttextbox%
23547 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
23548 }%
23549 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
23550 \anchor{center}{\origin}
23551 \anchor{text}{\centerpoint}% to adjust text
23552 \saveddimen\height{%
23553 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23554 \pgfmathsetlength\pgf@x{((\numpins)
23555 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
23556 }%
23557 \saveddimen{\chipspacing}{
23558 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23559 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
23560 \saveddimen{\width}{
23561 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23562 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
23563 \saveddimen{\extshift}{
23564 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23565 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
23566 % standard anchors
23567 \savedanchor\northwest{%
23568 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23569 \pgfmathsetlength\pgf@y{0.5*((\numpins)
23570 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
23571 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
23572 }
23573 \anchor{dot}{\northwest
23574 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
23575 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
23576 }
23577 \anchor{nw}{\northwest}
23578 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
23579 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
23580 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
23581 \anchor{north west}{\northwest}
23582 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
23583 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
23584 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
23585 \anchor{n}{\northwest\pgf@x=0pt }
23586 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
23587 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23588 \anchor{w}{\northwest\pgf@y=0pt }
23589 \anchor{north}{\northwest\pgf@x=0pt }
23590 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
23591 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23592 \anchor{west}{\northwest\pgf@y=0pt }
23593 % upper and lower pin
23594 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
23595 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
23596 \anchor{bup}{\northwest\pgf@x=0pt }
23597 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23598 % start drawing
23599 \backgroundpath{%
23600 \northwest
23601 \pgf@circ@res@up = \pgf@y
23602 \pgf@circ@res@down = -\pgf@y
23603 \pgf@circ@res@right = -\pgf@x
23604 \pgf@circ@res@left = \pgf@x
23605 \pgf@circ@scaled@Rlen=\scaledRlen
23606 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
23607 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
23608 \pgfsetcolor{\ctikzvalof{color}}
23609 \pgfscope% (for the line width)
23610 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
23611 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
23612 \pgf@circ@draworfill
23613 \pgfusepath{stroke}%
23614 \endpgfscope
23615 % Adding the pin number
23616 \pgf@circ@count@a=\numpins\relax
23617 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
23618 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
23619 \ifpgf@circuit@chip@straightnumbers
23620 \pgfgettransformentries\a\b\temp\temp\temp\temp
23621 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
23622 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
23623 \else
23624 \pgfmathsetmacro{\rot}{0}
23625 \pgfmathsetmacro{\quadrant}{0}
23626 \fi
23627 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
23628 % text
23629 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
23630 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
23631 \pgf@circ@strut\space}
23632 % \typeout{TEXT\space\mytext}
23633 \pgfmathloop%
23634 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
23635 \pgf@circ@res@temp=0pt\relax
23636 \ifnum\pgf@circ@count@a>0
23637 \ifcase\quadrant % rotation 0
23638 % left
23639 \pgf@circ@count@c=\pgf@circ@count@a
23640 \pgf@circ@do@wedge@left
23641 % \typeout{TEXT Left Q1\space\mytext}
23642 \pgftext[left,
23643 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},
23644 rotate=\rot]{\mytext}
23645 % right
23646 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23647 \pgf@circ@do@wedge@right
23648 \pgftext[right,
23649 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},
23650 rotate=\rot]{\mytext}
23651 \or % rotation -90
23652 % left
23653 \pgf@circ@count@c=\pgf@circ@count@a
23654 \pgf@circ@do@wedge@left
23655 \pgftext[top,
23656 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},
23657 rotate=\rot]{\mytext}
23658 % right
23659 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23660 \pgf@circ@do@wedge@right
23661 \pgftext[bottom,
23662 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},
23663 rotate=\rot]{\mytext}
23664 \or %rotation 180
23665 % left
23666 \pgf@circ@count@c=\pgf@circ@count@a
23667 \pgf@circ@do@wedge@left
23668 \pgftext[right,
23669 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},
23670 rotate=\rot]{\mytext}
23671 % right
23672 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23673 \pgf@circ@do@wedge@right
23674 \pgftext[left,
23675 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},
23676 rotate=\rot]{\mytext}
23677 \or % rotation +90
23678 % left
23679 \pgf@circ@count@c=\pgf@circ@count@a
23680 \pgf@circ@do@wedge@left
23681 \pgftext[bottom,
23682 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},
23683 rotate=\rot]{\mytext}
23684 % right
23685 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23686 \pgf@circ@do@wedge@right
23687 \pgftext[top,
23688 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},
23689 rotate=\rot]{\mytext}
23690 \fi
23691 \advance\pgf@circ@count@a-1\relax%
23692 \repeatpgfmathloop
23693 % Now the up and down text
23694 % up
23695 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
23696 \pgf@circ@do@wedge@up
23697 \ifcase\quadrant % rotation 0
23698 \pgftext[top,
23699 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
23700 rotate=\rot]{\mytext}
23701 \or % rotation -90
23702 \pgftext[right,
23703 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
23704 rotate=\rot]{\mytext}
23705 \or %rotation 180
23706 \pgftext[bottom,
23707 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
23708 rotate=\rot]{\mytext}
23709 \or % rotation +90
23710 \pgftext[left,
23711 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
23712 rotate=\rot]{\mytext}
23713 \fi
23714 % down
23715 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
23716 \pgf@circ@do@wedge@down
23717 \ifcase\quadrant % rotation 0
23718 \pgftext[bottom,
23719 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
23720 rotate=\rot]{\mytext}
23721 \or % rotation -90
23722 \pgftext[left,
23723 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
23724 rotate=\rot]{\mytext}
23725 \or %rotation 180
23726 \pgftext[top,
23727 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
23728 rotate=\rot]{\mytext}
23729 \or % rotation +90
23730 \pgftext[right,
23731 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
23732 rotate=\rot]{\mytext}
23733 \fi
23734 % external pins
23735 \ifdim\pgf@circ@res@other>0pt
23736 \pgfscope
23737 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
23738 \pgf@circ@count@a=\numpins\relax
23739 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
23740 \pgfmathloop%
23741 \ifnum\pgf@circ@count@a>0
23742 % left side pins
23743 \pgf@circ@count@c=\pgf@circ@count@a
23744 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
23745 %% Or'ing tests in core TeX is tough
23746 \edef\@@or{0}
23747 % Just expand the key the minimum needed
23748 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
23749 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
23750 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
23751 \ifnum\@@tmp>0\edef\@@or{1}\fi
23752 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
23753 \ifnum\@@tmp>0\edef\@@or{1}\fi
23754 \ifnum\@@or>0
23755 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23756 \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}}
23757 \pgfusepath{stroke}
23758 \fi
23759 % right side pins
23760 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23761 \edef\@@or{0}
23762 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
23763 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
23764 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
23765 \ifnum\@@tmp>0\edef\@@or{1}\fi
23766 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
23767 \ifnum\@@tmp>0\edef\@@or{1}\fi
23768 % \typeout{TEST\space\@@tmp\space\@@x}
23769 \ifnum\@@or>0
23770 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23771 \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}}
23772 \pgfusepath{stroke}
23773 \fi
23774 \advance\pgf@circ@count@a by -1\relax%
23775 \repeatpgfmathloop
23776 % up side
23777 \edef\@@or{0}
23778 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
23779 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
23780 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
23781 \ifnum\@@tmp>0\edef\@@or{1}\fi
23782 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
23783 \ifnum\@@tmp>0\edef\@@or{1}\fi
23784 % \typeout{TEST\space\@@tmp\space\@@x}
23785 \ifnum\@@or>0
23786 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
23787 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
23788 \pgfusepath{stroke}
23789 \fi
23790 % down side
23791 \edef\@@or{0}
23792 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
23793 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
23794 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
23795 \ifnum\@@tmp>0\edef\@@or{1}\fi
23796 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
23797 \ifnum\@@tmp>0\edef\@@or{1}\fi
23798 % \typeout{TEST\space\@@tmp\space\@@x}
23799 \ifnum\@@or>0
23800 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
23801 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
23802 \pgfusepath{stroke}
23803 \fi
23804 \endpgfscope
23805 \fi % external pin width >0
23806 %
23807 % draw "inverting" circles on outputs, they must be last
23808 %
23809 \pgfscope
23810 \ifpgf@circuit@ieeelogicport
23811 \def\@@notcirc{notcirc}
23812 \else
23813 \ifpgf@circ@european@port@circle@ieee
23814 \def\@@notcirc{notcirc}
23815 \else
23816 \def\@@notcirc{ocirc}
23817 \fi
23818 \fi
23819 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
23820 \pgf@circ@count@a=\numpins\relax
23821 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
23822 \pgfmathloop%
23823 \ifnum\pgf@circ@count@a>0
23824 % left side pins
23825 \pgf@circ@count@c=\pgf@circ@count@a
23826 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
23827 \ifnum\@@tmp>0\pgfscope
23828 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23829 \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
23830 \endpgfscope\fi
23831 % right side pins
23832 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
23833 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
23834 \ifnum\@@tmp>0\pgfscope
23835 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
23836 \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
23837 \endpgfscope\fi
23838 \advance\pgf@circ@count@a by -1\relax%
23839 \repeatpgfmathloop
23840 % up side
23841 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
23842 \ifnum\@@tmp>0\pgfscope
23843 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
23844 \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
23845 \endpgfscope\fi
23846 % down side
23847 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
23848 \ifnum\@@tmp>0\pgfscope
23849 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
23850 \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
23851 \endpgfscope\fi
23852 \endpgfscope
23853 }%
23854 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
23855 % and is executed just before a node is drawn.
23856 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
23857 % Start with the maximum pin number and go backwards.
23858 \pgf@circ@count@a=\numpins\relax
23859 \pgfmathloop%
23860 \ifnum\pgf@circ@count@a>0
23861 % we will create two anchors per pin: the "normal one" like `pin 1` for the
23862 % electrical contact, and the "border one" like `bpin 1` for labels.
23863 % they will coincide if `external pins width` is set to 0.
23864 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
23865 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
23866 }
23867 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
23868 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
23869 }
23870 \advance\pgf@circ@count@a by -1\relax%
23871 \repeatpgfmathloop%
23872 }%
23873 }
23874 % %>>>
23875
23876 %% Node shapes for mux-demuxes%<<<
23877
23878 %
23879 % MUX-DEMUXES
23880 %
23881 % Thanks to @marmot
23882 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
23883 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
23884 \tikzset{one bit adder/.style={muxdemux,
23885 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
23886 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
23887 \tikzset{ALU/.style={muxdemux,
23888 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
23889 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
23890
23891 %generic mux-demux shape
23892
23893 % helper macros to set the anchors inside a loop (to expand the current count)
23894 % left
23895 \pgfutil@protected\def\pgf@circ@make@muxdemux@L@anchor#1%
23896 {%
23897 \expandafter\gdef\csname pgf@anchor@muxdemux@lpin #1\endcsname
23898 {%
23899 \pgf@circ@if@num@in@list\pgf@circ@Lpins@list{#1}
23900 {\pgf@circ@muxdemux@L@anchor{#1}{1}}
23901 {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
23902 }%
23903 \expandafter\gdef\csname pgf@anchor@muxdemux@blpin #1\endcsname
23904 {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
23905 }
23906 % right
23907 \pgfutil@protected\def\pgf@circ@make@muxdemux@R@anchor#1%
23908 {%
23909 \expandafter\gdef\csname pgf@anchor@muxdemux@rpin #1\endcsname
23910 {%
23911 \pgf@circ@if@num@in@list\pgf@circ@Rpins@list{#1}
23912 {\pgf@circ@muxdemux@R@anchor{#1}{1}}
23913 {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
23914 }%
23915 \expandafter\gdef\csname pgf@anchor@muxdemux@brpin #1\endcsname
23916 {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
23917 }
23918 % bottom
23919 \pgfutil@protected\def\pgf@circ@make@muxdemux@B@anchor#1%
23920 {%
23921 \expandafter\gdef\csname pgf@anchor@muxdemux@bpin #1\endcsname
23922 {%
23923 \pgf@circ@if@num@in@list\pgf@circ@Bpins@list{#1}
23924 {\pgf@circ@muxdemux@B@anchor{#1}{1}}
23925 {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
23926 }%
23927 \expandafter\gdef\csname pgf@anchor@muxdemux@bbpin #1\endcsname
23928 {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
23929 }
23930 % top
23931 \pgfutil@protected\def\pgf@circ@make@muxdemux@T@anchor#1%
23932 {%
23933 \expandafter\gdef\csname pgf@anchor@muxdemux@tpin #1\endcsname
23934 {%
23935 \pgf@circ@if@num@in@list\pgf@circ@Tpins@list{#1}
23936 {\pgf@circ@muxdemux@T@anchor{#1}{1}}
23937 {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
23938 }%
23939 \expandafter\gdef\csname pgf@anchor@muxdemux@btpin #1\endcsname
23940 {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
23941 }
23942
23943
23944 \pgfdeclareshape{muxdemux}{
23945 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
23946 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23947 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
23948 % pins on the four sides
23949 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
23950 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
23951 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
23952 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
23953 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
23954 % pin lists
23955 \savedmacro\pgf@circ@Lpins@list
23956 {%
23957 \pgfkeysgetvalue
23958 {\circuitikzbasekey/multipoles/draw only left pins}\pgf@circ@temp
23959 \expandafter\pgf@circ@set@list
23960 \expandafter\pgf@circ@Lpins@list
23961 \expandafter{\pgf@circ@temp}%
23962 }%
23963 \savedmacro\pgf@circ@Rpins@list
23964 {%
23965 \pgfkeysgetvalue
23966 {\circuitikzbasekey/multipoles/draw only right pins}\pgf@circ@temp
23967 \expandafter\pgf@circ@set@list
23968 \expandafter\pgf@circ@Rpins@list
23969 \expandafter{\pgf@circ@temp}%
23970 }%
23971 \savedmacro\pgf@circ@Tpins@list
23972 {%
23973 \pgfkeysgetvalue
23974 {\circuitikzbasekey/multipoles/draw only top pins}\pgf@circ@temp
23975 \expandafter\pgf@circ@set@list
23976 \expandafter\pgf@circ@Tpins@list
23977 \expandafter{\pgf@circ@temp}%
23978 }%
23979 \savedmacro\pgf@circ@Bpins@list
23980 {%
23981 \pgfkeysgetvalue
23982 {\circuitikzbasekey/multipoles/draw only bottom pins}\pgf@circ@temp
23983 \expandafter\pgf@circ@set@list
23984 \expandafter\pgf@circ@Bpins@list
23985 \expandafter{\pgf@circ@temp}%
23986 }%
23987 % topleft and topright sizes
23988 \savedanchor{\topleft}{%
23989 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23990 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
23991 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
23992 }
23993 \savedanchor{\topright}{%
23994 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23995 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
23996 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
23997 }
23998 \savedanchor{\insetnortheast}{%
23999 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24000 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
24001 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
24002 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
24003 }
24004 \saveddimen{\insethright}{
24005 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24006 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
24007 \saveddimen{\extshift}{
24008 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24009 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
24010 \savedanchor{\northwest}{%
24011 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24012 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
24013 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
24014 }
24015 \anchor{nw}{\northwest}
24016 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
24017 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
24018 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
24019 \anchor{north west}{\northwest}
24020 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
24021 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
24022 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
24023 \anchor{n}{\northwest\pgf@x=0pt }
24024 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24025 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24026 \anchor{w}{\northwest\pgf@y=0pt }
24027 \anchor{north}{\northwest\pgf@x=0pt }
24028 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24029 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24030 \anchor{west}{\northwest\pgf@y=0pt }
24031 \anchor{center}{\pgfpointorigin}
24032 \anchor{top right}{\topright}
24033 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
24034 \anchor{right}{\topright\pgf@y=0pt\relax}
24035 \anchor{top left}{\topleft}
24036 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
24037 \anchor{left}{\topleft\pgf@y=0pt\relax}
24038 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
24039 \divide\pgf@y by 2 \pgf@x=0pt\relax}
24040 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
24041 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
24042 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
24043 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
24044 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
24045 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
24046 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
24047 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
24048 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
24049 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
24050 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
24051 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
24052 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
24053 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
24054 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
24055 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
24056 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
24057 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
24058 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
24059 \divide\pgf@y by 2
24060 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
24061 \divide\pgf@y by 2 \pgf@x=0pt\relax}
24062 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
24063 \divide\pgf@y by 2
24064 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
24065 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
24066 \anchor{text}{%
24067 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24068 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
24069 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
24070 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
24071 \pgf@y=-.5\ht\pgfnodeparttextbox%
24072 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
24073 }%
24074 \backgroundpath{%
24075 \topleft
24076 \pgf@circ@res@up = \pgf@y
24077 \pgf@circ@res@down = -\pgf@y
24078 \pgf@circ@res@left = \pgf@x
24079 \topright
24080 \pgf@circ@res@other = \pgf@y
24081 \pgf@circ@res@right = \pgf@x
24082 \insetnortheast
24083 \pgf@circ@res@step = \pgf@x
24084 \pgf@circ@res@temp = \pgf@y
24085 %
24086 % external block
24087 %
24088 \pgfscope% (for the line width)
24089 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
24090 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
24091 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
24092 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
24093 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
24094 % inset, starting down
24095 \ifdim\pgf@circ@res@temp>0pt % inset
24096 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
24097 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
24098 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
24099 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
24100 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
24101 \fi
24102 \pgfpathclose
24103 \pgf@circ@draworfill
24104 \endpgfscope
24105 % now we have to draw the pins, if needed
24106 \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent
24107 % Ok, we have to draw the leads (a.k.a. pins)
24108 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
24109 % We mimic the anchors here --- probably there is a better way
24110 % left pins
24111 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
24112 \pgf@circ@count@a=\NL\relax
24113 \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
24114 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
24115 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
24116 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
24117 % we have to check oddity
24118 \ifodd\NL
24119 \ifnum\NL=1
24120 % only centerpin, step should not be used, but anyway...
24121 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
24122 \else
24123 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
24124 \fi
24125 \else
24126 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
24127 \fi
24128 \else % no inset
24129 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
24130 \fi
24131 \pgfmathloop%
24132 \ifnum\pgf@circ@count@a>0
24133 %%%%% check if we want to draw this pin
24134 \pgf@circ@if@num@in@list\pgf@circ@Lpins@list\pgf@circ@count@a{%
24135 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
24136 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
24137 % for lower pins we have to shift them down
24138 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
24139 \ifodd\NL
24140 % odd number of pins
24141 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
24142 % centerpin!
24143 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
24144 \ifnum\squarepins>0
24145 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
24146 \else
24147 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
24148 \fi
24149 \else
24150 \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}}
24151 \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}}
24152 \fi
24153 \else
24154 % even numer of pins: just go down
24155 \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}}
24156 \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}}
24157 \fi
24158 \else
24159 % nothing need for #1<=NL/2
24160 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24161 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24162 \fi
24163 \else
24164 % no inset
24165 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24166 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24167 \fi
24168 %%%%%
24169 }{}% close the pin list check
24170 \advance\pgf@circ@count@a by -1\relax%
24171 \repeatpgfmathloop\fi%
24172 % right pins
24173 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
24174 \pgfmathloop%
24175 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
24176 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
24177 \ifnum\pgf@circ@count@a>0
24178 %%%%% check if we want to draw this pin
24179 \pgf@circ@if@num@in@list\pgf@circ@Rpins@list\pgf@circ@count@a{%
24180 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24181 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
24182 }{}%
24183 \advance\pgf@circ@count@a by -1\relax%
24184 \repeatpgfmathloop\fi%
24185 % bottom pins
24186 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
24187 \pgfmathloop%
24188 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
24189 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
24190 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
24191 \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}
24192 \ifnum\pgf@circ@count@a>0
24193 %%%%% check if we want to draw this pin
24194 \pgf@circ@if@num@in@list\pgf@circ@Bpins@list\pgf@circ@count@a{%
24195 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24196 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
24197 \ifnum\squarepins>0
24198 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24199 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
24200 \else
24201 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24202 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
24203 \fi
24204 }{}%
24205 \advance\pgf@circ@count@a by -1\relax%
24206 \repeatpgfmathloop\fi%
24207 % top pins
24208 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
24209 \pgfmathloop%
24210 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
24211 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
24212 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
24213 \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}
24214 \ifnum\pgf@circ@count@a>0
24215 %%%%% check if we want to draw this pin
24216 \pgf@circ@if@num@in@list\pgf@circ@Tpins@list\pgf@circ@count@a{%
24217 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24218 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
24219 \ifnum\squarepins>0
24220 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24221 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
24222 \else
24223 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
24224 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
24225 \fi
24226 }{}%
24227 \advance\pgf@circ@count@a by -1\relax%
24228 \repeatpgfmathloop\fi%
24229 % end drawing pins; stroke them
24230 \pgfusepath{stroke}
24231 \endpgfscope\fi\fi
24232 }
24233 % let's start adding anchors
24234 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
24235 % left side anchors
24236 \pgf@circ@count@a=\NL\relax
24237 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
24238 \pgfmathloop%
24239 \ifnum\pgf@circ@count@a>0
24240 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
24241 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
24242 % external leads, and the "border one" like `blpin 1` for internal ones.
24243 % they will coincide if `external pins width` is set to 0.
24244 \expandafter\pgf@circ@make@muxdemux@L@anchor\expandafter{\the\pgf@circ@count@a}%
24245 \advance\pgf@circ@count@a by -1\relax%
24246 \repeatpgfmathloop%
24247 % right anchors
24248 \pgf@circ@count@a=\NR\relax
24249 \pgfmathloop%
24250 \ifnum\pgf@circ@count@a>0
24251 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
24252 % external leads, and the "border one" like `brpin 1` for internal ones.
24253 % they will coincide if `external pins width` is set to 0.
24254 \expandafter\pgf@circ@make@muxdemux@R@anchor\expandafter{\the\pgf@circ@count@a}%
24255 \advance\pgf@circ@count@a by -1\relax%
24256 \repeatpgfmathloop%
24257 % bottom anchors
24258 \pgf@circ@count@a=\NB\relax
24259 \pgfmathloop%
24260 \ifnum\pgf@circ@count@a>0
24261 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
24262 % external leads, and the "border one" like `bbpin 1` for internal ones.
24263 % they will coincide if `external pins width` is set to 0.
24264 \expandafter\pgf@circ@make@muxdemux@B@anchor\expandafter{\the\pgf@circ@count@a}%
24265 \advance\pgf@circ@count@a by -1\relax%
24266 \repeatpgfmathloop%
24267 % top anchors
24268 \pgf@circ@count@a=\NT\relax
24269 \pgfmathloop%
24270 \ifnum\pgf@circ@count@a>0
24271 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
24272 % external leads, and the "border one" like `btpin 1` for internal ones.
24273 % they will coincide if `external pins width` is set to 0.
24274 \expandafter\pgf@circ@make@muxdemux@T@anchor\expandafter{\the\pgf@circ@count@a}%
24275 \advance\pgf@circ@count@a by -1\relax%
24276 \repeatpgfmathloop%
24277 }%
24278 }
24279
24280 %% left anchors for muxdemux
24281
24282 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24283 \topleft
24284 \pgf@xa=\pgf@x
24285 \pgf@ya=\pgf@y
24286 \insetnortheast
24287 \pgf@xb=\pgf@x
24288 \pgf@yb=\pgf@y
24289 \ifnum#1>\NL
24290 \PackageError{circuitikz}{%
24291 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
24292 which has been defined with \NL\space left pins%
24293 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
24294 \fi
24295 \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
24296 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
24297 \ifnum\NL>1
24298 \ifdim\pgf@yb>0pt % check if we have an inset
24299 % we have to check oddity
24300 \ifodd\NL
24301 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
24302 \else
24303 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
24304 \fi
24305 \else % no inset
24306 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
24307 \fi
24308 \ifdim\pgf@yb>0pt % check if we have an inset
24309 \ifnum#1>\pgf@circ@count@a\relax
24310 % for lower pins we have to shift them down
24311 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
24312 \ifodd\NL
24313 % odd number of pins
24314 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
24315 % centerpin!
24316 \ifnum#2=0\relax
24317 \pgfpoint{\pgf@xb}{0pt}
24318 \else
24319 \ifnum\squarepins>0
24320 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
24321 \else
24322 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
24323 \fi
24324 \fi
24325 \else
24326 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
24327 \fi
24328 \else
24329 % even numer of pins: just go down
24330 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
24331 \fi
24332 \else
24333 % nothing need for #1<=NL/2
24334 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
24335 \fi
24336 \else
24337 % no inset
24338 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
24339 \fi
24340 \else
24341 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
24342 \fi
24343 }
24344
24345 % right anchors
24346 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24347 \topright
24348 \pgf@xa=\pgf@x
24349 \pgf@ya=\pgf@y
24350 \ifnum#1>\NR
24351 \PackageError{circuitikz}{%
24352 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
24353 which has been defined with \NR\space right pins%
24354 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
24355 \fi
24356 \ifnum\NR>1
24357 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
24358 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
24359 \else
24360 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
24361 \fi
24362 }
24363
24364 % bottom anchors
24365 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24366 \topleft
24367 \pgf@xa=\pgf@x
24368 \pgf@ya=\pgf@y
24369 \topright
24370 \pgf@xb=\pgf@x
24371 \pgf@yb=\pgf@y
24372 \ifnum#1>\NB
24373 \PackageError{circuitikz}{%
24374 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
24375 which has been defined with \NB\space bottom pins%
24376 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
24377 \fi
24378 \ifnum\NB>0
24379 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
24380 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
24381 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
24382 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
24383 \ifnum#2=0\relax
24384 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
24385 \else
24386 \ifnum\squarepins>0\relax
24387 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
24388 \else
24389 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
24390 \fi
24391 \fi
24392 \else
24393 % should not happen, give the same as pin 1 anyway
24394 \ifnum#2=0\relax
24395 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
24396 \else
24397 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
24398 \fi
24399 \fi
24400 }
24401
24402 % top anchors
24403 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24404 \topleft
24405 \pgf@xa=\pgf@x
24406 \pgf@ya=\pgf@y
24407 \topright
24408 \pgf@xb=\pgf@x
24409 \pgf@yb=\pgf@y
24410 \ifnum#1>\NT
24411 \PackageError{circuitikz}{%
24412 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
24413 which has been defined with \NT\space top pins%
24414 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
24415 \fi
24416 \ifnum\NT>0
24417 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
24418 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
24419 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
24420 \ifnum#2=0\relax
24421 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
24422 \else
24423 \ifnum\squarepins>0
24424 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
24425 \else
24426 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
24427 \fi
24428 \fi
24429 \else
24430 % should not happen, give the same as pin 1 anyway
24431 \ifnum#2=0\relax
24432 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
24433 \else
24434 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
24435 \fi
24436 \fi
24437 }
24438 % %>>>
24439
24440 % vim: set fdm=marker fmr=%<<<,%>>>:
24441 %%%---------- close: tex/pgfcircmultipoles
24442
24443 %%%%%%%%%%% Springe nach tex/pgfcirclabel
24444 %%%---------- open: tex/pgfcirclabel.tex
24445 % Copyright 2018-2026 by Romano Giannetti
24446 % Copyright 2015-2026 by Stefan Lindner
24447 % Copyright 2013-2026 by Stefan Erhardt
24448 % Copyright 2007-2026 by Massimo Redaelli
24449 %
24450 % This file may be distributed and/or modified
24451 %
24452 % 1. under the LaTeX Project Public License and/or
24453 % 2. under the GNU Public License.
24454 %
24455 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
24456
24457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24458 %% Bipole label positioning
24459
24460 %% bipole labels and annotation extra style
24461
24462 \ctikzset{bipole label style/.style={}}
24463 \tikzset{bipole label style/.code={
24464 \ctikzset{bipole label style/.style={#1}}
24465 }}
24466 \tikzset{bipole label append style/.code={
24467 \ctikzset{bipole label style/.append style={#1}}
24468 }}
24469 \ctikzset{bipole annotation style/.style={}}
24470 \tikzset{bipole annotation style/.code={
24471 \ctikzset{bipole annotation style/.style={#1}}
24472 }}
24473 \tikzset{bipole annotation append style/.code={
24474 \ctikzset{bipole annotation style/.append style={#1}}
24475 }}
24476
24477 \ctikzset{label distance/.initial={0pt}}
24478 \ctikzset{annotation distance/.initial={0pt}}
24479
24480 %% Options
24481 \ctikzset{label/.style = { l={#1} } }
24482 \ctikzset{l/.code = {
24483 \pgfkeys{/tikz/circuitikz/bipole/label/name={#1}}
24484 \ctikzsetvalof{bipole/label/unit}{}
24485 \ifpgf@circ@siunitx
24486 \pgf@circ@handleSI{#1}
24487 \ifpgf@circ@siunitx@res
24488 \edef\pgf@temp{\pgf@circ@handleSI@val}
24489 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
24490 \edef\pgf@temp{\pgf@circ@handleSI@unit}
24491 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
24492 \else
24493 \fi
24494 \else
24495 \fi
24496 }}
24497
24498 \ctikzset{label above/.code = {
24499 l={#1},
24500 \circuitikzbasekey/bipole/label/position=90 }
24501 }
24502
24503 \ctikzset{l^/.style = {
24504 l={#1},
24505 \circuitikzbasekey/bipole/label/position=90 }
24506 }
24507
24508 \ctikzset{label below/.code = {
24509 l={#1},
24510 \circuitikzbasekey/bipole/label/position=-90 }
24511 }
24512
24513 \ctikzset{l_/.style = {
24514 l={#1},
24515 \circuitikzbasekey/bipole/label/position=-90 }
24516 }
24517
24518 \ctikzset{annotation/.style = { a={#1} } }
24519 \ctikzset{a/.code = {
24520 \pgfkeys{/tikz/circuitikz/bipole/annotation/name={#1}}
24521 \ctikzsetvalof{bipole/annotation/unit}{}
24522 \ifpgf@circ@siunitx
24523 \pgf@circ@handleSI{#1}
24524 \ifpgf@circ@siunitx@res
24525 \edef\pgf@temp{\pgf@circ@handleSI@val}
24526 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
24527 \edef\pgf@temp{\pgf@circ@handleSI@unit}
24528 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
24529 \else
24530 \fi
24531 \else
24532 \fi
24533 }}
24534
24535 \ctikzset{annotation above/.code = {
24536 a={#1},
24537 \circuitikzbasekey/bipole/annotation/position=90 }
24538 }
24539
24540 \ctikzset{a^/.style = {
24541 a={#1},
24542 \circuitikzbasekey/bipole/annotation/position=90 }
24543 }
24544
24545 \ctikzset{annotation below/.code = {
24546 a={#1},
24547 \circuitikzbasekey/bipole/annotation/position=-90 }
24548 }
24549 \ctikzset{a_/.style = {
24550 a={#1},
24551 \circuitikzbasekey/bipole/annotation/position=-90 }
24552 }
24553
24554 % This is to adjust spacing for the labels so that they are not cramped on components
24555 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
24556
24557 \def\pgf@circ@drawlabels#1{
24558 \pgfextra{
24559 % This function will be called with argument #1 equal
24560 % to "label" or "annotation" form pgfcircpath.tex.
24561 % pgf@circ@direction is the direction of the path,
24562 % its value is set in pgfcircpath.tex
24563 \pgfmathsubtract{\pgf@circ@direction}{90}
24564 \pgfmathround{\pgfmathresult} % avoid precision loss errors
24565 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24566
24567 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
24568 \ifnum \pgf@circ@temp < 0
24569 \pgfmathadd{\pgf@circ@labanc}{180}
24570 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24571 \fi
24572 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
24573 %
24574 % normalize the angle values
24575 %
24576 \pgfmathmod{\pgf@circ@labanc}{360}
24577 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24578 %
24579 \ifpgf@circuit@bipole@inverted
24580 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
24581 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24582 \fi
24583 %
24584 \ifnum \ctikzvalof{mirror value} = -1
24585 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
24586 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24587 \fi
24588 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
24589 }
24590 %Firstly, place a coordinate directly at the edge of the shape
24591 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (pgfcirc@labelcoor)
24592 %now decide, which labels should be drawn
24593 \pgfextra{
24594 \edef\pgf@temp{\ctikzvalof{label/align}}
24595 \def\pgf@circ@temp{straight}
24596 }
24597 \ifx\pgf@temp\pgf@circ@temp %straight
24598 \pgf@circ@drawreglabels{#1}
24599 \else
24600 \pgfextra{\def\pgf@circ@temp{rotate}}
24601 \ifx\pgf@temp\pgf@circ@temp %rotate
24602 \pgf@circ@drawrotlabels{#1}
24603 \else% smart
24604 \pgf@circ@drawsmartlabels{#1}
24605 \fi
24606 \fi
24607 }
24608
24609
24610 \def\pgf@circ@drawsmartlabels#1{
24611 \pgfextra{
24612 \pgfmathmod{\pgf@circ@direction}{90}
24613 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24614 }
24615 \ifnum \pgfcircmathresult > 20
24616 \ifnum \pgfcircmathresult < 70
24617 \pgf@circ@drawrotlabels{#1}
24618 \else
24619 \pgf@circ@drawreglabels{#1}
24620 \fi
24621 \else
24622 \pgf@circ@drawreglabels{#1}
24623 \fi
24624 }
24625
24626
24627 \def\pgf@circ@drawrotlabels#1{
24628 \pgfextra{
24629 % scale the distances in function of zoom, so that they are not
24630 % dependent on it but on font size. Thanks to @marmot
24631 % https://tex.stackexchange.com/a/476018/38080
24632 % the coefficient is adjusted so that the distance is more or less
24633 % the same for rotated labels and straight ones (although it will
24634 % depend on the font, so it's not exact).
24635 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
24636 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
24637 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
24638 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale}
24639 \ifnum \ctikzvalof{bipole/#1/position}>0
24640 %we need some more space for placement below, due to mid-anchor
24641 \else % we do not have <= in \ifnum...
24642 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
24643 \fi
24644 %Calculate rotation of the label from direction and strip decimals
24645 \pgfmathsetmacro{\pgfcirclabrot}{round(\pgf@circ@direction)}
24646 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfcirclabrot\pgf@nil}
24647 % rotate the label at second or third quadrant:
24648 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
24649 \pgfmathsubtract{\pgf@circ@direction}{180}
24650 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24651 %invert the space relationships due to rotated strings
24652 \ifnum \ctikzvalof{bipole/#1/position}>0
24653 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
24654 \fi
24655 \fi\fi
24656 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}%
24657 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}%
24658 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{\pgfcirclabrot}%
24659 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{mid}%
24660 }
24661 % reset cm is not working correctly here
24662 % relative ++ movement disrupt to[] +()
24663 ($(pgfcirc@labelcoor)+(\pgf@circ@labposangle:\the\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
24664 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
24665 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
24666 }
24667
24668 \def\pgf@circ@drawreglabels#1{
24669 %Now calculate all shape positions
24670 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
24671 %All points between will be addressed by angled-anchors:
24672 \pgfextra{
24673 % scale ex-distance to make it independent on scale
24674 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
24675 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
24676 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
24677 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
24678 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale}
24679 \pgfmathadd{\pgf@circ@labanc}{90}
24680 \pgfmathround{\pgfmathresult}
24681 \def\pgf@circ@labanctext{\pgf@circ@labanc}
24682 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24683 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
24684 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
24685 }
24686 %Values around 90 are at both y-axis
24687 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
24688 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
24689 \ifnum \pgf@circ@labpos > 180
24690 \ifnum \ctikzvalof{bipole/#1/position} > 0
24691 \pgfextra{\def\pgf@circ@labanctext{mid west}}
24692 \else
24693 \pgfextra{\def\pgf@circ@labanctext{mid east}}
24694 \fi
24695 \else
24696 \ifnum \ctikzvalof{bipole/#1/position} > 0
24697 \pgfextra{\def\pgf@circ@labanctext{mid east}}
24698 \else
24699 \pgfextra{\def\pgf@circ@labanctext{mid west}}
24700 \fi
24701 \fi
24702 \fi\fi
24703 %Values between -5 and 5 are at pos /neg x-axis
24704 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
24705 \ifnum \ctikzvalof{bipole/#1/position} < 0
24706 \ifnum \pgf@circ@labanc > 90
24707 % using base coordinate instead of south to naturally align
24708 % symbols with descendants; but this invalidate the effect of
24709 % the inner sep, so recover it by shifting the anchor
24710 % reset cm is not working sometime, use @marmot solution
24711 % see https://tex.stackexchange.com/a/476018/38080
24712 % notice that relative ++ movement disrupt to[] +()
24713 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
24714 \pgfextra{\def\pgf@circ@labanctext{base}}%base
24715 \else
24716 \pgfextra{\def\pgf@circ@labanctext{north}}%north
24717 \fi
24718 \else
24719 \ifnum \pgf@circ@labanc < 90
24720 % shift, as above
24721 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
24722 \pgfextra{\def\pgf@circ@labanctext{base}}%base
24723 \else
24724 \ifnum \pgf@circ@labanc > 180
24725 % this shouldn't happen, but somehow it does (270 degree anchors)
24726 % shift, as above
24727 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
24728 \pgfextra{\def\pgf@circ@labanctext{base}}%base
24729 \else
24730 \pgfextra{\def\pgf@circ@labanctext{north}}%north
24731 \fi
24732 \fi
24733 \fi
24734 \fi\fi
24735 \pgfextra{%
24736 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{0}%
24737 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{\pgf@circ@labanctext}%
24738 }
24739 (pgfcirc@labelcoor) node[anchor=\pgf@circ@labanctext,
24740 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
24741 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
24742 }
24743 }
24744
24745 \def\pgf@circ@finallabels#1{%
24746 \edef\pgf@temp{}%
24747 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
24748 \ifx\pgf@temp\pgf@circ@temp%
24749 \ctikzvalof{bipole/#1/name}%
24750 \else%
24751 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
24752 \fi%
24753 }
24754
24755
24756 %%%% Stacked labels
24757 %
24758 % stacked labels by Romano Giannetti [email protected]
24759 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
24760 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
24761 %
24762 % labels are in a tabular, globally aligned:
24763 % vertically with key l2 valign (default c)
24764 % c: center t: top b: bottom
24765 % horizontally with key l2 align (default l)
24766 % l: left c: centered r: right
24767 % you can switch sides using l2_=... and l2^=...
24768 % syntax is l2_ = line1 and line2 (same for l2^)
24769 %
24770 \ctikzset{%
24771 l2 valign/.store in=\pgfcirc@ltwo@valign, l2 valign=c,
24772 l2 halign/.store in=\pgfcirc@ltwo@halign, l2 halign=l,
24773 }
24774 \ctikzset{l2base/.code n args={2}{
24775 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
24776 \bgroup
24777 \setlength{\tabcolsep}{2pt}%
24778 \def\pgfcirc@ltwo@tabu{\tabular[\pgfcirc@ltwo@valign]}%
24779 \expandafter\pgfcirc@ltwo@tabu\expandafter{\pgfcirc@ltwo@halign}%
24780 #1\\ #2%
24781 \endtabular
24782 \egroup
24783 }%
24784 }}
24785 \ctikzset{l2/.style args={#1and#2}{
24786 l2base={#1}{#2},
24787 \circuitikzbasekey/bipole/label/position=90 }
24788 }
24789 \ctikzset{l2 above/.style args={#1and#2}{
24790 l2base={#1}{#2},
24791 \circuitikzbasekey/bipole/label/position=90 }
24792 }
24793 \ctikzset{l2^/.style args={#1and#2}{
24794 l2base={#1}{#2},
24795 \circuitikzbasekey/bipole/label/position=90 }
24796 }
24797 \ctikzset{l2 below/.style args={#1and#2}{
24798 l2base={#1}{#2},
24799 \circuitikzbasekey/bipole/label/position=-90 }
24800 }
24801 \ctikzset{l2_/.style args={#1and#2}{
24802 l2base={#1}{#2},
24803 \circuitikzbasekey/bipole/label/position=-90 }
24804 }
24805 %
24806 % the same for annotations
24807 %
24808 \ctikzset{%
24809 a2 valign/.store in=\pgfcirc@atwo@valign, a2 valign=c,
24810 a2 halign/.store in=\pgfcirc@atwo@halign, a2 halign=r,
24811 }
24812 \ctikzset{a2base/.code n args={2}{
24813 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=%
24814 \bgroup
24815 \setlength{\tabcolsep}{2pt}%
24816 \def\pgfcirc@atwo@tabu{\tabular[\pgfcirc@atwo@valign]}%
24817 \expandafter\pgfcirc@atwo@tabu\expandafter{\pgfcirc@atwo@halign}%
24818 #1\\ #2%
24819 \endtabular
24820 \egroup
24821 }%
24822 }}
24823 \ctikzset{a2/.style args={#1and#2}{
24824 a2base={#1}{#2},
24825 \circuitikzbasekey/bipole/annotation/position=-90 }
24826 }
24827 \ctikzset{a2 above/.style args={#1and#2}{
24828 a2base={#1}{#2},
24829 \circuitikzbasekey/bipole/annotation/position=-90 }
24830 }
24831 \ctikzset{a2^/.style args={#1and#2}{
24832 a2base={#1}{#2},
24833 \circuitikzbasekey/bipole/annotation/position=-90 }
24834 }
24835 \ctikzset{a2 below/.style args={#1and#2}{
24836 a2base={#1}{#2},
24837 \circuitikzbasekey/bipole/annotation/position=90 }
24838 }
24839 \ctikzset{a2_/.style args={#1and#2}{
24840 a2base={#1}{#2},
24841 \circuitikzbasekey/bipole/annotation/position=90 }
24842 }
24843
24844 %%%---------- close: tex/pgfcirclabel
24845 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
24846 %%%---------- open: tex/pgfcircvoltage.tex
24847 % Copyright 2018-2026 by Romano Giannetti
24848 % Copyright 2015-2026 by Stefan Lindner
24849 % Copyright 2013-2026 by Stefan Erhardt
24850 % Copyright 2007-2026 by Massimo Redaelli
24851 %
24852 % This file may be distributed and/or modified
24853 %
24854 % 1. under the LaTeX Project Public License and/or
24855 % 2. under the GNU Public License.
24856 %
24857 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
24858
24859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24860 %% Voltage management
24861
24862 %% styles%<<<
24863 \ctikzset{bipole voltage style/.style={}}
24864 \tikzset{bipole voltage style/.code={
24865 \ctikzset{bipole voltage style/.style={#1}}
24866 }}
24867 \tikzset{bipole voltage append style/.code={
24868 \ctikzset{bipole voltage style/.append style={#1}}
24869 }}
24870
24871 \ctikzset{v^>/.style = {
24872 v={#1},
24873 \circuitikzbasekey/bipole/voltage/direction = forward,
24874 \circuitikzbasekey/bipole/voltage/position = above
24875 }
24876 }
24877
24878 \ctikzset{v^</.style = {
24879 v={#1},
24880 \circuitikzbasekey/bipole/voltage/direction = backward,
24881 \circuitikzbasekey/bipole/voltage/position = above
24882 }
24883 }
24884
24885 \ctikzset{v_>/.style = {
24886 v={#1},
24887 \circuitikzbasekey/bipole/voltage/direction = forward,
24888 \circuitikzbasekey/bipole/voltage/position = below
24889 }
24890 }
24891
24892 \ctikzset{v_</.style = {
24893 v={#1},
24894 \circuitikzbasekey/bipole/voltage/direction = backward,
24895 \circuitikzbasekey/bipole/voltage/position = below
24896 }
24897 }
24898
24899 \ctikzset{v_/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = below} }
24900 \ctikzset{v^/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = above} }
24901 \ctikzset{v>/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward} }
24902 \ctikzset{v</.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = backward} }%
24903
24904 \newif\ifpgfcirc@do@v@symbols\pgfcirc@do@v@symbolstrue
24905 \ctikzset{no v symbols/.code={\pgfcirc@do@v@symbolsfalse}}
24906 \ctikzset{v symbols/.code={\pgfcirc@do@v@symbolstrue}}
24907
24908 % Default position varies whether the component is a voltage source
24909 % or not
24910 \ctikzset{v/.code = {
24911 \pgfcirc@has@vtrue
24912 \ifpgf@circuit@bipole@override@source@vif
24913 \pgf@circuit@bipole@isvoltagefalse
24914 \pgf@circuit@bipole@iscurrentfalse
24915 \fi
24916 \ifpgf@circuit@bipole@isvoltage
24917 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
24918 \circuitikzbasekey/bipole/voltage/direction=forward}
24919 \else
24920 \ifpgf@circ@oldvoltagedirection
24921 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
24922 \circuitikzbasekey/bipole/voltage/direction=backward}
24923 \else
24924 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
24925 \circuitikzbasekey/bipole/voltage/direction=forward}
24926 \fi
24927 \fi
24928 \ifpgf@circ@oldvoltagedirection
24929 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
24930 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
24931 \circuitikzbasekey/bipole/voltage/direction=forward}
24932 \fi\fi
24933 \else
24934 \ifpgf@circuit@bipole@iscurrent
24935 \ifpgf@circuit@bipole@current@backward
24936 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
24937 \circuitikzbasekey/bipole/voltage/direction=forward}
24938 \else
24939 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
24940 \circuitikzbasekey/bipole/voltage/direction=backward}
24941 \fi\fi\fi
24942 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name={#1}}
24943 \ctikzsetvalof{bipole/voltage/label/unit}{}
24944 \ifpgf@circ@siunitx
24945 \pgf@circ@handleSI{#1}
24946 \ifpgf@circ@siunitx@res
24947 \edef\pgf@temp{\pgf@circ@handleSI@val}
24948 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
24949 \edef\pgf@temp{\pgf@circ@handleSI@unit}
24950 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
24951 \else
24952 \fi
24953 \else
24954 \fi
24955 }
24956 }
24957 % %>>>
24958
24959 % american voltage font selection and symbol definition
24960 % the default font command is {} --- nothing
24961 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
24962 %
24963 % plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex)
24964 %
24965 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
24966 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
24967
24968 %%
24969 \def\setscaledRlenforclass{%
24970 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
24971 \ifdefined\ctikzclass
24972 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
24973 \pgfkeysifdefined{\pgf@temp}
24974 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24975 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
24976 \else
24977 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
24978 \fi
24979 }
24980
24981 %% Output routine for generic bipoles%<<<
24982 % put this to true to see the voltage label coordinate anchors
24983 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
24984
24985 \def\pgf@circ@drawvoltagegeneric{
24986 \pgfextra{
24987 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
24988 \ifnum \ctikzvalof{mirror value}=-1
24989 \ifpgf@circuit@bipole@inverted
24990 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
24991 \else
24992 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
24993 \fi
24994 \else
24995 \ifpgf@circuit@bipole@inverted
24996 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
24997 \else
24998 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
24999 \fi
25000 \fi
25001 \ifpgf@circuit@bipole@voltage@below
25002 \def\pgf@circ@voltage@angle{90}
25003 \else
25004 \def\pgf@circ@voltage@angle{-90}
25005 \fi
25006 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
25007 \pgfkeysifdefined{\pgf@temp}
25008 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
25009 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
25010 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
25011 \pgfkeysifdefined{\pgf@temp}
25012 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
25013 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
25014 \edef\shiftv{\ctikzvalof{voltage/shift}}
25015 % additional per-bipole voltage shift (internal)
25016 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
25017 \pgfkeysifdefined{\pgf@temp}
25018 {
25019 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
25020 }
25021 {
25022 \edef\addvshift{0}
25023 }
25024 \newdimen{\absvshift}
25025 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
25026 % reset anchor if american and open
25027 \ifpgf@circuit@europeanvoltage
25028 \else
25029 \ifx\@@kind\@@open
25030 \def\pgf@circ@bipole@voltage@label@anchor{center}
25031 \fi
25032 \fi
25033 \ifpgf@circuit@bipole@voltage@raised
25034 \def\pgf@circ@bipole@voltage@label@anchor{center}
25035 \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
25036 \fi
25037 }
25038 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
25039 %absolute move, minimum space is length of arrowhead
25040 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorstartnode)$)
25041 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorstartnode)$)
25042 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
25043 %absolute move, minimum space is length of arrowhead
25044 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorendnode)$)
25045 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorendnode)$)
25046 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
25047 coordinate (pgfcirc@mid) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
25048
25049 \ifpgf@circuit@bipole@voltage@below
25050 % see comments for the "above" part (similar)
25051 \ifpgf@circuit@europeanvoltage
25052 \ifpgf@circuit@bipole@voltage@straight
25053 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
25054 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
25055 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vto@flat)$)
25056 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!90 : (pgfcirc@Vfrom1)$)
25057 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!-90 : (pgfcirc@Vto1)$)
25058 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
25059 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
25060 \else
25061 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
25062 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
25063 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
25064 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
25065 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
25066 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
25067 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
25068 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
25069 \fi
25070 \else
25071 % we are in case of american here
25072 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
25073 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
25074 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
25075 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
25076 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@bottom) ! \absvshift!-90 : (pgfcirc@Vdir0)$)
25077 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
25078 \ifpgf@circuit@bipole@voltage@raised
25079 % move the from and to up to the level of Vlab
25080 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
25081 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
25082 \fi
25083 \fi
25084 \else
25085 \ifpgf@circuit@europeanvoltage
25086 \ifpgf@circuit@bipole@voltage@straight
25087 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
25088 % move parallel to the component line at pgfcirc@top distance
25089 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
25090 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vto@flat)$)
25091 % add the extra distance
25092 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!-90 : (pgfcirc@Vfrom1)$)
25093 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!90 : (pgfcirc@Vto1)$)
25094 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
25095 % direction line to shift the label later
25096 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
25097 \else
25098 % european voltages here
25099 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (pgfcirc@anchorendnode)$)
25100 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (pgfcirc@anchorstartnode)$)
25101 % identify the two control points for the "arc" of the voltage
25102 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
25103 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
25104 % and shift them a bit
25105 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
25106 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
25107 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
25108 % direction line to shift the label later
25109 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
25110 \fi
25111 \else
25112 % we are in case of american here
25113 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!-90 : (pgfcirc@anchorendnode)$)
25114 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!90 : (pgfcirc@anchorstartnode)$)
25115 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
25116 % move parallel to the component line
25117 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
25118 % and add the extra distance
25119 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@top) ! \absvshift!90 : (pgfcirc@Vdir0)$)
25120 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
25121 \ifpgf@circuit@bipole@voltage@raised
25122 % move the from and to up to the level of Vlab
25123 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
25124 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
25125 \fi
25126 \fi
25127 \fi
25128 \ifx\@@kind\@@open
25129 coordinate (\pgfcirc@a@prefix-Vto) at (pgfcirc@Vto@flat)
25130 coordinate (\pgfcirc@a@prefix-Vfrom) at (pgfcirc@Vfrom@flat)
25131 \fi
25132 \ifpgf@circ@debugv
25133 node [ocirc, fill=red] at (pgfcirc@anchorstartnode) {}
25134 node [ocirc, fill=blue] at (pgfcirc@anchorendnode) {}
25135 node [ocirc, fill=green] at (\pgfcirc@a@prefix-Vto) {}
25136 node [ocirc, fill=yellow] at (\pgfcirc@a@prefix-Vfrom) {}
25137 node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {}
25138 node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {}
25139 \ifpgf@circuit@europeanvoltage
25140 \ifpgf@circuit@bipole@voltage@straight
25141 \else
25142 node [osquarepole, fill=red] at (\pgfcirc@a@prefix-Vcont1) {}
25143 node [osquarepole, fill=blue] at (\pgfcirc@a@prefix-Vcont2) {}
25144 \fi
25145 \fi
25146 \fi
25147
25148 %
25149 % Now we draw the voltage things (only if not empty --- in which case we have been
25150 % called just to set the anchors)
25151 %
25152 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
25153 \ifpgfcirc@do@v@symbols
25154 \ifpgf@circuit@europeanvoltage
25155 \ifpgf@circuit@bipole@voltage@straight
25156 \ifpgf@circuit@bipole@voltage@backward
25157 (\pgfcirc@a@prefix-Vto) --(\pgfcirc@a@prefix-Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
25158 \else
25159 (\pgfcirc@a@prefix-Vfrom) --(\pgfcirc@a@prefix-Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
25160 \fi
25161 \else
25162 \ifpgf@circuit@bipole@voltage@backward
25163 (\pgfcirc@a@prefix-Vto) .. controls (\pgfcirc@a@prefix-Vcont2) and (\pgfcirc@a@prefix-Vcont1) ..
25164 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
25165 (\pgfcirc@a@prefix-Vfrom)
25166 \else
25167 (\pgfcirc@a@prefix-Vfrom) .. controls (\pgfcirc@a@prefix-Vcont1) and (\pgfcirc@a@prefix-Vcont2) ..
25168 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
25169 (\pgfcirc@a@prefix-Vto)
25170 \fi
25171 \fi
25172 \else % american
25173 \ifpgf@circuit@bipole@voltage@backward
25174 \ifpgf@circ@oldvoltagedirection
25175 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
25176 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
25177 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
25178 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
25179 \else
25180 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
25181 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
25182 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
25183 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
25184 \fi
25185 \else
25186 \ifpgf@circ@oldvoltagedirection
25187 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
25188 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
25189 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
25190 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
25191 \else
25192 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
25193 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
25194 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
25195 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
25196 \fi
25197 \fi
25198 \fi
25199 \fi % closing the ...symbol
25200 \fi % Closing the ...ifempty
25201 }
25202 % %>>>
25203
25204 %% Output routine for voltage sources%<<<
25205 \def\pgf@circ@drawvoltagegenerator{
25206 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
25207 % it's not perfect, but I can't find the way to do it correctly...
25208 \pgfextra{
25209 \edef\shiftv{\ctikzvalof{voltage/shift}}
25210 % distance along the 60-120 axis
25211 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}
25212 \pgfkeysifdefined{\pgf@temp}
25213 {
25214 \edef\bumpa{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}}
25215 }
25216 {
25217 \edef\bumpa{\ctikzvalof{voltage/bump a}}
25218 }
25219 % additional per-bipole voltage shift (internal)
25220 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
25221 \pgfkeysifdefined{\pgf@temp}
25222 {
25223 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
25224 }
25225 {
25226 \edef\addvshift{0}
25227 }
25228 \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
25229 }
25230 \ifpgf@circuit@bipole@voltage@below
25231 coordinate (pgfcirc@Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
25232 coordinate (pgfcirc@Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
25233 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! -90: (pgfcirc@Vto0) $)
25234 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! 90: (pgfcirc@Vfrom0) $)
25235 \else
25236 coordinate (pgfcirc@Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
25237 coordinate (pgfcirc@Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
25238 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! 90: (pgfcirc@Vto0) $)
25239 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! -90: (pgfcirc@Vfrom0) $)
25240 \fi
25241 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
25242 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
25243 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
25244 \ifpgfcirc@do@v@symbols
25245 \ifpgf@circuit@europeanvoltage
25246 \ifpgf@circuit@bipole@voltage@backward
25247 (\pgfcirc@a@prefix-Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vfrom)
25248 \else
25249 (\pgfcirc@a@prefix-Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vto)
25250 \fi
25251 \else% american voltage
25252 \ifpgf@circuit@bipole@voltageoutsideofsymbol
25253 % if it is a battery, must put + and -
25254
25255 \ifpgf@circ@fixbatteries
25256 \ifpgf@circuit@bipole@voltage@backward
25257 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
25258 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
25259 \else
25260 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
25261 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
25262 \fi
25263 \else
25264 \ifpgf@circuit@bipole@voltage@backward
25265 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
25266 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
25267 \else
25268 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
25269 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
25270 \fi
25271 \fi
25272 \fi
25273 \fi
25274 \fi % closes ... ifsymbol
25275 \fi % closes ...ifempty
25276 }
25277 % %>>>
25278
25279 %% Output routine (main entry point) %<<<
25280 %% this is the entry point
25281 %%
25282 %% locally used dimensions
25283 \newdimen{\pgfcirc@labelshift}
25284 \newif\ifpgfcirc@v@curved % helper if --- true only if voltages are curved
25285 \def\pgf@circ@drawvoltage{% node name
25286 \pgfextra{%
25287 % set the helper if...curved
25288 \ifpgf@circuit@europeanvoltage
25289 \ifpgf@circuit@bipole@voltage@straight
25290 \pgfcirc@v@curvedfalse
25291 \else
25292 \pgfcirc@v@curvedtrue
25293 \fi
25294 \else
25295 \pgfcirc@v@curvedfalse
25296 \fi
25297 % \typeout{V routine called with prefix: \pgfcirc@a@prefix}
25298 % Label anchors WARNING: indentation is probably wrong
25299 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
25300 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
25301 \ifpgf@circuit@bipole@voltage@below
25302 \def\pgf@circ@bipole@voltage@label@anchor{north west}
25303 \else
25304 \def\pgf@circ@bipole@voltage@label@anchor{south east}
25305 \fi
25306 \fi\fi
25307 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
25308 \ifpgf@circuit@bipole@voltage@below
25309 \def\pgf@circ@bipole@voltage@label@anchor{west}
25310 \else
25311 \def\pgf@circ@bipole@voltage@label@anchor{east}
25312 \fi
25313 \fi\fi
25314 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
25315 \ifpgf@circuit@bipole@voltage@below
25316 \def\pgf@circ@bipole@voltage@label@anchor{south west}
25317 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
25318 \fi
25319 \fi\fi
25320 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
25321 \ifpgf@circuit@bipole@voltage@below
25322 \def\pgf@circ@bipole@voltage@label@anchor{south}
25323 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
25324 \fi
25325 \fi\fi
25326 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
25327 \ifpgf@circuit@bipole@voltage@below
25328 \def\pgf@circ@bipole@voltage@label@anchor{south east}
25329 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
25330 \fi
25331 \fi\fi
25332 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
25333 \ifpgf@circuit@bipole@voltage@below
25334 \def\pgf@circ@bipole@voltage@label@anchor{east}
25335 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
25336 \fi
25337 \fi\fi
25338 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
25339 \ifpgf@circuit@bipole@voltage@below
25340 \def\pgf@circ@bipole@voltage@label@anchor{north east}
25341 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
25342 \fi
25343 \fi\fi
25344 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
25345 \ifpgf@circuit@bipole@voltage@below
25346 \def\pgf@circ@bipole@voltage@label@anchor{north}
25347 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
25348 \fi
25349 \fi\fi
25350 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
25351 \ifpgf@circuit@bipole@voltage@below
25352 \def\pgf@circ@bipole@voltage@label@anchor{north}
25353 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
25354 \fi
25355 \fi\fi
25356
25357 % export anchor position (if not needed, is always the same macro)
25358 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor}
25359 % this must be set *before* changing for mirroring and inverting; in that case
25360 % the xscale/yscale parameters take it into account
25361 \ifpgf@circuit@bipole@voltage@below
25362 \def\pgf@circ@bipole@voltage@label@where{-90}
25363 \else
25364 \def\pgf@circ@bipole@voltage@label@where{90}
25365 \fi
25366
25367 % magic to counteract the scale and yscale effects (there should be a better way...)
25368 \ifnum \ctikzvalof{mirror value}=-1
25369 \ifpgf@circuit@bipole@voltage@below
25370 \pgf@circuit@bipole@voltage@belowfalse
25371 \else
25372 \pgf@circuit@bipole@voltage@belowtrue
25373 \fi
25374 \fi
25375
25376 \ifpgf@circuit@bipole@inverted
25377 \ifpgf@circuit@bipole@voltage@below
25378 \pgf@circuit@bipole@voltage@belowfalse
25379 \else
25380 \pgf@circuit@bipole@voltage@belowtrue
25381 \fi
25382 \fi
25383
25384 % take into account scaling
25385 \setscaledRlenforclass
25386 % set the macro for detecting open
25387 \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
25388 % start voltage label adjustment
25389 \ifpgf@circuit@europeanvoltage
25390 \ifpgf@circuit@bipole@voltage@straight
25391 % check for straight
25392 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
25393 \pgfkeysifdefined{\pgf@temp}{%
25394 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}%
25395 % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist}
25396 }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}}
25397 \ifpgf@circ@debugv\edef\whichtypeshift{STR}\fi
25398 % do not labelshift for legacy straight open; 1.4 makes the shift null
25399 \ifx\@@kind\@@open\ifpgf@adjust@open@voltage\else\edef\labeldist{1.4}\fi\fi
25400 \else
25401 % check for european
25402 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
25403 \pgfkeysifdefined{\pgf@temp}{%
25404 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}%
25405 % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist}
25406 }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}}
25407 \ifpgf@circ@debugv\edef\whichtypeshift{EUR}\fi
25408 \fi
25409 \else
25410 % check for american
25411 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}
25412 \pgfkeysifdefined{\pgf@temp}{%
25413 \ifpgf@circuit@bipole@voltage@raised
25414 % do not apply the shift if we are using raised american style
25415 \edef\labeldist{1.4}% default value
25416 \else
25417 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
25418 \fi
25419 % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist}
25420 }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}}
25421 \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi
25422 \fi
25423 % find the height of the bipole or use a default value
25424 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
25425 \pgfkeysifdefined{\pgf@temp}
25426 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
25427 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
25428 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
25429 \ifpgf@circuit@bipole@isvoltage
25430 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.2)*\partheight}
25431 \else
25432 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.4)*\partheight}
25433 \fi
25434 % the value for the european was by default 1.4
25435 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
25436 % stop the detection of open if I do not want special treatment
25437 \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi
25438 % \typeout{KIND\space\@@kind}
25439 }%end pgfextra
25440
25441 \ifpgf@circuit@bipole@isvoltage
25442 \pgf@circ@drawvoltagegenerator
25443 % add fake cont1 and cont2 anchors for export
25444 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
25445 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
25446 \else
25447 \pgf@circ@drawvoltagegeneric
25448 \fi
25449 % % debugging
25450 % \pgfextra{%
25451 % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc@eushift\space AL:\the\pgfcirc@alshift\space
25452 % DIRECTION:\pgf@circ@bipole@voltage@label@where}
25453 % \pgf@circ@debugvtrue}
25454
25455 % move a bit if requested
25456 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$)
25457
25458 % check for the case of american AND open
25459 \ifpgf@circuit@europeanvoltage
25460 \else
25461 \ifx\@@kind\@@open
25462 % override pgfcirc@Vlab
25463 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
25464 \fi
25465 \fi
25466
25467 \ifpgf@circ@debugv
25468 node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {}
25469 node [odiamondpole, color=red] at (pgfcirc@Vdir) {}
25470 node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir)
25471 {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where}
25472 \fi
25473
25474 % put the node only if it's not empty
25475 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
25476 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
25477 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
25478 at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}}
25479 \fi
25480
25481 \ifpgfcirc@v@curved\else
25482 % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom
25483 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
25484 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
25485 \fi
25486 % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...)
25487 \ifpgf@circuit@bipole@voltage@backward
25488 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto}
25489 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2}
25490 \fi
25491
25492 }%end drawvoltages
25493
25494 % %>>>
25495
25496 %% these should be arguably moved to every component definition...
25497
25498 % special cases for voltage positions%<<<1
25499 % the KIND is the node name without SHAPE
25500 % See the definition above for meaning
25501 % if bipoles/KIND/voltage/straight label distance is not defined, it uses the height
25502 % if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance)
25503 %
25504 \ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4}
25505 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
25506 %
25507 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
25508 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
25509 %
25510 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
25511 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
25512 %
25513 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
25514 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
25515 %
25516 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
25517 %
25518 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
25519 \ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8}
25520 %
25521 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6}
25522 %
25523 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
25524 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8}
25525 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
25526 \ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8}
25527 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
25528 \ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8}
25529 %
25530 \ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2}
25531 %
25532 \ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5}
25533 \ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0}
25534 \ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5}
25535 \ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0}
25536 \ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0}
25537 \ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2}
25538 \ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0}
25539 \ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2}
25540 \ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8}
25541 \ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8}
25542 \ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8}
25543 \ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8}
25544 %
25545 \ctikzset{bipoles/short/voltage/american label distance/.initial=2.8}
25546 \ctikzset{bipoles/open/voltage/distance from node/.initial=0.3}
25547 %
25548 \ctikzset{bipoles/battery/voltage/bump a/.initial=1.4}
25549 \ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2}
25550 \ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2}
25551 %%>>>
25552
25553 % vim: set fdm=marker fmr=%<<<,%>>>:
25554 %%%---------- close: tex/pgfcircvoltage
25555 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
25556 %%%---------- open: tex/pgfcirccurrent.tex
25557 % Copyright 2018-2026 by Romano Giannetti
25558 % Copyright 2015-2026 by Stefan Lindner
25559 % Copyright 2013-2026 by Stefan Erhardt
25560 % Copyright 2007-2026 by Massimo Redaelli
25561 %
25562 % This file may be distributed and/or modified
25563 %
25564 % 1. under the LaTeX Project Public License and/or
25565 % 2. under the GNU Public License.
25566 %
25567 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
25568
25569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25570 %% Current handling
25571
25572 %% styles
25573 \ctikzset{bipole current style/.style={}}
25574 \tikzset{bipole current style/.code={
25575 \ctikzset{bipole current style/.style={#1}}
25576 }}
25577 \tikzset{bipole current append style/.code={
25578 \ctikzset{bipole current style/.append style={#1}}
25579 }}
25580
25581 %% Options
25582 \ctikzset{i^>/.style = {
25583 i={#1},
25584 \circuitikzbasekey/bipole/current/direction = forward,
25585 \circuitikzbasekey/bipole/current/x position = after,
25586 \circuitikzbasekey/bipole/current/y position = above
25587 }
25588 }
25589
25590 \ctikzset{i_>/.style = {
25591 i={#1},
25592 \circuitikzbasekey/bipole/current/direction = forward,
25593 \circuitikzbasekey/bipole/current/x position = after,
25594 \circuitikzbasekey/bipole/current/y position = below
25595 }
25596 }
25597
25598 \ctikzset{i>^/.style = {
25599 i={#1},
25600 \circuitikzbasekey/bipole/current/direction = forward,
25601 \circuitikzbasekey/bipole/current/x position = before,
25602 \circuitikzbasekey/bipole/current/y position = above
25603 }
25604 }
25605
25606 \ctikzset{i>_/.style = {
25607 i={#1},
25608 \circuitikzbasekey/bipole/current/direction = forward,
25609 \circuitikzbasekey/bipole/current/x position = before,
25610 \circuitikzbasekey/bipole/current/y position = below
25611 }
25612 }
25613
25614 \ctikzset{i^</.style = {
25615 i={#1},
25616 \circuitikzbasekey/bipole/current/direction = backward,
25617 \circuitikzbasekey/bipole/current/x position = after,
25618 \circuitikzbasekey/bipole/current/y position = above
25619 }
25620 }
25621
25622 \ctikzset{i_</.style = {
25623 i={#1},
25624 \circuitikzbasekey/bipole/current/direction = backward,
25625 \circuitikzbasekey/bipole/current/x position = after,
25626 \circuitikzbasekey/bipole/current/y position = below
25627 }
25628 }
25629
25630 \ctikzset{i<^/.style = {
25631 i={#1},
25632 \circuitikzbasekey/bipole/current/direction = backward,
25633 \circuitikzbasekey/bipole/current/x position = before,
25634 \circuitikzbasekey/bipole/current/y position = above
25635 }
25636 }
25637
25638 \ctikzset{i<_/.style = {
25639 i={#1},
25640 \circuitikzbasekey/bipole/current/direction = backward,
25641 \circuitikzbasekey/bipole/current/x position = before,
25642 \circuitikzbasekey/bipole/current/y position = below
25643 }
25644 }
25645
25646 \newif\ifpgfcirc@do@i@symbols\pgfcirc@do@i@symbolstrue
25647 \ctikzset{no i symbols/.code={\pgfcirc@do@i@symbolsfalse}}
25648 \ctikzset{i symbols/.code={\pgfcirc@do@i@symbolstrue}}
25649
25650 \ctikzset{i/.code = {
25651 \pgfcirc@has@itrue
25652 \ifpgf@circuit@bipole@override@source@vif
25653 \pgf@circuit@bipole@isvoltagefalse
25654 \pgf@circuit@bipole@iscurrentfalse
25655 \fi
25656 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
25657 \circuitikzbasekey/bipole/current/x position = after,
25658 \circuitikzbasekey/bipole/current/y position = above }
25659 \pgfkeys{/tikz/circuitikz/bipole/current/label/name={#1}}
25660 \ctikzsetvalof{bipole/current/label/unit}{}
25661 \ifpgf@circ@siunitx
25662 \pgf@circ@handleSI{#1}
25663 \ifpgf@circ@siunitx@res
25664 \edef\pgf@temp{\pgf@circ@handleSI@val}
25665 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
25666 \edef\pgf@temp{\pgf@circ@handleSI@unit}
25667 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
25668 \else
25669 \fi
25670 \else
25671 \fi
25672 %reverse current direction for voltage sources
25673 \ifpgf@circ@oldvoltagedirection\else
25674 \ifpgf@circuit@bipole@isvoltage
25675 \ifpgf@circuit@bipole@voltage@backward
25676 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
25677 \circuitikzbasekey/bipole/current/x position = after,
25678 \circuitikzbasekey/bipole/current/y position = below }
25679 \else
25680 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
25681 \circuitikzbasekey/bipole/current/x position = before,
25682 \circuitikzbasekey/bipole/current/y position = above }
25683 \fi\fi\fi
25684 }
25685 }
25686
25687 \ifpgf@circ@oldvoltagedirection
25688 \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward } }
25689 \else
25690 \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
25691 \fi
25692 \ctikzset{i_/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = below } }
25693 \ctikzset{i>/.style = {i={#1}, \circuitikzbasekey/bipole/current/direction = forward } }
25694 \ctikzset{i^/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = above } }
25695
25696 %% Output routine
25697 \def\pgf@circ@drawcurrent{
25698 \pgfextra{
25699 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
25700 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
25701
25702 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
25703 \ifpgf@circuit@bipole@current@below
25704 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
25705 \fi
25706 \fi\fi
25707 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
25708 \ifpgf@circuit@bipole@current@below
25709 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
25710 \fi
25711 \fi\fi
25712 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
25713 \ifpgf@circuit@bipole@current@below
25714 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
25715 \fi
25716 \fi\fi
25717 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
25718 \ifpgf@circuit@bipole@current@below
25719 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
25720 \fi
25721 \fi\fi
25722 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
25723 \ifpgf@circuit@bipole@current@below
25724 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
25725 \fi
25726 \fi\fi
25727 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
25728 \ifpgf@circuit@bipole@current@below
25729 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
25730 \fi
25731 \fi\fi
25732 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
25733 \ifpgf@circuit@bipole@current@below
25734 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
25735 \fi
25736 \fi\fi
25737 \ifnum\pgfcircmathresult <5
25738 \ifpgf@circuit@bipole@current@below
25739 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
25740 \fi
25741 \fi
25742 \ifnum\pgfcircmathresult >355
25743 \ifpgf@circuit@bipole@current@below
25744 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
25745 \fi
25746 \fi
25747 % export anchor position (if not needed, is always the same macro)
25748 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir}
25749
25750 \ifpgf@circuit@bipole@current@below
25751 \def\pgf@circ@bipole@current@label@where{-90}
25752 \else
25753 \def\pgf@circ@bipole@current@label@where{+90}
25754 \fi
25755 }
25756
25757 %
25758 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
25759 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
25760 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
25761 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
25762 \else% normal bipole or source
25763 \ifpgf@circuit@bipole@current@before
25764 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
25765 coordinate (\pgfcirc@a@prefix-Ito) at (pgfcirc@anchorstartnode)
25766 \else
25767 coordinate (\pgfcirc@a@prefix-Ifrom) at (pgfcirc@anchorendnode)
25768 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
25769 \fi
25770 \fi
25771 \ifpgf@circuit@bipole@current@backward
25772 \pgfextra{
25773 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
25774 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
25775 }
25776 \fi
25777 coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$)
25778 % export the current direction
25779 \pgfextra{\expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Iarrow-direction\endcsname{\pgf@circ@rounded@dir}}
25780 % if the current label is not empty (in which case we have already all the anchors)
25781 \pgf@circ@ifkeyempty{bipole/current/label/name}\else
25782 % put the arrow node
25783 % if we do not want the arrow, just put an empty node (needed to maintain the exact same distances)
25784 \ifpgfcirc@do@i@symbols
25785 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
25786 \else
25787 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center,
25788 circuitikz/phantom@currarrow](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
25789 \fi
25790 % put the label
25791 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
25792 (\ctikzvalof{bipole/name}current)
25793 at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}}
25794 \fi % end ifempty
25795 \ifpgf@circuit@bipole@current@backward
25796 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito}
25797 \fi
25798 }
25799
25800 %%%---------- close: tex/pgfcirccurrent
25801 %%%%%%%%%%% Springe nach tex/pgfcircflow
25802 %%%---------- open: tex/pgfcircflow.tex
25803 % Copyright 2018-2026 by Romano Giannetti
25804 % Copyright 2015-2026 by Stefan Lindner
25805 % Copyright 2013-2026 by Stefan Erhardt
25806 % Copyright 2007-2026 by Massimo Redaelli
25807 %
25808 % This file may be distributed and/or modified
25809 %
25810 % 1. under the LaTeX Project Public License and/or
25811 % 2. under the GNU Public License.
25812 %
25813 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
25814
25815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25816 %% flow handling
25817
25818
25819 %% styles
25820 \ctikzset{bipole flow style/.style={}}
25821 \tikzset{bipole flow style/.code={
25822 \ctikzset{bipole flow style/.style={#1}}
25823 }}
25824 \tikzset{bipole flow append style/.code={
25825 \ctikzset{bipole flow style/.append style={#1}}
25826 }}
25827
25828 %% Options
25829 \ctikzset{f^>/.style = {
25830 f={#1},
25831 \circuitikzbasekey/bipole/flow/direction = forward,
25832 \circuitikzbasekey/bipole/flow/x position = after,
25833 \circuitikzbasekey/bipole/flow/y position = above
25834 }
25835 }
25836
25837 \ctikzset{f_>/.style = {
25838 f={#1},
25839 \circuitikzbasekey/bipole/flow/direction = forward,
25840 \circuitikzbasekey/bipole/flow/x position = after,
25841 \circuitikzbasekey/bipole/flow/y position = below
25842 }
25843 }
25844
25845 \ctikzset{f>^/.style = {
25846 f={#1},
25847 \circuitikzbasekey/bipole/flow/direction = forward,
25848 \circuitikzbasekey/bipole/flow/x position = before,
25849 \circuitikzbasekey/bipole/flow/y position = above
25850 }
25851 }
25852
25853 \ctikzset{f>_/.style = {
25854 f={#1},
25855 \circuitikzbasekey/bipole/flow/direction = forward,
25856 \circuitikzbasekey/bipole/flow/x position = before,
25857 \circuitikzbasekey/bipole/flow/y position = below
25858 }
25859 }
25860
25861 \ctikzset{f^</.style = {
25862 f={#1},
25863 \circuitikzbasekey/bipole/flow/direction = backward,
25864 \circuitikzbasekey/bipole/flow/x position = after,
25865 \circuitikzbasekey/bipole/flow/y position = above
25866 }
25867 }
25868
25869 \ctikzset{f_</.style = {
25870 f={#1},
25871 \circuitikzbasekey/bipole/flow/direction = backward,
25872 \circuitikzbasekey/bipole/flow/x position = after,
25873 \circuitikzbasekey/bipole/flow/y position = below
25874 }
25875 }
25876
25877 \ctikzset{f<^/.style = {
25878 f={#1},
25879 \circuitikzbasekey/bipole/flow/direction = backward,
25880 \circuitikzbasekey/bipole/flow/x position = before,
25881 \circuitikzbasekey/bipole/flow/y position = above
25882 }
25883 }
25884
25885 \ctikzset{f<_/.style = {
25886 f={#1},
25887 \circuitikzbasekey/bipole/flow/direction = backward,
25888 \circuitikzbasekey/bipole/flow/x position = before,
25889 \circuitikzbasekey/bipole/flow/y position = below
25890 }
25891 }
25892
25893 \ctikzset{f</.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = backward} }
25894 \ctikzset{f_/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = below } }
25895 \ctikzset{f>/.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = forward } }
25896 \ctikzset{f^/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = above } }
25897
25898 \newif\ifpgfcirc@do@f@symbols\pgfcirc@do@f@symbolstrue
25899 \ctikzset{no f symbols/.code={\pgfcirc@do@f@symbolsfalse}}
25900 \ctikzset{f symbols/.code={\pgfcirc@do@f@symbolstrue}}
25901
25902 \ctikzset{f/.code = {
25903 \pgfcirc@has@ftrue
25904 \ifpgf@circuit@bipole@override@source@vif
25905 \pgf@circuit@bipole@isvoltagefalse
25906 \pgf@circuit@bipole@iscurrentfalse
25907 \fi
25908 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
25909 \circuitikzbasekey/bipole/flow/x position = after,
25910 \circuitikzbasekey/bipole/flow/y position = above }
25911 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name={#1}}
25912 \ctikzsetvalof{bipole/flow/label/unit}{}
25913 \ifpgf@circ@siunitx
25914 \pgf@circ@handleSI{#1}
25915 \ifpgf@circ@siunitx@res
25916 \edef\pgf@temp{\pgf@circ@handleSI@val}
25917 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
25918 \edef\pgf@temp{\pgf@circ@handleSI@unit}
25919 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
25920 \else
25921 \fi
25922 \else
25923 \fi
25924 }
25925 }
25926
25927 %% Output routine
25928
25929 \def\pgf@circ@drawflow{
25930 \pgfextra{
25931 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
25932 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
25933
25934 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
25935 \ifpgf@circuit@bipole@flow@below
25936 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
25937 \fi
25938 \fi\fi
25939 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
25940 \ifpgf@circuit@bipole@flow@below
25941 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
25942 \fi
25943 \fi\fi
25944 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
25945 \ifpgf@circuit@bipole@flow@below
25946 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
25947 \fi
25948 \fi\fi
25949 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
25950 \ifpgf@circuit@bipole@flow@below
25951 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
25952 \fi
25953 \fi\fi
25954 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
25955 \ifpgf@circuit@bipole@flow@below
25956 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
25957 \fi
25958 \fi\fi
25959 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
25960 \ifpgf@circuit@bipole@flow@below
25961 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
25962 \fi
25963 \fi\fi
25964 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
25965 \ifpgf@circuit@bipole@flow@below
25966 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
25967 \fi
25968 \fi\fi
25969 \ifnum\pgfcircmathresult <5
25970 \ifpgf@circuit@bipole@flow@below
25971 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
25972 \fi
25973 \fi
25974 \ifnum\pgfcircmathresult >355
25975 \ifpgf@circuit@bipole@flow@below
25976 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
25977 \fi
25978 \fi
25979
25980 \ifpgf@circuit@bipole@flow@below
25981 \def\pgf@circ@bipole@flow@label@where{-90}
25982 \else
25983 \def\pgf@circ@bipole@flow@label@where{+90}
25984 \fi
25985 % export anchor position (if not needed, is always the same macro)
25986 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir}
25987 }
25988
25989 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
25990 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
25991 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
25992 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
25993 \else% normal bipole or source
25994 \ifpgf@circuit@bipole@flow@before
25995 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
25996 coordinate (pgfcirc@Fto@flat) at (pgfcirc@anchorstartnode)
25997 \else
25998 coordinate (pgfcirc@Ffrom@flat) at (pgfcirc@anchorendnode)
25999 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
26000 \fi
26001 \fi
26002 \pgfextra{
26003 \newdimen{\absfshift}
26004 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
26005 \absfshift=\flow@offset
26006 \ifpgf@circuit@bipole@flow@backward
26007 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
26008 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26009 \fi
26010 }
26011 \ifpgf@circuit@bipole@flow@below
26012 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$)
26013 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$)
26014 \else
26015 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$)
26016 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$)
26017 \fi
26018 coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$)
26019 \pgfextra{
26020 \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape!
26021 }
26022 coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$)
26023 coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $)
26024 %
26025 % coordinate (\pgfcirc@a@prefix-Fpos) at
26026 % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$)
26027 % export the flow direction
26028 \pgfextra{\expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Farrow-direction\endcsname{\pgf@circ@rounded@dir}}
26029 % if the flow label is not empty (in which case we have already all the anchors)
26030 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else
26031 % the flow arrow is really a node "flowarrow", not a real arrow
26032 \ifpgfcirc@do@f@symbols
26033 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
26034 \else
26035 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center,
26036 circuitikz/phantom@flowarrow](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
26037 \fi
26038 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
26039 (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}}
26040 \fi
26041 % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above
26042 \ifpgf@circuit@bipole@flow@backward
26043 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto}
26044 \fi
26045
26046 }
26047
26048 %%%---------- close: tex/pgfcircflow
26049
26050 % defaults
26051
26052 \setupmodule
26053 [current=european,
26054 voltage=european,
26055 resistor=american,
26056 inductor=cute,
26057 logic=american,
26058 siunitx=true,
26059 arrowmos=false]
26060
26061 \processaction
26062 [\currentmoduleparameter{voltage}]
26063 [european=>\ctikzset{voltage=european},
26064 american=>\ctikzset{voltage=american}]
26065
26066 \processaction
26067 [\currentmoduleparameter{current}]
26068 [european=>\ctikzset{ current=european},
26069 american=>\ctikzset{ current=american}]
26070
26071 \processaction
26072 [\currentmoduleparameter{label}]
26073 [straight=>\ctikzset{label/align = straight},
26074 align=>\ctikzset{label/align = rotate},
26075 smart=>\ctikzset{label/align = smart}]
26076
26077 \processaction
26078 [\currentmoduleparameter{resistor}]
26079 [european=>\ctikzset{ resistor=european},
26080 american=>\ctikzset{ resistor=american}]
26081
26082 \processaction
26083 [\currentmoduleparameter{inductor}]
26084 [european=>\ctikzset{ inductor=european},
26085 american=>\ctikzset{ inductor=american},
26086 cute=>\ctikzset{ inductor=cute}]
26087
26088 \processaction
26089 [\currentmoduleparameter{diode}]
26090 [full=>\ctikzset{ diode=full},
26091 empty=>\ctikzset{ diode=empty}]
26092
26093 \processaction
26094 [\currentmoduleparameter{logic}]
26095 [european=>\ctikzset{ logic ports=european},
26096 american=>\ctikzset{ logic ports=american}]
26097
26098 \processaction
26099 [\currentmoduleparameter{siunitx}]
26100 [true=>\def\SI#1#2{#1\,#2}
26101 \def\ampere{\rm{A}}
26102 \def\volt{\rm{V}}
26103 \def\ohm{\Omega}
26104 \def\siemens{\rm{S}}
26105 \def\farad{\rm{F}}
26106 \def\henry{\rm{H}}
26107 \def\second{\rm{s}}
26108 \def\coulomb{\rm{C}}
26109 \def\siemens{\rm{S}}
26110 \def\radians{\rm{rad}}
26111 \def\milli{\rm{m}}
26112 \def\micro{\mu}
26113 \def\nano{\rm{n}}
26114 \def\pico{\rm{p}}
26115 \def\kilo{\rm{k}}
26116 \def\mega{\rm{M}}
26117 \def\giga{\rm{G}}
26118 \def\tera{\rm{T}},
26119 false=>]
26120 % \s!default=>\pgf@circ@siunitxtrue,
26121
26122 \processaction
26123 [\currentmoduleparameter{arrowmos}]
26124 [true=>\pgf@circuit@mos@arrowstrue,
26125 false=>\pgf@circuit@mos@arrowsfalse]
26126 % \s!default=>\pgf@circuit@mos@arrowstrue,
26127
26128
26129 \ifpgf@circ@siunitx
26130 % nothing! siunitx and xstrings don't work in context
26131 \fi
26132
26133
26134 % Context specific
26135
26136 \ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}
26137
26138
26139 \catcode`\@=\tikzatcode
26140 \catcode`\|=\tikzbarcode
26141 \catcode`\!=\tikzexclaimcode
26142
26143 % define the environment
26144 \long\def\startcircuitikz#1\stopcircuitikz{\starttikzpicture#1\stoptikzpicture}
26145
26146 \protect
26147
26148 \stopmodule
26149
26150 \endinput