Debian Codegraph @

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

raw
1 % Copyright 2018-2026 by Romano Giannetti
2 % Copyright 2015-2026 by Stefan Lindner
3 % Copyright 2013-2026 by Stefan Erhardt
4 % Copyright 2007-2026 by Massimo Redaelli
5 %
6 % This file may be distributed and/or modified
7 %
8 % 1. under the LaTeX Project Public License and/or
9 % 2. under the GNU Public License.
10 %
11 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
12
13 \NeedsTeXFormat{LaTeX2e}
14
15 \def\pgfcircversion{1.1.2}
16 \def\pgfcircversiondate{2020/05/17}
17
18 %% Version 3.0 of pgf/TikZ is required
19 \RequirePackage{tikz}
20 \usetikzlibrary{calc}
21 %
22 % "arrows" library is deprecated, and behave badly with
23 % arrows on short paths. Change to the new arrows.meta
24 % In pfgcirc.define, we will add the old definition of
25 % latex' which we have lost in the transition
26 %
27 \usetikzlibrary{arrows.meta, bending}
28 \usetikzlibrary{fpu} % may be needed for use fpu reciprocal (v1.0.1)
29
30 % The options are listed in the manual in this order
31
32 \DeclareOption{europeanvoltage}{
33 \ctikzset{voltage=european}
34 }
35
36 \DeclareOption{straightvoltages}{
37 \pgf@circuit@bipole@voltage@straighttrue
38 }
39
40 \DeclareOption{americanvoltage}{
41 \ctikzset{voltage=american}
42 }
43
44 \DeclareOption{europeancurrent}{
45 \ctikzset{current = european}
46 }
47
48 \DeclareOption{americancurrent}{
49 \ctikzset{current = american}
50 }
51
52
53
54 \DeclareOption{americanresistor}{
55 \ctikzset{resistor = american}
56 }
57
58 \DeclareOption{europeanresistor}{
59 \ctikzset{resistor = european}
60 }
61
62 \DeclareOption{americaninductor}{
63 \ctikzset{inductor = american}
64 }
65
66 \DeclareOption{europeaninductor}{
67 \ctikzset{inductor = european}
68 }
69
70 \DeclareOption{cuteinductor}{
71 \ctikzset{inductor = cute}
72 }
73
74 \DeclareOption{americanport}{
75 \ctikzset{logic ports = american}
76 }
77
78 \DeclareOption{europeanport}{
79 \ctikzset{logic ports = european}
80 }
81
82 \DeclareOption{european}{
83 \ctikzset{voltage=european} \ctikzset{current=european} \ctikzset{inductor=european}
84 \ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european}
85 }
86
87 \DeclareOption{american}{
88 \ctikzset{voltage=american} \ctikzset{current=american} \ctikzset{resistor=american} \ctikzset{inductor=american} \ctikzset{gas filled surge arrester choice = american}
89 \ctikzset{logic ports = american}
90 }
91
92 \DeclareOption{fulldiodes}{
93 \ctikzset{diode = full}
94 }
95
96 \DeclareOption{emptydiodes}{
97 \ctikzset{diode = empty}
98 }
99
100 \DeclareOption{europeanvoltages}{
101 \ctikzset{voltage=european}
102 }
103
104 \DeclareOption{americanvoltages}{
105 \ctikzset{voltage=american}
106 }
107
108 \DeclareOption{europeancurrents}{
109 \ctikzset{current = european}
110 }
111
112 \DeclareOption{americancurrents}{
113 \ctikzset{current = american}
114 }
115
116 \DeclareOption{americanresistors}{
117 \ctikzset{resistor = american}
118 }
119
120 \DeclareOption{europeanresistors}{
121 \ctikzset{resistor = european}
122 }
123
124 \DeclareOption{americaninductors}{
125 \ctikzset{inductor = american}
126 }
127
128 \DeclareOption{europeaninductors}{
129 \ctikzset{inductor = european}
130 }
131
132 \DeclareOption{cuteinductors}{
133 \ctikzset{inductor = cute}
134 }
135
136 \DeclareOption{americanports}{
137 \ctikzset{logic ports = american}
138 }
139
140 \DeclareOption{europeanports}{
141 \ctikzset{logic ports = european}
142 }
143
144 \DeclareOption{americangfsurgearrester}{
145 \ctikzset{gas filled surge arrester choice = american}
146 }
147
148 \DeclareOption{europeangfsurgearrester}{
149 \ctikzset{gas filled surge arrester choice = european}
150 }
151
152 \DeclareOption{siunitx}{
153 \pgf@circ@siunitxtrue
154 }
155
156 \DeclareOption{nosiunitx}{
157 \pgf@circ@siunitxfalse
158 }
159
160 \DeclareOption{fulldiode}{
161 \ctikzset{diode = full}
162 }
163
164 \DeclareOption{emptydiode}{
165 \ctikzset{diode = empty}
166 }
167
168 \DeclareOption{strokediode}{
169 \ctikzset{diode = stroke}
170 }
171
172 \DeclareOption{arrowmos}{
173 \pgf@circuit@mos@arrowstrue
174 }
175
176 \DeclareOption{noarrowmos}{
177 \pgf@circuit@mos@arrowsfalse
178 }
179
180 \DeclareOption{fetbodydiode}{
181 \pgf@circuit@fet@bodydiodetrue
182 }
183
184 \DeclareOption{nofetbodydiode}{
185 \pgf@circuit@fet@bodydiodefalse
186 }
187
188 \DeclareOption{fetsolderdot}{
189 \pgf@circuit@fet@solderdottrue
190 }
191
192 \DeclareOption{nofetsolderdot}{
193 \pgf@circuit@fet@solderdotfalse
194 }
195
196 \DeclareOption{emptypmoscircle}{
197 \pgf@circuit@pmos@emptycircletrue
198 }
199
200
201 \DeclareOption{lazymos}{
202 \ctikzset{tripoles/nmos/width=.5}
203 \ctikzset{tripoles/nmos/gate height=.35}
204 \ctikzset{tripoles/nmos/base height=.35}
205 \ctikzset{tripoles/nmos/height/.initial=1.2}
206 \ctikzset{tripoles/nmos/base width=.5}
207 \ctikzset{tripoles/nmos/gate width=.65}
208
209 \ctikzset{tripoles/pmos/width=.5}
210 \ctikzset{tripoles/pmos/gate height=.35}
211 \ctikzset{tripoles/pmos/base height=.35}
212 \ctikzset{tripoles/pmos/height/.initial=1.2}
213 \ctikzset{tripoles/pmos/base width=.5}
214 \ctikzset{tripoles/pmos/gate width=.65}
215
216 \pgf@circuit@pmos@emptycircletrue
217 }
218
219 \DeclareOption{straightlabels}{
220 \ctikzset{label/align = straight}
221 }
222
223 \DeclareOption{rotatelabels}{
224 \ctikzset{label/align = rotate}
225 }
226
227 \DeclareOption{smartlabels}{
228 \ctikzset{label/align = smart}
229 }
230
231 \DeclareOption{compatibility}{
232 \pgf@circuit@compattrue
233 }
234
235 \DeclareOption{oldvoltagedirection}{
236 \pgf@circ@oldvoltagedirectiontrue
237 \pgf@circ@explicitvdirtrue
238 \pgf@circ@fixbatteriesfalse
239 }
240 \DeclareOption{nooldvoltagedirection}{
241 \pgf@circ@oldvoltagedirectionfalse
242 \pgf@circ@explicitvdirtrue
243 \pgf@circ@fixbatteriesfalse
244 }
245
246 \DeclareOption{RPvoltages}{
247 \pgf@circ@oldvoltagedirectiontrue
248 \pgf@circ@explicitvdirtrue
249 \pgf@circ@fixbatteriestrue
250 }
251 \DeclareOption{EFvoltages}{
252 \pgf@circ@oldvoltagedirectionfalse
253 \pgf@circ@explicitvdirtrue
254 \pgf@circ@fixbatteriestrue
255 }
256
257 \DeclareOption{legacytransistorstext}{
258 \pgf@circuit@transisors@fixlabelsfalse
259 }
260
261 \DeclareOption{nolegacytransistorstext}{
262 \pgf@circuit@transisors@fixlabelstrue
263 }
264
265 \DeclareOption{centertransistorstext}{
266 \pgf@circuit@transisors@fixlabelstrue
267 }
268
269 \DeclareOption{betterproportions}{
270 \ctikzset{monopoles/ground/width/.initial=.15}
271
272 \ctikzset{bipoles/resistor/height/.initial=.23}
273 \ctikzset{bipoles/resistor/width/.initial=.6}
274 \ctikzset{bipoles/capacitor/height/.initial=.4}
275 \ctikzset{bipoles/capacitor/width/.initial=.1}
276 \ctikzset{bipoles/potentiometer/height/.initial=.6}
277 \ctikzset{bipoles/potentiometer/height 2/.initial=.23}
278 \ctikzset{bipoles/potentiometer/width/.initial=.6}
279 \ctikzset{bipoles/photoresistor/height/.initial=.6}
280 \ctikzset{bipoles/photoresistor/height 2/.initial=.23}
281 \ctikzset{bipoles/photoresistor/width/.initial=.6}
282 \ctikzset{bipoles/thermistor/main/.initial=.7}
283 \ctikzset{bipoles/thermistor/height/.initial=.328}%.23/.7
284 \ctikzset{bipoles/thermistor/width/.initial=.6}
285 \ctikzset{bipoles/thermistorntc/width/.initial=.6}
286 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
287 \ctikzset{bipoles/thermistorntc/height/.initial=.328}%.23/.7
288 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.23/.7
289 \ctikzset{bipoles/thermistorptc/width/.initial=.6}
290 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
291 \ctikzset{bipoles/thermistorptc/height/.initial=.328}%.23/.7
292 \ctikzset{bipoles/varistor/main/.initial=.7}
293 \ctikzset{bipoles/varistor/height/.initial=.328}%.23/.7
294 \ctikzset{bipoles/varistor/width/.initial=.6}
295 \ctikzset{bipoles/vresistor/height/.initial=.45}
296 \ctikzset{bipoles/vresistor/width/.initial=.6}
297 \ctikzset{bipoles/generic/height/.initial=.23}
298 \ctikzset{bipoles/generic/width/.initial=.6}
299 \ctikzset{bipoles/generic potentiometer/height/.initial=.6}
300 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.23}
301 \ctikzset{bipoles/generic potentiometer/width/.initial=.6}
302 \ctikzset{bipoles/ageneric/height/.initial=.23}
303 \ctikzset{bipoles/ageneric/width/.initial=.6}
304 \ctikzset{bipoles/memristor/height/.initial=.23}
305 \ctikzset{bipoles/memristor/wave height/.initial=.375}
306 \ctikzset{bipoles/memristor/width/.initial=.60}
307 \ctikzset{bipoles/tgeneric/height/.initial=.525}
308 \ctikzset{bipoles/tgeneric/width/.initial=.6}
309 \ctikzset{bipoles/tfullgeneric/height/.initial=.525}
310 \ctikzset{bipoles/tfullgeneric/width/.initial=.60}
311 \ctikzset{bipoles/fullgeneric/height/.initial=.23}
312 \ctikzset{bipoles/fullgeneric/width/.initial=.6}
313 \ctikzset{bipoles/diode/height/.initial=.3}
314 \ctikzset{bipoles/diode/width/.initial=.25}
315 \ctikzset{bipoles/bidirectionaldiode/height/.initial=.66}
316 \ctikzset{bipoles/bidirectionaldiode/width/.initial=.6}
317 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
318 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
319
320 \ctikzset{tripoles/thyristor/height/.initial=.66}
321 \ctikzset{tripoles/thyristor/height 2/.initial=.3}
322 \ctikzset{tripoles/thyristor/width/.initial=.6}
323 \ctikzset{tripoles/thyristor/diode height/.initial=.3}
324 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
325 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
326
327 \ctikzset{tripoles/triac/height/.initial=.66}
328 \ctikzset{tripoles/triac/width/.initial=.6}
329 \ctikzset{tripoles/triac/diode width left/.initial=.3}
330 \ctikzset{tripoles/triac/diode width right/.initial=.3}
331 }
332
333 % This is a nice hack that prints all the shapes declared
334 % by the package. Very useful for coverage testing and debugging.
335 %
336 % \let\origpgfdeclareshape=\pgfdeclareshape
337 % \def\pgfdeclareshape#1{%
338 % \typeout{SHAPE:\space"#1"}%
339 % \origpgfdeclareshape{#1}
340 % }
341
342
343 %%%%%%%%%
344 %%%%%%%%%%% Springe nach tex/pgfcirc.defines
345 %%%---------- open: tex/pgfcirc.defines.tex
346 % Copyright 2018-2026 by Romano Giannetti
347 % Copyright 2015-2026 by Stefan Lindner
348 % Copyright 2013-2026 by Stefan Erhardt
349 % Copyright 2007-2026 by Massimo Redaelli
350 %
351 % This file may be distributed and/or modified
352 %
353 % 1. under the LaTeX Project Public License and/or
354 % 2. under the GNU Public License.
355 %
356 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
357
358 %
359 %% Key managements
360
361 \long\def\pgf@circ@comment#1{}
362
363 \def\circuitikzbasekey{/tikz/circuitikz}
364
365 \pgfkeys{\circuitikzbasekey/.is family}
366
367 \def\circuitikzset#1{\pgfkeys{\circuitikzbasekey,#1}}
368 \let\ctikzset\circuitikzset
369 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
370 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
371
372 %% Temporary Counters
373
374 \newcount\pgf@circ@count@a
375 \newcount\pgf@circ@count@b
376 \newcount\pgf@circ@count@c
377 %%%%%%%%%%%%
378 %% Dimensions
379
380 % coordinates
381 \newdimen\pgf@circ@res@up
382 \newdimen\pgf@circ@res@down
383 \newdimen\pgf@circ@res@zero
384 \newdimen\pgf@circ@res@left
385 \newdimen\pgf@circ@res@right
386 \newdimen\pgf@circ@res@other
387 \newdimen\pgf@circ@res@step
388 \newdimen\pgf@circ@res@temp
389 % inital thickness
390 \newdimen \pgfstartlinewidth
391
392 % arrow tips, ported over old arrows library (deprecated)
393 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
394 % this was the original definition of latex' tips, renamed to avoid clashes
395 %
396 \pgfarrowsdeclare{latexslim}{latexslim}
397 {
398 \pgfutil@tempdima=0.28pt%
399 \advance\pgfutil@tempdima by.3\pgflinewidth%
400 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
401 \pgfarrowsrightextend{+6\pgfutil@tempdima}
402 }
403 {
404 \pgfutil@tempdima=0.28pt%
405 \advance\pgfutil@tempdima by.3\pgflinewidth%
406 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
407 \pgfpathcurveto
408 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
409 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
410 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
411 \pgfpathcurveto
412 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
413 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
414 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
415 \pgfpathcurveto
416 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
417 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
418 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
419 \pgfpathclose
420 \pgfusepathqfill
421 }
422
423 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
424
425 \def\pgf@circ@setifdefinedfill#1#2{%
426 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
427 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
428 \ifdefined\ctikzclass
429 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
430 {% yes, it's defined
431 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
432 \ifx\@@tmp\@@none % but it's none
433 \pgfusepath{#2}%
434 \else
435 \pgfsetfillcolor{\@@tmp}%
436 \pgfusepath{#1}%
437 \fi
438 }{% the class is defined but the fill key not; use #2
439 \pgfusepath{#2}%
440 }
441 \else
442 \pgfusepath{#2}%
443 \fi
444 }
445
446 %% Macro to fill or draw
447
448 \def\pgf@circ@draworfill{%
449 \ifx\tikz@fillcolor\pgfutil@empty
450 \pgf@circ@setifdefinedfill{draw,fill}{draw}
451 \else
452 \pgfsetfillcolor{\tikz@fillcolor}
453 \pgfusepath{draw, fill}
454 \fi
455 }
456
457 \def\pgf@circ@draworfillandclip{%
458 \ifx\tikz@fillcolor\pgfutil@empty
459 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
460 \pgfusepath{draw, clip}
461 \else
462 \pgfsetfillcolor{\tikz@fillcolor}
463 \pgfusepath{draw, clip, fill}
464 \fi
465 }
466
467 \def\pgf@circ@maybefill{%
468 \ifx\tikz@fillcolor\pgfutil@empty
469 \pgf@circ@setifdefinedfill{fill}{discard}
470 \else
471 \pgfsetfillcolor{\tikz@fillcolor}
472 \pgfusepath{fill}
473 \fi
474 }
475
476 %% Macros for setting linewidth
477 % #1 is the legacy class (bipoles, tripoles) etc
478 % #2 is the reference linewidth
479 \def\pgf@circ@setlinewidth#1#2{%
480 \ifdefined\ctikzclass
481 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
482 {% yes, it's defined
483 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
484 \ifx\@@tmp\@@none % but it's none
485 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
486 \else
487 \pgfsetlinewidth{\@@tmp #2}%
488 \fi
489 }{ % key not defined, do the legacy thing
490 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
491 }% Ok, do nothing
492 \else % no class
493 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
494 \fi
495 }
496 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
497 \ctikzset{none/thickness/.initial=1.0} % do not touch
498
499 %% font changes compatible with plain/LaTeX/ConTeXt
500 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
501
502 \ifpgfutil@format@is@latex
503 \long\def\pgf@circ@font@tiny{\tiny}
504 \long\def\pgf@circ@font@small{\small}
505 \long\def\pgf@circ@font@bold{\textbf}
506 \long\def\pgf@circ@font@boldmath{\boldmath}
507 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
508 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
509 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
510 \else\ifpgfutil@format@is@plain
511 \long\def\pgf@circ@font@tiny{\fiverm}
512 \long\def\pgf@circ@font@small{\sevenrm}
513 \long\def\pgf@circ@font@bold#1{{\bf#1}}
514 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
515 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
516 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
517 \long\def\pgf@circ@font@twelve{\twelverm} %
518 \else\ifpgfutil@format@is@context
519 \long\def\pgf@circ@font@tiny{\tfxx}
520 \long\def\pgf@circ@font@small{\tfx}
521 \long\def\pgf@circ@font@bold{\bold}
522 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
523 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
524 \long\def\pgf@circ@font@tenbm{\normal\bold}%
525 \long\def\pgf@circ@font@twelve{\tfa} %
526 \fi\fi\fi
527
528
529 %
530 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
531 %
532 % this is needed to avoid problems with \ConTeXt
533 \ifcsname normalunexpanded\endcsname
534 \let\pgfcircutil@unexpanded\normalunexpanded
535 \else
536 \let\pgfcircutil@unexpanded\unexpanded
537 \fi
538 % minimally expand a pgfkey to check if it's {}/undefined or filled.
539 \def\unexpandedvalueof#1{%
540 \pgfcircutil@unexpanded\expandafter\expandafter
541 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
542 \def\pgf@circ@valueof@chk#1{%
543 \ifx\relax#1%
544 \expandafter\pgfutil@firstoftwo
545 \else
546 \expandafter\pgfutil@secondoftwo
547 \fi
548 {{}}% #1 is \relax, so consider empty
549 {\expandafter{#1}}% otherwise, leave the key after one more expansion
550 }%
551 %
552 % text position (added with ieeestd logic ports. Maybe to be extended to other components,
553 % like amplifiers)
554 %
555 \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
556 \tikzset{component text/.is choice}%
557 \tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
558 \tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
559 \ctikzset{component text/.is choice}%
560 \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
561 \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
562 \ctikzset{left text distance/.initial=0.3em}%
563
564 % voltage options
565
566 \newif\ifpgf@circ@siunitx
567 \newif\ifpgf@circuit@compat
568 \newif\ifpgf@circ@oldvoltagedirection % default false
569 \newif\ifpgf@circ@explicitvdir
570 \newif\ifpgf@circ@fixbatteries
571
572 \ctikzset{voltage dir/.is choice}
573 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
574 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
575 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
576 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
577 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}
578
579 % Option ">" for twoports
580 \newif\ifpgf@circuit@inputarrow
581 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
582 \ctikzset{inputarrow/.is choice}
583 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
584 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
585
586 % Option "boxed" for nodes and twoports
587 \newif\ifpgf@circuit@boxed
588 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue}}
589 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue}}
590 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue}}
591 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue}}
592
593 % Option "dashed" for nodes and twoports
594 \newif\ifpgf@circuit@dashed
595 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
596 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}
597
598 % Option "t=*" for nodes
599 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
600
601 \ctikzset{current arrow scale/.initial=16}
602
603 \ctikzset{bipoles/.is family}
604 \ctikzset{bipoles/border margin/.initial=1.1}
605 \ctikzset{bipoles/thickness/.initial=2}
606 \ctikzset{tripoles/thickness/.initial=2}
607 \ctikzset{quadpoles/thickness/.initial=2}
608 \ctikzset{nodes width/.initial=.04}
609
610 % Base len for all circuitikz
611 \newdimen\pgf@circ@Rlen
612 % scaled length for internal use in scalable shapes
613 \newdimen\pgf@circ@scaled@Rlen
614 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
615 \pgf@circ@Rlen = 1.4cm
616 % by default scale is 1.0
617 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
618
619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
620 %% main style definitions
621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
622
623
624
625 % load a style file: search ctikzstyle-NAME.tex in path
626 \def\ctikzloadstyle#1{%
627 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
628 \tikzerror{I did not find the circuitikz style #1}}%
629 }
630
631 % load and enact a style
632 \def\ctikzsetstyle#1{%
633 \ctikzloadstyle{#1}%
634 \tikzset{#1 circuit style}%
635 }
636
637 % global style parameters
638 \ctikzset{default/scale/.initial=1.0} % do not touch
639 \ctikzset{default/fill/.initial=none} % do not touch
640 \ctikzset{default/thickness/.initial=none} % do not touch
641 % default is use as the generic default style for bipoles
642
643 % mostly bipoles:
644
645 \ctikzset{resistors/scale/.initial=1.0}
646 \ctikzset{resistors/fill/.initial=none}
647 \ctikzset{resistors/thickness/.initial=none}
648
649 \ctikzset{capacitors/scale/.initial=1.0}
650 \ctikzset{capacitors/fill/.initial=none}
651 \ctikzset{capacitors/thickness/.initial=none}
652
653 \ctikzset{inductors/scale/.initial=1.0}
654 \ctikzset{inductors/fill/.initial=none}
655 \ctikzset{inductors/thickness/.initial=none}
656
657 \ctikzset{diodes/scale/.initial=1.0}
658 \ctikzset{diodes/fill/.initial=none}
659 \ctikzset{diodes/thickness/.initial=none}
660
661 \ctikzset{batteries/scale/.initial=1.0}
662 \ctikzset{batteries/fill/.initial=none}
663 \ctikzset{batteries/thickness/.initial=none}
664
665 \ctikzset{sources/scale/.initial=1.0}
666 \ctikzset{sources/fill/.initial=none}
667 \ctikzset{sources/thickness/.initial=none}
668
669 \ctikzset{csources/scale/.initial=1.0}
670 \ctikzset{csources/fill/.initial=none}
671 \ctikzset{csources/thickness/.initial=none}
672
673 \ctikzset{instruments/scale/.initial=1.0}
674 \ctikzset{instruments/fill/.initial=none}
675 \ctikzset{instruments/thickness/.initial=none}
676
677 \ctikzset{mechanicals/scale/.initial=1.0}
678 \ctikzset{mechanicals/fill/.initial=none}
679 \ctikzset{mechanicals/thickness/.initial=none}
680
681 \ctikzset{misc/scale/.initial=1.0}
682 \ctikzset{misc/fill/.initial=none}
683 \ctikzset{misc/thickness/.initial=none}
684
685 \ctikzset{blocks/scale/.initial=1.0}
686 \ctikzset{blocks/fill/.initial=none}
687 \ctikzset{blocks/thickness/.initial=none}
688
689 % mostly nodes
690
691 \ctikzset{grounds/scale/.initial=1.0}
692 \ctikzset{grounds/fill/.initial=none}
693 \ctikzset{grounds/thickness/.initial=none}
694
695 \ctikzset{power supplies/scale/.initial=1.0}
696 \ctikzset{power supplies/fill/.initial=none}
697 \ctikzset{power supplies/thickness/.initial=none}
698
699 \ctikzset{transistors/scale/.initial=1.0}
700 \ctikzset{transistors/fill/.initial=none}
701 \ctikzset{transistors/thickness/.initial=none}
702
703 \ctikzset{tubes/scale/.initial=1.0}
704 \ctikzset{tubes/fill/.initial=none}
705 \ctikzset{tubes/thickness/.initial=none}
706
707 \ctikzset{RF/scale/.initial=1.0}
708 \ctikzset{RF/fill/.initial=none}
709 \ctikzset{RF/thickness/.initial=none}
710
711 \ctikzset{electromechanicals/scale/.initial=1.0}
712 \ctikzset{electromechanicals/fill/.initial=none}
713 \ctikzset{electromechanicals/thickness/.initial=none}
714
715 % transformers go with inductors
716 \ctikzset{amplifiers/scale/.initial=1.0}
717 \ctikzset{amplifiers/fill/.initial=none}
718 \ctikzset{amplifiers/thickness/.initial=none}
719
720 \ctikzset{switches/scale/.initial=1.0}
721 \ctikzset{switches/fill/.initial=none}
722 \ctikzset{switches/thickness/.initial=none}
723
724 \ctikzset{logic ports/scale/.initial=1.0}
725 \ctikzset{logic ports/fill/.initial=none}
726 \ctikzset{logic ports/thickness/.initial=none}
727
728 \ctikzset{flipflops/scale/.initial=1.0}
729 \ctikzset{flipflops/fill/.initial=none}
730 \ctikzset{flipflops/thickness/.initial=none}
731
732 \ctikzset{muxdemuxes/scale/.initial=1.0}
733 \ctikzset{muxdemuxes/fill/.initial=none}
734 \ctikzset{muxdemuxes/thickness/.initial=none}
735
736 \ctikzset{chips/scale/.initial=1.0}
737 \ctikzset{chips/fill/.initial=none}
738 \ctikzset{chips/thickness/.initial=none}
739
740 \ctikzset{displays/scale/.initial=1.0}
741 \ctikzset{displays/fill/.initial=none}
742 \ctikzset{displays/thickness/.initial=none}
743
744 % grounds and power supplies
745
746 \ctikzset{monopoles/.is family}
747 \ctikzset{monopoles/ground/width/.initial=.25}
748 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
749 \ctikzset{monopoles/ground/thickness/.initial=2}
750 \ctikzset{monopoles/rground/thickness/.initial=2}
751 \ctikzset{monopoles/tground/thickness/.initial=3}
752 \ctikzset{monopoles/vcc/width/.initial=.2}
753 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
754 \ctikzset{monopoles/vee/arrow/.initial=legacy}
755 \ctikzset{monopoles/match/width/.initial=.4}
756 \ctikzset{monopoles/chassis/width/.initial=.25}
757 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
758 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
759 \ctikzset{monopoles/antenna/width/.initial=.25}
760 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
761 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
762 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
763 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
764 \ctikzset{monopoles/txantenna/width/.initial=.25}
765 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
766 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
767 \ctikzset{monopoles/rxantenna/width/.initial=.25}
768 \ctikzset{monopoles/bareantenna/width/.initial=.25}
769 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
770 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
771 \ctikzset{monopoles/waves/width/.initial=0.5}
772
773 % microstrips
774 \ctikzset{bipoles/mstline/height/.initial=0.3}
775 \ctikzset{bipoles/mstline/width/.initial=1.2}
776 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
777 \ctikzset{monopoles/msport/width/.initial=.5}
778 \ctikzset{monopoles/msrstub/height/.initial=1.0}
779 \ctikzset{monopoles/msrstub/width/.initial=0.6}
780
781 % microphone and loudspeaker
782 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
783 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
784 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
785 \ctikzset{bipoles/mic/height/.initial=1.2}
786 \ctikzset{bipoles/mic/depth/.initial=.0}
787 \ctikzset{bipoles/mic/width/.initial=.8}
788
789 % Zig Zag resistors
790 \ctikzset{resistors/zigs/.initial=3}
791 \ctikzset{resistors/width/.code={%
792 \ctikzset{bipoles/resistor/width=#1}%
793 \ctikzset{bipoles/vresistor/width=#1}%
794 \ctikzset{bipoles/potentiometer/width=#1}%
795 \ctikzset{bipoles/resistivesens/width=#1}%
796 \ctikzset{bipoles/photoresistor/width=#1}%
797 \ctikzset{bipoles/thermistor/width=#1}%
798 \ctikzset{bipoles/thermistorntc/width=#1}%
799 \ctikzset{bipoles/thermistorptc/width=#1}%
800 \ctikzset{bipoles/varistor/width=#1}%
801 \ctikzset{bipoles/generic/width=#1}%
802 \ctikzset{bipoles/generic potentiometer/width=#1}%
803 \ctikzset{bipoles/ageneric/width=#1}%
804 \ctikzset{bipoles/tgeneric/width=#1}%
805 }}
806 \ctikzset{wiper pos/.code={%
807 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
808 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
809 }}
810 % zigzag resistor
811 \ctikzset{bipoles/resistor/height/.initial=.3}
812 \ctikzset{bipoles/resistor/width/.initial=.8}
813 \ctikzset{bipoles/potentiometer/height/.initial=.8}
814 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
815 \ctikzset{bipoles/potentiometer/width/.initial=.8}
816 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
817 \ctikzset{bipoles/vresistor/height/.initial=.6}
818 \ctikzset{bipoles/vresistor/width/.initial=.8}
819 \ctikzset{bipoles/resistivesens/height/.initial=.6}
820 \ctikzset{bipoles/resistivesens/width/.initial=.8}
821 % square resistors
822 \ctikzset{bipoles/photoresistor/height/.initial=.6}
823 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
824 \ctikzset{bipoles/photoresistor/width/.initial=.8}
825 \ctikzset{bipoles/thermistor/main/.initial=.7}
826 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
827 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
828 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
829 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
830 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
831 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
832 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
833 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
834 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
835 \ctikzset{bipoles/thermistor/width/.initial=.8}
836 \ctikzset{bipoles/varistor/main/.initial=.7}
837 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
838 \ctikzset{bipoles/varistor/width/.initial=.8}
839 \ctikzset{bipoles/generic/height/.initial=.30}
840 \ctikzset{bipoles/generic/width/.initial=.80}
841 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
842 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
843 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
844 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
845 \ctikzset{bipoles/ageneric/height/.initial=.30}
846 \ctikzset{bipoles/tgeneric/height/.initial=.70}
847 \ctikzset{bipoles/tgeneric/width/.initial=.80}
848 \ctikzset{bipoles/ageneric/width/.initial=.80}
849
850 %% Capacitors
851 \ctikzset{bipoles/capacitor/height/.initial=.6}
852 \ctikzset{bipoles/capacitor/width/.initial=.2}
853 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
854 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
855 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
856 %%% pcapacitor is deprecated
857 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
858 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
859 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
860 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
861 \ctikzset{bipoles/ccapacitor/width/.initial=.12}
862 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
863 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
864 \ctikzset{bipoles/vcapacitor/width/.initial=.5}
865 \ctikzset{bipoles/vcapacitor/capacitor width/.initial=.4}
866 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
867 \ctikzset{bipoles/piezoelectric/width/.initial=.5}
868
869 % Inductors
870 \ctikzset{inductors/coils/.code={%
871 \ctikzset{bipoles/cuteinductor/coils=#1}%
872 \ctikzset{bipoles/cutechoke/coils=#1}%
873 \ctikzset{bipoles/americaninductor/coils=#1}%
874 \ctikzset{bipoles/vcuteinductor/coils=#1}%
875 \ctikzset{bipoles/vamericaninductor/coils=#1}%
876 }}
877 \ctikzset{inductors/width/.code={%
878 \ctikzset{bipoles/cuteinductor/width=#1}%
879 \ctikzset{bipoles/cutechoke/width=#1}%
880 \ctikzset{bipoles/americaninductor/width=#1}%
881 \ctikzset{bipoles/vcuteinductor/width=#1}%
882 \ctikzset{bipoles/vamericaninductor/width=#1}%
883 \ctikzset{bipoles/fullgeneric/width=#1}%
884 \ctikzset{bipoles/tfullgeneric/width=#1}%
885 }}
886 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
887 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
888 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
889 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
890 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
891 %% Cute choke settings
892 \ctikzset{bipoles/cutechoke/height/.initial=.3}
893 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
894 \ctikzset{bipoles/cutechoke/width/.initial=.6}
895 \ctikzset{bipoles/cutechoke/coils/.initial=5}
896 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
897 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
898 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
899 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
900 \newif\ifpgf@circuit@bipole@twolineschoke
901 \pgf@circuit@bipole@twolineschokefalse
902 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
903 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
904 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
905 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
906 %
907 \ctikzset{bipoles/americaninductor/height/.initial=.3}
908 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
909 \ctikzset{bipoles/americaninductor/width/.initial=.8}
910 \ctikzset{bipoles/americaninductor/coils/.initial=4}
911 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
912 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
913 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
914 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
915 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
916 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
917 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
918 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
919 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
920 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
921 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
922 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
923 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
924 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
925 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
926
927 % Sources
928
929 \ctikzset{bipoles/esource/height/.initial=.60}
930 \ctikzset{bipoles/esource/width/.initial=.60}
931 \ctikzset{bipoles/pvsource/height/.initial=.60}
932 \ctikzset{bipoles/pvsource/width/.initial=.60}
933 \ctikzset{bipoles/isource/height/.initial=.60}
934 \ctikzset{bipoles/isource/width/.initial=.60}
935 \ctikzset{bipoles/oosource/height/.initial=.60}
936 \ctikzset{bipoles/oosource/width/.initial=.60}
937 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
938 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
939 \ctikzset{bipoles/dcisource/angle/.initial=80}
940 \ctikzset{bipoles/dcisource/height/.initial=.60}
941 \ctikzset{bipoles/dcisource/width/.initial=.60}
942 \ctikzset{bipoles/dcvsource/height/.initial=.60}
943 \ctikzset{bipoles/dcvsource/width/.initial=.60}
944 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
945 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
946 \ctikzset{bipoles/isourceam/height/.initial=.60}
947 \ctikzset{bipoles/isourceam/width/.initial=.60}
948 \ctikzset{bipoles/vsource/height/.initial=.60}
949 \ctikzset{bipoles/vsource/width/.initial=.60}
950 \ctikzset{bipoles/vsourceam/height/.initial=.60}
951 \ctikzset{bipoles/vsourceam/width/.initial=.60}
952 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
953 \ctikzset{bipoles/isourcesin/height/.initial=.60}
954 \ctikzset{bipoles/isourcesin/width/.initial=.60}
955 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
956 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
957 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
958 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
959 \ctikzset{bipoles/cisource/height/.initial=.7}
960 \ctikzset{bipoles/cisource/width/.initial=.7}
961 \ctikzset{bipoles/cisourceam/height/.initial=.7}
962 \ctikzset{bipoles/cisourceam/width/.initial=.7}
963 \ctikzset{bipoles/ecsource/height/.initial=.7}
964 \ctikzset{bipoles/ecsource/width/.initial=.7}
965 \ctikzset{bipoles/cvsource/height/.initial=.7}
966 \ctikzset{bipoles/cvsource/width/.initial=.7}
967 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
968 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
969 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
970 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
971 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
972 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
973 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
974 \ctikzset{bipoles/battery/height/.initial=.6}
975 \ctikzset{bipoles/battery/width/.initial=.3}
976 \ctikzset{bipoles/battery1/height/.initial=.6}
977 \ctikzset{bipoles/battery1/width/.initial=.3}
978 \ctikzset{bipoles/battery2/height/.initial=.6}
979 \ctikzset{bipoles/battery2/width/.initial=.3}
980
981 % % % ootransformer
982 \ctikzset{bipoles/oosourcetrans/height/.initial=.6}
983 \ctikzset{bipoles/oosourcetrans/width/.initial=.6}
984 \ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
985 \ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
986 \ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
987
988 % % % oootransformer
989 \ctikzset{bipoles/ooosource/height/.initial=.6}
990 \ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
991 \ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
992 \ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
993
994 % % % primary windings
995 \newif\ifpgf@circ@prim@delta
996 \newif\ifpgf@circ@prim@wye
997 \newif\ifpgf@circ@prim@zig
998 \pgfkeys{tikz/prim/.is choice}
999 \pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}}
1000 \pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}}
1001 \pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}}
1002
1003 % % % secondary windings
1004 \newif\ifpgf@circ@sec@delta
1005 \newif\ifpgf@circ@sec@wye
1006 \newif\ifpgf@circ@sec@zig
1007 \pgfkeys{tikz/sec/.is choice}
1008 \pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}}
1009 \pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}}
1010 \pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}}
1011
1012 % % % tertiary windings (ooosource)
1013 \newif\ifpgf@circ@tert@delta
1014 \newif\ifpgf@circ@tert@wye
1015 \newif\ifpgf@circ@tert@zig
1016 \pgfkeys{tikz/tert/.is choice}
1017 \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}}
1018 \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}}
1019 \pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}
1020
1021 % diodes
1022
1023 \ctikzset{bipoles/diode/height/.initial=.50}
1024 \ctikzset{bipoles/diode/width/.initial=.40}
1025 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
1026 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
1027 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
1028 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
1029 \ctikzset{bipoles/varcap/height/.initial=.50}
1030 \ctikzset{bipoles/varcap/width/.initial=.45}
1031
1032 % switches
1033
1034 \ctikzset{bipoles/spst/height/.initial=.35}
1035 \ctikzset{bipoles/spst/width/.initial=.35}
1036 \ctikzset{bipoles/spst/depth/.initial=.2}
1037 \ctikzset{bipoles/nos/height/.initial=.3}
1038 \ctikzset{bipoles/nos/width/.initial=.35}
1039 \ctikzset{bipoles/nos/depth/.initial=.2}
1040 \ctikzset{bipoles/ncs/height/.initial=.35}
1041 \ctikzset{bipoles/ncs/width/.initial=.35}
1042 \ctikzset{bipoles/ncs/depth/.initial=.2}
1043 %%% reed switch
1044 \ctikzset{bipoles/reed/height/.initial=.4}
1045 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
1046 \ctikzset{bipoles/reed/depth/.initial=.4}
1047
1048 % misc
1049
1050 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
1051 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
1052 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
1053 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
1054 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
1055 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
1056 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
1057 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
1058 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
1059 \ctikzset{bipoles/fuse/height/.initial=.20}
1060 \ctikzset{bipoles/fuse/width/.initial=.50}
1061 \ctikzset{bipoles/afuse/height/.initial=.20}
1062 \ctikzset{bipoles/afuse/width/.initial=.50}
1063 \ctikzset{bipoles/memristor/height/.initial=.30}
1064 \ctikzset{bipoles/memristor/wave height/.initial=.5}
1065 \ctikzset{bipoles/memristor/width/.initial=.80}
1066 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
1067 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
1068 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
1069 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
1070 \ctikzset{bipoles/short/height/.initial=0} %dummy height for voltage positioning
1071 \ctikzset{bipoles/short/width/.initial=0} %dummy width for voltage positioning
1072 %\ctikzset{bipoles/short/voltage/straight label distance/.initial=.2}
1073 %\ctikzset{bipoles/short/voltage/distance from node/.initial=.5}
1074 % multiwire
1075 \ctikzset{bipoles/multiwire/height/.initial=0.4}
1076 \ctikzset{bipoles/multiwire/width/.initial=0.2}
1077 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
1078
1079 \ctikzset{bipoles/ammeter/height/.initial=.60}
1080 \ctikzset{bipoles/ammeter/width/.initial=.60}
1081 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
1082 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
1083 \ctikzset{bipoles/voltmeter/height/.initial=.60}
1084 \ctikzset{bipoles/voltmeter/width/.initial=.60}
1085 \ctikzset{bipoles/smeter/height/.initial=.60}
1086 \ctikzset{bipoles/smeter/width/.initial=.60}
1087 \ctikzset{bipoles/smeter/voltage/additional label shift/.initial=1}
1088 \ctikzset{bipoles/qmeter/depth/.initial=.40}
1089 \ctikzset{bipoles/qmeter/height/.initial=.80}
1090 \ctikzset{bipoles/qmeter/width/.initial=.60}
1091 % this must be specified for each one
1092 \ctikzset{bipoles/qvprobe/voltage/additional label shift/.initial=.5}
1093 \ctikzset{bipoles/qiprobe/voltage/additional label shift/.initial=.5}
1094 \ctikzset{bipoles/qpprobe/voltage/additional label shift/.initial=.5}
1095 \ctikzset{bipoles/iloop/width/.initial=.40}
1096 \ctikzset{bipoles/iloop/height/.initial=.60}
1097
1098 \ctikzset{bipoles/oscope/height/.initial=.60}
1099 \ctikzset{bipoles/oscope/width/.initial=.60}
1100 \ctikzset{bipoles/oscope/voltage/additional label shift/.initial=1}
1101
1102
1103 % option to not rotate the new (Romano's) instruments
1104 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
1105 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
1106 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
1107 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
1108 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
1109
1110
1111 \ctikzset{bipoles/buffer/height/.initial=1}
1112 \ctikzset{bipoles/buffer/width/.initial=1}
1113 \ctikzset{bipoles/not port/width/.initial=1}
1114 \ctikzset{bipoles/not port/height/.initial=.8}
1115 \ctikzset{bipoles/not port/circle width/.initial=.15}
1116 \ctikzset{bipoles/lamp/height/.initial=.60}
1117 \ctikzset{bipoles/lamp/width/.initial=.60}
1118 \ctikzset{bipoles/bulb/height/.initial=.8}
1119 \ctikzset{bipoles/bulb/width/.initial=.8}
1120 \ctikzset{bipoles/tline/height/.initial=.3}
1121 \ctikzset{bipoles/tline/width/.initial=.8}
1122 \ctikzset{bipoles/squid/height/.initial=.60}
1123 \ctikzset{bipoles/squid/width/.initial=.60}
1124 \ctikzset{bipoles/barrier/height/.initial=.60}
1125 \ctikzset{bipoles/barrier/width/.initial=.60}
1126 \ctikzset{bipoles/openbarrier/gap/.initial=0.5}
1127 \ctikzset{bipoles/thermocouple/height/.initial=.250}
1128 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
1129 \ctikzset{bipoles/thermocouple/width/.initial=.140}
1130 \ctikzset{bipoles/pushbutton/height/.initial=.5}
1131 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
1132 \ctikzset{bipoles/pushbutton/width/.initial=.50}
1133
1134 \ctikzset{bipoles/twoport/width/.initial=.7}
1135 \ctikzset{bipoles/twoport/height/.initial=.7}
1136 \ctikzset{bipoles/twoport/text/.initial=}
1137 \ctikzset{bipoles/vco/width/.initial=.7}
1138 \ctikzset{bipoles/bandpass/width/.initial=.7}
1139 \ctikzset{bipoles/bandstop/width/.initial=.7}
1140 \ctikzset{bipoles/highpass/width/.initial=.7}
1141 \ctikzset{bipoles/lowpass/width/.initial=.7}
1142 \ctikzset{bipoles/adc/width/.initial=.7}
1143 \ctikzset{bipoles/dac/width/.initial=.7}
1144 \ctikzset{bipoles/dsp/width/.initial=.7}
1145 \ctikzset{bipoles/fft/width/.initial=.7}
1146 \ctikzset{bipoles/amp/width/.initial=.7}
1147 \ctikzset{bipoles/vamp/width/.initial=.7}
1148 \ctikzset{bipoles/piattenuator/width/.initial=.7}
1149 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
1150 \ctikzset{bipoles/tattenuator/width/.initial=.7}
1151 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
1152 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
1153 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
1154 \ctikzset{bipoles/detector/width/.initial=.7}
1155
1156 % crossing wires
1157 \ctikzset{bipoles/crossing/size/.initial=.2}
1158
1159 % Transistors starts here
1160
1161 \newif\ifpgf@circuit@trans@depletiontype
1162 \pgf@circuit@trans@depletiontypefalse
1163
1164 \newif\ifpgf@circuit@mos@arrows
1165 \ctikzset{tripoles/mos style/.is choice}
1166 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
1167 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
1168 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
1169 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
1170
1171 % Fixed label positions
1172 \newif\ifpgf@circuit@transisors@fixlabels
1173 \pgf@circuit@transisors@fixlabelstrue
1174 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
1175 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
1176 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
1177 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
1178
1179 % Option solderdot for fet
1180 \newif\ifpgf@circuit@fet@solderdot
1181 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
1182 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
1183 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
1184 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
1185
1186 % Option bodydiode for fet
1187 \newif\ifpgf@circuit@fet@bodydiode
1188 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
1189 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
1190 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
1191 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
1192
1193 % Option draw fet without gate connection
1194 \newif\ifpgf@circuit@bpt@drawgate
1195 \pgf@circuit@bpt@drawgatetrue
1196 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1197 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1198 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1199 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
1200
1201 % Option draw bpt with schottky base
1202 \newif\ifpgf@circuit@bpt@schottky
1203 \pgf@circuit@bpt@schottkyfalse
1204 \pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
1205 \ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
1206 \pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
1207 \ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
1208 \ctikzset{tripoles/schottky base size/.initial=0.07}
1209
1210 % Option draw bpt without base connection
1211 \newif\ifpgf@circuit@bpt@drawbase
1212 \pgf@circuit@bpt@drawbasetrue
1213 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1214 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1215 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1216 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
1217
1218 % Option draw bpt with optical input
1219 \newif\ifpgf@circuit@bpt@drawphoto
1220 \pgf@circuit@bpt@drawphotofalse
1221 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1222 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1223 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1224 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
1225
1226 % Option draw fet without bulk connection -- Added by Burak Kelleci
1227 \newif\ifpgf@circuit@bpt@drawbulk
1228 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
1229 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
1230 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
1231 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
1232
1233 % Option draw pmos with empty circle
1234 \newif\ifpgf@circuit@pmos@emptycircle
1235 \pgf@circuit@pmos@emptycirclefalse
1236 \ctikzset{tripoles/pmos style/.is choice}
1237 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
1238 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
1239 % Option draw pmos with no circle
1240 \newif\ifpgf@circuit@pmos@nocircle
1241 \pgf@circuit@pmos@nocirclefalse
1242 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
1243 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
1244 % back to normal
1245 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
1246 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
1247 % arrows at the end, the correct way
1248 \newif\ifpgf@circuit@trans@arrowatend
1249 \pgf@circuit@trans@arrowatendfalse
1250 \ctikzset{transistors/arrow pos/.is choice}
1251 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
1252 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
1253
1254 \newif\ifpgf@circuit@trans@ntype
1255 \pgf@circuit@trans@ntypetrue %default true
1256 %\newif\ifpgf@circuit@trans@ptype
1257 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
1258 \ctikzset{tripoles/nmos/width/.initial=.7}
1259 \ctikzset{tripoles/nmos/gate height/.initial=.35}
1260 \ctikzset{tripoles/nmos/base height/.initial=.5}
1261 \ctikzset{tripoles/nmos/conn height/.initial=0}
1262 \ctikzset{tripoles/nmos/height/.initial=1.1}
1263 \ctikzset{tripoles/nmos/base width/.initial=.5}
1264 \ctikzset{tripoles/nmos/gate width/.initial=.62}
1265 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
1266 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
1267 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
1268 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
1269 \ctikzset{tripoles/nmos/curr direction/.initial=1}
1270
1271 \ctikzset{tripoles/pmos/width/.initial=.7}
1272 \ctikzset{tripoles/pmos/gate height/.initial=.35}
1273 \ctikzset{tripoles/pmos/base height/.initial=.5}
1274 \ctikzset{tripoles/pmos/conn height/.initial=0}
1275 \ctikzset{tripoles/pmos/height/.initial=1.1}
1276 \ctikzset{tripoles/pmos/base width/.initial=.5}
1277 \ctikzset{tripoles/pmos/gate width/.initial=.62}
1278 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
1279 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
1280 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
1281 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
1282 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
1283
1284 \ctikzset{tripoles/hemt/width/.initial=.7}
1285 \ctikzset{tripoles/hemt/gate height/.initial=.35}
1286 \ctikzset{tripoles/hemt/base height/.initial=.5}
1287 \ctikzset{tripoles/hemt/conn height/.initial=0}
1288 \ctikzset{tripoles/hemt/height/.initial=1.1}
1289 \ctikzset{tripoles/hemt/base width/.initial=.5}
1290 \ctikzset{tripoles/hemt/gate width/.initial=.62}
1291 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
1292 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
1293 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
1294 \ctikzset{tripoles/hemt/curr direction/.initial=1}
1295
1296 \ctikzset{tripoles/nfet/width/.initial=.7}
1297 \ctikzset{tripoles/nfet/gate height/.initial=.35}
1298 \ctikzset{tripoles/nfet/base height/.initial=.5}
1299 \ctikzset{tripoles/nfet/conn height/.initial=0}
1300 \ctikzset{tripoles/nfet/height/.initial=1.1}
1301 \ctikzset{tripoles/nfet/base width/.initial=.5}
1302 \ctikzset{tripoles/nfet/gate width/.initial=.62}
1303 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
1304 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
1305 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
1306 \ctikzset{tripoles/nfet/curr direction/.initial=1}
1307
1308 \ctikzset{tripoles/pfet/width/.initial=.7}
1309 \ctikzset{tripoles/pfet/gate height/.initial=.35}
1310 \ctikzset{tripoles/pfet/base height/.initial=.5}
1311 \ctikzset{tripoles/pfet/conn height/.initial=0}
1312 \ctikzset{tripoles/pfet/height/.initial=1.1}
1313 \ctikzset{tripoles/pfet/base width/.initial=.5}
1314 \ctikzset{tripoles/pfet/gate width/.initial=.62}
1315 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
1316 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
1317 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
1318 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
1319
1320 \ctikzset{tripoles/nigfete/width/.initial=.7}
1321 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
1322 \ctikzset{tripoles/nigfete/base height/.initial=.5}
1323 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
1324 \ctikzset{tripoles/nigfete/height/.initial=1.1}
1325 \ctikzset{tripoles/nigfete/base width/.initial=.5}
1326 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
1327 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
1328 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
1329 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
1330 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
1331
1332 \ctikzset{tripoles/nigfetd/width/.initial=.7}
1333 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
1334 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
1335 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
1336 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
1337 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
1338 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
1339 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
1340 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
1341 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
1342 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
1343
1344 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
1345 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
1346 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
1347 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
1348 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
1349 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
1350 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
1351 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
1352 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
1353 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
1354 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
1355
1356 \ctikzset{tripoles/pigfete/width/.initial=.7}
1357 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
1358 \ctikzset{tripoles/pigfete/base height/.initial=.5}
1359 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
1360 \ctikzset{tripoles/pigfete/height/.initial=1.1}
1361 \ctikzset{tripoles/pigfete/base width/.initial=.5}
1362 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
1363 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
1364 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
1365 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
1366 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
1367
1368 \ctikzset{tripoles/pigfetd/width/.initial=.7}
1369 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
1370 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
1371 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
1372 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
1373 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
1374 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
1375 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
1376 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
1377 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
1378 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
1379
1380 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
1381 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
1382 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
1383 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
1384 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
1385 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
1386 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
1387 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
1388 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
1389 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
1390 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
1391
1392 \ctikzset{tripoles/npn/width/.initial=.6}
1393 \ctikzset{tripoles/npn/base height/.initial=.45}
1394 \ctikzset{tripoles/npn/base height 2/.initial=.15}
1395 \ctikzset{tripoles/npn/base height/.initial=.4}
1396 \ctikzset{tripoles/npn/conn height/.initial=0}
1397 \ctikzset{tripoles/npn/height/.initial=1.1}
1398 \ctikzset{tripoles/npn/base width/.initial=.5}
1399 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
1400 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
1401 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
1402 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
1403 \ctikzset{tripoles/npn/curr direction/.initial=1}
1404
1405 \ctikzset{tripoles/pnp/width/.initial=.6}
1406 \ctikzset{tripoles/pnp/base height/.initial=.45}
1407 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
1408 \ctikzset{tripoles/pnp/base height/.initial=.4}
1409 \ctikzset{tripoles/pnp/conn height/.initial=0}
1410 \ctikzset{tripoles/pnp/height/.initial=1.1}
1411 \ctikzset{tripoles/pnp/base width/.initial=.5}
1412 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
1413 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
1414 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
1415 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
1416 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
1417
1418 \ctikzset{tripoles/pigbt/width/.initial=.6}
1419 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
1420 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
1421 \ctikzset{tripoles/pigbt/base height/.initial=.4}
1422 \ctikzset{tripoles/pigbt/outer base height/.initial=.4}
1423 \ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
1424 \ctikzset{tripoles/pigbt/conn height/.initial=0}
1425 \ctikzset{tripoles/pigbt/height/.initial=1.1}
1426 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
1427 \ctikzset{tripoles/pigbt/base width/.initial=.5}
1428 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
1429 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
1430 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
1431 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
1432
1433 \ctikzset{tripoles/nigbt/width/.initial=.6}
1434 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
1435 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
1436 \ctikzset{tripoles/nigbt/base height/.initial=.4}
1437 \ctikzset{tripoles/nigbt/outer base height/.initial=.4}
1438 \ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
1439 \ctikzset{tripoles/nigbt/conn height/.initial=0}
1440 \ctikzset{tripoles/nigbt/height/.initial=1.1}
1441 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
1442 \ctikzset{tripoles/nigbt/base width/.initial=.5}
1443 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
1444 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
1445 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
1446 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
1447
1448 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
1449 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
1450 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
1451 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
1452 \ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
1453 \ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
1454 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
1455 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
1456 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
1457 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
1458 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
1459 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
1460 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
1461 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
1462
1463 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
1464 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
1465 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
1466 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
1467 \ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
1468 \ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
1469 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
1470 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
1471 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
1472 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
1473 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
1474 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
1475 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
1476 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
1477
1478 \ctikzset{tripoles/igbt/outer base height/.code={
1479 \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
1480 \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
1481 \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
1482 \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
1483 \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
1484 \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
1485 }}
1486 \ctikzset{tripoles/igbt/outer base thickness/.code={
1487 \ctikzset{tripoles/nigbt/outer base thickness=#1}
1488 \ctikzset{tripoles/pigbt/outer base thickness=#1}
1489 \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
1490 \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
1491 }}
1492
1493 \ctikzset{tripoles/njfet/width/.initial=.7}
1494 \ctikzset{tripoles/njfet/gate height/.initial=.5}
1495 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
1496 \ctikzset{tripoles/njfet/gate width/.initial=.5}
1497 \ctikzset{tripoles/njfet/conn height/.initial=.35}
1498 \ctikzset{tripoles/njfet/height/.initial=1.1}
1499 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
1500 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
1501 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
1502 \ctikzset{tripoles/njfet/curr direction/.initial=1}
1503
1504 \ctikzset{tripoles/pjfet/width/.initial=.7}
1505 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
1506 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
1507 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
1508 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
1509 \ctikzset{tripoles/pjfet/height/.initial=1.1}
1510 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
1511 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
1512 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
1513 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
1514
1515 \ctikzset{tripoles/isfet/width/.initial=1}
1516 \ctikzset{tripoles/isfet/gate height/.initial=.35}
1517 \ctikzset{tripoles/isfet/base height/.initial=.5}
1518 \ctikzset{tripoles/isfet/height/.initial=1.1}
1519 \ctikzset{tripoles/isfet/base width/.initial=.3}
1520 \ctikzset{tripoles/isfet/gate width/.initial=.5}
1521 \ctikzset{tripoles/isfet/conn height/.initial=0}
1522 \ctikzset{tripoles/isfet/wave width/.initial=.16}
1523 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
1524 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
1525 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
1526 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
1527 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
1528 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
1529 \ctikzset{tripoles/isfet/curr direction/.initial=1}
1530 %
1531 % multi-emitter and multi-collector BJTs by Romano Giannetti
1532 %
1533 \ctikzset{tripoles/bjt/emitters/.initial=1}
1534 \ctikzset{tripoles/bjt/collectors/.initial=1}
1535 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
1536 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
1537 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
1538 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
1539 \ctikzset{tripoles/bjt/multi height/.initial=.5}
1540 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
1541 %
1542 \ctikzset{tripoles/bjt/width/.initial=.3}
1543 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
1544 \ctikzset{tripoles/bjt/base height/.initial=1.1}
1545 \ctikzset{tripoles/bjt/height/.initial=.4}
1546 \ctikzset{tripoles/bjt/base width/.initial=1}
1547 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
1548 % do NOT touch these two!
1549 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
1550 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
1551
1552 %% transistors stop here
1553
1554 %% Logic ports
1555
1556 \newif\ifpgf@circuit@europeanlogicport
1557 \ctikzset{logic ports/.is choice}
1558 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
1559 \tikzset{and port/.style={shape=european and port}}%
1560 \tikzset{or port/.style={shape=european or port}}%
1561 \tikzset{xor port/.style={shape=european xor port}}%
1562 \tikzset{buffer port/.style={shape=european buffer port}}%
1563 \tikzset{not port/.style={shape=european not port}}%
1564 \tikzset{nand port/.style={shape=european nand port}}%
1565 \tikzset{nor port/.style={shape=european nor port}}%
1566 \tikzset{xnor port/.style={shape=european xnor port}}%
1567 }}
1568 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
1569 \tikzset{and port/.style={shape=american and port}}%
1570 \tikzset{or port/.style={shape=american or port}}%
1571 \tikzset{xor port/.style={shape=american xor port}}%
1572 \tikzset{buffer port/.style={shape=american buffer port}}%
1573 \tikzset{not port/.style={shape=american not port}}%
1574 \tikzset{nand port/.style={shape=american nand port}}%
1575 \tikzset{nor port/.style={shape=american nor port}}%
1576 \tikzset{xnor port/.style={shape=american xnor port}}%
1577 }}
1578
1579 \ctikzset{logic ports origin/.is choice}
1580 \ctikzset{logic ports origin/legacy/.code={
1581 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
1582 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
1583 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
1584 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
1585 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
1586 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
1587 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
1588 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
1589 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
1590 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
1591 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
1592 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
1593 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
1594 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
1595 }%
1596 }
1597 \ctikzset{logic ports origin/center/.code={%
1598 \ctikzset{tripoles/american and port/origin/.initial=0}%
1599 \ctikzset{tripoles/american nand port/origin/.initial=0}%
1600 \ctikzset{tripoles/american nor port/origin/.initial=0}%
1601 \ctikzset{tripoles/american or port/origin/.initial=0}%
1602 \ctikzset{tripoles/american xor port/origin/.initial=0}%
1603 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
1604 \ctikzset{tripoles/european and port/origin/.initial=0}%
1605 \ctikzset{tripoles/european nand port/origin/.initial=0}%
1606 \ctikzset{tripoles/european or port/origin/.initial=0}%
1607 \ctikzset{tripoles/european nor port/origin/.initial=0}%
1608 \ctikzset{tripoles/european xor port/origin/.initial=0}%
1609 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
1610 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
1611 \ctikzset{tripoles/european not port/origin/.initial=0}%
1612 }%
1613 }
1614
1615 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
1616 \ctikzset{american or shape/.is choice}
1617 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
1618 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
1619
1620 \newif\ifpgfcirc@draw@leads\pgfcirc@draw@leadstrue
1621 \ctikzset{logic ports draw input leads/.is choice}
1622 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@leadstrue}}
1623 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@leadsfalse}}
1624 \tikzset{input leads/.code={\pgfcirc@draw@leadstrue}}
1625 \tikzset{no input leads/.code={\pgfcirc@draw@leadsfalse}}
1626
1627 \ctikzset{tripoles/american and port/width/.initial=1.1}
1628 \ctikzset{tripoles/american and port/height/.initial=.8}
1629 \ctikzset{tripoles/american and port/port width/.initial=.7}
1630 \ctikzset{tripoles/american and port/input height/.initial=.5}
1631 \ctikzset{tripoles/american nand port/width/.initial=1.1}
1632 \ctikzset{tripoles/american nand port/height/.initial=.8}
1633 \ctikzset{tripoles/american nand port/port width/.initial=.7}
1634 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
1635 \ctikzset{tripoles/american nand port/input height/.initial=.5}
1636 \ctikzset{tripoles/american or port/width/.initial=1.1}
1637 \ctikzset{tripoles/american or port/height/.initial=.8}
1638 \ctikzset{tripoles/american or port/port width/.initial=.7}
1639 \ctikzset{tripoles/american or port/input height/.initial=.5}
1640 \ctikzset{tripoles/american or port/input skip/.initial=.25}
1641 \ctikzset{tripoles/american or port/aaa/.initial=.6}
1642 \ctikzset{tripoles/american or port/bbb/.initial=.4}
1643 \ctikzset{tripoles/american or port/ccc/.initial=.5}
1644 \ctikzset{tripoles/american or port/ddd/.initial=.0}
1645 \ctikzset{tripoles/american nor port/width/.initial=1.1}
1646 \ctikzset{tripoles/american nor port/height/.initial=.8}
1647 \ctikzset{tripoles/american nor port/port width/.initial=.7}
1648 \ctikzset{tripoles/american nor port/input height/.initial=.5}
1649 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
1650 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
1651 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
1652 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
1653 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
1654 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
1655 \ctikzset{tripoles/american xor port/width/.initial=1.1}
1656 \ctikzset{tripoles/american xor port/height/.initial=.8}
1657 \ctikzset{tripoles/american xor port/port width/.initial=.7}
1658 \ctikzset{tripoles/american xor port/input height/.initial=.5}
1659 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
1660 \ctikzset{tripoles/american xor port/distance/.initial=.1}
1661 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
1662 \ctikzset{tripoles/american xnor port/height/.initial=.8}
1663 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
1664 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
1665 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
1666 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
1667 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
1668 \ctikzset{tripoles/american and port/origin/.initial=0.8}
1669 \ctikzset{tripoles/american and port/inputs/.initial=2}
1670 % variable number of inputs
1671 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
1672 \ctikzset{tripoles/american nand port/inputs/.initial=2}
1673 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
1674 \ctikzset{tripoles/american nor port/inputs/.initial=2}
1675 \ctikzset{tripoles/american nor port/angle/.initial=70}
1676 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
1677 \ctikzset{tripoles/american or port/origin/.initial=0.8}
1678 \ctikzset{tripoles/american or port/inputs/.initial=2}
1679 \ctikzset{tripoles/american or port/angle/.initial=70}
1680 \ctikzset{tripoles/american or port/inner/.initial=0.3}
1681 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
1682 \ctikzset{tripoles/american xor port/inputs/.initial=2}
1683 \ctikzset{tripoles/american xor port/angle/.initial=70}
1684 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
1685 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
1686 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
1687 \ctikzset{tripoles/american xnor port/angle/.initial=70}
1688 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
1689
1690 \ctikzset{tripoles/european and port/width/.initial=1.4}
1691 \ctikzset{tripoles/european and port/height/.initial=.65}
1692 \ctikzset{tripoles/european and port/reserved/.initial=.6}
1693 \ctikzset{tripoles/european and port/input height/.initial=.6}
1694 \ctikzset{tripoles/european or port/width/.initial=1.4}
1695 \ctikzset{tripoles/european or port/height/.initial=.65}
1696 \ctikzset{tripoles/european or port/reserved/.initial=.6}
1697 \ctikzset{tripoles/european or port/input height/.initial=.6}
1698 \ctikzset{tripoles/european xor port/width/.initial=1.4}
1699 \ctikzset{tripoles/european xor port/height/.initial=.65}
1700 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
1701 \ctikzset{tripoles/european xor port/input height/.initial=.6}
1702 \ctikzset{tripoles/european nand port/width/.initial=1.4}
1703 \ctikzset{tripoles/european nand port/not height/.initial=.3}
1704 \ctikzset{tripoles/european nand port/not width/.initial=.8}
1705 \ctikzset{tripoles/european nand port/height/.initial=.65}
1706 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
1707 \ctikzset{tripoles/european nand port/input height/.initial=.6}
1708 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
1709 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
1710 \ctikzset{tripoles/european buffer port/not width/.initial=.8}
1711 \ctikzset{tripoles/european buffer port/height/.initial=.65}
1712 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
1713 \ctikzset{tripoles/european buffer port/input height/.initial=0}
1714 \ctikzset{tripoles/european not port/width/.initial=1.4}
1715 \ctikzset{tripoles/european not port/not height/.initial=.3}
1716 \ctikzset{tripoles/european not port/not width/.initial=.8}
1717 \ctikzset{tripoles/european not port/height/.initial=.65}
1718 \ctikzset{tripoles/european not port/reserved/.initial=.6}
1719 \ctikzset{tripoles/european not port/input height/.initial=0}
1720 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
1721 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
1722 \ctikzset{tripoles/european xnor port/not width/.initial=.8}
1723 \ctikzset{tripoles/european xnor port/height/.initial=.65}
1724 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
1725 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
1726 \ctikzset{tripoles/european nor port/width/.initial=1.4}
1727 \ctikzset{tripoles/european nor port/not height/.initial=.3}
1728 \ctikzset{tripoles/european nor port/not width/.initial=.8}
1729 \ctikzset{tripoles/european nor port/height/.initial=.65}
1730 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
1731 \ctikzset{tripoles/european nor port/input height/.initial=.6}
1732 % variable number of inputs
1733 \ctikzset{tripoles/european and port/origin/.initial=0.8}
1734 \ctikzset{tripoles/european and port/inputs/.initial=2}
1735 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
1736 \ctikzset{tripoles/european nand port/inputs/.initial=2}
1737 \ctikzset{tripoles/european or port/origin/.initial=0.8}
1738 \ctikzset{tripoles/european or port/inputs/.initial=2}
1739 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
1740 \ctikzset{tripoles/european nor port/inputs/.initial=2}
1741 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
1742 \ctikzset{tripoles/european xor port/inputs/.initial=2}
1743 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
1744 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
1745 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
1746 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
1747 \ctikzset{tripoles/european not port/origin/.initial=0.8}
1748 \ctikzset{tripoles/european not port/inputs/.initial=1}%
1749 %%% parameters that are not used anymore after multi-input
1750 %%% gates --- left for compatibility of source code.
1751 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
1752 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
1753 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
1754 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
1755 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
1756 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
1757 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
1758 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
1759 % switches for logic gates
1760 %
1761 \pgfkeys{/tikz/number inputs/.initial=0}
1762 \pgfkeys{/tikz/number inputs/.default=0}
1763
1764 %% flip-flop specific keys (most others are the same as chips)
1765
1766 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
1767 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
1768 \ctikzset{multipoles/flipflop/width/.initial=1.2}
1769 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
1770 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
1771
1772 %% muxdemuxes keys
1773
1774 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
1775 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
1776 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
1777 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
1778 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
1779 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
1780 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
1781 \ctikzset{multipoles/muxdemux/NL/.initial=8}
1782 \ctikzset{multipoles/muxdemux/NR/.initial=1}
1783 \ctikzset{multipoles/muxdemux/NB/.initial=3}
1784 \ctikzset{multipoles/muxdemux/NT/.initial=0}
1785 \ctikzset{multipoles/muxdemux/square pins/.initial=0}
1786 %
1787 % switches for op amps
1788 % changing input polarity
1789 %
1790 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
1791 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
1792 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
1793 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
1794 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
1795 %
1796 % changing output polarity (for fully diff objects)
1797 %
1798 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
1799 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
1800 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
1801 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
1802 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
1803
1804 % Operational amplifier
1805 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
1806 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
1807 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
1808 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
1809 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
1810 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1811
1812 % Fully differential operational amplifier
1813 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
1814 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
1815 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
1816 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
1817 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
1818 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
1819 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1820
1821 \ctikzset{tripoles/en amp/width/.initial=1.7}
1822 \ctikzset{tripoles/en amp/port width/.initial=.7}
1823 \ctikzset{tripoles/en amp/height/.initial=1.6}
1824 \ctikzset{tripoles/en amp/input height/.initial=.3}
1825 \ctikzset{tripoles/en amp/up pos/.initial=.45}
1826 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1827 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
1828 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
1829 \tikzset{
1830 en amp text/.code = {%
1831 \ctikzsetvalof{tripoles/en amp/text}{#1}%
1832 },
1833 en amp text A/.code = {%
1834 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
1835 },
1836 }
1837
1838 % Transconductance amplifier
1839 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
1840 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
1841 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
1842 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
1843 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
1844 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
1845 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1846
1847 % Instrumentation amplifier
1848 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
1849 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
1850 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
1851 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
1852 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
1853 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
1854 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
1855 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1856
1857 % Instrumentation amplifier with differential output
1858 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
1859 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
1860 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
1861 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
1862 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
1863 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
1864 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
1865 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
1866 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1867
1868 % Instrumentation amplifier with gain resistor terminals
1869 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
1870 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
1871 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
1872 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
1873 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
1874 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
1875 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
1876 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
1877 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
1878
1879 % Plain amplifier
1880 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
1881 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
1882 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
1883 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
1884 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
1885
1886 % changing fonts and symbols of amplifiers
1887 \ctikzset{amplifiers/symbol font/.code={%
1888 \ctikzset{tripoles/inst amp ra/font=#1}%
1889 \ctikzset{tripoles/fd inst amp/font=#1}%
1890 \ctikzset{tripoles/inst amp/font=#1}%
1891 \ctikzset{tripoles/gm amp/font=#1}%
1892 \ctikzset{tripoles/en amp/font=#1}%
1893 \ctikzset{tripoles/fd op amp/font=#1}%
1894 \ctikzset{tripoles/op amp/font=#1}%
1895 }}
1896 \ctikzset{amplifiers/plus/.initial={$+$}}
1897 \ctikzset{amplifiers/minus/.initial={$-$}}
1898 \tikzset{amp symbol font/.code={%
1899 \ctikzset{amplifiers/symbol font={#1}}%
1900 }
1901 }
1902 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
1903 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
1904 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
1905 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
1906
1907 \ctikzset{tripoles/thyristor/height/.initial=1.10}
1908 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
1909 \ctikzset{tripoles/thyristor/width/.initial=1.0}
1910 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
1911 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
1912 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
1913
1914 \ctikzset{tripoles/triac/height/.initial=1.1}
1915 \ctikzset{tripoles/triac/width/.initial=1}
1916 \ctikzset{tripoles/triac/diode width left/.initial=.3}
1917 \ctikzset{tripoles/triac/diode width right/.initial=.3}
1918
1919 %% Cute switches
1920 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
1921 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
1922 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
1923 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
1924 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
1925
1926 \ctikzset{tripoles/spdt/width/.initial=.85}
1927 \ctikzset{tripoles/spdt/height/.initial=.45}
1928 \ctikzset{tripoles/spdt/margin/.initial=.45}
1929
1930 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
1931 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
1932 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
1933
1934 \ctikzset{tripoles/mixer/width/.initial=0.7}
1935 \ctikzset{tripoles/adder/width/.initial=0.7}
1936 \ctikzset{tripoles/circulator/width/.initial=.7}
1937 \ctikzset{tripoles/oscillator/width/.initial=.7}
1938
1939
1940 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
1941 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
1942
1943 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
1944 \ctikzset{quadpoles/transformer/width/.initial=1.5}
1945 \ctikzset{quadpoles/transformer/width1/.initial=.4}
1946 \ctikzset{quadpoles/transformer/height/.initial=1.5}
1947 \ctikzset{quadpoles/transformer/height1/.initial=.8}
1948 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
1949 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
1950 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
1951 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
1952 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
1953 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
1954 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
1955 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
1956 \ctikzset{quadpoles/fourport/width/.initial=1.3}
1957 \ctikzset{quadpoles/fourport/height/.initial=1.3}
1958 \ctikzset{quadpoles/coupler/width/.initial=1.3}
1959 \ctikzset{quadpoles/coupler/height/.initial=1.3}
1960 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
1961 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
1962
1963 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
1964
1965 \ctikzset{quadpoles style/.is choice}
1966 \ctikzset{quadpoles style/inward/.code={% default value
1967 \ctikzset{quadpoles/transformer/inner=0.4}%
1968 \ctikzset{quadpoles/transformer/width=1.5}%
1969 \ctikzset{quadpoles/transformer core/inner=0.4}%
1970 \ctikzset{quadpoles/transformer core/width=1.5}%
1971 \ctikzset{quadpoles/gyrator/inner=0.4}%
1972 \ctikzset{quadpoles/gyrator/width=1.5}%
1973 }%
1974 }
1975 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
1976 \ctikzset{quadpoles/transformer/inner=1}%
1977 \ctikzset{quadpoles/transformer/width=0.6}%
1978 \ctikzset{quadpoles/transformer core/inner=1}%
1979 \ctikzset{quadpoles/transformer core/width=0.6}%
1980 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
1981 \ctikzset{quadpoles/gyrator/width=0.6}%
1982 }%
1983 }
1984
1985 %
1986 % multipoles
1987 %
1988 \ctikzset{multipoles/thickness/.initial=2}
1989 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
1990 % DIP (dual in line package) chips
1991 \ctikzset{multipoles/dipchip/width/.initial=1.2}
1992 \ctikzset{multipoles/dipchip/num pins/.initial=8}
1993 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
1994 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
1995 % QFP (quad flat package) chips
1996 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
1997 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
1998 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
1999 % chip numbers
2000 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
2001 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
2002 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
2003 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
2004 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
2005 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
2006 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
2007 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
2008 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
2009 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
2010 % external chip pins
2011 \ctikzset{multipoles/external pins thickness/.initial=1}
2012 \ctikzset{multipoles/external pins width/.initial=0.2}
2013 \ctikzset{multipoles/external pad fraction/.initial=0}
2014 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
2015 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
2016 % topmarks
2017 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
2018 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
2019 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
2020 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
2021 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
2022
2023 % rotary switch by Romano
2024 \ctikzset{multipoles/rotary/thickness/.initial=1}
2025 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
2026 \ctikzset{multipoles/rotary/channels/.initial=5}
2027 \ctikzset{multipoles/rotary/angle/.initial=60}
2028 \ctikzset{multipoles/rotary/wiper/.initial=20}
2029 \ctikzset{multipoles/rotary/arrow/.is choice}
2030 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
2031 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
2032 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
2033 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
2034 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
2035 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
2036 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
2037
2038 \tikzset{%
2039 rotary switch/.style args={#1in#2wiper#3}{%
2040 shape=rotaryswitch,
2041 /tikz/circuitikz/multipoles/rotary/channels=#1,
2042 /tikz/circuitikz/multipoles/rotary/angle=#2,
2043 /tikz/circuitikz/multipoles/rotary/wiper=#3,
2044 },
2045 rotary switch -/.style args={#1in#2wiper#3}{
2046 rotary switch=#1 in #2 wiper #3,
2047 /tikz/circuitikz/multipoles/rotary/arrow=none,
2048 },
2049 rotary switch <-/.style args={#1in#2wiper#3}{
2050 rotary switch=#1 in #2 wiper #3,
2051 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
2052 },
2053 rotary switch ->/.style args={#1in#2wiper#3}{
2054 rotary switch=#1 in #2 wiper #3,
2055 /tikz/circuitikz/multipoles/rotary/arrow=cw,
2056 },
2057 rotary switch <->/.style args={#1in#2wiper#3}{
2058 rotary switch=#1 in #2 wiper #3,
2059 /tikz/circuitikz/multipoles/rotary/arrow=both,
2060 },
2061 % Notice that these should be the same as the initial values of the keys
2062 rotary switch/.default={5 in 60 wiper 20},
2063 rotary switch -/.default={5 in 60 wiper 20},
2064 rotary switch <-/.default={5 in 60 wiper 20},
2065 rotary switch ->/.default={5 in 60 wiper 20},
2066 rotary switch <->/.default={5 in 60 wiper 20},
2067 }
2068
2069 % %Mechanical section
2070 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
2071 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
2072 \ctikzset{bipoles/spring/height/.initial=.5}
2073 \ctikzset{bipoles/spring/width/.initial=.5}
2074 \ctikzset{bipoles/inerter/height/.initial=.7}
2075 \ctikzset{bipoles/inerter/width/.initial=.175}
2076 \ctikzset{bipoles/mass/height/.initial=.55}
2077 \ctikzset{bipoles/mass/box height/.initial=.4}
2078 \ctikzset{bipoles/mass/width/.initial=.5}
2079
2080 \ctikzset{bipoles/damper/height/.initial=.35}
2081 \ctikzset{bipoles/damper/length/.initial=.3}
2082 \ctikzset{bipoles/damper/width/.initial=.4}
2083
2084
2085 \ctikzset{bipole/.is family}
2086 \ctikzset{bipole/kind/.initial=}
2087 \ctikzset{bipole/name/.initial=}
2088 \newif\ifpgf@circuit@bipole@isvoltage
2089 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
2090 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
2091 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
2092 \newif\ifpgf@circuit@bipole@strokedsymbol
2093 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
2094 \newif\ifpgf@circuit@bipole@iscurrent
2095 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
2096
2097 \ctikzset{bipole/voltage/.is family}
2098 \newif\ifpgf@circuit@bipole@voltage@backward
2099 \ctikzset{bipole/voltage/direction/.is choice}
2100 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
2101 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
2102 \newif\ifpgf@circuit@bipole@voltage@below
2103 \ctikzset{bipole/voltage/position/.is choice}
2104 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
2105 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
2106
2107 \ctikzset{bipole/voltage/label/unit/.initial=}
2108 \ctikzset{bipole/voltage/label/name/.initial=}
2109
2110 \ctikzset{bipole/current/.is family}
2111 \newif\ifpgf@circuit@bipole@current@backward
2112 \ctikzset{bipole/current/direction/.is choice}
2113 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
2114 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
2115 \newif\ifpgf@circuit@bipole@current@before
2116 \ctikzset{bipole/current/x position/.is choice}
2117 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
2118 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
2119 \newif\ifpgf@circuit@bipole@current@below
2120 \ctikzset{bipole/current/y position/.is choice}
2121 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
2122 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
2123 \ctikzset{bipole/current/label/unit/.initial=}
2124 \ctikzset{bipole/current/label/name/.initial=}
2125
2126 \ctikzset{bipole/flow/.is family}
2127 \newif\ifpgf@circuit@bipole@flow@backward
2128 \ctikzset{bipole/flow/direction/.is choice}
2129 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
2130 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
2131 \newif\ifpgf@circuit@bipole@flow@before
2132 \ctikzset{bipole/flow/x position/.is choice}
2133 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
2134 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
2135 \newif\ifpgf@circuit@bipole@flow@below
2136 \ctikzset{bipole/flow/y position/.is choice}
2137 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
2138 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
2139 \ctikzset{bipole/flow/label/unit/.initial=}
2140 \ctikzset{bipole/flow/label/name/.initial=}
2141 \ctikzset{flow/distance/.initial = .5}
2142 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
2143
2144 \ctikzset{bipole/label/.is family}
2145 \ctikzset{bipole/label/position/.initial=90}
2146 \ctikzset{bipole/label/unit/.initial=}
2147 \ctikzset{bipole/label/name/.initial=}
2148 \ctikzset{bipole/annotation/.is family}
2149 \ctikzset{bipole/annotation/position/.initial=-90}
2150 \ctikzset{bipole/annotation/unit/.initial=}
2151 \ctikzset{bipole/annotation/name/.initial=}
2152
2153 \newif\ifpgf@circuit@europeanresistor
2154 \ctikzset{resistor/.is choice}
2155 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
2156 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
2157
2158 \ctikzset{inductor/.is choice}
2159 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
2160 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
2161 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
2162
2163 %
2164 % Flipping arrows in LED and photodiodes
2165 %
2166 \newif\ifpgf@led@fliparrows
2167 \newif\ifpgf@pd@fliparrows
2168 \pgf@led@fliparrowsfalse
2169 \pgf@pd@fliparrowsfalse
2170 %
2171 % by default the arrows start (LED) and go (PD) to the anode.
2172 %
2173 \ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse}
2174 \ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse}
2175 %
2176 % but they can start form the cathode (LED) or go to it (PD)
2177 %
2178 \ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue}
2179 \ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue}
2180
2181 \newif\ifpgf@circuit@strokediode
2182 \newif\ifpgf@circuit@fulldiode
2183 \pgf@circuit@strokediodefalse
2184 \pgf@circuit@fulldiodefalse
2185
2186 \ctikzset{diode/.is choice}
2187 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
2188 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue }
2189 \ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}
2190
2191 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
2192 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
2193 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
2194
2195 \ctikzset{thickness/.initial=2}
2196 \ctikzset{color/.initial=black}
2197 \pgfkeys{/tikz/color/.add code={}{\ctikzset{color={#1}}}}
2198
2199 \newif\ifpgf@circ@siunitx
2200 \newif\ifpgf@circ@siunitx@res
2201
2202 %
2203 % voltage and current options
2204 %
2205
2206 \newif\ifpgf@circuit@europeancurrent
2207 \newif\ifpgf@circuit@europeanvoltage
2208 \newif\ifpgf@circuit@bipole@voltage@straight
2209
2210 \ctikzset{voltage/.is choice}
2211 %
2212 % straight is expected to be a subset of european, so disable it in american style
2213 %
2214 \ctikzset{voltage/american/.code = {\pgf@circuit@europeanvoltagefalse\pgf@circuit@bipole@voltage@straightfalse}}
2215 \ctikzset{voltage/european/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straightfalse}}
2216 \ctikzset{voltage/straight/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straighttrue}}
2217 \ctikzset{voltage/curved/.code = {\pgf@circuit@europeanvoltagetrue\pgf@circuit@bipole@voltage@straighttrue}}
2218
2219 \ctikzset{current/.is choice}
2220 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
2221 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
2222
2223 % this is left for backward compatibility...
2224 \ctikzset{straight/.is choice}
2225 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
2226 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
2227 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
2228 % never used, removed (RG 2020-05-17)
2229 % \ctikzset{straightvoltage value/.initial=true}
2230 % \ctikzset{straightvoltage/.style = {/tikz/circuitikz/straight=true}}
2231
2232 %
2233 % voltage is used also to set parameters, apart for the /.is choice
2234 % above. I hope it is ok --- would be a mess otherwise
2235 %
2236
2237 \ctikzset{voltage/distance from node/.initial=.5} %\pgf@circ@Rlen units
2238 \ctikzset{voltage/distance from line/.initial=.08} % pos, tra 0 e 1
2239 \ctikzset{voltage/bump a/.initial=1.2}
2240 \ctikzset{voltage/bump b/.initial=1.5}
2241 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
2242 \ctikzset{voltage shift/.style={voltage/shift=#1}}
2243 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
2244 \ctikzset{voltage/european label distance/.initial=1.4}
2245 \ctikzset{voltage/american label distance/.initial=1.1}
2246 % shaping the +/- sign, see pgfcircvoltage.tex
2247 \ctikzset{voltage/american font/.initial={}}
2248 \ctikzset{voltage/american plus/.initial={$+$}}
2249 \ctikzset{voltage/american minus/.initial={$-$}}
2250
2251 % special cases for voltage positions
2252 \ctikzset{bipoles/generic/voltage/distance from node/.initial=.4}
2253 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
2254 \ctikzset{bipoles/generic/voltage/european label distance/.initial=1.8}
2255 %\ctikzset{bipoles/thermocouple/voltage/distance from node/.initial=.3}
2256 \ctikzset{bipoles/thermocouple/voltage/bump b/.initial=2.2}
2257 \ctikzset{bipoles/thermocouple/voltage/european label distance/.initial=1.5}
2258 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
2259 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
2260 \ctikzset{bipoles/ageneric/voltage/european label distance/.initial=1.8}
2261 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
2262 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
2263 \ctikzset{bipoles/fullgeneric/voltage/european label distance/.initial=1.8}
2264 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
2265 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
2266 \ctikzset{bipoles/memristor/voltage/european label distance/.initial=1.8}
2267 %\ctikzset{bipoles/tline/voltage/distance from node/.initial=.2}
2268 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
2269 \ctikzset{bipoles/tline/voltage/european label distance/.initial=2.1}
2270 %\ctikzset{bipoles/varistor/voltage/distance from node/.initial=.2}
2271 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
2272 \ctikzset{bipoles/varistor/voltage/european label distance/.initial=2}
2273 %\ctikzset{bipoles/photoresistor/voltage/distance from node/.initial=.2}
2274 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=2}
2275 \ctikzset{bipoles/photoresistor/voltage/european label distance/.initial=1.8}
2276 %\ctikzset{bipoles/thermistor/voltage/distance from node/.initial=.2}
2277 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
2278 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=2}
2279 %\ctikzset{bipoles/thermistorntc/voltage/distance from node/.initial=.2}
2280 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
2281 %\ctikzset{bipoles/thermistorptc/voltage/distance from node/.initial=.2}
2282 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
2283 %
2284 % american open voltage adjusting
2285 %
2286 \newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue
2287 \ctikzset{american open voltage/.is choice}
2288 \ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}}
2289 \ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}}
2290
2291 %
2292 % currents
2293 %
2294 \ctikzset{current/distance/.initial = .5}
2295
2296 %
2297 % voltage and current styles
2298 %
2299
2300 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
2301 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
2302 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
2303 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
2304 \tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
2305 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
2306 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}
2307
2308 \newif\ifpgf@circuit@europeangfsurgearrester
2309 \ctikzset{gas filled surge arrester choice/.is choice}
2310 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
2311 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
2312
2313 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
2314 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
2315 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
2316 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
2317 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
2318 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
2319 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
2320
2321 %
2322 % general styles
2323 %
2324
2325 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
2326 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
2327 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
2328
2329
2330 % noise sources
2331 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
2332
2333 \ctikzset{label/align/.is choice}
2334 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
2335 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
2336 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
2337
2338 % seven segment displays by RGtti
2339
2340 \newif\ifpgf@circ@sevenseg@dot
2341 \newif\ifpgf@circ@sevenseg@box
2342 \def\pgf@circ@sevenseg@dotstate{empty}
2343 \ctikzset{seven seg/.is family}
2344 \ctikzset{seven seg/dot/.is choice}
2345 % none means no dot, not space for it. Empty means no dot, but space
2346 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
2347 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
2348 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
2349 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
2350 %
2351 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
2352 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
2353 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
2354 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
2355 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
2356 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
2357 \ctikzset{seven seg/box/.is choice}
2358 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
2359 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
2360
2361 \ctikzset{seven seg/bits/.initial=0000000}
2362
2363 \ctikzset{seven seg/value/.code={%
2364 \edef\@@tmp{#1}%
2365 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
2366 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
2367 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
2368 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
2369 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
2370 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
2371 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
2372 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
2373 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
2374 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
2375 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2376 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2377 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2378 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2379 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2380 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2381 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2382 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2383 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2384 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2385 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2386 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2387 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
2388 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
2389 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
2390 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
2391 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
2392 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
2393 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
2394 }}
2395
2396 \tikzset{%
2397 seven segment val/.style args={#1dot#2box#3}{%
2398 shape=bare7seg,
2399 /tikz/circuitikz/seven seg/value=#1,
2400 /tikz/circuitikz/seven seg/dot=#2,
2401 /tikz/circuitikz/seven seg/box=#3,
2402 },
2403 seven segment bits/.style args={#1dot#2box#3}{%
2404 shape=bare7seg,
2405 /tikz/circuitikz/seven seg/bits=#1,
2406 /tikz/circuitikz/seven seg/dot=#2,
2407 /tikz/circuitikz/seven seg/box=#3,
2408 },
2409 }
2410
2411
2412 %%%%%%%%%% new
2413 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
2414
2415 % Electronic tubes: diodetube, triode, tetrode and pentode
2416 \ctikzset{tubes/width/.initial=1} % relative width
2417 \ctikzset{tubes/height/.initial=1.4} % relative height
2418 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
2419 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
2420 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
2421 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
2422 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
2423 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
2424 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
2425 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
2426 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
2427 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
2428 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
2429 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
2430 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
2431
2432 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
2433 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
2434 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
2435 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
2436 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
2437 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
2438 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
2439 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
2440 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
2441
2442 % powerelectronic blocks
2443 \ctikzset{bipoles/sacdc/width/.initial=.7}
2444 \ctikzset{bipoles/sdcac/width/.initial=.7}
2445 \ctikzset{bipoles/tacdc/width/.initial=.7}
2446 \ctikzset{bipoles/tdcac/width/.initial=.7}
2447 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
2448
2449 %%%---------- close: tex/pgfcirc.defines
2450 %%%%%%%%%%% Springe nach tex/pgfcircutils
2451 %%%---------- open: tex/pgfcircutils.tex
2452 % Copyright 2018-2026 by Romano Giannetti
2453 % Copyright 2015-2026 by Stefan Lindner
2454 % Copyright 2013-2026 by Stefan Erhardt
2455 % Copyright 2007-2026 by Massimo Redaelli
2456 %
2457 % This file may be distributed and/or modified
2458 %
2459 % 1. under the LaTeX Project Public License and/or
2460 % 2. under the GNU Public License.
2461 %
2462 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2463
2464 \def\pgf@circ@handleSI#1{
2465 \noexpandarg
2466 \def\pgf@temp{}
2467 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
2468 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
2469
2470 \ifnum\pgf@circ@handleSI@unit@len=0
2471 \pgf@circ@siunitx@resfalse
2472 \else
2473 \IfEndWith{#1}{>}{
2474 \pgf@circ@siunitx@restrue
2475 \noexpandarg
2476 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
2477 %\typeout{si |#1|}
2478 }{
2479 \pgf@circ@siunitx@resfalse
2480 %\typeout{no si |#1|}
2481 }
2482 \fi
2483 }
2484
2485 \def\pgf@circ@ifkeyempty#1{
2486 \pgfextra{
2487 \ctikzset{#1/.get=\pgf@circ@temp}
2488 \edef\pgf@temp{}
2489 }
2490 \ifx\pgf@circ@temp\pgf@temp
2491 }
2492
2493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2494 %% Math routines
2495
2496 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
2497
2498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2499 %% useful commands
2500
2501 \ifpgfutil@format@is@latex
2502 %% flipping text
2503 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
2504 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
2505 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
2506 % text mode overbar
2507 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2508 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
2509 \else\ifpgfutil@format@is@plain
2510 % text mode overbar
2511 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2512 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2513 \else\ifpgfutil@format@is@context
2514 % text mode overbar
2515 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
2516 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
2517 \fi\fi\fi
2518
2519 %%%%%%%%%%%%%%%%%%%%%%%%%%%
2520 %% switch to use fpu in reciprocal scale transformations
2521 %%
2522 %% this code has been contributed by Schrödinger's cat
2523 %% https://tex.stackexchange.com/a/529159/38080
2524 %%
2525 \tikzset{use fpu reciprocal/.code={%
2526 \def\pgfmathreciprocal@##1{%
2527 \begingroup
2528 \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
2529 \pgfmathparse{1/##1}%
2530 \pgfmath@smuggleone\pgfmathresult
2531 \endgroup
2532 }}}%
2533
2534 %%%---------- close: tex/pgfcircutils
2535
2536 %%%%%%%%%%% Springe nach tex/pgfcircshapes
2537 %%%---------- open: tex/pgfcircshapes.tex
2538 % Copyright 2018-2026 by Romano Giannetti
2539 % Copyright 2015-2026 by Stefan Lindner
2540 % Copyright 2013-2026 by Stefan Erhardt
2541 % Copyright 2007-2026 by Massimo Redaelli
2542 %
2543 % This file may be distributed and/or modified
2544 %
2545 % 1. under the LaTeX Project Public License and/or
2546 % 2. under the GNU Public License.
2547 %
2548 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2549
2550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2551 %% Other shapes
2552
2553 %% Nothing
2554
2555 \pgfdeclareshape{emptyshape}{
2556 \savedanchor{\northeast}{%
2557 \pgf@x=.5\wd\pgfnodeparttextbox%
2558 \pgf@y=.5\ht\pgfnodeparttextbox%
2559 }
2560 \anchor{north}{\northeast\pgf@x=0cm\relax}
2561 \anchor{east}{\northeast\pgf@y=0cm\relax}
2562 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2563 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2564 \anchor{north east}{\northeast}
2565 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2566 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2567 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2568 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
2569 \anchor{center}{
2570 \pgfpointorigin
2571 }
2572 }
2573 %
2574 % Provision for changing opacity. Only expert use, see the manual.
2575 %
2576 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
2577 \tikzset{open poles opacity/.code={%
2578 \ctikzset{poles/open fill opacity=#1}%
2579 }}
2580 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
2581 \tikzset{full poles opacity/.code={%
2582 \ctikzset{poles/full fill opacity=#1}%
2583 }}
2584
2585 %% Full terminal
2586
2587 \pgfdeclareshape{circ}{
2588 \anchor{center}{
2589 \pgfpointorigin
2590 }
2591 \savedanchor\northwest{%
2592 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2593 \pgf@x=-\pgf@y
2594 }
2595 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2596 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2597 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2598 \anchor{west}{ \northwest \pgf@y=0pt }
2599 \anchor{w}{ \northwest \pgf@y=0pt }
2600 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2601 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2602 \anchor{north}{ \northwest \pgf@x=0pt }
2603 \anchor{n}{ \northwest \pgf@x=0pt }
2604 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2605 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2606 \anchor{north west}{ \northwest }
2607 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2608 \anchorborder{
2609 \pgf@circ@res@left=\pgf@x
2610 \pgf@circ@res@up=\pgf@y
2611 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2612 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2613 }
2614 \behindforegroundpath{
2615
2616 \pgfscope
2617 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2618 \pgfsetcolor{\ctikzvalof{color}}
2619 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2620 \pgfusepath{draw,fill}
2621 \endpgfscope
2622
2623 }
2624 }
2625
2626 %% Empty round terminal
2627
2628 \pgfdeclareshape{ocirc}{
2629 \anchor{center}{
2630 \pgfpointorigin
2631 }
2632 \savedanchor\northwest{%
2633 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2634 \pgf@x=-\pgf@y
2635 }
2636 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2637 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2638 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2639 \anchor{west}{ \northwest \pgf@y=0pt }
2640 \anchor{w}{ \northwest \pgf@y=0pt }
2641 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2642 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2643 \anchor{north}{ \northwest \pgf@x=0pt }
2644 \anchor{n}{ \northwest \pgf@x=0pt }
2645 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2646 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2647 \anchor{north west}{ \northwest }
2648 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2649 \anchorborder{
2650 \pgf@circ@res@left=\pgf@x
2651 \pgf@circ@res@up=\pgf@y
2652 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2653 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2654 }
2655
2656 \behindforegroundpath{
2657
2658 \pgfscope
2659 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2660 \pgfsetcolor{\ctikzvalof{color}}
2661 \ifx\tikz@fillcolor\pgfutil@empty
2662 % set the default fill color to white
2663 \pgfsetfillcolor{white}
2664 % ...but override it if the class is defined!
2665 % note that this element has no class, but will inherit it when used
2666 % into another component
2667 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2668 \else
2669 \pgfsetfillcolor{\tikz@fillcolor}
2670 \fi
2671 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2672 \pgfusepath{draw,fill}
2673 \endpgfscope
2674
2675 }
2676 }
2677
2678 %% Diamond terminal
2679
2680 \pgfdeclareshape{diamondpole}{
2681 \anchor{center}{
2682 \pgfpointorigin
2683 }
2684 \savedanchor\northwest{%
2685 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2686 \pgf@x=-\pgf@y
2687 }
2688 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2689 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2690 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2691 \anchor{west}{ \northwest \pgf@y=0pt }
2692 \anchor{w}{ \northwest \pgf@y=0pt }
2693 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2694 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2695 \anchor{north}{ \northwest \pgf@x=0pt }
2696 \anchor{n}{ \northwest \pgf@x=0pt }
2697 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2698 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2699 \anchor{north west}{ \northwest }
2700 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2701 \anchorborder{
2702 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2703 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2704 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2705 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2706 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2707 \pgfextracty{\pgf@circ@res@up}{\northwest}
2708 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2709 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2710 \pgfpointintersectionoflines
2711 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2712 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2713 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2714 \pgf@x=\@@switchx\pgf@x
2715 \pgf@y=\@@switchy\pgf@y
2716 }
2717 \behindforegroundpath{
2718 \pgfscope
2719 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2720 \pgftransformrotate{45}
2721 \pgfpathrectanglecorners
2722 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2723 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2724 \pgfsetcolor{\ctikzvalof{color}}
2725 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2726 \pgfusepath{draw,fill}
2727 \endpgfscope
2728 }
2729 }
2730
2731 %% Diamond terminal, unfilled
2732
2733 \pgfdeclareshape{odiamondpole}{
2734 \anchor{center}{
2735 \pgfpointorigin
2736 }
2737 \savedanchor\northwest{%
2738 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2739 \pgf@x=-\pgf@y
2740 }
2741 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2742 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2743 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2744 \anchor{west}{ \northwest \pgf@y=0pt }
2745 \anchor{w}{ \northwest \pgf@y=0pt }
2746 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2747 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2748 \anchor{north}{ \northwest \pgf@x=0pt }
2749 \anchor{n}{ \northwest \pgf@x=0pt }
2750 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2751 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2752 \anchor{north west}{ \northwest }
2753 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2754 \anchorborder{
2755 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2756 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2757 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2758 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2759 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2760 \pgfextracty{\pgf@circ@res@up}{\northwest}
2761 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2762 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2763 \pgfpointintersectionoflines
2764 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2765 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2766 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2767 \pgf@x=\@@switchx\pgf@x
2768 \pgf@y=\@@switchy\pgf@y
2769 }
2770 \behindforegroundpath{
2771 \pgfscope
2772 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2773 \pgftransformrotate{45}
2774 \pgfpathrectanglecorners
2775 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2776 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2777 \pgfsetcolor{\ctikzvalof{color}}
2778 \ifx\tikz@fillcolor\pgfutil@empty
2779 % set the default fill color to white
2780 \pgfsetfillcolor{white}
2781 % ...but override it if the class is defined!
2782 % note that this element has no class, but will inherit it when used
2783 % into another component
2784 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2785 \else
2786 \pgfsetfillcolor{\tikz@fillcolor}
2787 \fi
2788 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2789 \pgfusepath{draw,fill}
2790 \endpgfscope
2791 }
2792 }
2793
2794 %% square terminal, filled
2795
2796 \pgfdeclareshape{squarepole}{
2797 \anchor{center}{
2798 \pgfpointorigin
2799 }
2800 \savedanchor\northwest{%
2801 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2802 \pgf@x=-\pgf@y
2803 }
2804 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2805 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2806 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2807 \anchor{west}{ \northwest \pgf@y=0pt }
2808 \anchor{w}{ \northwest \pgf@y=0pt }
2809 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2810 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2811 \anchor{north}{ \northwest \pgf@x=0pt }
2812 \anchor{n}{ \northwest \pgf@x=0pt }
2813 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2814 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2815 \anchor{north west}{ \northwest }
2816 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2817 \anchorborder{
2818 \pgf@xa=\pgf@x
2819 \pgf@ya=\pgf@y
2820 \pgfextracty{\pgf@circ@res@up}{\northwest}
2821 \pgfpointborderrectangle
2822 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2823 {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}}
2824 }
2825 \behindforegroundpath{
2826 \pgfscope
2827 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2828 \pgfpathrectanglecorners
2829 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2830 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2831 \pgfsetcolor{\ctikzvalof{color}}
2832 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2833 \pgfusepath{draw,fill}
2834 \endpgfscope
2835 }
2836 }
2837 %% square terminal, unfilled
2838
2839 \pgfdeclareshape{osquarepole}{
2840 \anchor{center}{
2841 \pgfpointorigin
2842 }
2843 \savedanchor\northwest{%
2844 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2845 \pgf@x=-\pgf@y
2846 }
2847 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2848 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2849 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2850 \anchor{west}{ \northwest \pgf@y=0pt }
2851 \anchor{w}{ \northwest \pgf@y=0pt }
2852 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2853 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2854 \anchor{north}{ \northwest \pgf@x=0pt }
2855 \anchor{n}{ \northwest \pgf@x=0pt }
2856 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2857 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2858 \anchor{north west}{ \northwest }
2859 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2860 \anchorborder{
2861 \pgf@xa=\pgf@x
2862 \pgf@ya=\pgf@y
2863 \pgfextracty{\pgf@circ@res@up}{\northwest}
2864 \pgfpointborderrectangle
2865 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2866 {\pgfqpoint{\pgf@circ@res@up}{\pgfqpoint{\pgf@circ@res@up}}}
2867 }
2868 \behindforegroundpath{
2869 \pgfscope
2870 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2871 \pgfpathrectanglecorners
2872 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2873 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2874 \pgfsetcolor{\ctikzvalof{color}}
2875 \ifx\tikz@fillcolor\pgfutil@empty
2876 % set the default fill color to white
2877 \pgfsetfillcolor{white}
2878 % ...but override it if the class is defined!
2879 % note that this element has no class, but will inherit it when used
2880 % into another component
2881 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2882 \else
2883 \pgfsetfillcolor{\tikz@fillcolor}
2884 \fi
2885 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2886 \pgfusepath{draw,fill}
2887 \endpgfscope
2888 }
2889 }
2890 % BNC connector
2891
2892 \pgfdeclareshape{bnc}{
2893 \anchor{center}{
2894 \pgfpointorigin
2895 }
2896 % BNC size is 2.5 times the size of the internal "ocirc"
2897 \savedanchor\northwest{%
2898 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2899 \pgf@y=2.5\pgf@y
2900 \pgf@x=-\pgf@y
2901 }
2902 % center is on the opening
2903 \anchor{center}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2904 \anchor{zero}{ \pgfpointorigin }
2905 \anchor{hot}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2906 \anchor{shield}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2907 % geo-anchors
2908 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2909 \anchor{right}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
2910 \anchor{west}{ \northwest \pgf@y=0pt }
2911 \anchor{left}{ \northwest \pgf@y=0pt }
2912 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
2913 \anchor{north}{ \northwest \pgf@x=0pt }
2914 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
2915 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
2916 \anchor{north west}{ \northwest }
2917 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
2918 % put the node text above and centered
2919 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
2920 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
2921 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
2922 }
2923 }
2924 \anchorborder{
2925 \pgf@circ@res@left=\pgf@x
2926 \pgf@circ@res@up=\pgf@y
2927 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2928 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2929 }
2930 \behindforegroundpath{
2931 \pgfextracty{\pgf@circ@res@other}{\northwest}
2932 \pgf@circ@res@step=\ctikzvalof{nodes width}\pgf@circ@Rlen
2933 \pgfscope
2934 \pgfstartlinewidth=\pgflinewidth
2935 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
2936 \pgfsetcolor{\ctikzvalof{color}}
2937 % external circle
2938 \pgfscope
2939 % clipping path: first a rectangle bigger then the shape
2940 % to avoid problems with the line thickness
2941 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
2942 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
2943 % next the opening to the right
2944 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
2945 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
2946 % do the difference and clip before drawing
2947 \pgfseteorule
2948 \pgfusepath{clip}
2949 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
2950 \pgfusepath{draw}
2951 \endpgfscope
2952 % internal circle
2953 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
2954 \pgf@circ@draworfill
2955 % and the contact line to the right
2956 \pgfsetlinewidth{\pgfstartlinewidth}
2957 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2958 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
2959 \pgfusepath{draw}
2960 \endpgfscope
2961 }
2962 }
2963
2964 %% Fill for correct rectangular joins
2965
2966 \pgfdeclareshape{rectjoinfill}{
2967 \savedanchor{\northeast}{%
2968 \pgf@x=.5\pgflinewidth%
2969 \pgf@y=.5\pgflinewidth%
2970 }
2971 \anchor{north}{\northeast\pgf@x=0cm\relax}
2972 \anchor{east}{\northeast\pgf@y=0cm\relax}
2973 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2974 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2975 \anchor{north east}{\northeast}
2976 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2977 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2978 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2979 \anchor{center}{
2980 \pgfpointorigin
2981 }
2982 \anchorborder{
2983 \pgf@circ@res@left=\pgf@x
2984 \pgf@circ@res@up=\pgf@y
2985 }
2986 \behindforegroundpath{
2987 \pgfscope
2988 \pgfpathrectanglecorners
2989 {\pgfpoint{0}{.5\pgflinewidth}}
2990 {\pgfpoint{0}{-.5\pgflinewidth}}
2991 \pgfsetcolor{\ctikzvalof{color}}
2992 \pgfusepath{draw,fill}
2993 \endpgfscope
2994 }
2995 }
2996
2997 %% transistor arrow
2998
2999 \def\pgf@circ@find@linescale{
3000 % find the scale inverse of the scale factor: line width do not scale
3001 % with scale=..., transform shape so we have to counteract it.
3002 \iftikz@fullytransformed % this is true if `transform shape` is active
3003 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
3004 % Note that this trick is not working inside a `spy` environment...
3005 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
3006 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
3007 \else
3008 \pgfmathsetmacro{\@@factor}{1.0}
3009 \fi
3010 }
3011
3012 \pgfdeclareshape{trarrow}{%
3013 % this arrow is only filled but grows with the linewidth, more or less
3014 % like currarrow do
3015 \savedanchor{\northeast}{%
3016 \pgf@circ@res@step = \pgf@circ@Rlen
3017 \pgf@circ@find@linescale
3018 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3019 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
3020 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
3021 }
3022 % The arrow size should be more or less the same of a currarrow, which is
3023 % both filled and stroke, for backward output compatibility (more or less)
3024 %
3025 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
3026 % |-\__ currarrow as the tip at (W,0)
3027 % | | and the upper tail at (-0.7*W, 0.8*W)
3028 % | \__ it then "overshoot" do to the linew width L
3029 % | \__ xangle \alpha
3030 % ---0------->
3031 %
3032 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
3033 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
3034 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
3035 %
3036 \savedanchor{\northwest}{%
3037 \pgf@circ@res@step = \pgf@circ@Rlen
3038 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3039 \pgf@circ@find@linescale
3040 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
3041 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
3042 }
3043 \savedanchor{\tip}{%
3044 \pgf@circ@res@step = \pgf@circ@Rlen
3045 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3046 \pgf@circ@find@linescale
3047 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
3048 }
3049 \anchor{north}{\northeast\pgf@x=0cm\relax}
3050 \anchor{east}{\northeast\pgf@y=0cm\relax}
3051 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3052 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3053 \anchor{north east}{\northeast}
3054 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3055 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3056 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3057 \anchor{center}{
3058 \pgfpointorigin
3059 }
3060 \anchor{tip}{
3061 \tip
3062 }
3063 \anchor{btip}{% this anchor is behind the tip of half a linewidth
3064 \tip
3065 \pgf@circ@find@linescale
3066 \pgf@circ@res@temp=\@@factor\pgflinewidth
3067 \advance\pgf@x by -.5\pgf@circ@res@temp
3068 }
3069 \behindforegroundpath{
3070 \pgfscope
3071 \northwest
3072 \pgf@circ@res@up=\pgf@y
3073 \pgf@circ@res@left=\pgf@x
3074 \tip
3075 \pgf@circ@res@step = \pgf@x
3076 %
3077 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3078 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
3079 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
3080 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
3081 \pgfpathclose
3082 \pgfsetcolor{\ctikzvalof{color}}
3083 \pgfusepath{fill} % just fill
3084 \endpgfscope
3085 }
3086 }
3087
3088 %% Current arrow
3089
3090 \pgfdeclareshape{currarrow}{
3091 \savedanchor{\northeast}{%
3092 \pgf@circ@res@step = \pgf@circ@Rlen
3093 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3094 \pgf@x=.5\pgf@circ@res@step
3095 \pgf@y=\pgf@x%
3096 }
3097 \anchor{north}{\northeast\pgf@x=0cm\relax}
3098 \anchor{east}{\northeast\pgf@y=0cm\relax}
3099 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3100 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3101 \anchor{north east}{\northeast}
3102 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3103 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3104 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3105 \anchor{center}{
3106 \pgfpointorigin
3107 }
3108 \anchor{tip}{
3109 \pgfpointorigin
3110 \pgf@circ@res@step = \pgf@circ@Rlen
3111 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3112 \pgf@x =\pgf@circ@res@step
3113 }
3114 \behindforegroundpath{
3115 \pgfscope
3116 \pgf@circ@res@step = \pgf@circ@Rlen
3117 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3118
3119 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
3120 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3121 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
3122 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3123 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
3124 \pgfsetcolor{\ctikzvalof{color}}
3125 \pgfusepath{draw,fill}
3126
3127 \endpgfscope
3128 }
3129 }
3130
3131 %% Flow arrow
3132
3133 \pgfdeclareshape{flowarrow}{
3134 \savedanchor{\northeast}{%
3135 \pgf@circ@res@step = \pgf@circ@Rlen
3136 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3137 \pgf@y=.5\pgf@circ@res@step
3138 \pgf@circ@res@step = \pgf@circ@Rlen
3139 \divide \pgf@circ@res@step by 4
3140 \pgf@x=\pgf@circ@res@step%
3141 }
3142 \anchor{north}{\northeast\pgf@x=0cm\relax}
3143 \anchor{east}{\northeast\pgf@y=0cm\relax}
3144 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3145 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3146 \anchor{north east}{\northeast}
3147 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3148 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3149 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3150 \anchor{text}{% text centered above
3151 \pgfpointorigin
3152 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
3153 }
3154 \anchor{center}{
3155 \pgfpointorigin
3156 }
3157 \anchor{tip}{
3158 \pgfpointorigin
3159 \pgf@circ@res@step = \pgf@circ@Rlen
3160 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3161 \pgf@x =\pgf@circ@res@step
3162 }
3163 \behindforegroundpath{
3164 \pgfscope
3165 \pgf@circ@res@step = \pgf@circ@Rlen
3166 \divide \pgf@circ@res@step by 4
3167 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
3168 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
3169 \pgfsetcolor{\ctikzvalof{color}}
3170 \pgfusepath{draw}
3171 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
3172 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
3173 \endpgfscope
3174 }
3175 }
3176
3177 %% Input arrow
3178
3179 \pgfdeclareshape{inputarrow}{
3180 \savedanchor{\northeast}{% this is really not northeast, really -northwest
3181 \pgf@circ@res@step = \pgf@circ@Rlen
3182 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
3183 \pgf@y=.5\pgf@circ@res@step
3184 \pgf@x=1.7\pgf@circ@res@step
3185 }
3186 \anchor{north}{\northeast\pgf@x=0cm\relax}
3187 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
3188 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
3189 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
3190 \anchor{north east}{\northeast\pgf@x=0cm\relax}
3191 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3192 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
3193 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3194 \savedanchor{\tip}{
3195 \pgfpointorigin
3196 }
3197 \anchor{center}{
3198 \tip
3199 }
3200 \anchor{tip}{
3201 \tip
3202 }
3203 \behindforegroundpath{
3204
3205 \pgfscope
3206 \pgf@circ@res@step = \pgf@circ@Rlen
3207 \divide \pgf@circ@res@step by 16
3208
3209 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
3210 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3211 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
3212 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3213 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
3214 \pgfsetcolor{\ctikzvalof{color}}
3215 \pgfusepath{fill}
3216
3217 \endpgfscope
3218 }
3219 }
3220
3221
3222 %% box
3223
3224 \pgfdeclareshape{box}{
3225 \anchor{center}{
3226 \pgfpointorigin
3227 }
3228 \behindforegroundpath{
3229
3230 \pgfscope
3231 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
3232 \pgf@circ@res@step = 0.5\pgf@circ@res@step
3233 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3234 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
3235 \pgf@circ@draworfill
3236 \endpgfscope
3237 }
3238 }
3239
3240 %% box scaled with blocks
3241
3242 \pgfdeclareshape{blockbox}{
3243 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
3244 \anchor{center}{
3245 \pgfpointorigin
3246 }
3247 \behindforegroundpath{
3248 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
3249 \pgfscope
3250 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
3251 \pgf@circ@res@step = 0.5\pgf@circ@res@step
3252 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3253 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
3254 \pgf@circ@draworfill
3255 \endpgfscope
3256 }
3257 }
3258
3259 % full nodes for wire crossing
3260
3261 \pgfdeclareshape{jump crossing}
3262 {
3263 \savedanchor\northwest{%
3264 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
3265 \pgf@y=.5\pgf@y
3266 \pgf@x=-\pgf@y
3267 }
3268 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3269 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3270 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3271 \anchor{west}{ \northwest \pgf@y=0pt }
3272 \anchor{w}{ \northwest \pgf@y=0pt }
3273 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3274 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3275 \anchor{north}{ \northwest \pgf@x=0pt }
3276 \anchor{n}{ \northwest \pgf@x=0pt }
3277 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3278 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3279 \anchor{north west}{ \northwest }
3280 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3281 \behindbackgroundpath{
3282 \northwest
3283 \pgf@circ@res@up = \pgf@y
3284 \pgf@circ@res@down = -\pgf@y
3285 \pgf@circ@res@right = -\pgf@x
3286 \pgf@circ@res@left = \pgf@x
3287 % horizontal jumper
3288 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3289 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
3290 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
3291 \pgfsetbeveljoin
3292 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3293 % vertical, broken path
3294 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3295 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
3296 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
3297 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
3298 \pgfusepath{draw}
3299
3300 }
3301 }
3302 \pgfdeclareshape{plain crossing}
3303 {
3304 \savedanchor\northwest{%
3305 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
3306 \pgf@y=.5\pgf@y
3307 \pgf@x=-\pgf@y
3308 }
3309 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3310 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3311 \anchor{e}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
3312 \anchor{west}{ \northwest \pgf@y=0pt }
3313 \anchor{w}{ \northwest \pgf@y=0pt }
3314 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3315 \anchor{s}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
3316 \anchor{north}{ \northwest \pgf@x=0pt }
3317 \anchor{n}{ \northwest \pgf@x=0pt }
3318 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
3319 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
3320 \anchor{north west}{ \northwest }
3321 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
3322 \behindbackgroundpath{
3323 \northwest
3324 \pgf@circ@res@up = \pgf@y
3325 \pgf@circ@res@down = -\pgf@y
3326 \pgf@circ@res@right = -\pgf@x
3327 \pgf@circ@res@left = \pgf@x
3328 % horizontal jumper
3329 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3330 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3331 % vertical, broken path
3332 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3333 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
3334 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
3335 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
3336 \pgfusepath{draw}
3337
3338 }
3339 }
3340
3341 %%%---------- close: tex/pgfcircshapes
3342 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
3343 %%%---------- open: tex/pgfcircmonopoles.tex
3344 % Copyright 2018-2026 by Romano Giannetti
3345 % Copyright 2015-2026 by Stefan Lindner
3346 % Copyright 2013-2026 by Stefan Erhardt
3347 % Copyright 2007-2026 by Massimo Redaelli
3348 %
3349 % This file may be distributed and/or modified
3350 %
3351 % 1. under the LaTeX Project Public License and/or
3352 % 2. under the GNU Public License.
3353 %
3354 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
3355
3356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3357 %% Monopoles
3358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3359
3360 %%%%%%%%%%%%%
3361 %% Grounds
3362 %%%%%%%%%%%%%
3363
3364
3365 %% Ground symbol
3366 % #1 -> name
3367 % #2 -> width
3368 % #3 -> depth
3369 % #4 -> code
3370 \long\def\pgf@circ@declareground#1#2#3#4{
3371 \pgfdeclareshape{#1}{
3372 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
3373 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3374 \savedanchor{\southeast}{
3375 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3376 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3377 \pgf@x=#2\pgf@x
3378 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3379 \pgf@y=-#3\pgf@y
3380 }
3381 \anchor{north}{\pgfpointorigin}
3382 \anchor{north east}{\southeast\pgf@y=0pt\relax}
3383 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
3384 \anchor{south east}{\southeast}
3385 \anchor{south}{\southeast\pgf@x=0pt\relax}
3386 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3387 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
3388 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
3389 \anchor{left}{\pgfpointorigin}
3390 \anchor{right}{\pgfpointorigin}
3391 \anchor{center}{\pgfpointorigin}
3392 \behindforegroundpath{
3393 \pgf@circ@scaled@Rlen=\scaledRlen
3394 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3395 \pgfscope
3396 \pgfstartlinewidth=\pgflinewidth
3397 #4
3398 \endpgfscope
3399 }
3400 }
3401 }
3402
3403
3404 \pgf@circ@declareground{ground}{0.6}{1.6}{
3405 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3406 \pgfpathmoveto{\pgfpointorigin}
3407 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3408 \pgfusepath{draw}
3409 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3410 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3411 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3412 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3413 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3414 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3415 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3416 \pgfusepath{draw}
3417 }
3418
3419 \pgf@circ@declareground{tlground}{0.6}{0.4}{
3420 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3421 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3422 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3423 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3424 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3425 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3426 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3427 \pgfusepath{draw}
3428 }
3429
3430
3431 \pgf@circ@declareground{rground}{0.6}{1}{
3432 \pgfpathmoveto{\pgfpointorigin}
3433 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3434 \pgfusepath{draw}
3435
3436 \pgfstartlinewidth=\pgflinewidth
3437 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
3438
3439 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3440 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3441 \pgfsetroundcap\pgfusepath{draw}
3442 }
3443
3444 \pgf@circ@declareground{tground}{0.6}{0}{
3445 \pgfpathmoveto{\pgfpointorigin}
3446 \pgfusepath{draw}
3447
3448 \pgfstartlinewidth=\pgflinewidth
3449 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3450
3451 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3452 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3453 \pgfusepath{draw}
3454 }
3455
3456 \pgf@circ@declareground{sground}{0.6}{1.8}{
3457 \pgfpathmoveto{\pgfpointorigin}
3458 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3459 \pgfusepath{draw}
3460
3461 \pgfstartlinewidth=\pgflinewidth
3462 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3463
3464 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3465 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3466 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
3467 \pgfpathclose
3468 \pgf@circ@draworfill
3469 }
3470
3471 % noiseless ground
3472 \pgf@circ@declareground{nground}{0.9}{1.6}{
3473 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3474 \pgfpathmoveto{\pgfpointorigin}
3475 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3476 \pgfusepath{draw}
3477 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3478 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3479 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3480 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3481 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3482 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3483 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3484 \pgfusepath{draw}
3485 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3486 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
3487 \pgfusepath{draw}
3488 }
3489
3490 % protective ground
3491 \pgf@circ@declareground{pground}{0.9}{1.8}{
3492 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3493 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
3494 \pgf@circ@draworfill
3495 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3496 \pgfpathmoveto{\pgfpointorigin}
3497 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
3498 \pgfusepath{draw}
3499 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3500 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3501 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3502 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3503 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3504 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3505 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3506 \pgfusepath{draw}
3507 }
3508
3509 % chassis ground
3510 \pgf@circ@declareground{cground}{1}{2}{
3511 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3512 \pgfpathmoveto{\pgfpointorigin}
3513 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3514 \pgfusepath{draw}
3515 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3516 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3517 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3518 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3519 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3520 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3521 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3522 \pgfusepath{draw}
3523 }
3524
3525 % Contributed by @fotesan https://github.com/fotesan
3526 % european ground
3527 \pgf@circ@declareground{eground}{1.1}{1.7}{
3528 \pgfpathmoveto{\pgfpointorigin}
3529 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3530 \pgfusepath{draw}
3531
3532 \pgfstartlinewidth=\pgflinewidth
3533 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3534
3535 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3536 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3537 \pgfusepath{draw}
3538
3539 \pgfsetlinewidth{\pgfstartlinewidth}
3540 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3541 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3542 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3543 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3544 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3545 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3546 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3547 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3548 \pgfusepath{draw}
3549 }
3550
3551 \pgf@circ@declareground{eground2}{1.1}{1.7}{
3552 \pgfpathmoveto{\pgfpointorigin}
3553 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3554 \pgfusepath{draw}
3555
3556 \pgfstartlinewidth=\pgflinewidth
3557 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3558
3559 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3560 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3561 \pgfusepath{draw}
3562
3563 \pgfsetlinewidth{\pgfstartlinewidth}
3564 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3565 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3566 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3567 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3568 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3569 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3570 \pgfusepath{draw}
3571 }
3572
3573 %%%%%%%%%%%%%%%%%%
3574 %% Power supplies
3575 %%%%%%%%%%%%%%%%%%
3576
3577 % Vcc
3578 \pgfdeclareshape{vcc}{
3579 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3580 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3581 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3582 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3583 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3584 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3585 }
3586 \savedanchor{\northeast}{%
3587 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3588 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3589 \pgf@x=.5\pgf@circ@res@step
3590 \pgf@y=3\pgf@x%
3591 }
3592 \anchor{north}{\northeast\pgf@x=0cm\relax}
3593 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3594 \anchor{south}{\pgfpointorigin}
3595 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3596 \anchor{north east}{\northeast}
3597 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3598 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3599 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3600 \anchor{center}{\pgfpointorigin}
3601 \anchor{left}{\pgfpointorigin}
3602 \anchor{right}{\pgfpointorigin}
3603 \anchor{text}{
3604 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3605 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3606 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3607 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3608 \pgf@x=0pt
3609 \pgf@y=2\pgf@circ@res@step
3610 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
3611 \pgf@x=-.5\wd\pgfnodeparttextbox
3612 }
3613 \behindforegroundpath{
3614 \pgf@circ@scaled@Rlen=\scaledRlen
3615 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3616 \pgfscope
3617 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
3618 \ifx\pgf@temp\pgf@circ@temp
3619 \pgfstartlinewidth=\pgflinewidth
3620 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3621
3622 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3623 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
3624 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3625 \pgfusepath{draw}
3626
3627 \pgfsetlinewidth{\pgfstartlinewidth}
3628 \else
3629 \pgfsetarrowsend{\pgf@circ@temp}
3630 \fi
3631 \pgfpathmoveto{\pgfpointorigin}
3632 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
3633 \pgfusepath{draw}
3634 \endpgfscope
3635 }
3636 }
3637
3638 % Vee
3639 \pgfdeclareshape{vee}{
3640 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3641 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3642 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3643 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3644 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3645 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3646 }
3647 \savedanchor{\northeast}{%
3648 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3649 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3650 \pgf@x=.5\pgf@circ@res@step
3651 \pgf@y=-3\pgf@x%
3652 }
3653 \anchor{south}{\northeast\pgf@x=0cm\relax}
3654 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3655 \anchor{north}{\pgfpointorigin}
3656 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3657 \anchor{south east}{\northeast}
3658 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
3659 \anchor{north east}{\northeast\pgf@y=0pt\relax}
3660 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3661 \anchor{center}{\pgfpointorigin}
3662 \anchor{left}{\pgfpointorigin}
3663 \anchor{right}{\pgfpointorigin}
3664 \anchor{text}{
3665 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3666 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3667 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3668 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3669 \pgf@x=0pt
3670 \pgf@y=-2\pgf@circ@res@step
3671 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
3672 \pgf@x=-.5\wd\pgfnodeparttextbox
3673 }
3674
3675 \behindforegroundpath{
3676 \pgf@circ@scaled@Rlen=\scaledRlen
3677 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3678 \pgfscope
3679 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
3680 \ifx\pgf@temp\pgf@circ@temp
3681
3682 \pgfstartlinewidth=\pgflinewidth
3683 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3684
3685 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3686 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
3687 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3688 \pgfusepath{draw}
3689 \pgfsetlinewidth{\pgfstartlinewidth}
3690 \else
3691 \pgfsetarrowsend{\pgf@circ@temp}
3692 \fi
3693 \pgfpathmoveto{\pgfpointorigin}
3694 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3695 \pgfusepath{draw}
3696 \endpgfscope
3697 }
3698 }
3699
3700 %%%%%%%%%%%%%%%%
3701 %% RF elements
3702 %%%%%%%%%%%%%%%%
3703
3704 % Legacy tlinestub
3705 % Contributed by Leonardo Azzinnari
3706 \pgfdeclareshape{tlinestub}{
3707 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3708 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3709 \savedanchor{\northeast}{%
3710 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3711 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3712 \pgf@x=1.2\pgf@circ@res@step
3713 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3714 \pgf@y=.2\pgf@circ@res@step%
3715 }
3716 % the center is on the left side of the shape for facility of usage
3717 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3718 \anchor{east}{\northeast\pgf@y=0cm\relax}
3719 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
3720 \anchor{west}{\pgfpointorigin}
3721 \anchor{north east}{\northeast}
3722 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3723 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3724 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3725 \anchor{center}{\pgfpointorigin}
3726 \behindforegroundpath{
3727 \pgfstartlinewidth=\pgflinewidth
3728
3729 \pgf@circ@scaled@Rlen=\scaledRlen
3730 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3731 \pgf@circ@res@step=0.6\pgf@circ@scaled@Rlen
3732
3733 \pgfscope\begin{pgftransparencygroup}
3734 \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3735 \pgf@circ@maybefill
3736 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3737 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3738 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3739 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3740 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3741 \pgf@circ@draworfill
3742 \pgfpathellipse{\pgfpoint{0.5\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0.125\pgf@circ@res@step}{0\pgf@circ@res@step}}{\pgfpoint{0\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3743 \pgfusepath{draw}
3744 \end{pgftransparencygroup} \endpgfscope
3745 \pgfpathmoveto{\pgfpointorigin}
3746 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3747 \pgfusepath{draw}
3748 }
3749 }
3750
3751 %% New antennas without tails
3752
3753 % main body of antennas
3754 \def\pgf@circ@antennabody{%
3755 \pgfstartlinewidth=\pgflinewidth
3756 \pgf@circ@scaled@Rlen=\scaledRlen
3757 \pgfsetcolor{\ctikzvalof{color}}
3758 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3759 \pgfscope
3760 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3761 \pgfpathmoveto{\pgfpointorigin}
3762 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3763 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3764 \pgfsetbeveljoin
3765 \pgfpathclose
3766 \pgf@circ@draworfill
3767 \endpgfscope
3768 \pgfsetlinewidth{\pgfstartlinewidth}
3769 \pgfpathmoveto{\pgfpointorigin}
3770 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3771 \pgfusepath{draw}
3772 }
3773
3774 % Waves for the antennas.
3775 \def\pgf@circ@antennawaves{%
3776 \pgfscope
3777 % define a triangle for clipping the waves
3778 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3779 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3780 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3781 \pgfpathclose
3782 \pgfusepath{clip}
3783 % ...and build the waves as clipped circles
3784 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3785 \pgfmathloop%
3786 \ifnum\pgf@circ@count@a>2
3787 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3788 \advance\pgf@circ@count@a-1\relax%
3789 \repeatpgfmathloop
3790 \pgfusepath{draw}
3791 \endpgfscope
3792 }
3793
3794 % additional shape with the waves
3795 \pgfdeclareshape{waves}{
3796 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3797 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3798 \anchor{center}{\pgfpointorigin}
3799 \savedanchor{\northeast}{
3800 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3801 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3802 \pgf@x=\pgf@circ@res@step
3803 \pgf@y=\pgf@circ@res@step
3804 }
3805 \anchor{text}{
3806 \northeast
3807 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3808 }
3809 \anchor{top}{\northeast\pgf@x=0pt}
3810 \anchor{right}{\northeast\pgf@y=0pt}
3811 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3812 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3813 \anchor{north}{\northeast\pgf@x=0pt}
3814 \anchor{north east}{\northeast}
3815 \anchor{east}{\northeast\pgf@y=0pt}
3816 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3817 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3818 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3819 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3820 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3821 \behindforegroundpath{
3822 \pgf@circ@scaled@Rlen=\scaledRlen
3823 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3824 \pgf@circ@res@step=0.5\pgf@circ@res@step
3825 \pgfsetcolor{\ctikzvalof{color}}
3826 \pgfscope
3827 % define a triangle for clipping the waves
3828 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3829 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
3830 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
3831 \pgfpathclose
3832 \pgfusepath{clip}
3833 % ...and build the waves as clipped circles
3834 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3835 \pgfmathloop%
3836 \ifnum\c@pgf@counta>1
3837 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3838 \advance\c@pgf@counta-1\relax%
3839 \repeatpgfmathloop
3840 \pgfusepath{draw}
3841 \endpgfscope
3842 }
3843 }
3844
3845 % the three types of antennas: simple, TX, RX. Notice that you can flip them...
3846
3847 \pgfdeclareshape{bareantenna}{
3848 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3849 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3850 \anchor{center}{\pgfpointorigin}
3851 \savedanchor{\northeast}{
3852 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3853 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3854 \pgf@x=\pgf@circ@res@step
3855 \pgf@y=2\pgf@circ@res@step
3856 }
3857 \anchor{text}{
3858 \northeast
3859 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3860 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3861 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3862 }
3863 \anchor{top}{\northeast\pgf@x=0pt}
3864 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3865 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3866 \anchor{bottom}{\pgfpointorigin}
3867 \anchor{north}{\northeast\pgf@x=0pt}
3868 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3869 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3870 \anchor{south}{\pgfpointorigin}
3871 \anchor{north east}{\northeast}
3872 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3873 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3874 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3875 \behindforegroundpath{
3876 \pgf@circ@antennabody
3877 }
3878 }
3879
3880 \pgfdeclareshape{bareTXantenna}{
3881 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3882 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3883 \anchor{center}{\pgfpointorigin}
3884 \savedanchor{\northeast}{
3885 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3886 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3887 \pgf@x=\pgf@circ@res@step
3888 \pgf@y=2\pgf@circ@res@step
3889 }
3890 \savedanchor{\savedwaves}{
3891 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3892 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3893 \pgf@x=4.2\pgf@circ@res@step
3894 \pgf@y=\pgf@circ@res@step
3895 }
3896 \anchor{text}{
3897 \northeast
3898 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3899 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3900 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
3901 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3902 }
3903 \anchor{waves}{\savedwaves}
3904 \anchor{top}{\northeast\pgf@x=0pt}
3905 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3906 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3907 \anchor{bottom}{\pgfpointorigin}
3908 \anchor{north}{\northeast\pgf@x=0pt}
3909 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3910 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3911 \anchor{south}{\pgfpointorigin}
3912 \anchor{north east}{\northeast}
3913 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3914 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3915 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3916 \behindforegroundpath{
3917 \pgf@circ@antennabody
3918 \pgf@circ@antennawaves
3919 }
3920 }
3921
3922 \pgfdeclareshape{bareRXantenna}{
3923 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3924 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3925 \anchor{center}{\pgfpointorigin}
3926 \savedanchor{\northeast}{
3927 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3928 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3929 \pgf@x=\pgf@circ@res@step
3930 \pgf@y=2\pgf@circ@res@step
3931 }
3932 \savedanchor{\savedwaves}{
3933 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3934 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3935 \pgf@x=-4.2\pgf@circ@res@step
3936 \pgf@y=\pgf@circ@res@step
3937 }
3938 \anchor{text}{
3939 \northeast
3940 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3941 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3942 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3943 }
3944 \anchor{waves}{\savedwaves}
3945 \anchor{top}{\northeast\pgf@x=0pt}
3946 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3947 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3948 \anchor{bottom}{\pgfpointorigin}
3949 \anchor{north}{\northeast\pgf@x=0pt}
3950 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3951 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3952 \anchor{south}{\pgfpointorigin}
3953 \anchor{north east}{\northeast}
3954 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3955 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3956 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3957 \behindforegroundpath{
3958 \pgf@circ@antennabody
3959 \pgftransformxshift{-5.2\pgf@circ@res@step}
3960 \pgf@circ@antennawaves
3961 }
3962 }
3963
3964 % Microstrip monopoles
3965
3966 \pgfdeclareshape{mslstub}{
3967 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3968 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3969 \savedanchor{\southeast}{
3970 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3971 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3972 \pgf@x=.5\pgf@x
3973 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3974 \pgf@y=-.5\pgf@y
3975 }
3976 \savedanchor{\northwest}{
3977 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3978 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
3979 \pgf@x=-.5\pgf@x
3980 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
3981 \pgf@y=.5\pgf@y
3982 }
3983 \anchor{north}{\northwest\pgf@x=0pt\relax}
3984 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
3985 \anchor{east}{\southeast\pgf@y=0pt\relax}
3986 \anchor{south east}{\southeast}
3987 \anchor{south}{\southeast\pgf@x=0pt\relax}
3988 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3989 \anchor{west}{\northwest\pgf@y=0pt\relax}
3990 \anchor{north west}{\northwest}
3991 %
3992 \anchor{center}{\northwest\pgf@y=0pt\relax}
3993 \anchor{left}{\northwest\pgf@y=0pt\relax}
3994 \anchor{right}{\southeast\pgf@y=0pt\relax}
3995 % put the node text above and centered
3996 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3997 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3998 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3999 }
4000 }
4001 \behindbackgroundpath{
4002 \pgfextracty{\pgf@circ@res@up}{\northwest}
4003 \pgfextractx{\pgf@circ@res@right}{\southeast}
4004 \pgfextractx{\pgf@circ@res@left}{\northwest}
4005 \pgfextracty{\pgf@circ@res@down}{\southeast}
4006 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
4007 \pgfstartlinewidth=\pgflinewidth
4008 \pgfscope
4009 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4010 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4011 \pgf@circ@draworfill
4012 \endpgfscope
4013 }
4014 }
4015
4016 \pgfdeclareshape{msrstub}{
4017 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4018 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4019 \savedanchor{\southeast}{
4020 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4021 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
4022 \pgf@x=.5\pgf@x
4023 \pgf@y=0pt\relax
4024 }
4025 \savedanchor{\northwest}{
4026 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4027 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
4028 \pgf@x=-.5\pgf@x
4029 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
4030 \pgf@y=.5\pgf@y
4031 }
4032 \anchor{north}{\northwest\pgf@x=0pt\relax}
4033 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4034 \anchor{east}{\southeast\pgf@y=0pt\relax}
4035 \anchor{south east}{\southeast}
4036 \anchor{south}{\southeast\pgf@x=0pt\relax}
4037 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4038 \anchor{west}{\northwest\pgf@y=0pt\relax}
4039 \anchor{north west}{\northwest}
4040 %
4041 \anchor{center}{\pgfpointorigin}
4042 \anchor{left}{\pgfpointorigin}
4043 \anchor{right}{\pgfpointorigin}
4044 % put the node text above and centered
4045 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4046 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4047 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
4048 }
4049 }
4050 \behindbackgroundpath{
4051 \pgfextracty{\pgf@circ@res@up}{\northwest}
4052 \pgfextractx{\pgf@circ@res@right}{\southeast}
4053 \pgfextractx{\pgf@circ@res@left}{\northwest}
4054 \pgfextracty{\pgf@circ@res@down}{\southeast}
4055 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
4056 \pgfstartlinewidth=\pgflinewidth
4057 \pgfscope
4058 \pgfpathmoveto{\pgfpointorigin}
4059 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
4060 \pgfusepath{draw}
4061 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4062 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
4063 \pgfpatharc{135}{45}{\pgf@circ@res@step}
4064 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
4065 \pgfpatharc{45}{135}{\pgf@circ@res@up}
4066 \pgfclosepath
4067 \pgf@circ@draworfill
4068 \endpgfscope
4069 }
4070 }
4071
4072 \pgfdeclareshape{msport}{
4073 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4074 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4075 \savedanchor{\southeast}{
4076 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4077 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4078 \pgf@x=.5\pgf@x
4079 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4080 \pgf@y=-.5\pgf@y
4081 }
4082 \savedanchor{\northwest}{
4083 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4084 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4085 \pgf@x=-.5\pgf@x
4086 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4087 \pgf@y=.5\pgf@y
4088 }
4089 \anchor{north}{\northwest\pgf@x=0pt\relax}
4090 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4091 \anchor{east}{\southeast\pgf@y=0pt\relax}
4092 \anchor{south east}{\southeast}
4093 \anchor{south}{\southeast\pgf@x=0pt\relax}
4094 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4095 \anchor{west}{\northwest\pgf@y=0pt\relax}
4096 \anchor{north west}{\northwest}
4097 %
4098 \anchor{center}{\northwest\pgf@y=0pt\relax}
4099 \anchor{left}{\northwest\pgf@y=0pt\relax}
4100 \anchor{right}{\southeast\pgf@y=0pt\relax}
4101 % put the node text above and centered
4102 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4103 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4104 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4105 }
4106 }
4107 \behindbackgroundpath{
4108 \pgfextracty{\pgf@circ@res@up}{\northwest}
4109 \pgfextractx{\pgf@circ@res@right}{\southeast}
4110 \pgfextractx{\pgf@circ@res@left}{\northwest}
4111 \pgfextracty{\pgf@circ@res@down}{\southeast}
4112 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
4113 \pgfstartlinewidth=\pgflinewidth
4114 \pgfscope
4115 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4116 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4117 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
4118 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4119 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4120 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
4121 \pgfpathclose
4122 \pgf@circ@draworfill
4123 \endpgfscope
4124 }
4125 }
4126
4127 % Legacy antennas (with tails)
4128 \def\pgf@circ@shift@antenna@xy#1#2{%
4129 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
4130 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
4131 \relax}
4132
4133 % Legacy antenna
4134 \pgfdeclareshape{antenna}{
4135 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4136 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4137 \anchor{center}{\pgfpointorigin}
4138 \savedanchor{\northeast}{
4139 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4140 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4141 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4142 \pgf@y=4\pgf@circ@res@step
4143 }
4144 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
4145 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
4146 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
4147 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
4148 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4149 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4150 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
4151 \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}}
4152 \anchor{text}{
4153 \northeast
4154 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
4155 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
4156 }
4157 \behindforegroundpath{
4158 \pgfstartlinewidth=\pgflinewidth
4159 \pgf@circ@scaled@Rlen=\scaledRlen
4160 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4161
4162 \pgftransformxshift{ -4\pgf@circ@res@step }
4163
4164 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4165 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4166
4167 \pgfusepath{draw}
4168
4169 \pgfscope
4170 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4171 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4172 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4173 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4174 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4175 \pgfsetcolor{\ctikzvalof{color}}
4176 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4177 \pgfusepath{draw}
4178 \endpgfscope
4179 \pgfsetlinewidth{\pgfstartlinewidth}
4180
4181 }
4182 }
4183
4184 % Legacy TX antenna
4185 \pgfdeclareshape{txantenna}{
4186 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4187 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4188 \anchor{center}{\pgfpointorigin}
4189 \savedanchor{\northeast}{
4190 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4191 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4192 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4193 \pgf@y=4\pgf@circ@res@step
4194 }
4195 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4196 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4197 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4198 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4199 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4200 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4201 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4202 \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}}
4203 \anchor{text}{
4204 \northeast
4205 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
4206 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
4207 }
4208 \behindforegroundpath{
4209 \pgfstartlinewidth=\pgflinewidth
4210 \pgf@circ@scaled@Rlen=\scaledRlen
4211 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
4212
4213 \pgfpathmoveto{\pgfpointorigin}
4214 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4215 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4216 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4217
4218 \pgfusepath{draw}
4219
4220 \pgfscope
4221 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4222 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4223 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4224 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4225 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4226 \pgfsetcolor{\ctikzvalof{color}}
4227 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4228 \pgfusepath{draw}
4229 \endpgfscope
4230 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
4231 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4232 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4233 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
4234 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4235 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
4236 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4237 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
4238 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
4239 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
4240 \pgfusepath{draw}
4241 \pgfsetlinewidth{\pgfstartlinewidth}
4242
4243 }
4244 }
4245
4246 % Legacy RX antenna
4247 \pgfdeclareshape{rxantenna}{
4248 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4249 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4250 \anchor{center}{\pgfpointorigin}
4251 \savedanchor{\northeast}{
4252 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4253 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4254 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4255 \pgf@y=4\pgf@circ@res@step
4256 }
4257 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4258 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4259 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4260 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4261 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4262 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4263 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4264 \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}}
4265 \anchor{text}{
4266 \northeast
4267 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
4268 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
4269 }
4270 \behindforegroundpath{
4271 \pgfstartlinewidth=\pgflinewidth
4272 \pgf@circ@scaled@Rlen=\scaledRlen
4273 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
4274
4275 \pgfpathmoveto{\pgfpointorigin}
4276 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4277 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4278 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4279
4280 \pgfusepath{draw}
4281
4282 \pgfscope
4283 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4284 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4285 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4286 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4287 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4288 \pgfsetcolor{\ctikzvalof{color}}
4289 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4290 \pgfusepath{draw}
4291 \endpgfscope
4292
4293 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
4294 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4295 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4296 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
4297 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4298 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
4299 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4300 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
4301 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
4302 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
4303 \pgfusepath{draw}
4304 \pgfsetlinewidth{\pgfstartlinewidth}
4305 }
4306 }
4307
4308 % Legacy match
4309 \pgfdeclareshape{match}{
4310 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4311 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4312 \savedanchor{\northeast}{%
4313 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4314 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4315 \pgf@x=2\pgf@circ@res@step
4316 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4317 \pgf@y=.5\pgf@circ@res@step%
4318 }
4319 % the center is on the left side of the shape for facility of usage
4320 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
4321 \anchor{east}{\northeast\pgf@y=0cm\relax}
4322 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
4323 \anchor{west}{\pgfpointorigin}
4324 \anchor{north east}{\northeast}
4325 \anchor{north west}{\northeast\pgf@x=0cm\relax}
4326 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4327 \anchor{south west}{\pgfpointorigin}
4328 \anchor{center}{
4329 \pgfpointorigin
4330 }
4331 \anchor{text}{
4332 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4333 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4334 \pgf@x=1.5\pgf@x
4335 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
4336 \pgf@y=-1.5\ht\pgfnodeparttextbox
4337 }
4338 \behindforegroundpath{
4339 \pgf@circ@scaled@Rlen=\scaledRlen
4340 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4341
4342 \pgfscope
4343 \pgfpathmoveto{\pgfpointorigin}
4344 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
4345 \pgfusepath{draw}
4346
4347 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4348 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
4349 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
4350 \pgfusepath{fill}
4351
4352 \pgfsetlinewidth{\pgfstartlinewidth}
4353 \endpgfscope
4354 }
4355 }
4356
4357 %%%---------- close: tex/pgfcircmonopoles
4358 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
4359 %%%---------- open: tex/pgfcircbipoles.tex
4360 % Copyright 2018-2026 by Romano Giannetti
4361 % Copyright 2015-2026 by Stefan Lindner
4362 % Copyright 2013-2026 by Stefan Erhardt
4363 % Copyright 2007-2026 by Massimo Redaelli
4364 %
4365 % This file may be distributed and/or modified
4366 %
4367 % 1. under the LaTeX Project Public License and/or
4368 % 2. under the GNU Public License.
4369 %
4370 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
4371
4372 %% Generic macro for defining a bipole shape
4373 % #1 - additional anchors
4374 % #2 - lower y-size of the bipole (from the center).
4375 % #3 - #shape is the name of the shape
4376 % #4 - upper y-size of the bipole (from the center)
4377 % #5 - width of the bipole
4378 % #6 - macros drawing the bipole
4379 %
4380 \long\def\pgfcircdeclarebipole{%
4381 \pgfcircdeclarebipolescaled{default}}
4382
4383 %% Generic macro for defining a bipole shape
4384 % #1 - scale factor
4385 % #2 - additional anchors
4386 % #3 - lower y-size of the bipole (from the center).
4387 % #4 - #shape is the name of the shape
4388 % #5 - upper y-size of the bipole (from the center)
4389 % #6 - width of the bipole
4390 % #7 - macros drawing the bipole
4391 %
4392 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
4393 \pgfdeclareshape{#4shape}{
4394 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
4395 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4396 \savedanchor{\northeast}{
4397 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4398 \pgf@y=#5\pgf@circ@scaled@Rlen
4399 \pgf@y=.5\pgf@y
4400 \pgf@x=#6\pgf@circ@scaled@Rlen
4401 \pgf@x=.5\pgf@x
4402 }
4403 \savedanchor{\northeastborder}{
4404 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4405 \pgf@y=#5\pgf@circ@scaled@Rlen
4406 \pgf@y=.5\pgf@y
4407 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
4408 \pgf@x=#6\pgf@circ@scaled@Rlen
4409 \pgf@x=.5\pgf@x
4410 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
4411 }
4412 \savedanchor{\southwestborder}{
4413 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4414 \pgf@y=-#3\pgf@circ@scaled@Rlen
4415 \pgf@y=.5\pgf@y
4416 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
4417 \pgf@x=-#6\pgf@circ@scaled@Rlen
4418 \pgf@x=.5\pgf@x
4419 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
4420 }
4421 \savedanchor{\southwest}{
4422 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4423 \pgf@y=-#3\pgf@circ@scaled@Rlen
4424 \pgf@y=.5\pgf@y
4425 \pgf@x=-#6\pgf@circ@scaled@Rlen
4426 \pgf@x=.5\pgf@x
4427 }
4428 \savedanchor{\centerpoint}{
4429 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4430 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
4431 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
4432 \pgfpointorigin
4433 \pgf@y=\pgf@circ@res@up
4434 \advance\pgf@y by\pgf@circ@res@down
4435 \pgf@y=.5\pgf@y
4436 }
4437 \anchor{center}{\pgfpointorigin}
4438 \anchor{n}{
4439 \northeast
4440 \pgf@x=0cm
4441 }
4442 \anchor{north east}{
4443 \northeast
4444 }
4445 \anchor{north west}{
4446 \northeast
4447 \pgf@x=-\pgf@x
4448 }
4449 \anchor{ne}{
4450 \northeast
4451 }
4452 \anchor{nw}{
4453 \northeast
4454 \pgf@x=-\pgf@x
4455 }
4456 \anchor{e}{
4457 \northeast
4458 \pgf@y=0cm
4459 }
4460 \anchor{s}{
4461 \southwest
4462 \pgf@x=0cm
4463 }
4464 \anchor{south east}{
4465 \southwest
4466 \pgf@x=-\pgf@x
4467 }
4468 \anchor{south west}{
4469 \southwest
4470 }
4471 \anchor{se}{
4472 \southwest
4473 \pgf@x=-\pgf@x
4474 }
4475 \anchor{sw}{
4476 \southwest
4477 }
4478 \anchor{w}{
4479 \southwest
4480 \pgf@y=0cm
4481 }
4482 \anchor{north}{
4483 \northeast
4484 \pgf@x=0cm
4485 }
4486 \anchor{east}{
4487 \northeast
4488 \pgf@y=0cm
4489 }
4490 \anchor{south}{
4491 \southwest
4492 \pgf@x=0cm
4493 }
4494 \anchor{west}{
4495 \southwest
4496 \pgf@y=0cm
4497 }
4498 \anchor{right}{
4499 \northeast
4500 \pgf@y=0cm
4501 }
4502 \anchor{above}{
4503 \northeast
4504 \pgf@x=0cm
4505 }
4506 \anchor{left}{
4507 \southwest
4508 \pgf@y=0cm
4509 }
4510 \anchor{below}{
4511 \southwest
4512 \pgf@x=0cm
4513 }
4514 \anchor{a}{
4515 \northeast
4516 \pgf@y=0cm
4517 }
4518 \anchor{b}{
4519 \southwest
4520 \pgf@y=0cm
4521 }
4522 \savedanchor{\textanchor}{%
4523 \pgf@y=\ht\pgfnodeparttextbox
4524 \pgf@x=-.5\wd\pgfnodeparttextbox
4525 }
4526 \anchor{text}{
4527 \textanchor
4528 }
4529 \anchorborder{%
4530 \ifpgf@circuit@bipole@inverted
4531 \pgf@circ@res@left=-\pgf@x
4532 \pgf@circ@res@right=-\pgf@y
4533 \else
4534 \pgf@circ@res@left=\pgf@x
4535 \pgf@circ@res@right=\pgf@y
4536 \fi
4537 \ifdim\pgf@circ@res@right>0cm
4538 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\northeastborder}
4539 \else
4540 \southwestborder
4541 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@right}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
4542 \fi
4543 }
4544
4545 #2
4546
4547 \backgroundpath{
4548 \pgfsetcolor{\ctikzvalof{color}}
4549
4550 \northeast
4551 \pgf@circ@res@up = \pgf@y
4552 \pgf@circ@res@zero = 0cm
4553 \pgf@circ@res@left = -\pgf@x
4554 \pgf@circ@res@right = \pgf@x
4555 \southwest
4556 \pgf@circ@res@down = \pgf@y
4557 \pgf@circ@scaled@Rlen=\scaledRlen
4558 \pgfstartlinewidth=\pgflinewidth
4559 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
4560 #7
4561
4562 \pgfsetlinewidth{\pgfstartlinewidth}
4563 }
4564 }
4565 }
4566
4567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4568 %% Standard bipole shapes declarations
4569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4570
4571 %%%%%%%%%%%%%%%%%%%%%%%%
4572 % Resistive components
4573 %%%%%%%%%%%%%%%%%%%%%%%%
4574
4575 %% Short circuit
4576
4577 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
4578 %%% natural length is zero.
4579 \pgfcircdeclarebipole
4580 {}
4581 {0}
4582 {short}
4583 {0}
4584 {0}
4585 { }
4586
4587 %% Open circuit
4588 \pgfcircdeclarebipole
4589 {}
4590 {\ctikzvalof{bipoles/open/height}}
4591 {open}
4592 {\ctikzvalof{bipoles/open/height}}
4593 {\ctikzvalof{bipoles/open/width}}
4594 { }
4595
4596 % multiwire(s)
4597 \pgfcircdeclarebipole
4598 {}
4599 {\ctikzvalof{bipoles/multiwire/height}}
4600 {multiwire}
4601 {\ctikzvalof{bipoles/multiwire/height}}
4602 {\ctikzvalof{bipoles/multiwire/width}}
4603 {
4604 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4605 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4606 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4607 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4608 \pgfusepath{draw}
4609 }
4610
4611 \pgfcircdeclarebipole
4612 {}
4613 {\ctikzvalof{bipoles/multiwire/height}}
4614 {bmultiwire}
4615 {\ctikzvalof{bipoles/multiwire/height}}
4616 {\ctikzvalof{bipoles/multiwire/width}}
4617 {
4618 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4619 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4620 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4621 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4622 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4623 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4624 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4625 \pgfusepath{draw}
4626 }
4627
4628 \pgfcircdeclarebipole
4629 {}
4630 {\ctikzvalof{bipoles/multiwire/height}}
4631 {tmultiwire}
4632 {\ctikzvalof{bipoles/multiwire/height}}
4633 {\ctikzvalof{bipoles/multiwire/width}}
4634 {
4635 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4636 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4637 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4638 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4639 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4640 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}}
4641 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}}
4642 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4643 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4644 \pgfusepath{draw}
4645 }
4646
4647 %
4648 %
4649 %% Generic bipole - used as resistor by some (bleah)
4650 \pgfcircdeclarebipolescaled{resistors}
4651 {}
4652 {\ctikzvalof{bipoles/generic/height}}
4653 {generic}
4654 {\ctikzvalof{bipoles/generic/height}}
4655 {\ctikzvalof{bipoles/generic/width}}
4656 {
4657 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4658 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4659 \pgf@circ@draworfill
4660 }
4661
4662 %
4663 % generic crossed, suggested by Radványi Patrik Tamás <[email protected]>
4664 % inherit "generic" properties
4665 %
4666 \pgfcircdeclarebipolescaled{resistors}
4667 {}
4668 {\ctikzvalof{bipoles/generic/height}}
4669 {xgeneric}
4670 {\ctikzvalof{bipoles/generic/height}}
4671 {\ctikzvalof{bipoles/generic/width}}
4672 {
4673 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4674 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4675 \pgf@circ@draworfill
4676 % cross it
4677 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4678 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4679 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4680 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4681 \pgfusepath{draw}
4682 }
4683 %% Generic empty tunable
4684 \pgfcircdeclarebipolescaled{resistors}
4685 {}
4686 {\ctikzvalof{bipoles/tgeneric/height}}
4687 {tgeneric}
4688 {\ctikzvalof{bipoles/tgeneric/height}}
4689 {\ctikzvalof{bipoles/tgeneric/width}}
4690 {
4691 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
4692 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4693 \pgf@circ@draworfill
4694 \pgfscope
4695 \pgfsetarrowsend{latexslim}
4696 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4697 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4698 \pgfusepath{draw}
4699 \endpgfscope
4700 }
4701
4702 %% Generic asymmetric bipole
4703 \pgfcircdeclarebipolescaled{resistors}
4704 {}
4705 {\ctikzvalof{bipoles/ageneric/height}}
4706 {ageneric}
4707 {\ctikzvalof{bipoles/ageneric/height}}
4708 {\ctikzvalof{bipoles/ageneric/width}}
4709 {
4710 \pgfscope
4711 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4712 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4713 \pgf@circ@draworfill
4714 \endpgfscope
4715
4716 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4717 \pgfusepath{stroke,fill}
4718 }
4719
4720 %% Memristor
4721 \pgfcircdeclarebipolescaled{resistors}
4722 {}
4723 {\ctikzvalof{bipoles/memristor/height}}
4724 {memristor}
4725 {\ctikzvalof{bipoles/memristor/height}}
4726 {\ctikzvalof{bipoles/memristor/width}}
4727 {
4728 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4729 \divide \pgf@circ@res@step by 14
4730
4731 \pgfscope
4732 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4733 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4734 \pgf@circ@draworfill
4735 \endpgfscope
4736 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4737 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
4738 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4739 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4740 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4741 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4742 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4743 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4744 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
4745 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
4746
4747 \pgfusepath{draw}
4748
4749 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4750 \pgfusepath{stroke,fill}
4751 }
4752
4753 %% Photoresistor
4754 \pgfcircdeclarebipolescaled{resistors}
4755 {}
4756 {\ctikzvalof{bipoles/photoresistor/height 2}}
4757 {photoresistor}
4758 {\ctikzvalof{bipoles/photoresistor/height}}
4759 {\ctikzvalof{bipoles/photoresistor/width}}
4760 {
4761 \pgfscope
4762 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
4763 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4764 \pgf@circ@draworfill
4765 \endpgfscope
4766
4767 \pgfscope
4768 \pgfsetarrowsend{latexslim}
4769 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
4770 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4771 \pgfusepath{draw}
4772 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
4773 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4774 \pgfusepath{draw}
4775 \endpgfscope
4776 }
4777
4778 %% Thermistor
4779 \pgfcircdeclarebipolescaled{resistors}
4780 {{% anchor for labelling the type of dependency
4781 \anchor{label}{%
4782 \southwest
4783 \pgf@x=0.4\pgf@x
4784 \pgf@y=1.2\pgf@y
4785 }%
4786 }}
4787 {\ctikzvalof{bipoles/thermistor/height}}
4788 {thermistor}
4789 {\ctikzvalof{bipoles/thermistor/height}}
4790 {\ctikzvalof{bipoles/thermistor/width}}
4791 {
4792 \pgfscope
4793 \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}}
4794 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4795 \pgf@circ@draworfill
4796 \endpgfscope
4797
4798 %\pgfscope
4799 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
4800 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4801 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
4802 \pgfusepath{draw}
4803 %\endpgfscope
4804 }
4805
4806 %% Thermistor PTC
4807 \pgfcircdeclarebipolescaled{resistors}
4808 {}
4809 {\ctikzvalof{bipoles/thermistorptc/height 2}}
4810 {thermistorptc}
4811 {\ctikzvalof{bipoles/thermistorptc/height}}
4812 {\ctikzvalof{bipoles/thermistorptc/width}}
4813 {
4814 \pgfscope
4815 \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}}
4816 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4817 \pgf@circ@draworfill
4818 \endpgfscope
4819 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4820 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4821 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4822 \pgfusepath{draw}
4823
4824 \pgfsetlinewidth{\pgfstartlinewidth}
4825 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4826 \pgfsetarrowsend{latexslim}
4827 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4828 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4829 \pgfusepath{draw}
4830 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4831 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4832 \pgfusepath{draw}
4833 }
4834
4835 %% Thermistor NTC
4836 \pgfcircdeclarebipolescaled{resistors}
4837 {}
4838 {\ctikzvalof{bipoles/thermistorntc/height 2}}
4839 {thermistorntc}
4840 {\ctikzvalof{bipoles/thermistorntc/height}}
4841 {\ctikzvalof{bipoles/thermistorntc/width}}
4842 {
4843 \pgfscope
4844 \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}}
4845 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4846 \pgf@circ@draworfill
4847 \endpgfscope
4848
4849 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
4850 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
4851 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
4852 \pgfusepath{draw}
4853
4854 \pgfsetlinewidth{\pgfstartlinewidth}
4855 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
4856 \pgfsetarrowsend{latexslim}
4857 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
4858 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4859 \pgfusepath{draw}
4860 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
4861 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
4862 \pgfusepath{draw}
4863 }
4864
4865 %% Generic tunable
4866 \pgfcircdeclarebipolescaled{resistors}
4867 {
4868 \savedanchor{\wiper}{
4869 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4870 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
4871 \pgf@y=.5\pgf@ya
4872 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
4873 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
4874 }
4875 \anchor{wiper}{\wiper}
4876 \anchor{W}{\wiper}
4877 }
4878 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
4879 {genericpotentiometer}
4880 {\ctikzvalof{bipoles/generic potentiometer/height}}
4881 {\ctikzvalof{bipoles/generic potentiometer/width}}
4882 {
4883
4884 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4885 \divide \pgf@circ@res@step by 14
4886
4887 \pgfscope
4888 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4889 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4890 \pgf@circ@draworfill
4891 \endpgfscope
4892 \pgfscope
4893 %\pgfsetlinewidth{\pgfstartlinewidth}
4894 \pgfsetarrowsend{latexslim}
4895 \pgfextractx{\pgf@circ@res@other}{\wiper}
4896 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4897 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4898 \pgfusepath{draw}
4899 \endpgfscope
4900 }
4901
4902 %% Zig zag resistores
4903 \def\pgf@circ@zigzag#1{%
4904 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
4905
4906 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
4907 \pgf@circ@res@other = \pgf@circ@res@left
4908 \pgf@circ@count@a=\zigs\relax
4909 % first half zig
4910 \advance\pgf@circ@res@other by \pgf@circ@res@step
4911 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4912 \pgfmathloop%
4913 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
4914 \ifnum\pgf@circ@count@a>0
4915 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4916 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4917 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4918 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
4919 \repeatpgfmathloop%
4920 % last zig and a half
4921 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
4922 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
4923 \advance\pgf@circ@res@other by \pgf@circ@res@step
4924 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
4925 \pgfsetbeveljoin
4926 \pgfusepath{draw}
4927 }
4928
4929 %% Resistor
4930 \pgfcircdeclarebipolescaled{resistors}
4931 {
4932 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4933 }
4934 {\ctikzvalof{bipoles/resistor/height}}
4935 {resistor}
4936 {\ctikzvalof{bipoles/resistor/height}}
4937 {\ctikzvalof{bipoles/resistor/width}}
4938 {
4939 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4940 \pgftransformationadjustments
4941 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4942 \pgf@circ@zigzag{1}
4943 }
4944
4945
4946 %% Variable resistor
4947 \pgfcircdeclarebipolescaled{resistors}
4948 {
4949 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4950 }
4951 {\ctikzvalof{bipoles/vresistor/height}}
4952 {vresistor}
4953 {\ctikzvalof{bipoles/vresistor/height}}
4954 {\ctikzvalof{bipoles/vresistor/width}}
4955 {
4956 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4957 \pgftransformationadjustments
4958 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4959 \pgf@circ@zigzag{.5}
4960
4961 \pgfscope
4962 \pgfsetarrowsend{latexslim}
4963 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
4964 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
4965 \pgfusepath{draw}
4966 \endpgfscope
4967 }
4968
4969 %% Potentiometer
4970 \pgfcircdeclarebipolescaled{resistors}
4971 {
4972 \savedanchor{\wiper}{
4973 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
4974 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
4975 \pgf@y=.5\pgf@ya
4976 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
4977 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
4978 }
4979 \anchor{wiper}{\wiper}
4980 \anchor{W}{\wiper}
4981 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
4982 }
4983 {\ctikzvalof{bipoles/potentiometer/height 2}}
4984 {potentiometer}
4985 {\ctikzvalof{bipoles/potentiometer/height}}
4986 {\ctikzvalof{bipoles/potentiometer/width}}
4987 {
4988 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4989 \pgftransformationadjustments
4990 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
4991 \pgf@circ@zigzag{1}
4992
4993 \pgfscope
4994 %\pgfsetlinewidth{\pgfstartlinewidth}
4995 \pgfsetarrowsend{latexslim}
4996 \pgfextractx{\pgf@circ@res@other}{\wiper}
4997 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4998 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
4999 \pgfusepath{draw}
5000 \endpgfscope
5001 }
5002
5003 %% Resistive sensor
5004 \pgfcircdeclarebipolescaled{resistors}
5005 {% anchor for labelling the type of dependency
5006 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
5007 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5008 }
5009 {\ctikzvalof{bipoles/resistivesens/height}}
5010 {resistivesens}
5011 {\ctikzvalof{bipoles/resistivesens/height}}
5012 {\ctikzvalof{bipoles/resistivesens/width}}
5013 {%
5014 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5015 \pgftransformationadjustments
5016 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5017 \pgf@circ@zigzag{.5}
5018
5019 \pgfscope
5020 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@other}{\pgf@circ@res@up}}
5021 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@other}{\pgf@circ@res@down}}
5022 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@other}{\pgf@circ@res@down}}
5023 \pgfusepath{draw}
5024 \endpgfscope
5025 }
5026
5027 %%%%%%%%%%%%%%
5028 %% Capacitors
5029 %%%%%%%%%%%%%
5030
5031 %% Plain Capacitor
5032 \pgfcircdeclarebipolescaled{capacitors}
5033 {}
5034 {\ctikzvalof{bipoles/capacitor/height}}
5035 {capacitor}
5036 {\ctikzvalof{bipoles/capacitor/height}}
5037 {\ctikzvalof{bipoles/capacitor/width}}
5038 {
5039 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5040 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5041 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5042
5043 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5044 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5045 \pgfusepath{draw}
5046
5047 }
5048
5049 %% Capacitive sensor
5050 \pgfcircdeclarebipolescaled{capacitors}
5051 {
5052 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
5053 }
5054 {\ctikzvalof{bipoles/capacitor/height}}
5055 {capacitivesens}
5056 {\ctikzvalof{bipoles/capacitor/height}}
5057 {\ctikzvalof{bipoles/capacitor/width}}
5058 {
5059 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5060 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5061 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5062
5063 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5064 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5065 \pgfusepath{draw}
5066 \pgfscope
5067 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
5068 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5069 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5070 \pgfusepath{draw}
5071 \endpgfscope
5072 }
5073
5074 %% Polar Capacitor (DEPRECATED)
5075 \pgfcircdeclarebipolescaled{capacitors}
5076 {}
5077 {\ctikzvalof{bipoles/pcapacitor/height}}
5078 {polarcapacitor}
5079 {\ctikzvalof{bipoles/pcapacitor/height}}
5080 {\ctikzvalof{bipoles/pcapacitor/width}}
5081 {
5082 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5083
5084 \pgfscope
5085 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
5086 \pgftransformrotate{-90}
5087 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5088 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5089 \pgfusepath{draw}
5090 \endpgfscope
5091
5092 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5093 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5094 \pgfusepath{draw}
5095 }
5096
5097
5098 %% Curved capacitor
5099 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
5100 % for a rationale
5101 %
5102 \pgfcircdeclarebipolescaled{capacitors}
5103 {}
5104 {\ctikzvalof{bipoles/ccapacitor/height}}
5105 {ccapacitor}
5106 {\ctikzvalof{bipoles/ccapacitor/height}}
5107 {\ctikzvalof{bipoles/ccapacitor/width}}
5108 {
5109 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5110
5111 \pgfscope
5112 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+ \ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}{\pgf@circ@res@up}}
5113 \pgftransformrotate{-90}
5114 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5115 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5116 \pgfusepath{draw}
5117 \endpgfscope
5118
5119 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5120 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5121 \pgfusepath{draw}
5122 }
5123
5124
5125
5126
5127 %% Electrolytic Capacitor
5128 \pgfcircdeclarebipolescaled{capacitors}
5129 {}
5130 {\ctikzvalof{bipoles/ecapacitor/height}}
5131 {ecapacitor}
5132 {\ctikzvalof{bipoles/ecapacitor/height}}
5133 {\ctikzvalof{bipoles/ecapacitor/width}}
5134 {
5135 \pgfsetrectcap
5136 % % % Draw plus pole
5137 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5138 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5139 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5140 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5141 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5142 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5143 \pgf@circ@draworfill
5144 % % Draw minus pole
5145 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5146 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5147 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5148 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5149 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5150 \pgfsetfillcolor{\ctikzvalof{color}}
5151 \pgfusepath{draw,fill}
5152 \pgfsetfillcolor{\ctikzvalof{color}}
5153 % % plus pole annotation
5154 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
5155 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
5156 }
5157
5158 %% Variable Capacitor
5159 \pgfcircdeclarebipolescaled{capacitors}
5160 {}
5161 {\ctikzvalof{bipoles/vcapacitor/height}}
5162 {vcapacitor}
5163 {\ctikzvalof{bipoles/vcapacitor/height}}
5164 {\ctikzvalof{bipoles/vcapacitor/width}}
5165 {
5166 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/capacitor width} \pgf@circ@res@right
5167
5168 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5169 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5170 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5171
5172 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5173 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5174 \pgfusepath{draw}
5175
5176 \pgfscope
5177 \pgfsetarrowsend{latexslim}
5178 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5179 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5180 \pgfusepath{draw}
5181 \endpgfscope
5182
5183 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
5184 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
5185 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5186 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
5187 \pgfsetlinewidth{\pgfstartlinewidth}
5188 \pgfusepath{draw}
5189 }
5190
5191
5192 %% Piezoelectric Element
5193
5194 \pgfcircdeclarebipolescaled{capacitors}
5195 {}
5196 {\ctikzvalof{bipoles/piezoelectric/height}}
5197 {piezoelectric}
5198 {\ctikzvalof{bipoles/piezoelectric/height}}
5199 {\ctikzvalof{bipoles/piezoelectric/width}}
5200 {
5201 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
5202 % \divide \pgf@circ@res@step by 5
5203
5204 %% Outer markings
5205 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5206 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5207 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5208
5209 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5210 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5211 \pgfusepath{draw}
5212
5213 %% Inner Box
5214 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
5215 \pgfscope
5216 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5217 \pgfpathrectanglecorners
5218 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
5219 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
5220 \pgf@circ@draworfill
5221 \endpgfscope
5222 }
5223
5224 %%%%%%%%%%%%%%%
5225 %% Inductors
5226 %%%%%%%%%%%%%%%
5227
5228 %% cute inductor
5229 \pgfcircdeclarebipolescaled{inductors}
5230 {
5231 \savedanchor{\midtap}{%
5232 \pgf@x=0pt\relax
5233 \pgfmathsetlength{\pgf@y}{%
5234 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5235 \ctikzvalof{bipoles/cuteinductor/height} :% even
5236 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5237 *\pgf@circ@scaled@Rlen/2
5238 }
5239 }
5240 \anchor{midtap}{\midtap}
5241 }
5242 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5243 {cuteinductor}
5244 {\ctikzvalof{bipoles/cuteinductor/height}}
5245 {\ctikzvalof{bipoles/cuteinductor/width}}
5246 {
5247 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5248 \pgftransformationadjustments
5249
5250 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5251 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5252
5253
5254 \pgfmathsetlength{\pgf@circ@res@step}
5255 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5256
5257 \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
5258 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5259 {
5260 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5261 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5262 }
5263 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5264 \pgfsetbuttcap
5265 \pgfsetbeveljoin
5266 \pgfusepath{stroke}
5267 }
5268
5269 %% cute inductive sensor
5270 \pgfcircdeclarebipolescaled{inductors}
5271 {% anchor for labelling the type of dependency
5272 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5273 \savedanchor{\midtap}{%
5274 \pgf@x=0pt\relax
5275 \pgfmathsetlength{\pgf@y}{%
5276 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5277 \ctikzvalof{bipoles/cuteinductor/height} :% even
5278 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5279 *\pgf@circ@scaled@Rlen/2
5280 }
5281 }
5282 \anchor{midtap}{\midtap}
5283 }
5284 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5285 {scuteinductor}
5286 {\ctikzvalof{bipoles/cuteinductor/height}}
5287 {\ctikzvalof{bipoles/cuteinductor/width}}
5288 {
5289 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5290 \pgftransformationadjustments
5291
5292 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5293 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5294
5295
5296 \pgfmathsetlength{\pgf@circ@res@step}
5297 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5298
5299 \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
5300 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5301 {
5302 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5303 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5304 }
5305 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5306 \pgfsetbuttcap
5307 \pgfsetbeveljoin
5308 \pgfusepath{stroke}
5309 \pgfscope
5310 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5311 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5312 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5313 \pgfusepath{draw}
5314 \endpgfscope
5315 }
5316
5317 %% cute choke
5318 \pgfcircdeclarebipolescaled{inductors}
5319 {
5320 \savedanchor{\midtap}{%
5321 \pgf@x=0pt\relax
5322 \pgfmathsetlength{\pgf@y}{%
5323 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5324 \ctikzvalof{bipoles/cuteinductor/height} :% even
5325 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5326 *\pgf@circ@scaled@Rlen/2
5327 }
5328 }
5329 \anchor{midtap}{\midtap}
5330 }
5331 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
5332 {cutechoke}
5333 {\ctikzvalof{bipoles/cutechoke/height}}
5334 {\ctikzvalof{bipoles/cutechoke/width}}
5335 {
5336 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5337 \pgftransformationadjustments
5338
5339 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5340 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
5341
5342
5343 \pgfmathsetlength{\pgf@circ@res@step}
5344 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
5345
5346 \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
5347 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
5348 {
5349 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5350 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5351 }
5352 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5353 \pgfsetbuttcap
5354 \pgfsetbeveljoin
5355 \pgfusepath{stroke}
5356
5357 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5358 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
5359 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5360 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5361 \pgfusepath{stroke}
5362
5363 \ifpgf@circuit@bipole@twolineschoke
5364 \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}}
5365 \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}}
5366 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5367 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
5368 \pgfusepath{stroke}
5369 \fi
5370 }
5371
5372 %% variable cute inductor
5373 \pgfcircdeclarebipolescaled{inductors}
5374 {
5375 \savedanchor{\midtap}{%
5376 \pgf@x=0pt\relax
5377 \pgfmathsetlength{\pgf@y}{%
5378 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5379 \ctikzvalof{bipoles/cuteinductor/height} :% even
5380 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5381 *\pgf@circ@scaled@Rlen/2
5382 }
5383 }
5384 \anchor{midtap}{\midtap}
5385 }
5386 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
5387 {vcuteinductor}
5388 {\ctikzvalof{bipoles/vcuteinductor/height}}
5389 {\ctikzvalof{bipoles/vcuteinductor/width}}
5390 {
5391 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5392 \pgftransformationadjustments
5393
5394 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5395 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
5396
5397
5398 \pgfmathsetlength{\pgf@circ@res@step}
5399 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
5400
5401 \pgfscope
5402 \pgfsetarrowsend{latexslim}
5403 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5404 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5405 \pgfusepath{draw}
5406 \endpgfscope
5407
5408 \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
5409 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
5410 {
5411 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5412 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
5413 }
5414 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
5415 \pgfsetbuttcap
5416 \pgfsetbeveljoin
5417 \pgfusepath{stroke}
5418 }
5419
5420 %% american inductor
5421 \pgfcircdeclarebipolescaled{inductors}
5422 {
5423 \savedanchor{\midtap}{%
5424 \pgf@x=0pt\relax
5425 \pgfmathsetlength{\pgf@y}{%
5426 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5427 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5428 0) %odd
5429 *\pgf@circ@scaled@Rlen/2
5430 }
5431 }
5432 \anchor{midtap}{\midtap}
5433 }
5434 {\ctikzvalof{bipoles/americaninductor/height 2}}
5435 {americaninductor}
5436 {\ctikzvalof{bipoles/americaninductor/height}}
5437 {\ctikzvalof{bipoles/americaninductor/width}}
5438 {
5439 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5440 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5441 \pgftransformationadjustments
5442 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5443 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5444 \divide \pgf@circ@res@step by 2
5445 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5446
5447 \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
5448 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5449 {
5450 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5451 }
5452 \pgfsetbuttcap
5453 \pgfsetbeveljoin
5454 \pgfusepath{stroke}
5455 }
5456
5457
5458 %% american inductive sensor
5459 \pgfcircdeclarebipolescaled{inductors}
5460 {% anchor for labelling the type of dependency
5461 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
5462 \savedanchor{\midtap}{%
5463 \pgf@x=0pt\relax
5464 \pgfmathsetlength{\pgf@y}{%
5465 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
5466 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
5467 0) %odd
5468 *\pgf@circ@scaled@Rlen/2
5469 }
5470 }
5471 \anchor{midtap}{\midtap}
5472 }
5473 {\ctikzvalof{bipoles/americaninductor/height 2}}
5474 {samericaninductor}
5475 {\ctikzvalof{bipoles/americaninductor/height}}
5476 {\ctikzvalof{bipoles/americaninductor/width}}
5477 {
5478 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
5479 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5480 \pgftransformationadjustments
5481 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5482 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
5483 \divide \pgf@circ@res@step by 2
5484 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
5485
5486 \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
5487 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
5488 {
5489 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5490 }
5491 \pgfsetbuttcap
5492 \pgfsetbeveljoin
5493 \pgfusepath{stroke}
5494 \pgfscope
5495 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
5496 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5497 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
5498 \pgfusepath{draw}
5499 \endpgfscope
5500 }
5501
5502 %% variable american inductor
5503 \pgfcircdeclarebipolescaled{inductors}
5504 {
5505 \savedanchor{\midtap}{%
5506 \pgf@x=0pt\relax
5507 \pgfmathsetlength{\pgf@y}{%
5508 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
5509 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
5510 0) %odd
5511 *\pgf@circ@scaled@Rlen/2
5512 }
5513 }
5514 \anchor{midtap}{\midtap}
5515 }
5516 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
5517 {vamericaninductor}
5518 {\ctikzvalof{bipoles/vamericaninductor/height}}
5519 {\ctikzvalof{bipoles/vamericaninductor/width}}
5520 {
5521 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
5522 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5523 \pgftransformationadjustments
5524 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
5525 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
5526 \divide \pgf@circ@res@step by 2
5527 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
5528
5529 \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
5530 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
5531 {
5532 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
5533 }
5534 \pgfsetbuttcap
5535 \pgfsetbeveljoin
5536 \pgfusepath{stroke}
5537
5538 \pgfscope
5539 \pgfsetarrowsend{latexslim}
5540 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5541 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5542 \pgfusepath{draw}
5543 \endpgfscope
5544 }
5545
5546 %% Generic bipole, filled - used as inductor by some
5547 \pgfcircdeclarebipolescaled{inductors}
5548 {
5549 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5550 }
5551 {\ctikzvalof{bipoles/fullgeneric/height}}
5552 {fullgeneric}
5553 {\ctikzvalof{bipoles/fullgeneric/height}}
5554 {\ctikzvalof{bipoles/fullgeneric/width}}
5555 {
5556 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5557 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5558
5559 \pgfusepath{draw,fill}
5560 }
5561
5562 %% Generic sensor, filled - used as inductive sensor by some
5563 \pgfcircdeclarebipolescaled{inductors}
5564 {% anchor for labelling the type of dependency
5565 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
5566 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5567 }
5568 {\ctikzvalof{bipoles/fullgeneric/height}}
5569 {sfullgeneric}
5570 {\ctikzvalof{bipoles/fullgeneric/height}}
5571 {\ctikzvalof{bipoles/fullgeneric/width}}
5572 {
5573
5574 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5575 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5576 \pgfusepath{draw,fill}
5577 %\pgfscope
5578 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
5579 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
5580 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
5581 \pgfusepath{draw}
5582 %\endpgfscope
5583 }
5584
5585 %% Generic full tunable
5586 \pgfcircdeclarebipolescaled{inductors}
5587 {
5588 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
5589 }
5590 {\ctikzvalof{bipoles/tfullgeneric/height}}
5591 {tfullgeneric}
5592 {\ctikzvalof{bipoles/tfullgeneric/height}}
5593 {\ctikzvalof{bipoles/tfullgeneric/width}}
5594 {
5595 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
5596 \divide \pgf@circ@res@step by 14
5597
5598 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
5599 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5600 \pgfusepath{draw,fill}
5601
5602 \pgfscope
5603 \pgfsetarrowsend{latexslim}
5604 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
5605 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
5606 \pgfusepath{draw}
5607 \endpgfscope
5608 }
5609
5610 %%%%%%%%%%%
5611 %% Battery
5612 %%%%%%%%%%%
5613
5614 %% Battery
5615 \pgfcircdeclarebipolescaled{batteries}
5616 {}
5617 {\ctikzvalof{bipoles/battery/height}}
5618 {battery}
5619 {\ctikzvalof{bipoles/battery/height}}
5620 {\ctikzvalof{bipoles/battery/width}}
5621 {
5622 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
5623 \divide \pgf@circ@res@step by 6
5624
5625 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5626
5627 \ifpgf@circ@fixbatteries
5628 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5629 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5630
5631 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5632 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5633
5634 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5635 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5636
5637 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5638 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5639 \else
5640 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5641 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5642
5643 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
5644 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
5645
5646 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5647 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5648
5649 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5650 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5651 \fi
5652 \pgfusepath{draw}
5653 }
5654
5655
5656 %% Battery 1 % poles with equl thickness
5657
5658 \pgfcircdeclarebipolescaled{batteries}
5659 {}
5660 {\ctikzvalof{bipoles/battery1/height}}
5661 {battery1}
5662 {\ctikzvalof{bipoles/battery1/height}}
5663 {\ctikzvalof{bipoles/battery1/width}}
5664 {
5665 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5666 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5667 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5668 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5669 \pgfusepath{draw}
5670
5671 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5672 \ifpgf@circ@fixbatteries
5673 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5674 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5675
5676 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5677 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5678 \else
5679 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5680 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5681
5682 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5683 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5684 \fi
5685 \pgfusepath{draw}
5686 }
5687
5688 %% Battery 2 % negative pole thicker
5689
5690 \pgfcircdeclarebipolescaled{batteries}
5691 {}
5692 {\ctikzvalof{bipoles/battery2/height}}
5693 {battery2}
5694 {\ctikzvalof{bipoles/battery2/height}}
5695 {\ctikzvalof{bipoles/battery2/width}}
5696 {
5697 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
5698 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5699 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
5700 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5701 \pgfusepath{draw}
5702
5703 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5704 \ifpgf@circ@fixbatteries
5705 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
5706 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
5707 \pgfusepath{draw}
5708 \pgfsetlinewidth{3\pgflinewidth}
5709 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
5710 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
5711 \else
5712 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
5713 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
5714 \pgfusepath{draw}
5715 \pgfsetlinewidth{3\pgflinewidth}
5716 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
5717 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
5718 \fi
5719 \pgfusepath{draw}
5720 }
5721
5722 %%%%%%%%%%%
5723 %% Round and diamond sources
5724 %%%%%%%%%%%
5725
5726 %% Independent voltage source
5727 \pgfcircdeclarebipolescaled{sources}
5728 {}
5729 {\ctikzvalof{bipoles/vsource/height}}
5730 {vsource}
5731 {\ctikzvalof{bipoles/vsource/height}}
5732 {\ctikzvalof{bipoles/vsource/width}}
5733 {
5734
5735 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5736
5737 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5738 \pgf@circ@draworfill
5739 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
5740 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
5741 \pgfusepath{draw}
5742 }
5743
5744 %% To change the internal symbols of the voltage source american style
5745 \ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
5746 \ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
5747 %% Independent voltage source - American style
5748 \pgfcircdeclarebipolescaled{sources}
5749 {}
5750 {\ctikzvalof{bipoles/vsourceam/height}}
5751 {vsourceAM}
5752 {\ctikzvalof{bipoles/vsourceam/height}}
5753 {\ctikzvalof{bipoles/vsourceam/width}}
5754 {
5755
5756 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5757 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5758 \pgf@circ@draworfill
5759 \pgfsetcolor{\ctikzvalof{color}}
5760 \ifpgf@circ@oldvoltagedirection
5761 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5762 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5763 \else
5764 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
5765 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
5766 \fi
5767 }
5768
5769 %% Independent sinusoidal voltage source
5770 \pgfcircdeclarebipolescaled{sources}
5771 {}
5772 {\ctikzvalof{bipoles/vsourcesin/height}}
5773 {vsourcesin}
5774 {\ctikzvalof{bipoles/vsourcesin/height}}
5775 {\ctikzvalof{bipoles/vsourcesin/width}}
5776 {
5777
5778 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5779 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5780 \pgf@circ@draworfill
5781
5782 \pgf@circ@res@up = .5\pgf@circ@res@up
5783 \pgfscope
5784 \pgftransformrotate{90}
5785 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
5786 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5787 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5788 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
5789 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
5790 \pgfusepath{draw}
5791 \endpgfscope
5792 }
5793
5794 % Square Voltage source - contributed by Alistair Kwan
5795 \pgfcircdeclarebipolescaled{sources}
5796 {}
5797 {\ctikzvalof{bipoles/vsourcesquare/height}}
5798 {vsourcesquare}
5799 {\ctikzvalof{bipoles/vsourcesquare/height}}
5800 {\ctikzvalof{bipoles/vsourcesquare/width}}
5801 {
5802 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5803 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5804 \pgf@circ@draworfill
5805 \pgf@circ@res@up = .5\pgf@circ@res@up
5806 \pgfscope
5807 \pgftransformrotate{90}
5808 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5809 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
5810 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
5811 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5812 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
5813 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5814 \pgfusepath{draw}
5815 \endpgfscope
5816 }
5817
5818 % Triangle Voltage source - contributed by Ralf Farkas
5819 \pgfcircdeclarebipolescaled{sources}
5820 {}
5821 {\ctikzvalof{bipoles/vsourcetri/height}}
5822 {vsourcetri}
5823 {\ctikzvalof{bipoles/vsourcetri/height}}
5824 {\ctikzvalof{bipoles/vsourcetri/width}}
5825 {
5826
5827 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5828 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5829 \pgf@circ@draworfill
5830
5831 \pgf@circ@res@up = .5\pgf@circ@res@up
5832 \pgfscope
5833 \pgftransformrotate{90}
5834 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
5835 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
5836 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
5837 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
5838 \pgfusepath{draw}
5839 \endpgfscope
5840 }
5841
5842
5843 %% PV Source
5844 \pgfcircdeclarebipolescaled{sources}
5845 {}
5846 {\ctikzvalof{bipoles/pvsource/height}}
5847 {pvsource}
5848 {\ctikzvalof{bipoles/pvsource/height}}
5849 {\ctikzvalof{bipoles/pvsource/width}}
5850 {
5851 \pgfpointorigin
5852 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5853 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5854 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5855 \pgf@circ@draworfill
5856
5857 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
5858 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
5859 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
5860 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
5861 \pgfusepath{draw}
5862
5863 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5864 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
5865 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
5866
5867 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
5868 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
5869 \pgfusepath{draw}
5870
5871 %Arrow Part
5872 \pgfscope
5873 \pgfsetarrowsend{latex}
5874 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5875 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5876 \pgfusepath{draw}
5877 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
5878 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
5879 \pgfusepath{draw}
5880 \endpgfscope
5881
5882 }
5883
5884 %% Empty Source
5885 \pgfcircdeclarebipolescaled{sources}
5886 {}
5887 {\ctikzvalof{bipoles/esource/height}}
5888 {esource}
5889 {\ctikzvalof{bipoles/esource/height}}
5890 {\ctikzvalof{bipoles/esource/width}}
5891 {
5892 \pgfpointorigin
5893 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5894 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5895 \pgf@circ@draworfill
5896 }
5897
5898 %% DC Current Source with open shape
5899 \pgfcircdeclarebipolescaled{sources}
5900 {}
5901 {\ctikzvalof{bipoles/dcisource/height}}
5902 {dcisource}
5903 {\ctikzvalof{bipoles/dcisource/height}}
5904 {\ctikzvalof{bipoles/dcisource/width}}
5905 {
5906 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5907 \pgfpathmoveto{\pgfpointorigin}
5908 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5909 \pgf@circ@maybefill
5910 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
5911 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
5912 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
5913 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
5914 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
5915 \pgfusepath{draw}
5916
5917 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
5918 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
5919 \pgfusepath{draw}
5920 \pgfscope
5921 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
5922 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
5923 \endpgfscope
5924 }
5925
5926 %% DC-Voltage source
5927 \pgfcircdeclarebipolescaled{sources}
5928 {}
5929 {\ctikzvalof{bipoles/dcvsource/height}}
5930 {dcvsource}
5931 {\ctikzvalof{bipoles/dcvsource/height}}
5932 {\ctikzvalof{bipoles/dcvsource/width}}
5933 {
5934 \pgfpointorigin
5935 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5936 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5937 \pgf@circ@draworfill
5938 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
5939 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
5940 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
5941 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
5942 \pgfusepath{draw}
5943 }
5944
5945 %% Independent current source
5946 \pgfcircdeclarebipolescaled{sources}
5947 {}
5948 {\ctikzvalof{bipoles/isource/height}}
5949 {isource}
5950 {\ctikzvalof{bipoles/isource/height}}
5951 {\ctikzvalof{bipoles/isource/width}}
5952 {
5953 \pgfpointorigin
5954 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5955 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5956 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5957 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5958 \pgf@circ@draworfill
5959 }
5960
5961 %% Independent double oo source
5962 \pgfcircdeclarebipolescaled{sources}
5963 {}
5964 {\ctikzvalof{bipoles/oosource/height}}
5965 {oosource}
5966 {\ctikzvalof{bipoles/oosource/height}}
5967 {\ctikzvalof{bipoles/oosource/width}}
5968 {
5969 \pgfpointorigin
5970 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5971 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
5972 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
5973 \pgf@circ@maybefill
5974 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
5975 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@right}
5976 \pgf@circ@draworfill
5977 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
5978 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@left}
5979 \pgfusepath{draw}
5980 }
5981
5982 % % % winding symbols
5983 % triangle
5984 \def\pgf@circ@delta#1{
5985 \pgfscope
5986 \pgftransformscale{-.01\pgf@circ@res@left*#1}
5987 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
5988 \pgftransformrotate{-\pgfcircmathresult}
5989
5990 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5991 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5992 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5993 \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}}
5994 \pgfpathclose
5995 \pgfusepath{stroke}
5996 \endpgfscope
5997 }
5998
5999 % star
6000 \def\pgf@circ@wye#1{
6001 \pgfscope
6002 \pgftransformscale{-.015\pgf@circ@res@left*#1}
6003 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6004 \pgftransformrotate{-\pgfcircmathresult}
6005
6006 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6007 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
6008 \pgfpathlineto{\pgfpointorigin}
6009 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}}
6010 \pgfpathmoveto{\pgfpointorigin}
6011 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}}
6012 \pgfusepath{stroke}
6013 \endpgfscope
6014 }
6015
6016 % zigzag
6017 \def\pgf@circ@zig#1{
6018 \pgfscope
6019 \pgftransformscale{-.015\pgf@circ@res@left*#1}
6020 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
6021 \pgftransformrotate{-\pgfcircmathresult}
6022
6023 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6024 \pgfpathmoveto{\pgfpointorigin}
6025 \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}}
6026 \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}}
6027
6028 \pgfpathmoveto{\pgfpointorigin}
6029 \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}}
6030 \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}}
6031
6032 \pgfpathmoveto{\pgfpointorigin}
6033 \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}}
6034 \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}}
6035 \pgfusepath{stroke}
6036 \endpgfscope
6037 }
6038
6039 % % % % round three-phase transformer
6040 \pgfcircdeclarebipolescaled{sources}
6041 {}
6042 {\ctikzvalof{bipoles/oosourcetrans/height}}
6043 {oosourcetrans}
6044 {\ctikzvalof{bipoles/oosourcetrans/height}}
6045 {\ctikzvalof{bipoles/oosourcetrans/width}}
6046 {
6047
6048 \pgfpointorigin
6049 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6050 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6051 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6052 \pgf@circ@maybefill
6053 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}}
6054 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6055 \pgf@circ@draworfill
6056 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
6057 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6058 \pgfusepath{draw}
6059
6060
6061 % % % % draw inner symbols
6062
6063 %%primary winding
6064 \ifpgf@circ@prim@delta
6065 \pgfscope
6066 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6067 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6068 \endpgfscope
6069
6070 \else\ifpgf@circ@prim@wye
6071 \pgfscope
6072 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6073 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6074 \endpgfscope
6075
6076 \else\ifpgf@circ@prim@zig
6077 \pgfscope
6078 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
6079 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6080 \endpgfscope
6081 \fi\fi\fi
6082
6083 %%secondary winding
6084 \ifpgf@circ@sec@delta
6085 \pgfscope
6086 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6087 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6088 \endpgfscope
6089
6090 \else\ifpgf@circ@sec@wye
6091 \pgfscope
6092 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6093 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6094 \endpgfscope
6095
6096 \else\ifpgf@circ@sec@zig
6097 \pgfscope
6098 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
6099 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
6100 \endpgfscope
6101 \fi\fi\fi
6102 }
6103
6104
6105 % % % % ooosource for three phase transformer
6106 \pgfcircdeclarebipolescaled{sources}
6107 {
6108 \anchor{right}{
6109 \northeast
6110 \pgf@y=0pt
6111 \pgfmathparse{
6112 \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
6113 %%the sqrt must be > 0, the circles have to intersect
6114 sqrt(
6115 pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
6116 pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
6117 )
6118 }
6119 \pgf@x=\pgfmathresult\pgf@x
6120 }
6121 \anchor{east}{
6122 \northeast
6123 \pgf@y=0pt
6124 }
6125 \savedanchor{\centerprim}{
6126 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6127 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6128 \pgf@y=0pt
6129 \pgf@x=.5\pgf@circ@scaled@Rlen
6130 }
6131 \anchor{centerprim}{
6132 \centerprim
6133 }
6134 \savedanchor{\centersec}{
6135 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6136 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6137 \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen}
6138 \pgf@y=-\pgf@y
6139 \pgf@x=-\pgf@x
6140 }
6141 \anchor{centersec}{
6142 \centersec
6143 }
6144 \savedanchor{\centertert}{
6145 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6146 \pgf@circ@scaled@Rlen=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@scaled@Rlen
6147 \pgfpointpolar{60}{.5\pgf@circ@scaled@Rlen}
6148 \pgf@y=\pgf@y
6149 \pgf@x=-\pgf@x
6150 }
6151 \anchor{centertert}{
6152 \centertert
6153 }
6154
6155 % add some anchors in case the are needed :)
6156 \anchor{prim1}{
6157 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6158 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6159 \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@scaled@Rlen}}
6160 }
6161 \anchor{prim2}{
6162 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6163 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6164 \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@scaled@Rlen}}
6165 }
6166 \anchor{sec1}{
6167 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6168 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6169 \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}}
6170 }
6171 \anchor{sec2}{
6172 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6173 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6174 \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@scaled@Rlen}}
6175 }
6176 \anchor{sec3}{
6177 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6178 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6179 \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@scaled@Rlen}}
6180 }
6181 \anchor{tert1}{
6182 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6183 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6184 \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@scaled@Rlen}}
6185 }
6186 \anchor{tert2}{
6187 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6188 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6189 \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@scaled@Rlen}}
6190 }
6191 \anchor{tert3}{
6192 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@Rlen
6193 \pgf@circ@scaled@Rlen=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@scaled@Rlen
6194 \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@scaled@Rlen}}
6195 }
6196 }
6197 {\ctikzvalof{bipoles/ooosource/height}}
6198 {ooosource}
6199 {\ctikzvalof{bipoles/ooosource/height}}
6200 {\ctikzvalof{bipoles/ooosource/height}}
6201 {
6202 % \pgf@circ@res@other = \ctikzvalof{bipoles/ooosource/vectorgroup} \pgf@circ@scaled@Rlen
6203
6204 % % filling
6205 % left
6206 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6207 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6208 \pgf@circ@maybefill
6209
6210 % up
6211 \pgfscope
6212 \pgfpointorigin
6213 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6214 \pgf@circ@maybefill
6215 \endpgfscope
6216 % down
6217 \pgfscope
6218 \pgfpointorigin
6219 \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6220 \pgf@circ@draworfill
6221 \endpgfscope
6222
6223 % drawing
6224 % left
6225 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6226 \pgfusepath{draw}
6227
6228 % up
6229 \pgfscope
6230 \pgfpointorigin
6231 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
6232 \pgfusepath{draw}
6233 \endpgfscope
6234
6235 % % % draw inner symbols
6236
6237 % % primary winding
6238 \ifpgf@circ@prim@delta
6239 \pgfscope
6240 \pgftransformxshift{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
6241 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6242 \endpgfscope
6243
6244 \else\ifpgf@circ@prim@wye
6245 \pgfscope
6246 \pgftransformxshift{.6\pgf@circ@res@left}
6247 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6248 \endpgfscope
6249
6250 \else\ifpgf@circ@prim@zig
6251 \pgfscope
6252 \pgftransformxshift{.6\pgf@circ@res@left}
6253 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6254 \endpgfscope
6255 \fi\fi\fi
6256
6257 % % secondary winding
6258 \ifpgf@circ@sec@delta
6259 \pgfscope
6260 \pgfpointorigin
6261 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6262 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6263 \endpgfscope
6264
6265 \else\ifpgf@circ@sec@wye
6266 \pgfscope
6267 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6268 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6269 \endpgfscope
6270
6271 \else\ifpgf@circ@sec@zig
6272 \pgfscope
6273 \pgftransformshift{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6274 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6275 \endpgfscope
6276 \fi\fi\fi
6277
6278 % % tertiary winding
6279 \ifpgf@circ@tert@delta
6280 \pgfscope
6281 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6282 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6283 \endpgfscope
6284
6285 \else\ifpgf@circ@tert@wye
6286 \pgfscope
6287 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6288 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6289 \endpgfscope
6290
6291 \else\ifpgf@circ@tert@zig
6292 \pgfscope
6293 \pgftransformshift{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}}
6294 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
6295 \endpgfscope
6296 \fi\fi\fi
6297 }
6298
6299 %% Independent current source - American
6300 \pgfcircdeclarebipolescaled{sources}
6301 {}
6302 {\ctikzvalof{bipoles/isourceam/height}}
6303 {isourceAM}
6304 {\ctikzvalof{bipoles/isourceam/height}}
6305 {\ctikzvalof{bipoles/isourceam/width}}
6306 {
6307 \pgfpointorigin
6308 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6309 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6310 \pgf@circ@draworfill
6311
6312 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6313 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6314 \pgfusepath{draw}
6315 \pgfscope
6316 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6317 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6318 \endpgfscope
6319 }
6320
6321 %% Independent sinusoidal current source
6322 \pgfcircdeclarebipolescaled{sources}
6323 {}
6324 {\ctikzvalof{bipoles/isource/height}}
6325 {isourcesin}
6326 {\ctikzvalof{bipoles/isource/height}}
6327 {\ctikzvalof{bipoles/isource/width}}
6328 {
6329 \pgfpointorigin
6330 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6331 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6332 \pgf@circ@draworfill
6333
6334 \pgf@circ@res@up = .5\pgf@circ@res@up
6335 \pgfscope
6336 \pgftransformrotate{90}
6337 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6338 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6339 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6340 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6341 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6342 \pgfusepath{draw}
6343 \endpgfscope
6344 }
6345
6346 %% Empty controlled source
6347 \pgfcircdeclarebipolescaled{csources}
6348 {}
6349 {\ctikzvalof{bipoles/ecsource/height}}
6350 {ecsource}
6351 {\ctikzvalof{bipoles/ecsource/height}}
6352 {\ctikzvalof{bipoles/ecsource/width}}
6353 {
6354
6355 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6356
6357 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6358 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6359 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6360 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6361 \pgfpathclose
6362 \pgf@circ@draworfill
6363 }
6364
6365 %% Controlled voltage source
6366 \pgfcircdeclarebipolescaled{csources}
6367 {}
6368 {\ctikzvalof{bipoles/cvsource/height}}
6369 {cvsource}
6370 {\ctikzvalof{bipoles/cvsource/height}}
6371 {\ctikzvalof{bipoles/cvsource/width}}
6372 {
6373
6374 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6375
6376 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6377 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6378 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6380 \pgfpathclose
6381 \pgf@circ@draworfill
6382
6383 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6384 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6385 \pgfusepath{draw}
6386 }
6387
6388 %% To change the internal symbols of the controlled voltage source american style
6389 \ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
6390 \ctikzset{bipoles/cvsourceam/inner minus/.initial={$-$}}
6391 %% Controlled voltage source - American
6392 \pgfcircdeclarebipolescaled{csources}
6393 {}
6394 {\ctikzvalof{bipoles/cvsourceam/height}}
6395 {cvsourceAM}
6396 {\ctikzvalof{bipoles/cvsourceam/height}}
6397 {\ctikzvalof{bipoles/cvsourceam/width}}
6398 {
6399 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6400 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6401 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6402 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6403 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6404 \pgfpathclose
6405 \pgf@circ@draworfill
6406
6407 \pgfsetcolor{\ctikzvalof{color}}
6408 \ifpgf@circ@oldvoltagedirection
6409 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6410 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6411 \else
6412 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@left]{\ctikzvalof{bipoles/cvsourceam/inner minus}}
6413 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/cvsourceam/margin}\pgf@circ@res@right]{\ctikzvalof{bipoles/cvsourceam/inner plus}}
6414 \fi
6415 }
6416
6417 %% Controlled sinusoidal voltage source
6418 \pgfcircdeclarebipolescaled{csources}
6419 {}
6420 {\ctikzvalof{bipoles/cvsourcesin/height}}
6421 {cvsourcesin}
6422 {\ctikzvalof{bipoles/cvsourcesin/height}}
6423 {\ctikzvalof{bipoles/cvsourcesin/width}}
6424 {
6425
6426 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6427
6428 \pgfscope
6429 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6430 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6431 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6432 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6433 \pgfpathclose
6434 \pgf@circ@draworfill
6435 \endpgfscope
6436
6437 \pgf@circ@res@up = .5\pgf@circ@res@up
6438 \pgfscope
6439 \pgftransformrotate{90}
6440 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6441 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6442 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6443 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6444 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6445 \pgfusepath{draw}
6446 \endpgfscope
6447 }
6448
6449 %% Controlled sinusoidal current source
6450 \pgfcircdeclarebipolescaled{csources}
6451 {}
6452 {\ctikzvalof{bipoles/cvsourcesin/height}}
6453 {cisourcesin}
6454 {\ctikzvalof{bipoles/cvsourcesin/height}}
6455 {\ctikzvalof{bipoles/cvsourcesin/width}}
6456 {
6457
6458 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6459
6460 \pgfscope
6461 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6462 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6463 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6464 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6465 \pgfpathclose
6466 \pgf@circ@draworfill
6467 \endpgfscope
6468
6469 \pgf@circ@res@up = .5\pgf@circ@res@up
6470 \pgfscope
6471 \pgftransformrotate{90}
6472 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6473 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6474 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6475 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6476 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6477 \pgfusepath{draw}
6478 \endpgfscope
6479 }
6480
6481 %% Controlled current source
6482 \pgfcircdeclarebipolescaled{csources}
6483 {}
6484 {\ctikzvalof{bipoles/cisource/height}}
6485 {cisource}
6486 {\ctikzvalof{bipoles/cisource/height}}
6487 {\ctikzvalof{bipoles/cisource/width}}
6488 {
6489
6490 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6491
6492 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6493 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6494 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6495 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6496 \pgfpathclose
6497 \pgf@circ@draworfill
6498
6499 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6500 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6501 \pgfusepath{draw}
6502 }
6503
6504 %% Controlled current source - American
6505 \pgfcircdeclarebipolescaled{csources}
6506 {}
6507 {\ctikzvalof{bipoles/cisourceam/height}}
6508 {cisourceAM}
6509 {\ctikzvalof{bipoles/cisourceam/height}}
6510 {\ctikzvalof{bipoles/cisourceam/width}}
6511 {
6512 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6513
6514 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6515 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6516 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6517 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6518 \pgfpathclose
6519 \pgf@circ@draworfill
6520 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
6521 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
6522 \pgfusepath{draw}
6523 \pgfscope
6524 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
6525 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
6526 \endpgfscope
6527 }
6528
6529 %% Cute Independent voltage source
6530 \pgfcircdeclarebipolescaled{sources}
6531 {}
6532 {\ctikzvalof{bipoles/vsource/height}}
6533 {vsourceC}
6534 {\ctikzvalof{bipoles/vsource/height}}
6535 {\ctikzvalof{bipoles/vsource/width}}
6536 {
6537 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6538 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6539 \pgf@circ@draworfill
6540 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6541 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6542 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6543 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6544 \pgfsetroundcap\pgfusepath{draw}
6545 }
6546
6547 %% Cute Independent current source
6548 \pgfcircdeclarebipolescaled{sources}
6549 {}
6550 {\ctikzvalof{bipoles/isource/height}}
6551 {isourceC}
6552 {\ctikzvalof{bipoles/isource/height}}
6553 {\ctikzvalof{bipoles/isource/width}}
6554 {
6555 \pgfpointorigin
6556 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6557 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6558 \pgf@circ@draworfill
6559 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6560 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6561 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6562 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6563 \pgfsetroundcap\pgfusepath{draw}
6564 }
6565
6566 %% Cute Controlled voltage source
6567 \pgfcircdeclarebipolescaled{csources}
6568 {}
6569 {\ctikzvalof{bipoles/cvsource/height}}
6570 {cvsourceC}
6571 {\ctikzvalof{bipoles/cvsource/height}}
6572 {\ctikzvalof{bipoles/cvsource/width}}
6573 {
6574 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6575 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6576 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6577 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6578 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6579 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6580 \pgf@circ@draworfill
6581 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6582 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6583 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6584 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6585 \pgfsetroundcap\pgfusepath{draw}
6586 }
6587
6588 %% Cute Controlled current source
6589 \pgfcircdeclarebipolescaled{csources}
6590 {}
6591 {\ctikzvalof{bipoles/cisource/height}}
6592 {cisourceC}
6593 {\ctikzvalof{bipoles/cisource/height}}
6594 {\ctikzvalof{bipoles/cisource/width}}
6595 {
6596 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6597 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6598 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
6599 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6600 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
6601 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6602 \pgf@circ@draworfill
6603 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6604 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6605 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
6606 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
6607 \pgfsetroundcap\pgfusepath{draw}
6608 }
6609
6610 %% Noise voltage source
6611 \pgfcircdeclarebipolescaled{sources}
6612 {}
6613 {\ctikzvalof{bipoles/vsource/height}}
6614 {vsourceN}
6615 {\ctikzvalof{bipoles/vsource/height}}
6616 {\ctikzvalof{bipoles/vsource/width}}
6617 {
6618 \pgfscope
6619 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6620 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6621 %
6622 \pgf@circ@scaled@Rlen=\scaledRlen
6623 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6624 \edef\pgf@noise@temp{dashed}
6625 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6626 \ifx\pgf@noise@temp\pgf@noise@fill
6627 % fillable in this case
6628 \pgf@circ@draworfillandclip
6629 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6630 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6631 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6632 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6633 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6634 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6635 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6636 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6637 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6638 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6639 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6640 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6641 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6642 %
6643 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6644 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6645 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6646 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6647 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6648 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6649 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6650 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6651 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6652 \pgfusepath{draw}
6653 \else
6654 \pgfsetfillcolor{\pgf@noise@fill}
6655 \pgfusepath{draw,fill}
6656 \fi
6657 \endpgfscope
6658 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6659 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6660 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
6661 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
6662 \pgfsetroundcap\pgfusepath{draw}
6663 }
6664 %% Noise current source
6665
6666 \pgfcircdeclarebipolescaled{sources}
6667 {}
6668 {\ctikzvalof{bipoles/isource/height}}
6669 {isourceN}
6670 {\ctikzvalof{bipoles/isource/height}}
6671 {\ctikzvalof{bipoles/isource/width}}
6672 {
6673 \pgfpointorigin
6674 \pgfscope
6675 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6676 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6677 %
6678 \pgf@circ@scaled@Rlen=\scaledRlen
6679 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
6680 \edef\pgf@noise@temp{dashed}
6681 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
6682 \ifx\pgf@noise@temp\pgf@noise@fill
6683 % fillable in this case
6684 \pgf@circ@draworfillandclip
6685 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
6686 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
6687 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6688 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6689 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6690 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6691 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6692 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6693 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6694 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6695 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
6696 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6697 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6698 %
6699 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
6700 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6701 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6702 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6703 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6704 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6705 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
6706 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6707 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6708 \pgfusepath{draw}
6709 \else
6710 \pgfsetfillcolor{\pgf@noise@fill}
6711 \pgfusepath{draw,fill}
6712 \fi
6713 \endpgfscope
6714 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
6715 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
6716 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
6717 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
6718 \pgfsetroundcap\pgfusepath{draw}
6719 }
6720
6721 %%%%%%%%%%%%%%
6722 %% Diodes
6723 %%%%%%%%%%%%%%
6724
6725 %% Black generic diode
6726 \pgfcircdeclarebipolescaled{diodes}
6727 {}
6728 {\ctikzvalof{bipoles/diode/height}}
6729 {fulldiode}
6730 {\ctikzvalof{bipoles/diode/height}}
6731 {\ctikzvalof{bipoles/diode/width}}
6732 {
6733
6734 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6735
6736 \pgfscope
6737 \pgftransformxshift{\pgf@circ@res@left}
6738 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6739 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6740 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6741 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6742 \pgfusepath{draw,fill}
6743 \endpgfscope
6744 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6745 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6746 \pgfusepath{draw}
6747 }
6748
6749 %% Black Zener diode
6750 \pgfcircdeclarebipolescaled{diodes}
6751 {}
6752 {\ctikzvalof{bipoles/diode/height}}
6753 {fullzdiode}
6754 {\ctikzvalof{bipoles/diode/height}}
6755 {\ctikzvalof{bipoles/diode/width}}
6756 {
6757
6758 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6759
6760 \pgfscope
6761 \pgftransformxshift{\pgf@circ@res@left}
6762 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6763 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6764 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6765 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6766 \pgfusepath{draw,fill}
6767 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6768 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6769 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6770 \pgfusepath{draw}
6771 \endpgfscope
6772 }
6773
6774 %% Black alternative zigzag Zener diode
6775 \pgfcircdeclarebipolescaled{diodes}
6776 {}
6777 {\ctikzvalof{bipoles/diode/height}}
6778 {fullzzdiode}
6779 {\ctikzvalof{bipoles/diode/height}}
6780 {\ctikzvalof{bipoles/diode/width}}
6781 {
6782
6783 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6784
6785 \pgfscope
6786 \pgftransformxshift{\pgf@circ@res@left}
6787 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6788 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6789 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6790 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6791 \pgfusepath{draw,fill}
6792 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
6793 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6794 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6795 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
6796 \pgfusepath{draw}
6797 \endpgfscope
6798 }
6799
6800 %% Black Schottky diode
6801 \pgfcircdeclarebipolescaled{diodes}
6802 {}
6803 {\ctikzvalof{bipoles/diode/height}}
6804 {fullsdiode}
6805 {\ctikzvalof{bipoles/diode/height}}
6806 {\ctikzvalof{bipoles/diode/width}}
6807 {
6808
6809 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6810 \pgfscope
6811 \pgftransformxshift{\pgf@circ@res@left}
6812 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6813 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6814 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6815 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6816 \pgfusepath{draw,fill}
6817
6818 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
6819 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6820 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6821 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6823 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6824 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
6825 \pgfusepath{draw}
6826 \endpgfscope
6827
6828 }
6829
6830 %% Black tunnel diode
6831 \pgfcircdeclarebipolescaled{diodes}
6832 {}
6833 {\ctikzvalof{bipoles/diode/height}}
6834 {fulltdiode}
6835 {\ctikzvalof{bipoles/diode/height}}
6836 {\ctikzvalof{bipoles/diode/width}}
6837 {
6838
6839 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6840 \pgfscope
6841 \pgftransformxshift{\pgf@circ@res@left}
6842 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6843 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6844 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6846 \pgfusepath{draw,fill}
6847
6848 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
6849 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
6850 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
6851 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
6852 \pgfusepath{draw}
6853 \endpgfscope
6854 }
6855
6856 %
6857 % draw LED arrows
6858 %
6859 \def\pgf@circ@draw@ledarrows{%
6860 \pgfsetlinewidth{\pgfstartlinewidth}
6861 \pgfsetarrowsend{latexslim}
6862 \ifpgf@led@fliparrows
6863 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
6864 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6865 \pgfusepath{draw}
6866 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
6867 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
6868 \pgfusepath{draw}
6869 \else
6870 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6871 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6872 \pgfusepath{draw}
6873 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6874 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6875 \pgfusepath{draw}
6876 \fi
6877 }
6878 %
6879 % ---and photodiode arrows
6880 %
6881 \def\pgf@circ@draw@pdarrows{%
6882 \pgfsetlinewidth{\pgfstartlinewidth}
6883 \pgfsetarrowsstart{latexslim}
6884 \ifpgf@pd@fliparrows
6885 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
6886 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6887 \pgfusepath{draw}
6888 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
6889 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
6890 \pgfusepath{draw}
6891 \else
6892 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6893 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
6894 \pgfusepath{draw}
6895 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
6896 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
6897 \pgfusepath{draw}
6898 \fi
6899 }
6900 %% Black light emitting diode
6901 \pgfcircdeclarebipolescaled{diodes}
6902 {}
6903 {\ctikzvalof{bipoles/diode/height}}
6904 {fulllediode}
6905 {\ctikzvalof{bipoles/diode/height}}
6906 {\ctikzvalof{bipoles/diode/width}}
6907 {
6908
6909 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6910 \pgfscope
6911 \pgftransformxshift{\pgf@circ@res@left}
6912 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6913 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6914 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6915 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6916 \pgfusepath{draw,fill}
6917 \endpgfscope
6918 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6919 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6920 \pgfusepath{draw}
6921
6922 \pgf@circ@draw@ledarrows
6923 }
6924
6925 %% Black photodiode
6926 \pgfcircdeclarebipolescaled{diodes}
6927 {}
6928 {\ctikzvalof{bipoles/diode/height}}
6929 {fullpdiode}
6930 {\ctikzvalof{bipoles/diode/height}}
6931 {\ctikzvalof{bipoles/diode/width}}
6932 {
6933
6934 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6935 \pgfscope
6936 \pgftransformxshift{\pgf@circ@res@left}
6937 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6938 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6939 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6940 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6941 \pgfusepath{draw,fill}
6942 \endpgfscope
6943 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6944 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6945 \pgfusepath{draw}
6946
6947 \pgf@circ@draw@pdarrows
6948 }
6949
6950 %% Black varcap
6951 \pgfcircdeclarebipolescaled{diodes}
6952 {}
6953 {\ctikzvalof{bipoles/varcap/height}}
6954 {fullvarcap}
6955 {\ctikzvalof{bipoles/varcap/height}}
6956 {\ctikzvalof{bipoles/varcap/width}}
6957 {
6958 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
6959 \pgfsetlinewidth{\pgf@circ@res@temp}
6960 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6961 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6962 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6963 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
6964 \pgfusepath{draw,fill}
6965 %
6966 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
6967 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
6968 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6969 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6970 \pgfusepath{draw}
6971 }
6972
6973 %% Code for the diode triangle
6974 \def\pgf@circ@basicdiodeshape{
6975 % \pgfscope
6976 \pgftransformxshift{\pgf@circ@res@left}
6977 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6978 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
6979 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
6980 \pgfpathclose
6981 \pgf@circ@draworfill
6982 \pgfscope
6983 % to allow filling, we need to draw explicitly the stroke here.
6984 \pgfsetlinewidth{\pgfstartlinewidth}
6985 \ifpgf@circuit@bipole@strokedsymbol
6986 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
6987 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
6988 \pgfusepath{draw}
6989 \fi
6990 \endpgfscope
6991 % \endpgfscope
6992 }
6993
6994 %% Empty generic diode
6995 \pgfcircdeclarebipolescaled{diodes}
6996 {}
6997 {\ctikzvalof{bipoles/diode/height}}
6998 {emptydiode}
6999 {\ctikzvalof{bipoles/diode/height}}
7000 {\ctikzvalof{bipoles/diode/width}}
7001 {
7002 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7003 \pgfscope
7004 \pgf@circ@basicdiodeshape
7005 \endpgfscope
7006 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7007 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7008 \pgfusepath{draw}
7009 }
7010
7011 %% Empty Zener diode
7012 \pgfcircdeclarebipolescaled{diodes}
7013 {}
7014 {\ctikzvalof{bipoles/diode/height}}
7015 {emptyzdiode}
7016 {\ctikzvalof{bipoles/diode/height}}
7017 {\ctikzvalof{bipoles/diode/width}}
7018 {
7019
7020 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7021
7022 \pgfscope
7023 \pgf@circ@basicdiodeshape
7024 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7025 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7026 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7027 \pgfusepath{draw}
7028 \endpgfscope
7029 }
7030
7031 %% Empty alternative zigzag Zener diode
7032 \pgfcircdeclarebipolescaled{diodes}
7033 {}
7034 {\ctikzvalof{bipoles/diode/height}}
7035 {emptyzzdiode}
7036 {\ctikzvalof{bipoles/diode/height}}
7037 {\ctikzvalof{bipoles/diode/width}}
7038 {
7039
7040 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7041
7042 \pgfscope
7043 \pgf@circ@basicdiodeshape
7044 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@up}}
7045 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7046 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7047 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@[email protected]\pgf@circ@res@down}}
7048 \pgfusepath{draw}
7049 \endpgfscope
7050 }
7051 %% Empty Schottky diode
7052 \pgfcircdeclarebipolescaled{diodes}
7053 {}
7054 {\ctikzvalof{bipoles/diode/height}}
7055 {emptysdiode}
7056 {\ctikzvalof{bipoles/diode/height}}
7057 {\ctikzvalof{bipoles/diode/width}}
7058 {
7059
7060 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7061 \pgfscope
7062 \pgf@circ@basicdiodeshape
7063 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
7064 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7065 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7066 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7067 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7068 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7069 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
7070 \pgfusepath{draw}
7071 \endpgfscope
7072
7073 }
7074
7075 %% Empty tunnel diode
7076 \pgfcircdeclarebipolescaled{diodes}
7077 {}
7078 {\ctikzvalof{bipoles/diode/height}}
7079 {emptytdiode}
7080 {\ctikzvalof{bipoles/diode/height}}
7081 {\ctikzvalof{bipoles/diode/width}}
7082 {
7083
7084 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7085 \pgfscope
7086 \pgf@circ@basicdiodeshape
7087 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
7088 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
7089 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
7090 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
7091 \pgfusepath{draw}
7092 \endpgfscope
7093 }
7094
7095 %% Empty light emitting diode
7096 \pgfcircdeclarebipolescaled{diodes}
7097 {}
7098 {\ctikzvalof{bipoles/diode/height}}
7099 {emptylediode}
7100 {\ctikzvalof{bipoles/diode/height}}
7101 {\ctikzvalof{bipoles/diode/width}}
7102 {
7103
7104 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7105 \pgfscope
7106 \pgf@circ@basicdiodeshape
7107 \endpgfscope
7108 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7109 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7110 \pgfusepath{draw}
7111
7112 \pgf@circ@draw@ledarrows
7113 }
7114
7115 %% Empty photodiode
7116 \pgfcircdeclarebipolescaled{diodes}
7117 {}
7118 {\ctikzvalof{bipoles/diode/height}}
7119 {emptypdiode}
7120 {\ctikzvalof{bipoles/diode/height}}
7121 {\ctikzvalof{bipoles/diode/width}}
7122 {
7123
7124 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7125 \pgfscope
7126 \pgf@circ@basicdiodeshape
7127 \endpgfscope
7128 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7129 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7130 \pgfusepath{draw}
7131
7132 \pgf@circ@draw@pdarrows
7133 }
7134
7135 %% Empty varcap
7136 \pgfcircdeclarebipolescaled{diodes}
7137 {}
7138 {\ctikzvalof{bipoles/varcap/height}}
7139 {emptyvarcap}
7140 {\ctikzvalof{bipoles/varcap/height}}
7141 {\ctikzvalof{bipoles/varcap/width}}
7142 {
7143 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
7144 \pgfsetlinewidth{\pgf@circ@res@temp}
7145 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7146 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7147 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7148 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7149 \pgfpathclose
7150 \pgf@circ@draworfill
7151 \pgfscope
7152 % to allow filling, we need to draw explicitily the stroke here.
7153 \pgfsetlinewidth{\pgfstartlinewidth}
7154 \ifpgf@circuit@bipole@strokedsymbol
7155 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
7156 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7157 \pgfusepath{draw}
7158 \fi
7159 \endpgfscope
7160 %
7161 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
7162 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
7163 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7164 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7165 \pgfusepath{draw}
7166 }
7167
7168 %% Empty bidirectionaldiode
7169 \pgfcircdeclarebipolescaled{diodes}
7170 {}
7171 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7172 {emptybidirectionaldiode}
7173 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7174 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7175 {
7176
7177 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7178
7179 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7180 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7181
7182 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7183 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7184 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7185 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7186
7187 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7188 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7189 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7190 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7191
7192 \pgf@circ@draworfill
7193
7194 \pgfsetlinewidth{\pgfstartlinewidth}
7195
7196 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7197 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7198
7199 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7200 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7201
7202 \pgfusepath{draw}
7203 }
7204
7205 %% Full bidirectionaldiode
7206 \pgfcircdeclarebipolescaled{diodes}
7207 {}
7208 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7209 {fullbidirectionaldiode}
7210 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
7211 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
7212 {
7213
7214 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7215
7216 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
7217 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
7218
7219 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7220 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7221 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7222 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7223
7224 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7225 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7226 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7227 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7228
7229 \pgfusepath{draw, fill}
7230
7231 \pgfsetlinewidth{\pgfstartlinewidth}
7232
7233 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7234 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7235
7236 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7237 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7238
7239 \pgfusepath{draw}
7240 }
7241
7242 %% Black thyristor
7243 \pgfcircdeclarebipolescaled{diodes}
7244 {
7245 \anchor{gate}{\northeast}
7246 \anchor{anode}{\southwest\pgf@y=0cm}
7247 \anchor{G}{\northeast}
7248 \anchor{cathode}{\northeast\pgf@y=0cm }
7249 }
7250 {\ctikzvalof{tripoles/thyristor/height 2}}
7251 {fullthyristor}
7252 {\ctikzvalof{tripoles/thyristor/height}}
7253 {\ctikzvalof{tripoles/thyristor/width}}
7254 {
7255
7256 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7257
7258 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7259 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7260
7261 \pgfscope
7262 \pgftransformxshift{\pgf@circ@res@other}
7263 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7264
7265 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
7266 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7267 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7268 \pgfusepath{draw,fill}
7269
7270 \pgfsetlinewidth{\pgfstartlinewidth}
7271
7272 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7273 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
7274 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
7275 \pgfusepath{draw}
7276 \endpgfscope
7277
7278 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7279 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7280
7281 \pgfusepath{draw}
7282
7283 \pgfsetlinewidth{\pgfstartlinewidth}
7284
7285 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7286 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7287
7288 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7289 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7290
7291 \pgfusepath{draw}
7292
7293 }
7294
7295 %% Empty thyristor
7296
7297 \pgfcircdeclarebipolescaled{diodes}
7298 {
7299 \anchor{gate}{\northeast}
7300 \anchor{anode}{\southwest\pgf@y=0cm}
7301 \anchor{G}{\northeast}
7302 \anchor{cathode}{\northeast\pgf@y=0cm }
7303 }
7304 {\ctikzvalof{tripoles/thyristor/height 2}}
7305 {emptythyristor}
7306 {\ctikzvalof{tripoles/thyristor/height}}
7307 {\ctikzvalof{tripoles/thyristor/width}}
7308 {
7309
7310 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7311
7312 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
7313 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
7314
7315 \pgfscope
7316 \pgftransformxshift{\pgf@circ@res@other}
7317 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7318
7319 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@down}}
7320 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
7321 \pgfpathclose
7322 \pgf@circ@draworfill
7323 \pgfscope
7324 % to allow filling, we need to draw explicitily the stroke here.
7325 \pgfsetlinewidth{\pgfstartlinewidth}
7326 \ifpgf@circuit@bipole@strokedsymbol
7327 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7328 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
7329 \pgfusepath{draw}
7330 \fi
7331 \endpgfscope
7332
7333 \pgfsetlinewidth{\pgfstartlinewidth}
7334
7335 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
7336 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}}
7337 \pgfpathlineto{\pgfpoint{2*\pgf@circ@res@step-2*\pgf@circ@res@other}{\pgf@circ@res@up}}
7338 \pgfusepath{draw}
7339 \endpgfscope
7340
7341 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7342 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
7343
7344 \pgfusepath{draw}
7345
7346 \pgfsetlinewidth{\pgfstartlinewidth}
7347
7348 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7349 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7350
7351 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7352 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7353
7354 \pgfusepath{draw}
7355 }
7356
7357 %% Empty triac
7358 \pgfcircdeclarebipolescaled{diodes}
7359 {
7360 \anchor{gate}{\northeast}
7361 \anchor{anode}{\southwest\pgf@y=0cm}
7362 \anchor{G}{\northeast}
7363 \anchor{cathode}{\northeast\pgf@y=0cm }
7364 }
7365 {\ctikzvalof{tripoles/triac/height}}
7366 {emptytriac}
7367 {\ctikzvalof{tripoles/triac/height}}
7368 {\ctikzvalof{tripoles/triac/width}}
7369 {
7370
7371 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7372
7373 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7374 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7375
7376 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7377 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7378 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7380
7381 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7382 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7383 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7384 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7385
7386 \pgf@circ@draworfill
7387
7388 \pgfsetlinewidth{\pgfstartlinewidth}
7389
7390 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7391 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7392 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7393
7394 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7395 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7396
7397 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7398 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7399
7400 \pgfusepath{draw}
7401 }
7402
7403 %% Full triac
7404 \pgfcircdeclarebipolescaled{diodes}
7405 {
7406 \anchor{gate}{\northeast}
7407 \anchor{anode}{\southwest\pgf@y=0cm}
7408 \anchor{G}{\northeast}
7409 \anchor{cathode}{\northeast\pgf@y=0cm }
7410 }
7411 {\ctikzvalof{tripoles/triac/height}}
7412 {fulltriac}
7413 {\ctikzvalof{tripoles/triac/height}}
7414 {\ctikzvalof{tripoles/triac/width}}
7415 {
7416 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7417
7418 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
7419 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
7420
7421 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7422 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7423 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7424 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7425
7426 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7427 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7428 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7429 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
7430
7431 \pgfusepath{draw,fill}
7432
7433 \pgfsetlinewidth{\pgfstartlinewidth}
7434
7435 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7436 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
7437 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
7438
7439 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
7440 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7441
7442 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
7443 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7444
7445 \pgfusepath{draw}
7446 }
7447
7448 %%%%%%%%%%%%%
7449 %% switches
7450 %%%%%%%%%%%%%
7451
7452 %% (Closing) SPST
7453 \pgfcircdeclarebipolescaled{switches}
7454 {}
7455 {\ctikzvalof{bipoles/spst/depth}}
7456 {cspst}
7457 {\ctikzvalof{bipoles/spst/height}}
7458 {\ctikzvalof{bipoles/spst/width}}
7459 {
7460 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7461 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7462 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7463 \pgfusepath{draw}
7464
7465 \pgfscope
7466 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7467 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
7468 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
7469 \pgfsetarrowsend{latexslim}
7470 \pgfsetbeveljoin
7471 \pgfusepath{draw}
7472 \endpgfscope
7473 }
7474
7475 %% Opening SPST
7476 \pgfcircdeclarebipolescaled{switches}
7477 {}
7478 {\ctikzvalof{bipoles/spst/depth}}
7479 {ospst}
7480 {\ctikzvalof{bipoles/spst/height}}
7481 {\ctikzvalof{bipoles/spst/width}}
7482 {
7483
7484 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7485 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7486 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
7487 \pgfusepath{draw}
7488
7489 \pgfscope
7490 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7491 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
7492 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
7493 \pgfsetarrowsend{latexslim}
7494 \pgfsetbeveljoin
7495 \pgfusepath{draw}
7496 \endpgfscope
7497 }
7498
7499 %% Normal open Switch
7500 \pgfcircdeclarebipolescaled{switches}
7501 {}
7502 {\ctikzvalof{bipoles/nos/depth}}
7503 {nos}
7504 {\ctikzvalof{bipoles/nos/height}}
7505 {\ctikzvalof{bipoles/nos/width}}
7506 {
7507
7508 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7509 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7510 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
7511 \pgfsetbuttcap
7512 \pgfusepath{draw}
7513 }
7514
7515 %% Normal closed Switch
7516 \pgfcircdeclarebipolescaled{switches}
7517 {}
7518 {\ctikzvalof{bipoles/ncs/depth}}
7519 {ncs}
7520 {\ctikzvalof{bipoles/ncs/height}}
7521 {\ctikzvalof{bipoles/ncs/width}}
7522 {
7523 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7524 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7525 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
7526 \pgfusepath{draw}
7527 \pgfsetlinewidth{\pgfstartlinewidth}
7528 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7529 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
7530 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
7531 \pgfusepath{draw}
7532 }
7533
7534 %% Push Button
7535 \pgfcircdeclarebipolescaled{switches}
7536 {}
7537 {\ctikzvalof{bipoles/pushbutton/height 2}}
7538 {pushbutton}
7539 {\ctikzvalof{bipoles/pushbutton/height}}
7540 {\ctikzvalof{bipoles/pushbutton/width}}
7541 {
7542 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7543 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
7544 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
7545 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
7546 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
7547 \pgfusepath{draw}
7548
7549 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7550 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7551 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7552 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7553 }
7554
7555 %% Normally closed Push Button
7556 \pgfcircdeclarebipolescaled{switches}
7557 {}
7558 {\ctikzvalof{bipoles/pushbutton/height 2}}
7559 {ncpushbutton}
7560 {\ctikzvalof{bipoles/pushbutton/height}}
7561 {\ctikzvalof{bipoles/pushbutton/width}}
7562 {
7563 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7564 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7565 % Warning, if the nodes will have a class, we have to touch this.
7566 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7567 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
7568 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
7569 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
7570 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
7571 \pgfusepath{draw}
7572 %
7573 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7574 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7575 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7576 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
7577 }
7578 %%% reed switches
7579 \pgfcircdeclarebipolescaled{switches}
7580 {}
7581 {\ctikzvalof{bipoles/reed/depth}}
7582 {reed}
7583 {\ctikzvalof{bipoles/reed/height}}
7584 {\ctikzvalof{bipoles/reed/width}}
7585 {
7586 % this is designed to be the same as a "nos".
7587 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
7588 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
7589 \pgfscope
7590 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7591 % eclosure
7592 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
7593 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
7594 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
7595 \pgfpatharc{270}{90}{\pgf@circ@res@up}
7596 \pgfpathclose
7597 \pgf@circ@draworfill
7598 % switch
7599 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
7600 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
7601 % connection lines
7602 \pgfsetbuttcap
7603 \pgfusepath{draw}
7604 \endpgfscope
7605 % connection lines
7606 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7607 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
7608 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
7609 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
7610 \pgfusepath{draw}
7611 }
7612
7613 % cute switch "to" shapes help function
7614 % #1 -> name
7615 % #2 -> barposition
7616 % #3 -> arrowcode
7617 \long\def\pgfcircdeclarecutesw#1#2#3{
7618 \pgfcircdeclarebipolescaled{switches}
7619 {
7620 \savedanchor\midlever{
7621 % these values are calculated when we create the definition of the shape.
7622 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
7623 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
7624 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
7625 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
7626 \pgf@circ@res@down = -.5\pgf@y
7627 \pgf@circ@res@up = .5\pgf@y
7628 \pgfextracty{\pgf@circ@res@other}{#2}
7629 \pgf@x=0pt
7630 \pgf@y=.5\pgf@circ@res@other
7631 }
7632 % radius of the connector
7633 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7634 % If cnnecting nodes are scaled, we have to modify this
7635 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
7636 % shapename
7637 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
7638 % shape type
7639 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
7640 % mid of the lever, to stack switches
7641 \anchor{mid}{\midlever}
7642 \anchor{cout}{\northeast \pgf@y=0cm}
7643 \anchor{cin}{\southwest\pgf@y=0cm}
7644 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
7645 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
7646 }
7647 {\ctikzvalof{bipoles/cuteswitch/height 2}}
7648 {#1}
7649 {\ctikzvalof{bipoles/cuteswitch/height}}
7650 {\ctikzvalof{bipoles/cuteswitch/width}}{
7651 \pgfscope
7652 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
7653 % If cnnecting nodes are scaled, we have to modify this
7654 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
7655 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
7656 \pgfsetlinewidth{2\pgf@circ@res@temp}
7657 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
7658 \pgfpathlineto{#2}
7659 \pgfsetroundcap\pgfusepath{draw}
7660 \endpgfscope
7661 \pgfscope % arrow
7662 #3
7663 \endpgfscope
7664 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
7665 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
7666 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
7667 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
7668 }
7669 }
7670
7671 %% closed cute switch
7672 \pgfcircdeclarecutesw{cuteclosedswitch}
7673 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
7674 {}
7675
7676 %% open cute switch
7677 \pgfcircdeclarecutesw{cuteopenswitch}
7678 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7679 {}
7680
7681 %% closing cute switch
7682 \pgfcircdeclarecutesw{cuteclosingswitch}
7683 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7684 {
7685 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7686 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
7687 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
7688 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
7689 \pgfsetarrowsend{latexslim}
7690 \pgfusepath{draw}
7691 }
7692
7693 %% opening cute switch
7694 \pgfcircdeclarecutesw{cuteopeningswitch}
7695 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
7696 {
7697 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7698 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
7699 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
7700 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
7701 \pgfsetarrowsend{latexslim}
7702 \pgfusepath{draw}
7703 }
7704
7705 %%%%%%%%%%%%%%%%%
7706 %% Instruments
7707 %%%%%%%%%%%%%%%%%
7708
7709 % % METERINGSHAPE
7710 \long\def\drawmeteringcircle{
7711 \def\pgf@circ@temp{right}
7712 \ifx\tikz@res@label@pos\pgf@circ@temp
7713 \pgf@circ@res@step=-1.2\pgf@circ@res@up
7714 \else
7715 \def\pgf@circ@temp{below}
7716 \ifx\tikz@res@label@pos\pgf@circ@temp
7717 \pgf@circ@res@step=-1.2\pgf@circ@res@up
7718 \else
7719 \pgf@circ@res@step=1.2\pgf@circ@res@up
7720 \fi
7721 \fi
7722 %draw connections to circle
7723 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7724 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
7725 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
7726 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7727 \pgfusepath{draw}
7728 %draw circle
7729 \pgfscope
7730 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7731 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
7732 \pgf@circ@draworfill
7733 \endpgfscope
7734 %draw arrow
7735 \pgfscope
7736 \pgfsetarrowsend{latex}
7737 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7738 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
7739 \pgfusepath{draw}
7740 \endpgfscope
7741 }
7742
7743 %AMPEREMETER
7744 \pgfcircdeclarebipolescaled{instruments}
7745 {}
7746 {\ctikzvalof{bipoles/ammeter/height}}
7747 {ammeter}
7748 {\ctikzvalof{bipoles/ammeter/height}}
7749 {\ctikzvalof{bipoles/ammeter/width}}
7750 {
7751 \drawmeteringcircle
7752 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
7753 }
7754 %OHMMETER
7755 \pgfcircdeclarebipolescaled{instruments}
7756 {}
7757 {\ctikzvalof{bipoles/ohmmeter/height}}
7758 {ohmmeter}
7759 {\ctikzvalof{bipoles/ohmmeter/height}}
7760 {\ctikzvalof{bipoles/ohmmeter/width}}
7761 {
7762 \drawmeteringcircle
7763 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
7764 }
7765 %VOLTMETER
7766 \pgfcircdeclarebipolescaled{instruments}
7767 {}
7768 {\ctikzvalof{bipoles/voltmeter/height}}
7769 {voltmeter}
7770 {\ctikzvalof{bipoles/voltmeter/height}}
7771 {\ctikzvalof{bipoles/voltmeter/width}}
7772 {
7773 \drawmeteringcircle
7774 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
7775
7776 }
7777
7778 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
7779 \pgfcircdeclarebipolescaled{instruments}
7780 {
7781 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
7782 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
7783 % put the node text above and centered
7784 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7785 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7786 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7787 }
7788 }
7789 }
7790 {\ctikzvalof{bipoles/oscope/height}}
7791 {oscope}
7792 {\ctikzvalof{bipoles/oscope/height}}
7793 {\ctikzvalof{bipoles/oscope/width}}
7794 {
7795 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7796 \pgfextracty{\pgf@circ@res@up}{\northeast}
7797 \pgfextractx{\pgf@circ@res@right}{\northeast}
7798 \pgfextractx{\pgf@circ@res@left}{\southwest}
7799 \pgfextracty{\pgf@circ@res@down}{\southwest}
7800 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7801 \pgfscope
7802 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7803 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7804 % this would create a round (analog?) scope...
7805 % \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7806 \pgf@circ@draworfill
7807 \endpgfscope
7808 % get the rotation
7809 \ifpgf@circuit@straightinstruments
7810 \pgfgettransformentries\a\b\temp\temp\temp\temp
7811 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7812 \else
7813 \edef\rot{0}
7814 \fi
7815 % and unrotate the scope
7816 \pgfscope
7817 \pgftransformrotate{\rot}
7818 % grid
7819 \pgfscope
7820 \pgfsetlinewidth{0.5\pgfstartlinewidth}
7821 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7822 \pgfpathgrid[stepx=\pgf@circ@res@step, stepy=\pgf@circ@res@step]%
7823 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
7824 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
7825 \pgfsetstrokeopacity{0.5}
7826 \pgfusepath{draw}
7827 \endpgfscope
7828 % function displayed, thanks to
7829 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7830 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7831 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
7832 \pgfpathlineto{\pgfpoint{0.05\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
7833 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
7834 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
7835 \pgfusepath{draw}
7836 \endpgfscope
7837 }
7838
7839 % generic round meter with always horizontal text, no arrow
7840 \pgfcircdeclarebipolescaled{instruments}
7841 {}
7842 {\ctikzvalof{bipoles/esource/height}}
7843 {rmeter}
7844 {\ctikzvalof{bipoles/esource/height}}
7845 {\ctikzvalof{bipoles/esource/width}}
7846 {
7847 \pgfpointorigin
7848 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7849 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7850 \pgf@circ@draworfill
7851 % draw the text label
7852 % get the rotation
7853 \ifpgf@circuit@straightinstruments
7854 \pgfgettransformentries\a\b\temp\temp\temp\temp
7855 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7856 \else
7857 \edef\rot{0}
7858 \fi
7859 % and unrotate the scope
7860 \pgfscope
7861 \pgfsetcolor{\ctikzvalof{color}}
7862 \pgftransformrotate{\rot}
7863 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
7864 \endpgfscope
7865 }
7866
7867 % generic round meter with always horizontal text, with arrow
7868 \pgfcircdeclarebipolescaled{instruments}
7869 {}
7870 {\ctikzvalof{bipoles/esource/height}}
7871 {rmeterwa}
7872 {\ctikzvalof{bipoles/esource/height}}
7873 {\ctikzvalof{bipoles/esource/width}}
7874 {
7875 \pgfpointorigin
7876 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7877 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7878 \pgf@circ@draworfill
7879 % draw the text label
7880 % get the rotation
7881 \ifpgf@circuit@straightinstruments
7882 \pgfgettransformentries\a\b\temp\temp\temp\temp
7883 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7884 \else
7885 \edef\rot{0}
7886 \fi
7887 % and unrotate the scope
7888 \pgfscope
7889 \pgftransformrotate{\rot}
7890 \pgfsetcolor{\ctikzvalof{color}}
7891 \pgfsetlinewidth{\pgfstartlinewidth}
7892 % arrow: create a center hole to have better visual
7893 \pgfscope
7894 % clipping path: first a rectangle bigger then the shape
7895 % to avoid problems with the line thickness
7896 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
7897 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
7898 % next open a circle into it
7899 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
7900 % do the difference and clip before drawing
7901 \pgfseteorule
7902 \pgfusepath{clip}
7903 \pgfsetarrowsend{latexslim}
7904 % the arrow is better if it has a bit of breath and it's not 45º
7905 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
7906 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
7907 \pgfusepath{draw}
7908 \endpgfscope
7909 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
7910 \endpgfscope
7911 }
7912
7913 % generic square meter with always horizontal text
7914 \pgfcircdeclarebipolescaled{instruments}
7915 {
7916 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
7917 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
7918 % put the node text above and centered
7919 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7920 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7921 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7922 }
7923 }
7924 }
7925 {\ctikzvalof{bipoles/smeter/height}}
7926 {smeter}
7927 {\ctikzvalof{bipoles/smeter/height}}
7928 {\ctikzvalof{bipoles/smeter/width}}
7929 {
7930 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7931 \pgfextracty{\pgf@circ@res@up}{\northeast}
7932 \pgfextractx{\pgf@circ@res@right}{\northeast}
7933 \pgfextractx{\pgf@circ@res@left}{\southwest}
7934 \pgfextracty{\pgf@circ@res@down}{\southwest}
7935 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7936 \pgfscope
7937 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7938 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7939 \pgf@circ@draworfill
7940 \endpgfscope
7941 % get the rotation
7942 \ifpgf@circuit@straightinstruments
7943 \pgfgettransformentries\a\b\temp\temp\temp\temp
7944 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
7945 \else
7946 \edef\rot{0}
7947 \fi
7948 % and unrotate the scope
7949 \pgfscope
7950 \pgftransformrotate{\rot}
7951 % the metering window
7952 \pgfscope
7953 \def\@starta{105}\def\@stopa{75}
7954 \pgfsetlinewidth{\pgfstartlinewidth}
7955 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
7956 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
7957 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
7958 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
7959 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
7960 \pgfclosepath
7961 \pgfpathmoveto{\pgfpointpolar{80}{2\pgf@circ@res@up}}
7962 \pgfpathlineto{\pgfpointpolar{80}{2.4\pgf@circ@res@up}}
7963 \pgfusepath{draw}
7964 \endpgfscope
7965 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
7966 \endpgfscope
7967 }
7968
7969 % probes qucs style:
7970 % #1 : name
7971 % #2 : extra code
7972 \long\def\pgfcirc@qucsprobe#1#2{
7973 \pgfcircdeclarebipolescaled{instruments}
7974 {
7975 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
7976 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
7977 % put the node text above and centered
7978 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
7979 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
7980 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
7981 }
7982 }
7983 }
7984 {\ctikzvalof{bipoles/qmeter/depth}}
7985 {#1}
7986 {\ctikzvalof{bipoles/qmeter/height}}
7987 {\ctikzvalof{bipoles/qmeter/width}}
7988 {
7989 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7990 \pgfextracty{\pgf@circ@res@up}{\northeast}
7991 \pgfextractx{\pgf@circ@res@right}{\northeast}
7992 \pgfextractx{\pgf@circ@res@left}{\southwest}
7993 \pgfextracty{\pgf@circ@res@down}{\southwest}
7994 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
7995 \pgfscope
7996 \pgfscope
7997 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
7998 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7999 \pgf@circ@draworfill
8000 \endpgfscope
8001 \def\@starta{103}\def\@stopa{77}
8002 \pgfsetlinewidth{\pgfstartlinewidth}
8003 \pgfscope
8004 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
8005 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
8006 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
8007 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
8008 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
8009 \pgfclosepath
8010 \pgfpathmoveto{\pgfpointpolar{83}{2.1\pgf@circ@res@up}}
8011 \pgfpathlineto{\pgfpointpolar{83}{2.4\pgf@circ@res@up}}
8012 \pgfusepath{draw}
8013 \pgf@circ@draworfill
8014 \endpgfscope
8015 #2
8016 \endpgfscope
8017 }
8018 }
8019
8020 \pgfcirc@qucsprobe{qiprobe}{
8021 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8022 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8023 \pgfusepath{draw}
8024 \pgfnode{currarrow}{center}{}{}{}
8025 }
8026
8027 \pgfcirc@qucsprobe{qvprobe}{
8028 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
8029 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8030 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
8031 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
8032 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
8033 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8034 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
8035 \pgfusepath{draw}
8036 \pgfscope
8037 % "+" and "-", drawn so that they scale correctly
8038 \pgfsetlinewidth{2\pgfstartlinewidth}
8039 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
8040 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
8041 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8042 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8043 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8044 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
8045 \pgfusepath{draw}
8046 \endpgfscope
8047 }
8048
8049 \pgfcirc@qucsprobe{qpprobe}{
8050 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8051 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8052 \pgfusepath{draw}
8053 \pgfnode{currarrow}{center}{}{}{}
8054 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
8055 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
8056 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
8057 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
8058 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
8059 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
8060 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
8061 \pgfusepath{draw}
8062 \pgfscope
8063 % "+" and "-", drawn so that they scale correctly
8064 \pgfsetlinewidth{2\pgfstartlinewidth}
8065 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
8066 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
8067 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8068 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8069 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8070 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
8071 \pgfusepath{draw}
8072 \endpgfscope
8073 }
8074
8075 % current loop for oscope and similar: stylized
8076 \pgfcircdeclarebipolescaled{instruments}
8077 {
8078 \anchor{i}{\northeast\pgf@x=0pt\relax}
8079 \anchor{text}{
8080 \pgfextracty{\pgf@circ@res@up}{\northeast}
8081 \pgfextractx{\pgf@circ@res@left}{\northeast}
8082 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
8083 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8084 }
8085 }
8086 }
8087 {\ctikzvalof{bipoles/iloop/height}}
8088 {iloop}
8089 {\ctikzvalof{bipoles/iloop/height}}
8090 {\ctikzvalof{bipoles/iloop/width}}
8091 {
8092 \pgfextracty{\pgf@circ@res@up}{\northeast}
8093 \pgfextractx{\pgf@circ@res@right}{\northeast}
8094 \pgf@circ@res@down=-\pgf@circ@res@up
8095 \pgf@circ@res@left=-\pgf@circ@res@right
8096 \pgfscope
8097 \pgfstartlinewidth=\pgflinewidth
8098 \pgfsetcolor{\ctikzvalof{color}}
8099 % external ellipse
8100 \pgfscope
8101 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8102 % clipping path: first a rectangle bigger then the shape
8103 % to avoid problems with the line thickness
8104 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8105 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8106 % next the opening to the left
8107 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
8108 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
8109 % do the difference and clip before drawing
8110 \pgfseteorule
8111 \pgfusepath{clip}
8112 \pgfpathellipse{\pgfpointorigin}{
8113 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
8114 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
8115 \pgfusepath{draw}
8116 \endpgfscope
8117 % internal wire
8118 \pgfsetlinewidth{\pgfstartlinewidth}
8119 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8120 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
8121 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
8122 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8123 % and the contact line up
8124 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
8125 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8126 \pgfusepath{draw}
8127 \endpgfscope
8128 }
8129
8130 % current loop for oscope and similar: real (double connection)
8131 \pgfcircdeclarebipolescaled{instruments}
8132 {
8133 \anchor{i+}{
8134 \pgfextracty{\pgf@circ@res@up}{\northeast}
8135 \pgfextractx{\pgf@circ@res@right}{\northeast}
8136 \pgf@circ@res@step=0.4\pgf@circ@res@right
8137 \pgf@circ@res@other=0.8\pgf@circ@res@up
8138 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
8139 \pgf@y=\pgf@circ@res@up
8140 }
8141 \anchor{i-}{
8142 \pgfextracty{\pgf@circ@res@up}{\northeast}
8143 \pgfextractx{\pgf@circ@res@right}{\northeast}
8144 \pgf@circ@res@step=0.4\pgf@circ@res@right
8145 \pgf@circ@res@other=0.8\pgf@circ@res@up
8146 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
8147 \pgf@y=\pgf@circ@res@up
8148 }
8149 \anchor{text}{
8150 \pgfextracty{\pgf@circ@res@up}{\northeast}
8151 \pgfextractx{\pgf@circ@res@left}{\northeast}
8152 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
8153 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
8154 }
8155 }
8156 }
8157 {\ctikzvalof{bipoles/iloop/height}}
8158 {iloop2}
8159 {\ctikzvalof{bipoles/iloop/height}}
8160 {\ctikzvalof{bipoles/iloop/width}}
8161 {
8162 \pgfextracty{\pgf@circ@res@up}{\northeast}
8163 \pgfextractx{\pgf@circ@res@right}{\northeast}
8164 \pgf@circ@res@down=-\pgf@circ@res@up
8165 \pgf@circ@res@left=-\pgf@circ@res@right
8166 % must be the same than internal i+ and i- anchors definition
8167 \pgf@circ@res@step=0.4\pgf@circ@res@right
8168 \pgf@circ@res@other=0.8\pgf@circ@res@up
8169 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
8170 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
8171 \pgfscope
8172 \pgfstartlinewidth=\pgflinewidth
8173 \pgfsetcolor{\ctikzvalof{color}}
8174 % external ellipse
8175 \pgfscope
8176 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
8177 % clipping path: first a rectangle bigger then the shape
8178 % to avoid problems with the line thickness
8179 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
8180 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
8181 % next the opening to the left
8182 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
8183 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
8184 % do the difference and clip before drawing
8185 \pgfseteorule
8186 \pgfusepath{clip}
8187 \pgfpathmoveto{\@plus}
8188 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
8189 \pgfusepath{draw}
8190 \endpgfscope
8191 % internal wire
8192 \pgfsetlinewidth{\pgfstartlinewidth}
8193 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8194 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
8195 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
8196 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8197 % and the contact line up
8198 % I use ...left and ---right as temporal lengths here to avoid defining more
8199 \pgfextractx{\pgf@circ@res@left}{\@plus}
8200 \pgfextractx{\pgf@circ@res@right}{\@minus}
8201 \pgfpathmoveto{\@plus}
8202 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8203 \pgfpathmoveto{\@minus}
8204 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8205 \pgfusepath{draw}
8206 \endpgfscope
8207 }
8208
8209
8210 %% Varistor
8211 \pgfcircdeclarebipolescaled{resistors}
8212 {}
8213 {\ctikzvalof{bipoles/varistor/height}}
8214 {varistor}
8215 {\ctikzvalof{bipoles/varistor/height}}
8216 {\ctikzvalof{bipoles/varistor/width}}
8217 {
8218 \pgfscope
8219 \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}}
8220 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8221 \pgf@circ@draworfill
8222 \endpgfscope
8223
8224 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
8225 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
8226 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8227 \pgfusepath{draw}
8228
8229 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
8230 }
8231
8232 %%%%%%%%%%%%%%
8233 %% RF bipoles
8234 %%%%%%%%%%%%%%
8235
8236 % transmission line
8237 \pgfcircdeclarebipolescaled{RF}
8238 {}
8239 {\ctikzvalof{bipoles/tline/height}}
8240 {tline}
8241 {\ctikzvalof{bipoles/tline/height}}
8242 {\ctikzvalof{bipoles/tline/width}}
8243 {
8244 \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
8245 \begin{pgftransparencygroup}
8246 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8247 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
8248 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
8249 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
8250 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
8251 \pgf@circ@draworfill
8252 \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
8253 {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}}
8254 \pgf@circ@draworfill
8255 \end{pgftransparencygroup}
8256 \pgfsetlinewidth{\pgfstartlinewidth}
8257 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
8258 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8259 \pgfusepath{stroke}
8260 }
8261
8262 % microstrip transmission line
8263 \pgfcircdeclarebipolescaled{RF}
8264 {}
8265 {\ctikzvalof{bipoles/mstline/height}}
8266 {mstline}
8267 {\ctikzvalof{bipoles/mstline/height}}
8268 {\ctikzvalof{bipoles/mstline/width}}
8269 {
8270 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8271 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8272 \pgf@circ@draworfill
8273 }
8274
8275 %%%%%%%%%%%%%%%%%%%
8276 %% Block diagrams
8277 %%%%%%%%%%%%%%%%%%%
8278
8279 %% Draw the two-port fillable box
8280 \def\pgf@circ@twoportbox{
8281 \pgfscope
8282 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8283 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8284 \pgf@circ@draworfill
8285 \endpgfscope
8286 }
8287
8288 %% Generic two port box
8289 \pgfcircdeclarebipolescaled{blocks}
8290 {}
8291 {\ctikzvalof{bipoles/twoport/height}}
8292 {twoport}
8293 {\ctikzvalof{bipoles/twoport/height}}
8294 {\ctikzvalof{bipoles/twoport/width}}
8295 {
8296 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
8297 \divide \pgf@circ@res@step by 2
8298
8299 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8300 \pgf@circ@res@other = \pgf@circ@res@left
8301 \advance\pgf@circ@res@other by \pgf@circ@res@step
8302 \ifpgf@circuit@dashed
8303 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8304 \fi
8305 % draw outer box
8306 \pgf@circ@twoportbox
8307 \ifpgf@circuit@inputarrow
8308 {
8309 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8310 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8311 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8312 }
8313 \fi
8314
8315 % rotate inner symbol
8316 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8317 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8318 \pgftransformrotate{270}
8319 \fi\fi
8320 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8321 \pgftransformrotate{180}
8322 \fi\fi
8323 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8324 \pgftransformrotate{90}
8325 \fi\fi
8326
8327 % draw inner symbol
8328 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
8329
8330 }
8331
8332 %% voltage controled oscillator
8333 \pgfcircdeclarebipolescaled{blocks}
8334 {}
8335 {\ctikzvalof{bipoles/vco/width}}
8336 {vco}
8337 {\ctikzvalof{bipoles/twoport/width}}
8338 {\ctikzvalof{bipoles/vco/width}}
8339 {
8340 \pgf@circ@res@step = \ctikzvalof{bipoles/vco/width}\pgf@circ@scaled@Rlen
8341 \divide \pgf@circ@res@step by 2
8342
8343 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8344 \pgf@circ@res@other = \pgf@circ@res@left
8345 \advance\pgf@circ@res@other by \pgf@circ@res@step
8346
8347 \ifpgf@circuit@dashed
8348 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8349 \fi
8350 % draw circle
8351 \pgfscope
8352 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8353 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
8354 \pgf@circ@draworfill
8355 \endpgfscope
8356 \ifpgf@circuit@inputarrow
8357 {
8358 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8359 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8360 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8361 }
8362 \fi
8363
8364 % rotate inner symbol
8365 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8366 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8367 \pgftransformrotate{270}
8368 \fi\fi
8369 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8370 \pgftransformrotate{180}
8371 \fi\fi
8372 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8373 \pgftransformrotate{90}
8374 \fi\fi
8375
8376 % draw inner sine waves
8377 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8378 \pgfsetlinewidth{\pgfstartlinewidth}
8379 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
8380 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8381 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8382 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8383 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8384 \pgfusepath{draw}
8385 }
8386
8387 %% bandpass filter
8388 \pgfcircdeclarebipolescaled{blocks}
8389 {}
8390 {\ctikzvalof{bipoles/bandpass/width}}
8391 {bandpass}
8392 {\ctikzvalof{bipoles/bandpass/width}}
8393 {\ctikzvalof{bipoles/bandpass/width}}
8394 {
8395
8396 \pgf@circ@res@step = \ctikzvalof{bipoles/bandpass/width}\pgf@circ@scaled@Rlen
8397 \divide \pgf@circ@res@step by 2
8398
8399 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8400 \pgf@circ@res@other = \pgf@circ@res@left
8401 \advance\pgf@circ@res@other by \pgf@circ@res@step
8402
8403 \ifpgf@circuit@dashed
8404 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8405 \fi
8406
8407 % draw outer box
8408 \pgf@circ@twoportbox
8409
8410 \ifpgf@circuit@inputarrow
8411 {
8412 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8413 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8414 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8415 }
8416 \fi
8417
8418 % rotate inner symbol
8419 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8420 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8421 \pgftransformrotate{270}
8422 \fi\fi
8423 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8424 \pgftransformrotate{180}
8425 \fi\fi
8426 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8427 \pgftransformrotate{90}
8428 \fi\fi
8429
8430 % draw inner symbol
8431 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8432 \pgfsetarrows{-} %never draw arrows
8433 \pgfsetlinewidth{\pgfstartlinewidth}
8434 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8435 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8436 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8437 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8438 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8439 \pgfusepath{draw}
8440 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
8441 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
8442 \pgfusepath{draw}
8443
8444 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8445 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8446 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8447 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8448 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8449 \pgfusepath{draw}
8450
8451 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8452 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8453 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8454 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8455 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8456 \pgfusepath{draw}
8457 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
8458 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
8459 \pgfusepath{draw}
8460 }
8461
8462 %% bandstop filter
8463 \pgfcircdeclarebipolescaled{blocks}
8464 {}
8465 {\ctikzvalof{bipoles/bandstop/width}}
8466 {bandstop}
8467 {\ctikzvalof{bipoles/bandstop/width}}
8468 {\ctikzvalof{bipoles/bandstop/width}}
8469 {
8470 \pgf@circ@res@step = \ctikzvalof{bipoles/bandstop/width}\pgf@circ@scaled@Rlen
8471 \divide \pgf@circ@res@step by 2
8472
8473 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8474 \pgf@circ@res@other = \pgf@circ@res@left
8475 \advance\pgf@circ@res@other by \pgf@circ@res@step
8476
8477 \ifpgf@circuit@dashed
8478 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8479 \fi
8480
8481 % draw outer box
8482 \pgf@circ@twoportbox
8483
8484 \ifpgf@circuit@inputarrow
8485 {
8486 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8487 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8488 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8489 }
8490 \fi
8491
8492 % rotate inner symbol
8493 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8494 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8495 \pgftransformrotate{270}
8496 \fi\fi
8497 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225% 134 degree, because >= 135 is not possible
8498 \pgftransformrotate{180}
8499 \fi\fi
8500 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8501 \pgftransformrotate{90}
8502 \fi\fi
8503
8504 % draw inner symbol
8505 \pgfsetdash{}{0pt}% always draw solid line for inner symbol
8506 \pgfsetarrows{-}%never draw arrows
8507 \pgfsetlinewidth{\pgfstartlinewidth}
8508 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8509 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8510 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8511 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8512 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8513 \pgfusepath{draw}
8514
8515 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8516 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8517 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8518 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8519 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8520 \pgfusepath{draw}
8521 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8522 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8523 \pgfusepath{draw}
8524
8525 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8526 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8527 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8528 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8529 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8530 \pgfusepath{draw}
8531 }
8532
8533 %% highpass filter
8534 \pgfcircdeclarebipolescaled{blocks}
8535 {}
8536 {\ctikzvalof{bipoles/highpass/width}}
8537 {highpass}
8538 {\ctikzvalof{bipoles/highpass/width}}
8539 {\ctikzvalof{bipoles/highpass/width}}
8540 {
8541 \pgf@circ@res@step = \ctikzvalof{bipoles/highpass/width}\pgf@circ@scaled@Rlen
8542 \divide \pgf@circ@res@step by 2
8543
8544 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8545 \pgf@circ@res@other = \pgf@circ@res@left
8546 \advance\pgf@circ@res@other by \pgf@circ@res@step
8547
8548 \ifpgf@circuit@dashed
8549 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8550 \fi
8551
8552 % draw outer box
8553 \pgf@circ@twoportbox
8554
8555 \ifpgf@circuit@inputarrow
8556 {
8557 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8558 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8559 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8560 }
8561 \fi
8562
8563 % rotate inner symbol
8564 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8565 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8566 \pgftransformrotate{270}
8567 \fi\fi
8568 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8569 \pgftransformrotate{180}
8570 \fi\fi
8571 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8572 \pgftransformrotate{90}
8573 \fi\fi
8574
8575 % draw inner symbol
8576 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8577 \pgfsetarrows{-} %never draw arrows
8578 \pgfsetlinewidth{\pgfstartlinewidth}
8579 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8580 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8581 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8582 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8583 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8584 \pgfusepath{draw}
8585
8586 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8587 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8588 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8589 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8590 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8591 \pgfusepath{draw}
8592 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8593 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8594 \pgfusepath{draw}
8595
8596 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8597 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8598 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8599 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8600 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8601 \pgfusepath{draw}
8602 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.65\pgf@circ@res@step}}
8603 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
8604 \pgfusepath{draw}
8605 }
8606
8607 %% lowpass filter
8608 \pgfcircdeclarebipolescaled{blocks}
8609 {}
8610 {\ctikzvalof{bipoles/lowpass/width}}
8611 {lowpass}
8612 {\ctikzvalof{bipoles/lowpass/width}}
8613 {\ctikzvalof{bipoles/lowpass/width}}
8614 {
8615 \pgf@circ@res@step = \ctikzvalof{bipoles/lowpass/width}\pgf@circ@scaled@Rlen
8616 \divide \pgf@circ@res@step by 2
8617
8618 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8619 \pgf@circ@res@other = \pgf@circ@res@left
8620 \advance\pgf@circ@res@other by \pgf@circ@res@step
8621
8622 \ifpgf@circuit@dashed
8623 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8624 \fi
8625
8626 % draw outer box
8627 \pgf@circ@twoportbox
8628
8629 \ifpgf@circuit@inputarrow
8630 {
8631 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8632 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8633 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8634 }
8635 \fi
8636
8637 % rotate inner symbol
8638 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8639 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8640 \pgftransformrotate{270}
8641 \fi\fi
8642 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8643 \pgftransformrotate{180}
8644 \fi\fi
8645 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
8646 \pgftransformrotate{90}
8647 \fi\fi
8648
8649 % draw inner symbol
8650 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8651 \pgfsetarrows{-} %never draw arrows
8652 \pgfsetlinewidth{\pgfstartlinewidth}
8653 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
8654 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8655 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8656 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8657 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8658 \pgfusepath{draw}
8659 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{0.35\pgf@circ@res@step}}
8660 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.65\pgf@circ@res@step}}
8661 \pgfusepath{draw}
8662
8663 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0}}
8664 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8665 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8666 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8667 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8668 \pgfusepath{draw}
8669 \pgfpathmoveto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
8670 \pgfpathlineto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
8671 \pgfusepath{draw}
8672
8673 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
8674 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8675 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8676 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
8677 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
8678 \pgfusepath{draw}
8679 }
8680
8681 %% ADC
8682 \pgfcircdeclarebipolescaled{blocks}
8683 {}
8684 {\ctikzvalof{bipoles/adc/width}}
8685 {adc}
8686 {\ctikzvalof{bipoles/adc/width}}
8687 {\ctikzvalof{bipoles/adc/width}}
8688 {
8689 \pgf@circ@res@step = \ctikzvalof{bipoles/adc/width}\pgf@circ@scaled@Rlen
8690 \divide \pgf@circ@res@step by 2
8691
8692 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8693 \pgf@circ@res@other = \pgf@circ@res@left
8694 \advance\pgf@circ@res@other by \pgf@circ@res@step
8695
8696 \ifpgf@circuit@dashed
8697 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8698 \fi
8699
8700 % draw outer box
8701 \pgf@circ@twoportbox
8702
8703 \ifpgf@circuit@inputarrow
8704 {
8705 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8706 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8707 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8708 }
8709 \fi
8710
8711 % rotate inner symbol
8712 \def\texti{A}
8713 \def\textii{D}
8714 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8715 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8716 \def\texti{D}
8717 \def\textii{A}
8718 \pgftransformrotate{270}
8719 \fi\fi
8720 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8721 \def\texti{D}
8722 \def\textii{A}
8723 \pgftransformrotate{180}
8724 \fi\fi
8725 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8726 \pgftransformrotate{90}
8727 \def\texti{A}
8728 \def\textii{D}
8729 \fi\fi
8730
8731 % draw inner symbol
8732 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8733 \pgfsetarrows{-} %never draw arrows
8734 \pgfsetlinewidth{\pgfstartlinewidth}
8735 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8736 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8737 \pgfusepath{draw}
8738
8739 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
8740 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
8741 }
8742
8743 %% DAC
8744 \pgfcircdeclarebipolescaled{blocks}
8745 {}
8746 {\ctikzvalof{bipoles/dac/width}}
8747 {dac}
8748 {\ctikzvalof{bipoles/dac/width}}
8749 {\ctikzvalof{bipoles/dac/width}}
8750 {
8751 \pgf@circ@res@step = \ctikzvalof{bipoles/dac/width}\pgf@circ@scaled@Rlen
8752 \divide \pgf@circ@res@step by 2
8753
8754 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8755 \pgf@circ@res@other = \pgf@circ@res@left
8756 \advance\pgf@circ@res@other by \pgf@circ@res@step
8757
8758 \ifpgf@circuit@dashed
8759 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8760 \fi
8761
8762 % draw outer box
8763 \pgf@circ@twoportbox
8764
8765 \ifpgf@circuit@inputarrow
8766 {
8767 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8768 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8769 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8770 }
8771 \fi
8772
8773 % rotate inner symbol
8774 \def\texti{D}
8775 \def\textii{A}
8776 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8777 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8778 \def\texti{A}
8779 \def\textii{D}
8780 \pgftransformrotate{270}
8781 \fi\fi
8782 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
8783 \def\texti{A}
8784 \def\textii{D}
8785 \pgftransformrotate{180}
8786 \fi\fi
8787 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8788 \pgftransformrotate{90}
8789 \def\texti{D}
8790 \def\textii{A}
8791 \fi\fi
8792
8793 % draw inner symbol
8794 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
8795 \pgfsetarrows{-} %never draw arrows
8796 \pgfsetlinewidth{\pgfstartlinewidth}
8797 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8798 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8799 \pgfusepath{draw}
8800
8801 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\textsf{\texti}}
8802 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\textsf{\textii}}
8803 }
8804
8805 %% DSP
8806 \pgfcircdeclarebipolescaled{blocks}
8807 {}
8808 {\ctikzvalof{bipoles/dsp/width}}
8809 {dsp}
8810 {\ctikzvalof{bipoles/dsp/width}}
8811 {\ctikzvalof{bipoles/dsp/width}}
8812 {
8813 \pgf@circ@res@step = \ctikzvalof{bipoles/dsp/width}\pgf@circ@scaled@Rlen
8814 \divide \pgf@circ@res@step by 2
8815
8816 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8817 \pgf@circ@res@other = \pgf@circ@res@left
8818 \advance\pgf@circ@res@other by \pgf@circ@res@step
8819
8820 \ifpgf@circuit@dashed
8821 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8822 \fi
8823
8824 % draw outer box
8825 \pgf@circ@twoportbox
8826
8827 \ifpgf@circuit@inputarrow
8828 {
8829 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8830 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8831 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8832 }
8833 \fi
8834
8835 % rotate inner symbol
8836 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8837 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8838 \pgftransformrotate{270}
8839 \fi\fi
8840 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8841 \pgftransformrotate{180}
8842 \fi\fi
8843 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8844 \pgftransformrotate{90}
8845 \fi\fi
8846
8847 % draw inner symbol
8848 \pgftext[center,x=0,y=0]{\textsf{DSP}}
8849 }
8850
8851 %% FFT
8852 \pgfcircdeclarebipolescaled{blocks}
8853 {}
8854 {\ctikzvalof{bipoles/fft/width}}
8855 {fft}
8856 {\ctikzvalof{bipoles/fft/width}}
8857 {\ctikzvalof{bipoles/fft/width}}
8858 {
8859 \pgf@circ@res@step = \ctikzvalof{bipoles/fft/width}\pgf@circ@scaled@Rlen
8860 \divide \pgf@circ@res@step by 2
8861
8862 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
8863 \pgf@circ@res@other = \pgf@circ@res@left
8864 \advance\pgf@circ@res@other by \pgf@circ@res@step
8865
8866 \ifpgf@circuit@dashed
8867 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8868 \fi
8869
8870 % draw outer box
8871 \pgf@circ@twoportbox
8872
8873 \ifpgf@circuit@inputarrow
8874 {
8875 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8876 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8877 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8878 }
8879 \fi
8880
8881 % rotate inner symbol
8882 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
8883 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
8884 \pgftransformrotate{270}
8885 \fi\fi
8886 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
8887 \pgftransformrotate{180}
8888 \fi\fi
8889 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
8890 \pgftransformrotate{90}
8891 \fi\fi
8892
8893 % draw inner symbol
8894 \pgftext[center,x=0,y=0]{\textsf{FFT}}
8895 }
8896
8897 %% Amplifier
8898 \pgfcircdeclarebipolescaled{blocks}
8899 {}
8900 {
8901 \ifpgf@circuit@boxed
8902 \ctikzvalof{bipoles/twoport/width}
8903 \else
8904 \ctikzvalof{bipoles/amp/width}
8905 \fi
8906 }
8907 {amp}
8908 {
8909 \ifpgf@circuit@boxed
8910 \ctikzvalof{bipoles/twoport/width}
8911 \else
8912 \ctikzvalof{bipoles/amp/width}
8913 \fi
8914 }
8915 {
8916 \ifpgf@circuit@boxed
8917 \ctikzvalof{bipoles/twoport/width}
8918 \else
8919 \ctikzvalof{bipoles/amp/width}
8920 \fi
8921 }
8922 {
8923 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
8924
8925 \ifpgf@circuit@dashed
8926 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8927 \fi
8928
8929 % draw outer box
8930 \ifpgf@circuit@boxed
8931 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8932 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
8933 \pgf@circ@draworfill
8934 \fi
8935
8936 % draw input arrow
8937 \ifpgf@circuit@inputarrow
8938 {
8939 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8940 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
8941 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
8942 }
8943 \fi
8944
8945 \ifpgf@circuit@boxed
8946 \pgfsetlinewidth{\pgfstartlinewidth}
8947 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
8948 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
8949 \else
8950 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8951 \fi
8952
8953 \pgfsetarrows{-} %never draw arrows
8954
8955 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
8956 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
8957 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
8958
8959 \pgfpathclose
8960 \pgf@circ@draworfill
8961
8962 % draw inner text
8963 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
8964 }
8965
8966
8967 %% variable amplifier
8968 \pgfcircdeclarebipolescaled{blocks}
8969 {}
8970 {
8971 \ifpgf@circuit@boxed
8972 \ctikzvalof{bipoles/twoport/width}
8973 \else
8974 \ctikzvalof{bipoles/amp/width}
8975 \fi
8976 }
8977 {vamp}
8978 {
8979 \ifpgf@circuit@boxed
8980 \ctikzvalof{bipoles/twoport/width}
8981 \else
8982 \ctikzvalof{bipoles/amp/width}
8983 \fi
8984 }
8985 {
8986 \ifpgf@circuit@boxed
8987 \ctikzvalof{bipoles/twoport/width}
8988 \else
8989 \ctikzvalof{bipoles/amp/width}
8990 \fi
8991 }
8992 {
8993 \pgf@circ@res@step = \ctikzvalof{bipoles/amp/width}\pgf@circ@scaled@Rlen
8994
8995 \ifpgf@circuit@dashed
8996 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
8997 \fi
8998
8999 % draw outer box
9000 \ifpgf@circuit@boxed
9001 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
9002 \fi
9003
9004 % draw input arrow
9005 \ifpgf@circuit@inputarrow
9006 {
9007 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9008 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9009 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9010 }
9011 \fi
9012
9013 \ifpgf@circuit@boxed
9014 \pgfsetlinewidth{\pgfstartlinewidth}
9015 \pgfsetdash{}{0pt} % draw solid line for inner symbol if no box is drawn
9016 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
9017 \else
9018 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9019 \fi
9020
9021
9022 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9023 \pgfsetarrows{-} %never draw arrows
9024
9025 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
9026 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
9027 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
9028
9029 \pgfpathclose
9030 \pgf@circ@draworfill
9031
9032 % draw inner text
9033 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
9034
9035 % draw arrow
9036 \pgfsetlinewidth{\pgfstartlinewidth}
9037 \pgfsetarrowsend{latex}
9038 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
9039 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
9040 \pgfusepath{draw}
9041 }
9042
9043 %% pi attenuator
9044 \pgfcircdeclarebipolescaled{blocks}
9045 {}
9046 {\ctikzvalof{bipoles/piattenuator/width}}
9047 {piattenuator}
9048 {\ctikzvalof{bipoles/piattenuator/width}}
9049 {\ctikzvalof{bipoles/piattenuator/width}}
9050 {
9051 \pgf@circ@res@step = \ctikzvalof{bipoles/piattenuator/width}\pgf@circ@scaled@Rlen
9052 \divide \pgf@circ@res@step by 2
9053
9054 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9055 \pgf@circ@res@other = \pgf@circ@res@left
9056 \advance\pgf@circ@res@other by \pgf@circ@res@step
9057
9058 \ifpgf@circuit@dashed
9059 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9060 \fi
9061
9062 % draw outer box
9063 \pgf@circ@twoportbox
9064
9065 \ifpgf@circuit@inputarrow
9066 {
9067 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9068 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9069 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9070 }
9071 \fi
9072
9073 % rotate inner symbol
9074 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9075 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9076 \pgftransformrotate{270}
9077 \fi\fi
9078 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9079 \pgftransformrotate{90}
9080 \fi\fi
9081
9082 % draw inner symbol
9083 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9084 \pgfsetarrows{-} %never draw arrows
9085 \pgfsetlinewidth{\pgfstartlinewidth}
9086 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
9087 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9088 \pgfusepath{draw}
9089 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
9090 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9091 \pgfusepath{draw}
9092 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9093 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9094 \pgfusepath{draw}
9095 }
9096
9097 %% variable pi attenuator
9098 \pgfcircdeclarebipolescaled{blocks}
9099 {}
9100 {\ctikzvalof{bipoles/vpiattenuator/width}}
9101 {vpiattenuator}
9102 {\ctikzvalof{bipoles/vpiattenuator/width}}
9103 {\ctikzvalof{bipoles/vpiattenuator/width}}
9104 {
9105 \pgf@circ@res@step = \ctikzvalof{bipoles/vpiattenuator/width}\pgf@circ@scaled@Rlen
9106 \divide \pgf@circ@res@step by 2
9107
9108 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9109 \pgf@circ@res@other = \pgf@circ@res@left
9110 \advance\pgf@circ@res@other by \pgf@circ@res@step
9111
9112 \ifpgf@circuit@dashed
9113 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9114 \fi
9115
9116 % draw outer box
9117 \pgf@circ@twoportbox
9118
9119 \ifpgf@circuit@inputarrow
9120 {
9121 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9122 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9123 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9124 }
9125 \fi
9126
9127 % rotate inner symbol
9128 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9129 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9130 \pgftransformrotate{270}
9131 \fi\fi
9132 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9133 \pgftransformrotate{90}
9134 \fi\fi
9135
9136 % draw inner symbol
9137 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9138 \pgfsetarrows{-} %never draw arrows
9139 \pgfsetlinewidth{\pgfstartlinewidth}
9140 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
9141 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9142 \pgfusepath{draw}
9143 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
9144 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9145 \pgfusepath{draw}
9146 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9147 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9148 \pgfusepath{draw}
9149
9150 \pgfsetarrowsend{latex}
9151 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
9152 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
9153 \pgfusepath{draw}
9154 }
9155
9156 %% T attenuator
9157 \pgfcircdeclarebipolescaled{blocks}
9158 {}
9159 {\ctikzvalof{bipoles/tattenuator/width}}
9160 {tattenuator}
9161 {\ctikzvalof{bipoles/tattenuator/width}}
9162 {\ctikzvalof{bipoles/tattenuator/width}}
9163 {
9164 \pgf@circ@res@step = \ctikzvalof{bipoles/tattenuator/width}\pgf@circ@scaled@Rlen
9165 \divide \pgf@circ@res@step by 2
9166
9167 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9168 \pgf@circ@res@other = \pgf@circ@res@left
9169 \advance\pgf@circ@res@other by \pgf@circ@res@step
9170
9171 \ifpgf@circuit@dashed
9172 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9173 \fi
9174
9175 % draw outer box
9176 \pgf@circ@twoportbox
9177
9178 \ifpgf@circuit@inputarrow
9179 {
9180 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9181 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9182 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9183 }
9184 \fi
9185
9186 % rotate inner symbol
9187 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9188 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9189 \pgftransformrotate{270}
9190 \fi\fi
9191 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9192 \pgftransformrotate{90}
9193 \fi\fi
9194
9195 % draw inner symbol
9196 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9197 \pgfsetarrows{-} %never draw arrows
9198 \pgfsetlinewidth{\pgfstartlinewidth}
9199 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
9200 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
9201 \pgfusepath{draw}
9202 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9203 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9204 \pgfusepath{draw}
9205 }
9206
9207 %% variable T attenuator
9208 \pgfcircdeclarebipolescaled{blocks}
9209 {}
9210 {\ctikzvalof{bipoles/vtattenuator/width}}
9211 {vtattenuator}
9212 {\ctikzvalof{bipoles/vtattenuator/width}}
9213 {\ctikzvalof{bipoles/vtattenuator/width}}
9214 {
9215 \pgf@circ@res@step = \ctikzvalof{bipoles/vtattenuator/width}\pgf@circ@scaled@Rlen
9216 \divide \pgf@circ@res@step by 2
9217
9218 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9219 \pgf@circ@res@other = \pgf@circ@res@left
9220 \advance\pgf@circ@res@other by \pgf@circ@res@step
9221
9222 \ifpgf@circuit@dashed
9223 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9224 \fi
9225
9226 % draw outer box
9227 \pgf@circ@twoportbox
9228
9229 \ifpgf@circuit@inputarrow
9230 {
9231 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9232 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9233 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9234 }
9235 \fi
9236
9237 % rotate inner symbol
9238 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9239 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9240 \pgftransformrotate{270}
9241 \fi\fi
9242 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9243 \pgftransformrotate{90}
9244 \fi\fi
9245
9246 % draw inner symbol
9247 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9248 \pgfsetarrows{-} %never draw arrows
9249 \pgfsetlinewidth{\pgfstartlinewidth}
9250 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
9251 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
9252 \pgfusepath{draw}
9253 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
9254 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
9255 \pgfusepath{draw}
9256
9257 \pgfsetarrowsend{latex}
9258 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
9259 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
9260 \pgfusepath{draw}
9261 }
9262
9263 %% phase shifter
9264 \pgfcircdeclarebipolescaled{blocks}
9265 {}
9266 {\ctikzvalof{bipoles/phaseshifter/width}}
9267 {phaseshifter}
9268 {\ctikzvalof{bipoles/phaseshifter/width}}
9269 {\ctikzvalof{bipoles/phaseshifter/width}}
9270 {
9271 \pgf@circ@res@step = \ctikzvalof{bipoles/phaseshifter/width}\pgf@circ@scaled@Rlen
9272 \divide \pgf@circ@res@step by 2
9273
9274 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9275 \pgf@circ@res@other = \pgf@circ@res@left
9276 \advance\pgf@circ@res@other by \pgf@circ@res@step
9277
9278 \ifpgf@circuit@dashed
9279 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9280 \fi
9281
9282 % draw outer box
9283 \pgf@circ@twoportbox
9284
9285 \ifpgf@circuit@inputarrow
9286 {
9287 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9288 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9289 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9290 }
9291 \fi
9292
9293 % rotate inner symbol
9294 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9295 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9296 \pgftransformrotate{270}
9297 \fi\fi
9298 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9299 \pgftransformrotate{180}
9300 \fi\fi
9301 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9302 \pgftransformrotate{90}
9303 \fi\fi
9304
9305 % inner symbol
9306 \pgftext[center,x=0,y=0]{\Large$\varphi$}
9307 }
9308
9309 %% variable phase shifter
9310 \pgfcircdeclarebipolescaled{blocks}
9311 {}
9312 {\ctikzvalof{bipoles/phaseshifter/width}}
9313 {vphaseshifter}
9314 {\ctikzvalof{bipoles/vphaseshifter/width}}
9315 {\ctikzvalof{bipoles/vphaseshifter/width}}
9316 {
9317 \pgf@circ@res@step = \ctikzvalof{bipoles/vphaseshifter/width}\pgf@circ@scaled@Rlen
9318 \divide \pgf@circ@res@step by 2
9319
9320 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9321 \pgf@circ@res@other = \pgf@circ@res@left
9322 \advance\pgf@circ@res@other by \pgf@circ@res@step
9323
9324 \ifpgf@circuit@dashed
9325 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9326 \fi
9327
9328 % draw outer box
9329 \pgf@circ@twoportbox
9330
9331 \ifpgf@circuit@inputarrow
9332 {
9333 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9334 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9335 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9336 }
9337 \fi
9338
9339 % rotate inner symbol
9340 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9341 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9342 \pgftransformrotate{270}
9343 \fi\fi
9344 \ifnum \pgfcircmathresult > 135 \ifnum \pgfcircmathresult < 225
9345 \pgftransformrotate{180}
9346 \fi\fi
9347 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9348 \pgftransformrotate{90}
9349 \fi\fi
9350
9351 % inner symbol
9352 \pgftext[center,x=0,y=0]{\Large$\varphi$}
9353
9354 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9355 \pgfsetlinewidth{\pgfstartlinewidth}
9356 \pgfsetarrowsend{latex}
9357 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
9358 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
9359 \pgfusepath{draw}
9360 }
9361
9362 %% detector
9363 \pgfcircdeclarebipolescaled{blocks}
9364 {}
9365 {\ctikzvalof{bipoles/detector/width}}
9366 {detector}
9367 {\ctikzvalof{bipoles/detector/width}}
9368 {\ctikzvalof{bipoles/detector/width}}
9369 {
9370 \pgf@circ@res@step = \ctikzvalof{bipoles/detector/width}\pgf@circ@scaled@Rlen
9371 \divide \pgf@circ@res@step by 2
9372
9373 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9374 \pgf@circ@res@other = \pgf@circ@res@left
9375 \advance\pgf@circ@res@other by \pgf@circ@res@step
9376
9377 \ifpgf@circuit@dashed
9378 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9379 \fi
9380
9381 % draw outer box
9382 \pgf@circ@twoportbox
9383
9384 \ifpgf@circuit@inputarrow
9385 {
9386 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9387 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9388 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9389 }
9390 \fi
9391
9392 % draw inner stuff
9393 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9394 \pgfsetarrows{-} %never draw arrows
9395 \pgfsetlinewidth{0.8\pgfstartlinewidth}
9396 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
9397 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
9398 \pgfusepath{draw}
9399
9400 \ifpgf@circuit@fulldiode
9401 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
9402 \pgftransformscale{\pgfmathresult}
9403 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
9404 \else
9405 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
9406 \pgftransformscale{\pgfmathresult}
9407 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
9408 \fi
9409
9410 }
9411
9412 %% single phase ac/dc converter
9413 \pgfcircdeclarebipolescaled{blocks}
9414 {
9415 \anchor{dc1}{
9416 \northeast
9417 \pgf@y=.4\pgf@y
9418 }
9419 \anchor{dc2}{
9420 \northeast
9421 \pgf@y=-.4\pgf@y
9422 }
9423 }
9424 {\ctikzvalof{bipoles/sacdc/width}}
9425 {sacdc}
9426 {\ctikzvalof{bipoles/sacdc/width}}
9427 {\ctikzvalof{bipoles/sacdc/width}}
9428 {
9429 \pgf@circ@res@step = \ctikzvalof{bipoles/sacdc/width}\pgf@circ@scaled@Rlen
9430 \divide \pgf@circ@res@step by 2
9431
9432 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9433 \pgf@circ@res@other = \pgf@circ@res@left
9434 \advance\pgf@circ@res@other by \pgf@circ@res@step
9435
9436 \ifpgf@circuit@dashed
9437 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9438 \fi
9439
9440 % draw outer box
9441 \pgf@circ@twoportbox
9442
9443 \ifpgf@circuit@inputarrow
9444 {
9445 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9446 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9447 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9448 }
9449 \fi
9450
9451 % rotate inner symbol
9452 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9453 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9454 \pgftransformrotate{270}
9455 \fi\fi
9456 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9457 \pgftransformrotate{180}
9458 \fi\fi
9459 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9460 \pgftransformrotate{90}
9461 \fi\fi
9462
9463 % draw inner symbol
9464 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9465 \pgfsetarrows{-} %never draw arrows
9466 \pgfsetlinewidth{\pgfstartlinewidth}
9467 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9468 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9469 \pgfusepath{draw}
9470
9471 % draw sin wave
9472 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
9473 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9474 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9475 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9476 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9477 \pgfusepath{draw}
9478
9479 % draw equal sign
9480 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
9481 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
9482 \pgfusepath{draw}
9483 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
9484 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
9485 \pgfusepath{draw}
9486 }
9487
9488
9489
9490 %% single phase dc/ac converter
9491 \pgfcircdeclarebipolescaled{blocks}
9492 {
9493 \anchor{dc1}{
9494 \northeast
9495 \pgf@y=.4\pgf@y
9496 \pgf@x=-\pgf@x
9497 }
9498 \anchor{dc2}{
9499 \northeast
9500 \pgf@y=-.4\pgf@y
9501 \pgf@x=-\pgf@x
9502 }
9503 }
9504 {\ctikzvalof{bipoles/sdcac/width}}
9505 {sdcac}
9506 {\ctikzvalof{bipoles/sdcac/width}}
9507 {\ctikzvalof{bipoles/sdcac/width}}
9508 {
9509 \pgf@circ@res@step = \ctikzvalof{bipoles/sdcac/width}\pgf@circ@scaled@Rlen
9510 \divide \pgf@circ@res@step by 2
9511
9512 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9513 \pgf@circ@res@other = \pgf@circ@res@left
9514 \advance\pgf@circ@res@other by \pgf@circ@res@step
9515
9516 \ifpgf@circuit@dashed
9517 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9518 \fi
9519
9520 % draw outer box
9521 \pgf@circ@twoportbox
9522
9523 \ifpgf@circuit@inputarrow
9524 {
9525 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9526 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9527 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9528 }
9529 \fi
9530
9531 % rotate inner symbol
9532 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9533 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9534 \pgftransformrotate{270}
9535 \fi\fi
9536 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9537 \pgftransformrotate{180}
9538 \fi\fi
9539 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9540 \pgftransformrotate{90}
9541 \fi\fi
9542
9543 % draw inner symbol
9544 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9545 \pgfsetarrows{-} %never draw arrows
9546 \pgfsetlinewidth{\pgfstartlinewidth}
9547 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9548 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9549 \pgfusepath{draw}
9550
9551 % draw sin wave
9552 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
9553 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9554 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9555 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9556 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9557 \pgfusepath{draw}
9558
9559 % draw equal sign
9560 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
9561 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
9562 \pgfusepath{draw}
9563 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
9564 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
9565 \pgfusepath{draw}
9566 }
9567
9568
9569 %% threephase ac/dc converter
9570 \pgfcircdeclarebipolescaled{blocks}
9571 {
9572 \anchor{dc1}{
9573 \northeast
9574 \pgf@y=.4\pgf@y
9575 }
9576 \anchor{dc2}{
9577 \northeast
9578 \pgf@y=-.4\pgf@y
9579 }
9580 \anchor{ac1}{
9581 \northeast
9582 \pgf@y=.6\pgf@y
9583 \pgf@x=-\pgf@x
9584 }
9585 \anchor{ac2}{
9586 \northeast
9587 \pgf@y=0\pgf@y
9588 \pgf@x=-\pgf@x
9589 }
9590 \anchor{ac3}{
9591 \northeast
9592 \pgf@y=-.6\pgf@y
9593 \pgf@x=-\pgf@x
9594 }
9595 }
9596 {\ctikzvalof{bipoles/tacdc/width}}
9597 {tacdc}
9598 {\ctikzvalof{bipoles/tacdc/width}}
9599 {\ctikzvalof{bipoles/tacdc/width}}
9600 {
9601 \pgf@circ@res@step = \ctikzvalof{bipoles/tacdc/width}\pgf@circ@scaled@Rlen
9602 \divide \pgf@circ@res@step by 2
9603
9604 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9605 \pgf@circ@res@other = \pgf@circ@res@left
9606 \advance\pgf@circ@res@other by \pgf@circ@res@step
9607
9608 \ifpgf@circuit@dashed
9609 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9610 \fi
9611
9612 % draw outer box
9613 \pgf@circ@twoportbox
9614
9615 \ifpgf@circuit@inputarrow
9616 {
9617 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9618 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9619 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9620 }
9621 \fi
9622
9623 % rotate inner symbol
9624 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9625 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9626 \pgftransformrotate{270}
9627 \fi\fi
9628 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9629 \pgftransformrotate{180}
9630 \fi\fi
9631 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9632 \pgftransformrotate{90}
9633 \fi\fi
9634
9635 % draw inner symbol
9636 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9637 \pgfsetarrows{-} %never draw arrows
9638 \pgfsetlinewidth{\pgfstartlinewidth}
9639 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9640 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9641 \pgfusepath{draw}
9642
9643 % draw sin waves
9644 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.65\pgf@circ@res@step}}
9645 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9646 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9647 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9648 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9649 \pgfusepath{draw}
9650 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.5\pgf@circ@res@step}}
9651 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9652 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9653 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9654 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9655 \pgfusepath{draw}
9656 \pgfpathmoveto{\pgfpoint{-.76\pgf@circ@res@step}{.35\pgf@circ@res@step}}
9657 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9658 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9659 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9660 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9661 \pgfusepath{draw}
9662
9663
9664
9665
9666 % draw equal sign
9667 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.375\pgf@circ@res@step}}
9668 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.375\pgf@circ@res@step}}
9669 \pgfusepath{draw}
9670 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-.625\pgf@circ@res@step}}
9671 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.625\pgf@circ@res@step}}
9672 \pgfusepath{draw}
9673 }
9674
9675
9676 %% threephase dc/ac converter
9677 \pgfcircdeclarebipolescaled{blocks}
9678 {
9679 \anchor{dc1}{
9680 \northeast
9681 \pgf@y=.4\pgf@y
9682 \pgf@x=-\pgf@x
9683 }
9684 \anchor{dc2}{
9685 \northeast
9686 \pgf@y=-.4\pgf@y
9687 \pgf@x=-\pgf@x
9688 }
9689 \anchor{ac1}{
9690 \northeast
9691 \pgf@y=.6\pgf@y
9692 }
9693 \anchor{ac2}{
9694 \northeast
9695 \pgf@y=0\pgf@y
9696 }
9697 \anchor{ac3}{
9698 \northeast
9699 \pgf@y=-.6\pgf@y
9700 }
9701 }
9702 {\ctikzvalof{bipoles/tdcac/width}}
9703 {tdcac}
9704 {\ctikzvalof{bipoles/tdcac/width}}
9705 {\ctikzvalof{bipoles/tdcac/width}}
9706 {
9707 \pgf@circ@res@step = \ctikzvalof{bipoles/tdcac/width}\pgf@circ@scaled@Rlen
9708 \divide \pgf@circ@res@step by 2
9709
9710 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9711 \pgf@circ@res@other = \pgf@circ@res@left
9712 \advance\pgf@circ@res@other by \pgf@circ@res@step
9713
9714 \ifpgf@circuit@dashed
9715 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
9716 \fi
9717
9718 % draw outer box
9719 \pgf@circ@twoportbox
9720
9721 \ifpgf@circuit@inputarrow
9722 {
9723 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
9724 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9725 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
9726 }
9727 \fi
9728
9729 % rotate inner symbol
9730 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
9731 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
9732 \pgftransformrotate{270}
9733 \fi\fi
9734 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225 % 134 degree, because >= 135 is not possible
9735 \pgftransformrotate{180}
9736 \fi\fi
9737 \ifnum \pgfcircmathresult > 225 \ifnum \pgfcircmathresult < 315
9738 \pgftransformrotate{90}
9739 \fi\fi
9740
9741 % draw inner symbol
9742 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
9743 \pgfsetarrows{-} %never draw arrows
9744 \pgfsetlinewidth{\pgfstartlinewidth}
9745 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9746 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9747 \pgfusepath{draw}
9748
9749 % draw sin waves
9750 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.65\pgf@circ@res@step}}
9751 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9752 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9753 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9754 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9755 \pgfusepath{draw}
9756 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.5\pgf@circ@res@step}}
9757 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9758 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9759 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9760 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9761 \pgfusepath{draw}
9762 \pgfpathmoveto{\pgfpoint{.14\pgf@circ@res@step}{-.35\pgf@circ@res@step}}
9763 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9764 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9765 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
9766 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
9767 \pgfusepath{draw}
9768
9769
9770
9771
9772 % draw equal sign
9773 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.375\pgf@circ@res@step}}
9774 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.375\pgf@circ@res@step}}
9775 \pgfusepath{draw}
9776 \pgfpathmoveto{\pgfpoint{-.2\pgf@circ@res@step}{.625\pgf@circ@res@step}}
9777 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{0.625\pgf@circ@res@step}}
9778 \pgfusepath{draw}
9779 }
9780
9781
9782 %%%%%%%%%%%%%%%%%%%%%%%
9783 %% MECHANICAL SYMBOLS
9784 %%%%%%%%%%%%%%%%%%%%%%%
9785
9786 %% mechanical capacitance - stiffness/spring
9787
9788 \pgfcircdeclarebipolescaled{mechanicals}
9789 {}
9790 {\ctikzvalof{bipoles/spring/height}}
9791 {spring}
9792 {\ctikzvalof{bipoles/spring/height}}
9793 {\ctikzvalof{bipoles/spring/width}}{
9794 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9795 \pgftransformationadjustments
9796
9797 \pgfmathsetlength{\pgf@circ@res@step}
9798 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
9799
9800 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
9801 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
9802 \pgf@circ@res@other = \pgf@circ@res@left
9803 \advance\pgf@circ@res@other by \pgf@circ@res@step
9804 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9805 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9807 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9808 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9809 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9810 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9811 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9812 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9813 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9814 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9815 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9816 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
9817 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
9818 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9819 \advance\pgf@circ@res@other by \pgf@circ@res@step
9820 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
9821 \pgfsetbuttcap
9822 \pgfsetbeveljoin
9823 \pgfusepath{stroke}
9824 }
9825
9826 %% mechanical capacitance - inerter
9827 \pgfcircdeclarebipolescaled{mechanicals}
9828 {}
9829 {\ctikzvalof{bipoles/inerter/height}}
9830 {inerter}
9831 {\ctikzvalof{bipoles/inerter/height}}
9832 {\ctikzvalof{bipoles/inerter/width}}
9833 {
9834 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9835 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9836 \pgf@circ@draworfill
9837 }
9838
9839
9840 %% mechanical inductance - mass
9841 \pgfcircdeclarebipolescaled{mechanicals}
9842 {}
9843 {\ctikzvalof{bipoles/mass/box height}}
9844 {mass}
9845 {\ctikzvalof{bipoles/mass/height}}
9846 {\ctikzvalof{bipoles/mass/width}}
9847 {
9848 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9849 \pgftransformationadjustments
9850 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9851 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
9852 \pgf@circ@draworfill
9853
9854 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9855 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9856 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9857 \pgfsetrectcap
9858 \pgfsetmiterjoin
9859 \pgfusepath{stroke}
9860 }
9861
9862 %% mechanical resistor - damper
9863 \pgfcircdeclarebipolescaled{mechanicals}
9864 {}
9865 {\ctikzvalof{bipoles/damper/height}}
9866 {damper}
9867 {\ctikzvalof{bipoles/damper/height}}
9868 {\ctikzvalof{bipoles/damper/width}}
9869 {
9870 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9871 \pgf@circ@maybefill
9872
9873 % line into the damper
9874 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9875 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9876 {\pgf@circ@res@zero}}
9877 \pgfusepath{stroke}
9878
9879 % damper box
9880 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9881 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9882 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9883 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9884 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9885
9886 \pgfsetrectcap
9887 \pgfsetmiterjoin
9888 \pgfusepath{stroke}
9889
9890 % damper vertical element
9891 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9892 {.8\pgf@circ@res@down}}
9893 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9894 {.8\pgf@circ@res@up}}
9895 \pgfsetbuttcap
9896 \pgfusepath{stroke}
9897
9898 }
9899 %% mechanical viscoelastic element, suggested by @alex
9900 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
9901 \pgfcircdeclarebipolescaled{mechanicals}
9902 {} % extra anchors
9903 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
9904 {viscoe} % name
9905 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
9906 {\ctikzvalof{bipoles/damper/width}} % width
9907 { % draw the bipole
9908 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9909 \pgf@circ@maybefill
9910
9911 % spring into the damper
9912 \pgfscope
9913 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9914 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9915 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
9916 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
9917 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
9918 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
9919 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
9920 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
9921 \pgfusepath{stroke}
9922 \endpgfscope
9923 % damper box
9924 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9925 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9926 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9927 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9928 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9929
9930 \pgfsetrectcap
9931 \pgfsetmiterjoin
9932 \pgfusepath{stroke}
9933
9934 % damper vertical element
9935 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9936 {.8\pgf@circ@res@down}}
9937 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
9938 {.8\pgf@circ@res@up}}
9939 \pgfsetbuttcap
9940 \pgfusepath{stroke}
9941
9942 }
9943
9944 %%%%%%%%%%%%%%%%
9945 %% Crossing
9946 %%%%%%%%%%%%%%%%
9947
9948 %% crossing bipole (but see also nodes)
9949 \pgfcircdeclarebipole
9950 {}
9951 {\ctikzvalof{bipoles/crossing/size}}
9952 {crossing}
9953 {\ctikzvalof{bipoles/crossing/size}}
9954 {\ctikzvalof{bipoles/crossing/size}}{
9955 \pgfscope
9956 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
9957 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
9958 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
9959 \pgfsetbeveljoin
9960 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
9961 \pgfusepath{draw}
9962 \endpgfscope
9963 }
9964
9965 %%%%%%%%%%%%%%%%%%%%%%%%%
9966 %% Miscellaneous bipoles
9967 %%%%%%%%%%%%%%%%%%%%%%%%%
9968
9969 %% loudspeaker and microphone
9970
9971 \pgfcircdeclarebipolescaled{misc}
9972 {}
9973 {\ctikzvalof{bipoles/loudspeaker/depth}}
9974 {loudspeaker}
9975 {\ctikzvalof{bipoles/loudspeaker/height}}
9976 {\ctikzvalof{bipoles/loudspeaker/width}}{
9977
9978 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
9979 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9980 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
9981 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
9982 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
9983 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
9984 \pgfpathclose
9985 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9986 \pgf@circ@draworfill
9987 }
9988
9989 \pgfcircdeclarebipolescaled{misc}
9990 {}
9991 {\ctikzvalof{bipoles/mic/depth}}
9992 {mic}
9993 {\ctikzvalof{bipoles/mic/height}}
9994 {\ctikzvalof{bipoles/mic/width}}{
9995
9996 \pgfscope
9997 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9998 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
9999 \pgf@circ@draworfill
10000 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@up}}
10001 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
10002 \pgfusepath{draw}
10003 \endpgfscope
10004 \pgfscope
10005 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10006 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
10007 % 0.25358 is 0.6-0.4*cos(30)
10008 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
10009 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
10010 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
10011 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10012 \pgfusepath{draw}
10013
10014 \pgfusepath{draw}
10015 \endpgfscope
10016 }
10017
10018 %% european gas filled surge arrester
10019 \pgfcircdeclarebipolescaled{misc}
10020 {}
10021 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
10022 {european gas filled surge arrester}
10023 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
10024 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
10025 {
10026
10027 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10028 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10029
10030 \pgf@circ@draworfill
10031
10032 \pgfscope
10033 \pgfsetarrowsend{latexslim}
10034 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10035 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
10036 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10037 \pgfusepath{draw}
10038
10039 \endpgfscope
10040 }
10041
10042 %% american gas filled surge arrester
10043 \pgfcircdeclarebipolescaled{misc}
10044 {}
10045 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
10046 {american gas filled surge arrester}
10047 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
10048 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
10049
10050 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10051 \pgfpointorigin \pgf@circ@res@other = \pgf@x \advance \pgf@circ@res@other by -\pgf@circ@res@up
10052 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
10053 \pgfusepath{draw}
10054
10055 \pgfscope
10056 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10057 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
10058 \pgf@circ@draworfill
10059 \endpgfscope
10060
10061 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
10062 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10063 \pgfusepath{draw}
10064
10065 \pgfscope
10066 \pgfsetarrowsend{latex}
10067
10068 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10069 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
10070 \pgfusepath{draw}
10071
10072 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10073 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
10074 \pgfusepath{draw}
10075 \endpgfscope{}
10076
10077 \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}
10078 \pgfusepath{fill}
10079 }
10080
10081 %% thermocouple
10082 \pgfcircdeclarebipolescaled{misc}
10083 {}
10084 {\ctikzvalof{bipoles/thermocouple/height 2}}
10085 {thermocouple}
10086 {\ctikzvalof{bipoles/thermocouple/height}}
10087 {\ctikzvalof{bipoles/thermocouple/width}}
10088 {
10089 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10090 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
10091 \pgfusepath{draw}
10092 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
10093 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10094 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
10095 \pgfusepath{draw}
10096 \pgfsetlinewidth{\pgfstartlinewidth}
10097 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
10098 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
10099 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10100 \pgfusepath{draw}
10101 }
10102
10103 %% fuse
10104 \pgfcircdeclarebipolescaled{misc}
10105 {}
10106 {\ctikzvalof{bipoles/fuse/height}}
10107 {fuse}
10108 {\ctikzvalof{bipoles/fuse/height}}
10109 {\ctikzvalof{bipoles/fuse/width}}
10110 {
10111 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10112 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10113 \pgfusepath{draw}
10114
10115 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10116 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10117
10118 \pgf@circ@draworfill
10119 }
10120
10121 %% asymmetric fuse
10122 \pgfcircdeclarebipolescaled{misc}
10123 {}
10124 {\ctikzvalof{bipoles/afuse/height}}
10125 {afuse}
10126 {\ctikzvalof{bipoles/afuse/height}}
10127 {\ctikzvalof{bipoles/afuse/width}}
10128 {
10129 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
10130 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
10131 \pgfusepath{draw}
10132
10133 \pgfscope
10134 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10135 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10136 \pgf@circ@draworfill
10137 \endpgfscope
10138
10139 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10140 \pgfusepath{stroke,fill}
10141 }
10142
10143 %% SQUID added by Cor Molenaar 5 March 2010
10144 \pgfcircdeclarebipolescaled{misc}
10145 {}
10146 {\ctikzvalof{bipoles/squid/height}}
10147 {squid}
10148 {\ctikzvalof{bipoles/squid/height}}
10149 {\ctikzvalof{bipoles/squid/width}}
10150 {
10151 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10152
10153 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10154 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
10155 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
10156 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
10157 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
10158 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
10159 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
10160 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
10161 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
10162
10163 \pgfusepath{draw}
10164 }
10165
10166 % Generic barrier added by Cor Molenaar 5 March 2010
10167 \pgfcircdeclarebipolescaled{misc}
10168 {}
10169 {\ctikzvalof{bipoles/barrier/height}}
10170 {barrier}
10171 {\ctikzvalof{bipoles/barrier/height}}
10172 {\ctikzvalof{bipoles/barrier/width}}
10173 {
10174 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10175
10176 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
10177 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
10178 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
10179 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
10180 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
10181 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
10182
10183 \pgfusepath{draw}
10184 }
10185
10186 %
10187 % open version of the barrier symbol
10188 % suggested by Radványi Patrik Tamás <[email protected]>
10189 %
10190 \pgfcircdeclarebipolescaled{misc}
10191 {}
10192 {\ctikzvalof{bipoles/barrier/height}}
10193 {openbarrier}
10194 {\ctikzvalof{bipoles/barrier/height}}
10195 {\ctikzvalof{bipoles/barrier/width}}
10196 {
10197 % this is set with normal wire linewidth
10198 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10199 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}}
10200 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10201 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}}
10202 \pgfusepath{draw}
10203
10204 % do the cross part
10205 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10206
10207 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@up}}
10208 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@down}}
10209 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.35*\pgf@circ@res@down}}
10210 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.35*\pgf@circ@res@up}}
10211
10212 \pgfusepath{draw}
10213 }
10214 %% Lamp
10215 \pgfcircdeclarebipolescaled{misc}
10216 {}
10217 {\ctikzvalof{bipoles/lamp/height}}
10218 {lamp}
10219 {\ctikzvalof{bipoles/lamp/height}}
10220 {\ctikzvalof{bipoles/lamp/width}}
10221 {
10222 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10223
10224 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10225 \pgf@circ@draworfill
10226 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
10227 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
10228 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
10229 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
10230 \pgfusepath{draw}
10231 }
10232
10233 %% bulb
10234 \pgfcircdeclarebipolescaled{misc}
10235 {}
10236 {\ctikzvalof{bipoles/bulb/height}}
10237 {bulb}
10238 {\ctikzvalof{bipoles/bulb/height}}
10239 {\ctikzvalof{bipoles/bulb/width}}
10240 {%
10241 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10242 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
10243 \pgf@circ@draworfill
10244 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10245 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
10246 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
10247 \pgfsetbeveljoin
10248 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10249 \pgfusepath{draw}
10250 }
10251
10252
10253 % end of pgfcircbipoles.tex
10254 %%%---------- close: tex/pgfcircbipoles
10255 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
10256 %%%---------- open: tex/pgfcirctripoles.tex
10257 % Copyright 2018-2026 by Romano Giannetti
10258 % Copyright 2015-2026 by Stefan Lindner
10259 % Copyright 2013-2026 by Stefan Erhardt
10260 % Copyright 2007-2026 by Massimo Redaelli
10261 %
10262 % This file may be distributed and/or modified
10263 %
10264 % 1. under the LaTeX Project Public License and/or
10265 % 2. under the GNU Public License.
10266 %
10267 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
10268
10269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10270 %% Tripoles
10271
10272 %%%%%%%%%%%%%
10273 %% switches
10274 %%%%%%%%%%%%%
10275
10276 % Legacy spdt
10277 \pgfdeclareshape{spdt}{
10278 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10279 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10280 \savedanchor\northwest{%
10281 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10282 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
10283 \pgf@y=.5\pgf@y
10284 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10285 \pgf@x=.5\pgf@x
10286 }
10287 \anchor{left}{%
10288 \northwest
10289 \pgf@y=0pt
10290 }
10291 \anchor{in}{
10292 \northwest
10293 \pgf@y=0pt
10294 }
10295 \anchor{out 1}{
10296 \northwest
10297 \pgf@x=-\pgf@x
10298 }
10299 \anchor{out 2}{
10300 \northwest
10301 \pgf@x=-\pgf@x
10302 \pgf@y=-\pgf@y
10303 }
10304 \anchor{center}{
10305 \pgf@y=0pt
10306 \pgf@x=0pt
10307 }
10308 \anchor{east}{
10309 \northwest
10310 \pgf@y=0pt
10311 \pgf@x=-\pgf@x
10312 }
10313 \anchor{west}{
10314 \northwest
10315 \pgf@y=0pt
10316 }
10317 \anchor{south}{
10318 \northwest
10319 \pgf@x=0pt
10320 \pgf@y=-\pgf@y
10321 }
10322 \anchor{north}{
10323 \northwest
10324 \pgf@x=0pt
10325 }
10326 \anchor{south west}{
10327 \northwest
10328 \pgf@y=-\pgf@y
10329 }
10330 \anchor{north east}{
10331 \northwest
10332 \pgf@x=-\pgf@x
10333 }
10334 \anchor{north west}{
10335 \northwest
10336 }
10337 \anchor{south east}{
10338 \northwest
10339 \pgf@x=-\pgf@x
10340 \pgf@y=-\pgf@y
10341 }
10342 \backgroundpath{
10343 \pgfsetcolor{\ctikzvalof{color}}
10344
10345 \northwest
10346 \pgf@circ@res@up = \pgf@y
10347 \pgf@circ@res@down = -\pgf@y
10348 \pgf@circ@res@right = -\pgf@x
10349 \pgf@circ@res@left = \pgf@x
10350 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
10351
10352
10353 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10354 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10355 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10356 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10357
10358 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10359 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10360
10361 \pgfusepath{draw}
10362
10363 \pgfscope
10364 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10365 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
10366 \endpgfscope
10367 \pgfscope
10368 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10369 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
10370 \endpgfscope
10371 \pgfscope
10372 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
10373 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
10374 \endpgfscope
10375
10376 \pgfscope
10377 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
10378 \pgfpathlineto{
10379 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
10380 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
10381 }
10382 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10383 \pgfusepath{draw}
10384 \endpgfscope
10385 }
10386 }
10387
10388
10389 % cute switch "node" shapes, matching with cute "to" shapes
10390 % #1 -> name
10391 % #2 -> barposition
10392 % #3 -> arrowcode
10393 \long\def\pgfcircdeclarecutespdt#1#2#3{
10394 \pgfdeclareshape{#1}
10395 {
10396 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10397 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10398 \savedanchor\northwest{%
10399 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10400 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10401 \pgf@y=.5\pgf@y
10402 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10403 \pgf@x=.25\pgf@x
10404 }
10405 \savedanchor\midlever{
10406 % these values are calculated when we create the definition of the shape.
10407 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10408 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10409 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
10410 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10411 \pgf@circ@res@down = -.5\pgf@y
10412 \pgf@circ@res@up = .5\pgf@y
10413 \pgfextracty{\pgf@circ@res@other}{#2}
10414 \pgf@x=0pt
10415 \pgf@y=.5\pgf@circ@res@other
10416 }
10417 % radius of the connector
10418 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10419 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10420 % shapename
10421 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
10422 % shape type
10423 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
10424 % mid of the lever, to stack switches
10425 \anchor{mid}{\midlever}
10426 % center anchors
10427 \anchor{cin}{ \northwest \pgf@y=0pt}
10428 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
10429 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10430 % horizontal angles
10431 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
10432 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
10433 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
10434
10435 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
10436 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
10437 \anchor{west}{ \northwest \pgf@y=0pt }
10438 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
10439 \anchor{north}{ \northwest \pgf@x=0pt }
10440 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
10441 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
10442 \anchor{north west}{ \northwest }
10443 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10444
10445 \backgroundpath{
10446 \pgfsetcolor{\ctikzvalof{color}}
10447 \northwest
10448 \pgf@circ@res@up = \pgf@y
10449 \pgf@circ@res@down = -\pgf@y
10450 \pgf@circ@res@right = -\pgf@x
10451 \pgf@circ@res@left = \pgf@x
10452
10453 \pgfscope
10454 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10455 \pgf@circ@res@temp=\radius\relax
10456 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10457 \pgfsetlinewidth{2\pgf@circ@res@temp}
10458 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10459 \pgfpathlineto{#2}
10460 \pgfsetroundcap\pgfusepath{draw}
10461 \endpgfscope
10462 \pgfscope % arrow
10463 #3
10464 \endpgfscope
10465 % terminals
10466 \pgfscope
10467 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10468 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
10469 \endpgfscope
10470 \pgfscope
10471 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10472 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
10473 \endpgfscope
10474 \pgfscope
10475 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10476 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
10477 \endpgfscope
10478
10479 }
10480 }
10481 }
10482
10483 \pgfcircdeclarecutespdt{cute spdt up}
10484 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
10485 {}
10486
10487 \pgfcircdeclarecutespdt{cute spdt mid}
10488 {\pgfpoint{\pgf@circ@res@right}{0pt}}
10489 {}
10490
10491 \pgfcircdeclarecutespdt{cute spdt down}
10492 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
10493 {}
10494
10495 \pgfcircdeclarecutespdt{cute spdt up arrow}
10496 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
10497 {
10498 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10499 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10500 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
10501 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
10502 \pgfsetarrowsend{latexslim}
10503 \pgfusepath{draw}
10504 }
10505
10506 \pgfcircdeclarecutespdt{cute spdt mid arrow}
10507 {\pgfpoint{\pgf@circ@res@right}{0pt}}
10508 {
10509 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10510 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10511 \pgfsetarrowsstart{latexslim}
10512 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
10513 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
10514 \pgfsetarrowsend{latexslim}
10515 \pgfusepath{draw}
10516 }
10517
10518 \pgfcircdeclarecutespdt{cute spdt down arrow}
10519 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
10520 {
10521 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10522 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10523 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
10524 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
10525 \pgfsetarrowsend{latexslim}
10526 \pgfusepath{draw}
10527 }
10528
10529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10531 %%
10532 %% Logic ports
10533 %%
10534 %% Code from John Kormylo at tex.stackexchange.com
10535 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
10536 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
10537 %%
10538
10539 \newcount\pgf@circ@res@count% reserve global register
10540
10541 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
10542 {%
10543 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10544 \step
10545 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10546 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10547 }%
10548
10549 % #1 = \pgfmathcounter #2=type #3 specificic port
10550 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
10551 \def\pgf@circ@logicport@baseinput#1#2#3%
10552 {%
10553 % and and nand
10554 \ifnum #2=1\relax
10555 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10556 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10557 \step
10558 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10559 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10560 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
10561 \fi
10562 % or and nor
10563 \ifnum #2=2\relax
10564 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10565 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10566 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10567 \step
10568 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10569 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10570 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
10571 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10572 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10573 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10574 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10575 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10576 \pgf@circ@res@temp=\pgf@y
10577 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10578 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10579 \pgf@x=\pgf@circ@res@other
10580 \fi
10581 % xor and xnor
10582 \ifnum #2=3\relax
10583 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10584 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10585 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10586 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
10587 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
10588 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10589 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10590 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
10591 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10592 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
10593 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10594 % this compensates for the effect of the line width on the gap between the arcs
10595 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10596 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10597
10598 \step
10599 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10600 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10601 \pgf@circ@res@temp=\pgf@y
10602 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10603 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10604 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10605 \pgf@x=\pgf@circ@res@other
10606 \fi
10607 % european
10608 \ifnum #2=4\relax
10609 \pgfextracty{\pgf@circ@res@up}{\northeast}%
10610 \pgfextractx{\pgf@circ@res@other}{\left}%
10611 \step
10612 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
10613 \advance\pgf@y by -#1\pgf@circ@res@step\relax
10614 \pgf@x=\pgf@circ@res@other
10615 \fi
10616 }%
10617
10618 %%% american
10619 \long\def\pgfcircdeclarelogicport#1#2#3{%
10620 \pgfdeclareshape{american #1 port}%
10621 {%
10622 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
10623 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10624 \savedmacro\resize{% automatic
10625 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10626 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10627 \pgf@circ@res@up = .5\pgf@circ@res@up
10628 \pgf@circ@res@down = -\pgf@circ@res@up
10629 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
10630 \pgf@circ@res@right = .5\pgf@circ@res@right
10631 \pgf@circ@res@left = -\pgf@circ@res@right
10632 }%
10633 \savedmacro\inputs{% get number of inputs
10634 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
10635 \ifnum\pgf@circ@res@count=0
10636 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
10637 \fi
10638 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
10639 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
10640 \def\inputs{\the\pgf@circ@res@count}%
10641 }%
10642 \savedanchor\step{% 1/2 gap at edges
10643 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10644 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
10645 \divide\pgf@circ@res@step by \pgf@circ@res@count
10646 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
10647 }%
10648 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10649 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10650 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
10651 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
10652 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
10653
10654 \anchor{center}{\origin}% for backwards compatibility
10655 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
10656
10657 % create input anchors
10658 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
10659 \pgfmathloop%
10660 \ifnum\pgfmathcounter>\pgf@circ@res@count%
10661 \else%
10662 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
10663 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
10664 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
10665 }%
10666 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
10667 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
10668 }%
10669 %}{}%
10670 \repeatpgfmathloop%
10671 }
10672
10673 \anchor{out}{\northeast\pgf@y=0pt}
10674 \anchor{bout}{\right\pgf@y=0pt}
10675
10676
10677 \anchor{left}{\left}% edges of component minus leads
10678 \anchor{right}{\right}
10679
10680 \anchor{north east}{\northeast}% see \Compass macro
10681 \anchor{south west}{\southwest}
10682 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10683 \pgfpoint{0cm}{\pgf@circ@res@up}}
10684 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
10685 \pgfextractx{\pgf@circ@res@left}{\southwest}%
10686 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
10687 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
10688 \pgfpoint{\pgf@circ@res@left}{0cm}}
10689 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10690 \pgfpoint{0cm}{\pgf@circ@res@down}}
10691 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
10692 \pgfextractx{\pgf@circ@res@right}{\northeast}%
10693 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10694 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
10695 \pgfpoint{\pgf@circ@res@right}{0cm}}
10696
10697 \backgroundpath{
10698 \pgfsetcolor{\ctikzvalof{color}}
10699 #3
10700 }
10701 }
10702 }
10703 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10704 \pgfcircdeclarelogicport{and}{1}{
10705 \pgfextracty{\pgf@circ@res@temp}{\step}%
10706 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10707 \pgf@circ@res@count = \inputs\relax
10708 \ifpgfcirc@draw@leads
10709 %input leads
10710 \loop\ifnum\pgf@circ@res@count>0
10711 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10712 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10713 \pgfpathlineto{\pgfpoint
10714 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
10715 {\pgf@circ@res@temp}}
10716 \advance\pgf@circ@res@count by -1
10717 \repeat
10718 \fi
10719 % output lead
10720 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10721 \pgfpathlineto{\pgfpoint
10722 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right}
10723 {0pt}}
10724 \pgfusepath{draw}
10725
10726
10727 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10728 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
10729
10730 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
10731 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
10732 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
10733 \pgfpathclose
10734 \pgf@circ@draworfill
10735 }
10736 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10737 \pgfcircdeclarelogicport{nand}{1}{
10738 \pgfextracty{\pgf@circ@res@temp}{\step}%
10739 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10740 \pgf@circ@res@count = \inputs\relax
10741 \ifpgfcirc@draw@leads
10742 %input leads
10743 \loop\ifnum\pgf@circ@res@count>0
10744 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10745 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10746 \pgfpathlineto{\pgfpoint
10747 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
10748 {\pgf@circ@res@temp}}
10749 \advance\pgf@circ@res@count by -1
10750 \repeat
10751 \fi
10752
10753 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10754 \pgfpathlineto{\pgfpoint
10755 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
10756
10757 \pgfusepath{draw}
10758 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10759 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
10760 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
10761 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10762
10763 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10764 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10765 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
10766 \pgfpathclose
10767
10768 \pgfpathellipse
10769 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
10770 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10771 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10772
10773 \pgf@circ@draworfill
10774 }
10775 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10776 \pgfcircdeclarelogicport{nor}{2}{
10777 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
10778 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
10779 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10780 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10781 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
10782 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10783
10784 \pgfextracty{\pgf@circ@res@temp}{\step}%
10785 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10786 \pgf@circ@res@count = \inputs\relax
10787 \ifpgfcirc@draw@leads
10788 %input leads
10789 \loop\ifnum\pgf@circ@res@count>0
10790 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10791 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10792 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10793 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10794 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10795 \advance\pgf@circ@res@count by -1
10796 \repeat
10797 \fi
10798
10799 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
10800 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10801 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10802
10803 \pgfusepath{draw}
10804
10805 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10806
10807 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
10808 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
10809 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10810 \advance\pgf@circ@res@other by -\pgf@circ@res@step
10811
10812 % main shape
10813 \ifpgfcirc@roundy@or@shapes
10814 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10815 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10816 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10817 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10818 \pgfpathclose
10819 \else
10820 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10821 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10822 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10823 \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}}
10824 \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}}
10825 \pgfpathclose
10826 \fi
10827
10828 % not dot
10829 \pgfpathellipse
10830 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
10831 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
10832 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
10833
10834 \pgf@circ@draworfill
10835 }
10836 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10837 \pgfcircdeclarelogicport{or}{2}{
10838 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
10839 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
10840 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10841 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
10842 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
10843 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10844
10845 \pgfextracty{\pgf@circ@res@temp}{\step}%
10846 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10847 \pgf@circ@res@count = \inputs\relax
10848 \ifpgfcirc@draw@leads
10849 %input leads
10850 \loop\ifnum\pgf@circ@res@count>0
10851 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10852 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10853 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
10854 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10855 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10856 \advance\pgf@circ@res@count by -1
10857 \repeat
10858 \fi
10859
10860 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
10861 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10862 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10863
10864 \pgfusepath{draw}
10865
10866 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10867
10868 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
10869
10870 % main shape
10871 \ifpgfcirc@roundy@or@shapes
10872 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10873 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10874 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10875 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10876 \pgfpathclose
10877 \else
10878 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10879 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10880 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10881 \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}}
10882 \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}}
10883 \pgfpathclose
10884 \fi
10885
10886 \pgf@circ@draworfill
10887 }
10888 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10889 \pgfcircdeclarelogicport{xor}{3}{
10890 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
10891 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
10892 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10893 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10894 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
10895 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10896 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
10897 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10898 % this compensates for the effect of the line width on the gap between the arcs
10899 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10900 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10901
10902 \pgfextracty{\pgf@circ@res@temp}{\step}%
10903 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10904 \pgf@circ@res@count = \inputs\relax
10905 \ifpgfcirc@draw@leads
10906 %input leads
10907 \loop\ifnum\pgf@circ@res@count>0
10908 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10909 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10910 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10911 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10912 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10913 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10914 \advance\pgf@circ@res@count by -1
10915 \repeat
10916 \fi
10917
10918 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
10919 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10920 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10921
10922 \pgfusepath{draw}
10923
10924 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10925
10926 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
10927
10928 % main shape
10929 \ifpgfcirc@roundy@or@shapes
10930 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10931 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10932 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10933 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
10934 \pgfpathclose
10935 \else
10936 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10937 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
10938 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
10939 \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}}
10940 \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}}
10941 \pgfpathclose
10942 \fi
10943 \pgf@circ@draworfill
10944
10945 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
10946
10947 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
10948 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
10949
10950 \pgfusepath{draw}
10951 }
10952 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10953 \pgfcircdeclarelogicport{xnor}{3}{
10954 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
10955 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
10956 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
10957 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
10958 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
10959 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
10960 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
10961 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
10962 % this compensates for the effect of the line width on the gap between the arcs
10963 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
10964 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
10965
10966 \pgfextracty{\pgf@circ@res@temp}{\step}%
10967 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
10968 \pgf@circ@res@count = \inputs\relax
10969 \ifpgfcirc@draw@leads
10970 %input leads
10971 \loop\ifnum\pgf@circ@res@count>0
10972 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
10973 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
10974 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
10975 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
10976 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
10977 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
10978 \advance\pgf@circ@res@count by -1
10979 \repeat
10980 \fi
10981
10982 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
10983 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10984 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10985
10986 \pgfusepath{draw}
10987
10988 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10989
10990 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
10991 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
10992 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
10993 \advance\pgf@circ@res@other by -\pgf@circ@res@step
10994
10995 % main shape
10996 \ifpgfcirc@roundy@or@shapes
10997 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
10998 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
10999 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11000 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
11001 \pgfpathclose
11002 \else
11003 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
11004 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
11005 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
11006 \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}}
11007 \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}}
11008 \pgfpathclose
11009 \fi
11010
11011 \pgfpathellipse
11012 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
11013 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
11014 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
11015 \pgf@circ@draworfill
11016
11017 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
11018 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
11019
11020 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
11021 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
11022
11023 \pgfusepath{draw}
11024 }
11025
11026 %%% Original one-input ports
11027
11028 \pgfdeclareshape{american not port}{
11029 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11030 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11031 \anchor{center}{\pgfpointorigin}
11032 \savedanchor\northwest{%
11033 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11034 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11035 \pgf@y=.5\pgf@y
11036 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11037 \pgf@x=.5\pgf@x
11038 }
11039 \anchor{in}{
11040 \northwest
11041 \pgf@y=0pt
11042 }
11043 \anchor{in 1}{
11044 \northwest
11045 \pgf@y=0pt
11046 }
11047 \anchor{bin}{
11048 \northwest
11049 \pgf@y=0pt
11050 }
11051 \anchor{bin 1}{
11052 \northwest
11053 \pgf@y=0pt
11054 \pgf@x=0.7\pgf@x
11055 }
11056 \anchor{out}{
11057 \northwest
11058 \pgf@y=0pt
11059 \pgf@x=-\pgf@x
11060 }
11061 \anchor{bout}{
11062 \northwest
11063 \pgf@y=0pt
11064 \pgf@x=-0.7\pgf@x
11065 }
11066 \anchor{center}{
11067 \pgfpointorigin
11068 }
11069 \anchor{east}{
11070 \northwest
11071 \pgf@y=0pt
11072 \pgf@x=-\pgf@x
11073 }
11074 \anchor{west}{
11075 \northwest
11076 \pgf@y=0pt
11077 }
11078 \anchor{south}{
11079 \northwest
11080 \pgf@x=0pt
11081 \pgf@y=-\pgf@y
11082 }
11083 \anchor{north}{
11084 \northwest
11085 \pgf@x=0pt
11086 }
11087 \anchor{south west}{
11088 \northwest
11089 \pgf@y=-\pgf@y
11090 }
11091 \anchor{north east}{
11092 \northwest
11093 \pgf@x=-\pgf@x
11094 }
11095 \anchor{north west}{
11096 \northwest
11097 }
11098 \anchor{south east}{
11099 \northwest
11100 \pgf@x=-\pgf@x
11101 \pgf@y=-\pgf@y
11102 }
11103 \backgroundpath{
11104 \pgfsetcolor{\ctikzvalof{color}}
11105
11106 \northwest
11107 \pgf@circ@res@up = \pgf@y
11108 \pgf@circ@res@down = -\pgf@y
11109 \pgf@circ@res@right = -\pgf@x
11110 \pgf@circ@res@left = \pgf@x
11111
11112 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11113
11114 \pgfscope
11115 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11116 \pgftransformxshift{.7\pgf@circ@res@left}
11117 \pgf@circ@res@step=\pgf@circ@res@right
11118 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11119 \pgf@circ@res@step=.7\pgf@circ@res@step
11120
11121 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11122 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11123 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11124 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11125 \pgf@circ@draworfill
11126 \pgfpathellipse
11127 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11128 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11129 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11130 \pgf@circ@draworfill
11131 \endpgfscope
11132
11133 \ifpgfcirc@draw@leads
11134 %input leads
11135 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11136 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11137 \fi
11138
11139 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11140 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11141
11142 \pgfusepath{draw}
11143 }
11144 }
11145
11146 \pgfdeclareshape{american buffer port}{
11147 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11148 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11149 \anchor{center}{\pgfpointorigin}
11150 \savedanchor\northwest{%
11151 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11152 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11153 \pgf@y=.5\pgf@y
11154 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11155 \pgf@x=.5\pgf@x
11156 }
11157 \anchor{in}{
11158 \northwest
11159 \pgf@y=0pt
11160 }
11161 \anchor{in 1}{
11162 \northwest
11163 \pgf@y=0pt
11164 }
11165 \anchor{bin}{
11166 \northwest
11167 \pgf@y=0pt
11168 }
11169 \anchor{bin 1}{
11170 \northwest
11171 \pgf@y=0pt
11172 \pgf@x=0.7\pgf@x
11173 }
11174 \anchor{out}{
11175 \northwest
11176 \pgf@y=0pt
11177 \pgf@x=-\pgf@x
11178 }
11179 \anchor{bout}{
11180 \northwest
11181 \pgf@y=0pt
11182 \pgf@x=-0.7\pgf@x
11183 }
11184 \anchor{center}{
11185 \pgfpointorigin
11186 }
11187 \anchor{east}{
11188 \northwest
11189 \pgf@y=0pt
11190 \pgf@x=-\pgf@x
11191 }
11192 \anchor{west}{
11193 \northwest
11194 \pgf@y=0pt
11195 }
11196 \anchor{south}{
11197 \northwest
11198 \pgf@x=0pt
11199 \pgf@y=-\pgf@y
11200 }
11201 \anchor{north}{
11202 \northwest
11203 \pgf@x=0pt
11204 }
11205 \anchor{south west}{
11206 \northwest
11207 \pgf@y=-\pgf@y
11208 }
11209 \anchor{north east}{
11210 \northwest
11211 \pgf@x=-\pgf@x
11212 }
11213 \anchor{north west}{
11214 \northwest
11215 }
11216 \anchor{south east}{
11217 \northwest
11218 \pgf@x=-\pgf@x
11219 \pgf@y=-\pgf@y
11220 }
11221 \backgroundpath{
11222 \pgfsetcolor{\ctikzvalof{color}}
11223
11224 \northwest
11225 \pgf@circ@res@up = \pgf@y
11226 \pgf@circ@res@down = -\pgf@y
11227 \pgf@circ@res@right = -\pgf@x
11228 \pgf@circ@res@left = \pgf@x
11229
11230 \pgfscope
11231 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11232 \pgftransformxshift{.7\pgf@circ@res@left}
11233 \pgf@circ@res@step=\pgf@circ@res@right
11234 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11235 \pgf@circ@res@step=.7\pgf@circ@res@step
11236
11237 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11238 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11239 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11240 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11241 \pgf@circ@draworfill
11242 \endpgfscope
11243
11244 \ifpgfcirc@draw@leads
11245 %input leads
11246 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11247 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11248 \fi
11249
11250 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11251 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11252
11253 \pgfusepath{draw}
11254 }
11255 }
11256 \pgfdeclareshape{invschmitt}{
11257 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11258 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11259 \anchor{center}{\pgfpointorigin}
11260 \savedanchor\northwest{%
11261 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11262 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11263 \pgf@y=.5\pgf@y
11264 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11265 \pgf@x=.5\pgf@x
11266 }
11267 \anchor{in}{
11268 \northwest
11269 \pgf@y=0pt
11270 }
11271 \anchor{in 1}{
11272 \northwest
11273 \pgf@y=0pt
11274 }
11275 \anchor{bin}{
11276 \northwest
11277 \pgf@y=0pt
11278 \pgf@x=0.7\pgf@x
11279 }
11280 \anchor{bin 1}{
11281 \northwest
11282 \pgf@y=0pt
11283 \pgf@x=0.7\pgf@x
11284 }
11285 \anchor{out}{
11286 \northwest
11287 \pgf@y=0pt
11288 \pgf@x=-\pgf@x
11289 }
11290 \anchor{bout}{
11291 \northwest
11292 \pgf@y=0pt
11293 \pgf@x=-0.7\pgf@x
11294 }
11295 \anchor{center}{
11296 \pgfpointorigin
11297 }
11298 \anchor{east}{
11299 \northwest
11300 \pgf@y=0pt
11301 \pgf@x=-\pgf@x
11302 }
11303 \anchor{west}{
11304 \northwest
11305 \pgf@y=0pt
11306 }
11307 \anchor{south}{
11308 \northwest
11309 \pgf@x=0pt
11310 \pgf@y=-\pgf@y
11311 }
11312 \anchor{north}{
11313 \northwest
11314 \pgf@x=0pt
11315 }
11316 \anchor{south west}{
11317 \northwest
11318 \pgf@y=-\pgf@y
11319 }
11320 \anchor{north east}{
11321 \northwest
11322 \pgf@x=-\pgf@x
11323 }
11324 \anchor{north west}{
11325 \northwest
11326 }
11327 \anchor{south east}{
11328 \northwest
11329 \pgf@x=-\pgf@x
11330 \pgf@y=-\pgf@y
11331 }
11332 \backgroundpath{
11333 \pgfsetcolor{\ctikzvalof{color}}
11334
11335 \northwest
11336 \pgf@circ@res@up = \pgf@y
11337 \pgf@circ@res@down = -\pgf@y
11338 \pgf@circ@res@right = -\pgf@x
11339 \pgf@circ@res@left = \pgf@x
11340
11341 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
11342
11343 \pgfscope
11344 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11345 \pgftransformxshift{.7\pgf@circ@res@left}
11346 \pgf@circ@res@step=\pgf@circ@res@right
11347 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11348 \pgf@circ@res@step=.7\pgf@circ@res@step
11349
11350 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
11351 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11352 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11353 \pgfpathclose
11354 \pgf@circ@draworfill
11355 \pgfpathellipse
11356 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
11357 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
11358 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
11359 \pgf@circ@draworfill
11360 \endpgfscope
11361
11362 \ifpgfcirc@draw@leads
11363 %input leads
11364 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11365 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11366 \fi
11367
11368 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11369 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
11370 \pgfusepath{draw}
11371 %draw inner shape
11372
11373 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11374
11375 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11376 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11377 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11378 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11379 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11380 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11381 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11382 \pgfusepath{draw}
11383
11384 }
11385 }
11386
11387 \pgfdeclareshape{schmitt}{
11388 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11389 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11390 \anchor{center}{\pgfpointorigin}
11391 \savedanchor\northwest{%
11392 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11393 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
11394 \pgf@y=.5\pgf@y
11395 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
11396 \pgf@x=.5\pgf@x
11397 }
11398 \anchor{in}{
11399 \northwest
11400 \pgf@y=0pt
11401 }
11402 \anchor{in 1}{
11403 \northwest
11404 \pgf@y=0pt
11405 }
11406 \anchor{bin}{
11407 \northwest
11408 \pgf@y=0pt
11409 \pgf@x=0.7\pgf@x
11410 }
11411 \anchor{bin 1}{
11412 \northwest
11413 \pgf@y=0pt
11414 \pgf@x=0.7\pgf@x
11415 }
11416 \anchor{out}{
11417 \northwest
11418 \pgf@y=0pt
11419 \pgf@x=-\pgf@x
11420 }
11421 \anchor{bout}{
11422 \northwest
11423 \pgf@y=0pt
11424 \pgf@x=-.7\pgf@x
11425 }
11426 \anchor{center}{
11427 \pgfpointorigin
11428 }
11429 \anchor{east}{
11430 \northwest
11431 \pgf@y=0pt
11432 \pgf@x=-\pgf@x
11433 }
11434 \anchor{west}{
11435 \northwest
11436 \pgf@y=0pt
11437 }
11438 \anchor{south}{
11439 \northwest
11440 \pgf@x=0pt
11441 \pgf@y=-\pgf@y
11442 }
11443 \anchor{north}{
11444 \northwest
11445 \pgf@x=0pt
11446 }
11447 \anchor{south west}{
11448 \northwest
11449 \pgf@y=-\pgf@y
11450 }
11451 \anchor{north east}{
11452 \northwest
11453 \pgf@x=-\pgf@x
11454 }
11455 \anchor{north west}{
11456 \northwest
11457 }
11458 \anchor{south east}{
11459 \northwest
11460 \pgf@x=-\pgf@x
11461 \pgf@y=-\pgf@y
11462 }
11463 \backgroundpath{
11464 \pgfsetcolor{\ctikzvalof{color}}
11465
11466
11467 \northwest
11468 \pgf@circ@res@up = \pgf@y
11469 \pgf@circ@res@down = -\pgf@y
11470 \pgf@circ@res@right = -\pgf@x
11471 \pgf@circ@res@left = \pgf@x
11472
11473 \pgfscope
11474 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11475 \pgftransformxshift{.7\pgf@circ@res@left}
11476 \pgf@circ@res@step=\pgf@circ@res@right
11477 \advance\pgf@circ@res@step by -\pgf@circ@res@left
11478 \pgf@circ@res@step=.7\pgf@circ@res@step
11479
11480 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
11481 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11482 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
11483 \pgfpathclose
11484 \pgf@circ@draworfill
11485 \endpgfscope
11486
11487 \ifpgfcirc@draw@leads
11488 %input leads
11489 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11490 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
11491 \fi
11492
11493 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11494 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
11495 \pgfusepath{draw}
11496 %draw inner shape
11497
11498 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11499
11500 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11501 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11502 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11503 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11504 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11505 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
11506 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
11507 \pgfusepath{draw}
11508
11509 }
11510 }
11511
11512
11513 %%% start european logic ports, from John Kormylo
11514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11515 %%
11516
11517 % #1 - name
11518 % #2 - text inside
11519 % #3 - number of inputs
11520 % #4 = is it a not?
11521 %
11522 % option to add a circle for not-output, see
11523 % https://github.com/circuitikz/circuitikz/issues/385
11524 %
11525 \newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
11526 \newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse
11527 \ctikzset{tripoles/european not shape/.initial=ocirc}
11528 \ctikzset{tripoles/european not symbol/.is choice}
11529 \ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
11530 \ctikzset{tripoles/european not symbol/circle/.code={%
11531 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
11532 \ctikzset{tripoles/european not symbol/ieee circle/.code={%
11533 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
11534
11535 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
11536 \pgfdeclareshape{european #1 port}
11537 {
11538 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
11539 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11540 \saveddimen{\boutshift}{%
11541 \ifpgf@circ@european@port@circle
11542 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11543 \edef\pgf@temp{ocirc}
11544 \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
11545 \ifx\pgf@temp\pgf@circ@temp % it's ocirc
11546 \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
11547 \else % it's ieee not circ
11548 \pgf@circ@notradius % defined together with ieeestd ports
11549 \pgf@x=2\pgf@circ@res@temp
11550 \fi
11551 \else
11552 \pgf@x=0pt
11553 \fi
11554 }
11555 \savedmacro\resize{% automatic
11556 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11557 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11558 \pgf@circ@res@up = .5\pgf@circ@res@up
11559 \pgf@circ@res@down = -\pgf@circ@res@up
11560 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
11561 \pgf@circ@res@right = .5\pgf@circ@res@right
11562 \pgf@circ@res@left = -\pgf@circ@res@right
11563 }%
11564 \savedmacro\inputs{% get number of inputs
11565 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
11566 \ifnum\pgf@circ@res@count=0
11567 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
11568 \fi
11569 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
11570 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
11571 \def\inputs{\the\pgf@circ@res@count}%
11572 }%
11573 \savedanchor\step{% 1/2 gap at edges
11574 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11575 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
11576 \divide\pgf@circ@res@step by #3
11577 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
11578 }%
11579 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
11580 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
11581 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11582 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
11583 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
11584
11585 \anchor{center}{\origin}% for backwards compatibility
11586 % the text anchor overlaps the logic symbol
11587 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
11588 % create input anchors
11589 \ifnum#3=1\relax
11590 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11591 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
11592 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11593 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
11594 \else
11595 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
11596 \pgfmathloop%
11597 \ifnum\pgfmathcounter>#3%
11598 \else%
11599 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
11600 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
11601 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
11602 }%
11603 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
11604 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
11605 }%
11606 %}{}%
11607 \repeatpgfmathloop%
11608 }
11609 \fi
11610 \anchor{out}{\northeast\pgf@y=0pt}
11611 \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
11612
11613 \anchor{left}{\left}% edges of component minus leads
11614 \anchor{right}{\right}
11615
11616 \anchor{north east}{\northeast}% see \Compass macro
11617 \anchor{south west}{\southwest}
11618 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11619 \pgfpoint{0cm}{\pgf@circ@res@up}}
11620 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
11621 \pgfextractx{\pgf@circ@res@left}{\southwest}%
11622 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11623 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
11624 \pgfpoint{\pgf@circ@res@left}{0cm}}
11625 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11626 \pgfpoint{0cm}{\pgf@circ@res@down}}
11627 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
11628 \pgfextractx{\pgf@circ@res@right}{\northeast}%
11629 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11630 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
11631 \pgfpoint{\pgf@circ@res@right}{0cm}}
11632
11633 \backgroundpath{
11634 \pgfsetcolor{\ctikzvalof{color}}
11635 \pgfstartlinewidth=\pgflinewidth
11636 \pgfscope
11637 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11638 \pgfpathrectanglecorners
11639 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
11640 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
11641 \pgf@circ@draworfill
11642 \endpgfscope
11643 \ifpgfcirc@draw@leads
11644 %input leads
11645 \ifnum#3=1\relax
11646 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
11647 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
11648 \else
11649 \pgfextracty{\pgf@circ@res@temp}{\step}%
11650 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
11651 %\pgf@circ@res@count = #3\relax% redundant
11652 \loop\ifnum\pgf@circ@res@count>0
11653 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
11654 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
11655 \pgfpathlineto{\pgfpoint
11656 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
11657 {\pgf@circ@res@temp}}
11658 \advance\pgf@circ@res@count by -1
11659 \repeat
11660 \fi
11661 \fi
11662 %
11663 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11664 \pgfpathlineto{%
11665 \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
11666 %
11667 \pgfusepath{draw}
11668 %
11669 \edef\pgf@temp{not}
11670 \edef\pgf@circ@temp{#4}
11671 \ifx\pgf@temp\pgf@circ@temp % is a not
11672 \ifpgf@circ@european@port@circle
11673 \pgfscope
11674 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
11675 \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
11676 % reset linewidth for IEEE ports, otherwise they will multiply...
11677 \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
11678 \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
11679 \endpgfscope
11680 \else
11681 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
11682 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
11683 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
11684 \pgfusepath{draw}
11685 \fi
11686 \fi
11687 %
11688 \pgfpathmoveto{\pgfpointorigin}
11689 \pgftext{#2}
11690 }
11691 }
11692 }
11693 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
11694 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
11695 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
11696 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
11697 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
11698 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
11699 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
11700 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
11701
11702 %% end european logic ports
11703
11704 %%%%%%%%%%%%%%%%%%%%%%%%
11705 %% Transistors
11706 %%%%%%%%%%%%%%%%%%%%%%%%
11707
11708
11709 \long\def\pgfcircdeclaretransistor#1#2#3{
11710 \pgfdeclareshape{#1}
11711 {
11712 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
11713 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11714 \anchor{center}{
11715 \pgfpointorigin
11716 }
11717 \savedanchor\northeast{% upper right
11718 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11719 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
11720 \pgf@y=.5\pgf@y
11721 \pgf@x=0pt
11722 }
11723 \savedanchor\left{%center left
11724 \pgf@y=0pt
11725 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11726 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
11727 }
11728 \savedanchor\right{%center right -- added by Burak Kelleci % this is really 0,0
11729 \pgf@y=0pt
11730 \pgf@x=0pt
11731 }
11732 \anchor{text}{
11733 \northeast
11734 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11735 \ifpgf@circuit@transisors@fixlabels
11736 \ifpgf@circuit@fet@bodydiode
11737 % try to put the text to the right of the flyback diode
11738 \pgfmathsetlength{\pgf@circ@res@other}{(
11739 \ctikzvalof{tripoles/#1/bodydiode distance}*
11740 \ctikzvalof{tripoles/#1/width} +
11741 \ctikzvalof{tripoles/#1/bodydiode scale}*
11742 \ctikzvalof{bipoles/diode/height}/2
11743 )*\pgf@circ@scaled@Rlen}
11744 \advance\pgf@x by \pgf@circ@res@other
11745 \fi
11746 % add a bit of space to avoid central (substrate) terminal if drawn
11747 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
11748 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
11749 \else
11750 \pgf@y=.7\pgf@y
11751 \pgf@x= \pgf@circ@scaled@Rlen
11752 \pgf@x=0.1\pgf@x
11753 \fi
11754 }
11755 \anchor{pathstart}{ % south
11756 \northeast
11757 \pgf@y=-\pgf@y
11758 }
11759 \anchor{pathend}{
11760 \northeast
11761 }
11762 \anchor{north}{
11763 \northeast
11764 \pgf@circ@res@step=\pgf@y
11765 \left
11766 \pgf@y=\pgf@circ@res@step
11767 \pgf@x=.5\pgf@x
11768 }
11769 \anchor{west}{
11770 \left
11771 }
11772 \anchor{east}{
11773 \northeast
11774 \pgf@y=0pt
11775 }
11776 \anchor{south}{
11777 \northeast
11778 \pgf@circ@res@step=\pgf@y
11779 \left
11780 \pgf@y=-\pgf@circ@res@step
11781 \pgf@x=.5\pgf@x
11782 }
11783 \anchor{south west}{
11784 \northeast
11785 \pgf@circ@res@step=\pgf@y
11786 \left
11787 \pgf@y=-\pgf@circ@res@step
11788 }
11789 \anchor{north east}{
11790 \northeast
11791 }
11792 \anchor{north west}{
11793 \northeast
11794 \pgf@circ@res@step=\pgf@y
11795 \left
11796 \pgf@y=\pgf@circ@res@step
11797 }
11798 \anchor{south east}{
11799 \northeast
11800 \pgf@y=-\pgf@y
11801 }
11802 \anchor{B}{
11803 \northeast
11804 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11805 \left
11806 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11807 }
11808 \anchor{base}{
11809 \northeast
11810 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11811 \left
11812 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11813 }
11814 \anchor{bulk}{ %added by Burak Kelleci
11815 \northeast
11816 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11817 \right
11818 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11819 }
11820 \anchor{nobulk}{ %added by Burak Kelleci
11821 \left
11822 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
11823 }
11824 \anchor{G}{
11825 \northeast
11826 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11827 \left
11828 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11829 }
11830 \anchor{gate}{
11831 \northeast
11832 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
11833 \left
11834 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
11835 }
11836 \anchor{nobase}{
11837 \left
11838 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
11839 }
11840 \anchor{nogate}{
11841 \left
11842 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
11843 }
11844 \anchor{E}{
11845 \northeast
11846 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11847 }
11848 \anchor{emitter}{
11849 \northeast
11850 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11851 }
11852 \anchor{C}{
11853 \northeast
11854 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11855 }
11856 \anchor{collector}{
11857 \northeast
11858 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11859 }
11860 \anchor{S}{
11861 \northeast
11862 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11863 }
11864 \anchor{source}{
11865 \northeast
11866 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11867 }
11868 \anchor{D}{
11869 \northeast
11870 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11871 }
11872 \anchor{drain}{
11873 \northeast
11874 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11875 }
11876 \anchor{body C in}{
11877 \northeast
11878 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11879 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
11880 }
11881 \anchor{body E in}{
11882 \northeast
11883 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11884 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
11885 }
11886 \anchor{body C out}{
11887 \northeast
11888 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11889 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
11890 \pgf@y=\pgf@ya
11891 \left
11892 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
11893 \pgf@y=\pgf@ya
11894 }
11895 \anchor{body E out}{
11896 \northeast
11897 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
11898 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
11899 \pgf@y=\pgf@ya
11900 \left
11901 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
11902 \pgf@y=\pgf@ya
11903 }
11904 #2
11905 \backgroundpath{
11906 \pgftransformationadjustments
11907 \pgfsetcolor{\ctikzvalof{color}}
11908 %
11909 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
11910 \pgf@circuit@trans@ntypetrue
11911 \else
11912 \pgf@circuit@trans@ntypefalse
11913 \fi
11914 \northeast
11915 \pgf@circ@res@up = \pgf@y
11916 \pgf@circ@res@down = -\pgf@y
11917 \pgf@circ@res@right = \pgf@x
11918 \left
11919 \pgf@circ@res@left = \pgf@x
11920 \pgf@circ@scaled@Rlen=\scaledRlen
11921 %
11922 #3
11923 % BODY DIODE
11924 \ifpgf@circuit@fet@bodydiode
11925 \drawbodydiode{#1}
11926 \fi
11927 %
11928 }
11929 }
11930 }
11931
11932 \long\def\drawbodydiode#1{
11933 \pgfscope
11934 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
11935 \pgftransformrotate{90}
11936 % diode scale and bodydiode scale interacts. We want the size of the diode
11937 % proportional to the transistor, so we will:
11938 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
11939 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
11940 \pgftransformscale{\@@BDscale}
11941 \ifpgf@circuit@fulldiode
11942 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
11943 \else
11944 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
11945 \fi
11946 \endpgfscope
11947 % Draw stroke line
11948 \ifpgf@circuit@strokediode
11949 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
11950 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
11951 \pgfusepath{stroke}
11952 \fi
11953 %Draw upper connection to body diode
11954 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
11955 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
11956 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
11957 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
11958 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
11959 \pgfusepath{draw}
11960 \pgfscope
11961 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
11962 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
11963 \pgftransformscale{0.5}
11964 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
11965 \endpgfscope{}
11966 %Draw lower connection to body diode
11967 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
11968 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
11969 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
11970 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
11971 \pgfusepath{draw}
11972 \pgfscope
11973 \pgftransformshift{\pgfpoint{\pgf@circ@res@right} {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
11974 \pgftransformscale{0.5}
11975 \pgfnode{circ}{center}{}{}{\pgfusepath{fill}}
11976 \endpgfscope
11977 }
11978
11979 \long\def\declarebpt#1{
11980 \pgfcircdeclaretransistor{#1}{
11981 \anchor{inner up}{
11982 \northeast
11983 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
11984 }
11985 \anchor{inner down}{
11986 \northeast
11987 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
11988 }
11989 }{
11990 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
11991 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
11992 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
11993 \pgfpathlineto{\pgfpoint
11994 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
11995 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
11996 \pgfusepath{draw}
11997
11998 % drawing base
11999 \pgfscope
12000 \pgfpathmoveto{\pgfpoint
12001 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12002 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12003 \pgfpathlineto{\pgfpoint
12004 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12005 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12006 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12007 \ifpgf@circuit@bpt@schottky
12008 % upper
12009 \pgfpathmoveto{\pgfpoint
12010 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12011 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12012 \pgfpathlineto{\pgfpoint
12013 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12014 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
12015 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12016 \pgfpathlineto{\pgfpoint
12017 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
12018 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12019 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
12020 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12021 \pgfpathlineto{\pgfpoint
12022 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
12023 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12024 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12025 % % lower
12026 \pgfpathmoveto{\pgfpoint
12027 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12028 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12029 \pgfpathlineto{\pgfpoint
12030 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12031 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
12032 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12033 \pgfpathlineto{\pgfpoint
12034 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
12035 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12036 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
12037 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12038 \pgfpathlineto{\pgfpoint
12039 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
12040 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12041 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12042 \fi
12043 \pgfusepath{draw}
12044 \endpgfscope
12045
12046 \pgfpathmoveto{\pgfpoint
12047 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12048 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
12049 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12050 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12051 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12052 \pgfusepath{draw}
12053 %draw arrow depending on type of transistor
12054 \pgfscope
12055 \pgfslopedattimetrue
12056 \pgfallowupsidedownattimetrue
12057 \pgfresetnontranslationattimefalse
12058 \edef\@@anchor{center}
12059 \ifpgf@circuit@trans@ntype
12060 \ifpgf@circuit@trans@arrowatend
12061 \edef\@@anchor{btip}
12062 \pgftransformlineattime{1.0}{%
12063 \pgfpoint%
12064 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12065 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
12066 }{%
12067 \pgfpoint{\pgf@circ@res@right}%
12068 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
12069 }
12070 \else
12071 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
12072 \pgfpoint%
12073 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12074 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
12075 }{%
12076 \pgfpoint{\pgf@circ@res@right}%
12077 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
12078 }
12079 \fi
12080 \else % p-type
12081 \ifpgf@circuit@trans@arrowatend
12082 \edef\@@anchor{tip}
12083 \pgftransformlineattime{1.0}{%
12084 \pgfpoint{\pgf@circ@res@right}%
12085 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
12086 }{%
12087 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12088 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
12089 }
12090 \else
12091 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
12092 \pgfpoint{\pgf@circ@res@right}%
12093 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
12094 }{%
12095 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12096 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
12097 }
12098 \fi
12099 \fi
12100 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12101 \endpgfscope
12102
12103 \ifpgf@circuit@bpt@drawphoto
12104 \pgfscope
12105 \pgfsetarrowsstart{latexslim}
12106 \pgfpathmoveto{\pgfpointadd{\pgfpoint
12107 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12108 {\pgf@circ@res@up+\pgf@circ@res@down}}
12109 {\pgfpoint{0.05\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
12110 \pgfpathlineto{\pgfpointadd{\pgfpoint
12111 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12112 {\pgf@circ@res@up+\pgf@circ@res@down}}
12113 {\pgfpoint{0.5\pgf@circ@res@left}{0.3\pgf@circ@res@up}}}
12114 \pgfusepath{draw}
12115 \pgfpathmoveto{\pgfpointadd{\pgfpoint
12116 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12117 {\pgf@circ@res@up+\pgf@circ@res@down}}
12118 {\pgfpoint{0.05\pgf@circ@res@left}{-0.1\pgf@circ@res@up}}}
12119 \pgfpathlineto{\pgfpointadd{\pgfpoint
12120 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12121 {\pgf@circ@res@up+\pgf@circ@res@down}}
12122 {\pgfpoint{0.5\pgf@circ@res@left}{0.1\pgf@circ@res@up}}}
12123 \pgfusepath{draw}
12124 \endpgfscope
12125 \else
12126 \ifpgf@circuit@bpt@drawbase
12127 \pgfpathmoveto{\pgfpoint
12128 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12129 {\pgf@circ@res@up+\pgf@circ@res@down}}
12130 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12131 \pgfusepath{draw}
12132 \fi
12133 \fi
12134 }
12135 }
12136
12137 \declarebpt{npn}
12138 \declarebpt{pnp}
12139 %
12140 % multi-emitter and multi-collector BJTs by Romano Giannetti
12141 %
12142 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
12143 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
12144 \pgfextracty{\pgf@circ@res@other}{\basedimension}
12145 \ifnum\cdir>0 % NPN, above
12146 \pgfpoint{\pgf@circ@res@temp}{%
12147 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
12148 \else % PNP, below
12149 \pgfpoint{\pgf@circ@res@temp}{%
12150 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
12151 \fi
12152 }
12153 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
12154 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
12155 \pgfextracty{\pgf@circ@res@other}{\basedimension}
12156 \ifnum\cdir<0 % PNP, above
12157 \pgfpoint{\pgf@circ@res@temp}{%
12158 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
12159 \else % PNP, below
12160 \pgfpoint{\pgf@circ@res@temp}{%
12161 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
12162 \fi
12163 }
12164
12165 \long\def\declarebjt#1{
12166 \pgfdeclareshape{bjt#1}{
12167 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
12168 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12169 % \cdir is 1 for npn, -1 for pnp
12170 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
12171 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
12172 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
12173 % step up or down for the additional C/Es
12174 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
12175 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12176 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
12177 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
12178 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
12179 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
12180 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12181 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12182 \pgf@y=.5\pgf@y
12183 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
12184 \pgf@x=.5\pgf@x
12185 }
12186 \savedanchor\northeast{% upper right
12187 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12188 \pgfmathsetlength{\pgf@circ@res@step}{%
12189 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12190 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12191 \ifnum\cdir> 0
12192 \edef\numup{\numC}\edef\numdown{\numE}
12193 \else
12194 \edef\numup{\numE}\edef\numdown{\numC}
12195 \fi
12196 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12197 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
12198 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12199 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
12200 \pgf@x=.5\pgf@x
12201 }
12202 \savedanchor\southeast{% lower right
12203 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12204 \pgfmathsetlength{\pgf@circ@res@step}{%
12205 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12206 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12207 \ifnum\cdir> 0
12208 \edef\numup{\numC}\edef\numdown{\numE}
12209 \else
12210 \edef\numup{\numE}\edef\numdown{\numC}
12211 \fi
12212 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12213 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
12214 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12215 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
12216 \pgf@x=.5\pgf@x
12217 }
12218 \savedanchor\southwest{% lower left
12219 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12220 \pgfmathsetlength{\pgf@circ@res@step}{%
12221 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
12222 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12223 \ifnum\cdir> 0
12224 \edef\numup{\numC}\edef\numdown{\numE}
12225 \else
12226 \edef\numup{\numE}\edef\numdown{\numC}
12227 \fi
12228 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
12229 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
12230 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12231 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
12232 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
12233 }
12234 \anchor{center}{\pgfpointorigin}
12235 \anchor{north}{\northeast\pgf@x=0cm\relax}
12236 \anchor{east}{\northeast\pgf@y=0cm\relax}
12237 \anchor{south}{\southwest\pgf@x=0cm\relax}
12238 \anchor{west}{\southwest\pgf@y=0cm}
12239 \anchor{north east}{\northeast}
12240 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
12241 \anchor{south west}{\southwest}
12242 \anchor{south east}{\southeast}
12243
12244 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
12245 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
12246 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
12247 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
12248 % center of the base "bar"
12249 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
12250 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
12251 }
12252 % geometrical centers
12253 \anchor{vcenter}{\pgf@x=0cm\relax
12254 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
12255 }
12256 \anchor{gcenter}{%
12257 \northeast\pgf@xa=0.5\pgf@x
12258 \southwest\advance\pgf@xa by 0.5\pgf@x
12259 \pgf@x=\pgf@xa
12260 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
12261 }
12262 % external connections
12263 \anchor{E}{
12264 \ifnum\cdir>0% npn, emitter down
12265 \southeast
12266 \else
12267 \northeast
12268 \fi
12269 }% first emitter
12270 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
12271 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
12272 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
12273
12274 \backgroundpath{
12275 \pgftransformationadjustments
12276 \pgfsetcolor{\ctikzvalof{color}}
12277 %
12278 % set the type and up and down number of connections
12279 %
12280 \ifnum\cdir> 0
12281 \pgf@circuit@trans@ntypetrue
12282 \edef\numup{\numC}
12283 \edef\numdown{\numE}
12284 \else
12285 \pgf@circuit@trans@ntypefalse
12286 \edef\numup{\numE}
12287 \edef\numdown{\numC}
12288 \fi
12289 \basedimension
12290 \pgf@circ@res@up = \pgf@y
12291 \pgf@circ@res@down = -\pgf@y
12292 \pgf@circ@res@right = \pgf@x
12293 \pgf@circ@res@left = -\pgf@x
12294 \pgf@circ@scaled@Rlen=\scaledRlen
12295 \pgf@circ@res@step=\multistep
12296 %
12297 % set arrow positions options
12298 %
12299 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
12300 \ifpgf@circuit@trans@arrowatend
12301 \edef\@@pos{1.0}
12302 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
12303 \edef\@@anchor{btip}
12304 \else
12305 \edef\@@anchor{tip}
12306 \fi
12307 \fi
12308 %
12309 % Drawing upper connections
12310 %
12311 \pgfscope
12312 \pgf@circ@count@a=\numup\relax
12313 \pgfmathloop%
12314 \ifnum\pgf@circ@count@a>0
12315 \advance\pgf@circ@count@a-1\relax
12316 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
12317 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
12318 \pgfpathmoveto{\pgfpoint
12319 {\pgf@circ@res@right}%
12320 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12321 \pgfpathlineto{\pgfpoint
12322 {\pgf@circ@res@right}%
12323 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12324 \else
12325 \pgfpathmoveto{\pgfpoint
12326 {\pgf@circ@res@right}%
12327 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
12328 \fi
12329 \pgfpathlineto{\pgfpoint
12330 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12331 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
12332 \pgfsetroundcap % better when connecting to sloped lines
12333 \pgfusepath{draw}
12334 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
12335 \pgfscope
12336 \pgfslopedattimetrue
12337 \pgfallowupsidedownattimetrue
12338 \pgfresetnontranslationattimefalse
12339 \pgftransformlineattime{\@@pos}{%
12340 \pgfpoint
12341 {\pgf@circ@res@right}%
12342 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
12343 }{\pgfpoint
12344 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12345 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
12346 }
12347 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12348 \endpgfscope
12349 \fi
12350 \repeatpgfmathloop
12351 \endpgfscope
12352 %
12353 % Drawing base
12354 %
12355 \pgfscope
12356 \pgfpathmoveto{\pgfpoint
12357 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12358 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12359 \pgfpathlineto{\pgfpoint
12360 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12361 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12362 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12363 \ifpgf@circuit@bpt@schottky
12364 % upper
12365 \pgfpathmoveto{\pgfpoint
12366 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12367 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12368 \pgfpathlineto{\pgfpoint
12369 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12370 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
12371 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12372 \pgfpathlineto{\pgfpoint
12373 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
12374 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12375 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
12376 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12377 \pgfpathlineto{\pgfpoint
12378 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
12379 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12380 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
12381 % lower
12382 \pgfpathmoveto{\pgfpoint
12383 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12384 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12385 \pgfpathlineto{\pgfpoint
12386 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12387 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
12388 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12389 \pgfpathlineto{\pgfpoint
12390 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
12391 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12392 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
12393 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
12394 \pgfpathlineto{\pgfpoint
12395 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
12396 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
12397 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
12398 \fi
12399 \pgfsetroundcap % I like it more...
12400 \pgfusepath{draw}
12401 \endpgfscope
12402 %
12403 % draw base external connection
12404 %
12405 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
12406 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
12407 \pgfusepath{draw}
12408 %
12409 % Drawing lower connections
12410 %
12411 \pgfscope
12412 \pgf@circ@count@a=\numdown\relax
12413 \pgfmathloop%
12414 \ifnum\pgf@circ@count@a>0
12415 \advance\pgf@circ@count@a-1\relax
12416 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
12417 \pgfpathmoveto{\pgfpoint
12418 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
12419 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
12420 \pgfpathlineto{\pgfpoint
12421 {\pgf@circ@res@right}
12422 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
12423 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
12424 \pgfpathlineto{\pgfpoint
12425 {\pgf@circ@res@right}
12426 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
12427 \fi
12428 \pgfsetroundcap % better when connecting to sloped lines
12429 \pgfusepath{draw}
12430 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
12431 \pgfscope
12432 \pgfslopedattimetrue
12433 \pgfallowupsidedownattimetrue
12434 \pgfresetnontranslationattimefalse
12435 \pgftransformlineattime{\@@pos}{%
12436 \pgfpoint
12437 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
12438 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
12439 }{\pgfpoint
12440 {\pgf@circ@res@right}%
12441 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
12442 }
12443 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12444 \endpgfscope
12445 \fi
12446 \repeatpgfmathloop
12447 \endpgfscope
12448 }
12449 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
12450 % and is executed just before a node is drawn.
12451 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
12452 % Start with the maximum collector number and go backwards.
12453 \pgf@circ@count@a=\numC\relax
12454 \pgfmathloop%
12455 \ifnum\pgf@circ@count@a>0
12456 % we will create two anchors per pin: the "normal one" like `pin 1` for the
12457 % electrical contact, and the "border one" like `bpin 1` for labels.
12458 % they will coincide if `external pins width` is set to 0.
12459 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
12460 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
12461 }
12462 \advance\pgf@circ@count@a by -1\relax%
12463 \repeatpgfmathloop%
12464 % and emitters
12465 \pgf@circ@count@a=\numE\relax
12466 \pgfmathloop%
12467 \ifnum\pgf@circ@count@a>0
12468 % we will create two anchors per pin: the "normal one" like `pin 1` for the
12469 % electrical contact, and the "border one" like `bpin 1` for labels.
12470 % they will coincide if `external pins width` is set to 0.
12471 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
12472 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
12473 }
12474 \advance\pgf@circ@count@a by -1\relax%
12475 \repeatpgfmathloop%
12476 }%
12477 }
12478 }
12479
12480 \declarebjt{npn}
12481 \declarebjt{pnp}
12482
12483 % end of multi-bjts
12484
12485 \long\def\declareigbt#1{
12486 \pgfcircdeclaretransistor{#1}{
12487 \anchor{inner up}{
12488 \northeast
12489 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
12490 }
12491 \anchor{inner down}{
12492 \northeast
12493 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
12494 }
12495 }
12496 {
12497 %draw upper connection
12498 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12499 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12500 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
12501 \pgfpathlineto{\pgfpoint
12502 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12503 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
12504 \pgfusepath{draw}
12505
12506 %draw thicker gate lines
12507 \pgfscope
12508 \pgfscope
12509 \pgfpathmoveto{\pgfpoint
12510 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12511 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
12512 \pgfpathlineto{\pgfpoint
12513 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12514 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
12515 % set the normal thickness
12516 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12517 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
12518 \pgfsetlinewidth{\@@extrat\pgflinewidth}
12519 \pgfusepath{draw}
12520 \endpgfscope
12521 \pgfpathmoveto{\pgfpoint
12522 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12523 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
12524 \pgfpathlineto{\pgfpoint
12525 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12526 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
12527 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12528 \pgfusepath{draw}
12529 \endpgfscope
12530 %draw lower connection
12531 \pgfpathmoveto{\pgfpoint
12532 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12533 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
12534 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12535 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
12536 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12537 \pgfusepath{draw}
12538 %draw arrow depending on type of transistor
12539 \pgfscope
12540 \pgfslopedattimetrue
12541 \pgfallowupsidedownattimetrue
12542 \pgfresetnontranslationattimefalse
12543 \ifpgf@circuit@trans@arrowatend
12544 \ifpgf@circuit@trans@ntype
12545 \edef\@@anchor{btip}\edef\@@pos{1.0}
12546 \else
12547 \edef\@@anchor{tip}\edef\@@pos{1.0}
12548 \fi
12549 \else
12550 \edef\@@anchor{center}\edef\@@pos{0.5}
12551 \fi
12552 \ifpgf@circuit@trans@ntype
12553 \pgftransformlineattime{\@@pos}{%
12554 \pgfpoint%
12555 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12556 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
12557 }{%
12558 \pgfpoint{\pgf@circ@res@right}%
12559 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
12560 }
12561 \else
12562 \pgftransformlineattime{\@@pos}{%
12563 \pgfpoint{\pgf@circ@res@right}%
12564 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
12565 }{%
12566 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12567 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
12568 }
12569 \fi
12570 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12571 \endpgfscope
12572 %draw gate
12573 \ifpgf@circuit@trans@ntype
12574 \pgfpathmoveto{\pgfpoint
12575 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12576 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12577 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
12578 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12579 \else
12580 \pgfpathmoveto{\pgfpoint
12581 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12582 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
12583 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
12584 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
12585 \fi
12586 \pgfusepath{draw}
12587 }
12588 }
12589
12590 \declareigbt{pigbt}
12591 \declareigbt{nigbt}
12592 \declareigbt{Lnigbt}
12593 \declareigbt{Lpigbt}
12594
12595 \pgfcircdeclaretransistor{nmos}{
12596 \anchor{inner up}{
12597 \northeast
12598 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
12599 }
12600 \anchor{inner down}{
12601 \northeast
12602 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
12603 }
12604 }{%
12605 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12606 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12607 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
12608 \pgfpathlineto{\pgfpoint
12609 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12610 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
12611
12612 \pgfpathmoveto{\pgfpoint
12613 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12614 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
12615 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12616 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
12617 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12618 \pgfusepath{draw}
12619
12620 \pgfscope
12621 \pgfpathmoveto{\pgfpoint
12622 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12623 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
12624 \pgfpathlineto{\pgfpoint
12625 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12626 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
12627 \pgfpathmoveto{\pgfpoint
12628 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
12629 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
12630 \pgfpathlineto{\pgfpoint
12631 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
12632 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
12633 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12634 \pgfusepath{draw}
12635 \endpgfscope
12636 \ifpgf@circuit@mos@arrows
12637 \pgfscope
12638 \ifpgf@circuit@trans@arrowatend
12639 \pgftransformshift{\pgfpoint
12640 {\pgf@circ@res@right}%
12641 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
12642 }
12643 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
12644 \else
12645 \pgfslopedattimetrue
12646 \pgfallowupsidedownattimetrue
12647 \pgfresetnontranslationattimefalse
12648 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
12649 \pgfpoint%
12650 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
12651 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
12652 }{%
12653 \pgfpoint
12654 {\pgf@circ@res@right}%
12655 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
12656 }
12657 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
12658 \fi
12659 \endpgfscope
12660 \fi
12661
12662 \ifpgf@circuit@bpt@drawgate
12663 \pgfpathmoveto{\pgfpoint
12664 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
12665 {\pgf@circ@res@up+\pgf@circ@res@down}}
12666 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12667 \pgfusepath{draw}
12668 \fi
12669
12670 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
12671 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
12672 {\pgf@circ@res@up+\pgf@circ@res@down}}
12673 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
12674 {\pgf@circ@res@up+\pgf@circ@res@down}}
12675 \pgfusepath{draw}
12676 \fi
12677 }
12678
12679 \pgfcircdeclaretransistor{pmos}{
12680 \anchor{inner up}{
12681 \northeast
12682 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
12683 }
12684 \anchor{inner down}{
12685 \northeast
12686 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
12687 }
12688 }{%
12689 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12690 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12691 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
12692 \pgfpathlineto{\pgfpoint
12693 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12694 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
12695 \pgfusepath{draw}
12696
12697 \ifpgf@circuit@mos@arrows
12698 \pgfscope
12699 \ifpgf@circuit@trans@arrowatend
12700 \pgftransformshift{\pgfpoint
12701 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
12702 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
12703 }
12704 \pgftransformrotate{180}
12705 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
12706 \else
12707 \pgfslopedattimetrue
12708 \pgfallowupsidedownattimetrue
12709 \pgfresetnontranslationattimefalse
12710 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
12711 \pgfpoint%
12712 {\pgf@circ@res@right}%
12713 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
12714 }{%
12715 \pgfpoint
12716 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
12717 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
12718 }
12719 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
12720 \fi
12721 \endpgfscope
12722 \fi
12723
12724 \pgfscope
12725 \pgfpathmoveto{\pgfpoint
12726 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12727 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
12728 \pgfpathlineto{\pgfpoint
12729 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12730 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
12731 \pgfpathmoveto{\pgfpoint
12732 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
12733 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
12734 \pgfpathlineto{\pgfpoint
12735 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
12736 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
12737 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12738 \pgfusepath{draw}
12739 \endpgfscope
12740
12741 \pgfpathmoveto{\pgfpoint
12742 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12743 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
12744 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12745 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
12746 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12747
12748
12749 \pgfusepath{draw}
12750 \ifpgf@circuit@bpt@drawgate
12751 \pgfpathmoveto{\pgfpoint
12752 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
12753 {\pgf@circ@res@up+\pgf@circ@res@down}}
12754 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12755 \pgfusepath{draw}
12756 \fi
12757
12758 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
12759 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
12760 {\pgf@circ@res@up+\pgf@circ@res@down}}
12761 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
12762 {\pgf@circ@res@up+\pgf@circ@res@down}}
12763 \pgfusepath{draw}
12764 \fi
12765
12766 \ifpgf@circuit@pmos@nocircle\else
12767 % we are not scaling the circle with the MOS --- I think it's better to have it
12768 % coherent with the poles/nodes of the rest of the circuit.
12769 \pgfpathcircle{\pgfpoint
12770 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
12771 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
12772 \ifpgf@circuit@pmos@emptycircle
12773 \pgfsetfillcolor{white}
12774 \fi
12775 \pgfusepath{draw,fill}
12776 \fi
12777 }
12778
12779 %% HEMT FET Transistor
12780 \pgfcircdeclaretransistor{hemt}{
12781 \anchor{inner up}{
12782 \northeast
12783 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
12784 }
12785 \anchor{inner down}{
12786 \northeast
12787 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
12788 }
12789 }{%
12790 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12791 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12792 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
12793 \pgfpathlineto{\pgfpoint
12794 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12795 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
12796
12797 \pgfpathmoveto{\pgfpoint
12798 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12799 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
12800 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12801 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
12802 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12803 \pgfusepath{draw}
12804
12805 \pgfscope
12806 \pgfpathmoveto{\pgfpoint
12807 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12808 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
12809 \pgfpathlineto{\pgfpoint
12810 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12811 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
12812 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12813 \pgfusepath{draw}
12814 \endpgfscope
12815
12816 \pgfpathmoveto{\pgfpoint
12817 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
12818 {\pgf@circ@res@up+\pgf@circ@res@down}}
12819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
12820 \pgfusepath{draw}
12821 }
12822
12823 \long\def\drawfetcore#1{
12824 \pgftransformationadjustments
12825 %top connection
12826 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12827 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12828 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
12829 \pgfpathlineto{\pgfpoint
12830 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12831 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
12832 \pgfusepath{draw}
12833 \pgfscope
12834 \pgfpathmoveto{\pgfpoint
12835 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12836 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
12837 \ifpgf@circuit@trans@depletiontype
12838 \pgfpathlineto{\pgfpoint
12839 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12840 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12841 \else
12842
12843 \pgfpathlineto{\pgfpoint
12844 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12845 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
12846 \pgfpathmoveto{\pgfpoint
12847 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12848 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
12849 \pgfpathlineto{\pgfpoint
12850 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12851 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
12852 \pgfpathmoveto{\pgfpoint
12853 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12854 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
12855 \pgfpathlineto{\pgfpoint
12856 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12857 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
12858 \fi
12859 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12860 \pgfusepath{draw}
12861 \endpgfscope
12862 %Bulk connection line
12863 \pgfpathmoveto{\pgfpoint
12864 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12865 {\pgf@circ@res@up+\pgf@circ@res@down}}
12866 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
12867 {\pgf@circ@res@up+\pgf@circ@res@down}}
12868
12869 %bottom connection
12870 \pgfpathmoveto{\pgfpoint
12871 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
12872 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
12873 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
12874 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
12875 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12876 \pgfusepath{draw}
12877
12878 %draw thick gate line
12879 \pgfscope
12880 \pgfpathmoveto{\pgfpoint
12881 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12882 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12883 \pgfpathlineto{\pgfpoint
12884 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12885 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
12886 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12887 \pgfusepath{draw}
12888 \endpgfscope
12889
12890 % arrows
12891 \pgfscope
12892 \pgfslopedattimetrue
12893 \pgfallowupsidedownattimetrue
12894 \pgfresetnontranslationattimefalse
12895 \ifpgf@circuit@trans@arrowatend
12896 \ifpgf@circuit@trans@ntype
12897 \edef\@@anchor{tip}
12898 \edef\@@pos{1.0}
12899 \else
12900 \edef\@@anchor{btip}
12901 \edef\@@pos{0.0}
12902 \fi
12903 \else
12904 \edef\@@anchor{center}\edef\@@pos{0.6}
12905 \fi
12906 \pgftransformlineattime{\@@pos}{%
12907 \pgfpoint
12908 {\pgf@circ@res@right}%
12909 {\pgf@circ@res@up+\pgf@circ@res@down}%
12910 }{%
12911 \pgfpoint%
12912 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
12913 {\pgf@circ@res@up+\pgf@circ@res@down}%
12914 }
12915 \ifpgf@circuit@trans@ntype
12916 \else
12917 \pgftransformrotate{180}
12918 \fi
12919 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
12920 \endpgfscope
12921
12922 % GATE CONNECTION
12923 \ifpgf@circuit@bpt@drawgate
12924 \ifpgf@circuit@trans@ntype
12925 \pgfpathmoveto{\pgfpoint
12926 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12927 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12928 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12929 \else
12930 \pgfpathmoveto{\pgfpoint
12931 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
12932 {-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12933 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{-\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
12934 \fi
12935 \pgfusepath{draw}
12936 \fi
12937
12938 }
12939
12940 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3
12941 {\pgfcircdeclaretransistor{#1}{
12942 \anchor{bulk}{\left\pgf@x=0pt}
12943 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
12944 \anchor{inner up}{
12945 \northeast
12946 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
12947 }
12948 \anchor{inner down}{
12949 \northeast
12950 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
12951 }
12952 #2
12953 }
12954 {#3}
12955 }
12956
12957 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
12958 \pgf@circuit@trans@depletiontypefalse
12959 \drawfetcore{nfet}
12960 }
12961
12962 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
12963 \pgf@circuit@trans@depletiontypefalse
12964 \drawfetcore{pfet}
12965 }
12966
12967 % N-CHANNEL IGFET ENHANCEMENT TYPE
12968 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
12969 \pgf@circuit@trans@depletiontypefalse
12970 \drawfetcore{nigfete}
12971
12972 % SOURCE CONNECTION
12973 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12974 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12975 \pgfusepath{draw}
12976
12977 % SOLDER DOT at source-bulk connection
12978 \ifpgf@circuit@fet@solderdot
12979 \pgfscope
12980 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
12981 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
12982 \pgfnode{circ}{center}{}{}{}
12983 \endpgfscope{}
12984 \fi
12985 }
12986
12987 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
12988 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
12989 \pgf@circuit@trans@depletiontypefalse
12990 \drawfetcore{nigfetebulk}
12991 % SOLDER DOT at source-bulk connection
12992 \ifpgf@circuit@fet@solderdot
12993 \pgfscope
12994 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
12995 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
12996 \pgfnode{circ}{center}{}{}{}
12997 \endpgfscope{}
12998 \fi
12999 }
13000
13001 % N-CHANNEL IGFET DEPLETION TYPE
13002 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
13003 \pgf@circuit@trans@depletiontypetrue
13004 \drawfetcore{nigfetd}
13005
13006 % SOURCE CONNECTION
13007 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13008 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
13009 \pgfusepath{draw}
13010
13011 % SOLDER DOT at source-bulk connection
13012 \ifpgf@circuit@fet@solderdot
13013 \pgfscope
13014 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13015 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
13016 \pgfnode{circ}{center}{}{}{}
13017 \endpgfscope{}
13018 \fi
13019 }
13020
13021 % P-CHANNEL IGFET ENHANCEMENT TYPE
13022 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
13023 \pgf@circuit@trans@depletiontypefalse
13024 \drawfetcore{pigfete}
13025 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13026
13027 % SOURCE CONNECTION
13028 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13029 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13030 \pgfusepath{draw}
13031
13032
13033 % SOLDER DOT at source-bulk connection
13034 \ifpgf@circuit@fet@solderdot
13035 \pgfscope
13036 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13037 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
13038 \pgfnode{circ}{center}{}{}{}
13039 \endpgfscope
13040 \fi
13041 }
13042
13043 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
13044 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
13045 \pgf@circuit@trans@depletiontypefalse
13046 \drawfetcore{pigfetebulk}
13047 }
13048
13049 % P-CHANNEL IGFET DEPLETION TYPE
13050 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
13051 \pgf@circuit@trans@depletiontypetrue
13052 \drawfetcore{pigfetd}
13053
13054 % SOURCE CONNECTION
13055 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13056 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13057 \pgfusepath{draw}
13058
13059
13060 % SOLDER DOT at source-bulk connection
13061 \ifpgf@circuit@fet@solderdot
13062 \pgfscope
13063 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13064 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
13065 \pgfnode{circ}{center}{}{}{}
13066 \endpgfscope{}
13067 \fi
13068 }
13069
13070 \pgfcircdeclaretransistor{njfet}{
13071 \anchor{inner up}{
13072 \northeast
13073 \pgf@y=\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
13074 }
13075 \anchor{inner down}{
13076 \northeast
13077 \pgf@y=-\ctikzvalof{tripoles/njfet/gate height 2}\pgf@y
13078 }
13079 }{%
13080 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13081 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13082 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
13083 \pgfpathlineto{\pgfpoint
13084 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13085 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@up}}
13086
13087 \pgfpathmoveto{\pgfpoint
13088 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13089 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
13090 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13091 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
13092 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13093 \pgfusepath{draw}
13094
13095 \pgfscope
13096 \pgfpathmoveto{\pgfpoint
13097 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13098 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@up}}
13099 \pgfpathlineto{\pgfpoint
13100 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13101 {\ctikzvalof{tripoles/njfet/gate height}\pgf@circ@res@down}}
13102 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13103 \pgfusepath{draw}
13104 \endpgfscope
13105
13106 % arrow
13107 \pgfscope
13108 \pgfslopedattimetrue
13109 \pgfallowupsidedownattimetrue
13110 \pgfresetnontranslationattimefalse
13111 \ifpgf@circuit@trans@arrowatend
13112 \edef\@@anchor{tip}\edef\@@pos{1.0}
13113 \else
13114 \edef\@@anchor{center}\edef\@@pos{0.6}
13115 \fi
13116 \pgftransformlineattime{\@@pos}{%
13117 \pgfpoint{\pgf@circ@res@left}%
13118 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
13119 }{%
13120 \pgfpoint
13121 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}%
13122 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}%
13123 }
13124 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13125 \endpgfscope
13126
13127 \pgfpathmoveto{\pgfpoint
13128 {\ctikzvalof{tripoles/njfet/gate width}\pgf@circ@res@left}
13129 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
13130 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13131 {\ctikzvalof{tripoles/njfet/gate height 2}\pgf@circ@res@down}}
13132 \pgfusepath{draw}
13133 }
13134
13135 \pgfcircdeclaretransistor{pjfet}{
13136 \anchor{inner up}{
13137 \northeast
13138 \pgf@y=\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
13139 }
13140 \anchor{inner down}{
13141 \northeast
13142 \pgf@y=-\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@y
13143 }
13144 }{%
13145 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13146 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13147 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
13148 \pgfpathlineto{\pgfpoint
13149 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13150 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
13151
13152 \pgfpathmoveto{\pgfpoint
13153 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13154 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
13155 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13156 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@down}}
13157 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13158 \pgfusepath{draw}
13159
13160 \pgfscope
13161 \pgfpathmoveto{\pgfpoint
13162 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13163 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@up}}
13164 \pgfpathlineto{\pgfpoint
13165 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13166 {\ctikzvalof{tripoles/pjfet/gate height}\pgf@circ@res@down}}
13167 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13168 \pgfusepath{draw}
13169 \endpgfscope
13170
13171 \pgfscope
13172 \pgfslopedattimetrue
13173 \pgfallowupsidedownattimetrue
13174 \pgfresetnontranslationattimefalse
13175 \ifpgf@circuit@trans@arrowatend
13176 \edef\@@anchor{btip}\edef\@@pos{1.0}
13177 \else
13178 \edef\@@anchor{center}\edef\@@pos{0.4}
13179 \fi
13180 \pgftransformlineattime{\@@pos}{%
13181 \pgfpoint%
13182 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}%
13183 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
13184 }{%
13185 \pgfpoint{\pgf@circ@res@left}%
13186 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}%
13187 }
13188 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13189 \endpgfscope
13190
13191 \pgfpathmoveto{\pgfpoint
13192 {\ctikzvalof{tripoles/pjfet/gate width}\pgf@circ@res@left}
13193 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
13194 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
13195 {\ctikzvalof{tripoles/pjfet/gate height 2}\pgf@circ@res@up}}
13196 \pgfusepath{draw}
13197 }
13198
13199 \pgfdeclaretransistorwrapperaddbulk{isfet}{}{%
13200 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13201 % DRAIN CONNECTION
13202 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13203 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
13204 % DRAIN
13205 \pgfpathlineto{\pgfpoint
13206 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
13207 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
13208 \pgfusepath{draw}
13209
13210 % GATE, DEPLETION TYPE
13211 \pgfscope %% added
13212 \pgfpathmoveto{\pgfpoint
13213 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
13214 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
13215 \pgfpathlineto{\pgfpoint
13216 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
13217 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
13218 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
13219 \pgfusepath{draw} %% added
13220 \endpgfscope %% added
13221
13222 % BULK
13223 \pgfpathmoveto{\pgfpoint
13224 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
13225 {\pgf@circ@res@up+\pgf@circ@res@down}}
13226 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
13227 {\pgf@circ@res@up+\pgf@circ@res@down}}
13228
13229 % SOURCE
13230 \pgfpathmoveto{\pgfpoint
13231 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
13232 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
13233 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
13234 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
13235 % SOURCE CONNECTION
13236 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13237 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
13238 \pgfusepath{draw}
13239
13240 % SOLDER DOT at source-bulk connection
13241 \ifpgf@circuit@fet@solderdot
13242 \pgfscope
13243 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
13244 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
13245 \pgfnode{circ}{center}{}{}{}
13246 \endpgfscope{}
13247 \fi
13248 % ARROW
13249 \pgfscope
13250 \pgfslopedattimetrue
13251 \pgfallowupsidedownattimetrue
13252 \pgfresetnontranslationattimefalse
13253 \ifpgf@circuit@trans@arrowatend
13254 \edef\@@anchor{tip}\edef\@@pos{1.0}
13255 \else
13256 \edef\@@anchor{center}\edef\@@pos{0.6}
13257 \fi
13258 \pgftransformlineattime{\@@pos}{%
13259 \pgfpoint
13260 {\pgf@circ@res@right}%
13261 {\pgf@circ@res@up+\pgf@circ@res@down}%
13262 }{%
13263 \pgfpoint%
13264 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
13265 {\pgf@circ@res@up+\pgf@circ@res@down}%
13266 }
13267 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
13268 \endpgfscope
13269 \pgfusepath{draw}
13270
13271 % Wavy lines
13272 \pgfscope
13273 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
13274 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13275 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13276 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13277 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13278 \pgfusepath{draw}
13279
13280 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
13281 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13282 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13283 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13284 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13285 \pgfusepath{draw}
13286
13287 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
13288 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13289 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13290 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13291 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
13292 \pgfusepath{draw}
13293 \endpgfscope
13294 }
13295
13296 % end of transistors
13297
13298 %%%%%%%%%%%%%
13299 %% Switches
13300 %%%%%%%%%%%%%
13301
13302 \pgfcircdeclarebipole{
13303 \anchor{out 1}{
13304 \northeast
13305 \pgf@y=0cm
13306 }
13307 \anchor{out 2}{
13308 \northeast
13309 \pgf@y=.8\pgf@y
13310 }
13311 }
13312 {\ctikzvalof{tripoles/toggleswitch/height 2}}
13313 {toggleswitch}
13314 {\ctikzvalof{tripoles/toggleswitch/height}}
13315 {\ctikzvalof{tripoles/toggleswitch/width}}
13316 {
13317
13318 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13319 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
13320 \pgfusepath{draw}
13321 \pgfscope
13322 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
13323 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
13324 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
13325 \pgfusepath{draw}
13326 \endpgfscope
13327
13328 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13329 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
13330
13331 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
13332 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
13333 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
13334 \pgfusepath{draw}
13335
13336
13337 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
13338 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
13339 \pgfusepath{draw}
13340
13341 \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}
13342 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
13343 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
13344 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
13345 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
13346 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
13347 \pgfusepath{draw}
13348 \pgfsetdash{}{0cm}
13349 }
13350
13351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13352 %% operational and instrumentation amplifiers
13353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13354
13355 \pgfdeclareshape{op amp}
13356 {
13357 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13358 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13359 \anchor{center}{\pgfpointorigin}
13360 \savedanchor\northwest{%
13361 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13362 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
13363 \pgf@y=.5\pgf@y
13364 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13365 \pgf@x=.5\pgf@x
13366 }
13367 \savedanchor\left{%
13368 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13369 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13370 \pgf@x=.5\pgf@x
13371 \pgf@y=0pt
13372 }
13373 \anchor{south}{
13374 \northwest
13375 \pgf@y=-\pgf@y
13376 \pgf@x=0pt
13377 }
13378 \anchor{north}{
13379 \northwest
13380 \pgf@x=0pt
13381 }
13382 \savedanchor\left{%
13383 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13384 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13385 \pgf@x=.5\pgf@x
13386 \pgf@y=0pt
13387 }
13388 \savedanchor\inOneFixed{%
13389 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13390 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
13391 \pgf@y=.5\pgf@y
13392 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
13393 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13394 \pgf@x=.5\pgf@x
13395 }
13396 \anchor{in up}{
13397 \inOneFixed
13398 }
13399 \anchor{in down}{
13400 \inOneFixed
13401 \pgf@y=-\pgf@y
13402 }
13403 \savedanchor\inOne{%
13404 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13405 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
13406 \pgf@y=.5\pgf@y
13407 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
13408 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13409 \pgf@x=.5\pgf@x
13410 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13411 }
13412 \anchor{-}{
13413 \inOne
13414 }
13415 \anchor{+}{
13416 \inOne
13417 \pgf@y=-\pgf@y
13418 }
13419 \savedanchor\up{%
13420 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13421 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
13422 \pgf@y=.5\pgf@y
13423 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13424 \pgf@x=.5\pgf@x
13425 \pgf@circ@res@up = \pgf@y
13426 \pgf@circ@res@right = -\pgf@x
13427 \pgf@circ@res@left = \pgf@x
13428 \pgfpointlineattime{
13429 \ctikzvalof{tripoles/op amp/up pos}}{
13430 \pgfpoint{
13431 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
13432 {\pgf@circ@res@up}}
13433 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
13434 }
13435 \anchor{up}{
13436 \up
13437 }
13438 \anchor{down}{
13439 \up
13440 \pgf@y=-\pgf@y
13441 }
13442 \anchor{out}{
13443 \northwest
13444 \pgf@y=0pt
13445 \pgf@x=-\pgf@x
13446 }
13447 \anchor{west}{
13448 \left
13449 }
13450 \anchor{east}{
13451 \left
13452 \pgf@x=-\pgf@x
13453 }
13454
13455 % support for border anchors
13456 \savedanchor\leftedge{%
13457 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13458 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
13459 \pgf@x=.5\pgf@x
13460 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
13461 \pgf@y=0pt
13462 }
13463 \anchor{leftedge}{\leftedge}
13464 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13465 \anchor{bin up}{
13466 \inOneFixed
13467 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13468 }
13469 \anchor{bin down}{
13470 \inOneFixed
13471 \pgf@y=-\pgf@y
13472 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13473 }
13474 \anchor{b-}{
13475 \inOne
13476 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13477 }
13478 \anchor{b+}{
13479 \inOne
13480 \pgf@y=-\pgf@y
13481 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13482 }
13483 \anchor{bout}{
13484 \leftedge
13485 \pgf@y=0pt
13486 \pgf@x=-\pgf@x
13487 }
13488 % end border anchors
13489 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13490 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13491 \anchor{north west}{ \northwest }
13492 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13493
13494 \anchor{text}{
13495 \ifpgf@circ@center@text
13496 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13497 \else
13498 \leftedge
13499 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
13500 \fi
13501 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13502 }
13503
13504 \backgroundpath{
13505 \pgfsetcolor{\ctikzvalof{color}}
13506
13507 \northwest
13508 \pgf@circ@res@up = \pgf@y
13509 \pgf@circ@res@down = -\pgf@y
13510 \pgf@circ@res@right = -\pgf@x
13511 \pgf@circ@res@left = \pgf@x
13512 \pgf@circ@scaled@Rlen=\scaledRlen
13513
13514 % Triangle
13515 \pgfscope
13516 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13517 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
13518 \pgf@circ@res@step=\pgf@circ@res@right
13519 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13520 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
13521
13522 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13523 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13524 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13525 \pgfpathclose
13526 \pgf@circ@draworfill
13527 \endpgfscope
13528
13529 % Negative input terminal
13530 \pgfpathmoveto{\pgfpoint
13531 {\pgf@circ@res@left}
13532 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
13533 \pgfpathlineto{\pgfpoint
13534 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
13535 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
13536 \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}
13537
13538 % Positive input terminal
13539 \pgfpathmoveto{\pgfpoint
13540 {\pgf@circ@res@left}
13541 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
13542 \pgfpathlineto{\pgfpoint
13543 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
13544 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
13545 \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}
13546
13547 % Output terminal
13548 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13549 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
13550 \pgfsetrectcap
13551 \pgfusepath{draw}
13552 }
13553 }
13554
13555 % Op amp shape as in european standard EN 60617
13556 \pgfdeclareshape{en amp}
13557 {
13558 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13559 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13560 \anchor{center}{\pgfpointorigin}
13561 \savedanchor\northwest{%
13562 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13563 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
13564 \pgf@y=.5\pgf@y
13565 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13566 \pgf@x=.5\pgf@x
13567 }
13568 \savedanchor\left{%
13569 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13570 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13571 \pgf@x=.5\pgf@x
13572 \pgf@y=0pt
13573 }
13574 \anchor{south}{
13575 \northwest
13576 \pgf@y=-\pgf@y
13577 \pgf@x=0pt
13578 }
13579 \anchor{north}{
13580 \northwest
13581 \pgf@x=0pt
13582 }
13583 \savedanchor\inOneFixed{%
13584 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13585 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
13586 \pgf@y=.5\pgf@y
13587 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
13588 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13589 \pgf@x=.5\pgf@x
13590 }
13591 \anchor{in up}{
13592 \inOneFixed
13593 }
13594 \anchor{in down}{
13595 \inOneFixed
13596 \pgf@y=-\pgf@y
13597 }
13598 \savedanchor\inOne{%
13599 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13600 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
13601 \pgf@y=.5\pgf@y
13602 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
13603 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13604 \pgf@x=.5\pgf@x
13605 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13606 }
13607 \anchor{-}{
13608 \inOne
13609 }
13610 \anchor{+}{
13611 \inOne
13612 \pgf@y=-\pgf@y
13613 }
13614 \anchor{up}{
13615 \northwest
13616 \pgf@x=0pt
13617 }
13618 \anchor{down}{
13619 \northwest
13620 \pgf@x=0pt
13621 \pgf@y=-\pgf@y
13622 }
13623 \anchor{out}{
13624 \northwest
13625 \pgf@y=0pt
13626 \pgf@x=-\pgf@x
13627 }
13628 \anchor{west}{
13629 \left
13630 }
13631 \anchor{east}{
13632 \left
13633 \pgf@x=-\pgf@x
13634 }
13635 % support for border anchors
13636 \savedanchor\leftedge{%
13637 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13638 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
13639 \pgf@x=.5\pgf@x
13640 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
13641 \pgf@y=0pt
13642 }
13643 \anchor{leftedge}{\leftedge}
13644 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13645 \anchor{bin up}{
13646 \inOneFixed
13647 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13648 }
13649 \anchor{bin down}{
13650 \inOneFixed
13651 \pgf@y=-\pgf@y
13652 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13653 }
13654 \anchor{b-}{
13655 \inOne
13656 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13657 }
13658 \anchor{b+}{
13659 \inOne
13660 \pgf@y=-\pgf@y
13661 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13662 }
13663 \anchor{bout}{
13664 \leftedge
13665 \pgf@y=0pt
13666 \pgf@x=-\pgf@x
13667 }
13668 % end border anchors
13669 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13670 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
13671 \anchor{north west}{ \northwest }
13672 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
13673 \anchor{text}{
13674 \ifpgf@circ@center@text
13675 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13676 \else
13677 \leftedge
13678 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
13679 \fi
13680 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13681 }
13682
13683 \backgroundpath{
13684 \pgfsetcolor{\ctikzvalof{color}}
13685 \northwest
13686 \pgf@circ@res@up = \pgf@y
13687 \pgf@circ@res@down = -\pgf@y
13688 \pgf@circ@res@right = -\pgf@x
13689 \pgf@circ@res@left = \pgf@x
13690 \pgf@circ@scaled@Rlen=\scaledRlen
13691
13692 \pgfscope
13693 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13694 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
13695 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
13696 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
13697 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
13698 \pgfpathclose
13699 \pgf@circ@draworfill
13700 \endpgfscope
13701
13702 \pgfpathmoveto{\pgfpoint
13703 {\pgf@circ@res@left}
13704 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
13705 \pgfpathlineto{\pgfpoint
13706 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
13707 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
13708 \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}
13709
13710 \pgfpathmoveto{\pgfpoint
13711 {\pgf@circ@res@left}
13712 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
13713 \pgfpathlineto{\pgfpoint
13714 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
13715 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
13716 \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}
13717
13718 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13719 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13720 \pgfsetrectcap
13721 \pgfusepath{draw}
13722
13723
13724 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
13725 % \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\ctikzvalof{tripoles/en amp/font2}$\mathstrut{\triangleright}\,\mathrm{A}$}
13726 }
13727 }
13728
13729 % Fully differential output op amp
13730 % Contributed by Kristofer M. Monisit
13731 \pgfdeclareshape{fd op amp}
13732 {
13733 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
13734 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13735 \anchor{center}{\pgfpointorigin}
13736 \savedanchor\northwest{%
13737 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13738 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13739 \pgf@y=.5\pgf@y
13740 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13741 \pgf@x=.5\pgf@x
13742 }
13743 \savedanchor\outline{%
13744 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13745 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13746 \pgf@y=.5\pgf@y
13747 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13748 \pgf@x=.5\pgf@x
13749 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
13750 }
13751 \anchor{south}{
13752 \northwest
13753 \pgf@y=-\pgf@y\pgf@x=0pt\relax
13754 }
13755 \anchor{north}{
13756 \northwest\pgf@x=0pt\relax
13757 }
13758 \savedanchor\left{%
13759 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13760 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13761 \pgf@x=.5\pgf@x
13762 \pgf@y=0pt
13763 }
13764 \savedanchor\inOneFixed{%
13765 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13766 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13767 \pgf@y=.5\pgf@y
13768 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
13769 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13770 \pgf@x=.5\pgf@x
13771 }
13772 \anchor{in up}{
13773 \inOneFixed
13774 }
13775 \anchor{in down}{
13776 \inOneFixed
13777 \pgf@y=-\pgf@y
13778 }
13779 \savedanchor\inOne{%
13780 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13781 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13782 \pgf@y=.5\pgf@y
13783 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
13784 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13785 \pgf@x=.5\pgf@x
13786 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
13787 }
13788 \anchor{-}{
13789 \inOne
13790 }
13791 \anchor{+}{
13792 \inOne
13793 \pgf@y=-\pgf@y
13794 }
13795 \savedanchor\up{%
13796 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13797 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
13798 \pgf@y=.5\pgf@y
13799 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13800 \pgf@x=.5\pgf@x
13801 \pgf@circ@res@up = \pgf@y
13802 \pgf@circ@res@right = -\pgf@x
13803 \pgf@circ@res@left = \pgf@x
13804 \pgfpointlineattime{
13805 \ctikzvalof{tripoles/fd op amp/up pos}}{
13806 \pgfpoint{
13807 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
13808 {\pgf@circ@res@up}}
13809 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
13810 }
13811 \anchor{up}{
13812 \up
13813 }
13814 \anchor{down}{
13815 \up
13816 \pgf@y=-\pgf@y
13817 }
13818 \anchor{out up}{
13819 \northwest
13820 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
13821 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13822 }
13823 \anchor{out down}{
13824 \northwest
13825 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
13826 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13827 }
13828 \anchor{out +}{
13829 \outline
13830 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
13831 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13832 }
13833 \anchor{out -}{
13834 \outline
13835 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
13836 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13837 }
13838 % support for border anchors
13839 \savedanchor\leftedge{%
13840 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13841 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
13842 \pgf@x=.5\pgf@x
13843 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13844 \pgf@y=0pt
13845 }
13846 \anchor{leftedge}{\leftedge}
13847 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
13848 \anchor{bin up}{
13849 \inOneFixed
13850 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13851 }
13852 \anchor{bin down}{
13853 \inOneFixed
13854 \pgf@y=-\pgf@y
13855 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13856 }
13857 \anchor{b-}{
13858 \inOne
13859 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13860 }
13861 \anchor{b+}{
13862 \inOne
13863 \pgf@y=-\pgf@y
13864 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
13865 }
13866 \anchor{bout}{
13867 \leftedge
13868 \pgf@y=0pt
13869 \pgf@x=-\pgf@x
13870 }
13871 \anchor{bout +}{
13872 \outline
13873 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
13874 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
13875 {\pgfpoint{\pgf@xa}{0pt}}
13876 {\pgfpoint{0pt}{\pgf@ya}}
13877 }
13878 \anchor{bout -}{
13879 \outline
13880 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
13881 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
13882 {\pgfpoint{\pgf@xa}{0pt}}
13883 {\pgfpoint{0pt}{\pgf@ya}}
13884 \pgf@y=-\pgf@y
13885 }
13886 \anchor{bout up}{
13887 \northwest
13888 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
13889 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
13890 {\pgfpoint{\pgf@xa}{0pt}}
13891 {\pgfpoint{0pt}{\pgf@ya}}
13892 }
13893 \anchor{bout down}{
13894 \northwest
13895 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
13896 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
13897 {\pgfpoint{\pgf@xa}{0pt}}
13898 {\pgfpoint{0pt}{\pgf@ya}}
13899 \pgf@y=-\pgf@y
13900 }
13901 % end border anchors
13902 \anchor{west}{
13903 \left
13904 }
13905 \anchor{east}{
13906 \left
13907 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13908 }
13909 \anchor{out}{% should not be used
13910 \left
13911 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
13912 }
13913 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
13914 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
13915 \anchor{north west}{ \northwest }
13916 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
13917 \anchor{text}{
13918 \ifpgf@circ@center@text
13919 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13920 \else
13921 \leftedge
13922 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
13923 \fi
13924 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13925 }
13926 \backgroundpath{
13927 \pgfsetcolor{\ctikzvalof{color}}
13928
13929 \northwest
13930 \pgf@circ@res@up = \pgf@y
13931 \pgf@circ@res@down = -\pgf@y
13932 \pgf@circ@res@right = -\pgf@x
13933 \pgf@circ@res@left = \pgf@x
13934 \pgf@circ@scaled@Rlen=\scaledRlen
13935
13936 % Triangle
13937 % Includes output terminals in the traingular shape
13938 % to ensure that diagonal joins are properly displayed
13939 % we first draw the main triangle and the leads with normal thickness,
13940 % and the redraw the main triangle with the component shape
13941 \pgfscope
13942 % shift origin a bit to ease calculations
13943 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
13944 \pgf@circ@res@step=\pgf@circ@res@right
13945 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13946 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
13947
13948 % Initial point (right vertex)
13949 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13950
13951 % Negative output terminal
13952 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
13953 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
13954 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
13955
13956 % Top vertex
13957 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13958
13959 % Bottom vertex
13960 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13961
13962 % Positive output terminal
13963 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
13964 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
13965 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
13966
13967 % Right vertex
13968 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13969
13970 \pgfpathclose
13971 \pgfusepath{stroke}
13972
13973 % ok, now we'll redraw the triangle with the class specific
13974 % thickness and optionally fill
13975
13976 \pgfscope
13977 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
13978
13979 % Initial point (right vertex)
13980 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13981 % Top vertex
13982 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13983 % Bottom vertex
13984 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13985
13986 \pgfpathclose
13987 \pgf@circ@draworfill
13988 \endpgfscope % thick and fill
13989 \endpgfscope % shift
13990
13991 % Negative input terminal
13992 \pgfpathmoveto{\pgfpoint
13993 {\pgf@circ@res@left}
13994 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
13995 \pgfpathlineto{\pgfpoint
13996 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
13997 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
13998 \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}
13999
14000 % Positive input terminal
14001 \pgfpathmoveto{\pgfpoint
14002 {\pgf@circ@res@left}
14003 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
14004 \pgfpathlineto{\pgfpoint
14005 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
14006 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
14007 \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}
14008
14009 % Negative output terminal label
14010 \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}
14011
14012 % Positive output terminal label
14013 \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}
14014
14015 \pgfsetrectcap
14016 \pgfusepath{draw}
14017 }
14018 }
14019
14020
14021 % Instrumentation amplifier with differential output
14022 \pgfdeclareshape{fd inst amp}
14023 {
14024 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14025 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14026 % when tikz calls the anchor it wants the relative position in the lengths
14027 % \pgf@x \pgf@y
14028 % \pgfpoint* functions set that variables
14029 % anchors are visible outside and run on use
14030 \anchor{center}{\pgfpointorigin}
14031 % savedanchors are internals and run on node creation (not use)
14032 % bounding-box top left
14033 \savedanchor\northwest{%
14034 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14035 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14036 \pgf@y=.5\pgf@y
14037 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14038 \pgf@x=.5\pgf@x
14039 }
14040 \anchor{nw}{
14041 \northwest
14042 }
14043 \anchor{south}{
14044 \northwest
14045 \pgf@y=-\pgf@y\pgf@x=0pt\relax
14046 }
14047 \anchor{north}{
14048 \northwest\pgf@x=0pt\relax
14049 }
14050 \savedanchor\left{%
14051 \pgf@y=0pt
14052 }
14053 \anchor{leftedge}
14054 {\left
14055 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
14056 }
14057 \savedanchor\inOneFixed{%
14058 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14059 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14060 \pgf@y=.5\pgf@y
14061 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
14062 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14063 \pgf@x=.5\pgf@x
14064 }
14065 \anchor{in up}{
14066 \inOneFixed
14067 }
14068 \anchor{in down}{
14069 \inOneFixed
14070 \pgf@y=-\pgf@y
14071 }
14072 \savedanchor\inOne{%
14073 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14074 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14075 \pgf@y=.5\pgf@y
14076 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
14077 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14078 \pgf@x=.5\pgf@x
14079 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14080 }
14081 \anchor{-}{
14082 \inOne
14083 }
14084 \anchor{+}{
14085 \inOne
14086 \pgf@y=-\pgf@y
14087 }
14088 \savedanchor\up{%
14089 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14090 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14091 \pgf@y=.5\pgf@y
14092 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14093 \pgf@x=.5\pgf@x
14094 \pgf@circ@res@up = \pgf@y
14095 \pgf@circ@res@right = -\pgf@x
14096 \pgf@circ@res@left = \pgf@x
14097 \pgfpointlineattime{
14098 \ctikzvalof{tripoles/fd inst amp/up pos}}{
14099 \pgfpoint{
14100 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
14101 {\pgf@circ@res@up}}
14102 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
14103 }
14104 \anchor{up}{
14105 \up
14106 }
14107 \anchor{down}{
14108 \up
14109 \pgf@y=-\pgf@y
14110 }
14111 % reference voltage input anchors.
14112 \savedanchor\refv{%
14113 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14114 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14115 \pgf@y=.5\pgf@y
14116 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14117 \pgf@x=.5\pgf@x
14118 \pgf@circ@res@up = \pgf@y
14119 \pgf@circ@res@right = -\pgf@x
14120 \pgf@circ@res@left = \pgf@x
14121 \pgfpointlineattime{
14122 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
14123 \pgfpoint{
14124 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
14125 {\pgf@circ@res@up}}
14126 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
14127 }
14128 % we need both because they are normally drawn under the amp, and if you
14129 % mirror it vertically you need them
14130 \anchor{refv up}{
14131 \refv
14132 }
14133 \anchor{refv down}{
14134 \refv
14135 \pgf@y=-\pgf@y
14136 }
14137 \savedanchor\outport{
14138 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14139 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14140 \pgf@y=.5\pgf@y
14141 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
14142 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14143 \pgf@x=-.5\pgf@x
14144 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
14145 }
14146 \anchor{out}{
14147 \outport
14148 \pgf@y=0pt
14149 }
14150 \anchor{out +}{
14151 \outport
14152 }
14153 \anchor{out -}{
14154 \outport
14155 \pgf@y=-\pgf@y
14156 }
14157 \savedanchor\outportfixed{
14158 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14159 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
14160 \pgf@y=.5\pgf@y
14161 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
14162 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14163 \pgf@x=-.5\pgf@x
14164 }
14165 \anchor{out up}{
14166 \outportfixed
14167 }
14168 \anchor{out down}{
14169 \outportfixed
14170 \pgf@y=-\pgf@y
14171 }
14172 % support for border anchors
14173 \savedanchor\leftedge{%
14174 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14175 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
14176 \pgf@x=.5\pgf@x
14177 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
14178 \pgf@y=0pt
14179 }
14180 \anchor{leftedge}{\leftedge}
14181 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14182 \anchor{bin up}{
14183 \inOneFixed
14184 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14185 }
14186 \anchor{bin down}{
14187 \inOneFixed
14188 \pgf@y=-\pgf@y
14189 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14190 }
14191 \anchor{b-}{
14192 \inOne
14193 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14194 }
14195 \anchor{b+}{
14196 \inOne
14197 \pgf@y=-\pgf@y
14198 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14199 }
14200 \anchor{bout}{
14201 \leftedge
14202 \pgf@x=-\pgf@x \pgf@y=0pt
14203 }
14204 \anchor{bout +}{
14205 \outport
14206 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
14207 }
14208 \anchor{bout -}{
14209 \outport
14210 \pgf@y=-\pgf@y
14211 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
14212 }
14213 \anchor{bout up}{
14214 \outportfixed
14215 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
14216 }
14217 \anchor{bout down}{
14218 \outportfixed
14219 \pgf@y=-\pgf@y
14220 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
14221 }
14222 % end border anchors
14223 %
14224 \anchor{west}{
14225 \left
14226 }
14227 \anchor{east}{
14228 \left
14229 \pgf@x=-\pgf@x
14230 }
14231 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14232 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14233 \anchor{north west}{ \northwest }
14234 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14235 \anchor{text}{
14236 \ifpgf@circ@center@text
14237 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14238 \else
14239 \leftedge
14240 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14241 \fi
14242 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14243 }
14244
14245 % let's start drawing the component
14246 \backgroundpath{
14247 \pgfsetcolor{\ctikzvalof{color}}
14248 %
14249 \northwest
14250 \pgf@circ@res@up = \pgf@y
14251 \pgf@circ@res@down = -\pgf@y
14252 \pgf@circ@res@right = -\pgf@x
14253 \pgf@circ@res@left = \pgf@x
14254 \pgf@circ@scaled@Rlen=\scaledRlen
14255 % main component, normally in thicker lines
14256 \pgfscope
14257 \newdimen\pgf@circ@res@right@double
14258 \pgf@circ@res@right@double=2\pgf@circ@res@right
14259
14260 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14261 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
14262 \pgf@circ@res@step=\pgf@circ@res@right
14263 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14264 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
14265 %first point (near output)
14266 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
14267 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
14268 \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}}
14269 % and then to the input "front up", "down", to the output short side "down"
14270 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14271 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14272 \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}}
14273 % ...and close
14274 \pgfpathclose
14275 \pgf@circ@draworfill
14276 \endpgfscope
14277
14278 % input terminal up
14279 \pgfpathmoveto{\pgfpoint
14280 {\pgf@circ@res@left}
14281 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
14282 %
14283 \pgfpathlineto{\pgfpoint
14284 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
14285 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
14286 %
14287 \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}
14288
14289 % input terminal down
14290 \pgfpathmoveto{\pgfpoint
14291 {\pgf@circ@res@left}
14292 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
14293 %
14294 \pgfpathlineto{\pgfpoint
14295 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
14296 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
14297 \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}
14298
14299 % output leads down and up
14300 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
14301 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
14302 \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}
14303
14304 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
14305 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
14306 \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}
14307 %
14308 \pgfsetrectcap
14309 \pgfusepath{draw}
14310 }
14311 }
14312
14313 % Transconductance amplifier (Transkonduktanzverstärker)
14314 \pgfdeclareshape{gm amp}
14315 {
14316 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14317 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14318 \anchor{center}{\pgfpointorigin}
14319 \savedanchor\northwest{%
14320 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14321 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
14322 \pgf@y=.5\pgf@y
14323 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14324 \pgf@x=.5\pgf@x
14325 }
14326 \anchor{south}{
14327 \northwest
14328 \pgf@y=-\pgf@y
14329 }
14330 \anchor{north}{
14331 \northwest
14332 }
14333 \savedanchor\left{%
14334 \pgf@y=0pt
14335 }
14336 \anchor{leftedge}
14337 {\left
14338 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
14339 }
14340 \savedanchor\inOneFixed{%
14341 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14342 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
14343 \pgf@y=.5\pgf@y
14344 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
14345 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14346 \pgf@x=.5\pgf@x
14347 }
14348 \anchor{in up}{
14349 \inOneFixed
14350 }
14351 \anchor{in down}{
14352 \inOneFixed
14353 \pgf@y=-\pgf@y
14354 }
14355 \savedanchor\inOne{%
14356 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14357 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
14358 \pgf@y=.5\pgf@y
14359 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
14360 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14361 \pgf@x=.5\pgf@x
14362 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14363 }
14364 \anchor{-}{
14365 \inOne
14366 }
14367 \anchor{+}{
14368 \inOne
14369 \pgf@y=-\pgf@y
14370 }
14371 \savedanchor\up{%
14372 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14373 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
14374 \pgf@y=.5\pgf@y
14375 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14376 \pgf@x=.5\pgf@x
14377 \pgf@circ@res@up = \pgf@y
14378 \pgf@circ@res@right = -\pgf@x
14379 \pgf@circ@res@left = \pgf@x
14380 \pgfpointlineattime{
14381 \ctikzvalof{tripoles/gm amp/up pos}}{
14382 \pgfpoint{
14383 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
14384 {\pgf@circ@res@up}}
14385 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
14386 }
14387 \anchor{up}{
14388 \up
14389 }
14390 \anchor{down}{
14391 \up
14392 \pgf@y=-\pgf@y
14393 }
14394 \anchor{out}{
14395 \northwest
14396 \pgf@y=0pt
14397 \pgf@x=-\pgf@x
14398 }
14399 % support for border anchors
14400 \savedanchor\leftedge{%
14401 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14402 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
14403 \pgf@x=.5\pgf@x
14404 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
14405 \pgf@y=0pt
14406 }
14407 \anchor{leftedge}{\leftedge}
14408 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14409 \anchor{bin up}{
14410 \inOneFixed
14411 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14412 }
14413 \anchor{bin down}{
14414 \inOneFixed
14415 \pgf@y=-\pgf@y
14416 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14417 }
14418 \anchor{b-}{
14419 \inOne
14420 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14421 }
14422 \anchor{b+}{
14423 \inOne
14424 \pgf@y=-\pgf@y
14425 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14426 }
14427 \anchor{bout}{
14428 \leftedge
14429 \pgf@y=0pt
14430 \pgf@x=-\pgf@x
14431 }
14432 % end border anchors
14433 \anchor{west}{
14434 \left
14435 }
14436 \anchor{east}{
14437 \left
14438 \pgf@x=-\pgf@x
14439 }
14440 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14441 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14442 \anchor{north west}{ \northwest }
14443 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14444
14445 \anchor{text}{
14446 \ifpgf@circ@center@text
14447 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14448 \else
14449 \leftedge
14450 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14451 \fi
14452 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14453 }
14454 \backgroundpath{
14455 \pgfsetcolor{\ctikzvalof{color}}
14456
14457 \northwest
14458 \pgf@circ@res@up = \pgf@y
14459 \pgf@circ@res@down = -\pgf@y
14460 \pgf@circ@res@right = -\pgf@x
14461 \pgf@circ@res@left = \pgf@x
14462 \pgf@circ@scaled@Rlen=\scaledRlen
14463
14464 \pgfscope
14465 \newdimen\pgf@circ@res@right@double
14466 \pgf@circ@res@right@double=2\pgf@circ@res@right
14467
14468 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14469 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
14470 \pgf@circ@res@step=\pgf@circ@res@right
14471 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14472 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
14473 %Umrandung:
14474 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
14475 \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
14476 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
14477 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
14478 \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
14479 \pgfpathclose
14480 \pgf@circ@draworfill
14481 \endpgfscope
14482
14483 \pgfpathmoveto{\pgfpoint
14484 {\pgf@circ@res@left}
14485 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
14486 \pgfpathlineto{\pgfpoint
14487 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
14488 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
14489 \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}
14490
14491
14492 \pgfpathmoveto{\pgfpoint
14493 {\pgf@circ@res@left}
14494 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
14495 \pgfpathlineto{\pgfpoint
14496 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
14497 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
14498 \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}
14499
14500 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14501 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
14502 \pgfsetrectcap
14503 \pgfusepath{draw}
14504
14505 }
14506 }
14507
14508 % Instrumentation amplifier
14509 \pgfdeclareshape{inst amp}
14510 {
14511 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14512 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14513 % when tikz calls the anchor it wants the relative position in the lengths
14514 % \pgf@x \pgf@y
14515 % \pgfpoint* functions set that variables
14516 % anchors are visible outside and run on use
14517 \anchor{center}{\pgfpointorigin}
14518 % savedanchors are internals and run on node creation (not use)
14519 % bounding-box top left
14520 \savedanchor\northwest{%
14521 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14522 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14523 \pgf@y=.5\pgf@y
14524 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14525 \pgf@x=.5\pgf@x
14526 }
14527 \anchor{nw}{
14528 \northwest
14529 }
14530 \anchor{south}{
14531 \northwest
14532 \pgf@y=-\pgf@y
14533 }
14534 \anchor{north}{
14535 \northwest
14536 }
14537 \savedanchor\left{%
14538 \pgf@y=0pt
14539 }
14540 \anchor{leftedge}
14541 {\left
14542 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
14543 }
14544 \savedanchor\inOneFixed{%
14545 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14546 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14547 \pgf@y=.5\pgf@y
14548 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
14549 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14550 \pgf@x=.5\pgf@x
14551 }
14552 \anchor{in up}{
14553 \inOneFixed
14554 }
14555 \anchor{in down}{
14556 \inOneFixed
14557 \pgf@y=-\pgf@y
14558 }
14559 \savedanchor\inOne{%
14560 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14561 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14562 \pgf@y=.5\pgf@y
14563 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
14564 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14565 \pgf@x=.5\pgf@x
14566 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14567 }
14568 \anchor{-}{
14569 \inOne
14570 }
14571 \anchor{+}{
14572 \inOne
14573 \pgf@y=-\pgf@y
14574 }
14575 \savedanchor\up{%
14576 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14577 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14578 \pgf@y=.5\pgf@y
14579 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14580 \pgf@x=.5\pgf@x
14581 \pgf@circ@res@up = \pgf@y
14582 \pgf@circ@res@right = -\pgf@x
14583 \pgf@circ@res@left = \pgf@x
14584 \pgfpointlineattime{
14585 \ctikzvalof{tripoles/inst amp/up pos}}{
14586 \pgfpoint{
14587 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14588 {\pgf@circ@res@up}}
14589 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
14590 }
14591 \anchor{up}{
14592 \up
14593 }
14594 \anchor{down}{
14595 \up
14596 \pgf@y=-\pgf@y
14597 }
14598 % reference voltage input anchors.
14599 \savedanchor\refv{%
14600 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14601 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
14602 \pgf@y=.5\pgf@y
14603 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14604 \pgf@x=.5\pgf@x
14605 \pgf@circ@res@up = \pgf@y
14606 \pgf@circ@res@right = -\pgf@x
14607 \pgf@circ@res@left = \pgf@x
14608 \pgfpointlineattime{
14609 \ctikzvalof{tripoles/inst amp/refv pos}}{
14610 \pgfpoint{
14611 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14612 {\pgf@circ@res@up}}
14613 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
14614 }
14615 % we need both because they are normally drawn under the amp, and if you
14616 % mirror it vertically you need them
14617 \anchor{refv up}{
14618 \refv
14619 }
14620 \anchor{refv down}{
14621 \refv
14622 \pgf@y=-\pgf@y
14623 }
14624 \anchor{out}{
14625 \northwest
14626 \pgf@y=0pt
14627 \pgf@x=-\pgf@x
14628 }
14629 % support for border anchors
14630 \savedanchor\leftedge{%
14631 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14632 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
14633 \pgf@x=.5\pgf@x
14634 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
14635 \pgf@y=0pt
14636 }
14637 \anchor{leftedge}{\leftedge}
14638 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14639 \anchor{bin up}{
14640 \inOneFixed
14641 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14642 }
14643 \anchor{bin down}{
14644 \inOneFixed
14645 \pgf@y=-\pgf@y
14646 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14647 }
14648 \anchor{b-}{
14649 \inOne
14650 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14651 }
14652 \anchor{b+}{
14653 \inOne
14654 \pgf@y=-\pgf@y
14655 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14656 }
14657 \anchor{bout}{
14658 \leftedge
14659 \pgf@y=0pt
14660 \pgf@x=-\pgf@x
14661 }
14662 % end border anchors
14663 \anchor{west}{
14664 \left
14665 }
14666 \anchor{east}{
14667 \left
14668 \pgf@x=-\pgf@x
14669 }
14670 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14671 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14672 \anchor{north west}{ \northwest }
14673 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14674
14675 \anchor{text}{
14676 \ifpgf@circ@center@text
14677 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14678 \else
14679 \leftedge
14680 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14681 \fi
14682 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14683 }
14684
14685 % let's start drawing the component
14686 \backgroundpath{
14687 \pgfsetcolor{\ctikzvalof{color}}
14688 %
14689 \northwest
14690 \pgf@circ@res@up = \pgf@y
14691 \pgf@circ@res@down = -\pgf@y
14692 \pgf@circ@res@right = -\pgf@x
14693 \pgf@circ@res@left = \pgf@x
14694 \pgf@circ@scaled@Rlen=\scaledRlen
14695
14696 % main component, normally in thicker lines
14697 \pgfscope
14698 \newdimen\pgf@circ@res@right@double
14699 \pgf@circ@res@right@double=2\pgf@circ@res@right
14700
14701 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14702 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14703 \pgf@circ@res@step=\pgf@circ@res@right
14704 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14705 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
14706 %first point (near output)
14707 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
14708 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
14709 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
14710 % and then to the input "front up", "down", to the output short side "down"
14711 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14712 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
14713 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
14714 % ...and close
14715 \pgfpathclose
14716 \pgf@circ@draworfill
14717 \endpgfscope
14718
14719 % Negative input terminal
14720 \pgfpathmoveto{\pgfpoint
14721 {\pgf@circ@res@left}
14722 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
14723 %
14724 \pgfpathlineto{\pgfpoint
14725 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14726 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
14727 %
14728 \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}
14729
14730 % Positive input terminal
14731 \pgfpathmoveto{\pgfpoint
14732 {\pgf@circ@res@left}
14733 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
14734 %
14735 \pgfpathlineto{\pgfpoint
14736 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
14737 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
14738 \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}
14739
14740 % Output terminal
14741 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14742 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
14743 %
14744 \pgfsetrectcap
14745 \pgfusepath{draw}
14746 }
14747 }
14748
14749 % Instrumentation amplifier with terminals for gain resistance between inputs
14750 \pgfdeclareshape{inst amp ra}
14751 {
14752 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
14753 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14754 \anchor{center}{\pgfpointorigin}
14755 % bounding-box top left
14756 \savedanchor\northwest{%
14757 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14758 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14759 \pgf@y=.5\pgf@y
14760 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14761 \pgf@x=.5\pgf@x
14762 }
14763 \anchor{nw}{
14764 \northwest
14765 }
14766 \anchor{south}{
14767 \northwest
14768 \pgf@y=-\pgf@y\pgf@x=0pt\relax
14769 }
14770 \anchor{north}{
14771 \northwest\pgf@x=0pt\relax
14772 }
14773 \savedanchor\left{%
14774 \pgf@y=0pt
14775 }
14776 \anchor{leftedge}
14777 {\left
14778 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
14779 }
14780 % inputs (+-)
14781 \savedanchor\inOneFixed{%
14782 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14783 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14784 \pgf@y=.5\pgf@y
14785 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
14786 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14787 \pgf@x=.5\pgf@x
14788 }
14789 \anchor{in up}{
14790 \inOneFixed
14791 }
14792 \anchor{in down}{
14793 \inOneFixed
14794 \pgf@y=-\pgf@y
14795 }
14796 \savedanchor\inOne{%
14797 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14798 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14799 \pgf@y=.5\pgf@y
14800 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
14801 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14802 \pgf@x=.5\pgf@x
14803 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14804 }
14805 \anchor{-}{
14806 \inOne
14807 }
14808 \anchor{+}{
14809 \inOne
14810 \pgf@y=-\pgf@y
14811 }
14812 % R ampli anchors. They are by default at 20% more than R-length distance
14813 % you can change that with the `ra pos` key (use 0.5 for one-R).
14814 \savedanchor\raOneFixed{%
14815 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14816 \pgf@y=\pgf@circ@scaled@Rlen
14817 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
14818 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14819 \pgf@x=.5\pgf@x
14820 }
14821 \anchor{ra up}{
14822 \raOneFixed
14823 }
14824 \anchor{ra down}{
14825 \raOneFixed
14826 \pgf@y=-\pgf@y
14827 }
14828 \savedanchor\raOne{%
14829 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14830 \pgf@y=\pgf@circ@scaled@Rlen
14831 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
14832 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14833 \pgf@x=.5\pgf@x
14834 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
14835 }
14836 \anchor{ra-}{
14837 \raOne
14838 }
14839 \anchor{ra+}{
14840 \raOne
14841 \pgf@y=-\pgf@y
14842 }
14843 % power supplies
14844 \savedanchor\up{%
14845 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14846 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14847 \pgf@y=.5\pgf@y
14848 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14849 \pgf@x=.5\pgf@x
14850 \pgf@circ@res@up = \pgf@y
14851 \pgf@circ@res@right = -\pgf@x
14852 \pgf@circ@res@left = \pgf@x
14853 \pgfpointlineattime{
14854 \ctikzvalof{tripoles/inst amp ra/up pos}}{
14855 \pgfpoint{
14856 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14857 {\pgf@circ@res@up}}
14858 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
14859 }
14860 \anchor{up}{
14861 \up
14862 }
14863 \anchor{down}{
14864 \up
14865 \pgf@y=-\pgf@y
14866 }
14867 % reference voltage input anchors.
14868 \savedanchor\refv{%
14869 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14870 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
14871 \pgf@y=0.5\pgf@y
14872 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14873 \pgf@x=0.5\pgf@x
14874 \pgf@circ@res@up = \pgf@y
14875 \pgf@circ@res@right = -\pgf@x
14876 \pgf@circ@res@left = \pgf@x
14877 \pgfpointlineattime{
14878 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
14879 \pgfpoint{
14880 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14881 {\pgf@circ@res@up}}
14882 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
14883 }
14884 % we need both because they are normally drawn under the amp, and if you
14885 % mirror it vertically you need them
14886 \anchor{refv up}{
14887 \refv
14888 }
14889 \anchor{refv down}{
14890 \refv
14891 \pgf@y=-\pgf@y
14892 }
14893 \anchor{out}{
14894 \northwest
14895 \pgf@y=0pt
14896 \pgf@x=-\pgf@x
14897 }
14898 % support for border anchors
14899 \savedanchor\leftedge{%
14900 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
14901 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
14902 \pgf@x=.5\pgf@x
14903 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
14904 \pgf@y=0pt
14905 }
14906 \anchor{leftedge}{\leftedge}
14907 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
14908 \anchor{bin up}{
14909 \inOneFixed
14910 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14911 }
14912 \anchor{bin down}{
14913 \inOneFixed
14914 \pgf@y=-\pgf@y
14915 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14916 }
14917 \anchor{b-}{
14918 \inOne
14919 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14920 }
14921 \anchor{b+}{
14922 \inOne
14923 \pgf@y=-\pgf@y
14924 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14925 }
14926 \anchor{bra up}{
14927 \raOneFixed
14928 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14929 }
14930 \anchor{bra down}{
14931 \raOneFixed
14932 \pgf@y=-\pgf@y
14933 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14934 }
14935 \anchor{bra-}{
14936 \raOne
14937 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14938 }
14939 \anchor{bra+}{
14940 \raOne
14941 \pgf@y=-\pgf@y
14942 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
14943 }
14944 \anchor{bout}{
14945 \leftedge
14946 \pgf@y=0pt
14947 \pgf@x=-\pgf@x
14948 }
14949 % end border anchors
14950 \anchor{west}{
14951 \left
14952 }
14953 \anchor{east}{
14954 \left
14955 \pgf@x=-\pgf@x
14956 }
14957 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
14958 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
14959 \anchor{north west}{ \northwest }
14960 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
14961
14962 \anchor{text}{
14963 \ifpgf@circ@center@text
14964 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
14965 \else
14966 \leftedge
14967 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
14968 \fi
14969 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
14970 }
14971
14972 % drawing of the component
14973 \backgroundpath{
14974 \pgfsetcolor{\ctikzvalof{color}}
14975
14976 \northwest
14977 \pgf@circ@res@up = \pgf@y
14978 \pgf@circ@res@down = -\pgf@y
14979 \pgf@circ@res@right = -\pgf@x
14980 \pgf@circ@res@left = \pgf@x
14981 \pgf@circ@scaled@Rlen=\scaledRlen
14982
14983 \newdimen\pgf@circ@res@right@double
14984 \pgf@circ@res@right@double=2\pgf@circ@res@right
14985
14986 % main component, normally in thicker lines
14987 \pgfscope
14988 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14989 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
14990 \pgf@circ@res@step=\pgf@circ@res@right
14991 \advance\pgf@circ@res@step by -\pgf@circ@res@left
14992 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
14993 %primer punto: la linea de salida (lado componente)
14994 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
14995 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
14996 \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}}
14997 % and then to the input "front up", "down", to the output short side "down"
14998 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
14999 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15000 \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}}
15001 % ...and close
15002 \pgfpathclose
15003 \pgf@circ@draworfill
15004 \endpgfscope
15005
15006 % ra terminal -
15007 \pgfpathmoveto{\pgfpoint
15008 {\pgf@circ@res@left}
15009 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
15010 %
15011 \pgfpathlineto{\pgfpoint
15012 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15013 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
15014 % ra terminal +
15015 \pgfpathmoveto{\pgfpoint
15016 {\pgf@circ@res@left}
15017 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
15018 %
15019 \pgfpathlineto{\pgfpoint
15020 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15021 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@Rlen}}
15022
15023 % Negative input terminal
15024 \pgfpathmoveto{\pgfpoint
15025 {\pgf@circ@res@left}
15026 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
15027 %
15028 \pgfpathlineto{\pgfpoint
15029 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15030 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
15031 %
15032 \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}
15033
15034 % Positive input terminal
15035 \pgfpathmoveto{\pgfpoint
15036 {\pgf@circ@res@left}
15037 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
15038 %
15039 \pgfpathlineto{\pgfpoint
15040 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
15041 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
15042 \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}
15043
15044 % Output terminal
15045 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15046 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
15047 %
15048 \pgfsetrectcap
15049 \pgfusepath{draw}
15050 }
15051 }
15052
15053 % Buffer
15054 % Contributed by Danilo Piazzalunga
15055 \pgfdeclareshape{buffer}
15056 {
15057 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15058 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15059 \anchor{center}{\pgfpointorigin}
15060 \savedanchor\northwest{%
15061 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15062 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
15063 \pgf@y=.5\pgf@y
15064 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
15065 \pgf@x=.5\pgf@x
15066 }
15067 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
15068 \anchor{west}{ \northwest \pgf@y=0pt }
15069 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
15070 \anchor{north}{ \northwest \pgf@x=0pt }
15071 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15072 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15073 \anchor{north west}{ \northwest }
15074 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15075 \savedanchor\left{%
15076 \pgf@y=0pt
15077 }
15078 \anchor{in}{
15079 \northwest
15080 \pgf@y=0pt
15081 }
15082 \anchor{out}{
15083 \northwest
15084 \pgf@y=0pt
15085 \pgf@x=-\pgf@x
15086 }
15087 \anchor{bin}{
15088 \northwest
15089 \pgf@y=0pt
15090 \pgf@x=0.7\pgf@x
15091 }
15092 \anchor{bout}{
15093 \northwest
15094 \pgf@y=0pt
15095 \pgf@x=-0.7\pgf@x
15096 }
15097
15098 \anchor{text}{
15099 \ifpgf@circ@center@text
15100 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15101 \else
15102 \northwest
15103 \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
15104 \fi
15105 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15106 }
15107
15108 \backgroundpath{
15109 \pgfsetcolor{\ctikzvalof{color}}
15110
15111 \northwest
15112 \pgf@circ@res@up = \pgf@y
15113 \pgf@circ@res@down = -\pgf@y
15114 \pgf@circ@res@right = -\pgf@x
15115 \pgf@circ@res@left = \pgf@x
15116 \pgf@circ@scaled@Rlen=\scaledRlen
15117 \pgfscope
15118 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15119 \pgftransformxshift{.7\pgf@circ@res@left}
15120 \pgf@circ@res@step=\pgf@circ@res@right
15121 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15122 \pgf@circ@res@step=.7\pgf@circ@res@step
15123
15124 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15125 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15126 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15127 \pgfpathclose
15128 \pgf@circ@draworfill
15129 \endpgfscope
15130
15131 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
15132 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
15133
15134 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15135 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
15136
15137 \pgfusepath{draw}
15138 }
15139 }
15140
15141 % plain amplifier, no symbols
15142 \pgfdeclareshape{plain amp}
15143 {
15144 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15145 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15146 \anchor{center}{\pgfpointorigin}
15147 \savedanchor\northwest{%
15148 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15149 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15150 \pgf@y=.5\pgf@y
15151 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15152 \pgf@x=.5\pgf@x
15153 }
15154 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
15155 \anchor{west}{ \northwest \pgf@y=0pt }
15156 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
15157 \anchor{north}{ \northwest \pgf@x=0pt }
15158 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15159 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15160 \anchor{north west}{ \northwest }
15161 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15162 \savedanchor\left{%
15163 \pgf@y=0pt
15164 }
15165 \savedanchor\inOne{%
15166 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15167 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15168 \pgf@y=.5\pgf@y
15169 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
15170 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15171 \pgf@x=.5\pgf@x
15172 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
15173 }
15174 \savedanchor\inOneFixed{%
15175 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15176 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15177 \pgf@y=.5\pgf@y
15178 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
15179 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15180 \pgf@x=.5\pgf@x
15181 }
15182 \anchor{-}{
15183 \inOne
15184 }
15185 \anchor{+}{
15186 \inOne
15187 \pgf@y=-\pgf@y
15188 }
15189 \anchor{in up}{
15190 \inOneFixed
15191 }
15192 \anchor{in down}{
15193 \inOneFixed
15194 \pgf@y=-\pgf@y
15195 }
15196 % support for border anchors
15197 \savedanchor\leftedge{%
15198 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15199 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15200 \pgf@x=.5\pgf@x
15201 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
15202 \pgf@y=0pt
15203 }
15204 \anchor{leftedge}{\leftedge}
15205 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15206 \anchor{bin up}{
15207 \inOneFixed
15208 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15209 }
15210 \anchor{bin down}{
15211 \inOneFixed
15212 \pgf@y=-\pgf@y
15213 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15214 }
15215 \anchor{b-}{
15216 \inOne
15217 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15218 }
15219 \anchor{b+}{
15220 \inOne
15221 \pgf@y=-\pgf@y
15222 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15223 }
15224 \anchor{bout}{
15225 \leftedge
15226 \pgf@y=0pt
15227 \pgf@x=-\pgf@x
15228 }
15229 % end border anchors
15230 \savedanchor\up{%
15231 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15232 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15233 \pgf@y=.5\pgf@y
15234 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15235 \pgf@x=.5\pgf@x
15236 \pgf@circ@res@up = \pgf@y
15237 \pgf@circ@res@right = -\pgf@x
15238 \pgf@circ@res@left = \pgf@x
15239 \pgfpointlineattime{
15240 \ctikzvalof{tripoles/plain amp/up pos}}{
15241 \pgfpoint{
15242 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15243 {\pgf@circ@res@up}}
15244 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
15245 }
15246 \anchor{up}{
15247 \up
15248 }
15249 \anchor{down}{
15250 \up
15251 \pgf@y=-\pgf@y
15252 }
15253 \anchor{out}{
15254 \northwest
15255 \pgf@y=0pt
15256 \pgf@x=-\pgf@x
15257 }
15258
15259 \anchor{text}{
15260 \ifpgf@circ@center@text
15261 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15262 \else
15263 \leftedge
15264 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15265 \fi
15266 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15267 }
15268
15269 \backgroundpath{
15270 \pgfsetcolor{\ctikzvalof{color}}
15271
15272 \northwest
15273 \pgf@circ@res@up = \pgf@y
15274 \pgf@circ@res@down = -\pgf@y
15275 \pgf@circ@res@right = -\pgf@x
15276 \pgf@circ@res@left = \pgf@x
15277
15278 \pgfscope
15279 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15280 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15281 \pgf@circ@res@step=\pgf@circ@res@right
15282 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15283 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
15284
15285 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15286 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15287 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15288 \pgfpathclose
15289 \pgf@circ@draworfill
15290 \endpgfscope
15291 \pgfpathmoveto{\pgfpoint
15292 {\pgf@circ@res@left}
15293 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
15294 \pgfpathlineto{\pgfpoint
15295 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15296 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
15297
15298
15299 \pgfpathmoveto{\pgfpoint
15300 {\pgf@circ@res@left}
15301 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
15302 \pgfpathlineto{\pgfpoint
15303 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15304 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
15305
15306 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15307 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
15308
15309 \pgfusepath{draw}
15310 }
15311 }
15312
15313 % plain amplifier, no symbols, one input
15314 \pgfdeclareshape{plain mono amp}
15315 {
15316 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
15317 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15318 \anchor{center}{\pgfpointorigin}
15319 \savedanchor\northwest{%
15320 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15321 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15322 \pgf@y=.5\pgf@y
15323 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15324 \pgf@x=.5\pgf@x
15325 }
15326 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
15327 \anchor{west}{ \northwest \pgf@y=0pt }
15328 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
15329 \anchor{north}{ \northwest \pgf@x=0pt }
15330 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15331 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15332 \anchor{north west}{ \northwest }
15333 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15334 \savedanchor\left{%
15335 \pgf@y=0pt
15336 }
15337 \savedanchor\inOne{%
15338 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15339 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15340 \pgf@x=.5\pgf@x
15341 \pgf@y=0pt\relax
15342 }
15343 \anchor{in}{
15344 \inOne
15345 }
15346 % support for border anchors
15347 \savedanchor\leftedge{%
15348 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15349 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15350 \pgf@x=.5\pgf@x
15351 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
15352 \pgf@y=0pt
15353 }
15354 \anchor{leftedge}{\leftedge}
15355 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
15356 \anchor{bin}{
15357 \inOne
15358 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
15359 }
15360 \anchor{bout}{
15361 \leftedge
15362 \pgf@y=0pt
15363 \pgf@x=-\pgf@x
15364 }
15365 % end border anchors
15366 \savedanchor\up{%
15367 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15368 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
15369 \pgf@y=.5\pgf@y
15370 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
15371 \pgf@x=.5\pgf@x
15372 \pgf@circ@res@up = \pgf@y
15373 \pgf@circ@res@right = -\pgf@x
15374 \pgf@circ@res@left = \pgf@x
15375 \pgfpointlineattime{
15376 \ctikzvalof{tripoles/plain amp/up pos}}{
15377 \pgfpoint{
15378 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15379 {\pgf@circ@res@up}}
15380 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
15381 }
15382 \anchor{up}{
15383 \up
15384 }
15385 \anchor{down}{
15386 \up
15387 \pgf@y=-\pgf@y
15388 }
15389 \anchor{out}{
15390 \northwest
15391 \pgf@y=0pt
15392 \pgf@x=-\pgf@x
15393 }
15394
15395 \anchor{text}{
15396 \ifpgf@circ@center@text
15397 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
15398 \else
15399 \leftedge
15400 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
15401 \fi
15402 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
15403 }
15404 \backgroundpath{
15405 \pgfsetcolor{\ctikzvalof{color}}
15406
15407 \northwest
15408 \pgf@circ@res@up = \pgf@y
15409 \pgf@circ@res@down = -\pgf@y
15410 \pgf@circ@res@right = -\pgf@x
15411 \pgf@circ@res@left = \pgf@x
15412
15413 \pgfscope
15414 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15415 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15416 \pgf@circ@res@step=\pgf@circ@res@right
15417 \advance\pgf@circ@res@step by -\pgf@circ@res@left
15418 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
15419
15420 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
15421 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15422 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
15423 \pgfpathclose
15424 \pgf@circ@draworfill
15425 \endpgfscope
15426 \pgfpathmoveto{\pgfpoint
15427 {\pgf@circ@res@left}
15428 {0pt}}
15429 \pgfpathlineto{\pgfpoint
15430 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
15431 {0pt}}
15432
15433 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15434 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
15435
15436 \pgfusepath{draw}
15437 }
15438 }
15439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15440 %% electromechanical device (motor/generator)
15441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15442
15443 \pgfdeclareshape{elmech}
15444 {
15445 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
15446 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15447 \savedanchor\northwest{
15448 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15449 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
15450 \pgf@y=.5\pgf@y
15451 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
15452 \pgf@x=.5\pgf@x
15453 }
15454 \anchor{center}{
15455 \pgfpointorigin
15456 }
15457 \anchor{text}{
15458 \pgfpointorigin
15459 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
15460 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
15461 }
15462 \anchor{left}{%
15463 \northwest
15464 \pgf@y=0pt
15465 }
15466 \anchor{right}{%
15467 \northwest
15468 \pgf@y=0pt
15469 \pgf@x=-\pgf@x
15470 }
15471 \anchor{top}{
15472 \northwest
15473 \pgf@x=0pt
15474 }
15475 \anchor{pathstart}{
15476 \northwest
15477 \pgf@x=0pt
15478 }
15479 \anchor{pathend}{
15480 \northwest
15481 \pgf@x=0pt
15482 \pgf@y=-\pgf@y
15483 }
15484 \anchor{bottom}{
15485 \northwest
15486 \pgf@x=0pt
15487 \pgf@y=-\pgf@y
15488 }
15489 \anchor{center}{
15490 \pgf@y=0pt
15491 \pgf@x=0pt
15492 }
15493 \anchor{east}{
15494 \northwest
15495 \pgf@y=0pt
15496 \pgf@x=-\pgf@x
15497 }
15498 \anchor{west}{
15499 \northwest
15500 \pgf@y=0pt
15501 }
15502 \anchor{south}{
15503 \northwest
15504 \pgf@x=0pt
15505 \pgf@y=-\pgf@y
15506 }
15507 \anchor{north}{
15508 \northwest
15509 \pgf@x=0pt
15510 }
15511 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15512 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15513 \anchor{north west}{ \northwest }
15514 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15515 \anchorborder{%
15516 \@tempdima=\pgf@x\@tempdimb=\pgf@y
15517 \northwest\pgf@circ@res@other=-\pgf@x
15518 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
15519 }
15520 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
15521 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
15522 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
15523 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
15524 \anchor{block up right}{
15525 \northwest
15526 % remember that pgf@x is negative
15527 % center of the block is at 0.5*H+W*cos(30)/2
15528 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
15529 \pgf@x=-0.5\pgf@x
15530 }
15531 \anchor{block up left}{
15532 \northwest
15533 % remember that pgf@x is negative
15534 % center of the block is at 0.5*H+W*cos(30)/2
15535 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
15536 \pgf@x=0.5\pgf@x
15537 }
15538 \anchor{block down right}{
15539 \northwest
15540 % remember that pgf@x is negative
15541 % center of the block is at 0.5*H+W*cos(30)/2
15542 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
15543 \pgf@y=-\pgf@y
15544 \pgf@x=-0.5\pgf@x
15545 }
15546 \anchor{block down left}{
15547 \northwest
15548 % remember that pgf@x is negative
15549 % center of the block is at 0.5*H+W*cos(30)/2
15550 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
15551 \pgf@y=-\pgf@y
15552 \pgf@x=0.5\pgf@x
15553 }
15554 \behindbackgroundpath{
15555 \pgfsetcolor{\ctikzvalof{color}}
15556 \pgf@circ@scaled@Rlen=\scaledRlen
15557 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
15558 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
15559 \pgfscope
15560 \pgfstartlinewidth=\pgflinewidth
15561 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15562 \pgfscope % clip the bar: whole size minus the circle
15563 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
15564 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
15565 \pgfseteorule
15566 \pgfusepath{clip}
15567 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
15568 \pgfsetfillcolor{\ctikzvalof{color}}
15569 \pgfusepath{fill, draw}
15570 \endpgfscope
15571 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
15572 \ifx\tikz@fillcolor\pgfutil@empty
15573 % set the default fill color to white
15574 \pgfsetfillcolor{white}
15575 % ...but override it if the class is defined!
15576 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
15577 \else
15578 \pgfsetfillcolor{\tikz@fillcolor}
15579 \pgfusepath{draw, fill}
15580 \fi
15581 \endpgfscope
15582 }
15583 }
15584
15585 %%%%%%%%%%%%%%%%%%%
15586 %% Magnetron
15587 %%%%%%%%%%%%%%%%%%%
15588
15589 \pgfdeclareshape{magnetron}
15590 {
15591 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
15592 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15593 \savedanchor\northwest{
15594 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15595 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
15596 \pgf@y=.5\pgf@y
15597 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
15598 \pgf@x=.5\pgf@x
15599 }
15600 \anchor{center}{
15601 \pgfpointorigin
15602 }
15603 \anchor{anode}{
15604 \northwest
15605 \pgf@x=0pt
15606 \pgf@y=-\pgf@y
15607 }
15608 \anchor{cathode1}{
15609 \northwest
15610 \pgf@circ@res@step=\pgf@y
15611 \pgfmathparse{cos(105)}
15612 \pgf@x=\pgfmathresult\pgf@circ@res@step
15613 \pgfmathparse{sin(105)}
15614 \pgf@y=\pgfmathresult\pgf@circ@res@step
15615 %\pgfpointorigin
15616 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
15617 }
15618 \anchor{cathode2}{
15619 \northwest
15620 \pgf@circ@res@step=\pgf@y
15621 \pgfmathparse{cos(75)}
15622 \pgf@x=\pgfmathresult\pgf@circ@res@step
15623 \pgfmathparse{sin(75)}
15624 \pgf@y=\pgfmathresult\pgf@circ@res@step
15625 %\pgfpointorigin
15626 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
15627 }
15628 \anchor{text}{
15629 \pgfpointorigin
15630 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
15631 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
15632 }
15633 \anchor{left}{%
15634 \northwest
15635 \pgf@y=0pt
15636 }
15637 \anchor{right}{%
15638 \northwest
15639 \pgf@y=0pt
15640 \pgf@x=-\pgf@x
15641 }
15642 \anchor{top}{
15643 \northwest
15644 \pgf@x=0pt
15645 }
15646 \anchor{pathstart}{
15647 \northwest
15648 \pgf@x=0pt
15649 }
15650 \anchor{pathend}{
15651 \northwest
15652 \pgf@x=0pt
15653 \pgf@y=-\pgf@y
15654 }
15655 \anchor{bottom}{
15656 \northwest
15657 \pgf@x=0pt
15658 \pgf@y=-\pgf@y
15659 }
15660 \anchor{center}{
15661 \pgf@y=0pt
15662 \pgf@x=0pt
15663 }
15664 \anchor{east}{
15665 \northwest
15666 \pgf@y=0pt
15667 \pgf@x=-\pgf@x
15668 }
15669 \anchor{west}{
15670 \northwest
15671 \pgf@y=0pt
15672 }
15673 \anchor{south}{
15674 \northwest
15675 \pgf@x=0pt
15676 \pgf@y=-\pgf@y
15677 }
15678 \anchor{north}{
15679 \northwest
15680 \pgf@x=0pt
15681 }
15682 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
15683 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
15684 \anchor{north west}{ \northwest }
15685 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
15686 \backgroundpath{
15687 \pgfsetcolor{\ctikzvalof{color}}
15688 \pgf@circ@scaled@Rlen=\scaledRlen
15689 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
15690 \northwest
15691 \pgf@circ@res@up = \pgf@y
15692 \pgf@circ@res@down = -\pgf@y
15693 \pgf@circ@res@right = -\pgf@x
15694 \pgf@circ@res@left = \pgf@x
15695 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
15696
15697 \pgfscope
15698 \pgfstartlinewidth=\pgflinewidth
15699 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
15700 %create outer circle
15701 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
15702 \pgf@circ@draworfill
15703 %create chambers
15704 \foreach \angle in {45,135,225,315}{
15705 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
15706 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
15707 }
15708 \pgfsetroundcap
15709 \pgfusepath{draw}
15710 \pgfscope
15711 %draw connection from outside
15712 %anode
15713 \pgfsetlinewidth{\pgfstartlinewidth}
15714 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
15715 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
15716 %cathodes
15717 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
15718 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
15719 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
15720 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
15721 \pgfsetbuttcap
15722 \pgfusepath{draw}
15723 \endpgfscope
15724 %create cathode
15725 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
15726 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
15727 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
15728 \pgfusepath{draw}
15729 %create anode
15730 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
15731 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
15732
15733 \pgfsetbuttcap
15734 \pgfusepath{draw}
15735 \endpgfscope
15736 }
15737 }
15738
15739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15740 % Electronic tubes, submitted by J. op den Brouw
15741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15742
15743 % Draw tube outline
15744 \def\pgf@circ@tubes@drawtube{%
15745 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
15746 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
15747 \pgfutil@tempdima=\pgf@circ@res@right
15748 \advance\pgfutil@tempdima by -\pgf@circ@res@up
15749 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
15750 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
15751 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
15752 \pgfpatharc{270}{90}{\pgf@circ@res@up}
15753 \else
15754 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
15755 \pgfutil@tempdima=\pgf@circ@res@up
15756 \advance\pgfutil@tempdima by -\pgf@circ@res@right
15757 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
15758 \pgfpatharc{180}{0}{\pgf@circ@res@right}
15759 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
15760 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
15761 \fi
15762 \pgfpathclose
15763 }
15764
15765 %% The diode (tube), triode, tetrode and pentode only differ in the
15766 %% number of grids. So we construct a generic declare function in
15767 %% which we can put code for the grid anchors and grid drawing code
15768 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
15769 \long\def\pgfcircdeclaretube#1#2#3{%
15770 \pgfdeclareshape{#1}{
15771 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
15772 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15773 \anchor{center}{
15774 \pgfpointorigin
15775 }
15776 \savedanchor\northwest{%
15777 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15778 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
15779 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
15780 % x and y should be half the Rlen
15781 \pgf@y=\pgf@circ@res@up
15782 \pgf@y=.5\pgf@y
15783 \pgf@x=-\pgf@circ@res@right
15784 \pgf@x=.5\pgf@x
15785 }
15786 \anchor{north} {%
15787 \northwest
15788 \pgf@x=0pt
15789 }
15790 \anchor{east}{%
15791 \northwest
15792 \pgf@x=-\pgf@x
15793 \pgf@y=0pt
15794 }
15795 \anchor{south}{%
15796 \northwest
15797 \pgf@y=-\pgf@y
15798 \pgf@x=0pt
15799 }
15800 \anchor{west}{%
15801 \northwest
15802 \pgf@y=0pt
15803 }
15804 \anchor{north west}{%
15805 \northwest
15806 }
15807 \anchor{north east}{%
15808 \northwest
15809 \pgf@x=-\pgf@x
15810 }
15811 \anchor{south east}{
15812 \northwest
15813 \pgf@x=-\pgf@x
15814 \pgf@y=-\pgf@y
15815 }
15816 \anchor{south west}{
15817 \northwest
15818 \pgf@y=-\pgf@y
15819 }
15820 \anchor{anode} {%
15821 \northwest
15822 \pgf@x=0pt
15823 }
15824 \anchor{cathode}{%
15825 \northwest
15826 \pgf@y=-\pgf@y
15827 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
15828 }
15829 \anchor{cathode 1}{%
15830 \northwest
15831 \pgf@y=-\pgf@y
15832 \pgf@x=\ctikzvalof{tubes/cathode width}\pgf@x
15833 }
15834 \anchor{cathode 2}{%
15835 \northwest
15836 \pgf@y=-\pgf@y
15837 \pgf@x=-\ctikzvalof{tubes/cathode width}\pgf@x
15838 }
15839 \anchor{filament 1}{%
15840 \northwest
15841 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
15842 \pgf@x=\pgfmathresult\pgf@x
15843 \pgf@y=-\pgf@y
15844 }
15845 \anchor{filament 2}{%
15846 \northwest
15847 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
15848 \pgf@x=-\pgfmathresult\pgf@x
15849 \pgf@y=-\pgf@y
15850 }
15851
15852 % Extra anchors
15853 #2
15854
15855 \backgroundpath{
15856 \pgfscope
15857 % Line width for tripoles
15858 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15859 \pgf@circ@scaled@Rlen=\scaledRlen
15860
15861 % Setup to draw tube
15862 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
15863 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
15864 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
15865 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
15866
15867 % Tube outline
15868 \pgf@circ@tubes@drawtube
15869
15870 % Setup to draw grid, filament, anode and cathode
15871 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
15872 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
15873 \pgf@circ@res@up=0.5\pgf@circ@res@up
15874 \pgf@circ@res@right=0.5\pgf@circ@res@right
15875
15876 % Tube fill color (if any)
15877 \pgf@circ@draworfill
15878
15879 % Grid drawing
15880 #3
15881
15882 % Filament (is not drawn by default)
15883 \ifpgf@circuit@tubes@filament
15884 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
15885 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
15886 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
15887 \pgf@xa=\pgfmathresult\pgf@circ@res@right
15888 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
15889 \pgf@ya=\pgfmathresult\pgf@circ@res@up
15890 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
15891 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
15892 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
15893 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
15894 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
15895 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
15896 \pgf@circuit@tubes@filamentfalse
15897 \fi
15898
15899 % Anode (or plate)
15900 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
15901 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
15902 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
15903 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
15904
15905 % Cathode
15906 \ifpgf@circuit@tubes@nocathode
15907 \pgf@circuit@tubes@nocathodefalse
15908 \else
15909 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
15910 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
15911 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
15912 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
15913 \ifpgf@circuit@tubes@fullcathode
15914 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
15915 \pgf@circuit@tubes@fullcathodefalse
15916 \else
15917 \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}}
15918 \fi
15919 \fi
15920
15921 % Draw the background
15922 \pgfusepath{draw}
15923 \endpgfscope
15924 }
15925 }
15926 }
15927
15928 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
15929
15930 \pgfcircdeclaretube{triode}
15931 {
15932 \anchor{grid} {% should not be used
15933 \northwest
15934 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
15935 }
15936 \anchor{control} {%
15937 \northwest
15938 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
15939 }
15940 }
15941 {
15942 % Grid protrusion
15943 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
15944 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
15945 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
15946 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
15947 % Grid dashes: calculations
15948 \pgf@xb=2\pgf@circ@res@right
15949 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
15950 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
15951 \multiply\pgf@circ@count@a by 2\relax
15952 \advance\pgf@circ@count@a by 1\relax
15953 \advance\pgf@circ@res@step by -\pgf@xa
15954 \divide\pgf@circ@res@step by \pgf@circ@count@a
15955 % Grid dashes: draw
15956 \pgf@circ@res@temp=\pgf@xa
15957 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
15958 \loop
15959 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15960 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
15961 \advance\pgf@circ@res@temp by\pgf@circ@res@step
15962 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
15963 \advance\pgf@circ@count@a by-1
15964 \ifnum\pgf@circ@count@a>0\relax
15965 \repeat
15966 }
15967
15968 \pgfcircdeclaretube{tetrode}
15969 {
15970 \anchor{grid} {% should not be used
15971 \northwest
15972 \pgfutil@tempdima=\pgf@y
15973 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
15974 \pgf@y=0.5\pgf@y
15975 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15976 }
15977 \anchor{control} {%
15978 \northwest
15979 \pgfutil@tempdima=\pgf@y
15980 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
15981 \pgf@y=0.5\pgf@y
15982 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15983 }
15984 \anchor{screen} {%
15985 \northwest
15986 \pgfutil@tempdima=\pgf@y
15987 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
15988 \pgf@y=0.5\pgf@y
15989 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
15990 }
15991 }
15992 {
15993 % Grid x/y points
15994 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
15995 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
15996 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
15997 \pgfutil@tempdimb=-\pgfutil@tempdima
15998 \pgfutil@tempdima=0.5\pgfutil@tempdima
15999 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16000 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
16001 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16002 % Grid protrusion
16003 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
16004 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
16005 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
16006 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
16007 % Grid dashes: calculations
16008 \pgf@xb=2\pgf@circ@res@right
16009 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
16010 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
16011 \multiply\pgf@circ@count@a by 2\relax
16012 \advance\pgf@circ@count@a by 1\relax
16013 \advance\pgf@circ@res@step by -\pgf@xa
16014 \divide\pgf@circ@res@step by \pgf@circ@count@a
16015 % Grid dashes: draw
16016 \pgf@circ@res@temp=\pgf@xa
16017 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
16018 \loop
16019 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16020 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
16021 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
16022 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
16023 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
16024 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16025 \advance\pgf@circ@count@a by-1
16026 \ifnum\pgf@circ@count@a>0\relax
16027 \repeat
16028 }
16029
16030 \pgfcircdeclaretube{pentode}
16031 {
16032 \anchor{grid} {% should not be used
16033 \northwest
16034 \pgfutil@tempdima=\pgf@y
16035 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16036 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16037 }
16038 \anchor{control} {%
16039 \northwest
16040 \pgfutil@tempdima=\pgf@y
16041 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16042 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16043 }
16044 \anchor{screen} {%
16045 \northwest
16046 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
16047 }
16048 \anchor{suppressor} {%
16049 \northwest
16050 \pgfutil@tempdima=\pgf@y
16051 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
16052 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16053 }
16054 }
16055 {
16056 % Grid x/y points
16057 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
16058 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
16059 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
16060 \pgfutil@tempdimb=-\pgfutil@tempdima
16061 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16062 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16063 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16064 % Grid protrusion
16065 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
16066 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
16067 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
16068 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
16069 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
16070 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
16071 % Grid dashes: calculations
16072 \pgf@xb=2\pgf@circ@res@right
16073 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
16074 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
16075 \multiply\pgf@circ@count@a by 2\relax
16076 \advance\pgf@circ@count@a by 1\relax
16077 \advance\pgf@circ@res@step by -\pgf@xa
16078 \divide\pgf@circ@res@step by \pgf@circ@count@a
16079 % Grid dashes: draw
16080 \pgf@circ@res@temp=\pgf@xa
16081 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
16082 \loop
16083 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16084 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
16085 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
16086 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
16087 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
16088 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
16089 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
16090 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16091 \advance\pgf@circ@count@a by-1
16092 \ifnum\pgf@circ@count@a>0\relax
16093 \repeat
16094 }
16095
16096 \pgfcircdeclaretube{pentode suppressor to cathode}
16097 {
16098 \anchor{grid} {% should not be used
16099 \northwest
16100 \pgfutil@tempdima=\pgf@y
16101 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16102 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16103 }
16104 \anchor{control} {%
16105 \northwest
16106 \pgfutil@tempdima=\pgf@y
16107 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
16108 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
16109 }
16110 \anchor{screen} {%
16111 \northwest
16112 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
16113 }
16114 }
16115 {
16116 % Grid x/y points
16117 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
16118 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
16119 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
16120 \pgfutil@tempdimb=-\pgfutil@tempdima
16121 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16122 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16123 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
16124 % Grid protrusion
16125 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
16126 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
16127 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
16128 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
16129 % Grid dashes: calculations
16130 \pgf@xb=2\pgf@circ@res@right
16131 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
16132 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
16133 \multiply\pgf@circ@count@a by 2\relax
16134 \advance\pgf@circ@count@a by 1\relax
16135 \advance\pgf@circ@res@step by -\pgf@xa
16136 \divide\pgf@circ@res@step by \pgf@circ@count@a
16137 % Grid dashes: draw
16138 \pgf@circ@res@temp=\pgf@xa
16139 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
16140 \loop
16141 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16142 \ifnum\pgf@circ@count@a>1\relax
16143 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
16144 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
16145 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
16146 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
16147 \fi
16148 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
16149 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
16150 \advance\pgf@circ@res@temp by\pgf@circ@res@step
16151 \advance\pgf@circ@count@a by-1
16152 \ifnum\pgf@circ@count@a>0\relax
16153 \repeat
16154 % Grid: connection from suppressor to cathode
16155 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
16156 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
16157 \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}}
16158
16159 }
16160
16161 %%%---------- close: tex/pgfcirctripoles
16162 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
16163 %%%---------- open: tex/pgfcircquadpoles.tex
16164 % Copyright 2018-2026 by Romano Giannetti
16165 % Copyright 2015-2026 by Stefan Lindner
16166 % Copyright 2013-2026 by Stefan Erhardt
16167 % Copyright 2007-2026 by Massimo Redaelli
16168 %
16169 % This file may be distributed and/or modified
16170 %
16171 % 1. under the LaTeX Project Public License and/or
16172 % 2. under the GNU Public License.
16173 %
16174 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
16175
16176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16177 %% Quadripoles
16178
16179 \long\def\pgfcircdeclarequadpole#1#2#3{
16180 \pgfdeclareshape{#1}
16181 {
16182 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
16183 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16184 % shapename
16185 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
16186 \anchor{center}{
16187 \northwest
16188 \pgf@x=0pt
16189 \pgf@y=0pt
16190 }
16191 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
16192 \savedanchor\northwest{%
16193 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16194 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
16195 \pgf@y=.5\pgf@y
16196 \pgf@x=.5\pgf@circ@scaled@Rlen
16197 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
16198 }
16199 %% we define the upper right (positive coord) dot (which is B1)
16200 \savedanchor{\innerdot}{%
16201 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16202 \pgf@xa=.5\pgf@circ@scaled@Rlen
16203 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
16204 % by default use the cute inductor size
16205 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
16206 % check if it's american
16207 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
16208 \edef\pgf@temp{american}
16209 \ifx\pgf@circ@temp\pgf@temp
16210 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
16211 \fi
16212 % check if it's european
16213 \edef\pgf@temp{european}
16214 \ifx\pgf@circ@temp\pgf@temp
16215 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
16216 \fi
16217 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
16218 }
16219 \savedanchor{\outerdot}{%
16220 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16221 \pgf@xa=.5\pgf@circ@scaled@Rlen
16222 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
16223 % by default use the cute inductor size
16224 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
16225 % check if it's american
16226 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
16227 \edef\pgf@temp{american}
16228 \ifx\pgf@circ@temp\pgf@temp
16229 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
16230 \fi
16231 % check if it's european
16232 \edef\pgf@temp{european}
16233 \ifx\pgf@circ@temp\pgf@temp
16234 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
16235 \fi
16236 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
16237 }
16238 \anchor{A2}{
16239 \northwest
16240 \pgf@y=-\pgf@y
16241 }
16242 \anchor{B1}{
16243 \northwest
16244 \pgf@x=-\pgf@x
16245 }
16246 \anchor{A1}{
16247 \northwest
16248 }
16249 \anchor{B2}{
16250 \northwest
16251 \pgf@x=-\pgf@x
16252 \pgf@y=-\pgf@y
16253 }
16254 %% dot's anchors
16255 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
16256 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
16257 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
16258 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
16259 \anchor{inner dot B1}{\innerdot}
16260 \anchor{outer dot B1}{\outerdot}
16261 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
16262 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
16263 % geographical
16264 \anchor{north}{
16265 \northwest
16266 \pgf@x=0pt
16267 }
16268 \anchor{south}{
16269 \northwest
16270 \pgf@x=0pt
16271 \pgf@y=-\pgf@y
16272 }
16273 \anchor{west}{
16274 \northwest
16275 \pgf@y=0pt
16276 }
16277 \anchor{east}{
16278 \northwest
16279 \pgf@y=0pt
16280 \pgf@x=-\pgf@x
16281 }
16282 \anchor{south west}{
16283 \northwest
16284 \pgf@y=-\pgf@y
16285 }
16286 \anchor{north east}{
16287 \northwest
16288 \pgf@x=-\pgf@x
16289 }
16290 \anchor{north west}{
16291 \northwest
16292 }
16293 \anchor{south east}{
16294 \northwest
16295 \pgf@x=-\pgf@x
16296 \pgf@y=-\pgf@y
16297 }
16298 \anchor{base}{
16299 \northwest
16300 \pgf@x=0pt
16301 }
16302 #3
16303 \backgroundpath{
16304 \pgfsetcolor{\ctikzvalof{color}}
16305
16306 \northwest
16307 \pgf@circ@res@up = \pgf@y
16308 \pgf@circ@res@down = -\pgf@y
16309 \pgf@circ@res@right = -\pgf@x
16310 \pgf@circ@res@left = \pgf@x
16311 #2
16312 }
16313 }
16314 }
16315
16316
16317 \def\pgf@circ@drawtransformerbasicanchor{
16318 \ctikzvalof{quadpoles/trans/height}
16319 \anchor{AA2}{
16320 \northwest
16321 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
16322 \pgf@x=.7\pgf@x
16323 \pgf@y=-\pgf@y
16324 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
16325 }
16326 \anchor{BB1}{
16327 \northwest
16328 \pgf@x=-\pgf@x
16329 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
16330 \pgf@x=.7\pgf@x
16331 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
16332 }
16333 \anchor{AA1}{
16334 \northwest
16335 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
16336 \pgf@x=.7\pgf@x
16337 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
16338 }
16339 \anchor{BB2}{
16340 \northwest
16341 \pgf@x=-\pgf@x
16342 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
16343 \pgf@x=.7\pgf@x
16344 \pgf@y=-\pgf@y
16345 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
16346 }
16347 }
16348
16349 %% Null styles that can be used to change individually the L1 and L2
16350 %% inductors of the transformer.
16351
16352 \ctikzset{transformer L1/.style={}}
16353 \ctikzset{transformer L2/.style={}}
16354
16355 \def\pgf@circ@drawtransformerbasicbody{
16356 \pgfscope
16357 \pgfslopedattimetrue
16358 \pgfallowupsidedownattimetrue
16359 \pgftransformlineattime{.5}{%
16360 \pgfpoint%
16361 {\stretto\pgf@circ@res@left}%
16362 {\pgf@circ@res@up}%
16363 }{%
16364 \pgfpoint
16365 {\stretto\pgf@circ@res@left}%
16366 {\pgf@circ@res@down}%
16367 }
16368
16369 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
16370 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
16371 \def\pgf@temp{european}%
16372 \ifx\pgf@temp\pgf@circ@temp%
16373 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
16374 \else%
16375 \def\pgf@temp{cute}
16376 \ifx\pgf@temp\pgf@circ@temp%
16377 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
16378 \else%
16379 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
16380 \fi%
16381 \fi%
16382
16383
16384 \endpgfscope
16385 \pgfscope
16386 \pgfslopedattimetrue
16387 \pgfallowupsidedownattimetrue
16388 \pgftransformlineattime{.5}{%
16389 \pgfpoint%
16390 {\stretto\pgf@circ@res@right}%
16391 {\pgf@circ@res@down}%
16392 }{%
16393 \pgfpoint
16394 {\stretto\pgf@circ@res@right}%
16395 {\pgf@circ@res@up}%
16396 }
16397
16398 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
16399 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
16400 \def\pgf@temp{european}%
16401 \ifx\pgf@temp\pgf@circ@temp%
16402 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
16403 \else%
16404 \def\pgf@temp{cute}
16405 \ifx\pgf@temp\pgf@circ@temp%
16406 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
16407 \else%
16408 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
16409 \fi%
16410 \fi%
16411
16412 \endpgfscope
16413
16414 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
16415 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
16416 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
16417
16418 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
16419 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
16420 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
16421
16422 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
16423 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
16424 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
16425
16426 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
16427 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
16428 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
16429
16430 \pgfusepath{draw}
16431
16432 }
16433
16434
16435 \pgfcircdeclarequadpole{transformer}{
16436 \pgf@circ@drawtransformerbasicbody
16437 }{\pgf@circ@drawtransformerbasicanchor}
16438
16439 \pgfcircdeclarequadpole{transformer core}{
16440
16441 \pgf@circ@drawtransformerbasicbody
16442
16443 % use the chocke line thickness
16444 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
16445
16446 % Find the distance from center for the lines representing the core
16447 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
16448 % of the whole component, now as a fraction of the distance between coils, to be
16449 % compatible with the quadpoles "inner" style.
16450 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
16451
16452 \pgfmoveto{\pgfpoint%
16453 {\pgf@circ@res@other}%
16454 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
16455 }
16456 \pgflineto{
16457 \pgfpoint%
16458 {\pgf@circ@res@other}%
16459 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
16460 }
16461
16462 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
16463 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
16464 \pgfmoveto{\pgfpoint%
16465 {\pgf@circ@res@other}%
16466 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
16467 }
16468 \pgflineto{
16469 \pgfpoint%
16470 {\pgf@circ@res@other}%
16471 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
16472 }
16473
16474 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
16475 \pgfusepath{draw}
16476 }{\pgf@circ@drawtransformerbasicanchor}
16477
16478
16479 \pgfcircdeclarequadpole{gyrator}{
16480
16481 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
16482 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
16483 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
16484 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
16485
16486 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
16487 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
16488 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
16489 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
16490
16491 \pgfusepath{draw}
16492
16493 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
16494 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
16495 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
16496 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
16497 \pgfpathclose
16498 \pgf@circ@draworfill
16499
16500 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
16501 \pgfpatharc{90}{270}{\pgf@circ@res@other}
16502 \pgfpathclose
16503 \pgf@circ@draworfill
16504 }{}
16505
16506 %%%%%%%%%%%%%%%%%%%%
16507 %% Block elements
16508 %%%%%%%%%%%%%%%%%%%%
16509
16510 \pgfdeclareshape{mixer}
16511 {
16512 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16513 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16514 \savedanchor\northwest{
16515 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16516 \ifpgf@circuit@boxed
16517 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16518 \pgf@y=.5\pgf@y
16519 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16520 \pgf@x=.5\pgf@x
16521 \else
16522 \pgf@y=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
16523 \pgf@y=.5\pgf@y
16524 \pgf@x=-\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
16525 \pgf@x=.5\pgf@x
16526 \fi
16527 }
16528 \anchor{center}{
16529 \pgfpointorigin
16530 }
16531 \anchor{left}{%
16532 \northwest
16533 \pgf@y=0pt
16534 }
16535 \anchor{1}{
16536 \northwest
16537 \pgf@y=0pt
16538 }
16539 \anchor{2}{
16540 \northwest
16541 \pgf@y=-\pgf@y
16542 \pgf@x=0pt
16543 }
16544 \anchor{3}{
16545 \northwest
16546 \pgf@y=0pt
16547 \pgf@x=-\pgf@x
16548 }
16549 \anchor{4}{
16550 \northwest
16551 \pgf@y=\pgf@y
16552 \pgf@x=0pt
16553 }
16554 \anchor{in 1}{
16555 \northwest
16556 \pgf@y=0pt
16557 }
16558 \anchor{in1}{
16559 \northwest
16560 \pgf@y=0pt
16561 }
16562 \anchor{in}{
16563 \northwest
16564 \pgf@y=0pt
16565 }
16566 \anchor{in 2}{
16567 \northwest
16568 \pgf@y=-\pgf@y
16569 \pgf@x=0pt
16570 }
16571 \anchor{in2}{
16572 \northwest
16573 \pgf@y=-\pgf@y
16574 \pgf@x=0pt
16575 }
16576 \anchor{out}{
16577 \northwest
16578 \pgf@y=0pt
16579 \pgf@x=-\pgf@x
16580 }
16581 \anchor{center}{
16582 \pgf@y=0pt
16583 \pgf@x=0pt
16584 }
16585 \anchor{east}{
16586 \northwest
16587 \pgf@y=0pt
16588 \pgf@x=-\pgf@x
16589 }
16590 \anchor{west}{
16591 \northwest
16592 \pgf@y=0pt
16593 }
16594 \anchor{south}{
16595 \northwest
16596 \pgf@x=0pt
16597 \pgf@y=-\pgf@y
16598 }
16599 \anchor{north}{
16600 \northwest
16601 \pgf@x=0pt
16602 }
16603 \anchor{south west}{
16604 \northwest
16605 \pgf@y=-\pgf@y
16606 }
16607 \anchor{north east}{
16608 \northwest
16609 \pgf@x=-\pgf@x
16610 }
16611 \anchor{north west}{
16612 \northwest
16613 }
16614 \anchor{south east}{
16615 \northwest
16616 \pgf@x=-\pgf@x
16617 \pgf@y=-\pgf@y
16618 }
16619 \backgroundpath{
16620 \pgfsetcolor{\ctikzvalof{color}}
16621 \pgf@circ@scaled@Rlen=\scaledRlen
16622
16623 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
16624
16625 \pgfscope
16626 \pgfstartlinewidth=\pgflinewidth
16627
16628 % draw outer box
16629 \ifpgf@circuit@boxed
16630 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
16631 \fi
16632
16633 % draw outer circle
16634 \ifpgf@circuit@boxed
16635 \pgf@circ@res@step=.7\pgf@circ@res@step
16636 \pgfsetdash{}{0pt} % draw solid circle if boxed
16637 \else
16638 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16639 \fi
16640 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16641 \pgf@circ@draworfill
16642
16643 % draw inner stuff
16644 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16645 \pgfsetlinewidth{\pgfstartlinewidth}
16646 \pgfpathmoveto{\pgfpointorigin}
16647 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
16648 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
16649 \pgfpathmoveto{\pgfpointorigin}
16650 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
16651 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
16652 \pgfusepath{draw}
16653
16654 \endpgfscope
16655 }
16656 }
16657
16658 \pgfdeclareshape{adder}
16659 {
16660 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16661 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16662 \savedanchor\northwest{
16663 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16664 \ifpgf@circuit@boxed
16665 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16666 \pgf@y=.5\pgf@y
16667 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16668 \pgf@x=.5\pgf@x
16669 \else
16670 \pgf@y=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
16671 \pgf@y=.5\pgf@y
16672 \pgf@x=-\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
16673 \pgf@x=.5\pgf@x
16674 \fi
16675 }
16676 \anchor{center}{
16677 \pgfpointorigin
16678 }
16679 \anchor{left}{%
16680 \northwest
16681 \pgf@y=0pt
16682 }
16683 \anchor{1}{
16684 \northwest
16685 \pgf@y=0pt
16686 }
16687 \anchor{2}{
16688 \northwest
16689 \pgf@y=-\pgf@y
16690 \pgf@x=0pt
16691 }
16692 \anchor{3}{
16693 \northwest
16694 \pgf@y=0pt
16695 \pgf@x=-\pgf@x
16696 }
16697 \anchor{4}{
16698 \northwest
16699 \pgf@y=\pgf@y
16700 \pgf@x=0pt
16701 }
16702 \anchor{in 1}{
16703 \northwest
16704 \pgf@y=0pt
16705 }
16706 \anchor{in1}{
16707 \northwest
16708 \pgf@y=0pt
16709 }
16710 \anchor{in}{
16711 \northwest
16712 \pgf@y=0pt
16713 }
16714 \anchor{in 2}{
16715 \northwest
16716 \pgf@y=-\pgf@y
16717 \pgf@x=0pt
16718 }
16719 \anchor{in2}{
16720 \northwest
16721 \pgf@y=-\pgf@y
16722 \pgf@x=0pt
16723 }
16724 \anchor{out}{
16725 \northwest
16726 \pgf@y=0pt
16727 \pgf@x=-\pgf@x
16728 }
16729 \anchor{center}{
16730 \pgf@y=0pt
16731 \pgf@x=0pt
16732 }
16733 \anchor{east}{
16734 \northwest
16735 \pgf@y=0pt
16736 \pgf@x=-\pgf@x
16737 }
16738 \anchor{west}{
16739 \northwest
16740 \pgf@y=0pt
16741 }
16742 \anchor{south}{
16743 \northwest
16744 \pgf@x=0pt
16745 \pgf@y=-\pgf@y
16746 }
16747 \anchor{north}{
16748 \northwest
16749 \pgf@x=0pt
16750 }
16751 \anchor{south west}{
16752 \northwest
16753 \pgf@y=-\pgf@y
16754 }
16755 \anchor{north east}{
16756 \northwest
16757 \pgf@x=-\pgf@x
16758 }
16759 \anchor{north west}{
16760 \northwest
16761 }
16762 \anchor{south east}{
16763 \northwest
16764 \pgf@x=-\pgf@x
16765 \pgf@y=-\pgf@y
16766 }
16767 \backgroundpath{
16768 \pgfsetcolor{\ctikzvalof{color}}
16769 \pgf@circ@scaled@Rlen=\scaledRlen
16770
16771 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
16772
16773 \pgfscope
16774 \pgfstartlinewidth=\pgflinewidth
16775
16776 % draw outer box
16777 \ifpgf@circuit@boxed
16778 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
16779 \fi
16780
16781 % draw outer circle
16782 \ifpgf@circuit@boxed
16783 \pgf@circ@res@step=.7\pgf@circ@res@step{}
16784 \pgfsetdash{}{0pt} % draw solid circle if boxed
16785 \else
16786 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16787 \fi
16788 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16789 \pgf@circ@draworfill
16790
16791 % draw inner stuff
16792 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16793 \pgfsetlinewidth{\pgfstartlinewidth}
16794
16795 \pgfpathmoveto{\pgfpointorigin}
16796 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
16797 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
16798 \pgfpathmoveto{\pgfpointorigin}
16799 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
16800 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
16801 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16802 \pgfusepath{draw}
16803
16804 \endpgfscope
16805 }
16806 }
16807
16808 \pgfdeclareshape{oscillator}
16809 {
16810 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16811 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16812 \savedanchor\northwest{
16813 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16814 \ifpgf@circuit@boxed
16815 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16816 \pgf@y=.5\pgf@y
16817 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16818 \else
16819 \pgf@y=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
16820 \pgf@y=.5\pgf@y
16821 \pgf@x=-\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen
16822 \fi
16823 }
16824 \anchor{center}{
16825 \pgfpointorigin
16826 }
16827 \anchor{north}{
16828 \northwest
16829 \pgf@x=.5\pgf@x
16830 }
16831 \anchor{south}{
16832 \northwest
16833 \pgf@x=.5\pgf@x
16834 \pgf@y=-\pgf@y
16835 }
16836 \anchor{east}{
16837 \northwest
16838 \pgf@y=0pt
16839 \pgf@x=0pt
16840 }
16841 \anchor{west}{
16842 \northwest
16843 \pgf@y=0pt
16844 }
16845 \anchor{south west}{ \northwest \pgf@y=-\pgf@y}
16846 \anchor{north east}{ \northwest \pgf@x=0pt\relax}
16847 \anchor{north west}{ \northwest }
16848 \anchor{south east}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
16849 \anchor{text}{
16850 \pgf@x=-2\pgf@x
16851 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
16852 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
16853 }
16854 \backgroundpath{
16855 \pgfsetcolor{\ctikzvalof{color}}
16856 \pgf@circ@scaled@Rlen=\scaledRlen
16857
16858 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
16859
16860 \pgfscope
16861 \pgfstartlinewidth=\pgflinewidth
16862
16863 \pgftransformxshift{-0.5\pgf@circ@res@step} % The oscillator is shifted to the left, so a connection comes out of the anchor "east"
16864
16865 % draw outer box
16866 \ifpgf@circuit@boxed{}
16867 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
16868 \fi
16869
16870 % draw outer circle
16871 \ifpgf@circuit@boxed
16872 \pgf@circ@res@step=.7\pgf@circ@res@step{}
16873 \pgfsetdash{}{0pt} % draw solid circle if boxed
16874 \else
16875 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16876 \fi
16877 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16878 \pgf@circ@draworfill
16879
16880 % draw inner sine waves
16881 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16882 \pgfsetlinewidth{\pgfstartlinewidth}
16883 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
16884 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
16885 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
16886 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
16887 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
16888 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
16889
16890 \pgfusepath{draw}
16891
16892 \endpgfscope
16893 }
16894 }
16895
16896 \pgfdeclareshape{circulator}
16897 {
16898 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
16899 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16900 \savedanchor\northwest{
16901 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16902 \ifpgf@circuit@boxed
16903 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16904 \pgf@y=.5\pgf@y
16905 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
16906 \pgf@x=.5\pgf@x
16907 \else
16908 \pgf@y=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
16909 \pgf@y=.5\pgf@y
16910 \pgf@x=-\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
16911 \pgf@x=.5\pgf@x
16912 \fi
16913 }
16914 \anchor{center}{
16915 \pgfpointorigin
16916 }
16917 \anchor{left}{%
16918 \northwest
16919 \pgf@y=0pt
16920 }
16921 \anchor{1}{
16922 \northwest
16923 \pgf@y=0pt
16924 }
16925 \anchor{2}{
16926 \northwest
16927 \pgf@y=0pt
16928 \pgf@x=-\pgf@x
16929 }
16930 \anchor{3}{
16931 \northwest
16932 \pgf@y=-\pgf@y
16933 \pgf@x=0pt
16934 }
16935 \anchor{east}{
16936 \northwest
16937 \pgf@y=0pt
16938 \pgf@x=-\pgf@x
16939 }
16940 \anchor{west}{
16941 \northwest
16942 \pgf@y=0pt
16943 }
16944 \anchor{south}{
16945 \northwest
16946 \pgf@x=0pt
16947 \pgf@y=-\pgf@y
16948 }
16949 \anchor{north}{
16950 \northwest
16951 \pgf@x=0pt
16952 }
16953 \anchor{south west}{
16954 \northwest
16955 \pgf@y=-\pgf@y
16956 }
16957 \anchor{north east}{
16958 \northwest
16959 \pgf@x=-\pgf@x
16960 }
16961 \anchor{north west}{
16962 \northwest
16963 }
16964 \anchor{south east}{
16965 \northwest
16966 \pgf@x=-\pgf@x
16967 \pgf@y=-\pgf@y
16968 }
16969 \backgroundpath{
16970 \pgfsetcolor{\ctikzvalof{color}}
16971 \pgf@circ@scaled@Rlen=\scaledRlen
16972
16973 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
16974
16975 \pgfscope
16976 \pgfstartlinewidth=\pgflinewidth
16977
16978 % draw outer box
16979 \ifpgf@circuit@boxed
16980 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
16981 \fi
16982
16983 % draw outer circle
16984 \ifpgf@circuit@boxed{}
16985 \pgf@circ@res@step=.7\pgf@circ@res@step{}
16986 \pgfsetdash{}{0pt} % draw solid circle if boxed
16987 \else
16988 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
16989 \fi
16990 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
16991 \pgf@circ@draworfill
16992
16993 % inner arrow
16994 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
16995 \pgfsetlinewidth{\pgfstartlinewidth}
16996
16997 \pgfsetarrowsend{latex}
16998 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
16999 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
17000 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
17001 \pgfusepath{draw}
17002
17003 \endpgfscope
17004 }
17005 }
17006
17007 %% gridnode
17008 \pgfdeclareshape{gridnode}
17009 {
17010 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17011 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17012 \savedanchor\northwest{
17013 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17014 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
17015 \pgf@y=.5\pgf@y
17016 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
17017 \pgf@x=.5\pgf@x
17018 }
17019 \anchor{center}{
17020 \pgfpointorigin
17021 }
17022
17023 \anchor{north}{
17024 \northwest
17025 \pgf@x=0pt
17026 }
17027 \anchor{up}{
17028 \northwest
17029 \pgf@x=0pt
17030 }
17031 \anchor{south}{
17032 \northwest
17033 \pgf@x=0pt
17034 \pgf@y=-\pgf@y
17035 }
17036 \anchor{down}{
17037 \northwest
17038 \pgf@x=0pt
17039 \pgf@y=-\pgf@y
17040 }
17041 \anchor{east}{
17042 \northwest
17043 \pgf@y=0pt
17044 \pgf@x=-\pgf@x
17045 }
17046 \anchor{right}{
17047 \northwest
17048 \pgf@y=0pt
17049 \pgf@x=-\pgf@x
17050 }
17051 \anchor{west}{
17052 \northwest
17053 \pgf@y=0pt
17054 }
17055 \anchor{left}{
17056 \northwest
17057 \pgf@y=0pt
17058 }
17059 \anchor{south west}{
17060 \northwest
17061 \pgf@y=-\pgf@y
17062 }
17063 \anchor{north east}{
17064 \northwest
17065 \pgf@x=-\pgf@x
17066 \relax
17067 }
17068 \anchor{north west}{
17069 \northwest
17070 }
17071 \anchor{south east}{
17072 \northwest
17073 \pgf@x=-\pgf@x
17074 \pgf@y=-\pgf@y
17075 }
17076 \anchor{text}{
17077 \pgf@x=-2\pgf@x
17078 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
17079 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
17080 }
17081 \backgroundpath{
17082 \pgfsetcolor{\ctikzvalof{color}}
17083 \pgf@circ@scaled@Rlen=\scaledRlen
17084
17085 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
17086
17087 \northwest
17088 \pgf@circ@res@up = \pgf@y
17089 \pgf@circ@res@down = -\pgf@y
17090 \pgf@circ@res@right = -\pgf@x
17091 \pgf@circ@res@left = \pgf@x
17092
17093 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
17094 \divide \pgf@circ@res@step by 2
17095
17096 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
17097 \pgf@circ@res@other = \pgf@circ@res@left
17098 \advance\pgf@circ@res@other by \pgf@circ@res@step
17099
17100 \ifpgf@circuit@dashed
17101 \pgfsetdash{{0.1cm}{0.1cm}}{0cm}
17102 \fi
17103
17104 % draw outer box
17105 \pgf@circ@twoportbox
17106
17107
17108 \ifpgf@circuit@inputarrow
17109 {
17110 \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
17111 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
17112 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}
17113 }
17114 \fi
17115
17116 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17117 \pgfsetarrows{-} %never draw arrows
17118 \pgfsetlinewidth{0.05mm}
17119
17120 % draw grid
17121 \foreach \line in {-1,-.5,...,1}
17122 {
17123 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
17124 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}}
17125
17126 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
17127 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}}
17128 }
17129
17130 %prevent from draw the inner cross twice
17131 \foreach \line in {-.5,0,...,.5}
17132 {
17133 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
17134 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}}
17135
17136 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
17137 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}}
17138 }
17139 \pgfusepath{draw}
17140 }
17141 }
17142
17143
17144 % Wilkinson divider
17145 \pgfdeclareshape{wilkinson}{
17146 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17147 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17148 \savedanchor\northwest{%
17149 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17150 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
17151 \pgf@y=.5\pgf@y
17152 \pgf@x= \pgf@circ@scaled@Rlen
17153 \pgf@x=.5\pgf@x
17154 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
17155 }
17156 \anchor{center}{
17157 \northwest
17158 \pgf@x=0pt
17159 \pgf@y=0pt
17160 }
17161 \anchor{north}{
17162 \northwest
17163 \pgf@x=0pt
17164 }
17165 \anchor{south}{
17166 \northwest
17167 \pgf@x=0pt
17168 \pgf@y=-\pgf@y
17169 }
17170 \anchor{west}{
17171 \northwest
17172 \pgf@y=0pt
17173 }
17174 \anchor{east}{
17175 \northwest
17176 \pgf@y=0pt
17177 \pgf@x=-\pgf@x
17178 }
17179 \anchor{south west}{
17180 \northwest
17181 \pgf@y=-\pgf@y
17182 }
17183 \anchor{north east}{
17184 \northwest
17185 \pgf@x=-\pgf@x
17186 }
17187 \anchor{north west}{
17188 \northwest
17189 }
17190 \anchor{south east}{
17191 \northwest
17192 \pgf@x=-\pgf@x
17193 \pgf@y=-\pgf@y
17194 }
17195 \anchor{in}{
17196 \northwest
17197 \pgf@y=0pt
17198 }
17199 \anchor{out1}{
17200 \northwest
17201 \pgf@x=-\pgf@x
17202 \pgf@y=-0.5\pgf@y
17203 }
17204 \anchor{out2}{
17205 \northwest
17206 \pgf@x=-\pgf@x
17207 \pgf@y=0.5\pgf@y
17208 }
17209 \anchor{text}{
17210 \northwest
17211 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
17212 \pgf@x=-.5\wd\pgfnodeparttextbox
17213 }
17214 \backgroundpath{
17215 \pgfsetcolor{\ctikzvalof{color}}
17216 \pgf@circ@scaled@Rlen=\scaledRlen
17217
17218 \northwest
17219 \pgf@circ@res@up = \pgf@y
17220 \pgf@circ@res@down = -\pgf@y
17221 \pgf@circ@res@right = -\pgf@x
17222 \pgf@circ@res@left = \pgf@x
17223
17224 \pgfstartlinewidth=\pgflinewidth
17225
17226 % draw outer box
17227 \pgf@circ@twoportbox
17228
17229 % draw inner stuff
17230 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17231 \pgfsetarrows{-} %never draw arrows
17232 \pgfsetlinewidth{\pgfstartlinewidth}
17233 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
17234 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
17235 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
17236 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
17237 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
17238 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
17239 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
17240
17241 \pgfusepath{draw}
17242
17243 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
17244 % draw inner resisitor - european or american style is recognised
17245 {
17246 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
17247 \pgftransformrotate{90}
17248
17249 % calculate size of resistor
17250 \ifpgf@circuit@europeanresistor
17251 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
17252 \pgftransformscale{\pgfmathresult}
17253 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
17254 \else
17255 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
17256 \pgftransformscale{\pgfmathresult}
17257 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
17258 \fi
17259 }
17260
17261 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
17262 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
17263
17264 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
17265 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
17266 \pgfusepath{draw}
17267
17268 }
17269 }
17270
17271 %% couplers generics
17272 \long\def\pgfcircdeclarefourport#1#2{
17273
17274 \pgfdeclareshape{#1}{
17275 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
17276 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17277 \anchor{center}{
17278 \northwest
17279 \pgf@x=0pt
17280 \pgf@y=0pt
17281 }
17282 \savedanchor\northwest{%
17283 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17284 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
17285 \pgf@y=.5\pgf@y
17286 \pgf@x=.5\pgf@circ@scaled@Rlen
17287 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
17288 }
17289 \anchor{north}{
17290 \northwest
17291 \pgf@x=0pt
17292 }
17293 \anchor{south}{
17294 \northwest
17295 \pgf@x=0pt
17296 \pgf@y=-\pgf@y
17297 }
17298 \anchor{west}{
17299 \northwest
17300 \pgf@y=0pt
17301 }
17302 \anchor{east}{
17303 \northwest
17304 \pgf@y=0pt
17305 \pgf@x=-\pgf@x
17306 }
17307 \anchor{south west}{
17308 \northwest
17309 \pgf@y=-\pgf@y
17310 }
17311 \anchor{north east}{
17312 \northwest
17313 \pgf@x=-\pgf@x
17314 }
17315 \anchor{north west}{
17316 \northwest
17317 }
17318 \anchor{south east}{
17319 \northwest
17320 \pgf@x=-\pgf@x
17321 \pgf@y=-\pgf@y
17322 }
17323 \anchor{port1}{
17324 \northwest
17325 \pgf@y=-0.5\pgf@y
17326 }
17327 \anchor{port2}{
17328 \northwest
17329 \pgf@x=-\pgf@x
17330 \pgf@y=-0.5\pgf@y
17331 }
17332 \anchor{port3}{
17333 \northwest
17334 \pgf@x=-\pgf@x
17335 \pgf@y=0.5\pgf@y
17336 }
17337 \anchor{port4}{
17338 \northwest
17339 \pgf@y=0.5\pgf@y
17340 }
17341 \anchor{1}{
17342 \northwest
17343 \pgf@y=-0.5\pgf@y
17344 }
17345 \anchor{2}{
17346 \northwest
17347 \pgf@x=-\pgf@x
17348 \pgf@y=-0.5\pgf@y
17349 }
17350 \anchor{3}{
17351 \northwest
17352 \pgf@x=-\pgf@x
17353 \pgf@y=0.5\pgf@y
17354 }
17355 \anchor{4}{
17356 \northwest
17357 \pgf@y=0.5\pgf@y
17358 }
17359
17360 \anchor{text}{
17361 \northwest
17362 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
17363 \pgf@x=-.5\wd\pgfnodeparttextbox
17364 }
17365 \backgroundpath{
17366 \pgfsetcolor{\ctikzvalof{color}}
17367
17368 \northwest
17369 \pgf@circ@res@up = \pgf@y
17370 \pgf@circ@res@down = -\pgf@y
17371 \pgf@circ@res@right = -\pgf@x
17372 \pgf@circ@res@left = \pgf@x
17373 \pgf@circ@scaled@Rlen=\scaledRlen
17374
17375 \pgfstartlinewidth=\pgflinewidth
17376
17377 % draw outer box
17378 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
17379 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17380 \pgf@circ@draworfill
17381
17382 % draw inner stuff
17383 #2
17384
17385 % draw inner text
17386 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
17387 }
17388 }
17389 }
17390
17391 % four-port
17392 \pgfcircdeclarefourport{fourport}{}
17393
17394 % straight coupler
17395 \pgfcircdeclarefourport{coupler}{
17396 \pgfsetlinewidth{\pgfstartlinewidth}
17397 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
17398 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
17399 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
17400 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
17401 \pgfusepath{draw}
17402
17403 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
17404 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
17405 \pgfsetarrows{latex-latex}
17406 \pgfusepath{draw}
17407 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
17408 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
17409 \pgfsetarrows{latex-latex}
17410 \pgfusepath{draw}
17411 }
17412
17413 % "bended" coupler
17414 \pgfcircdeclarefourport{coupler2}{
17415 \pgfsetlinewidth{\pgfstartlinewidth}
17416 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
17417 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
17418 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
17419 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
17420 \pgfusepath{draw}
17421
17422 \pgfscope
17423 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
17424 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
17425 \pgfsetarrowsend{latex}
17426 \pgfusepath{draw}
17427 \endpgfscope
17428 \pgfscope
17429 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
17430 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
17431 \pgfsetarrowsend{latex}
17432 \pgfusepath{draw}
17433 \endpgfscope
17434 \pgfscope
17435 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
17436 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
17437 \pgfsetarrowsend{latex}
17438 \pgfusepath{draw}
17439 \endpgfscope
17440 \pgfscope
17441 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
17442 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
17443 \pgfsetarrowsend{latex}
17444 \pgfusepath{draw}
17445 \endpgfscope
17446 }
17447
17448 %%%---------- close: tex/pgfcircquadpoles
17449 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
17450 %%%---------- open: tex/pgfcircmultipoles.tex
17451 % Copyright 2018-2026 by Romano Giannetti
17452 % Copyright 2015-2026 by Stefan Lindner
17453 % Copyright 2013-2026 by Stefan Erhardt
17454 % Copyright 2007-2026 by Massimo Redaelli
17455 %
17456 % This file may be distributed and/or modified
17457 %
17458 % 1. under the LaTeX Project Public License and/or
17459 % 2. under the GNU Public License.
17460 %
17461 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
17462
17463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17464 %% Multipoles by Romano Giannetti
17465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17466
17467 %%%%%%%%%
17468 %% Chips
17469 %%%%%%%%%
17470
17471 % let's use the same shifts everywhere, no magic numbers
17472 \def\pgf@circ@dip@pin@shift{0.5}
17473 \def\pgf@circ@qfp@pin@shift{0.25}
17474
17475 % derived from https://tex.stackexchange.com/a/146753/38080
17476 % original author Mark Wibrow
17477 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
17478 % a lot of thanks to @marmot for the un-rotation hint
17479 % https://tex.stackexchange.com/a/473571/38080
17480
17481 % DIP (dual in line package) chips
17482
17483 \pgfdeclareshape{dipchip}{
17484 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
17485 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17486 \savedmacro\numpins{%
17487 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
17488 \def\numpins{\the\pgf@circ@count@a}
17489 }
17490 \savedanchor\centerpoint{%
17491 \pgf@x=-.5\wd\pgfnodeparttextbox%
17492 \pgf@y=-.5\ht\pgfnodeparttextbox%
17493 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
17494 }%
17495 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
17496 \anchor{center}{\origin}
17497 \anchor{text}{\centerpoint}% to adjust text
17498 \saveddimen\height{%
17499 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17500 \pgfmathsetlength\pgf@x{((\numpins)
17501 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
17502 }%
17503 \saveddimen{\chipspacing}{
17504 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17505 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
17506 \saveddimen{\width}{
17507 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17508 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
17509 \saveddimen{\extshift}{
17510 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17511 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
17512 % standard anchors
17513 \savedanchor\northwest{%
17514 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17515 \pgfmathsetlength\pgf@y{0.5*((\numpins)
17516 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
17517 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
17518 }
17519 \anchor{dot}{\northwest
17520 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
17521 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
17522 }
17523 \anchor{nw}{\northwest}
17524 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
17525 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17526 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
17527 \anchor{north west}{\northwest}
17528 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
17529 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
17530 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
17531 \anchor{n}{\northwest\pgf@x=0pt }
17532 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17533 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17534 \anchor{w}{\northwest\pgf@y=0pt }
17535 \anchor{north}{\northwest\pgf@x=0pt }
17536 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17537 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17538 \anchor{west}{\northwest\pgf@y=0pt }
17539 % start drawing
17540 \backgroundpath{%
17541 \northwest
17542 \pgf@circ@res@up = \pgf@y
17543 \pgf@circ@res@down = -\pgf@y
17544 \pgf@circ@res@right = -\pgf@x
17545 \pgf@circ@res@left = \pgf@x
17546 \pgf@circ@scaled@Rlen=\scaledRlen
17547 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
17548 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
17549 \pgfscope% (for the line width)
17550 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
17551 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
17552 \pgf@circ@draworfill
17553 %% upside mark
17554 \ifpgf@circuit@chip@topmark
17555 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
17556 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
17557 \fi
17558 \pgfusepath{stroke}%
17559 \pgfsetcolor{\ctikzvalof{color}}
17560 % Adding the pin number
17561 \ifpgf@circuit@chip@shownumbers
17562 \pgf@circ@count@a=\numpins\relax
17563 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
17564 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
17565 \ifpgf@circuit@chip@straightnumbers
17566 \pgfgettransformentries\a\b\temp\temp\temp\temp
17567 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
17568 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
17569 \else
17570 \pgfmathsetmacro{\rot}{0}
17571 \pgfmathsetmacro{\quadrant}{0}
17572 \fi
17573 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
17574 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
17575 \pgfmathloop%
17576 \ifnum\pgf@circ@count@a>0
17577 \ifcase\quadrant % rotation 0
17578 % left
17579 \pgf@circ@count@c=\pgf@circ@count@a
17580 \pgftext[left,
17581 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17582 rotate=\rot]{\mytext}
17583 % right
17584 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17585 \pgftext[right,
17586 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17587 rotate=\rot]{\mytext}
17588 \or % rotation -90
17589 % left
17590 \pgf@circ@count@c=\pgf@circ@count@a
17591 \pgftext[top,
17592 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17593 rotate=\rot]{\mytext}
17594 % right
17595 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17596 \pgftext[bottom,
17597 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17598 rotate=\rot]{\mytext}
17599 \or %rotation 180
17600 % left
17601 \pgf@circ@count@c=\pgf@circ@count@a
17602 \pgftext[right,
17603 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17604 rotate=\rot]{\mytext}
17605 % right
17606 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17607 \pgftext[left,
17608 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17609 rotate=\rot]{\mytext}
17610 \or % rotation +90
17611 % left
17612 \pgf@circ@count@c=\pgf@circ@count@a
17613 \pgftext[bottom,
17614 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17615 rotate=\rot]{\mytext}
17616 % right
17617 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17618 \pgftext[top,
17619 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17620 rotate=\rot]{\mytext}
17621 \fi
17622 \advance\pgf@circ@count@a-1\relax%
17623 \repeatpgfmathloop
17624 \fi
17625 \endpgfscope
17626 \ifdim\pgf@circ@res@other>0pt
17627 \pgfscope
17628 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
17629 \pgf@circ@count@a=\numpins\relax
17630 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
17631 \pgfmathloop%
17632 \ifnum\pgf@circ@count@a>0
17633 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
17634 \ifnum\padfrac>0
17635 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
17636 % left side pads
17637 \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}}
17638 \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}}
17639 \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}}
17640 \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}}
17641 % right side pads
17642 \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}}
17643 \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}}
17644 \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}}
17645 \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}}
17646 \else
17647 % left side pins
17648 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17649 \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}}
17650 % right side pins
17651 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17652 \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}}
17653 \fi
17654 \advance\pgf@circ@count@a by -1\relax%
17655 \repeatpgfmathloop
17656 \pgfusepath{stroke}
17657 \endpgfscope
17658 \fi
17659 }%
17660 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
17661 % and is executed just before a node is drawn.
17662 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
17663 % Start with the maximum pin number and go backwards.
17664 \pgf@circ@count@a=\numpins\relax
17665 \pgfmathloop%
17666 \ifnum\pgf@circ@count@a>0
17667 % we will create two anchors per pin: the "normal one" like `pin 1` for the
17668 % electrical contact, and the "border one" like `bpin 1` for labels.
17669 % they will coincide if `external pins width` is set to 0.
17670 \expandafter\xdef\csname pgf@anchor@dipchip@pin\space\the\pgf@circ@count@a\endcsname{%
17671 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
17672 }
17673 \expandafter\xdef\csname pgf@anchor@dipchip@bpin\space\the\pgf@circ@count@a\endcsname{%
17674 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
17675 }
17676 \advance\pgf@circ@count@a by -1\relax%
17677 \repeatpgfmathloop%
17678 }%
17679 }
17680
17681 % QFP (quad flat package) chips
17682
17683 \pgfdeclareshape{qfpchip}{
17684 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
17685 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17686 \savedmacro\numpins{%
17687 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
17688 \def\numpins{\the\pgf@circ@count@a}
17689 }
17690 \savedanchor\centerpoint{%
17691 \pgf@x=-.5\wd\pgfnodeparttextbox%
17692 \pgf@y=-.5\ht\pgfnodeparttextbox%
17693 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
17694 }%
17695 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
17696 \anchor{center}{\origin}
17697 \anchor{text}{\centerpoint}% to adjust text
17698 \saveddimen\height{%
17699 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17700 \pgfmathsetlength\pgf@x{((\numpins+2)
17701 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
17702 }%
17703 \saveddimen\width{%
17704 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17705 \pgfmathsetlength\pgf@x{((\numpins+2)
17706 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
17707 }%
17708 \saveddimen{\chipspacing}{
17709 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17710 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
17711 \saveddimen{\extshift}{
17712 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17713 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
17714 % standard anchors
17715 \savedanchor\northwest{%
17716 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17717 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
17718 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
17719 \pgf@x=-\pgf@y
17720 }
17721 \anchor{dot}{\northwest
17722 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
17723 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
17724 }
17725 \anchor{nw}{\northwest}
17726 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
17727 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
17728 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
17729 \anchor{north west}{\northwest}
17730 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
17731 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
17732 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
17733 \anchor{n}{\northwest\pgf@x=0pt }
17734 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17735 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17736 \anchor{w}{\northwest\pgf@y=0pt }
17737 \anchor{north}{\northwest\pgf@x=0pt }
17738 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
17739 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
17740 \anchor{west}{\northwest\pgf@y=0pt }
17741 % start drawing
17742 \backgroundpath{%
17743 \northwest
17744 \pgf@circ@res@up = \pgf@y
17745 \pgf@circ@res@down = -\pgf@y
17746 \pgf@circ@res@right = -\pgf@x
17747 \pgf@circ@res@left = \pgf@x
17748 \pgf@circ@scaled@Rlen=\scaledRlen
17749 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
17750 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
17751 \pgfscope% (for the line width)
17752 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
17753 %% upside mark
17754 \ifpgf@circuit@chip@topmark
17755 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
17756 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
17757 \else
17758 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
17759 \fi
17760 %% rest of the shape
17761 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
17762 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
17763 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
17764 \pgfpathclose
17765 \pgf@circ@draworfill
17766 % Adding the pin number
17767 \pgfsetcolor{\ctikzvalof{color}}
17768 \ifpgf@circuit@chip@shownumbers
17769 \pgf@circ@count@a=\numpins%
17770 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
17771 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
17772 \ifpgf@circuit@chip@straightnumbers
17773 \pgfgettransformentries\a\b\temp\temp\temp\temp
17774 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
17775 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
17776 \else
17777 \pgfmathsetmacro{\rot}{0}
17778 \pgfmathsetmacro{\quadrant}{0}
17779 \fi
17780 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
17781 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
17782 \pgfmathloop%
17783 \ifnum\pgf@circ@count@a>0
17784 \ifcase\quadrant % rotation 0
17785 % left
17786 \pgf@circ@count@c=\pgf@circ@count@a
17787 \pgftext[left,
17788 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17789 rotate=\rot]{\mytext}
17790 % bottom
17791 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
17792 \pgftext[bottom,
17793 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
17794 rotate=\rot]{\mytext}
17795 % right
17796 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17797 \pgftext[right,
17798 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17799 rotate=\rot]{\mytext}
17800 % top
17801 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
17802 \pgftext[top,
17803 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
17804 rotate=\rot]{\mytext}
17805 \or % rotation -90
17806 % left
17807 \pgf@circ@count@c=\pgf@circ@count@a
17808 \pgftext[top,
17809 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17810 rotate=\rot]{\mytext}
17811 % bottom
17812 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
17813 \pgftext[left,
17814 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
17815 rotate=\rot]{\mytext}
17816 % right
17817 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17818 \pgftext[bottom,
17819 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17820 rotate=\rot]{\mytext}
17821 % top
17822 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
17823 \pgftext[right,
17824 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
17825 rotate=\rot]{\mytext}
17826 \or %rotation 180
17827 % left
17828 \pgf@circ@count@c=\pgf@circ@count@a
17829 \pgftext[right,
17830 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17831 rotate=\rot]{\mytext}
17832 % bottom
17833 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
17834 \pgftext[top,
17835 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
17836 rotate=\rot]{\mytext}
17837 % right
17838 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17839 \pgftext[left,
17840 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17841 rotate=\rot]{\mytext}
17842 % top
17843 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
17844 \pgftext[bottom,
17845 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
17846 rotate=\rot]{\mytext}
17847 \or % rotation +90
17848 % left
17849 \pgf@circ@count@c=\pgf@circ@count@a
17850 \pgftext[bottom,
17851 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17852 rotate=\rot]{\mytext}
17853 % bottom
17854 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
17855 \pgftext[right,
17856 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
17857 rotate=\rot]{\mytext}
17858 % right
17859 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
17860 \pgftext[top,
17861 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
17862 rotate=\rot]{\mytext}
17863 % top
17864 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
17865 \pgftext[left,
17866 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
17867 rotate=\rot]{\mytext}
17868 \fi
17869 \advance\pgf@circ@count@a-1\relax%
17870 \repeatpgfmathloop
17871 \fi
17872 \endpgfscope
17873 \ifdim\pgf@circ@res@other>0pt
17874 \pgfscope
17875 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
17876 \pgf@circ@count@a=\numpins%
17877 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
17878 \pgfmathloop%
17879 \ifnum\pgf@circ@count@a>0
17880 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
17881 \ifnum\padfrac>0
17882 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
17883 % left side pads
17884 \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}}
17885 \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}}
17886 \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}}
17887 \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}}
17888 % bottom side pads
17889 \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}}
17890 \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}}
17891 \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}}
17892 \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}}
17893 % right side pads
17894 \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}}
17895 \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}}
17896 \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}}
17897 \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}}
17898 % top side pads
17899 \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}}
17900 \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}}
17901 \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}}
17902 \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}}
17903 \else
17904 % left side pins
17905 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17906 \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}}
17907 % bottom side pins
17908 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
17909 \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}}
17910 % right side pins
17911 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
17912 \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}}
17913 % top side pins
17914 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
17915 \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}}
17916 \fi
17917 \advance\pgf@circ@count@a-1\relax%
17918 \repeatpgfmathloop
17919 \pgfusepath{stroke}
17920 \endpgfscope
17921 \fi
17922 }%
17923 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
17924 % and is executed just before a node is drawn.
17925 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
17926 % Start with the maximum pin number and go backwards.
17927 \pgf@circ@count@a=\numpins%
17928 \pgfmathloop%
17929 \ifnum\pgf@circ@count@a>0
17930 \expandafter\xdef\csname pgf@anchor@qfpchip@pin\space\the\pgf@circ@count@a\endcsname{%
17931 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{1}%
17932 }
17933 \expandafter\xdef\csname pgf@anchor@qfpchip@bpin\space\the\pgf@circ@count@a\endcsname{%
17934 \noexpand\pgf@circ@qfppinanchor{\the\pgf@circ@count@a}{0}%
17935 }
17936 \advance\pgf@circ@count@a-1\relax%
17937 \repeatpgfmathloop%
17938 }%
17939 }
17940
17941 %% anchors for DIP
17942 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
17943 \c@pgf@countc=\numpins\relax
17944 \divide\c@pgf@countc by 2
17945 \ifnum #1 > \the\c@pgf@countc
17946 % right side
17947 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
17948 \else
17949 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
17950 \fi
17951 }
17952
17953 %% anchors for QFP
17954 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
17955 \c@pgf@countc=\numpins\relax
17956 \divide\c@pgf@countc by 4
17957 \ifnum #1 > \the\c@pgf@countc
17958 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
17959 \ifnum #1 > \the\c@pgf@countb
17960 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
17961 \ifnum #1 > \the\c@pgf@countb
17962 % 3*npins/4 < pin, top side
17963 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
17964 \else
17965 % 2*npins/4 < pin <= 3*npins/4, right side
17966 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
17967 \fi
17968 \else
17969 % npins/4 < pin <= 2*npins/4, bottom side
17970 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
17971 \fi
17972 \else
17973 % <= npins/4, left side
17974 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
17975 \fi
17976 }
17977
17978 %%%%%%%%%%%%%%%%%
17979 %% Rotary Switch
17980 %%%%%%%%%%%%%%%%%
17981
17982 \pgfdeclareshape{rotaryswitch}
17983 {
17984 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
17985 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
17986 \savedanchor\northeast{%
17987 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17988 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
17989 % the magic number is 0.25/cos(35)
17990 % try to recalculate it for the actual switch
17991 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
17992 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
17993 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
17994 \edef\r{\ctikzvalof{nodes width}}
17995 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
17996 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
17997 }
17998 \savedanchor\northwest{%
17999 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18000 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
18001 % the magic number is 0.25/cos(35)
18002 % try to recalculate it for the actual switch
18003 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
18004 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
18005 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
18006 \edef\r{\ctikzvalof{nodes width}}
18007 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
18008 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
18009 }
18010 \savedanchor\central{%
18011 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18012 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
18013 % the magic number is 0.25/cos(35)
18014 % try to recalculate it for the actual switch
18015 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
18016 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
18017 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
18018 \edef\r{\ctikzvalof{nodes width}}
18019 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
18020 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
18021 }
18022 % external square limits
18023 \savedanchor\extnorthwest{%
18024 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18025 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
18026 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
18027 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
18028 \pgf@x=2.5\pgf@x % external square size
18029 \pgf@y=-\pgf@x %square thing when angle=180?
18030 }
18031 \saveddimen{\width}{
18032 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18033 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
18034 % radius of the connector
18035 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
18036 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
18037 % shapename
18038 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
18039 % shape type
18040 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
18041 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
18042 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
18043 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
18044 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
18045 % mid of the lever, to stack switches
18046 %\anchor{mid}{\midlever}
18047 \anchor{mid}{\northwest
18048 \pgf@circ@res@temp=-\pgf@x
18049 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
18050 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
18051 }
18052 % center anchors
18053 \anchor{cin}{ \northwest \pgf@y=0pt\advance\pgf@x by \radius}
18054 % horizontal angles
18055 \anchor{in}{ \northwest \pgf@y=0pt}
18056 \anchor{ain}{ \northwest \pgf@y=0pt}
18057
18058 \anchor{center}{ \central \pgf@y=0pt }
18059 \anchor{east}{ \northeast \pgf@y=0pt }
18060 \anchor{west}{ \northwest \pgf@y=0pt }
18061 \anchor{south}{ \central \pgf@y=-\pgf@y }
18062 \anchor{north}{ \central }
18063 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18064 \anchor{north east}{ \northeast }
18065 \anchor{north west}{ \northwest }
18066 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
18067
18068 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
18069 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
18070 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
18071 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
18072 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
18073 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
18074 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
18075 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
18076 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
18077
18078 \backgroundpath{
18079 \pgfsetcolor{\ctikzvalof{color}}
18080 \pgf@circ@res@right = \width
18081 \pgf@circ@res@left = -\width
18082
18083 \pgfscope %wiper
18084 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
18085 \pgf@circ@res@temp=\radius\relax
18086 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
18087 \pgfsetlinewidth{2\pgf@circ@res@temp}
18088 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
18089 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
18090 \pgfsetroundcap\pgfusepath{draw}
18091 \endpgfscope
18092
18093 \ifpgf@circ@rotaryarrow
18094 \pgfscope % arrow
18095 \ifpgf@circ@rotaryarrow@ccw\pgfsetarrowsstart{latexslim}\fi
18096 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
18097 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
18098 \pgftransformrotate{\wiper}
18099 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
18100 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
18101 \ifpgf@circ@rotaryarrow@cw\pgfsetarrowsend{latexslim}\fi
18102 \pgfusepath{draw}
18103 \endpgfscope
18104 \fi
18105
18106 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
18107 \pgf@circ@count@a=\channels\relax
18108 \pgfmathsetmacro{\currenta}{-\angle}
18109 \pgfmathloop%
18110 \ifnum\pgf@circ@count@a>0
18111 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
18112 \pgfscope
18113 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
18114 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
18115 \endpgfscope
18116 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
18117 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
18118 \advance\pgf@circ@count@a by -1\relax%
18119 \repeatpgfmathloop
18120
18121 \pgfscope % input
18122 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
18123 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
18124 \endpgfscope
18125 }
18126 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
18127 % and is executed just before a node is drawn.
18128 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
18129 % Start with the maximum pin number and go backwards.
18130 \pgf@circ@count@a=\channels\relax
18131 \pgfmathloop%
18132 \ifnum\pgf@circ@count@a>0
18133 % we will create two anchors per pin: the "normal one" like `pin 1` for the
18134 % electrical contact, and the "border one" like `bpin 1` for labels.
18135 % they will coincide if `external pins width` is set to 0.
18136 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
18137 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
18138 }
18139 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
18140 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
18141 }
18142 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
18143 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
18144 }
18145 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
18146 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}{0}%
18147 }
18148 \advance\pgf@circ@count@a by -1\relax%
18149 \repeatpgfmathloop%
18150 }%
18151 }
18152
18153 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
18154 \pgf@circ@res@temp=\width
18155 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
18156 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
18157 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
18158 \advance\pgf@x by -\pgf@circ@res@temp
18159 }
18160
18161 \def\pgf@circ@rotarysqanchor#1{% external square anchors
18162 \pgf@circ@res@temp=\width
18163 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
18164 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
18165 \advance\pgf@x by -\pgf@circ@res@temp
18166 }
18167
18168 %%%%%%%%%%%%%%%%%%%%%%%%%%
18169 % Seven segments displays
18170 %%%%%%%%%%%%%%%%%%%%%%%%%%
18171
18172 \pgfdeclareshape{bare7seg}{
18173 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
18174 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18175 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
18176 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
18177 \ifpgf@circ@sevenseg@dot
18178 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
18179 \else
18180 \pgf@x=0pt
18181 \fi
18182 }
18183 % The object extension is more or less (-width/2,-width) to (width/2,width)
18184 % and adjusted for line thickness (both sides) and eventually the dot
18185 \saveddimen{\width}{
18186 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18187 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
18188 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
18189 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
18190 \savedanchor{\southwest}{% both negative
18191 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18192 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
18193 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
18194 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
18195 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
18196 }
18197 \savedanchor{\northeast}{% both positive
18198 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18199 \ifpgf@circ@sevenseg@dot
18200 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
18201 \else
18202 \pgf@circ@res@other=0pt
18203 \fi
18204 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
18205 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
18206 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
18207 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
18208 }
18209 \savedanchor{\topright}{% anchor without the box sep and the thickness
18210 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18211 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
18212 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
18213 }
18214 \anchor{center}{\pgfpointorigin}
18215 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
18216 \anchor{north east}{\northeast}
18217 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
18218 \anchor{south west}{\southwest}
18219 \anchor{north}{\northeast\pgf@x=0pt}
18220 \anchor{east}{\northeast\pgf@y=0pt}
18221 \anchor{south}{\southwest\pgf@x=0pt}
18222 \anchor{west}{\southwest\pgf@y=0pt}
18223 \anchor{a}{\topright\pgf@x=0pt}
18224 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
18225 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
18226 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
18227 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
18228 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
18229 \anchor{g}{\pgfpointorigin}
18230 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
18231 \behindbackgroundpath{%
18232 \southwest % I do not want the dot here, it will stick out
18233 \pgf@circ@res@up = -\pgf@y
18234 \pgf@circ@res@down = \pgf@y
18235 \pgf@circ@res@right = \pgf@x
18236 \pgf@circ@res@left = -\pgf@x
18237 \pgfscope
18238 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
18239 \pgfsetcolor{\ctikzvalof{color}}
18240 \pgfpathrectanglecorners%
18241 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
18242 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
18243 \ifpgf@circ@sevenseg@box
18244 \pgf@circ@draworfill
18245 \else
18246 \pgf@circ@maybefill
18247 \fi
18248 \endpgfscope
18249 \edef\bits{\ctikzvalof{seven seg/bits}}
18250 \pgfscope
18251 \pfg@circ@sseg@drawbits{\bits}
18252 \endpgfscope
18253 \pgfscope
18254 \ifpgf@circ@sevenseg@dot
18255 \pgf@circ@sseg@drawdots
18256 \fi
18257 \endpgfscope
18258 }
18259 }
18260
18261 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
18262 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
18263 }
18264 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
18265 \ifnum #1 > 0\relax
18266 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
18267 \else
18268 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
18269 \fi
18270 \pgfpathmoveto{\pgfpoint{#2}{#3}}
18271 \pgfpathlineto{\pgfpoint{#4}{#5}}
18272 \pgfusepath{draw}
18273 }
18274 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
18275 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
18276 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
18277 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
18278 % \pgfsetroundcap
18279 \pgfsetarrowsstart{Triangle Cap[]}
18280 \pgfsetarrowsend{Triangle Cap[]}
18281 % segments
18282 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
18283 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
18284 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
18285 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
18286 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
18287 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
18288 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
18289 }
18290 \def\pgf@circ@sseg@drawdots{% dots
18291 \edef\what{empty}
18292 \ifx\what\pgf@circ@sevenseg@dotstate
18293 % do nothing
18294 \else
18295 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
18296 \edef\what{off}
18297 \ifx\what\pgf@circ@sevenseg@dotstate
18298 % dot off
18299 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
18300 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
18301 \else
18302 % dot on
18303 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
18304 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
18305 \fi
18306 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
18307 \pgfusepath{draw,fill}
18308 \fi
18309 }
18310
18311
18312 %%%%%%
18313 %%%%%% Flip-flops
18314 %%%%%%
18315
18316 % Flip flops are a specialized kind of dipchip.
18317 % they have a class by themselves
18318
18319 %% flip flop definitions --- by default empty
18320 %% pin texts
18321 \ctikzset{multipoles/flipflop/t1/.initial={}}
18322 \ctikzset{multipoles/flipflop/t2/.initial={}}
18323 \ctikzset{multipoles/flipflop/t3/.initial={}}
18324 \ctikzset{multipoles/flipflop/t4/.initial={}}
18325 \ctikzset{multipoles/flipflop/t5/.initial={}}
18326 \ctikzset{multipoles/flipflop/t6/.initial={}}
18327 \ctikzset{multipoles/flipflop/tu/.initial={}}
18328 \ctikzset{multipoles/flipflop/td/.initial={}}
18329 % pin clock wedge flags
18330 \ctikzset{multipoles/flipflop/c1/.initial={0}}
18331 \ctikzset{multipoles/flipflop/c2/.initial={0}}
18332 \ctikzset{multipoles/flipflop/c3/.initial={0}}
18333 \ctikzset{multipoles/flipflop/c4/.initial={0}}
18334 \ctikzset{multipoles/flipflop/c5/.initial={0}}
18335 \ctikzset{multipoles/flipflop/c6/.initial={0}}
18336 \ctikzset{multipoles/flipflop/cu/.initial={0}}
18337 \ctikzset{multipoles/flipflop/cd/.initial={0}}
18338 % pin negation circle flags
18339 \ctikzset{multipoles/flipflop/n1/.initial={0}}
18340 \ctikzset{multipoles/flipflop/n2/.initial={0}}
18341 \ctikzset{multipoles/flipflop/n3/.initial={0}}
18342 \ctikzset{multipoles/flipflop/n4/.initial={0}}
18343 \ctikzset{multipoles/flipflop/n5/.initial={0}}
18344 \ctikzset{multipoles/flipflop/n6/.initial={0}}
18345 \ctikzset{multipoles/flipflop/nu/.initial={0}}
18346 \ctikzset{multipoles/flipflop/nd/.initial={0}}
18347
18348
18349 % Thanks to @marmot
18350 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
18351
18352 % default set of flip flops
18353 \tikzset{
18354 % async
18355 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
18356 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
18357 % sync
18358 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
18359 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
18360 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
18361 % additional features
18362 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
18363 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
18364 }
18365
18366 %
18367 % commodity macro to draw the clock wedges. They leave the size of the
18368 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
18369 %
18370 \def\pgf@circ@do@wedge@left{
18371 \pgf@circ@res@temp=0pt\relax
18372 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
18373 \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}}
18374 \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}}
18375 \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}}
18376 \pgfusepath{stroke}
18377 \pgf@circ@res@temp=\wedge
18378 \fi
18379 }
18380 \def\pgf@circ@do@wedge@right{
18381 \pgf@circ@res@temp=0pt\relax
18382 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
18383 \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}}
18384 \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}}
18385 \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}}
18386 \pgfusepath{stroke}
18387 \pgf@circ@res@temp=-\wedge
18388 \fi
18389 }
18390 \def\pgf@circ@do@wedge@up{
18391 \pgf@circ@res@temp=0pt\relax
18392 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
18393 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
18394 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
18395 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
18396 \pgfusepath{stroke}
18397 \pgf@circ@res@temp=-\wedge
18398 \fi
18399 }
18400 \def\pgf@circ@do@wedge@down{
18401 \pgf@circ@res@temp=0pt\relax
18402 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
18403 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
18404 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
18405 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
18406 \pgfusepath{stroke}
18407 \pgf@circ@res@temp=\wedge
18408 \fi
18409 }
18410 % generic flip-flop shape
18411 \pgfdeclareshape{flipflop}{
18412 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
18413 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18414 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
18415 \savedmacro\numpins{\def\numpins{6}}
18416 \savedanchor\centerpoint{%
18417 \pgf@x=-.5\wd\pgfnodeparttextbox%
18418 \pgf@y=-.5\ht\pgfnodeparttextbox%
18419 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
18420 }%
18421 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
18422 \anchor{center}{\origin}
18423 \anchor{text}{\centerpoint}% to adjust text
18424 \saveddimen\height{%
18425 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18426 \pgfmathsetlength\pgf@x{((\numpins)
18427 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
18428 }%
18429 \saveddimen{\chipspacing}{
18430 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18431 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
18432 \saveddimen{\width}{
18433 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18434 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
18435 \saveddimen{\extshift}{
18436 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18437 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
18438 % standard anchors
18439 \savedanchor\northwest{%
18440 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18441 \pgfmathsetlength\pgf@y{0.5*((\numpins)
18442 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
18443 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
18444 }
18445 \anchor{dot}{\northwest
18446 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
18447 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
18448 }
18449 \anchor{nw}{\northwest}
18450 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
18451 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18452 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
18453 \anchor{north west}{\northwest}
18454 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
18455 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
18456 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
18457 \anchor{n}{\northwest\pgf@x=0pt }
18458 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18459 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18460 \anchor{w}{\northwest\pgf@y=0pt }
18461 \anchor{north}{\northwest\pgf@x=0pt }
18462 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18463 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18464 \anchor{west}{\northwest\pgf@y=0pt }
18465 % upper and lower pin
18466 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
18467 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
18468 \anchor{bup}{\northwest\pgf@x=0pt }
18469 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18470 % start drawing
18471 \backgroundpath{%
18472 \northwest
18473 \pgf@circ@res@up = \pgf@y
18474 \pgf@circ@res@down = -\pgf@y
18475 \pgf@circ@res@right = -\pgf@x
18476 \pgf@circ@res@left = \pgf@x
18477 \pgf@circ@scaled@Rlen=\scaledRlen
18478 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
18479 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
18480 \pgfsetcolor{\ctikzvalof{color}}
18481 \pgfscope% (for the line width)
18482 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
18483 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
18484 \pgf@circ@draworfill
18485 \pgfusepath{stroke}%
18486 \endpgfscope
18487 % Adding the pin number
18488 \pgf@circ@count@a=\numpins\relax
18489 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
18490 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
18491 \ifpgf@circuit@chip@straightnumbers
18492 \pgfgettransformentries\a\b\temp\temp\temp\temp
18493 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
18494 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
18495 \else
18496 \pgfmathsetmacro{\rot}{0}
18497 \pgfmathsetmacro{\quadrant}{0}
18498 \fi
18499 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
18500 % text
18501 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
18502 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
18503 \pgf@circ@strut\space}
18504 % \typeout{TEXT\space\mytext}
18505 \pgfmathloop%
18506 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
18507 \pgf@circ@res@temp=0pt\relax
18508 \ifnum\pgf@circ@count@a>0
18509 \ifcase\quadrant % rotation 0
18510 % left
18511 \pgf@circ@count@c=\pgf@circ@count@a
18512 \pgf@circ@do@wedge@left
18513 % \typeout{TEXT Left Q1\space\mytext}
18514 \pgftext[left,
18515 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},
18516 rotate=\rot]{\mytext}
18517 % right
18518 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18519 \pgf@circ@do@wedge@right
18520 \pgftext[right,
18521 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},
18522 rotate=\rot]{\mytext}
18523 \or % rotation -90
18524 % left
18525 \pgf@circ@count@c=\pgf@circ@count@a
18526 \pgf@circ@do@wedge@left
18527 \pgftext[top,
18528 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},
18529 rotate=\rot]{\mytext}
18530 % right
18531 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18532 \pgf@circ@do@wedge@right
18533 \pgftext[bottom,
18534 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},
18535 rotate=\rot]{\mytext}
18536 \or %rotation 180
18537 % left
18538 \pgf@circ@count@c=\pgf@circ@count@a
18539 \pgf@circ@do@wedge@left
18540 \pgftext[right,
18541 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},
18542 rotate=\rot]{\mytext}
18543 % right
18544 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18545 \pgf@circ@do@wedge@right
18546 \pgftext[left,
18547 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},
18548 rotate=\rot]{\mytext}
18549 \or % rotation +90
18550 % left
18551 \pgf@circ@count@c=\pgf@circ@count@a
18552 \pgf@circ@do@wedge@left
18553 \pgftext[bottom,
18554 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},
18555 rotate=\rot]{\mytext}
18556 % right
18557 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18558 \pgf@circ@do@wedge@right
18559 \pgftext[top,
18560 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},
18561 rotate=\rot]{\mytext}
18562 \fi
18563 \advance\pgf@circ@count@a-1\relax%
18564 \repeatpgfmathloop
18565 % Now the up and down text
18566 % up
18567 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
18568 \pgf@circ@do@wedge@up
18569 \ifcase\quadrant % rotation 0
18570 \pgftext[top,
18571 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
18572 rotate=\rot]{\mytext}
18573 \or % rotation -90
18574 \pgftext[right,
18575 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
18576 rotate=\rot]{\mytext}
18577 \or %rotation 180
18578 \pgftext[bottom,
18579 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
18580 rotate=\rot]{\mytext}
18581 \or % rotation +90
18582 \pgftext[left,
18583 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
18584 rotate=\rot]{\mytext}
18585 \fi
18586 % down
18587 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
18588 \pgf@circ@do@wedge@down
18589 \ifcase\quadrant % rotation 0
18590 \pgftext[bottom,
18591 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
18592 rotate=\rot]{\mytext}
18593 \or % rotation -90
18594 \pgftext[left,
18595 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
18596 rotate=\rot]{\mytext}
18597 \or %rotation 180
18598 \pgftext[top,
18599 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
18600 rotate=\rot]{\mytext}
18601 \or % rotation +90
18602 \pgftext[right,
18603 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
18604 rotate=\rot]{\mytext}
18605 \fi
18606 % external pins
18607 \ifdim\pgf@circ@res@other>0pt
18608 \pgfscope
18609 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
18610 \pgf@circ@count@a=\numpins\relax
18611 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
18612 \pgfmathloop%
18613 \ifnum\pgf@circ@count@a>0
18614 % left side pins
18615 \pgf@circ@count@c=\pgf@circ@count@a
18616 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
18617 %% Or'ing tests in core TeX is tough
18618 \edef\@@or{0}
18619 % Just expand the key the minimum needed
18620 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
18621 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
18622 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
18623 \ifnum\@@tmp>0\edef\@@or{1}\fi
18624 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
18625 \ifnum\@@tmp>0\edef\@@or{1}\fi
18626 \ifnum\@@or>0
18627 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18628 \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}}
18629 \pgfusepath{stroke}
18630 \fi
18631 % right side pins
18632 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18633 \edef\@@or{0}
18634 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
18635 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
18636 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
18637 \ifnum\@@tmp>0\edef\@@or{1}\fi
18638 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
18639 \ifnum\@@tmp>0\edef\@@or{1}\fi
18640 % \typeout{TEST\space\@@tmp\space\@@x}
18641 \ifnum\@@or>0
18642 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18643 \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}}
18644 \pgfusepath{stroke}
18645 \fi
18646 \advance\pgf@circ@count@a by -1\relax%
18647 \repeatpgfmathloop
18648 % up side
18649 \edef\@@or{0}
18650 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
18651 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
18652 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
18653 \ifnum\@@tmp>0\edef\@@or{1}\fi
18654 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
18655 \ifnum\@@tmp>0\edef\@@or{1}\fi
18656 % \typeout{TEST\space\@@tmp\space\@@x}
18657 \ifnum\@@or>0
18658 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18659 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
18660 \pgfusepath{stroke}
18661 \fi
18662 % down side
18663 \edef\@@or{0}
18664 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
18665 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
18666 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
18667 \ifnum\@@tmp>0\edef\@@or{1}\fi
18668 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
18669 \ifnum\@@tmp>0\edef\@@or{1}\fi
18670 % \typeout{TEST\space\@@tmp\space\@@x}
18671 \ifnum\@@or>0
18672 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
18673 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
18674 \pgfusepath{stroke}
18675 \fi
18676 \endpgfscope
18677 \fi % external pin width >0
18678 %
18679 % draw "inverting" circles on outputs, they must be last
18680 %
18681 \pgfscope
18682 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
18683 \pgf@circ@count@a=\numpins\relax
18684 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
18685 \pgfmathloop%
18686 \ifnum\pgf@circ@count@a>0
18687 % left side pins
18688 \pgf@circ@count@c=\pgf@circ@count@a
18689 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
18690 \ifnum\@@tmp>0\pgfscope
18691 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18692 \pgfnode{ocirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
18693 \endpgfscope\fi
18694 % right side pins
18695 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
18696 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
18697 \ifnum\@@tmp>0\pgfscope
18698 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
18699 \pgfnode{ocirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
18700 \endpgfscope\fi
18701 \advance\pgf@circ@count@a by -1\relax%
18702 \repeatpgfmathloop
18703 % up side
18704 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
18705 \ifnum\@@tmp>0\pgfscope
18706 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
18707 \pgfnode{ocirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
18708 \endpgfscope\fi
18709 % down side
18710 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
18711 \ifnum\@@tmp>0\pgfscope
18712 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
18713 \pgfnode{ocirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
18714 \endpgfscope\fi
18715 \endpgfscope
18716 }%
18717 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
18718 % and is executed just before a node is drawn.
18719 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
18720 % Start with the maximum pin number and go backwards.
18721 \pgf@circ@count@a=\numpins\relax
18722 \pgfmathloop%
18723 \ifnum\pgf@circ@count@a>0
18724 % we will create two anchors per pin: the "normal one" like `pin 1` for the
18725 % electrical contact, and the "border one" like `bpin 1` for labels.
18726 % they will coincide if `external pins width` is set to 0.
18727 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
18728 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
18729 }
18730 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
18731 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
18732 }
18733 \advance\pgf@circ@count@a by -1\relax%
18734 \repeatpgfmathloop%
18735 }%
18736 }
18737
18738 %
18739 % MUX-DEMUXES
18740 %
18741 % Thanks to @marmot
18742 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
18743 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
18744 \tikzset{one bit adder/.style={muxdemux,
18745 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
18746 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
18747 \tikzset{ALU/.style={muxdemux,
18748 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
18749 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
18750 %generic mux-demux shape
18751 \pgfdeclareshape{muxdemux}{
18752 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
18753 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18754 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
18755 % pins on the four sides
18756 % \savedmacro\NL{%
18757 % \pgf@circ@count@a=\ctikzvalof{multipoles/muxdemux/NL}%
18758 % \def\NL{\the\pgf@circ@count@a}
18759 % }
18760 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
18761 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
18762 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
18763 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
18764 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
18765 % topleft and topright sizes
18766 \savedanchor{\topleft}{%
18767 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18768 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
18769 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
18770 }
18771 \savedanchor{\topright}{%
18772 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18773 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
18774 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
18775 }
18776 \savedanchor{\insetnortheast}{%
18777 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18778 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
18779 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
18780 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
18781 }
18782 \saveddimen{\insethright}{
18783 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18784 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
18785 \saveddimen{\extshift}{
18786 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18787 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
18788 \savedanchor{\northwest}{%
18789 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18790 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
18791 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
18792 }
18793 \anchor{nw}{\northwest}
18794 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
18795 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
18796 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
18797 \anchor{north west}{\northwest}
18798 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
18799 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
18800 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
18801 \anchor{n}{\northwest\pgf@x=0pt }
18802 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18803 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18804 \anchor{w}{\northwest\pgf@y=0pt }
18805 \anchor{north}{\northwest\pgf@x=0pt }
18806 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
18807 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
18808 \anchor{west}{\northwest\pgf@y=0pt }
18809 \anchor{center}{\pgfpointorigin}
18810 \anchor{top right}{\topright}
18811 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
18812 \anchor{right}{\topright\pgf@y=0pt\relax}
18813 \anchor{top left}{\topleft}
18814 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
18815 \anchor{left}{\topleft\pgf@y=0pt\relax}
18816 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
18817 \divide\pgf@y by 2 \pgf@x=0pt\relax}
18818 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
18819 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
18820 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
18821 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
18822 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
18823 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
18824 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
18825 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
18826 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
18827 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
18828 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
18829 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
18830 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
18831 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
18832 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
18833 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
18834 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
18835 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
18836 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
18837 \divide\pgf@y by 2
18838 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
18839 \divide\pgf@y by 2 \pgf@x=0pt\relax}
18840 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
18841 \divide\pgf@y by 2
18842 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
18843 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
18844 \anchor{text}{%
18845 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18846 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
18847 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
18848 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
18849 \pgf@y=-.5\ht\pgfnodeparttextbox%
18850 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
18851 }%
18852 \backgroundpath{%
18853 \topleft
18854 \pgf@circ@res@up = \pgf@y
18855 \pgf@circ@res@down = -\pgf@y
18856 \pgf@circ@res@left = \pgf@x
18857 \topright
18858 \pgf@circ@res@other = \pgf@y
18859 \pgf@circ@res@right = \pgf@x
18860 \insetnortheast
18861 \pgf@circ@res@step = \pgf@x
18862 \pgf@circ@res@temp = \pgf@y
18863 %
18864 % external block
18865 %
18866 \pgfscope% (for the line width)
18867 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
18868 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
18869 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
18870 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
18871 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
18872 % inset, starting down
18873 \ifdim\pgf@circ@res@temp>0pt % inset
18874 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
18875 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
18876 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
18877 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
18878 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
18879 \fi
18880 \pgfpathclose
18881 \pgf@circ@draworfill
18882 \endpgfscope
18883 % now we have to draw the pins, if needed
18884 \ifdim\extshift>0pt\ifpgfcirc@draw@leads\pgfscope % let's avoid too much indent
18885 % Ok, we have to draw the leads (a.k.a. pins)
18886 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
18887 % We mimic the anchors here --- probably there is a better way
18888 % left pins
18889 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
18890 \pgf@circ@count@a=\NL\relax
18891 \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
18892 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
18893 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
18894 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
18895 % we have to check oddity
18896 \ifodd\NL
18897 \ifnum\NL=1
18898 % only centerpin, step should not be used, but anyway...
18899 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
18900 \else
18901 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
18902 \fi
18903 \else
18904 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
18905 \fi
18906 \else % no inset
18907 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
18908 \fi
18909 \pgfmathloop%
18910 \ifnum\pgf@circ@count@a>0
18911 %%%%%
18912 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
18913 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
18914 % for lower pins we have to shift them down
18915 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
18916 \ifodd\NL
18917 % odd number of pins
18918 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
18919 % centerpin!
18920 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18921 \ifnum\squarepins>0
18922 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
18923 \else
18924 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
18925 \fi
18926 \else
18927 \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}}
18928 \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}}
18929 \fi
18930 \else
18931 % even numer of pins: just go down
18932 \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}}
18933 \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}}
18934 \fi
18935 \else
18936 % nothing need for #1<=NL/2
18937 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18938 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18939 \fi
18940 \else
18941 % no inset
18942 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18943 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18944 \fi
18945 %%%%%
18946 \advance\pgf@circ@count@a by -1\relax%
18947 \repeatpgfmathloop\fi%
18948 % right pins
18949 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
18950 \pgfmathloop%
18951 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
18952 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
18953 \ifnum\pgf@circ@count@a>0
18954 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18955 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
18956 \advance\pgf@circ@count@a by -1\relax%
18957 \repeatpgfmathloop\fi%
18958 % bottom pins
18959 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
18960 \pgfmathloop%
18961 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
18962 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
18963 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
18964 \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}
18965 \ifnum\pgf@circ@count@a>0
18966 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18967 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
18968 \ifnum\squarepins>0
18969 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18970 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
18971 \else
18972 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18973 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
18974 \fi
18975 \advance\pgf@circ@count@a by -1\relax%
18976 \repeatpgfmathloop\fi%
18977 % top pins
18978 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
18979 \pgfmathloop%
18980 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
18981 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
18982 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
18983 \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}
18984 \ifnum\pgf@circ@count@a>0
18985 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18986 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
18987 \ifnum\squarepins>0
18988 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18989 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
18990 \else
18991 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
18992 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
18993 \fi
18994 \advance\pgf@circ@count@a by -1\relax%
18995 \repeatpgfmathloop\fi%
18996 % end drawing pins; stroke them
18997 \pgfusepath{stroke}
18998 \endpgfscope\fi\fi
18999 }
19000 % let's start adding anchors
19001 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
19002 % left side anchors
19003 \pgf@circ@count@a=\NL\relax
19004 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
19005 \pgfmathloop%
19006 \ifnum\pgf@circ@count@a>0
19007 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
19008 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
19009 % external leads, and the "border one" like `blpin 1` for internal ones.
19010 % they will coincide if `external pins width` is set to 0.
19011 \expandafter\xdef\csname pgf@anchor@muxdemux@lpin\space\the\pgf@circ@count@a\endcsname{%
19012 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{1}%
19013 }
19014 \expandafter\xdef\csname pgf@anchor@muxdemux@blpin\space\the\pgf@circ@count@a\endcsname{%
19015 \noexpand\pgf@circ@muxdemux@L@anchor{\the\pgf@circ@count@a}{0}%
19016 }
19017 \advance\pgf@circ@count@a by -1\relax%
19018 \repeatpgfmathloop%
19019 % right anchors
19020 \pgf@circ@count@a=\NR\relax
19021 \pgfmathloop%
19022 \ifnum\pgf@circ@count@a>0
19023 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
19024 % external leads, and the "border one" like `brpin 1` for internal ones.
19025 % they will coincide if `external pins width` is set to 0.
19026 \expandafter\xdef\csname pgf@anchor@muxdemux@rpin\space\the\pgf@circ@count@a\endcsname{%
19027 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{1}%
19028 }
19029 \expandafter\xdef\csname pgf@anchor@muxdemux@brpin\space\the\pgf@circ@count@a\endcsname{%
19030 \noexpand\pgf@circ@muxdemux@R@anchor{\the\pgf@circ@count@a}{0}%
19031 }
19032 \advance\pgf@circ@count@a by -1\relax%
19033 \repeatpgfmathloop%
19034 % bottom anchors
19035 \pgf@circ@count@a=\NB\relax
19036 \pgfmathloop%
19037 \ifnum\pgf@circ@count@a>0
19038 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
19039 % external leads, and the "border one" like `bbpin 1` for internal ones.
19040 % they will coincide if `external pins width` is set to 0.
19041 \expandafter\xdef\csname pgf@anchor@muxdemux@bpin\space\the\pgf@circ@count@a\endcsname{%
19042 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{1}%
19043 }
19044 \expandafter\xdef\csname pgf@anchor@muxdemux@bbpin\space\the\pgf@circ@count@a\endcsname{%
19045 \noexpand\pgf@circ@muxdemux@B@anchor{\the\pgf@circ@count@a}{0}%
19046 }
19047 \advance\pgf@circ@count@a by -1\relax%
19048 \repeatpgfmathloop%
19049 % top anchors
19050 \pgf@circ@count@a=\NT\relax
19051 \pgfmathloop%
19052 \ifnum\pgf@circ@count@a>0
19053 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
19054 % external leads, and the "border one" like `btpin 1` for internal ones.
19055 % they will coincide if `external pins width` is set to 0.
19056 \expandafter\xdef\csname pgf@anchor@muxdemux@tpin\space\the\pgf@circ@count@a\endcsname{%
19057 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{1}%
19058 }
19059 \expandafter\xdef\csname pgf@anchor@muxdemux@btpin\space\the\pgf@circ@count@a\endcsname{%
19060 \noexpand\pgf@circ@muxdemux@T@anchor{\the\pgf@circ@count@a}{0}%
19061 }
19062 \advance\pgf@circ@count@a by -1\relax%
19063 \repeatpgfmathloop%
19064 }%
19065 }
19066
19067 %% left anchors for muxdemux
19068
19069 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
19070 \topleft
19071 \pgf@xa=\pgf@x
19072 \pgf@ya=\pgf@y
19073 \insetnortheast
19074 \pgf@xb=\pgf@x
19075 \pgf@yb=\pgf@y
19076 \ifnum#1>\NL
19077 \PackageError{circuitikz}{%
19078 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
19079 which has been defined with \NL\space left pins%
19080 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
19081 \fi
19082 \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
19083 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
19084 \ifnum\NL>1
19085 \ifdim\pgf@yb>0pt % check if we have an inset
19086 % we have to check oddity
19087 \ifodd\NL
19088 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
19089 \else
19090 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
19091 \fi
19092 \else % no inset
19093 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
19094 \fi
19095 \ifdim\pgf@yb>0pt % check if we have an inset
19096 \ifnum#1>\pgf@circ@count@a\relax
19097 % for lower pins we have to shift them down
19098 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
19099 \ifodd\NL
19100 % odd number of pins
19101 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
19102 % centerpin!
19103 \ifnum#2=0\relax
19104 \pgfpoint{\pgf@xb}{0pt}
19105 \else
19106 \ifnum\squarepins>0
19107 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
19108 \else
19109 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
19110 \fi
19111 \fi
19112 \else
19113 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
19114 \fi
19115 \else
19116 % even numer of pins: just go down
19117 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
19118 \fi
19119 \else
19120 % nothing need for #1<=NL/2
19121 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
19122 \fi
19123 \else
19124 % no inset
19125 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
19126 \fi
19127 \else
19128 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
19129 \fi
19130 }
19131
19132 % right anchors
19133 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
19134 \topright
19135 \pgf@xa=\pgf@x
19136 \pgf@ya=\pgf@y
19137 \ifnum#1>\NR
19138 \PackageError{circuitikz}{%
19139 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
19140 which has been defined with \NR\space right pins%
19141 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
19142 \fi
19143 \ifnum\NR>1
19144 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
19145 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
19146 \else
19147 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
19148 \fi
19149 }
19150
19151 % bottom anchors
19152 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
19153 \topleft
19154 \pgf@xa=\pgf@x
19155 \pgf@ya=\pgf@y
19156 \topright
19157 \pgf@xb=\pgf@x
19158 \pgf@yb=\pgf@y
19159 \ifnum#1>\NB
19160 \PackageError{circuitikz}{%
19161 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
19162 which has been defined with \NB\space bottom pins%
19163 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
19164 \fi
19165 \ifnum\NB>0
19166 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
19167 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
19168 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
19169 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
19170 \ifnum#2=0\relax
19171 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
19172 \else
19173 \ifnum\squarepins>0\relax
19174 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
19175 \else
19176 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
19177 \fi
19178 \fi
19179 \else
19180 % should not happen, give the same as pin 1 anyway
19181 \ifnum#2=0\relax
19182 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
19183 \else
19184 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
19185 \fi
19186 \fi
19187 }
19188
19189 % top anchors
19190 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
19191 \topleft
19192 \pgf@xa=\pgf@x
19193 \pgf@ya=\pgf@y
19194 \topright
19195 \pgf@xb=\pgf@x
19196 \pgf@yb=\pgf@y
19197 \ifnum#1>\NT
19198 \PackageError{circuitikz}{%
19199 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
19200 which has been defined with \NT\space top pins%
19201 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
19202 \fi
19203 \ifnum\NT>0
19204 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
19205 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
19206 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
19207 \ifnum#2=0\relax
19208 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
19209 \else
19210 \ifnum\squarepins>0
19211 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
19212 \else
19213 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
19214 \fi
19215 \fi
19216 \else
19217 % should not happen, give the same as pin 1 anyway
19218 \ifnum#2=0\relax
19219 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
19220 \else
19221 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
19222 \fi
19223 \fi
19224 }
19225
19226 %% IEEE standard logic ports module
19227 %%
19228 %% Original multi-input code from John Kormylo at tex.stackexchange.com
19229 %% Help by TheTeXnician <[email protected]>
19230 %% Suggested idea and example code by Jason Sachs <[email protected]>
19231 %% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
19232 %% Most of the code, all errors and bugs by Romano Giannetti <[email protected]>
19233 %% Everything is in the same place here --- more or less; first step to move towards
19234 %% a module interface for circutikz
19235 %%
19236
19237 % base parameters for ieeestd ports.
19238
19239 \ctikzset{ieeestd ports/.is family}
19240 % baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
19241 % the value of 0.4 is the standard pin distance for a port with height=num pins
19242 % and matches the chip distance
19243 \ctikzset{ieeestd ports/baselen/.initial=0.4}
19244 % these are in term of baselen; width depends on height (fixed proportions)
19245 \ctikzset{ieeestd ports/height/.initial=2}
19246 \ctikzset{ieeestd ports/pin length/.initial=0.7}
19247 % the standard "not" circle should be 1/6.5 of height (diameter);
19248 % so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
19249 \ctikzset{ieeestd ports/not radius/.initial=0.154}
19250 \ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
19251 % the suggested xnor distance is is 1.24, so 1.25/3.25/2
19252 % xor/xnor leads go full in in IEEE; let this be optional
19253 \ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
19254 \ctikzset{ieeestd ports/xor leads in/.initial=1}%
19255 %
19256 % base size of a small external schmitt symbol
19257 %
19258 \ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
19259 %
19260 % input management
19261 % we are using the same /tikz/number inputs than the legacy ports
19262 %
19263 \tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
19264 %
19265 % integrate with the other logic ports
19266 %
19267 \ctikzset{logic ports/ieee/.code= {\pgf@circuit@europeanlogicportfalse
19268 \tikzset{and port/.style={shape=ieeestd and port}}%
19269 \tikzset{or port/.style={shape=ieeestd or port}}%
19270 \tikzset{xor port/.style={shape=ieeestd xor port}}%
19271 \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
19272 \tikzset{not port/.style={shape=ieeestd not port}}%
19273 \tikzset{nand port/.style={shape=ieeestd nand port}}%
19274 \tikzset{nor port/.style={shape=ieeestd nor port}}%
19275 \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
19276 \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
19277 \tikzset{inv schmitt port/.style={shape=ieeestd schmitt port}}%
19278 }}
19279 \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
19280 %
19281 % the base angle for the or port. See the drawings. This will not change with height
19282 %
19283 \pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
19284 % \typeout{ANGLE-IS\space\pgf@circ@orangle}
19285 \def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
19286 {%
19287 \ifnum#1>\inputs
19288 \PackageError{circuitikz}{%
19289 You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
19290 which has been defined with \inputs\space pins%
19291 }{Please check the manual about logic ports; if you press return I'll try to continue}
19292 \fi
19293 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
19294 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
19295 \pgf@circ@res@step=\pind
19296 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
19297 \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
19298 }%
19299
19300 % #1 = \pgfmathcounter #2=type
19301 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
19302 \def\pgf@circ@ieeeport@baseinput#1#2%
19303 {%
19304 \ifnum#1>\inputs
19305 \PackageError{circuitikz}{%
19306 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
19307 which has been defined with \inputs\space pins%
19308 }{Please check the manual about logic ports; if you press return I'll try to continue}
19309 \fi
19310 % Find the vertical position (this is the same for any port)
19311 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
19312 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
19313 % rack (extended) pins; they are the same for all the ports
19314 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
19315 % above: 1..K (included)
19316 % below: inputs-K..inputs
19317 % Find the pins on the rack; they are 1...
19318 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
19319 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
19320 % border anchors for rack should be ok
19321 \pgfextractx{\pgf@circ@res@left}{\topleft}
19322 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
19323 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
19324 % we have finished if we are in the rack
19325 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
19326 % we are on the inner ports; we have to do the hard work here
19327 % and and nand
19328 \ifnum #2=1
19329 \relax % It's an and/nand, all border ports are on the rack line
19330 \fi
19331 % or and nor
19332 \ifnum #2=2
19333 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
19334 \fi
19335 % xor and xnor
19336 \ifnum #2=3\relax
19337 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
19338 \fi
19339 \fi\fi
19340 }%
19341 % inner base ports for xor types port
19342 % #1 = \pgfmathcounter #2=type
19343 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
19344 \def\pgf@circ@ieeeport@innerbaseinput#1%
19345 {%
19346 \ifnum#1>\inputs
19347 \PackageError{circuitikz}{%
19348 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
19349 which has been defined with \inputs\space pins%
19350 }{Please check the manual about logic ports; if you press return I'll try to continue}
19351 \fi
19352 % Find the vertical position (this is the same for any port)
19353 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
19354 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
19355 % rack (extended) pins; they are the same for all the ports
19356 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
19357 % above: 1..K (included)
19358 % below: inputs-K..inputs
19359 % Find the pins on the rack; they are 1...
19360 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
19361 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
19362 % border anchors for rack should be ok
19363 \pgfextractx{\pgf@circ@res@left}{\topleft}
19364 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
19365 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
19366 % we have finished if we are in the rack
19367 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
19368 % we are on the inner ports; we have to do the hard work here
19369 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
19370 \fi\fi
19371 }%
19372
19373 %%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
19374 \def\pgf@circ@ieeestd@baselen{%
19375 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
19376 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
19377 }
19378 \def\pgf@circ@ieeestd@stdH{%
19379 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
19380 \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
19381 \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
19382 }
19383 \def\pgf@circ@ieeestd@pinlen{%
19384 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
19385 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
19386 \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
19387 }
19388 \def\pgf@circ@ieeestd@xorbar{%
19389 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
19390 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
19391 \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
19392 }
19393 %% Not circle
19394 \def\pgf@circ@notradius{
19395 \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
19396 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
19397 % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
19398 }
19399 %% Find (in ...@other) the height of the rack
19400 \def\pgf@circ@findrackH{%
19401 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
19402 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
19403 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
19404 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
19405 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
19406 \pgf@circ@ieeestd@stdH
19407 \multiply\pgf@circ@res@temp by 2\relax% full height
19408 \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
19409 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
19410 % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
19411 }
19412 %%
19413 \def\pgf@circ@find@ieeeport@up{% leave it in up
19414 % Normal port limits
19415 \pgf@circ@ieeestd@stdH
19416 \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
19417 % rack top size
19418 \pgf@circ@findrackH
19419 \ifdim\pgf@circ@res@other > \pgf@circ@res@up
19420 \pgf@circ@res@up=\pgf@circ@res@other
19421 \else
19422 \fi
19423 }
19424 \def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
19425 % Normal port limits
19426 \pgf@circ@ieeestd@stdH
19427 \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
19428 \pgf@circ@res@right=\pgf@circ@res@left % save the border value
19429 \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
19430 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
19431 % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19432 % this is the normal left border
19433 % For the or or xor port, the limit can be the pointy thing (in case the
19434 % pinlen is zero or too small)
19435 % add to the body margin the or/nor peak:
19436 \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
19437 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
19438 \advance\pgf@circ@res@right by \pgf@circ@res@other
19439 % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19440 \fi
19441 % add to the body margin the xor/xnor distance
19442 \ifnum #1 = 3\relax% "xor" or "xnor" gates.
19443 \pgf@circ@ieeestd@xorbar
19444 \advance\pgf@circ@res@right by \pgf@circ@res@temp
19445 % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19446 \fi
19447 % and if this exceeds the normal margin, this is it
19448 % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19449 \ifdim \pgf@circ@res@right > \pgf@circ@res@left
19450 \pgf@circ@res@left=\pgf@circ@res@right
19451 \fi
19452 % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
19453 \pgf@circ@res@left=-\pgf@circ@res@left
19454 }
19455 \def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
19456 % Normal port limits
19457 \pgf@circ@ieeestd@stdH
19458 \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
19459 \pgf@circ@notradius
19460 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
19461 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
19462 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
19463 \pgf@circ@res@right=\pgf@circ@res@other
19464 \fi
19465 }
19466 \def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
19467 % Normal port limits
19468 \pgf@circ@ieeestd@stdH
19469 % notice 0.8660254 is cos(30)
19470 \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
19471 \pgf@circ@notradius
19472 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
19473 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
19474 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
19475 \pgf@circ@res@right=\pgf@circ@res@other
19476 \fi
19477 }
19478
19479
19480 %%% ieeestd multi-input ports
19481 %%% #1: name
19482 %%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
19483 %%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
19484 %%% #4: drawing for the port
19485 \long\def\pgfcircdeclareieeeport#1#2#3#4{%
19486 \pgfdeclareshape{ieeestd #1 port}%
19487 {%
19488 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
19489 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19490 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
19491 \saveddimen{\baselen}{%
19492 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
19493 }
19494 \saveddimen{\stdH}{% This is HALF the height of the inner port
19495 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
19496 }
19497 \saveddimen{\notdiameter}{
19498 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
19499 }
19500 \saveddimen{\pind}{% pin distance;
19501 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
19502 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
19503 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
19504 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
19505 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
19506 \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
19507 \divide\pgf@x by \pgf@circ@count@b
19508 }
19509 \saveddimen{\pinlen}{%
19510 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
19511 }
19512 \saveddimen{\xorbar}{%
19513 \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
19514 }
19515 % anchors for the body (no pins included here)
19516 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
19517 \pgf@circ@ieeestd@stdH
19518 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
19519 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19520 }
19521 \savedanchor{\topleft}{%
19522 \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
19523 \pgf@circ@ieeestd@stdH
19524 \pgf@circ@res@other=0pt\relax
19525 \ifnum #2 = 2\relax% "or" or "nor" gates.
19526 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
19527 \fi
19528 \ifnum #2 = 3\relax% "xor" or "xnor" gates.
19529 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
19530 +\pgf@circ@res@right}
19531 \fi
19532 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
19533 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19534 }
19535 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
19536 \pgf@circ@ieeestd@stdH
19537 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
19538 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
19539 }
19540 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
19541 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
19542 \pgf@circ@ieeestd@stdH
19543 % #3 is =1 if the port is a negated output one
19544 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
19545 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
19546 }
19547 % geographical anchors --- must be rectangulars!
19548 \savedanchor{\northwest}{%
19549 \pgf@circ@find@ieeeport@up
19550 \pgf@circ@find@ieeeport@left{#2}
19551 % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
19552 \pgf@x=\pgf@circ@res@left
19553 \pgf@y=\pgf@circ@res@up
19554 }
19555 \savedanchor{\southwest}{%
19556 \pgf@circ@find@ieeeport@up
19557 \pgf@circ@find@ieeeport@left{#2}
19558 \pgf@x=\pgf@circ@res@left
19559 \pgf@y=-\pgf@circ@res@up
19560 }
19561 \savedanchor{\southeast}{%
19562 \pgf@circ@find@ieeeport@up
19563 \pgf@circ@find@ieeeport@right{#3}
19564 \pgf@x=\pgf@circ@res@right
19565 \pgf@y=-\pgf@circ@res@up
19566 }
19567 \savedanchor{\northeast}{%
19568 \pgf@circ@find@ieeeport@up
19569 \pgf@circ@find@ieeeport@right{#3}
19570 \pgf@x=\pgf@circ@res@right
19571 \pgf@y=\pgf@circ@res@up
19572 }
19573 \savedmacro\inputs{% get number of inputs
19574 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
19575 \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
19576 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
19577 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
19578 \def\inputs{\the\pgf@circ@count@a}%
19579 }%
19580 \savedmacro\inners{% get number of "inner" inputs (for racks)
19581 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
19582 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
19583 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
19584 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
19585 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
19586 % \typeout{INNER is \the\pgf@circ@count@b}%
19587 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
19588 \def\inners{\the\pgf@circ@count@b}%
19589 }%
19590 \anchor{center}{\pgfpointorigin}
19591 \anchor{text}{
19592 \ifpgf@circ@center@text
19593 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
19594 \else
19595 \pgf@circ@ieeestd@stdH
19596 \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
19597 \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
19598 \fi
19599 }
19600 % create input anchors
19601 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
19602 \pgf@circ@count@a=\inputs
19603 \pgfmathloop%
19604 \ifnum\pgfmathcounter>\pgf@circ@count@a%
19605 \else%
19606 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
19607 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
19608 \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
19609 }%
19610 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
19611 \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
19612 }%
19613 \ifnum #2 = 3\relax % xor/xnor inner border pins
19614 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
19615 \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
19616 }%
19617 \fi
19618 %}{}%
19619 \repeatpgfmathloop%
19620 }
19621 % output anchor
19622 \anchor{out}{%
19623 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
19624 \advance\pgf@circ@res@other by\pinlen
19625 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
19626 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
19627 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
19628 \fi
19629 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
19630 }
19631 \anchor{bout}{\bottomright\pgf@y=0pt}
19632
19633 \anchor{body right}{\bodyright\pgf@y=0pt}
19634 \anchor{right}{\bottomright\pgf@y=0pt}
19635 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
19636 \anchor{left}{% central edge of the component
19637 \bodyleft\pgf@y=0pt
19638 \ifnum #2=3\relax
19639 \advance\pgf@x by -\xorbar
19640 \fi
19641 }
19642 \anchor{up}{%
19643 \bodyleft
19644 \ifnum #2 > 1 % pointy shapes
19645 \pgf@circ@ieeestd@stdH
19646 % horizontal coordinate where the right semicircle starts
19647 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
19648 % vertical drop of the circle at the above coordinate
19649 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
19650 \advance \pgf@y by -\pgf@circ@res@step
19651 \fi
19652 \pgf@x=0pt
19653 }
19654 \anchor{down}{%
19655 \bodyleft
19656 \ifnum #2 > 1 % pointy shapes
19657 \pgf@circ@ieeestd@stdH
19658 % horizontal coordinate where the right semicircle starts
19659 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
19660 % vertical drop of the circle at the above coordinate
19661 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
19662 \advance \pgf@y by -\pgf@circ@res@step
19663 \fi
19664 \pgf@y=-\pgf@y\pgf@x=0pt
19665 }
19666
19667 % geographical anchors
19668 \anchor{nw}{\northwest}
19669 \anchor{ne}{\northeast}
19670 \anchor{se}{\southeast}
19671 \anchor{sw}{\southwest}
19672 \anchor{north west}{\northwest}
19673 \anchor{north east}{\northeast}
19674 \anchor{south east}{\southeast}
19675 \anchor{south west}{\southwest}
19676 % over 0,0 even if asymmetric
19677 % will break if the geocoords are not rectangular
19678 \anchor{n}{\northwest\pgf@x=0pt\relax}
19679 \anchor{e}{\northeast\pgf@y=0pt\relax}
19680 \anchor{s}{\southwest\pgf@x=0pt\relax}
19681 \anchor{w}{\northwest\pgf@y=0pt\relax}
19682 \anchor{north}{\northwest\pgf@x=0pt\relax}
19683 \anchor{east}{\northeast\pgf@y=0pt\relax}
19684 \anchor{south}{\southwest\pgf@x=0pt\relax}
19685 \anchor{west}{\northwest\pgf@y=0pt\relax}
19686
19687 \backgroundpath{
19688 \pgfscope
19689 \pgfsetcolor{\ctikzvalof{color}}
19690 #4
19691 \endpgfscope
19692 % output lead:
19693 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
19694 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
19695 \advance\pgf@circ@res@other by \pinlen\relax
19696 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
19697 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19698 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
19699 \pgfusepath{draw}
19700 \fi
19701 \ifnum #3=1\relax\pgfscope
19702 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
19703 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
19704 \endpgfscope\fi
19705 }
19706 }
19707 }
19708
19709 %%% #1 direct name #2 negated name #3 type #4 drawing (without output)
19710 \long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
19711 \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
19712 \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
19713 }
19714 %
19715 % ieeestd "and" and "nand"
19716 %
19717 \pgfcircdeclareieeeportpair{and}{nand}{1}{%
19718 \pgf@circ@count@a = \inputs\relax
19719 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
19720 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
19721 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
19722 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
19723 \ifpgfcirc@draw@leads
19724 %input leads --- all the same for AND ports
19725 \loop\ifnum\pgf@circ@count@a>0
19726 \advance\pgf@circ@res@temp by -\pind
19727 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
19728 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
19729 \advance\pgf@circ@count@a by -1
19730 \repeat
19731 \fi
19732 \pgfusepath{draw}
19733 %% Body. let's start from the top left
19734 \pgfscope
19735 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19736 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
19737 \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
19738 \pgfpatharc{90}{-90}{\stdH}
19739 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
19740 \pgfpathclose
19741 \pgf@circ@draworfill
19742 % rack now; skip if not needed.
19743 % \typeout{WHAT\space \inputs\space \inners}
19744 \ifnum\inputs>\inners
19745 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
19746 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19747 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
19748 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
19749 \pgfusepath{draw}
19750 \fi
19751 \endpgfscope
19752 }
19753 %
19754 % or/nor and xor/xnor are practically the same. Let factor out everything
19755 % the argument #1 is put just before the drawing of the inner pins
19756 % the argument #2 is put after the drawing of the body
19757 %
19758 \long\def\pgf@circ@ieeeport@orxor#1#2{%
19759 \pgf@circ@count@a = \inputs\relax
19760 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
19761 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
19762 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
19763 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
19764 % rack (extended) pins; they are the same for all the ports
19765 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
19766 % above: 1..K (included)
19767 % below: inputs-K..inputs
19768 % Find the pins on the rack; they are 1...
19769 \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
19770 \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
19771 \ifpgfcirc@draw@leads
19772 %input leads --- for or ports
19773 \loop\ifnum\pgf@circ@count@a>0
19774 \pgfextractx{\pgf@circ@res@right}{\topleft}
19775 \advance\pgf@circ@res@temp by -\pind
19776 % this is the height; let's find the "right" position
19777 \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
19778 % inner pins
19779 % \typeout{INNER\space\pgf@circ@count@a}
19780 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
19781 % hook for xor/xnor
19782 #1
19783 \fi\fi
19784 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
19785 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
19786 \pgfusepath{draw}
19787 \advance\pgf@circ@count@a by -1
19788 \repeat
19789 \fi
19790 %% Body. let's start from the top left
19791 \pgfscope
19792 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19793 % it should start here, but with this trick the close comes out better.
19794 % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
19795 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
19796 \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
19797 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
19798 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
19799 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
19800 %% this should be 2 and 2; but the round part is not a perfect circle that way
19801 %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
19802 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
19803 \pgfpathclose
19804 \pgf@circ@draworfill
19805 % hook for xor/xnor
19806 #2
19807 % rack now; skip if not needed.
19808 % \typeout{WHAT\space \inputs\space \inners}
19809 \ifnum\inputs>\inners
19810 \pgfextractx{\pgf@circ@res@left}{\topleft}
19811 \pgfextracty{\pgf@circ@res@down}{\topleft}
19812 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
19813 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
19814 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
19815 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
19816 \pgfusepath{draw}
19817 \fi
19818 \endpgfscope
19819 }
19820 %
19821 % ieeestd "or" and "nor"
19822 %
19823 \pgfcircdeclareieeeportpair{or}{nor}{2}{%
19824 \pgf@circ@ieeeport@orxor{}{}
19825 }
19826 \pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
19827 \pgf@circ@ieeeport@orxor{
19828 \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
19829 \ifnum\@@tmp=0\relax
19830 % move pin start to the left to leave the xor gap free (not standard)
19831 \advance\pgf@circ@res@right by -\xorbar
19832 \fi
19833 }{%
19834 % add the xor/xnor bar
19835 \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
19836 % see the comment on the main body about the 2.2
19837 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
19838 \pgfusepath{draw}
19839 }
19840 }
19841 %
19842 % Buffer and inverters
19843 %
19844 % #1: name
19845 % #2: polarity
19846 % #3: content
19847 \long\def\pgfcircdeclareieeebufferport#1#2#3{%
19848 \pgfdeclareshape{ieeestd #1 port}%
19849 {%
19850 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
19851 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19852 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
19853 \saveddimen{\baselen}{%
19854 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
19855 }
19856 \saveddimen{\stdH}{% This is HALF the height of the inner port
19857 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
19858 }
19859 \saveddimen{\notdiameter}{
19860 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
19861 }
19862 \saveddimen{\pinlen}{%
19863 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
19864 }
19865 % anchors for the body (no pins included here)
19866 % Notice that 0.8660254 is cos(30)
19867 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
19868 \pgf@circ@ieeestd@stdH
19869 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
19870 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19871 }
19872 \savedanchor{\topleft}{%
19873 \pgf@circ@ieeestd@stdH
19874 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
19875 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19876 }
19877 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
19878 \pgf@circ@ieeestd@stdH
19879 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
19880 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19881 }
19882 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
19883 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
19884 \pgf@circ@ieeestd@stdH
19885 % #2 is =1 if the port is a negated output one
19886 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
19887 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
19888 }
19889 % geographical anchors --- must be rectangulars!
19890 \savedanchor{\northwest}{%
19891 \pgf@circ@ieeestd@stdH
19892 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
19893 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
19894 }
19895 \savedanchor{\southwest}{%
19896 \pgf@circ@ieeestd@stdH
19897 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
19898 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
19899 }
19900 \savedanchor{\southeast}{%
19901 \pgf@circ@ieeestd@stdH
19902 \pgf@circ@res@up=\pgf@circ@res@temp
19903 \pgf@circ@find@ieeeport@not@right{#2}
19904 \pgf@x=\pgf@circ@res@right
19905 \pgf@y=-\pgf@circ@res@up
19906 }
19907 \savedanchor{\northeast}{%
19908 \pgf@circ@ieeestd@stdH
19909 \pgf@circ@res@up=\pgf@circ@res@temp
19910 \pgf@circ@find@ieeeport@not@right{#2}
19911 \pgf@x=\pgf@circ@res@right
19912 \pgf@y=\pgf@circ@res@up
19913 }
19914 \anchor{center}{\pgfpointorigin}
19915 \anchor{text}{
19916 \ifpgf@circ@center@text
19917 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
19918 \else
19919 \pgf@circ@ieeestd@stdH
19920 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
19921 \fi
19922 }
19923 % input anchors
19924 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
19925 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
19926 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
19927 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
19928 % output anchors
19929 \anchor{out}{%
19930 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
19931 \advance\pgf@circ@res@other by\pinlen
19932 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
19933 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
19934 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
19935 \fi
19936 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
19937 }
19938 \anchor{bout}{\bottomright\pgf@y=0pt}
19939
19940 \anchor{body right}{\bodyright\pgf@y=0pt}
19941 \anchor{right}{\bottomright\pgf@y=0pt}
19942 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
19943 \anchor{left}{% central edge of the component
19944 \pgf@circ@ieeestd@xorbar% save \xorbar in temp
19945 \bodyleft\pgf@y=0pt\advance\pgf@x by -\pgf@circ@res@temp
19946 }
19947 \anchor{up}{%
19948 \bodyleft
19949 \pgf@y=+0.5\pgf@y\pgf@x=0pt
19950 }
19951 \anchor{down}{%
19952 \bodyleft
19953 \pgf@y=-0.5\pgf@y\pgf@x=0pt
19954 }
19955
19956 % geographical anchors
19957 \anchor{nw}{\northwest}
19958 \anchor{ne}{\northeast}
19959 \anchor{se}{\southeast}
19960 \anchor{sw}{\southwest}
19961 \anchor{north west}{\northwest}
19962 \anchor{north east}{\northeast}
19963 \anchor{south east}{\southeast}
19964 \anchor{south west}{\southwest}
19965 % over 0,0 even if asymmetric
19966 % will break if the geocoords are not rectangular
19967 \anchor{n}{\northwest\pgf@x=0pt\relax}
19968 \anchor{e}{\northeast\pgf@y=0pt\relax}
19969 \anchor{s}{\southwest\pgf@x=0pt\relax}
19970 \anchor{w}{\northwest\pgf@y=0pt\relax}
19971 \anchor{north}{\northwest\pgf@x=0pt\relax}
19972 \anchor{east}{\northeast\pgf@y=0pt\relax}
19973 \anchor{south}{\southwest\pgf@x=0pt\relax}
19974 \anchor{west}{\northwest\pgf@y=0pt\relax}
19975
19976 \backgroundpath{
19977 \pgfscope
19978 \pgfsetcolor{\ctikzvalof{color}}
19979 #3
19980 \endpgfscope
19981 % output lead:
19982 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
19983 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
19984 \advance\pgf@circ@res@other by \pinlen\relax
19985 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
19986 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19987 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
19988 \pgfusepath{draw}
19989 \fi
19990 \ifnum #2=1\relax\pgfscope
19991 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
19992 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
19993 \endpgfscope\fi
19994 }
19995 }
19996 }
19997
19998 %%% #1 direct name #2 negated name #3 drawing (without output)
19999 \long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
20000 \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
20001 \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
20002 }
20003
20004 \pgfcircdeclareieeebufferportpair{buffer}{not}{%
20005 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
20006 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
20007 \pgfextractx{\pgf@circ@res@right}{\bodyright}
20008 % \draw input pin
20009 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
20010 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
20011 \pgfusepath{draw}
20012 \pgfscope
20013 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20014 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
20015 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20016 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
20017 \pgfpathclose
20018 \pgf@circ@draworfill
20019 \endpgfscope
20020 }
20021
20022 \pgfcircdeclareieeebufferportpair{schmitt}{inv schmitt}{%
20023 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
20024 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
20025 \pgfextractx{\pgf@circ@res@right}{\bodyright}
20026 % \draw input pin
20027 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
20028 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
20029 \pgfusepath{draw}
20030 \pgfscope
20031 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20032 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
20033 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20034 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
20035 \pgfpathclose
20036 \pgf@circ@draworfill
20037 \endpgfscope
20038 % draw schmitt symbol in normal line thickness
20039 \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
20040 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
20041 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
20042 \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
20043 \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
20044 \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
20045 \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
20046 \pgfusepath{draw}
20047 }
20048
20049
20050 \pgfdeclareshape{schmitt symbol}{
20051 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
20052 \anchor{center}{\pgfpointorigin}
20053 \savedanchor\northwest{%
20054 \pgf@circ@ieeestd@stdH
20055 \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
20056 \pgf@x=-1.5\pgf@y
20057 }
20058 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
20059 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
20060 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
20061 \anchor{west}{\northwest\pgf@y=0pt}
20062 \anchor{w}{\northwest \pgf@y=0pt}
20063 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
20064 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20065 \anchor{north}{\northwest\pgf@x=0pt}
20066 \anchor{n}{\northwest\pgf@x=0pt}
20067 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
20068 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
20069 \anchor{north west}{\northwest}
20070 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
20071 \backgroundpath{
20072 \pgfscope
20073 \pgfsetcolor{\ctikzvalof{color}}
20074 \pgfextractx{\pgf@circ@res@left}{\northwest}
20075 \pgfextracty{\pgf@circ@res@up}{\northwest}
20076 \pgf@circ@res@left=0.7\pgf@circ@res@left
20077 \pgf@circ@res@up=0.7\pgf@circ@res@up
20078 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
20079 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
20080 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
20081 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
20082 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
20083 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
20084 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
20085 \pgfusepath{draw}
20086 \endpgfscope
20087 }
20088 }
20089
20090 \pgfdeclareshape{notcirc}{
20091 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
20092 \anchor{center}{\pgfpointorigin}
20093 \savedanchor\northwest{%
20094 \pgf@circ@notradius
20095 \pgf@y=\pgf@circ@res@temp
20096 \pgf@x=-\pgf@y
20097 }
20098 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
20099 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
20100 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
20101 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
20102 \anchor{left}{\northwest\pgf@y=0pt}
20103 \anchor{west}{\northwest\pgf@y=0pt}
20104 \anchor{w}{\northwest \pgf@y=0pt}
20105 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
20106 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
20107 \anchor{north}{\northwest\pgf@x=0pt}
20108 \anchor{n}{\northwest\pgf@x=0pt}
20109 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
20110 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
20111 \anchor{north west}{\northwest}
20112 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
20113 \anchorborder{
20114 \pgf@circ@res@left=\pgf@x
20115 \pgf@circ@res@up=\pgf@y
20116 \northwest\pgf@circ@res@temp=\pgf@y
20117 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
20118 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
20119 }
20120 \behindforegroundpath{
20121 \pgfscope
20122 \northwest\pgf@circ@res@temp=\pgf@y
20123 \pgfsetcolor{\ctikzvalof{color}}
20124 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20125 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
20126 \ifx\tikz@fillcolor\pgfutil@empty
20127 % set the default fill color to white
20128 \pgfsetfillcolor{white}
20129 % ...but override it if the class is defined!
20130 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
20131 \else
20132 \pgfsetfillcolor{\tikz@fillcolor}
20133 \fi
20134 \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
20135 \pgfusepath{draw,fill}
20136 \endpgfscope
20137 }
20138 }
20139
20140
20141 %%%---------- close: tex/pgfcircmultipoles
20142
20143 %%%%%%%%%%% Springe nach tex/pgfcirclabel
20144 %%%---------- open: tex/pgfcirclabel.tex
20145 % Copyright 2018-2026 by Romano Giannetti
20146 % Copyright 2015-2026 by Stefan Lindner
20147 % Copyright 2013-2026 by Stefan Erhardt
20148 % Copyright 2007-2026 by Massimo Redaelli
20149 %
20150 % This file may be distributed and/or modified
20151 %
20152 % 1. under the LaTeX Project Public License and/or
20153 % 2. under the GNU Public License.
20154 %
20155 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
20156
20157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20158 %% Bipole label positioning
20159
20160 %% bipole labels and annotation extra style
20161
20162 \ctikzset{bipole label style/.style={}}
20163 \tikzset{bipole label style/.code={
20164 \ctikzset{bipole label style/.style={#1}}
20165 }}
20166 \tikzset{bipole label append style/.code={
20167 \ctikzset{bipole label style/.append style={#1}}
20168 }}
20169 \ctikzset{bipole annotation style/.style={}}
20170 \tikzset{bipole annotation style/.code={
20171 \ctikzset{bipole annotation style/.style={#1}}
20172 }}
20173 \tikzset{bipole annotation append style/.code={
20174 \ctikzset{bipole annotation style/.append style={#1}}
20175 }}
20176
20177 %% Options
20178 \ctikzset{label/.style = { l=#1 } }
20179 \ctikzset{l/.code = {
20180 \pgfkeys{/tikz/circuitikz/bipole/label/name=#1}
20181 \ctikzsetvalof{bipole/label/unit}{}
20182 \ifpgf@circ@siunitx
20183 \pgf@circ@handleSI{#1}
20184 \ifpgf@circ@siunitx@res
20185 \edef\pgf@temp{\pgf@circ@handleSI@val}
20186 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
20187 \edef\pgf@temp{\pgf@circ@handleSI@unit}
20188 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
20189 \else
20190 \fi
20191 \else
20192 \fi
20193 }}
20194
20195 \ctikzset{label above/.code = {
20196 l=#1,
20197 \circuitikzbasekey/bipole/label/position=90 }
20198 }
20199
20200 \ctikzset{l^/.style = {
20201 l=#1,
20202 \circuitikzbasekey/bipole/label/position=90 }
20203 }
20204
20205 \ctikzset{label below/.code = {
20206 l=#1,
20207 \circuitikzbasekey/bipole/label/position=-90 }
20208 }
20209
20210 \ctikzset{l_/.style = {
20211 l=#1,
20212 \circuitikzbasekey/bipole/label/position=-90 }
20213 }
20214
20215 \ctikzset{annotation/.style = { a=#1 } }
20216 \ctikzset{a/.code = {
20217 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=#1}
20218 \ctikzsetvalof{bipole/annotation/unit}{}
20219 \ifpgf@circ@siunitx
20220 \pgf@circ@handleSI{#1}
20221 \ifpgf@circ@siunitx@res
20222 \edef\pgf@temp{\pgf@circ@handleSI@val}
20223 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
20224 \edef\pgf@temp{\pgf@circ@handleSI@unit}
20225 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
20226 \else
20227 \fi
20228 \else
20229 \fi
20230 }}
20231
20232 \ctikzset{annotation above/.code = {
20233 a=#1,
20234 \circuitikzbasekey/bipole/annotation/position=90 }
20235 }
20236
20237 \ctikzset{a^/.style = {
20238 a=#1,
20239 \circuitikzbasekey/bipole/annotation/position=90 }
20240 }
20241
20242 \ctikzset{annotation below/.code = {
20243 a=#1,
20244 \circuitikzbasekey/bipole/annotation/position=-90 }
20245 }
20246 \ctikzset{a_/.style = {
20247 a=#1,
20248 \circuitikzbasekey/bipole/annotation/position=-90 }
20249 }
20250
20251 % This is to adjust spacing for the labels so that they are not cramped on components
20252 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
20253
20254 \def\pgf@circ@drawlabels#1{
20255 \pgfextra{
20256 % This function will be called with argument #1 equal
20257 % to "label" or "annotation" form pgfcircpath.tex.
20258 % pgf@circ@direction is the direction of the path,
20259 % its value is set in pgfcircpath.tex
20260 \pgfmathsubtract{\pgf@circ@direction}{90}
20261 \pgfmathround{\pgfmathresult} % avoid precision loss errors
20262 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20263
20264 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
20265 \ifnum \pgf@circ@temp < 0
20266 \pgfmathadd{\pgf@circ@labanc}{180}
20267 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20268 \fi
20269 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
20270 %
20271 % normalize the angle values
20272 %
20273 \pgfmathmod{\pgf@circ@labanc}{360}
20274 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20275 %
20276 \ifpgf@circuit@bipole@inverted
20277 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
20278 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20279 \fi
20280 %
20281 \ifnum \ctikzvalof{mirror value} = -1
20282 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
20283 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20284 \fi
20285 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
20286 }
20287 %Firstly, place a coordinate directly at the edge of the shape
20288 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (labelcoor)
20289 %now decide, which labels should be drawn
20290 \pgfextra{
20291 \edef\pgf@temp{\ctikzvalof{label/align}}
20292 \def\pgf@circ@temp{straight}
20293 }
20294 \ifx\pgf@temp\pgf@circ@temp %straight
20295 \pgf@circ@drawreglabels{#1}
20296 \else
20297 \pgfextra{\def\pgf@circ@temp{rotate}}
20298 \ifx\pgf@temp\pgf@circ@temp %rotate
20299 \pgf@circ@drawrotlabels{#1}
20300 \else% smart
20301 \pgf@circ@drawsmartlabels{#1}
20302 \fi
20303 \fi
20304 }
20305
20306
20307 \def\pgf@circ@drawsmartlabels#1{
20308 \pgfextra{
20309 \pgfmathmod{\pgf@circ@direction}{90}
20310 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20311 }
20312 \ifnum \pgfcircmathresult > 20
20313 \ifnum \pgfcircmathresult < 70
20314 \pgf@circ@drawrotlabels{#1}
20315 \else
20316 \pgf@circ@drawreglabels{#1}
20317 \fi
20318 \else
20319 \pgf@circ@drawreglabels{#1}
20320 \fi
20321 }
20322
20323
20324 \def\pgf@circ@drawrotlabels#1{
20325 \pgfextra{
20326 % scale the distances in function of zoom, so that they are not
20327 % dependent on it but on font size. Thanks to @marmot
20328 % https://tex.stackexchange.com/a/476018/38080
20329 % the coeffcient is adjusted so that the distance is more or less
20330 % the same for rotated labels and straight ones (although it will
20331 % depend on the font, so it's not exact).
20332 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
20333 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
20334 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
20335 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale}
20336 \ifnum \ctikzvalof{bipole/#1/position}>0
20337 %we need some more space for placement below, due to mid-anchor
20338 \else % we do not have <= in \ifnum...
20339 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
20340 \fi
20341 %Calculate rotation of the label from direction and strip decimals
20342 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20343 % rotate the label at second or third quadrant:
20344 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
20345 \pgfmathsubtract{\pgf@circ@direction}{180}
20346 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20347 %invert the space relationships due to rotated strings
20348 \ifnum \ctikzvalof{bipole/#1/position}>0
20349 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
20350 \fi
20351 \fi\fi
20352 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}
20353 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20354 }
20355 % reset cm is not working correctly here
20356 (labelcoor)++(\pgf@circ@labposangle:\the\pgf@circ@res@temp) coordinate(labelcoor)
20357 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
20358 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
20359 }
20360
20361 \def\pgf@circ@drawreglabels#1{
20362 %Now calculate all shape positions
20363 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
20364 %All points between will be addressed by angled-anchors:
20365 \pgfextra{
20366 % scale ex-distance to make it independent on scale
20367 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
20368 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
20369 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
20370 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
20371 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale}
20372 \pgfmathadd{\pgf@circ@labanc}{90}
20373 \pgfmathround{\pgfmathresult}
20374 \def\pgf@circ@labanctext{\pgf@circ@labanc}
20375 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20376 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
20377 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
20378 }
20379 %Values around 90 are at both y-axis
20380 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
20381 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
20382 \ifnum \pgf@circ@labpos > 180
20383 \ifnum \ctikzvalof{bipole/#1/position} > 0
20384 \pgfextra{\def\pgf@circ@labanctext{mid west}}
20385 \else
20386 \pgfextra{\def\pgf@circ@labanctext{mid east}}
20387 \fi
20388 \else
20389 \ifnum \ctikzvalof{bipole/#1/position} > 0
20390 \pgfextra{\def\pgf@circ@labanctext{mid east}}
20391 \else
20392 \pgfextra{\def\pgf@circ@labanctext{mid west}}
20393 \fi
20394 \fi
20395 \fi\fi
20396 %Values between -5 and 5 are at pos /neg x-axis
20397 \pgfextra{\def\uffa{}\newdimen\realshift\realshift=\dimexpr1pt\relax}
20398 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
20399 \ifnum \ctikzvalof{bipole/#1/position} < 0
20400 \ifnum \pgf@circ@labanc > 90
20401 % using base coordinate instead of south to naturally align
20402 % symbols with descendants; but this invalidate the effect of
20403 % the inner sep, so recover it by shifting the anchor
20404 % reset cm is not working sometime, use @marmot solution
20405 % see https://tex.stackexchange.com/a/476018/38080
20406 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
20407 \pgfextra{\def\pgf@circ@labanctext{base}}%base
20408 \else
20409 \pgfextra{\def\pgf@circ@labanctext{north}}%north
20410 \fi
20411 \else
20412 \ifnum \pgf@circ@labanc < 90
20413 % shift, as above
20414 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
20415 \pgfextra{\def\pgf@circ@labanctext{base}}%base
20416 \else
20417 \ifnum \pgf@circ@labanc > 180
20418 % this shouldn't happen, but somehow it does (270 degree anchors)
20419 % shift, as above
20420 (labelcoor) ++(-\pgf@circ@labanc:\pgf@circ@res@temp) coordinate(labelcoor)
20421 \pgfextra{\def\pgf@circ@labanctext{base}}%base
20422 \else
20423 \pgfextra{\def\pgf@circ@labanctext{north}}%north
20424 \fi
20425 \fi
20426 \fi
20427 \fi\fi
20428 (labelcoor) node[anchor=\pgf@circ@labanctext,
20429 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
20430 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
20431 }
20432 }
20433
20434 \def\pgf@circ@finallabels#1{%
20435 \edef\pgf@temp{}%
20436 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
20437 \ifx\pgf@temp\pgf@circ@temp%
20438 \ctikzvalof{bipole/#1/name}%
20439 \else%
20440 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
20441 \fi%
20442 }
20443
20444 \ctikzset{text/.style={t=#1}}
20445 \ctikzset{t/.code={%
20446 \ctikzsetvalof{bipoles/twoport/text}{#1}%
20447 }}
20448
20449 %%%% Stacked labels
20450 %
20451 % stacked labels by Romano Giannetti [email protected]
20452 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
20453 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
20454 %
20455 % labels are in a tabular, globally aligned:
20456 % vertically with key l2 valign (default c)
20457 % c: center t: top b: bottom
20458 % horizontally with key l2 align (default l)
20459 % l: left c: centered r: right
20460 % you can switch sides using l2_=... and l2^=...
20461 % syntax is l2_ = line1 and line2 (same for l2^)
20462 %
20463 \ctikzset{%
20464 l2 valign/.store in=\ltwo@valign, l2 valign=c,
20465 l2 halign/.store in=\ltwo@halign, l2 halign=l,
20466 }
20467 \ctikzset{l2base/.code n args={2}{
20468 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
20469 \bgroup
20470 \setlength{\tabcolsep}{2pt}%
20471 \def\ltwo@tabu{\tabular[\ltwo@valign]}%
20472 \expandafter\ltwo@tabu\expandafter{\ltwo@halign}%
20473 #1\\ #2%
20474 \endtabular
20475 \egroup
20476 }%
20477 \ctikzsetvalof{bipole/label/unit}{}
20478 \ifpgf@circ@siunitx
20479 \pgf@circ@handleSI{#2}
20480 \ifpgf@circ@siunitx@res
20481 \edef\pgf@temp{\pgf@circ@handleSI@val}
20482 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
20483 \edef\pgf@temp{\pgf@circ@handleSI@unit}
20484 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
20485 \else
20486 \fi
20487 \else
20488 \fi
20489 }}
20490 \ctikzset{l2/.style args={#1 and #2}{
20491 l2base={#1}{#2},
20492 \circuitikzbasekey/bipole/label/position=90 }
20493 }
20494 \ctikzset{l2 above/.style args={#1 and #2}{
20495 l2base={#1}{#2},
20496 \circuitikzbasekey/bipole/label/position=90 }
20497 }
20498 \ctikzset{l2^/.style args={#1 and #2}{
20499 l2base={#1}{#2},
20500 \circuitikzbasekey/bipole/label/position=90 }
20501 }
20502 \ctikzset{l2 below/.style args={#1 and #2}{
20503 l2base={#1}{#2},
20504 \circuitikzbasekey/bipole/label/position=-90 }
20505 }
20506 \ctikzset{l2_/.style args={#1 and #2}{
20507 l2base={#1}{#2},
20508 \circuitikzbasekey/bipole/label/position=-90 }
20509 }
20510
20511 %%%---------- close: tex/pgfcirclabel
20512 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
20513 %%%---------- open: tex/pgfcircvoltage.tex
20514 % Copyright 2018-2026 by Romano Giannetti
20515 % Copyright 2015-2026 by Stefan Lindner
20516 % Copyright 2013-2026 by Stefan Erhardt
20517 % Copyright 2007-2026 by Massimo Redaelli
20518 %
20519 % This file may be distributed and/or modified
20520 %
20521 % 1. under the LaTeX Project Public License and/or
20522 % 2. under the GNU Public License.
20523 %
20524 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
20525
20526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20527 %% Voltage management
20528
20529 %% styles
20530 \ctikzset{bipole voltage style/.style={}}
20531 \tikzset{bipole voltage style/.code={
20532 \ctikzset{bipole voltage style/.style={#1}}
20533 }}
20534 \tikzset{bipole voltage append style/.code={
20535 \ctikzset{bipole voltage style/.append style={#1}}
20536 }}
20537
20538 \ctikzset{v^>/.style = {
20539 v = #1,
20540 \circuitikzbasekey/bipole/voltage/direction = forward,
20541 \circuitikzbasekey/bipole/voltage/position = above
20542 }
20543 }
20544
20545 \ctikzset{v^</.style = {
20546 v = #1,
20547 \circuitikzbasekey/bipole/voltage/direction = backward,
20548 \circuitikzbasekey/bipole/voltage/position = above
20549 }
20550 }
20551
20552 \ctikzset{v_>/.style = {
20553 v = #1,
20554 \circuitikzbasekey/bipole/voltage/direction = forward,
20555 \circuitikzbasekey/bipole/voltage/position = below
20556 }
20557 }
20558
20559 \ctikzset{v_</.style = {
20560 v = #1,
20561 \circuitikzbasekey/bipole/voltage/direction = backward,
20562 \circuitikzbasekey/bipole/voltage/position = below
20563 }
20564 }
20565
20566 \ctikzset{v_/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = below} }
20567 \ctikzset{v^/.style = {v = #1, \circuitikzbasekey/bipole/voltage/position = above} }
20568 \ctikzset{v>/.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = forward} }
20569 \ctikzset{v</.style = {v = #1, \circuitikzbasekey/bipole/voltage/direction = backward} }
20570
20571 % Default position varies whether the component is a voltage source
20572 % or not
20573 \ctikzset{v/.code = {
20574 \ifpgf@circuit@bipole@isvoltage
20575 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
20576 \circuitikzbasekey/bipole/voltage/direction=forward}
20577 \else
20578 \ifpgf@circ@oldvoltagedirection
20579 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20580 \circuitikzbasekey/bipole/voltage/direction=backward}
20581 \else
20582 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20583 \circuitikzbasekey/bipole/voltage/direction=forward}
20584 \fi
20585 \fi
20586 \ifpgf@circ@oldvoltagedirection
20587 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
20588 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20589 \circuitikzbasekey/bipole/voltage/direction=forward}
20590 \fi\fi
20591 \else
20592 \ifpgf@circuit@bipole@iscurrent
20593 \ifpgf@circuit@bipole@current@backward
20594 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20595 \circuitikzbasekey/bipole/voltage/direction=forward}
20596 \else
20597 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
20598 \circuitikzbasekey/bipole/voltage/direction=backward}
20599 \fi\fi\fi
20600 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name=#1}
20601 \ctikzsetvalof{bipole/voltage/label/unit}{}
20602 \ifpgf@circ@siunitx
20603 \pgf@circ@handleSI{#1}
20604 \ifpgf@circ@siunitx@res
20605 \edef\pgf@temp{\pgf@circ@handleSI@val}
20606 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
20607 \edef\pgf@temp{\pgf@circ@handleSI@unit}
20608 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
20609 \else
20610 \fi
20611 \else
20612 \fi
20613 }
20614 }
20615
20616 % american voltage font selection and symbol definition
20617 % the default font command is {} --- nothing
20618 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
20619 %
20620 % plus and minus symbols (default is $+$ and $-$, see pgfcirc.defines.tex)
20621 %
20622 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
20623 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
20624
20625 %%
20626 \def\setscaledRlenforclass{%
20627 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
20628 \ifdefined\ctikzclass
20629 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
20630 \pgfkeysifdefined{\pgf@temp}
20631 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20632 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
20633 \else
20634 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
20635 \fi
20636 }
20637
20638 %% Output routine for generic bipoles
20639
20640 \def\pgf@circ@drawvoltagegeneric{
20641 \pgfextra{
20642 % \typeout{NAME:\ctikzvalof{bipole/name}}
20643 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
20644 \pgfkeysifdefined{\pgf@temp}
20645 {
20646 \edef\partheight{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}
20647 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)}
20648 }
20649 {
20650 \pgfkeysifdefined{/tikz/circuitikz/bipoles/voltage/straight label distance}
20651 {
20652 \edef\partheight{\ctikzvalof{bipoles/voltage/straight label distance}}
20653 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen)}
20654 }
20655 {%calculate default value from part height
20656 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
20657 \pgfkeysifdefined{\pgf@temp}
20658 {
20659 \edef\partheight{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
20660 \edef\tmpdistfromline{(\partheight\pgf@circ@scaled@Rlen+0.2\pgf@circ@scaled@Rlen)}
20661 }
20662 {
20663 \edef\tmpdistfromline{(.5\pgf@circ@scaled@Rlen)} %fallback to fixed value
20664 }
20665 }
20666 }
20667 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
20668 \ifnum \ctikzvalof{mirror value}=-1
20669 \ifpgf@circuit@bipole@inverted
20670 \ifpgf@circuit@bipole@voltage@straight
20671 \def\distfromline{\tmpdistfromline}
20672 \else
20673 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
20674 \fi
20675 \else
20676 \ifpgf@circuit@bipole@voltage@straight
20677 \def\distfromline{-\tmpdistfromline}
20678 \else
20679 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
20680 \fi
20681 \fi
20682 \else
20683 \ifpgf@circuit@bipole@inverted
20684 \ifpgf@circuit@bipole@voltage@straight
20685 \def\distfromline{-\tmpdistfromline}
20686 \else
20687 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
20688 \fi
20689 \else
20690 \ifpgf@circuit@bipole@voltage@straight
20691 \def\distfromline{\tmpdistfromline}
20692 \else
20693 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
20694 \fi
20695 \fi
20696 \fi
20697 \ifpgf@circuit@bipole@voltage@below
20698 \def\pgf@circ@voltage@angle{90}
20699 \else
20700 \def\pgf@circ@voltage@angle{-90}
20701 \fi
20702 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
20703 \pgfkeysifdefined{\pgf@temp}
20704 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
20705 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
20706 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
20707 \pgfkeysifdefined{\pgf@temp}
20708 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
20709 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
20710 \edef\shiftv{\ctikzvalof{voltage/shift}}
20711 % additional per-bipole voltage shift (internal)
20712 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}
20713 \pgfkeysifdefined{\pgf@temp}
20714 {
20715 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional label shift}}
20716 }
20717 {
20718 \edef\addvshift{0}
20719 }
20720 \newdimen{\absvshift}
20721 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
20722 % put this to true to see the voltage label coordinate anchors
20723 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
20724 }
20725 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
20726 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorstartnode)$) %absolute move, minimum space is length of arrowhead
20727 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorstartnode)$)
20728 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
20729 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@midtmp) ! -\distfromline ! \pgf@circ@voltage@angle:(anchorstartnode)$)
20730
20731 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (anchorendnode)$)%absolute move, minimum space is length of arrowhead
20732 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (anchorendnode)$)
20733 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
20734 coordinate (pgfcirc@Vto) at ($(pgfcirc@midtmp) ! \distfromline ! \pgf@circ@voltage@angle : (anchorendnode)$)
20735
20736 \ifpgf@circuit@bipole@voltage@below
20737 \ifpgf@circ@debugv
20738 node [ocirc, fill=red] at (anchorstartnode) {}
20739 node [ocirc, fill=blue] at (anchorendnode) {}
20740 node [ocirc, fill=green] at (pgfcirc@Vto) {}
20741 node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {}
20742 node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {}
20743 node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {}
20744 \fi
20745 coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (anchorendnode)$)
20746 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (anchorstartnode)$)
20747 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
20748 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
20749 coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
20750 coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
20751 \ifpgf@circ@debugv
20752 node [odiamondpole, fill=green] at (pgfcirc@Vto) {}
20753 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {}
20754 node [osquarepole, fill=red] at (pgfcirc@Vcont1) {}
20755 node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {}
20756 \fi
20757 \else
20758 \ifpgf@circ@debugv
20759 node [ocirc, fill=red] at (anchorstartnode) {}
20760 node [ocirc, fill=blue] at (anchorendnode) {}
20761 node [ocirc, fill=green] at (pgfcirc@Vto) {}
20762 node [ocirc, fill=yellow] at (pgfcirc@Vfrom) {}
20763 node [odiamondpole, fill=green] at (pgfcirc@Vto@flat) {}
20764 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom@flat) {}
20765 \fi
20766 coordinate (pgfcirc@Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (anchorendnode)$)
20767 coordinate (pgfcirc@Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (anchorstartnode)$)
20768 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
20769 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
20770 coordinate (pgfcirc@Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
20771 coordinate (pgfcirc@Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
20772 \ifpgf@circ@debugv
20773 node [odiamondpole, fill=green] at (pgfcirc@Vto) {}
20774 node [odiamondpole, fill=yellow] at (pgfcirc@Vfrom) {}
20775 node [osquarepole, fill=red] at (pgfcirc@Vcont1) {}
20776 node [osquarepole, fill=blue] at (pgfcirc@Vcont2) {}
20777 \fi
20778 \fi
20779
20780 \ifpgf@circuit@europeanvoltage
20781 \ifpgf@circuit@bipole@voltage@straight
20782 \ifpgf@circuit@bipole@voltage@backward
20783 (pgfcirc@Vto) --(pgfcirc@Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
20784 \else
20785 (pgfcirc@Vfrom) --(pgfcirc@Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
20786 \fi
20787 \else
20788 \ifpgf@circuit@bipole@voltage@backward
20789 (pgfcirc@Vto) .. controls (pgfcirc@Vcont2) and (pgfcirc@Vcont1) ..
20790 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
20791 (pgfcirc@Vfrom)
20792 \else
20793 (pgfcirc@Vfrom) .. controls (pgfcirc@Vcont1) and (pgfcirc@Vcont2) ..
20794 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
20795 (pgfcirc@Vto)
20796 \fi
20797 \fi
20798 \else % american
20799 \ifx\@@kind\@@open % open circuit; put + and - directly on it
20800 \ifpgf@circuit@bipole@voltage@backward
20801 \ifpgf@circ@oldvoltagedirection
20802 (pgfcirc@Vfrom@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20803 anchor=center]{\pgf@circ@avplus}
20804 (pgfcirc@Vto@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20805 anchor=center]{\pgf@circ@avminus}
20806 \else
20807 (pgfcirc@Vfrom@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20808 anchor=center]{\pgf@circ@avminus}
20809 (pgfcirc@Vto@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20810 anchor=center]{\pgf@circ@avplus}
20811 \fi
20812 \else
20813 \ifpgf@circ@oldvoltagedirection
20814 (pgfcirc@Vfrom@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20815 anchor=center]{\pgf@circ@avminus}
20816 (pgfcirc@Vto@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20817 anchor=center]{\pgf@circ@avplus}
20818 \else
20819 (pgfcirc@Vfrom@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20820 anchor=center]{\pgf@circ@avplus}
20821 (pgfcirc@Vto@flat) node[inner sep=0, node font=\pgf@circ@avfont,
20822 anchor=center]{\pgf@circ@avminus}
20823 \fi
20824 \fi
20825 \else % not open circuit
20826 \ifpgf@circuit@bipole@voltage@backward
20827 \ifpgf@circ@oldvoltagedirection
20828 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
20829 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
20830 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
20831 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
20832 \else
20833 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
20834 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
20835 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
20836 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
20837 \fi
20838 \else
20839 \ifpgf@circ@oldvoltagedirection
20840 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
20841 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
20842 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
20843 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
20844 \else
20845 (pgfcirc@Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
20846 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
20847 (pgfcirc@Vto) node[inner sep=0, node font=\pgf@circ@avfont,
20848 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
20849 \fi
20850 \fi
20851 \fi
20852 \fi
20853 }
20854
20855 %% Output routine for voltage sources
20856 \def\pgf@circ@drawvoltagegenerator{
20857 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
20858 % it's not perfect, but I can't find the way to do it correctly...
20859 \pgfextra{
20860 \edef\shiftv{\ctikzvalof{voltage/shift}}
20861 \edef\bumpa{\ctikzvalof{voltage/bump a}}
20862 \pgfmathsetmacro{\bumpaplus}{\bumpa + 0.5*\shiftv} % coefficient added "by feel". Sorry.
20863 }
20864 \ifpgf@circuit@bipole@voltage@below
20865 coordinate (pgfcirc@Vfrom) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
20866 coordinate (pgfcirc@Vto) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
20867 \else
20868 coordinate (pgfcirc@Vfrom) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
20869 coordinate (pgfcirc@Vto) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
20870 \fi
20871 % fix the (unused in this case) Vcont1/2 coords for label placement along the line
20872 coordinate (pgfcirc@Vcont1) at (pgfcirc@Vto)
20873 coordinate (pgfcirc@Vcont2) at (pgfcirc@Vfrom)
20874 \ifpgf@circuit@europeanvoltage
20875 \ifpgf@circuit@bipole@voltage@backward
20876 (pgfcirc@Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc@Vfrom)
20877 \else
20878 (pgfcirc@Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (pgfcirc@Vto)
20879 \fi
20880 \else% american voltage
20881 \ifpgf@circuit@bipole@voltageoutsideofsymbol
20882 % if it is a battery, must put + and -
20883
20884 \ifpgf@circ@fixbatteries
20885 \ifpgf@circuit@bipole@voltage@backward
20886 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
20887 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
20888 \else
20889 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
20890 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
20891 \fi
20892 \else
20893 \ifpgf@circuit@bipole@voltage@backward
20894 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
20895 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
20896 \else
20897 (pgfcirc@Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
20898 (pgfcirc@Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
20899 \fi
20900 \fi
20901 \fi
20902 \fi
20903 }
20904
20905 %% Output routine
20906 %% this is the entry point
20907 %%
20908 \def\pgf@circ@drawvoltage{% node name
20909 \pgfextra{ %WARNING: indentation is probably wrong
20910 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
20911 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
20912 \ifpgf@circuit@bipole@voltage@below
20913 \def\pgf@circ@bipole@voltage@label@anchor{north west}
20914 \else
20915 \def\pgf@circ@bipole@voltage@label@anchor{south east}
20916 \fi
20917 \fi\fi
20918 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
20919 \ifpgf@circuit@bipole@voltage@below
20920 \def\pgf@circ@bipole@voltage@label@anchor{west}
20921 \else
20922 \def\pgf@circ@bipole@voltage@label@anchor{east}
20923 \fi
20924 \fi\fi
20925 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
20926 \ifpgf@circuit@bipole@voltage@below
20927 \def\pgf@circ@bipole@voltage@label@anchor{south west}
20928 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
20929 \fi
20930 \fi\fi
20931 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
20932 \ifpgf@circuit@bipole@voltage@below
20933 \def\pgf@circ@bipole@voltage@label@anchor{south}
20934 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
20935 \fi
20936 \fi\fi
20937 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
20938 \ifpgf@circuit@bipole@voltage@below
20939 \def\pgf@circ@bipole@voltage@label@anchor{south east}
20940 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
20941 \fi
20942 \fi\fi
20943 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
20944 \ifpgf@circuit@bipole@voltage@below
20945 \def\pgf@circ@bipole@voltage@label@anchor{east}
20946 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
20947 \fi
20948 \fi\fi
20949 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
20950 \ifpgf@circuit@bipole@voltage@below
20951 \def\pgf@circ@bipole@voltage@label@anchor{north east}
20952 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
20953 \fi
20954 \fi\fi
20955 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
20956 \ifpgf@circuit@bipole@voltage@below
20957 \def\pgf@circ@bipole@voltage@label@anchor{north}
20958 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
20959 \fi
20960 \fi\fi
20961 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
20962 \ifpgf@circuit@bipole@voltage@below
20963 \def\pgf@circ@bipole@voltage@label@anchor{north}
20964 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
20965 \fi
20966 \fi\fi
20967
20968 % this must be set *before* changing for mirroring and inverting; in that case
20969 % the xscale/yscale parameters take it into account
20970 \ifpgf@circuit@bipole@voltage@below
20971 \def\pgf@circ@bipole@voltage@label@where{-90}
20972 \else
20973 \def\pgf@circ@bipole@voltage@label@where{90}
20974 \fi
20975
20976 % magic to counteract the scale and yscale effects (there should be a better way...)
20977 \ifnum \ctikzvalof{mirror value}=-1
20978 \ifpgf@circuit@bipole@voltage@below
20979 \pgf@circuit@bipole@voltage@belowfalse
20980 \else
20981 \pgf@circuit@bipole@voltage@belowtrue
20982 \fi
20983 \fi
20984
20985 \ifpgf@circuit@bipole@inverted
20986 \ifpgf@circuit@bipole@voltage@below
20987 \pgf@circuit@bipole@voltage@belowfalse
20988 \else
20989 \pgf@circuit@bipole@voltage@belowtrue
20990 \fi
20991 \fi
20992
20993 % take into account scaling
20994 \setscaledRlenforclass
20995
20996 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
20997 \pgfkeysifdefined{\pgf@temp}
20998 { \edef\eudist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}} }
20999 { \edef\eudist{\ctikzvalof{voltage/european label distance}} }
21000 % find the height of the bipole or use a default value
21001 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
21002 \pgfkeysifdefined{\pgf@temp}
21003 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
21004 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
21005 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
21006 \newdimen{\alshift}
21007 % this is more or less the same of the legacy code; we shift the american label a bit
21008 % outside the (+) -- (-) line
21009 \pgfmathsetlength{\alshift}{(\ctikzvalof{voltage/american label distance}-0.6)*\partheight}
21010 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
21011 % set the macro for detecting open
21012 \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
21013 \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi
21014 % \typeout{KIND\space\@@kind}
21015 }%end pgfextra
21016
21017 \ifpgf@circuit@bipole@isvoltage
21018 \pgf@circ@drawvoltagegenerator
21019 \else
21020 \pgf@circ@drawvoltagegeneric
21021 \fi
21022
21023 % \pgfextra{\typeout{LABEL\space KIND:\@@kind\space OPEN:\@@open}}
21024
21025 \ifpgf@circuit@bipole@voltage@straight
21026 coordinate (Vlab) at ($(pgfcirc@Vto)!0.5!(pgfcirc@Vfrom) $)
21027 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
21028 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
21029 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
21030 \else
21031 \ifpgf@circuit@europeanvoltage
21032 coordinate (Vlab) at ($(pgfcirc@Vcont1)!0.5!(pgfcirc@Vcont2)$)
21033 \else
21034 coordinate (Vlab) at ($(pgfcirc@Vfrom)!0.5!(pgfcirc@Vto)$)
21035 \ifpgf@circuit@bipole@isvoltage\else
21036 % add a bit of space for american labels above their symbols in the normal case. You can avoid that
21037 % with voltage/american label distance=0.5 (it's measured from the center of the component, in heights)
21038 coordinate (Vlab) at ($(Vlab) ! \alshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vto)$)
21039 \fi
21040 \fi
21041
21042 \ifpgf@circuit@europeanvoltage
21043 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
21044 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
21045 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
21046 \else % american voltages
21047 \ifx\@@kind\@@open
21048 coordinate (Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
21049 node [anchor=center, inner sep=2pt,
21050 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
21051 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
21052 \else
21053 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
21054 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
21055 at (Vlab) {\pgf@circ@finallabels{voltage/label}}
21056 \fi
21057 \fi
21058 \fi
21059 }%end drawvoltages
21060 %%%---------- close: tex/pgfcircvoltage
21061 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
21062 %%%---------- open: tex/pgfcirccurrent.tex
21063 % Copyright 2018-2026 by Romano Giannetti
21064 % Copyright 2015-2026 by Stefan Lindner
21065 % Copyright 2013-2026 by Stefan Erhardt
21066 % Copyright 2007-2026 by Massimo Redaelli
21067 %
21068 % This file may be distributed and/or modified
21069 %
21070 % 1. under the LaTeX Project Public License and/or
21071 % 2. under the GNU Public License.
21072 %
21073 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
21074
21075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21076 %% Current handling
21077
21078 %% styles
21079 \ctikzset{bipole current style/.style={}}
21080 \tikzset{bipole current style/.code={
21081 \ctikzset{bipole current style/.style={#1}}
21082 }}
21083 \tikzset{bipole current append style/.code={
21084 \ctikzset{bipole current style/.append style={#1}}
21085 }}
21086
21087 %% Options
21088 \ctikzset{i^>/.style = {
21089 i = #1,
21090 \circuitikzbasekey/bipole/current/direction = forward,
21091 \circuitikzbasekey/bipole/current/x position = after,
21092 \circuitikzbasekey/bipole/current/y position = above
21093 }
21094 }
21095
21096 \ctikzset{i_>/.style = {
21097 i = #1,
21098 \circuitikzbasekey/bipole/current/direction = forward,
21099 \circuitikzbasekey/bipole/current/x position = after,
21100 \circuitikzbasekey/bipole/current/y position = below
21101 }
21102 }
21103
21104 \ctikzset{i>^/.style = {
21105 i = #1,
21106 \circuitikzbasekey/bipole/current/direction = forward,
21107 \circuitikzbasekey/bipole/current/x position = before,
21108 \circuitikzbasekey/bipole/current/y position = above
21109 }
21110 }
21111
21112 \ctikzset{i>_/.style = {
21113 i = #1,
21114 \circuitikzbasekey/bipole/current/direction = forward,
21115 \circuitikzbasekey/bipole/current/x position = before,
21116 \circuitikzbasekey/bipole/current/y position = below
21117 }
21118 }
21119
21120 \ctikzset{i^</.style = {
21121 i = #1,
21122 \circuitikzbasekey/bipole/current/direction = backward,
21123 \circuitikzbasekey/bipole/current/x position = after,
21124 \circuitikzbasekey/bipole/current/y position = above
21125 }
21126 }
21127
21128 \ctikzset{i_</.style = {
21129 i = #1,
21130 \circuitikzbasekey/bipole/current/direction = backward,
21131 \circuitikzbasekey/bipole/current/x position = after,
21132 \circuitikzbasekey/bipole/current/y position = below
21133 }
21134 }
21135
21136 \ctikzset{i<^/.style = {
21137 i = #1,
21138 \circuitikzbasekey/bipole/current/direction = backward,
21139 \circuitikzbasekey/bipole/current/x position = before,
21140 \circuitikzbasekey/bipole/current/y position = above
21141 }
21142 }
21143
21144 \ctikzset{i<_/.style = {
21145 i = #1,
21146 \circuitikzbasekey/bipole/current/direction = backward,
21147 \circuitikzbasekey/bipole/current/x position = before,
21148 \circuitikzbasekey/bipole/current/y position = below
21149 }
21150 }
21151
21152 \ctikzset{i/.code = {
21153 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
21154 \circuitikzbasekey/bipole/current/x position = after,
21155 \circuitikzbasekey/bipole/current/y position = above }
21156 \pgfkeys{/tikz/circuitikz/bipole/current/label/name=#1}
21157 \ctikzsetvalof{bipole/current/label/unit}{}
21158 \ifpgf@circ@siunitx
21159 \pgf@circ@handleSI{#1}
21160 \ifpgf@circ@siunitx@res
21161 \edef\pgf@temp{\pgf@circ@handleSI@val}
21162 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
21163 \edef\pgf@temp{\pgf@circ@handleSI@unit}
21164 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
21165 \else
21166 \fi
21167 \else
21168 \fi
21169 %reverse current direction for voltage sources
21170 \ifpgf@circ@oldvoltagedirection\else
21171 \ifpgf@circuit@bipole@isvoltage
21172 \ifpgf@circuit@bipole@voltage@backward
21173 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
21174 \circuitikzbasekey/bipole/current/x position = after,
21175 \circuitikzbasekey/bipole/current/y position = below }
21176 \else
21177 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
21178 \circuitikzbasekey/bipole/current/x position = before,
21179 \circuitikzbasekey/bipole/current/y position = above }
21180 \fi\fi\fi
21181 }
21182 }
21183
21184 \ifpgf@circ@oldvoltagedirection
21185 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward } }
21186 \else
21187 \ctikzset{i</.style = { i = #1, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
21188 \fi
21189 \ctikzset{i_/.style = { i = #1, \circuitikzbasekey/bipole/current/y position = below } }
21190 \ctikzset{i>/.style = {i = #1, \circuitikzbasekey/bipole/current/direction = forward } }
21191 \ctikzset{i^/.style = { i= #1, \circuitikzbasekey/bipole/current/y position = above } }
21192
21193 %% Output routine
21194 \def\pgf@circ@drawcurrent{
21195 \pgfextra{
21196 \edef\pgf@circ@ffffff{\pgf@circ@direction}
21197 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil}
21198
21199 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
21200 \ifpgf@circuit@bipole@current@below
21201 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
21202 \fi
21203 \fi\fi
21204 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
21205 \ifpgf@circuit@bipole@current@below
21206 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
21207 \fi
21208 \fi\fi
21209 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
21210 \ifpgf@circuit@bipole@current@below
21211 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
21212 \fi
21213 \fi\fi
21214 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
21215 \ifpgf@circuit@bipole@current@below
21216 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
21217 \fi
21218 \fi\fi
21219 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
21220 \ifpgf@circuit@bipole@current@below
21221 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
21222 \fi
21223 \fi\fi
21224 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
21225 \ifpgf@circuit@bipole@current@below
21226 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
21227 \fi
21228 \fi\fi
21229 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
21230 \ifpgf@circuit@bipole@current@below
21231 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
21232 \fi
21233 \fi\fi
21234 \ifnum\pgfcircmathresult <5
21235 \ifpgf@circuit@bipole@current@below
21236 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
21237 \fi
21238 \fi
21239 \ifnum\pgfcircmathresult >355
21240 \ifpgf@circuit@bipole@current@below
21241 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
21242 \fi
21243 \fi
21244
21245 \ifpgf@circuit@bipole@current@below
21246 \def\pgf@circ@bipole@current@label@where{-90}
21247 \else
21248 \def\pgf@circ@bipole@current@label@where{+90}
21249 \fi
21250 }
21251
21252 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
21253 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
21254 (\tikztostart)--(\tikztotarget)
21255 \else% normal bipole or source
21256 \ifpgf@circuit@bipole@current@before
21257 (\tikztostart)--(anchorstartnode)
21258 \else
21259 (anchorendnode)--(\tikztotarget)
21260 \fi
21261 \fi
21262 \ifpgf@circuit@bipole@current@backward
21263 \pgfextra{
21264 \pgfmathsubtract{\pgf@circ@ffffff}{180}
21265 \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21266 }
21267 \fi
21268 coordinate[currarrow,pos=\ctikzvalof{current/distance},rotate=\pgf@circ@ffffff,
21269 anchor=center](Iarrow)
21270 (Iarrow.\pgf@circ@bipole@current@label@where)
21271 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
21272 (\ctikzvalof{bipole/name}current){\pgf@circ@finallabels{current/label}}
21273 }
21274
21275 %%%---------- close: tex/pgfcirccurrent
21276 %%%%%%%%%%% Springe nach tex/pgfcircflow
21277 %%%---------- open: tex/pgfcircflow.tex
21278 % Copyright 2018-2026 by Romano Giannetti
21279 % Copyright 2015-2026 by Stefan Lindner
21280 % Copyright 2013-2026 by Stefan Erhardt
21281 % Copyright 2007-2026 by Massimo Redaelli
21282 %
21283 % This file may be distributed and/or modified
21284 %
21285 % 1. under the LaTeX Project Public License and/or
21286 % 2. under the GNU Public License.
21287 %
21288 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
21289
21290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21291 %% flow handling
21292
21293 %% styles
21294 \ctikzset{bipole flow style/.style={}}
21295 \tikzset{bipole flow style/.code={
21296 \ctikzset{bipole flow style/.style={#1}}
21297 }}
21298 \tikzset{bipole flow append style/.code={
21299 \ctikzset{bipole flow style/.append style={#1}}
21300 }}
21301
21302 %% Options
21303 \ctikzset{f^>/.style = {
21304 f = #1,
21305 \circuitikzbasekey/bipole/flow/direction = forward,
21306 \circuitikzbasekey/bipole/flow/x position = after,
21307 \circuitikzbasekey/bipole/curflowrent/y position = above
21308 }
21309 }
21310
21311 \ctikzset{f_>/.style = {
21312 f = #1,
21313 \circuitikzbasekey/bipole/flow/direction = forward,
21314 \circuitikzbasekey/bipole/flow/x position = after,
21315 \circuitikzbasekey/bipole/flow/y position = below
21316 }
21317 }
21318
21319 \ctikzset{f>^/.style = {
21320 f = #1,
21321 \circuitikzbasekey/bipole/flow/direction = forward,
21322 \circuitikzbasekey/bipole/flow/x position = before,
21323 \circuitikzbasekey/bipole/flow/y position = above
21324 }
21325 }
21326
21327 \ctikzset{f>_/.style = {
21328 f = #1,
21329 \circuitikzbasekey/bipole/flow/direction = forward,
21330 \circuitikzbasekey/bipole/flow/x position = before,
21331 \circuitikzbasekey/bipole/flow/y position = below
21332 }
21333 }
21334
21335 \ctikzset{f^</.style = {
21336 f = #1,
21337 \circuitikzbasekey/bipole/flow/direction = backward,
21338 \circuitikzbasekey/bipole/flow/x position = after,
21339 \circuitikzbasekey/bipole/flow/y position = above
21340 }
21341 }
21342
21343 \ctikzset{f_</.style = {
21344 f = #1,
21345 \circuitikzbasekey/bipole/flow/direction = backward,
21346 \circuitikzbasekey/bipole/flow/x position = after,
21347 \circuitikzbasekey/bipole/flow/y position = below
21348 }
21349 }
21350
21351 \ctikzset{f<^/.style = {
21352 f = #1,
21353 \circuitikzbasekey/bipole/flow/direction = backward,
21354 \circuitikzbasekey/bipole/flow/x position = before,
21355 \circuitikzbasekey/bipole/flow/y position = above
21356 }
21357 }
21358
21359 \ctikzset{f<_/.style = {
21360 f = #1,
21361 \circuitikzbasekey/bipole/flow/direction = backward,
21362 \circuitikzbasekey/bipole/flow/x position = before,
21363 \circuitikzbasekey/bipole/flow/y position = below
21364 }
21365 }
21366
21367 \ctikzset{f</.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = backward} }
21368 \ctikzset{f_/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = below } }
21369 \ctikzset{f>/.style = { f = #1, \circuitikzbasekey/bipole/flow/direction = forward } }
21370 \ctikzset{f^/.style = { f = #1, \circuitikzbasekey/bipole/flow/y position = above } }
21371
21372 \ctikzset{f/.code = {
21373 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
21374 \circuitikzbasekey/bipole/flow/x position = after,
21375 \circuitikzbasekey/bipole/flow/y position = above }
21376 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name=#1}
21377 \ctikzsetvalof{bipole/flow/label/unit}{}
21378 \ifpgf@circ@siunitx
21379 \pgf@circ@handleSI{#1}
21380 \ifpgf@circ@siunitx@res
21381 \edef\pgf@temp{\pgf@circ@handleSI@val}
21382 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
21383 \edef\pgf@temp{\pgf@circ@handleSI@unit}
21384 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
21385 \else
21386 \fi
21387 \else
21388 \fi
21389 }
21390 }
21391
21392 %% Output routine
21393 \def\pgf@circ@drawflow{
21394 \pgfextra{
21395 \edef\pgf@circ@ffffff{\pgf@circ@direction}
21396 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@ffffff\pgf@nil}
21397
21398 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
21399 \ifpgf@circuit@bipole@flow@below
21400 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
21401 \fi
21402 \fi\fi
21403 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
21404 \ifpgf@circuit@bipole@flow@below
21405 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
21406 \fi
21407 \fi\fi
21408 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
21409 \ifpgf@circuit@bipole@flow@below
21410 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
21411 \fi
21412 \fi\fi
21413 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
21414 \ifpgf@circuit@bipole@flow@below
21415 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
21416 \fi
21417 \fi\fi
21418 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
21419 \ifpgf@circuit@bipole@flow@below
21420 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
21421 \fi
21422 \fi\fi
21423 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
21424 \ifpgf@circuit@bipole@flow@below
21425 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
21426 \fi
21427 \fi\fi
21428 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
21429 \ifpgf@circuit@bipole@flow@below
21430 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
21431 \fi
21432 \fi\fi
21433 \ifnum\pgfcircmathresult <5
21434 \ifpgf@circuit@bipole@flow@below
21435 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
21436 \fi
21437 \fi
21438 \ifnum\pgfcircmathresult >355
21439 \ifpgf@circuit@bipole@flow@below
21440 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
21441 \fi
21442 \fi
21443
21444 \ifpgf@circuit@bipole@flow@below
21445 \def\pgf@circ@bipole@flow@label@where{-90}
21446 \else
21447 \def\pgf@circ@bipole@flow@label@where{+90}
21448 \fi
21449 }
21450
21451 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
21452 \ifx\pgf@circ@temp\pgf@temp%draw flow at a short at middle of the line
21453 (\tikztostart)--(\tikztotarget)
21454 \else% normal bipole or source
21455 \ifpgf@circuit@bipole@flow@before
21456 (\tikztostart)--(anchorstartnode)
21457 \else
21458 (anchorendnode)--(\tikztotarget)
21459 \fi
21460 \fi
21461 \pgfextra{
21462 \ifpgf@circuit@bipole@flow@backward
21463 \ifpgf@circuit@bipole@flow@below
21464 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
21465 \else
21466 \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen}
21467 \fi
21468 \pgfmathsubtract{\pgf@circ@ffffff}{180}
21469 \edef\pgf@circ@ffffff{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
21470 \else
21471 \ifpgf@circuit@bipole@flow@below
21472 \def\flow@offset{-\ctikzvalof{flow/offset}\pgf@circ@Rlen}
21473 \else
21474 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
21475 \fi
21476 \fi
21477 }
21478 coordinate[flowarrow,pos=\ctikzvalof{flow/distance},rotate=\pgf@circ@ffffff,yshift=\flow@offset, anchor=center](Farrowpos)
21479 (Farrowpos.\pgf@circ@bipole@flow@label@where) node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
21480 (\ctikzvalof{bipole/name}flow){\pgf@circ@finallabels{flow/label}}
21481 }
21482
21483 %%%---------- close: tex/pgfcircflow
21484
21485 % notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning
21486 \ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages,americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels}
21487
21488 \ProcessOptions\relax
21489
21490 %%%%%%%%%%% Springe nach tex/pgfcircpath
21491 %%%---------- open: tex/pgfcircpath.tex
21492 % Copyright 2018-2026 by Romano Giannetti
21493 % Copyright 2015-2026 by Stefan Lindner
21494 % Copyright 2013-2026 by Stefan Erhardt
21495 % Copyright 2007-2026 by Massimo Redaelli
21496 %
21497 % This file may be distributed and/or modified
21498 %
21499 % 1. under the LaTeX Project Public License and/or
21500 % 2. under the GNU Public License.
21501 %
21502 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
21503
21504
21505 \def\pgf@circ@direction{0.0}
21506
21507 % Names
21508 \ctikzset{name/.style = { n=#1 } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
21509 \ctikzset{n/.code = {
21510 \pgfkeys{/tikz/circuitikz/bipole/name=#1}
21511 }}
21512
21513 % Reflect the node along
21514 \ctikzset{mirrored/.is choice}
21515 \ctikzset{mirror value/.initial=1}
21516 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
21517 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
21518 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
21519
21520 % Invert node along path
21521 \ctikzset{inverted/.is choice}
21522 \ctikzset{invert value/.initial=1}
21523 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
21524 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
21525 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
21526 \newif\ifpgf@circuit@bipole@inverted
21527 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
21528
21529 \newif\ifpgf@circuit@bipole@voltage@backward
21530 \ctikzset{bipole/voltage/direction/.is choice}
21531 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
21532 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
21533
21534 % Initialize paths
21535 \def\pgfcircresetpath{
21536 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
21537 bipole/inverted=false, bipole/kind=,
21538 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
21539 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
21540 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
21541 bipole/current/y position=above, bipole/current/direction=forward,
21542 mirrored=false
21543 }
21544 }
21545
21546 %% Helper function for path-function to ensure using anchors between nodes
21547 \def\set@explicit@center@anchor#1{
21548 \pgfutil@ifundefined{pgf@sh@ns@#1}
21549 {
21550 %This coordinate is no node(but a relative position or a coordinate), no further handling needed
21551 }{
21552 \pgfutil@in@.{#1}
21553 \ifpgfutil@in@
21554 % Anchor is used, do nothing!
21555 \else%
21556 \let\tikz@moveto@waiting=\relax
21557 \pgfpathmoveto{\tikz@last@position}%force movement, because tikz@moveto@waiting
21558 \edef#1{#1.center}%ensure using center anchor
21559 \fi
21560 }
21561 }
21562
21563
21564 %% Generic bipole path
21565 %% I am not user what the second argument is needed for
21566 \def\pgf@circ@bipole@path#1#2{
21567
21568 \pgfextra{
21569 \set@explicit@center@anchor{\tikztostart}
21570 \set@explicit@center@anchor{\tikztotarget}
21571 \pgfsyssoftpath@getcurrentpath{\myp@th}%% save current path to extend after calculation of correct start/end coordinates
21572 \ctikzset{bipole/kind = #1}
21573 \edef\pgf@temp{\ctikzvalof{bipole/name}}
21574 \def\pgf@circ@temp{}
21575 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
21576 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
21577 \ctikzset{bipole/name = #1\pgf@circ@rand} % create it (re-usage should not create problem, but...)
21578 \fi
21579 }
21580
21581 (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relative start/end or constructions like ((node1)-|(node2))
21582 (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end)
21583 \pgfextra{
21584 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
21585 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
21586 % DO NOT ROUND HERE! pgfcirclabel.tex will do that when needed
21587 % \pgfmathround{\pgfmathresult}
21588 \edef\pgf@circ@direction{\pgfmathresult}%Calculate direction(angle) of path
21589 % \typeout{DIRECTION:\pgf@circ@direction}
21590 \pgfsyssoftpath@setcurrentpath{\myp@th}
21591 }
21592 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
21593 \ifx\pgf@temp\pgf@circ@temp % if it is an open
21594 \else
21595 --($(\ctikzvalof{bipole/name}start) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}end)$) %ugly workaround to get correct linejoins(node breaks path?)
21596 \fi
21597 ($(\tikztostart) ! .5 ! (\tikztotarget)$)%%positio of middle node
21598 node[#1shape, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value}, xscale=\ctikzvalof{invert value}]
21599 (\ctikzvalof{bipole/name}) {}
21600 \ifpgf@circuit@bipole@inverted
21601 \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
21602 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
21603 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
21604 \else
21605 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.right)
21606 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.left)
21607 \fi
21608 \else
21609 \ifcsname pgf@anchor@#1shape@pathstart\endcsname%if special path-anchors are defined, use them!
21610 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
21611 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
21612 \else
21613 coordinate (anchorstartnode) at (\ctikzvalof{bipole/name}.left)
21614 coordinate (anchorendnode) at (\ctikzvalof{bipole/name}.right)
21615 \fi
21616 \fi
21617 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
21618 \ifx\pgf@temp\pgf@circ@temp % if it is an open
21619 \else
21620 (\ctikzvalof{bipole/name}start.center) -- (anchorstartnode)
21621 (anchorendnode) -- (\ctikzvalof{bipole/name}end.center)
21622 \fi
21623
21624 \drawpoles
21625 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
21626 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
21627 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else\pgf@circ@drawvoltage\fi
21628 \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi
21629 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi
21630 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#1}}
21631 \ifx\pgf@temp\pgf@circ@temp % if it is an open
21632 (\ctikzvalof{bipole/name}end)%Move to end of path
21633 \else
21634 ($(\ctikzvalof{bipole/name}end) ! .5\pgflinewidth ! (\ctikzvalof{bipole/name}start)$) -- (\ctikzvalof{bipole/name}end)%ugly workaround to get correct linejoins(node breaks path?)
21635 %tikztostart and tikztotarget could not be used, because it would break if target coordinate is something like (node1-|node2)
21636
21637 \fi
21638 % reset
21639 \pgfextra{
21640 \pgfcircresetpath
21641 }
21642 \tikztonodes%draw pending nodes an path
21643 }
21644
21645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21646 %% Handling of terminals
21647
21648 \ctikzset{bipole/nodes/.is family}
21649 \ctikzset{bipole/nodes/left/.initial=none}
21650 \ctikzset{bipole/nodes/right/.initial=none}
21651 \tikzset{bipole nodes/.style n args={2}{%
21652 \circuitikzbasekey/bipole/nodes/left=#1,
21653 \circuitikzbasekey/bipole/nodes/right=#2
21654 }
21655 }
21656
21657 %% Easily usable styles
21658
21659 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21660 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21661 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
21662 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21663 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
21664 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21665 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21666 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
21667 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
21668 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
21669 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21670 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
21671 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
21672 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21673 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21674
21675 % rectjoinfill workarounds
21676
21677 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
21678 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
21679 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
21680 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
21681 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21682 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21683 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21684 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21685 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
21686
21687 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
21688
21689 \def\drawpoles{
21690 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
21691 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
21692 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
21693 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
21694 }
21695
21696 %% Path definitions
21697 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
21698 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
21699 \def\pgf@circ@sresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
21700 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
21701 \def\pgf@circ@thermistor@path#1{\pgf@circ@bipole@path{thermistor}{#1}}
21702 \def\pgf@circ@thermistorptc@path#1{\pgf@circ@bipole@path{thermistorptc}{#1}}
21703 \def\pgf@circ@thermistorntc@path#1{\pgf@circ@bipole@path{thermistorntc}{#1}}
21704 \def\pgf@circ@varistor@path#1{\pgf@circ@bipole@path{varistor}{#1}}
21705 \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
21706 \def\pgf@circ@capacitivesens@path#1{\pgf@circ@bipole@path{capacitivesens}{#1}}
21707 \def\pgf@circ@ecapacitor@path#1{\pgf@circ@bipole@path{ecapacitor}{#1}}
21708 %% polar capacitor is deprectaed, use curved capacitor instead
21709 \def\pgf@circ@polarcapacitor@path#1{\pgf@circ@bipole@path{polarcapacitor}{#1}}
21710 \def\pgf@circ@ccapacitor@path#1{\pgf@circ@bipole@path{ccapacitor}{#1}}
21711 \def\pgf@circ@vcapacitor@path#1{\pgf@circ@bipole@path{vcapacitor}{#1}}
21712 \def\pgf@circ@piezoelectric@path#1{\pgf@circ@bipole@path{piezoelectric}{#1}}
21713 \def\pgf@circ@battery@path#1{\pgf@circ@bipole@path{battery}{#1}}
21714 \def\pgf@circ@batteryone@path#1{\pgf@circ@bipole@path{battery1}{#1}}
21715 \def\pgf@circ@batterytwo@path#1{\pgf@circ@bipole@path{battery2}{#1}}
21716 \def\pgf@circ@europeaninductor@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
21717 \def\pgf@circ@americaninductor@path#1{\pgf@circ@bipole@path{americaninductor}{#1}}
21718 \def\pgf@circ@cuteinductor@path#1{\pgf@circ@bipole@path{cuteinductor}{#1}}
21719 \def\pgf@circ@cutechoke@path#1{\pgf@circ@bipole@path{cutechoke}{#1}}
21720 \def\pgf@circ@inductor@path#1{%
21721 \pgfextra{
21722 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21723 \def\pgf@temp{european}%
21724 }
21725 \ifx\pgf@temp\pgf@circ@temp%
21726 \pgf@circ@europeaninductor@path{#1}%
21727 \else%
21728 \pgfextra{ \def\pgf@temp{cute} }%
21729 \ifx\pgf@temp\pgf@circ@temp%
21730 \pgf@circ@cuteinductor@path{#1}%
21731 \else%
21732 \pgf@circ@americaninductor@path{#1}%
21733 \fi%
21734 \fi%
21735 }
21736 \def\pgf@circ@vinductor@path#1{
21737 \pgfextra{
21738 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21739 \def\pgf@temp{european}%
21740 }
21741 \ifx\pgf@temp\pgf@circ@temp%
21742 \pgf@circ@veuropeaninductor@path{#1}%
21743 \else%
21744 \pgfextra{ \def\pgf@temp{cute} }%
21745 \ifx\pgf@temp\pgf@circ@temp%
21746 \pgf@circ@vcuteinductor@path{#1}%
21747 \else%
21748 \pgf@circ@vamericaninductor@path{#1}%
21749 \fi%
21750 \fi%
21751 }
21752 \def\pgf@circ@inductivesens@path#1{%
21753 \pgfextra{
21754 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21755 \def\pgf@temp{european}%
21756 }
21757 \ifx\pgf@temp\pgf@circ@temp%
21758 \pgf@circ@europeaninductivesens@path{#1}%
21759 \else%
21760 \pgfextra{ \def\pgf@temp{cute} }%
21761 \ifx\pgf@temp\pgf@circ@temp%
21762 \pgf@circ@cuteinductivesens@path{#1}%
21763 \else%
21764 \pgf@circ@americaninductivesens@path{#1}%
21765 \fi%
21766 \fi%
21767 }
21768 \def\pgf@circ@veuropeaninductor@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
21769 \def\pgf@circ@vamericaninductor@path#1{\pgf@circ@bipole@path{vamericaninductor}{#1}}
21770 \def\pgf@circ@vcuteinductor@path#1{\pgf@circ@bipole@path{vcuteinductor}{#1}}
21771 \def\pgf@circ@europeaninductivesens@path#1{\pgf@circ@bipole@path{sfullgeneric}{#1}}
21772 \def\pgf@circ@americaninductivesens@path#1{\pgf@circ@bipole@path{samericaninductor}{#1}}
21773 \def\pgf@circ@cuteinductivesens@path#1{\pgf@circ@bipole@path{scuteinductor}{#1}}
21774 \def\pgf@circ@lamp@path#1{\pgf@circ@bipole@path{lamp}{#1}}
21775 \def\pgf@circ@bulb@path#1{\pgf@circ@bipole@path{bulb}{#1}}
21776 \def\pgf@circ@esource@path#1{\pgf@circ@bipole@path{esource}{#1}}
21777 \def\pgf@circ@pvsource@path#1{\pgf@circ@bipole@path{pvsource}{#1}}
21778 \def\pgf@circ@vsource@path#1{\pgf@circ@bipole@path{vsource}{#1}}
21779 \def\pgf@circ@dcvsource@path#1{\pgf@circ@bipole@path{dcvsource}{#1}}
21780 \def\pgf@circ@vsourceam@path#1{\pgf@circ@bipole@path{vsourceAM}{#1}}
21781 \def\pgf@circ@vsourcesin@path#1{\pgf@circ@bipole@path{vsourcesin}{#1}}
21782 \def\pgf@circ@isource@path#1{\pgf@circ@bipole@path{isource}{#1}}
21783 \def\pgf@circ@oosource@path#1{\pgf@circ@bipole@path{oosource}{#1}}
21784 \def\pgf@circ@oosourcetrans@path#1{\pgf@circ@bipole@path{oosourcetrans}{#1}}
21785 \def\pgf@circ@ooosource@path#1{\pgf@circ@bipole@path{ooosource}{#1}}
21786 \def\pgf@circ@dcisource@path#1{\pgf@circ@bipole@path{dcisource}{#1}}
21787 \def\pgf@circ@isourcesin@path#1{\pgf@circ@bipole@path{isourcesin}{#1}}
21788 \def\pgf@circ@vsourcesquare@path#1{\pgf@circ@bipole@path{vsourcesquare}{#1}}
21789 \def\pgf@circ@vsourcetri@path#1{\pgf@circ@bipole@path{vsourcetri}{#1}}
21790 \def\pgf@circ@isourceam@path#1{\pgf@circ@bipole@path{isourceAM}{#1}}
21791 \def\pgf@circ@ecsource@path#1{\pgf@circ@bipole@path{ecsource}{#1}}
21792 \def\pgf@circ@cvsource@path#1{\pgf@circ@bipole@path{cvsource}{#1}}
21793 \def\pgf@circ@cvsourceam@path#1{\pgf@circ@bipole@path{cvsourceAM}{#1}}
21794 \def\pgf@circ@cvsourcesin@path#1{\pgf@circ@bipole@path{cvsourcesin}{#1}}
21795 \def\pgf@circ@cisource@path#1{\pgf@circ@bipole@path{cisource}{#1}}
21796 \def\pgf@circ@cisourceam@path#1{\pgf@circ@bipole@path{cisourceAM}{#1}}
21797 \def\pgf@circ@cisourcesin@path#1{\pgf@circ@bipole@path{cisourcesin}{#1}}
21798 \def\pgf@circ@short@path#1{\pgf@circ@bipole@path{short}{#1}}
21799 \def\pgf@circ@cspst@path#1{\pgf@circ@bipole@path{cspst}{#1}}
21800 \def\pgf@circ@ospst@path#1{\pgf@circ@bipole@path{ospst}{#1}}
21801 \def\pgf@circ@nos@path#1{\pgf@circ@bipole@path{nos}{#1}}
21802 \def\pgf@circ@ncs@path#1{\pgf@circ@bipole@path{ncs}{#1}}
21803 \def\pgf@circ@pushbutton@path#1{\pgf@circ@bipole@path{pushbutton}{#1}}
21804 \def\pgf@circ@ncpushbutton@path#1{\pgf@circ@bipole@path{ncpushbutton}{#1}}
21805 \def\pgf@circ@open@path#1{\pgf@circ@bipole@path{open}{#1}}
21806 \def\pgf@circ@generic@path#1{\pgf@circ@bipole@path{generic}{#1}}
21807 \def\pgf@circ@ageneric@path#1{\pgf@circ@bipole@path{ageneric}{#1}}
21808 \def\pgf@circ@tgeneric@path#1{\pgf@circ@bipole@path{tgeneric}{#1}}
21809 \def\pgf@circ@xgeneric@path#1{\pgf@circ@bipole@path{xgeneric}{#1}}
21810 \def\pgf@circ@fullgeneric@path#1{\pgf@circ@bipole@path{fullgeneric}{#1}}
21811 \def\pgf@circ@tfullgeneric@path#1{\pgf@circ@bipole@path{tfullgeneric}{#1}}
21812 \def\pgf@circ@ammeter@path#1{\pgf@circ@bipole@path{ammeter}{#1}}
21813 \def\pgf@circ@ohmmeter@path#1{\pgf@circ@bipole@path{ohmmeter}{#1}}
21814 \def\pgf@circ@voltmeter@path#1{\pgf@circ@bipole@path{voltmeter}{#1}}
21815 \def\pgf@circ@oscope@path#1{\pgf@circ@bipole@path{oscope}{#1}}
21816 \def\pgf@circ@empty@path#1{}
21817 \def\pgf@circ@photoresistor@path#1{\pgf@circ@bipole@path{photoresistor}{#1}}
21818 \def\pgf@circ@emptythyristor@path#1{\pgf@circ@bipole@path{emptythyristor}{#1}}
21819 \def\pgf@circ@fullthyristor@path#1{\pgf@circ@bipole@path{fullthyristor}{#1}}
21820 \def\pgf@circ@toggleswitch@path#1{\pgf@circ@bipole@path{toggleswitch}{#1}}
21821 \def\pgf@circ@memristor@path#1{\pgf@circ@bipole@path{memristor}{#1}}
21822 \def\pgf@circ@emptytriac@path#1{\pgf@circ@bipole@path{emptytriac}{#1}}
21823 \def\pgf@circ@fulltriac@path#1{\pgf@circ@bipole@path{fulltriac}{#1}}
21824 \def\pgf@circ@tline@path#1{\pgf@circ@bipole@path{tline}{#1}}
21825 \def\pgf@circ@mstline@path#1{\pgf@circ@bipole@path{mstline}{#1}}
21826 \def\pgf@circ@squid@path#1{\pgf@circ@bipole@path{squid}{#1}}
21827 \def\pgf@circ@barrier@path#1{\pgf@circ@bipole@path{barrier}{#1}}
21828 \def\pgf@circ@openbarrier@path#1{\pgf@circ@bipole@path{openbarrier}{#1}}
21829 \def\pgf@circ@thermocouple@path#1{\pgf@circ@bipole@path{thermocouple}{#1}}
21830 \def\pgf@circ@fuse@path#1{\pgf@circ@bipole@path{fuse}{#1}}
21831 \def\pgf@circ@afuse@path#1{\pgf@circ@bipole@path{afuse}{#1}}
21832
21833 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
21834 \def\pgf@circ@europeangfsurgearrester@path#1{\pgf@circ@bipole@path{european gas filled surge arrester}{#1}}
21835 \def\pgf@circ@americangfsurgearrester@path#1{\pgf@circ@bipole@path{american gas filled surge arrester}{#1}}
21836
21837 \def\pgf@circ@twoport@path#1{\pgf@circ@bipole@path{twoport}{#1}}
21838 \def\pgf@circ@vco@path#1{\pgf@circ@bipole@path{vco}{#1}}
21839 \def\pgf@circ@bandpass@path#1{\pgf@circ@bipole@path{bandpass}{#1}}
21840 \def\pgf@circ@bandstop@path#1{\pgf@circ@bipole@path{bandstop}{#1}}
21841 \def\pgf@circ@highpass@path#1{\pgf@circ@bipole@path{highpass}{#1}}
21842 \def\pgf@circ@lowpass@path#1{\pgf@circ@bipole@path{lowpass}{#1}}
21843 \def\pgf@circ@adc@path#1{\pgf@circ@bipole@path{adc}{#1}}
21844 \def\pgf@circ@dac@path#1{\pgf@circ@bipole@path{dac}{#1}}
21845 \def\pgf@circ@dsp@path#1{\pgf@circ@bipole@path{dsp}{#1}}
21846 \def\pgf@circ@fft@path#1{\pgf@circ@bipole@path{fft}{#1}}
21847 \def\pgf@circ@amp@path#1{\pgf@circ@bipole@path{amp}{#1}}
21848 \def\pgf@circ@vamp@path#1{\pgf@circ@bipole@path{vamp}{#1}}
21849 \def\pgf@circ@piattenuator@path#1{\pgf@circ@bipole@path{piattenuator}{#1}}
21850 \def\pgf@circ@vpiattenuator@path#1{\pgf@circ@bipole@path{vpiattenuator}{#1}}
21851 \def\pgf@circ@tattenuator@path#1{\pgf@circ@bipole@path{tattenuator}{#1}}
21852 \def\pgf@circ@vtattenuator@path#1{\pgf@circ@bipole@path{vtattenuator}{#1}}
21853 \def\pgf@circ@phaseshifter@path#1{\pgf@circ@bipole@path{phaseshifter}{#1}}
21854 \def\pgf@circ@vphaseshifter@path#1{\pgf@circ@bipole@path{vphaseshifter}{#1}}
21855 \def\pgf@circ@detector@path#1{\pgf@circ@bipole@path{detector}{#1}}
21856 %
21857 \def\pgf@circ@sacdc@path#1{\pgf@circ@bipole@path{sacdc}{#1}}
21858 \def\pgf@circ@sdcac@path#1{\pgf@circ@bipole@path{sdcac}{#1}}
21859 \def\pgf@circ@tacdc@path#1{\pgf@circ@bipole@path{tacdc}{#1}}
21860 \def\pgf@circ@tdcac@path#1{\pgf@circ@bipole@path{tdcac}{#1}}
21861
21862 %%Mechanical
21863 \def\pgf@circ@spring@path#1{\pgf@circ@bipole@path{spring}{#1}}
21864 \def\pgf@circ@inerter@path#1{\pgf@circ@bipole@path{inerter}{#1}}
21865 \def\pgf@circ@mass@path#1{\pgf@circ@bipole@path{mass}{#1}}
21866 \def\pgf@circ@damper@path#1{\pgf@circ@bipole@path{damper}{#1}}
21867 \def\pgf@circ@viscoe@path#1{\pgf@circ@bipole@path{viscoe}{#1}}
21868
21869 %% Styles
21870
21871 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
21872 \def\compattikzset#1{\tikzset{\comnpatname#1}}
21873
21874 %\def\ctikzsetbipole#1#2{%
21875 % \tikzset{#1/.style= {to path=#2, \circuitikzbasekey, l=##1}}%
21876 %}
21877
21878 \compattikzset{spring/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@spring@path, l=#1}}
21879 \compattikzset{inerter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inerter@path, l=#1}}
21880 \compattikzset{mass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mass@path, l=#1}}
21881 \compattikzset{damper/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@damper@path, l=#1}}
21882 \compattikzset{viscoe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@viscoe@path, l=#1}}
21883 \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}}
21884 \compattikzset{american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{resistor}{#1}, l=#1}}
21885 \compattikzset{european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{generic}{#1}, l=#1}}
21886 \compattikzset{potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@potentiometer@path, l=#1}}
21887 \compattikzset{varistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@varistor@path, l=#1}}
21888 \compattikzset{photoresistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@photoresistor@path, l=#1}}
21889 \compattikzset{thermistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistor@path, l=#1}}
21890 \compattikzset{thermistor ptc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorptc@path, l=#1}}
21891 \compattikzset{thermistor ntc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
21892 \compattikzset{american potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{potentiometer}{#1}, l=#1}}
21893 \compattikzset{european potentiometer/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{genericpotentiometer}{#1}, l=#1}}
21894 \compattikzset{variable resistor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vresistor@path, l=#1}}
21895 \compattikzset{variable american resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{vresistor}{#1}, l=#1}}
21896 \compattikzset{variable european resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@bipole@path{tgeneric}{#1}, l=#1}}
21897 \compattikzset{capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitor@path, l=#1}}
21898 \compattikzset{elko/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
21899 \compattikzset{ecapacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecapacitor@path, l=#1}}
21900 % polar capacitor is deprecated, use curved capacitor instead
21901 \compattikzset{polar capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@polarcapacitor@path, l=#1}}
21902 \compattikzset{curved capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ccapacitor@path, l=#1}}
21903 \compattikzset{variable capacitor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcapacitor@path, l=#1}}
21904 \compattikzset{piezoelectric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piezoelectric@path, l=#1}}
21905 \compattikzset{battery/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@battery@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21906 \compattikzset{battery1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batteryone@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21907 \compattikzset{battery2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@batterytwo@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21908 \compattikzset{inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductor@path, l=#1}}
21909 \compattikzset{gf surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
21910 \compattikzset{american gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americangfsurgearrester@path, l=#1}}
21911 \compattikzset{european gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeangfsurgearrester@path, l=#1}}
21912 \compattikzset{gas filled surge arrester/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@gfsurgearrester@path, l=#1}}
21913 \compattikzset{american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductor@path, l=#1}}
21914 \compattikzset{cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductor@path, l=#1}}
21915 \compattikzset{cute choke/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cutechoke@path, l=#1}}
21916 \compattikzset{european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductor@path, l=#1}}
21917 \compattikzset{variable inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vinductor@path, l=#1}}
21918 \compattikzset{variable european inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@veuropeaninductor@path, l=#1}}
21919 \compattikzset{variable american inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamericaninductor@path, l=#1}}
21920 \compattikzset{variable cute inductor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vcuteinductor@path, l=#1}}
21921 \compattikzset{tline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tline@path, l=#1}}
21922 \compattikzset{transmission line/.style = {tline = #1}}
21923 \compattikzset{TL/.style = {tline = #1}}
21924 \compattikzset{mstline/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mstline@path, l=#1}}
21925 \compattikzset{european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21926 \compattikzset{american voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
21927 \compattikzset{european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21928 \compattikzset{american current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21929 \compattikzset{empty controlled source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ecsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21930 \compattikzset{european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsource@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21931 \compattikzset{american controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceam@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
21932 \compattikzset{european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisource@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21933 \compattikzset{american controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceam@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21934 \compattikzset{sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
21935 \compattikzset{square voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcesquare@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
21936 \compattikzset{triangle voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourcetri@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1 }}
21937 \compattikzset{sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21938 \compattikzset{controlled sinusoidal voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourcesin@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
21939 \compattikzset{controlled sinusoidal current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourcesin@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
21940
21941 \compattikzset{voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
21942 \compattikzset{current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi current source = #1, \circuitikzbasekey/bipole/is current=true}}
21943 \compattikzset{controlled voltage source/.style = {\comnpatname \ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
21944 \compattikzset{controlled current source/.style = {\comnpatname \ifpgf@circuit@europeancurrent european \else american \fi controlled current source = #1, \circuitikzbasekey/bipole/is current=true}}
21945
21946
21947 \compattikzset{generic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@generic@path, l=#1}}
21948 \compattikzset{xgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@xgeneric@path, l=#1}}
21949 \compattikzset{ageneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ageneric@path, l=#1}}
21950 \compattikzset{tgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tgeneric@path, l=#1}}
21951 \compattikzset{fullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullgeneric@path, l=#1}}
21952 \compattikzset{tfullgeneric/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tfullgeneric@path, l=#1}}
21953 \compattikzset{short/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@short@path}}
21954 \compattikzset{open/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@open@path}}
21955
21956 \compattikzset{lamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lamp@path}}
21957 \compattikzset{bulb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bulb@path, l=#1}}
21958
21959 \compattikzset{squid/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@squid@path}}
21960 \compattikzset{barrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@barrier@path}}
21961 \compattikzset{openbarrier/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@openbarrier@path}}
21962 \compattikzset{thermocouple/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermocouple@path}}
21963 \compattikzset{fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fuse@path}}
21964 \compattikzset{asymmetric fuse/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@afuse@path}}
21965
21966 \compattikzset{twoport/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@twoport@path}}
21967 \compattikzset{vco/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vco@path}}
21968 \compattikzset{bandpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandpass@path}}
21969 \compattikzset{bandstop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@bandstop@path}}
21970 \compattikzset{highpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@highpass@path}}
21971 \compattikzset{lowpass/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@lowpass@path}}
21972 \compattikzset{adc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@adc@path}}
21973 \compattikzset{dac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dac@path}}
21974 \compattikzset{dsp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dsp@path}}
21975 \compattikzset{fft/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fft@path}}
21976 \compattikzset{amp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@amp@path}}
21977 \compattikzset{vamp/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vamp@path}}
21978 \compattikzset{piattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@piattenuator@path}}
21979 \compattikzset{vpiattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vpiattenuator@path}}
21980 \compattikzset{tattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tattenuator@path}}
21981 \compattikzset{vtattenuator/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vtattenuator@path}}
21982 \compattikzset{phaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@phaseshifter@path}}
21983 \compattikzset{vphaseshifter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vphaseshifter@path}}
21984 \compattikzset{detector/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@detector@path}}
21985 %
21986 \compattikzset{sacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sacdc@path, l=#1}}
21987 \compattikzset{sdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@sdcac@path, l=#1}}
21988 \compattikzset{tacdc/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tacdc@path, l=#1}}
21989 \compattikzset{tdcac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@tdcac@path, l=#1}}
21990
21991 % % % % % %
21992 % % Begin of Diodes
21993 % % % % % %
21994
21995 \def\pgf@circ@fulldiode@path#1{\pgf@circ@bipole@path{fulldiode}{#1}}
21996 \def\pgf@circ@fullzdiode@path#1{\pgf@circ@bipole@path{fullzdiode}{#1}}
21997 \def\pgf@circ@fullzzdiode@path#1{\pgf@circ@bipole@path{fullzzdiode}{#1}}
21998 \def\pgf@circ@fullsdiode@path#1{\pgf@circ@bipole@path{fullsdiode}{#1}}
21999 \def\pgf@circ@fulltdiode@path#1{\pgf@circ@bipole@path{fulltdiode}{#1}}
22000 \def\pgf@circ@fulllediode@path#1{\pgf@circ@bipole@path{fulllediode}{#1}}
22001 \def\pgf@circ@fullpdiode@path#1{\pgf@circ@bipole@path{fullpdiode}{#1}}
22002 \def\pgf@circ@fullvarcap@path#1{\pgf@circ@bipole@path{fullvarcap}{#1}}
22003 \def\pgf@circ@fullbidirectionaldiode@path#1{\pgf@circ@bipole@path{fullbidirectionaldiode}{#1}}
22004 \def\pgf@circ@emptydiode@path#1{\pgf@circ@bipole@path{emptydiode}{#1}}
22005 \def\pgf@circ@emptyzdiode@path#1{\pgf@circ@bipole@path{emptyzdiode}{#1}}
22006 \def\pgf@circ@emptyzzdiode@path#1{\pgf@circ@bipole@path{emptyzzdiode}{#1}}
22007 \def\pgf@circ@emptysdiode@path#1{\pgf@circ@bipole@path{emptysdiode}{#1}}
22008 \def\pgf@circ@emptytdiode@path#1{\pgf@circ@bipole@path{emptytdiode}{#1}}
22009 \def\pgf@circ@emptylediode@path#1{\pgf@circ@bipole@path{emptylediode}{#1}}
22010 \def\pgf@circ@emptypdiode@path#1{\pgf@circ@bipole@path{emptypdiode}{#1}}
22011 \def\pgf@circ@emptyvarcap@path#1{\pgf@circ@bipole@path{emptyvarcap}{#1}}
22012 \def\pgf@circ@emptybidirectionaldiode@path#1{\pgf@circ@bipole@path{emptybidirectionaldiode}{#1}}
22013
22014 \compattikzset{full diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulldiode@path}}
22015 \compattikzset{full Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullsdiode@path}}
22016 \compattikzset{full Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzdiode@path}}
22017 \compattikzset{full ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullzzdiode@path}}
22018 \compattikzset{full tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltdiode@path}}
22019 \compattikzset{full photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullpdiode@path}}
22020 \compattikzset{full led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulllediode@path}}
22021 \compattikzset{full varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullvarcap@path}}
22022 \compattikzset{full bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullbidirectionaldiode@path}}
22023 \compattikzset{full thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fullthyristor@path}}
22024 \compattikzset{full triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@fulltriac@path}}
22025
22026 \compattikzset{empty diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptydiode@path}}
22027 \compattikzset{empty Schottky diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptysdiode@path}}
22028 \compattikzset{empty Zener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzdiode@path}}
22029 \compattikzset{empty ZZener diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
22030 \compattikzset{empty tunnel diode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytdiode@path}}
22031 \compattikzset{empty photodiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptypdiode@path}}
22032 \compattikzset{empty led/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptylediode@path}}
22033 \compattikzset{empty varcap/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptyvarcap@path}}
22034 \compattikzset{empty bidirectionaldiode/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptybidirectionaldiode@path}}
22035 \compattikzset{empty thyristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptythyristor@path}}
22036 \compattikzset{empty triac/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@emptytriac@path}}
22037
22038 \compattikzset{stroke diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptydiode@path}}
22039 \compattikzset{stroke Schottky diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptysdiode@path}}
22040 \compattikzset{stroke Zener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzdiode@path}}
22041 \compattikzset{stroke ZZener diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyzzdiode@path}}
22042 \compattikzset{stroke tunnel diode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytdiode@path}}
22043 \compattikzset{stroke photodiode/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptypdiode@path}}
22044 \compattikzset{stroke led/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptylediode@path}}
22045 \compattikzset{stroke varcap/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptyvarcap@path}}
22046 \compattikzset{stroke thyristor/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptythyristor@path}}
22047 %\compattikzset{stroke triac/.style = {\circuitikzbasekey,\circuitikzbasekey/bipole/is strokedsymbol=true, /tikz/to path=\pgf@circ@emptytriac@path}}
22048
22049 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
22050
22051 \compattikzset{Schottky diode/.style = {\comnpatname \pgfcircdiodestylemacro Schottky diode}}
22052 \compattikzset{Zener diode/.style = {\comnpatname \pgfcircdiodestylemacro Zener diode}}
22053 \compattikzset{ZZener diode/.style = {\comnpatname \pgfcircdiodestylemacro ZZener diode}}
22054 \compattikzset{tunnel diode/.style = {\comnpatname \pgfcircdiodestylemacro tunnel diode}}
22055 \compattikzset{photodiode/.style = {\comnpatname \pgfcircdiodestylemacro photodiode}}
22056 \compattikzset{led/.style = {\comnpatname \pgfcircdiodestylemacro led}}
22057 \compattikzset{varcap/.style = {\comnpatname \pgfcircdiodestylemacro varcap}}
22058 \compattikzset{diode/.style = {\comnpatname \pgfcircdiodestylemacro diode}}
22059 \compattikzset{thyristor/.style = {\comnpatname \pgfcircdiodestylemacro thyristor}}
22060 \compattikzset{triac/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi triac}}%no stroke triac!
22061 \compattikzset{bidirectionaldiode/.style = {\comnpatname \ifpgf@circuit@fulldiode full \else empty \fi bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
22062
22063 %% Define Shortcuts
22064 \compattikzset{Do/.style = {\comnpatname empty diode}}
22065 \compattikzset{tDo/.style = {\comnpatname empty tunnel diode}}
22066 \compattikzset{zDo/.style = {\comnpatname empty Zener diode}}
22067 \compattikzset{zzDo/.style = {\comnpatname empty ZZener diode}}
22068 \compattikzset{sDo/.style = {\comnpatname empty Schottky diode}}
22069 \compattikzset{pDo/.style = {\comnpatname empty photodiode}}
22070 \compattikzset{leDo/.style = {\comnpatname empty led}}
22071 \compattikzset{VCo/.style = {\comnpatname empty varcap}}
22072 \compattikzset{biDo/.style = {\comnpatname empty bidirectionaldiode}}
22073 \compattikzset{Tyo/.style = {\comnpatname empty thyristor}}
22074 \compattikzset{Tro/.style = {\comnpatname empty triac}}
22075
22076 \compattikzset{D*/.style = {\comnpatname full diode}}
22077 \compattikzset{tD*/.style = {\comnpatname full tunnel diode}}
22078 \compattikzset{zD*/.style = {\comnpatname full Zener diode}}
22079 \compattikzset{zzD*/.style = {\comnpatname full ZZener diode}}
22080 \compattikzset{sD*/.style = {\comnpatname full Schottky diode}}
22081 \compattikzset{pD*/.style = {\comnpatname full photodiode}}
22082 \compattikzset{leD*/.style = {\comnpatname full led}}
22083 \compattikzset{VC*/.style = {\comnpatname full varcap}}
22084 \compattikzset{biD*/.style = {\comnpatname full bidirectionaldiode}}
22085 \compattikzset{Ty*/.style = {\comnpatname full thyristor}}
22086 \compattikzset{Tr*/.style = {\comnpatname full triac}}
22087
22088 \compattikzset{D/.style = {\comnpatname diode}}
22089 \compattikzset{tD/.style = {\comnpatname tunnel diode}}
22090 \compattikzset{zD/.style = {\comnpatname Zener diode}}
22091 \compattikzset{zzD/.style = {\comnpatname ZZener diode}}
22092 \compattikzset{sD/.style = {\comnpatname Schottky diode}}
22093 \compattikzset{pD/.style = {\comnpatname photodiode}}
22094 \compattikzset{leD/.style = {\comnpatname led}}
22095 \compattikzset{VC/.style = {\comnpatname varcap}}
22096 \compattikzset{biD/.style = {\comnpatname bidirectionaldiode}}
22097 \compattikzset{Ty/.style = {\comnpatname thyristor}}
22098 \compattikzset{Tr/.style = {\comnpatname triac}}
22099
22100 \compattikzset{D-/.style = {\comnpatname stroke diode}}
22101 \compattikzset{tD-/.style = {\comnpatname stroke tunnel diode}}
22102 \compattikzset{zD-/.style = {\comnpatname stroke Zener diode}}
22103 \compattikzset{zzD-/.style = {\comnpatname stroke ZZener diode}}
22104 \compattikzset{sD-/.style = {\comnpatname stroke Schottky diode}}
22105 \compattikzset{pD-/.style = {\comnpatname stroke photodiode}}
22106 \compattikzset{leD-/.style = {\comnpatname stroke led}}
22107 \compattikzset{VC-/.style = {\comnpatname stroke varcap}}
22108 \compattikzset{Ty-/.style = {\comnpatname stroke thyristor}}
22109 \compattikzset{Tr-/.style = {\comnpatname empty triac}}%no stroke triac!
22110 \compattikzset{biD-/.style = {\comnpatname empty bidirectionaldiode}}%no stroke bidirectionaldiode! (based on triac)
22111
22112 % % % % % %
22113 % % End of Diodes
22114 % % % % % %
22115
22116
22117 \compattikzset{memristor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@memristor@path}}
22118 \compattikzset{closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
22119 \compattikzset{opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ospst@path, l=#1}}
22120 \compattikzset{ncs/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
22121 \compattikzset{nos/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
22122 \compattikzset{normal closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncs@path, l=#1}}
22123 \compattikzset{normal open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@nos@path, l=#1}}
22124 \compattikzset{switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cspst@path, l=#1}}
22125 \compattikzset{push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
22126 \compattikzset{nopb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
22127 \compattikzset{normally open push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pushbutton@path, l=#1}}
22128 \compattikzset{ncpb/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
22129 \compattikzset{normally closed push button/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ncpushbutton@path, l=#1}}
22130 \compattikzset{toggle switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@toggleswitch@path}}
22131
22132 \compattikzset{ammeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ammeter@path}}
22133 \compattikzset{voltmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@voltmeter@path}}
22134 \compattikzset{ohmmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@ohmmeter@path}}
22135 \tikzset{oscope/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@oscope@path, l=#1}}
22136
22137 % cute switches
22138 %% closed cute switch
22139 \def\pgf@circ@cuteclosedswitch@path#1{\pgf@circ@bipole@path{cuteclosedswitch}{#1}}
22140 \compattikzset{cute closed switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosedswitch@path, l=#1}}
22141 \compattikzset{ccsw/.style= {\comnpatname cute closed switch= #1}}
22142
22143 %% open cute switch
22144 \def\pgf@circ@cuteopenswitch@path#1{\pgf@circ@bipole@path{cuteopenswitch}{#1}}
22145 \compattikzset{cute open switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopenswitch@path, l=#1}}
22146 \compattikzset{cosw/.style= {\comnpatname cute open switch= #1}}
22147
22148 %% closing cute switch
22149 \def\pgf@circ@cuteclosingswitch@path#1{\pgf@circ@bipole@path{cuteclosingswitch}{#1}}
22150 \compattikzset{cute closing switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteclosingswitch@path, l=#1}}
22151 \compattikzset{ccgsw/.style= {\comnpatname cute closing switch= #1}}
22152
22153 %% opening cute switch
22154 \def\pgf@circ@cuteopeningswitch@path#1{\pgf@circ@bipole@path{cuteopeningswitch}{#1}}
22155 \compattikzset{cute opening switch/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteopeningswitch@path, l=#1}}
22156 \compattikzset{cogsw/.style= {\comnpatname cute opening switch= #1}}
22157
22158
22159 % short forms
22160 \compattikzset{esource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@esource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
22161 \compattikzset{pvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@pvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
22162 \compattikzset{dcvsource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcvsource@path, \circuitikzbasekey/bipole/is voltage=true,\circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
22163 \compattikzset{dcisource/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@dcisource@path, \circuitikzbasekey/bipole/is current=true, l=#1}}
22164
22165 \compattikzset{ioosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is current=true,/tikz/to path=\pgf@circ@oosource@path, i=#1}}
22166 \compattikzset{voosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosource@path, v=#1}}
22167 \compattikzset{oosourcetrans/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@oosourcetrans@path, v=#1}}
22168 \compattikzset{ooosource/.style = {\circuitikzbasekey, \circuitikzbasekey/bipole/is voltage=true,/tikz/to path=\pgf@circ@ooosource@path, v=#1}}
22169
22170 \compattikzset{vsource/.style = {\comnpatname voltage source = #1}}
22171 \compattikzset{isource/.style = {\comnpatname current source = #1}}
22172 \compattikzset{cisource/.style = {\comnpatname controlled current source = #1}}
22173 \compattikzset{ecsource/.style = {\comnpatname empty controlled source = #1}}
22174 \compattikzset{cvsource/.style = {\comnpatname controlled voltage source = #1}}
22175 \compattikzset{vsourcesin/.style = {\comnpatname sinusoidal voltage source = #1}}
22176 \compattikzset{vsourcesquare/.style = {\comnpatname square voltage source = #1}}
22177 \compattikzset{vsourcetri/.style = {triangle voltage source = #1}}
22178 \compattikzset{isourcesin/.style = {\comnpatname sinusoidal current source = #1}}
22179 \compattikzset{cisourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
22180 \compattikzset{cvsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
22181
22182 \compattikzset{controlled vsource/.style = {\comnpatname controlled voltage source = #1}}
22183 \compattikzset{controlled isource/.style = {\comnpatname controlled current source = #1}}
22184 \compattikzset{controlled vsourcesin/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
22185 \compattikzset{controlled isourcesin/.style = {\comnpatname controlled sinusoidal current source = #1}}
22186
22187 \compattikzset{R/.style= {\comnpatname resistor = #1}}
22188 \compattikzset{vR/.style= {\comnpatname variable resistor = #1}}
22189 \compattikzset{phR/.style= {\comnpatname photoresistor = #1}}
22190 \compattikzset{thR/.style= {\comnpatname thermistor = #1}}
22191 \compattikzset{thRp/.style= {\comnpatname thermistor ptc= #1}}
22192 \compattikzset{thRn/.style= {\comnpatname thermistor ntc= #1}}
22193 \compattikzset{pR/.style= {\comnpatname potentiometer = #1}}
22194 \compattikzset{C/.style = {\comnpatname capacitor = #1}}
22195 \compattikzset{eC/.style = {\comnpatname ecapacitor = #1}}
22196 %% pC is deprecated, use cC instead
22197 \compattikzset{pC/.style = {\comnpatname polar capacitor = #1}}
22198 \compattikzset{cC/.style = {\comnpatname curved capacitor = #1}}
22199 \compattikzset{vC/.style = {\comnpatname variable capacitor = #1}}
22200 \compattikzset{PZ/.style = {\comnpatname piezoelectric = #1}}
22201 \compattikzset{L/.style = {\comnpatname inductor = #1}}
22202 \compattikzset{vL/.style = {\comnpatname variable inductor = #1}}
22203 \compattikzset{V/.style = {\comnpatname voltage source = #1}}
22204 \compattikzset{cV/.style = {\comnpatname controlled voltage source = #1}}
22205 \compattikzset{sV/.style = {\comnpatname sinusoidal voltage source = #1}}
22206 \compattikzset{sqV/.style = {\comnpatname square voltage source = #1}}
22207 \compattikzset{tV/.style = {\comnpatname triangle voltage source = #1}}
22208 \compattikzset{csV/.style = {\comnpatname controlled sinusoidal voltage source = #1}}
22209 \def\pgf@temp#1{
22210 \compattikzset{V#1/.style = {\comnpatname voltage source, v#1=##1} }
22211 \compattikzset{cV#1/.style = {\comnpatname controlled voltage source, v#1=##1} }
22212 \compattikzset{sV#1/.style = {\comnpatname sinusoidal voltage source, v#1=##1} }
22213 \compattikzset{csV#1/.style = {\comnpatname controlled sinusoidal voltage source, v#1=##1} }
22214 }
22215 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
22216 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
22217
22218 %current sources
22219 \compattikzset{I/.style = {\comnpatname current source = #1}}
22220 \compattikzset{cI/.style = {\comnpatname controlled current source = #1}}
22221 \compattikzset{sI/.style = {\comnpatname sinusoidal current source = #1}}
22222 \compattikzset{csI/.style = {\comnpatname controlled sinusoidal current source = #1}}
22223 \def\pgf@temp#1{
22224 \compattikzset{I#1/.style = {\comnpatname current source, i#1=##1} }
22225 \compattikzset{cI#1/.style = {\comnpatname controlled current source, i#1=##1} }
22226 \compattikzset{sI#1/.style = {\comnpatname sinusoidal current source, i#1=##1} }
22227 \compattikzset{csI#1/.style = {\comnpatname controlled sinusoidal current source, i#1=##1} }
22228 }
22229 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
22230 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
22231 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
22232
22233 % cute sources
22234 \def\pgf@circ@vsourceC@path#1{\pgf@circ@bipole@path{vsourceC}{#1}}
22235 \compattikzset{cute european voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
22236 \compattikzset{vsourceC/.style= {\comnpatname cute european voltage source= #1}}
22237 \compattikzset{ceV/.style= {\comnpatname cute european voltage source= #1}}
22238
22239 \def\pgf@circ@isourceC@path#1{\pgf@circ@bipole@path{isourceC}{#1}}
22240 \compattikzset{cute european current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
22241 \compattikzset{isourceC/.style= {\comnpatname cute european current source= #1}}
22242 \compattikzset{ceI/.style= {\comnpatname cute european current source= #1}}
22243
22244 \def\pgf@circ@cvsourceC@path#1{\pgf@circ@bipole@path{cvsourceC}{#1}}
22245 \compattikzset{cute european controlled voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cvsourceC@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
22246 \compattikzset{cvsourceC/.style= {\comnpatname cute european controlled voltage source= #1}}
22247 \compattikzset{cceV/.style= {\comnpatname cute european controlled voltage source= #1}}
22248
22249 \def\pgf@circ@cisourceC@path#1{\pgf@circ@bipole@path{cisourceC}{#1}}
22250 \compattikzset{cute european controlled current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cisourceC@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
22251 \compattikzset{cisourceC/.style= {\comnpatname cute european controlled current source= #1}}
22252 \compattikzset{cceI/.style= {\comnpatname cute european controlled current source= #1}}
22253
22254 % noise sources
22255 \def\pgf@circ@vsourceN@path#1{\pgf@circ@bipole@path{vsourceN}{#1}}
22256 \compattikzset{noise voltage source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceN@path, \circuitikzbasekey/bipole/is voltage=true, \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true, v=#1}}
22257 \compattikzset{vsourceN/.style= {\comnpatname noise voltage source= #1}}
22258 \compattikzset{nV/.style= {\comnpatname noise voltage source= #1}}
22259
22260 \def\pgf@circ@isourceN@path#1{\pgf@circ@bipole@path{isourceN}{#1}}
22261 \compattikzset{noise current source/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@isourceN@path, \circuitikzbasekey/bipole/is current=true, i=#1}}
22262 \compattikzset{isourceN/.style= {\comnpatname noise current source= #1}}
22263 \compattikzset{nI/.style= {\comnpatname noise current source= #1}}
22264
22265 % resistive sensor american style
22266 \def\pgf@circ@resistivesens@path#1{\pgf@circ@bipole@path{resistivesens}{#1}}
22267 \compattikzset{american resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistivesens@path, l=#1}}
22268 \compattikzset{european resistive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@thermistorntc@path, l=#1}}
22269 \compattikzset{resistive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@sresistor@path, l=#1}}
22270 \compattikzset{sR/.style= {\comnpatname resistive sensor= #1}}
22271
22272 \compattikzset{capacitive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@capacitivesens@path, l=#1}}
22273 \compattikzset{sC/.style= {\comnpatname capacitive sensor= #1}}
22274
22275 \compattikzset{cute inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@cuteinductivesens@path, l=#1}}
22276 \compattikzset{european inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@europeaninductivesens@path, l=#1}}
22277 \compattikzset{american inductive sensor/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@americaninductivesens@path, l=#1}}
22278 \compattikzset{inductive sensor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@inductivesens@path, l=#1}}
22279 \compattikzset{sL/.style= {\comnpatname inductive sensor= #1}}
22280
22281 \compattikzset{Mr/.style = {\comnpatname memristor}}
22282
22283 \compattikzset{cspst/.style = {\comnpatname closing switch = #1}}
22284 \compattikzset{ospst/.style = {\comnpatname opening switch = #1}}
22285 \compattikzset{spst/.style = {\comnpatname switch = #1}}
22286
22287 \compattikzset{afuse/.style = {\comnpatname asymmetric fuse=#1}}
22288
22289 \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
22290 \compattikzset{vss/.style = {\comnpatname vee = #1}}
22291
22292 % activate the to-style crossing
22293 \def\pgf@circ@crossing@path#1{\pgf@circ@bipole@path{crossing}{#1}}
22294 \compattikzset{crossing/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@crossing@path, l=#1}}
22295 \compattikzset{xing/.style= {\comnpatname crossing= #1}}
22296
22297 %% loudspeaker and microphone
22298
22299 \def\pgf@circ@loudspeaker@path#1{\pgf@circ@bipole@path{loudspeaker}{#1}}
22300 \compattikzset{loudspeaker/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@loudspeaker@path, l=#1}}
22301
22302 \def\pgf@circ@mic@path#1{\pgf@circ@bipole@path{mic}{#1}}
22303 \compattikzset{mic/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@mic@path, l=#1}}
22304
22305 % more instrument
22306 \def\pgf@circ@rmeter@path#1{\pgf@circ@bipole@path{rmeter}{#1}}
22307 \compattikzset{rmeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeter@path, l=#1}}
22308 \def\pgf@circ@rmeterwa@path#1{\pgf@circ@bipole@path{rmeterwa}{#1}}
22309 \compattikzset{rmeterwa/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@rmeterwa@path, l=#1}}
22310 \def\pgf@circ@smeter@path#1{\pgf@circ@bipole@path{smeter}{#1}}
22311 \compattikzset{smeter/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@smeter@path, l=#1}}
22312 % current loop probes
22313 \def\pgf@circ@iloop@path#1{\pgf@circ@bipole@path{iloop}{#1}}
22314 \compattikzset{iloop/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop@path, l=#1}}
22315 \def\pgf@circ@iloop2@path#1{\pgf@circ@bipole@path{iloop2}{#1}}
22316 \compattikzset{iloop2/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@iloop2@path, l=#1}}
22317 % qucs-style probes
22318 \def\pgf@circ@qiprobe@path#1{\pgf@circ@bipole@path{qiprobe}{#1}}
22319 \compattikzset{qiprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qiprobe@path, l=#1}}
22320 \def\pgf@circ@qvprobe@path#1{\pgf@circ@bipole@path{qvprobe}{#1}}
22321 \compattikzset{qvprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qvprobe@path, l=#1}}
22322 \def\pgf@circ@qpprobe@path#1{\pgf@circ@bipole@path{qpprobe}{#1}}
22323 \compattikzset{qpprobe/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@qpprobe@path, l=#1}}
22324 % multiwire(s)
22325 \def\pgf@circ@bmultiwire@path#1{\pgf@circ@bipole@path{bmultiwire}{#1}}
22326 \compattikzset{bmultiwire/.style = {\circuitikzbasekey,
22327 /tikz/to path=\pgf@circ@bmultiwire@path, l=#1}}
22328 \def\pgf@circ@multiwire@path#1{\pgf@circ@bipole@path{multiwire}{#1}}
22329 \compattikzset{multiwire/.style = {\circuitikzbasekey,
22330 /tikz/to path=\pgf@circ@multiwire@path, l=#1}}
22331 \def\pgf@circ@tmultiwire@path#1{\pgf@circ@bipole@path{tmultiwire}{#1}}
22332 \compattikzset{tmultiwire/.style = {\circuitikzbasekey,
22333 /tikz/to path=\pgf@circ@tmultiwire@path, l=#1}}
22334
22335 % reed switches
22336 \def\pgf@circ@reed@path#1{\pgf@circ@bipole@path{reed}{#1}}
22337 \compattikzset{reed/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@reed@path, l=#1}}
22338
22339 % Transistor like bipoles
22340
22341 \def\pgf@circ@trans@path#1#2{
22342 \pgfextra{
22343 \edef\pgf@temp{\ctikzvalof{bipole/name}}
22344 \def\pgf@circ@temp{#2}
22345 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
22346 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
22347 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
22348 \fi
22349 }
22350 \ifpgf@circuit@bipole@inverted
22351 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
22352 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
22353 \else
22354 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
22355 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
22356 \fi
22357 \pgfextra{
22358 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
22359 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
22360 \pgfmathadd{\pgfmathresult}{-90}
22361 \pgfmathround{\pgfmathresult}
22362 \edef\pgf@circ@direction{\pgfmathresult}
22363 }
22364 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
22365 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
22366 (\ctikzvalof{bipole/name}) {}
22367 node {\ctikzvalof{bipole/label/name}}
22368 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
22369 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
22370 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
22371 \else
22372 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
22373 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
22374 \fi
22375 \drawpoles
22376 \pgfextra{
22377 \pgfcircresetpath
22378 }
22379 (\tikztotarget) \tikztonodes % e si continua
22380 }
22381
22382
22383 \def\pgf@circ@definetranspath#1{
22384 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
22385 }
22386
22387 \pgf@circ@definetranspath{elmech}
22388 \pgf@circ@definetranspath{nmos}
22389 \pgf@circ@definetranspath{pmos}
22390 \pgf@circ@definetranspath{hemt}
22391 \pgf@circ@definetranspath{npn}
22392 \pgf@circ@definetranspath{pnp}
22393 \pgf@circ@definetranspath{nfet}
22394 \pgf@circ@definetranspath{nigfete}
22395 \pgf@circ@definetranspath{nigfetd}
22396 \pgf@circ@definetranspath{nigfetebulk}
22397 \pgf@circ@definetranspath{pfet}
22398 \pgf@circ@definetranspath{pigfete}
22399 \pgf@circ@definetranspath{pigfetd}
22400 \pgf@circ@definetranspath{pigfetebulk}
22401 \pgf@circ@definetranspath{njfet}
22402 \pgf@circ@definetranspath{pjfet}
22403 \pgf@circ@definetranspath{pigbt}
22404 \pgf@circ@definetranspath{nigbt}
22405 \pgf@circ@definetranspath{Lpigbt}
22406 \pgf@circ@definetranspath{Lnigbt}
22407 %%%---------- close: tex/pgfcircpath
22408
22409 \ifpgf@circ@siunitx
22410 \RequirePackage{xstring}[2009/03/13]
22411 %\expandafter\let\csname angstrom\endcsname\relax
22412 \RequirePackage{siunitx}
22413 \fi
22414
22415 \ifpgf@circ@explicitvdir\else
22416 \PackageWarningNoLine{circuitikz}{%
22417 You did not specify one of the voltage directions:\MessageBreak
22418 \space\space oldvoltagedirection, nooldvoltagedirection, \MessageBreak
22419 \space\space RPvoltages or EFvoltages \MessageBreak
22420 Default directions may have changed, \MessageBreak
22421 please check the manual%
22422 }
22423 \fi
22424
22425 \newenvironment{circuitikz}{\begin{tikzpicture}}{\end{tikzpicture}}
22426 %override (unused) circuitikz environment for compability to externalization)
22427 \let\circuitikz\tikzpicture
22428 \let\endcircuitikz\endtikzpicture
22429
22430 \endinput