Debian Codegraph @

texmf-dist/tex/latex/circuitikz/circuitikz-1.7.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.7.2}
16 \def\pgfcircversiondate{2025/03/21}
17
18 %% Version 3.0 of pgf/TikZ is required
19 \RequirePackage{tikz}
20 \usetikzlibrary{calc}
21 %
22 % "arrows" library is deprecated, and behave badly with
23 % arrows on short paths. Change to the new arrows.meta
24 % In pfgcirc.define, we will add the old definition of
25 % latex' which we have lost in the transition
26 %
27 \usetikzlibrary{arrows.meta, bending}
28 \usetikzlibrary{fpu} % may be needed for use fpu reciprocal (v1.0.1)
29 %
30 % global of options (better use styles!)
31 %
32 \DeclareOption{european}{\AtEndOfPackage{%
33 \ctikzset{voltage=european} \ctikzset{current=european} \ctikzset{inductor=european}
34 \ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european}}
35 }
36 \DeclareOption{american}{\AtEndOfPackage{%
37 \ctikzset{voltage=american} \ctikzset{current=american} \ctikzset{resistor=american} \ctikzset{inductor=american} \ctikzset{gas filled surge arrester choice = american}
38 \ctikzset{logic ports = american}}
39 }
40 %
41 % voltages
42 %
43 \DeclareOption{europeanvoltage}{\AtEndOfPackage{%
44 \ctikzset{voltage=european}}
45 }
46 \DeclareOption{straightvoltages}{\AtEndOfPackage{%
47 \ctikzset{voltage=straight}}
48 }
49 \DeclareOption{americanvoltage}{\AtEndOfPackage{%
50 \ctikzset{voltage=american}}
51 }
52 \DeclareOption{europeanvoltages}{\AtEndOfPackage{%
53 \ctikzset{voltage=european}}
54 }
55 \DeclareOption{americanvoltages}{\AtEndOfPackage{%
56 \ctikzset{voltage=american}}
57 }
58 % Voltage directions
59 \DeclareOption{oldvoltagedirection}{\AtEndOfPackage{%
60 \pgf@circ@oldvoltagedirectiontrue
61 \pgf@circ@explicitvdirtrue
62 \pgf@circ@fixbatteriesfalse}
63 }
64 \DeclareOption{nooldvoltagedirection}{\AtEndOfPackage{%
65 \pgf@circ@oldvoltagedirectionfalse
66 \pgf@circ@explicitvdirtrue
67 \pgf@circ@fixbatteriesfalse}
68 }
69 \DeclareOption{RPvoltages}{\AtEndOfPackage{%
70 \pgf@circ@oldvoltagedirectiontrue
71 \pgf@circ@explicitvdirtrue
72 \pgf@circ@fixbatteriestrue}
73 }
74 \DeclareOption{EFvoltages}{\AtEndOfPackage{%
75 \pgf@circ@oldvoltagedirectionfalse
76 \pgf@circ@explicitvdirtrue
77 \pgf@circ@fixbatteriestrue}
78 }
79 %
80 % currents
81 %
82 \DeclareOption{europeancurrent}{\AtEndOfPackage{%
83 \ctikzset{current = european}}
84 }
85 \DeclareOption{americancurrent}{\AtEndOfPackage{%
86 \ctikzset{current = american}}
87 }
88 \DeclareOption{europeancurrents}{\AtEndOfPackage{%
89 \ctikzset{current = european}}
90 }
91 \DeclareOption{americancurrents}{\AtEndOfPackage{%
92 \ctikzset{current = american}}
93 }
94 %
95 % resistors
96 %
97 \DeclareOption{americanresistor}{\AtEndOfPackage{%
98 \ctikzset{resistor = american}}
99 }
100 \DeclareOption{europeanresistor}{\AtEndOfPackage{%
101 \ctikzset{resistor = european}}
102 }
103 \DeclareOption{americanresistors}{\AtEndOfPackage{%
104 \ctikzset{resistor = american}}
105 }
106 \DeclareOption{europeanresistors}{\AtEndOfPackage{%
107 \ctikzset{resistor = european}}
108 }
109 %
110 % inductors
111 %
112 \DeclareOption{americaninductor}{\AtEndOfPackage{%
113 \ctikzset{inductor = american}}
114 }
115 \DeclareOption{europeaninductor}{\AtEndOfPackage{%
116 \ctikzset{inductor = european}}
117 }
118 \DeclareOption{cuteinductor}{\AtEndOfPackage{%
119 \ctikzset{inductor = cute}}
120 }
121 \DeclareOption{americaninductors}{\AtEndOfPackage{%
122 \ctikzset{inductor = american}}
123 }
124 \DeclareOption{europeaninductors}{\AtEndOfPackage{%
125 \ctikzset{inductor = european}}
126 }
127 \DeclareOption{cuteinductors}{\AtEndOfPackage{%
128 \ctikzset{inductor = cute}}
129 }
130 %
131 % logic ports
132 %
133 \DeclareOption{americanport}{\AtEndOfPackage{%
134 \ctikzset{logic ports = american}}
135 }
136 \DeclareOption{europeanport}{\AtEndOfPackage{%
137 \ctikzset{logic ports = european}}
138 }
139 \DeclareOption{americanports}{\AtEndOfPackage{%
140 \ctikzset{logic ports = american}}
141 }
142 \DeclareOption{europeanports}{\AtEndOfPackage{%
143 \ctikzset{logic ports = european}}
144 }
145 %
146 % surge arresters (really?)
147 %
148 \DeclareOption{americangfsurgearrester}{\AtEndOfPackage{%
149 \ctikzset{gas filled surge arrester choice = american}}
150 }
151 \DeclareOption{europeangfsurgearrester}{\AtEndOfPackage{%
152 \ctikzset{gas filled surge arrester choice = european}}
153 }
154 %
155 % diodes
156 %
157 \DeclareOption{fulldiodes}{\AtEndOfPackage{%
158 \ctikzset{diode = full}}
159 }
160 \DeclareOption{emptydiodes}{\AtEndOfPackage{%
161 \ctikzset{diode = empty}}
162 }
163 \DeclareOption{strokediodes}{\AtEndOfPackage{%
164 \ctikzset{diode = stroke}}
165 }
166 \DeclareOption{fulldiode}{\AtEndOfPackage{%
167 \ctikzset{diode = full}}
168 }
169 \DeclareOption{emptydiode}{\AtEndOfPackage{%
170 \ctikzset{diode = empty}}
171 }
172 \DeclareOption{strokediode}{\AtEndOfPackage{%
173 \ctikzset{diode = stroke}}
174 }
175 %
176 % MOSes and FETs
177 %
178 \DeclareOption{arrowmos}{\AtEndOfPackage{%
179 \pgf@circuit@mos@arrowstrue}
180 }
181 \DeclareOption{noarrowmos}{\AtEndOfPackage{%
182 \pgf@circuit@mos@arrowsfalse}
183 }
184 \DeclareOption{fetbodydiode}{\AtEndOfPackage{%
185 \pgf@circuit@fet@bodydiodetrue}
186 }
187 \DeclareOption{nofetbodydiode}{\AtEndOfPackage{%
188 \pgf@circuit@fet@bodydiodefalse}
189 }
190 \DeclareOption{fetsolderdot}{\AtEndOfPackage{%
191 \pgf@circuit@fet@solderdottrue}
192 }
193 \DeclareOption{nofetsolderdot}{\AtEndOfPackage{%
194 \pgf@circuit@fet@solderdotfalse}
195 }
196 \DeclareOption{emptypmoscircle}{\AtEndOfPackage{%
197 \pgf@circuit@pmos@emptycircletrue}
198 }
199 \DeclareOption{lazymos}{\AtEndOfPackage{%
200 \ctikzset{tripoles/nmos/width=.5}
201 \ctikzset{tripoles/nmos/gate height=.35}
202 \ctikzset{tripoles/nmos/base height=.35}
203 \ctikzset{tripoles/nmos/height/.initial=1.2}
204 \ctikzset{tripoles/nmos/base width=.5}
205 \ctikzset{tripoles/nmos/gate width=.65}
206 \ctikzset{tripoles/pmos/width=.5}
207 \ctikzset{tripoles/pmos/gate height=.35}
208 \ctikzset{tripoles/pmos/base height=.35}
209 \ctikzset{tripoles/pmos/height/.initial=1.2}
210 \ctikzset{tripoles/pmos/base width=.5}
211 \ctikzset{tripoles/pmos/gate width=.65}
212 \pgf@circuit@pmos@emptycircletrue}
213 }
214 %
215 % BJTs labels
216 %
217 \DeclareOption{legacytransistorstext}{\AtEndOfPackage{%
218 \pgf@circuit@transisors@fixlabelsfalse}
219 }
220 \DeclareOption{nolegacytransistorstext}{\AtEndOfPackage{%
221 \pgf@circuit@transisors@fixlabelstrue}
222 }
223 \DeclareOption{centertransistorstext}{\AtEndOfPackage{%
224 \pgf@circuit@transisors@fixlabelstrue}
225 }
226 %
227 % labels
228 %
229 \DeclareOption{straightlabels}{\AtEndOfPackage{%
230 \ctikzset{label/align = straight}}
231 }
232 \DeclareOption{rotatelabels}{\AtEndOfPackage{%
233 \ctikzset{label/align = rotate}}
234 }
235 \DeclareOption{smartlabels}{\AtEndOfPackage{%
236 \ctikzset{label/align = smart}}
237 }
238 %
239 % Several options (better use styles)
240 %
241 \DeclareOption{betterproportions}{\AtEndOfPackage{%
242 \ctikzset{monopoles/ground/width/.initial=.15}
243 \ctikzset{bipoles/resistor/height/.initial=.23}
244 \ctikzset{bipoles/resistor/width/.initial=.6}
245 \ctikzset{bipoles/capacitor/height/.initial=.4}
246 \ctikzset{bipoles/capacitor/width/.initial=.1}
247 \ctikzset{bipoles/potentiometer/height/.initial=.6}
248 \ctikzset{bipoles/potentiometer/height 2/.initial=.23}
249 \ctikzset{bipoles/potentiometer/width/.initial=.6}
250 \ctikzset{bipoles/photoresistor/height/.initial=.6}
251 \ctikzset{bipoles/photoresistor/height 2/.initial=.23}
252 \ctikzset{bipoles/photoresistor/width/.initial=.6}
253 \ctikzset{bipoles/thermistor/main/.initial=.7}
254 \ctikzset{bipoles/thermistor/height/.initial=.328}%.23/.7
255 \ctikzset{bipoles/thermistor/width/.initial=.6}
256 \ctikzset{bipoles/thermistorntc/width/.initial=.6}
257 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
258 \ctikzset{bipoles/thermistorntc/height/.initial=.328}%.23/.7
259 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.23/.7
260 \ctikzset{bipoles/thermistorptc/width/.initial=.6}
261 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
262 \ctikzset{bipoles/thermistorptc/height/.initial=.328}%.23/.7
263 \ctikzset{bipoles/varistor/main/.initial=.7}
264 \ctikzset{bipoles/varistor/height/.initial=.328}%.23/.7
265 \ctikzset{bipoles/varistor/width/.initial=.6}
266 \ctikzset{bipoles/vresistor/height/.initial=.45}
267 \ctikzset{bipoles/vresistor/width/.initial=.6}
268 \ctikzset{bipoles/generic/height/.initial=.23}
269 \ctikzset{bipoles/generic/width/.initial=.6}
270 \ctikzset{bipoles/generic potentiometer/height/.initial=.6}
271 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.23}
272 \ctikzset{bipoles/generic potentiometer/width/.initial=.6}
273 \ctikzset{bipoles/ageneric/height/.initial=.23}
274 \ctikzset{bipoles/ageneric/width/.initial=.6}
275 \ctikzset{bipoles/memristor/height/.initial=.23}
276 \ctikzset{bipoles/memristor/wave height/.initial=.375}
277 \ctikzset{bipoles/memristor/width/.initial=.60}
278 \ctikzset{bipoles/tgeneric/height/.initial=.525}
279 \ctikzset{bipoles/tgeneric/width/.initial=.6}
280 \ctikzset{bipoles/tfullgeneric/height/.initial=.525}
281 \ctikzset{bipoles/tfullgeneric/width/.initial=.60}
282 \ctikzset{bipoles/fullgeneric/height/.initial=.23}
283 \ctikzset{bipoles/fullgeneric/width/.initial=.6}
284 \ctikzset{bipoles/diode/height/.initial=.3}
285 \ctikzset{bipoles/diode/width/.initial=.25}
286 \ctikzset{bipoles/bidirectionaldiode/height/.initial=.66}
287 \ctikzset{bipoles/bidirectionaldiode/width/.initial=.6}
288 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
289 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
290 \ctikzset{tripoles/thyristor/height/.initial=.66}
291 \ctikzset{tripoles/thyristor/height 2/.initial=.3}
292 \ctikzset{tripoles/thyristor/width/.initial=.6}
293 \ctikzset{tripoles/thyristor/diode height/.initial=.3}
294 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
295 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
296 \ctikzset{tripoles/triac/height/.initial=.66}
297 \ctikzset{tripoles/triac/width/.initial=.6}
298 \ctikzset{tripoles/triac/diode width left/.initial=.3}
299 \ctikzset{tripoles/triac/diode width right/.initial=.3}}
300 }
301 % This is a nice hack that prints all the shapes declared
302 % by the package. Very useful for coverage testing and debugging.
303 %
304 % \let\origpgfdeclareshape=\pgfdeclareshape
305 % \def\pgfdeclareshape#1{%
306 % \typeout{SHAPE:\space"#1"}%
307 % \origpgfdeclareshape{#1}
308 % }
309 %
310 %
311 %%%%%%%%%
312 %%% These is the only direct options!
313 \DeclareOption{siunitx}{
314 \pgf@circ@siunitxtrue
315 }
316 \DeclareOption{nosiunitx}{
317 \pgf@circ@siunitxfalse
318 }
319 \DeclareOption{compatibility}{
320 \pgf@circuit@compattrue
321 }
322
323
324 %% we have to load this before options to define the magics for compatibility
325 %%%%%%%%%%% Springe nach tex/pgfcirc.defines
326 %%%---------- open: tex/pgfcirc.defines.tex
327 % Copyright 2018-2026 by Romano Giannetti
328 % Copyright 2015-2026 by Stefan Lindner
329 % Copyright 2013-2026 by Stefan Erhardt
330 % Copyright 2007-2026 by Massimo Redaelli
331 %
332 % This file may be distributed and/or modified
333 %
334 % 1. under the LaTeX Project Public License and/or
335 % 2. under the GNU Public License.
336 %
337 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
338 %
339 % This file has folding marks for vim (See last line).
340 %
341
342 %
343 % This file is loaded *before* the options for the package are executed, mainly
344 % for the following three ifs
345 %
346 % these three ifs are fundamental for the package loading options;
347 % do not move away
348 \newif\ifpgf@circ@siunitx
349 \newif\ifpgf@circ@siunitx@res
350 \newif\ifpgf@circuit@compat
351
352 %% Key managements%<<<1
353
354 \long\def\pgf@circ@comment#1{}
355
356 \def\circuitikzbasekey{/tikz/circuitikz}
357
358 \pgfkeys{\circuitikzbasekey/.is family}
359
360 \def\circuitikzset{\expandafter\pgfqkeys\expandafter{\circuitikzbasekey}}
361 \let\ctikzset\circuitikzset
362 \def\ctikzvalof#1{\pgfkeysvalueof{\circuitikzbasekey/#1}}
363 \def\ctikzsetvalof#1#2{\pgfkeyssetvalue{\circuitikzbasekey/#1}{#2}}
364
365 \pgfkeys{\circuitikzbasekey/.search also={/tikz}}
366 %%>>>
367
368 %% Temporary Counters and dimensions%<<<1
369 %% Temporary Counters
370 \newcount\pgf@circ@count@a
371 \newcount\pgf@circ@count@b
372 \newcount\pgf@circ@count@c
373 %%%%%%%%%%%%
374 %% Dimensions
375 % coordinate
376 \newdimen\pgf@circ@res@up
377 \newdimen\pgf@circ@res@down
378 \newdimen\pgf@circ@res@zero
379 \newdimen\pgf@circ@res@left
380 \newdimen\pgf@circ@res@right
381 \newdimen\pgf@circ@res@other
382 \newdimen\pgf@circ@res@step
383 \newdimen\pgf@circ@res@temp
384 % Base len for all circuitikz
385 \newdimen\pgf@circ@Rlen
386 % scaled length for internal use in scalable shapes
387 \newdimen\pgf@circ@scaled@Rlen
388 \ctikzset{bipoles/length/.code={\pgf@circ@Rlen = #1\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}}
389 \pgf@circ@Rlen = 1.4cm
390 % by default scale is 1.0
391 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
392 % inital thickness
393 \newdimen \pgfstartlinewidth
394 %%>>>
395
396 %% Colors%<<<
397
398 % The following code is by @muzimuzhi --- see comment in
399 % https://github.com/circuitikz/circuitikz/issues/605#issuecomment-1030745366
400 \newif\ifpgf@circ@setcolor
401
402 % similar to how `/tikz/draw` and `/tikz/fill` are defined
403 %
404 % - `color=none`, \pgfusecolor is not executed at the beginning of node path(s)
405 % - `color` or `color=` (no or empty value), ignored
406 % - `color=<color name>`, \pgfusecolor{<color name>} will be executed
407 \ctikzset{
408 color/.code={%
409 \edef\pgf@circ@temp{#1}%
410 \ifx\pgf@circ@temp\pgf@nonetext
411 \pgf@circ@setcolorfalse
412 \else
413 \ifx\pgf@circ@temp\pgfutil@empty
414 \else
415 \pgf@circ@setcolortrue
416 \pgfkeyssetvalue{\circuitikzbasekey/color}{#1}%
417 \edef\ctikz@strokecolor{\ctikzvalof{color}}%
418 \fi
419 \fi
420 },
421 % init
422 color=none
423 }
424
425 \let\ctikz@strokecolor\pgfutil@empty
426 \let\ctikz@fillcolor\pgfutil@empty
427 % do our tracking of color
428 \pgfkeys{/tikz/color/.add code={}{%
429 \edef\ctikz@strokecolor{#1}\ctikzset{color={#1}}}}
430 % do our tracking of fill
431 \pgfkeys{/tikz/fill/.add code={}{%
432 \edef\ctikz@fillcolor{#1}}}
433 %
434 % This is to try to track the "implicit" color specification of Tikz,
435 % like \draw[red,...] ...; which are not exactly the same than saying
436 % \draw[color=red,...] ...;
437 % This is too dangerous to issue by default (it was in 1.5.0 and it
438 % was an error), so we will just define a command and tell it in the
439 % manual.
440 % It needs \usepackage{regexpatch} (which is not compatible with
441 % xpatch, unfortunately)
442 % I do not know how to do the xpatchcmd in ConTeXt...
443 %
444 \def\ctikzPatchImplicitColor{%
445 \ifpgfutil@format@is@latex
446 \pgfkeysgetvalue{/tikz/.unknown/.@cmd}{\my@temp}
447 \xpatchcmd*\my@temp % use starred-form to replace all (two places actually)
448 {\expandafter\tikz@addoption\expandafter}
449 {\edef\ctikz@strokecolor{\tikz@key}%
450 \expandafter\tikz@addoption\expandafter}
451 {}{%
452 \pgfutil@packagewarning{circuitikz}{%
453 Color patch failed, use only explicit color=... (see manual)}}
454 \pgfkeyslet{/tikz/.unknown/.@cmd}{\my@temp}
455 \else
456 \pgfutil@packagewarning{circuitikz}{%
457 Not on LaTeX: patch failed, ^^J%
458 use only explicit color=...(see manual).}
459 \fi
460 }
461 %
462 \def\pgf@circ@setcolor{%
463 \ifpgf@circ@setcolor
464 \pgfsetcolor{\ctikzvalof{color}}%
465 \fi
466 }%
467 %
468 % Try our best to set the fill color the same as the draw
469 % color. This needs the patch above
470 %
471 \def\pgf@circ@setfillcolorasdraw{%
472 \ifx\tikz@strokecolor\pgfutil@empty
473 % we do not have the stroke color. Resort to the
474 % last explicit color command; this will fail if
475 % the color is changed mid-draw.
476 % "Doctor, it hurts if I touch here..."
477 \ifx\ctikz@strokecolor\pgfutil@empty
478 % no info here. Try to use the current color.
479 \pgfsetfillcolor{.}%
480 \else
481 % Try with the last seen change-color command
482 \pgfsetfillcolor{\ctikz@strokecolor}
483 \fi
484 \else
485 % we have strokecolor, yay!
486 \pgfsetfillcolor{\tikz@strokecolor}
487 \fi
488 }
489 % we call this when we want to fill of the "draw"
490 % color. So if we have no explicit color, use ".".
491 \def\pgf@circ@fill@strokecolor{%
492 \pgf@circ@setfillcolorasdraw
493 }
494 % this is to select the \pgftext color; set it as
495 % the stroke color (\pgftext uses the fill color)
496 \def\pgf@circ@text@strokecolor{%
497 \pgf@circ@setfillcolorasdraw
498 }
499 % debug text
500 \def\pgf@circ@debug@colors{%
501 \pgfscope
502 \pgfsetcolor{black}%
503 \pgftext[y=10pt]{\tiny S:\tikz@strokecolor~T:\tikz@textcolor~F:\tikz@fillcolor}%
504 \pgftext[y=16pt]{\tiny CS:\ctikz@strokecolor~CF:\ctikz@fillcolor}%
505 \endpgfscope
506 }
507 %>>>
508
509
510 %% Macros for basic drawing%<<<
511 %
512 \long\gdef\pgf@circ@draw@component#1{%
513 \behindbackgroundpath{%
514 \pgf@circ@start@draw@hooks
515 #1%
516 \pgf@circ@end@draw@hooks
517 }%
518 }%
519 %
520 % auxiliary macros to reset some thing in paths, for background images.
521 % use with care and ALWAYS inside a \pgfscope, see here:
522 % https://matrix.to/#/!NuxCISwYQJuyWwNsEI:matrix.org/$vQO6luq1F66LJ79dERmaqKI46qMBcjStqYCPi725uZE?via=matrix.org&via=2krueger.de&via=im.f3l.de
523 % Thanks to @muzimuzhi
524 %
525 \def\pgf@circ@reset@arrows{%
526 \pgfsetshortenstart{+0pt}\pgfsetshortenend{+0pt}\pgfsetarrows{-}%
527 }
528 \def\pgf@circ@reset@rounded{%
529 \pgfsetcornersarced{\pgfpointorigin}%
530 }
531 \def\pgf@circ@reset@arrows@rounded{%
532 \pgf@circ@reset@arrows\pgf@circ@reset@rounded
533 }
534 \def\pgf@circ@adjustfill{%
535 \ifx\ctikz@fillcolor\pgfutil@empty
536 % do nothing
537 \else
538 \ifx\ctikz@fillcolor\pgf@nonetext
539 % do nothing
540 \else
541 \pgfsetfillcolor{\ctikz@fillcolor}%
542 \fi
543 \fi
544 }
545 %% Hook macros for the start and end of component drawing. The idea is that
546 %% specific macros overrides class macro that overrides generic macro
547 %% the generic macro is the one that resets arrows and curved path parameters
548 %% but let the path inherits the rest (dashed, etc.)
549
550 \def\pgf@circ@start@draw@hooks{%
551 % \typeout{SHAPE: \pgf@sm@shape@name}
552 \ifcsname ctikz@hook@start@draw@component@\pgf@sm@shape@name\endcsname
553 \csname ctikz@hook@start@draw@component@\pgf@sm@shape@name\endcsname
554 \else
555 \ifcsname ctikzclass\endcsname
556 \ifcsname ctikz@hook@start@draw@class@\ctikzclass\endcsname
557 \csname ctikz@hook@start@draw@class@\ctikzclass\endcsname
558 % class defined, but no hook, run generic hook
559 \else
560 \csname ctikz@hook@start@draw@default\endcsname
561 \fi
562 % we have no class, we did not run specific hook:run generic hook
563 \else
564 \csname ctikz@hook@start@draw@default\endcsname
565 \fi
566 \fi
567 }
568 \def\pgf@circ@end@draw@hooks{%
569 % \typeout{SHAPE: \pgf@sm@shape@name}
570 \ifcsname ctikz@hook@end@draw@component@\pgf@sm@shape@name\endcsname
571 \csname ctikz@hook@end@draw@component@\pgf@sm@shape@name\endcsname
572 \else
573 \ifcsname ctikzclass\endcsname
574 \ifcsname ctikz@hook@end@draw@class@\ctikzclass\endcsname
575 \csname ctikz@hook@end@draw@class@\ctikzclass\endcsname
576 % class defined, but no hook, run generic hook
577 \else
578 \csname ctikz@hook@end@draw@default\endcsname
579 \fi
580 % we have no class, we did not run specific hook:run generic hook
581 \else
582 \csname ctikz@hook@end@draw@default\endcsname
583 \fi
584 \fi
585 }
586 %
587 %% default hook is to stop the propagation of arrows parameters and
588 %% arced corners.
589 %
590 \def\ctikz@hook@start@draw@default{\pgf@circ@reset@arrows@rounded}
591 %
592 %
593 %>>>
594
595 %% check loaded TikZ/pgf version %<<<`
596 %
597 % parse the release date, thanks to Skillmon
598 % https://github.com/pgf-tikz/pgf/issues/1348#issuecomment-2231681032
599 % date can be yyyy-mm-dd or (older TikZ) yyyy/mm/dd
600 \begingroup
601 \pgfutil@protected\def\parsedate#1%
602 {%
603 \afterassignment\parsedate@month
604 \pgf@circ@count@a=#1\relax
605 }
606 \pgfutil@protected\def\parsedate@month#1%
607 {%
608 \afterassignment\parsedate@day
609 \pgf@circ@count@b=%
610 }
611 \pgfutil@protected\def\parsedate@day#1%
612 {%
613 \afterassignment\parsedate@cleanup
614 \pgf@circ@count@c=%
615 }
616 \def\parsedate@cleanup#1\relax{}%
617 \parsedate{\pgfrevisiondate}%
618 \xdef\ctikz@@pgfyear{\the\pgf@circ@count@a}%
619 \xdef\ctikz@@pgfmonth{\the\pgf@circ@count@b}%
620 \xdef\ctikz@@pgfday{\the\pgf@circ@count@c}%
621 \endgroup
622 % The following code thanks to Skillmon:
623 % https://tex.stackexchange.com/a/722570/38080
624 % modified by romano to check the date
625 \def\ctikz@@ifpgfafter@auxi#1#2%
626 {%
627 \ifnum#1
628 \ctikz@@ifpgfafter@auxii{#2}%
629 \fi
630 }
631 \def\ctikz@@ifpgfafter@auxii#1\fi#2\ctikz@@ifpgfafter#3{\fi#1}
632 \def\ctikz@@ifpgfafter#1-#2-#3#%
633 {%
634 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfyear>#1}\pgfutil@firstoftwo
635 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfyear<#1}\pgfutil@secondoftwo
636 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfmonth>#2}\pgfutil@firstoftwo
637 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfmonth<#2}\pgfutil@secondoftwo
638 \ctikz@@ifpgfafter@auxi{\ctikz@@pgfday<#3}\pgfutil@secondoftwo
639 \pgfutil@gobble\ctikz@@ifpgfafter\pgfutil@firstoftwo
640 }
641 %
642 % usage \ctikz@@ifpgfafter 2023-01-16{true}{false}
643 % ^^^ no spaces here, braces needed.
644 %
645 %>>>
646
647 %% arrow tips macros and utilities %<<<1
648
649 % the default arrow is latexslim, which has been ported over old arrows library (deprecated)
650 % see https://tex.stackexchange.com/questions/234084/latex-arrow-tip-with-arrows-meta-library
651 % this was the original definition of latex' tips, renamed to avoid clashes
652 %
653 \pgfarrowsdeclare{latexslim}{latexslim}
654 {
655 \pgfutil@tempdima=0.28pt%
656 \advance\pgfutil@tempdima by.3\pgflinewidth%
657 \pgfarrowsleftextend{+-4\pgfutil@tempdima}
658 \pgfarrowsrightextend{+6\pgfutil@tempdima}
659 }
660 {
661 \pgfutil@tempdima=0.28pt%
662 \advance\pgfutil@tempdima by.3\pgflinewidth%
663 \pgfpathmoveto{\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
664 \pgfpathcurveto
665 {\pgfqpoint{3.5\pgfutil@tempdima}{.5\pgfutil@tempdima}}
666 {\pgfqpoint{-1\pgfutil@tempdima}{1.5\pgfutil@tempdima}}
667 {\pgfqpoint{-4\pgfutil@tempdima}{3.75\pgfutil@tempdima}}
668 \pgfpathcurveto
669 {\pgfqpoint{-1.5\pgfutil@tempdima}{1\pgfutil@tempdima}}
670 {\pgfqpoint{-1.5\pgfutil@tempdima}{-1\pgfutil@tempdima}}
671 {\pgfqpoint{-4\pgfutil@tempdima}{-3.75\pgfutil@tempdima}}
672 \pgfpathcurveto
673 {\pgfqpoint{-1\pgfutil@tempdima}{-1.5\pgfutil@tempdima}}
674 {\pgfqpoint{3.5\pgfutil@tempdima}{-.5\pgfutil@tempdima}}
675 {\pgfqpoint{6\pgfutil@tempdima}{0\pgfutil@tempdima}}
676 \pgfpathclose
677 \pgfusepathqfill
678 }
679 \pgfarrowsdeclarereversed{latexslim reversed}{latexslim reversed}{latexslim}{latexslim}
680 %% Jack Tap, see
681 %% https://github.com/circuitikz/circuitikz/issues/806
682 \pgfdeclarearrow{name=Jack Tap,
683 parameters = {%
684 \the\pgfarrowlength,%
685 \the\pgfarrowwidth,%
686 \ifpgfarrowswap s\fi%
687 \ifpgfarrowopen o\fi%
688 \ifpgfarrowroundjoin j\fi
689 \ifpgfarrowroundcap c\fi%
690 },
691 setup code = {
692 \pgfarrowssettipend{.5\pgfarrowlength}
693 \pgfarrowssetlineend{-.6\pgfarrowlength}
694 \pgfarrowssetvisualbackend{-.6\pgfarrowlength}
695 \pgfarrowssetbackend{-.6\pgfarrowlength}
696 % hull
697 \pgfarrowshullpoint{.5\pgfarrowlength}{0pt}
698 \pgfarrowshullpoint{0pt}{\pgfarrowwidth}
699 \pgfarrowshullpoint{-.6\pgfarrowlength}{0pt}
700 % Saves: Only the length:
701 \pgfarrowssavethe\pgfarrowlength
702 \pgfarrowssavethe\pgfarrowwidth
703 },
704 drawing code = {
705 \pgfsetdash{}{+0pt}
706 \pgfarrowlinewidth=\pgflinewidth
707 \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi
708 \ifpgfarrowroundcap\pgfsetroundcap\else\pgfsetbuttcap\fi
709 \pgfpathmoveto{\pgfqpoint{-.6\pgfarrowlength}{0pt}}
710 \pgfpathlineto{\pgfqpoint{-.5\pgfarrowlength}{0pt}}
711 \pgfpathlineto{\pgfqpoint{0pt}{\pgfarrowwidth}}
712 \pgfpathlineto{\pgfqpoint{.5\pgfarrowlength}{0pt}}
713 \ifpgfarrowopen
714 \pgfusepathqstroke
715 \else
716 \pgfpathclose
717 \ifdim\pgfarrowlinewidth>0pt\pgfusepathqfillstroke\else\pgfusepathqfill\fi
718 \fi
719 },
720 defaults = {length = 0.3cm, width=0.15cm, open},
721 % cache=false, % breaks everything
722 }
723 % the new "fill without arg" will be in TikZ 3.1.11. Apply it here if we have an
724 % older version
725 \ctikz@@ifpgfafter 2023-01-16{\relax}{%
726 % thanks @muzimuzhi https://github.com/pgf-tikz/pgf/issues/1348#issuecomment-2229075269
727 % undo the fill/.value required key
728 \expandafter\let\csname pgfk@/pgf/arrow keys/fill/.@def\endcsname\@undefined
729 \pgfkeys{/pgf/arrow keys/fill/.code={%
730 \def\pgf@temp{#1}%
731 \ifx\pgf@temp\pgf@nonetext%
732 \pgfarrowsaddtooptions{\pgfarrowopentrue}%
733 \else\ifx\pgf@temp\pgfkeysnovalue@text%
734 \pgfarrowsaddtooptions{\pgfarrowopenfalse}%
735 \else
736 \pgfarrowsaddtooptions{\pgfarrowopenfalse\def\pgf@arrows@fill@color{#1}}%
737 \fi\fi
738 }}%
739 }
740 \tikzset{v/.tip={Jack Tap[swap]}, ^/.tip={Jack Tap},
741 vf/.tip={Jack Tap[swap,fill]}, ^f/.tip={Jack Tap[fill]}}
742 %
743 % select the arrows using available defaults.
744 \def\pgfcirc@arrow@default{default}
745 % choose the arrows to use. Use #2 and #3 if the key is equal to "default"
746 % arguments: type, default start, default end
747 \def\pgfcirc@set@arrows#1#2#3{%
748 \pgfkeysifdefined{\circuitikzbasekey/#1 start arrow}%
749 {\edef\@@start{\ctikzvalof{#1 start arrow}}}%
750 {\edef\@@start{\pgfcirc@arrow@default}}
751 \pgfkeysifdefined{\circuitikzbasekey/#1 end arrow}%
752 {\edef\@@end{\ctikzvalof{#1 end arrow}}}%
753 {\edef\@@end{\pgfcirc@arrow@default}}
754 \ifx\@@start\pgfcirc@arrow@default
755 \pgfsetarrowsstart{#2}%
756 \else
757 \pgfsetarrowsstart{\@@start}%
758 \fi
759 \ifx\@@end\pgfcirc@arrow@default
760 \pgfsetarrowsend{#3}%
761 \else
762 \pgfsetarrowsend{\@@end}%
763 \fi
764 }
765
766 \def\pgf@circ@declare@family@arrows#1{%
767 \ctikzset{#1 start arrow/.initial={default}}
768 \ctikzset{#1 end arrow/.initial={default}}
769 \tikzset{#1 start arrow/.style={\circuitikzbasekey/#1 start arrow={##1}}}
770 \tikzset{#1 end arrow/.style={\circuitikzbasekey/#1 end arrow={##1}}}
771 }
772 %%>>>
773
774 %% Macros to do things depending on the class%<<<1
775
776 \def\pgf@circ@setifdefinedfill#1#2{%
777 % if \ctikzclass is defined and \ctikzclass/fill is defined and is not none:
778 % set the fill color and execute \pgfusepath{#1}, else execute \pgfusepath{#2}
779 % \typeout{SETIFDEF:#1\space#2:}
780 \ifdefined\ctikzclass
781 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/fill}%
782 {% yes, it's defined
783 \edef\@@tmp{\ctikzvalof{\ctikzclass/fill}}\edef\@@none{none}%
784 \ifx\@@tmp\@@none % but it's none
785 \pgfusepath{#2}%
786 \else
787 \pgfsetfillcolor{\@@tmp}%
788 \pgfusepath{#1}%
789 \fi
790 }{% the class is defined but the fill key not; use #2
791 \pgfusepath{#2}%
792 }
793 \else
794 \pgfusepath{#2}%
795 \fi
796 }
797
798 %% Macro to fill or draw
799
800 \def\pgf@circ@draworfill{%
801 \ifx\tikz@fillcolor\pgfutil@empty
802 \ifx\ctikz@fillcolor\pgfutil@empty
803 \pgf@circ@setifdefinedfill{draw,fill}{draw}
804 \else
805 \ifx\ctikz@fillcolor\pgf@nonetext
806 \pgf@circ@setifdefinedfill{draw,fill}{draw}
807 \else
808 \pgfsetfillcolor{\ctikz@fillcolor}
809 \pgfusepath{draw, fill}
810 \fi
811 \fi
812 \else
813 \pgfsetfillcolor{\tikz@fillcolor}
814 \pgfusepath{draw, fill}
815 \fi
816 }
817
818 \def\pgf@circ@draworfillandclip{%
819 \ifx\tikz@fillcolor\pgfutil@empty
820 \ifx\ctikz@fillcolor\pgfutil@empty
821 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
822 \pgfusepath{draw, clip}
823 \else
824 \ifx\ctikz@fillcolor\pgf@nonetext
825 \pgf@circ@setifdefinedfill{draw, clip, fill}{draw, clip}
826 \pgfusepath{draw, clip}
827 \else
828 \pgfsetfillcolor{\ctikz@fillcolor}
829 \pgfusepath{draw, clip, fill}
830 \fi
831 \fi
832 \else
833 \pgfsetfillcolor{\tikz@fillcolor}
834 \pgfusepath{draw, clip, fill}
835 \fi
836 }
837
838 \def\pgf@circ@maybefill{%
839 % \typeout{MAYBEFILL\tikz@fillcolor}%
840 \ifx\tikz@fillcolor\pgfutil@empty
841 \ifx\ctikz@fillcolor\pgfutil@empty
842 \pgf@circ@setifdefinedfill{fill}{discard}
843 \else
844 \ifx\ctikz@fillcolor\pgf@nonetext
845 \pgf@circ@setifdefinedfill{fill}{discard}
846 \else
847 \pgfsetfillcolor{\ctikz@fillcolor}
848 \pgfusepath{fill}
849 \fi
850 \fi
851 \else
852 \pgfsetfillcolor{\tikz@fillcolor}
853 \pgfusepath{fill}
854 \fi
855 }
856
857 %% Macros for setting linewidth
858 % #1 is the legacy class (bipoles, tripoles) etc
859 % #2 is the reference linewidth
860 \def\pgf@circ@setlinewidth#1#2{%
861 \ifdefined\ctikzclass
862 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/thickness}%
863 {% yes, it's defined
864 \edef\@@tmp{\ctikzvalof{\ctikzclass/thickness}}\edef\@@none{none}%
865 \ifx\@@tmp\@@none % but it's none
866 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}% passthrough legacy class
867 \else
868 \pgfsetlinewidth{\@@tmp #2}%
869 \fi
870 }{ % key not defined, do the legacy thing
871 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
872 }% Ok, do nothing
873 \else % no class
874 \pgfsetlinewidth{\ctikzvalof{#1/thickness}#2}%
875 \fi
876 }
877 % use \pgf@circ@setlinewidth{none}{\pgflinewidth} if there is no legacy case
878 \ctikzset{none/thickness/.initial=1.0} % do not touch
879
880 % set thickness relative to current thickness if exists class and key
881 \def\pgf@circ@set@relative@thickness#1{%
882 \ifdefined\ctikzclass
883 \pgfkeysifdefined{\circuitikzbasekey/\ctikzclass/#1}
884 {% yes, it's defined
885 \pgfsetlinewidth{\ctikzvalof{\ctikzclass/#1}\pgflinewidth}%
886 }{}
887 \fi
888 }
889
890 % set the color and dash pattern for a subset of the shape, following keys #1/color
891 % and #1/dash. The keys must exist, and check for none or default for both
892 \def\pgf@circ@subset@color@dash#1{%
893 % You *must* be sure that this is called inside a \pgfscope!
894 \edef\@@none{none}\edef\@@default{default}
895 \edef\@@tmp{\ctikzvalof{#1/color}}
896 \ifx\@@tmp\@@default\else
897 \pgfsetcolor{\@@tmp}
898 \fi
899 \edef\@@tmp{\ctikzvalof{#1/dash}}
900 \ifx\@@tmp\@@default\else
901 \ifx\@@tmp\@@none
902 \pgfsetdash{}{0pt}% solid line, override dash
903 \else
904 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
905 \fi
906 \fi
907 }
908 % similar o the above, use the fill parameter to set fill or draw
909 % for a subset of the shape
910 \def\pgf@circ@subset@fill@or@draw#1{%
911 % You *must* be sure that this is called inside a \pgfscope!
912 \edef\@@none{none}\edef\@@default{default}
913 \edef\@@tmp{\ctikzvalof{#1/fill}}
914 \ifx\@@tmp\@@none
915 \pgfusepath{draw}
916 \else
917 \ifx\@@tmp\@@default\else
918 \pgfsetfillcolor{\@@tmp}
919 \fi
920 \pgfusepath{draw, fill}
921 \fi
922 }
923 % ...and for the thickness
924 \def\pgf@circ@subset@thickness#1{%
925 % You *must* be sure that this is called inside a \pgfscope!
926 \edef\@@default{default}
927 \edef\@@tmp{\ctikzvalof{#1/thickness}}
928 \ifx\@@tmp\@@default\else
929 \pgfsetlinewidth{\@@tmp\pgflinewidth}%
930 \fi
931 }
932 % set the text color (via \color) if the color is not default or none
933 % needed in some strange case (like bodydiode' dots)
934 \def\pgf@circ@maybe@color#1{%
935 \edef\@@none{none}\edef\@@default{default}%
936 \edef\@@tmp{\ctikzvalof{#1}}%
937 \ifx\@@tmp\@@default\else
938 \ifx\@@tmp\@@none\else
939 \color{\@@tmp}%
940 \fi
941 \fi
942 }
943
944 %%>>>
945
946 %% font changes compatible with plain/LaTeX/ConTeXt%<<<1
947 %% thanks to Henri Menke https://github.com/circuitikz/circuitikz/issues/285#issuecomment-537224605
948
949 \ifpgfutil@format@is@latex
950 \long\def\pgf@circ@font@tiny{\tiny}
951 \long\def\pgf@circ@font@small{\small}
952 \long\def\pgf@circ@font@bold{\textbf}
953 \long\def\pgf@circ@font@boldmath{\boldmath}
954 \long\def\pgf@circ@font@sixbm{\fontsize{6}{7}\selectfont\boldmath}
955 \long\def\pgf@circ@font@tenbm{\fontsize{10}{12}\selectfont\boldmath}
956 \long\def\pgf@circ@font@twelve{\fontsize{12}{14}\selectfont}
957 \else\ifpgfutil@format@is@plain
958 \long\def\pgf@circ@font@tiny{\fiverm}
959 \long\def\pgf@circ@font@small{\sevenrm}
960 \long\def\pgf@circ@font@bold#1{{\bf#1}}
961 \long\def\pgf@circ@font@boldmath{\bf} % to be tested
962 \long\def\pgf@circ@font@sixbm{\sevenrm\bf} %
963 \long\def\pgf@circ@font@tenbm{\tenrm\bf} %
964 \long\def\pgf@circ@font@twelve{\twelverm} %
965 \else\ifpgfutil@format@is@context
966 \long\def\pgf@circ@font@tiny{\tfxx}
967 \long\def\pgf@circ@font@small{\tfx}
968 \long\def\pgf@circ@font@bold{\bold}
969 \long\def\pgf@circ@font@boldmath{\bold} % to be tested
970 \long\def\pgf@circ@font@sixbm{\tfx\bold} %
971 \long\def\pgf@circ@font@tenbm{\normal\bold}%
972 \long\def\pgf@circ@font@twelve{\tfa} %
973 \fi\fi\fi
974 % noop
975 \def\pgfcirc@nop#1{#1}% no operation, just strip {}
976 %
977 %
978 % Thanks to Phelype Oleinik https://tex.stackexchange.com/a/520806/38080
979 %
980 % this is needed to avoid problems with \ConTeXt
981 \ifcsname normalunexpanded\endcsname
982 \let\pgfcircutil@unexpanded\normalunexpanded
983 \else
984 \let\pgfcircutil@unexpanded\unexpanded
985 \fi
986 % minimally expand a pgfkey to check if it's {}/undefined or filled.
987 \def\unexpandedvalueof#1{%
988 \pgfcircutil@unexpanded\expandafter\expandafter
989 \expandafter\pgf@circ@valueof@chk\pgfkeysvalueof{#1}}
990 \def\pgf@circ@valueof@chk#1{%
991 \ifx\relax#1%
992 \expandafter\pgfutil@firstoftwo
993 \else
994 \expandafter\pgfutil@secondoftwo
995 \fi
996 {{}}% #1 is \relax, so consider empty
997 {\expandafter{#1}}% otherwise, leave the key after one more expansion
998 }%
999 %>>>
1000
1001 %% Generic macro for defining a bipole shape%<<<
1002 % #1 - additional anchors
1003 % #2 - lower y-size of the bipole (from the center).
1004 % #3 - #shape is the name of the shape
1005 % #4 - upper y-size of the bipole (from the center)
1006 % #5 - width of the bipole
1007 % #6 - macros drawing the bipole
1008 %
1009 \long\def\pgfcircdeclarebipole{%
1010 \pgfcircdeclarebipolescaled{default}}
1011
1012 %% Generic macro for defining a bipole shape
1013 % #1 - scale factor
1014 % #2 - additional anchors
1015 % #3 - lower y-size of the bipole (from the center).
1016 % #4 - #shape is the name of the shape
1017 % #5 - upper y-size of the bipole (from the center)
1018 % #6 - width of the bipole
1019 % #7 - macros drawing the bipole
1020 %
1021 \long\def\pgfcircdeclarebipolescaled#1#2#3#4#5#6#7{
1022 % \typeout{Declaring bipole:\space #4,}
1023 \pgfdeclareshape{#4shape}{
1024 \savedmacro{\ctikzclass}{\edef\ctikzclass{#1}}
1025 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
1026 \savedanchor{\northeast}{
1027 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
1028 \pgf@y=#5\pgf@circ@scaled@Rlen
1029 \pgf@y=.5\pgf@y
1030 \pgf@x=#6\pgf@circ@scaled@Rlen
1031 \pgf@x=.5\pgf@x
1032 }
1033 \savedanchor{\northeastborder}{
1034 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
1035 \pgf@y=#5\pgf@circ@scaled@Rlen
1036 \pgf@y=.5\pgf@y
1037 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
1038 \pgf@x=#6\pgf@circ@scaled@Rlen
1039 \pgf@x=.5\pgf@x
1040 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
1041 }
1042 \savedanchor{\southwestborder}{
1043 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
1044 \pgf@y=-#3\pgf@circ@scaled@Rlen
1045 \pgf@y=.5\pgf@y
1046 \pgf@y=\ctikzvalof{bipoles/border margin}\pgf@y
1047 \pgf@x=-#6\pgf@circ@scaled@Rlen
1048 \pgf@x=.5\pgf@x
1049 \pgf@x=\ctikzvalof{bipoles/border margin}\pgf@x
1050 }
1051 \savedanchor{\southwest}{
1052 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
1053 \pgf@y=-#3\pgf@circ@scaled@Rlen
1054 \pgf@y=.5\pgf@y
1055 \pgf@x=-#6\pgf@circ@scaled@Rlen
1056 \pgf@x=.5\pgf@x
1057 }
1058 \savedanchor{\centerpoint}{
1059 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
1060 \pgf@circ@res@down=-#3\pgf@circ@scaled@Rlen
1061 \pgf@circ@res@up=#5\pgf@circ@scaled@Rlen
1062 \pgfpointorigin % this is ok, it loads \pgf@x\pgf@y
1063 \pgf@y=\pgf@circ@res@up
1064 \advance\pgf@y by\pgf@circ@res@down
1065 \pgf@y=.5\pgf@y
1066 }
1067 \anchor{center}{\pgfpointorigin}
1068 \anchor{n}{\northeast\pgf@x=0cm }
1069 \anchor{north east}{\northeast}
1070 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
1071 \anchor{ne}{\northeast}
1072 \anchor{nw}{\northeast\pgf@x=-\pgf@x}
1073 \anchor{e}{\northeast\pgf@y=0cm }
1074 \anchor{s}{\southwest\pgf@x=0cm }
1075 \anchor{south east}{\southwest\pgf@x=-\pgf@x}
1076 \anchor{south west}{\southwest}
1077 \anchor{se}{\southwest\pgf@x=-\pgf@x}
1078 \anchor{sw}{\southwest}
1079 \anchor{w}{\southwest\pgf@y=0cm }
1080 \anchor{north}{\northeast\pgf@x=0cm }
1081 \anchor{east}{\northeast\pgf@y=0cm }
1082 \anchor{south}{\southwest\pgf@x=0cm }
1083 \anchor{west}{\southwest\pgf@y=0cm }
1084 \anchor{right}{\northeast\pgf@y=0cm }
1085 \anchor{above}{\northeast\pgf@x=0cm }
1086 \anchor{left}{\southwest\pgf@y=0cm }
1087 \anchor{below}{\southwest\pgf@x=0cm }
1088 \anchor{a}{\northeast\pgf@y=0cm }
1089 \anchor{b}{\southwest\pgf@y=0cm }
1090 \savedanchor{\textanchor}{%
1091 \pgf@y=\ht\pgfnodeparttextbox
1092 \pgf@x=-.5\wd\pgfnodeparttextbox
1093 }
1094 \anchor{text}{ \textanchor }
1095 \anchorborder{%
1096 \ifpgf@circuit@bipole@inverted
1097 \pgf@circ@res@left=-\pgf@x
1098 \pgf@circ@res@up=-\pgf@y
1099 \else
1100 \pgf@circ@res@left=\pgf@x
1101 \pgf@circ@res@up=\pgf@y
1102 \fi
1103 \ifdim\pgf@circ@res@up>0cm
1104 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\northeastborder}
1105 \else
1106 \southwestborder
1107 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@x}{-\pgf@y}}
1108 \fi
1109 }
1110 #2%
1111 \pgf@circ@draw@component{
1112 \pgf@circ@setcolor
1113 \northeast
1114 \pgf@circ@res@up = \pgf@y
1115 \pgf@circ@res@zero = 0cm
1116 \pgf@circ@res@left = -\pgf@x
1117 \pgf@circ@res@right = \pgf@x
1118 \southwest
1119 \pgf@circ@res@down = \pgf@y
1120 \pgf@circ@scaled@Rlen=\scaledRlen
1121 \pgfstartlinewidth=\pgflinewidth
1122 % we used to reset arced corners here --- now it's in the hooks. I hope.
1123 #7%
1124 \pgfsetlinewidth{\pgfstartlinewidth}
1125 }
1126 }
1127 }% %>>>
1128
1129 %% anchor adjustment macros%<<<
1130
1131 % Extend the border anchor position by the specified factors on the right-top (north east corner)
1132 % and the left-down (southwest border). Argument must be number (possibly decimal) without sign
1133
1134 \def\pgfcirc@border@extend@full#1#2#3#4{% right, top, left, down
1135 \anchorborder{%
1136 \ifpgf@circuit@bipole@inverted
1137 \pgf@circ@res@left=-\pgf@x
1138 \pgf@circ@res@up=-\pgf@y
1139 \else
1140 \pgf@circ@res@left=\pgf@x
1141 \pgf@circ@res@up=\pgf@y
1142 \fi
1143 \ifdim\pgf@circ@res@up>0cm
1144 \northeastborder
1145 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{#1\pgf@x}{#2\pgf@y}}
1146 \else
1147 \southwestborder
1148 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-#3\pgf@x}{-#4\pgf@y}}
1149 \fi
1150 }
1151 }
1152
1153 % Just up and down (very common)
1154 \def\pgfcirc@border@extend@updown#1#2{\pgfcirc@border@extend@full{1}{#1}{1}{#2}}%
1155
1156
1157 % set of symmetrical, geographical anchors when a \northwest saved anchor is available
1158 \long\def\pgfcirc@northwest@symmetric@geoanchors{%
1159 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
1160 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
1161 \anchor{e}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
1162 \anchor{left}{\northwest\pgf@y=0pt}
1163 \anchor{west}{\northwest\pgf@y=0pt}
1164 \anchor{w}{\northwest\pgf@y=0pt}
1165 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
1166 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
1167 \anchor{north}{\northwest\pgf@x=0pt}
1168 \anchor{n}{\northwest\pgf@x=0pt}
1169 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
1170 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
1171 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
1172 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
1173 \anchor{north west}{\northwest}
1174 \anchor{nw}{\northwest}
1175 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
1176 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
1177 }
1178 % the same, when we have \northeast (I know...)
1179 \long\def\pgfcirc@northeast@symmetric@geoanchors{%
1180 \anchor{north}{\northeast\pgf@x=0cm\relax}
1181 \anchor{n}{\northeast\pgf@x=0cm\relax}
1182 \anchor{east}{\northeast\pgf@y=0cm\relax}
1183 \anchor{e}{\northeast\pgf@y=0cm\relax}
1184 \anchor{right}{\northeast\pgf@y=0cm\relax}
1185 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
1186 \anchor{s}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
1187 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
1188 \anchor{w}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
1189 \anchor{left}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
1190 \anchor{north east}{\northeast}
1191 \anchor{ne}{\northeast}
1192 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
1193 \anchor{nw}{\northeast\pgf@x=-\pgf@x}
1194 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
1195 \anchor{se}{\northeast\pgf@y=-\pgf@y}
1196 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
1197 \anchor{sw}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
1198 }
1199 %>>>
1200
1201 %% text position in some component.%<<<1
1202 % (added with ieeestd logic ports. Maybe to be extended to other components,
1203 % like amplifiers)
1204 %
1205 \newif\ifpgf@circ@center@text\pgf@circ@center@texttrue
1206 \tikzset{component text/.is choice}%
1207 \tikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
1208 \tikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
1209 \ctikzset{component text/.is choice}%
1210 \ctikzset{component text/center/.code={\pgf@circ@center@texttrue}}%
1211 \ctikzset{component text/left/.code={\pgf@circ@center@textfalse}}%
1212 \ctikzset{left text distance/.initial=0.3em}%
1213 %>>>
1214
1215 %% voltage direction options%<<<1
1216
1217 \newif\ifpgf@circ@oldvoltagedirection % default false
1218 \newif\ifpgf@circ@explicitvdir
1219 \newif\ifpgf@circ@fixbatteries
1220
1221 \ctikzset{voltage dir/.is choice}
1222 \ctikzset{voltage dir/old/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriesfalse}}
1223 \ctikzset{voltage dir/noold/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriesfalse}}
1224 \ctikzset{voltage dir/RP/.code={\pgf@circ@oldvoltagedirectiontrue\pgf@circ@fixbatteriestrue}}
1225 \ctikzset{voltage dir/EF/.code={\pgf@circ@oldvoltagedirectionfalse\pgf@circ@fixbatteriestrue}}
1226 \tikzset{voltage dir/.style={circuitikz/voltage dir=#1}}%
1227 %>>>
1228
1229 %% bipole definitions for path component and text decorations%%<<<1
1230 %
1231 % Option "t=*" for nodes
1232 \pgfkeys{/tikz/t/.add code={}{\ctikzset{text=#1}}}
1233 \pgfkeys{/tikz/t1/.add code={}{\ctikzset{text in=#1}}}
1234 \pgfkeys{/tikz/t2/.add code={}{\ctikzset{text out=#1}}}
1235 %
1236 \ctikzset{bipole/.is family}
1237 \ctikzset{bipole/kind/.initial=}
1238 \ctikzset{bipole/name/.initial=}
1239 \newif\ifpgf@circuit@bipole@isvoltage
1240 \ctikzset{bipole/is voltage/.is if=pgf@circuit@bipole@isvoltage}
1241 \newif\ifpgf@circuit@bipole@override@source@vif
1242 \ctikzset{bipole/override source vif/.is if=pgf@circuit@bipole@override@source@vif}
1243 \newif\ifpgf@circuit@bipole@voltageoutsideofsymbol
1244 \ctikzset{bipole/is voltageoutsideofsymbol/.is if=pgf@circuit@bipole@voltageoutsideofsymbol}
1245 \newif\ifpgf@circuit@bipole@strokedsymbol
1246 \ctikzset{bipole/is strokedsymbol/.is if=pgf@circuit@bipole@strokedsymbol}
1247 \newif\ifpgf@circuit@bipole@iscurrent
1248 \ctikzset{bipole/is current/.is if=pgf@circuit@bipole@iscurrent}
1249
1250 \ctikzset{bipole/voltage/.is family}
1251 \newif\ifpgf@circuit@bipole@voltage@backward
1252 \ctikzset{bipole/voltage/direction/.is choice}
1253 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
1254 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
1255 \newif\ifpgf@circuit@bipole@voltage@below
1256 \ctikzset{bipole/voltage/position/.is choice}
1257 \ctikzset{bipole/voltage/position/above/.code={\pgf@circuit@bipole@voltage@belowfalse}}
1258 \ctikzset{bipole/voltage/position/below/.code={\pgf@circuit@bipole@voltage@belowtrue}}
1259
1260 \ctikzset{bipole/voltage/label/unit/.initial=}
1261 \ctikzset{bipole/voltage/label/name/.initial=}
1262
1263 \ctikzset{bipole/current/.is family}
1264 \newif\ifpgf@circuit@bipole@current@backward
1265 \ctikzset{bipole/current/direction/.is choice}
1266 \ctikzset{bipole/current/direction/forward/.code={\pgf@circuit@bipole@current@backwardfalse}}
1267 \ctikzset{bipole/current/direction/backward/.code={\pgf@circuit@bipole@current@backwardtrue}}
1268 \newif\ifpgf@circuit@bipole@current@before
1269 \ctikzset{bipole/current/x position/.is choice}
1270 \ctikzset{bipole/current/x position/after/.code={\pgf@circuit@bipole@current@beforefalse}}
1271 \ctikzset{bipole/current/x position/before/.code={\pgf@circuit@bipole@current@beforetrue}}
1272 \newif\ifpgf@circuit@bipole@current@below
1273 \ctikzset{bipole/current/y position/.is choice}
1274 \ctikzset{bipole/current/y position/above/.code={\pgf@circuit@bipole@current@belowfalse}}
1275 \ctikzset{bipole/current/y position/below/.code={\pgf@circuit@bipole@current@belowtrue}}
1276 \ctikzset{bipole/current/label/unit/.initial=}
1277 \ctikzset{bipole/current/label/name/.initial=}
1278
1279 \ctikzset{bipole/flow/.is family}
1280 \newif\ifpgf@circuit@bipole@flow@backward
1281 \ctikzset{bipole/flow/direction/.is choice}
1282 \ctikzset{bipole/flow/direction/forward/.code={\pgf@circuit@bipole@flow@backwardfalse}}
1283 \ctikzset{bipole/flow/direction/backward/.code={\pgf@circuit@bipole@flow@backwardtrue}}
1284 \newif\ifpgf@circuit@bipole@flow@before
1285 \ctikzset{bipole/flow/x position/.is choice}
1286 \ctikzset{bipole/flow/x position/after/.code={\pgf@circuit@bipole@flow@beforefalse}}
1287 \ctikzset{bipole/flow/x position/before/.code={\pgf@circuit@bipole@flow@beforetrue}}
1288 \newif\ifpgf@circuit@bipole@flow@below
1289 \ctikzset{bipole/flow/y position/.is choice}
1290 \ctikzset{bipole/flow/y position/above/.code={\pgf@circuit@bipole@flow@belowfalse}}
1291 \ctikzset{bipole/flow/y position/below/.code={\pgf@circuit@bipole@flow@belowtrue}}
1292 \ctikzset{bipole/flow/label/unit/.initial=}
1293 \ctikzset{bipole/flow/label/name/.initial=}
1294 \ctikzset{flow/distance/.initial = .5}
1295 \ctikzset{flow/offset/.initial = .2}%distance between flow-arrow and conductor
1296
1297 \ctikzset{bipole/label/.is family}
1298 \ctikzset{bipole/label/position/.initial=90}
1299 \ctikzset{bipole/label/unit/.initial=}
1300 \ctikzset{bipole/label/name/.initial=}
1301 \ctikzset{bipole/annotation/.is family}
1302 \ctikzset{bipole/annotation/position/.initial=-90}
1303 \ctikzset{bipole/annotation/unit/.initial=}
1304 \ctikzset{bipole/annotation/name/.initial=}
1305
1306
1307 \ctikzset{label/align/.is choice}
1308 \ctikzset{label/align/straight/.code={\ctikzsetvalof{label/align}{straight}}}
1309 \ctikzset{label/align/rotate/.code={\ctikzsetvalof{label/align}{rotate}}}
1310 \ctikzset{label/align/smart/.code={\ctikzsetvalof{label/align}{smart}}}
1311 %%>>>
1312
1313 %% traditional styles %<<<1
1314 %
1315 \ctikzset{thickness/.initial=2}
1316 \ctikzset{bipoles/border margin/.initial=1.1}
1317 \ctikzset{bipoles/thickness/.initial=2}
1318 \ctikzset{tripoles/thickness/.initial=2}
1319 \ctikzset{quadpoles/thickness/.initial=2}
1320 \ctikzset{nodes width/.initial=.04}
1321 %%>>>
1322
1323 %% Styles definitions and macros%<<<1
1324
1325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
1326 %% main style definitions
1327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
1328
1329 % load a style file: search ctikzstyle-NAME.tex in path
1330 \def\ctikzloadstyle#1{%
1331 \pgfutil@InputIfFileExists{ctikzstyle-#1}{}{%
1332 \tikzerror{I did not find the circuitikz style #1}}%
1333 }
1334
1335 % load and enact a style
1336 \def\ctikzsetstyle#1{%
1337 \ctikzloadstyle{#1}%
1338 \tikzset{#1 circuit style}%
1339 }
1340
1341 % global style parameters
1342 \ctikzset{default/scale/.initial=1.0} % do not touch
1343 \ctikzset{default/fill/.initial=none} % do not touch
1344 \ctikzset{default/thickness/.initial=none} % do not touch
1345 % default is use as the generic default style for bipoles
1346
1347 % mostly bipoles:
1348
1349 \ctikzset{resistors/scale/.initial=1.0}
1350 \ctikzset{resistors/fill/.initial=none}
1351 \ctikzset{resistors/thickness/.initial=none}
1352 \ctikzset{resistors/modifier thickness/.initial=1}% relative to main thickness
1353
1354 \ctikzset{capacitors/scale/.initial=1.0}
1355 \ctikzset{capacitors/fill/.initial=none}
1356 \ctikzset{capacitors/thickness/.initial=none}
1357 \ctikzset{capacitors/modifier thickness/.initial=1}
1358
1359 \ctikzset{inductors/scale/.initial=1.0}
1360 \ctikzset{inductors/fill/.initial=none}
1361 \ctikzset{inductors/thickness/.initial=none}
1362 \ctikzset{inductors/modifier thickness/.initial=1}
1363
1364 \ctikzset{diodes/scale/.initial=1.0}
1365 \ctikzset{diodes/fill/.initial=none}
1366 \ctikzset{diodes/thickness/.initial=none}
1367 % we define opto arrows style here because they are used also
1368 % in transistors
1369 \ctikzset{opto arrows/.is family}
1370 \ctikzset{opto arrows/relative thickness/.initial=1}
1371 \ctikzset{opto arrows/color/.initial=default}
1372 \ctikzset{opto arrows/dash/.initial=default}
1373 \def\pgf@circ@set@optoarrow@style{%
1374 % You *must* be sure that this is called inside a \pgfscope!
1375 \pgfsetlinewidth{\ctikzvalof{opto arrows/relative thickness}\pgflinewidth}
1376 \pgf@circ@subset@color@dash{opto arrows}
1377 \pgfcirc@set@arrows{opto}{}{latexslim}
1378 }
1379
1380 \ctikzset{batteries/scale/.initial=1.0}
1381 \ctikzset{batteries/fill/.initial=none}
1382 \ctikzset{batteries/thickness/.initial=none}
1383
1384 \ctikzset{sources/scale/.initial=1.0}
1385 \ctikzset{sources/fill/.initial=none}
1386 \ctikzset{sources/thickness/.initial=none}
1387
1388 \ctikzset{csources/scale/.initial=1.0}
1389 \ctikzset{csources/fill/.initial=none}
1390 \ctikzset{csources/thickness/.initial=none}
1391
1392 \ctikzset{instruments/scale/.initial=1.0}
1393 \ctikzset{instruments/fill/.initial=none}
1394 \ctikzset{instruments/thickness/.initial=none}
1395
1396 \ctikzset{mechanicals/scale/.initial=1.0}
1397 \ctikzset{mechanicals/fill/.initial=none}
1398 \ctikzset{mechanicals/thickness/.initial=none}
1399
1400 \ctikzset{misc/scale/.initial=1.0}
1401 \ctikzset{misc/fill/.initial=none}
1402 \ctikzset{misc/thickness/.initial=none}
1403
1404 \ctikzset{blocks/scale/.initial=1.0}
1405 \ctikzset{blocks/fill/.initial=none}
1406 \ctikzset{blocks/thickness/.initial=none}
1407
1408 % mostly nodes
1409
1410 \ctikzset{grounds/scale/.initial=1.0}
1411 \ctikzset{grounds/fill/.initial=none}
1412 \ctikzset{grounds/thickness/.initial=none}
1413
1414 \ctikzset{power supplies/scale/.initial=1.0}
1415 \ctikzset{power supplies/fill/.initial=none}
1416 \ctikzset{power supplies/thickness/.initial=none}
1417
1418 \ctikzset{transistors/scale/.initial=1.0}
1419 \ctikzset{transistors/fill/.initial=none}
1420 \ctikzset{transistors/thickness/.initial=none}
1421 \ctikzset{transistors/modifier thickness/.initial=1}% relative to main thickness
1422
1423 \ctikzset{tubes/scale/.initial=1.0}
1424 \ctikzset{tubes/fill/.initial=none}
1425 \ctikzset{tubes/thickness/.initial=none}
1426
1427 \ctikzset{RF/scale/.initial=1.0}
1428 \ctikzset{RF/fill/.initial=none}
1429 \ctikzset{RF/thickness/.initial=none}
1430
1431 \ctikzset{electromechanicals/scale/.initial=1.0}
1432 \ctikzset{electromechanicals/fill/.initial=none}
1433 \ctikzset{electromechanicals/thickness/.initial=none}
1434
1435 % transformers go with inductors
1436 \ctikzset{amplifiers/scale/.initial=1.0}
1437 \ctikzset{amplifiers/fill/.initial=none}
1438 \ctikzset{amplifiers/thickness/.initial=none}
1439
1440 \ctikzset{switches/scale/.initial=1.0}
1441 \ctikzset{switches/fill/.initial=none}
1442 \ctikzset{switches/thickness/.initial=none}
1443
1444 \ctikzset{logic ports/scale/.initial=1.0}
1445 \ctikzset{logic ports/fill/.initial=none}
1446 \ctikzset{logic ports/thickness/.initial=none}
1447
1448 \ctikzset{flipflops/scale/.initial=1.0}
1449 \ctikzset{flipflops/fill/.initial=none}
1450 \ctikzset{flipflops/thickness/.initial=none}
1451
1452 \ctikzset{muxdemuxes/scale/.initial=1.0}
1453 \ctikzset{muxdemuxes/fill/.initial=none}
1454 \ctikzset{muxdemuxes/thickness/.initial=none}
1455
1456 \ctikzset{chips/scale/.initial=1.0}
1457 \ctikzset{chips/fill/.initial=none}
1458 \ctikzset{chips/thickness/.initial=none}
1459
1460 \ctikzset{displays/scale/.initial=1.0}
1461 \ctikzset{displays/fill/.initial=none}
1462 \ctikzset{displays/thickness/.initial=none}
1463 %
1464 % general styles
1465 %
1466 \tikzset{european/.style = {european currents, european voltages, european resistors, european inductors, european ports, european gas filled surge arrester set}}
1467 \tikzset{american/.style = {american currents, american voltages, american resistors, american inductors, american ports, american gas filled surge arrester set}}
1468 \tikzset{cute/.style = {european currents, european voltages, american resistors, cute inductors, american ports}}
1469 %%>>>
1470
1471 %% voltage and current options%<<<1
1472 %
1473 \ctikzset{current arrow scale/.initial=16}
1474 \ctikzset{current/distance/.initial = .5}
1475
1476 \newif\ifpgf@circuit@europeancurrent
1477 \newif\ifpgf@circuit@europeanvoltage
1478 \newif\ifpgf@circuit@bipole@voltage@straight
1479 \newif\ifpgf@circuit@bipole@voltage@raised
1480
1481 \ctikzset{voltage/.is choice}
1482 %
1483 % straight is expected to be a subset of european, so disable it in american style
1484 %
1485 \ctikzset{voltage/american/.code = {%
1486 \pgf@circuit@europeanvoltagefalse
1487 \pgf@circuit@bipole@voltage@straightfalse
1488 \pgf@circuit@bipole@voltage@raisedfalse
1489 }}
1490 \ctikzset{voltage/raised/.code = {%
1491 \pgf@circuit@europeanvoltagefalse
1492 \pgf@circuit@bipole@voltage@straightfalse
1493 \pgf@circuit@bipole@voltage@raisedtrue
1494 }}
1495 \ctikzset{voltage/european/.code = {%
1496 \pgf@circuit@europeanvoltagetrue
1497 \pgf@circuit@bipole@voltage@straightfalse
1498 \pgf@circuit@bipole@voltage@raisedfalse
1499 }}
1500 \ctikzset{voltage/straight/.code = {%
1501 \pgf@circuit@europeanvoltagetrue
1502 \pgf@circuit@bipole@voltage@straighttrue
1503 \pgf@circuit@bipole@voltage@raisedfalse
1504 }}
1505 \ctikzset{voltage/curved/.code = {%
1506 \pgf@circuit@europeanvoltagetrue
1507 \pgf@circuit@bipole@voltage@straightfalse
1508 \pgf@circuit@bipole@voltage@raisedfalse
1509 }}
1510 % are these used?
1511 \ctikzset{current/.is choice}
1512 \ctikzset{current/american/.code = \pgf@circuit@europeancurrentfalse}
1513 \ctikzset{current/european/.code = \pgf@circuit@europeancurrenttrue}
1514
1515 % this is left for backward compatibility...
1516 \ctikzset{straight/.is choice}
1517 \ctikzset{straight/true/.code = {\pgf@circuit@bipole@voltage@straighttrue}}
1518 \ctikzset{straight/false/.code = {\pgf@circuit@bipole@voltage@straightfalse}}
1519 \ctikzset{bipole/straight/.is if=pgf@circuit@bipole@voltage@straight}
1520 %
1521 % voltage is used also to set parameters, apart for the /.is choice
1522 % above. I hope it is ok --- would be a mess otherwise
1523 %
1524 \ctikzset{voltage/shift/.initial=0.0} % shift form the cable of voltage symbols
1525 \ctikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
1526 \tikzset{voltage shift/.style={\circuitikzbasekey/voltage/shift=#1}}
1527 %
1528 % keys for exporting voltage, current, flow anchors
1529 %
1530 \newif\ifpgfcirc@has@v\pgfcirc@has@vfalse
1531 \newif\ifpgfcirc@has@f\pgfcirc@has@ffalse
1532 \newif\ifpgfcirc@has@i\pgfcirc@has@ifalse
1533 \def\ctikzgetanchor#1#2{\csname pgfcirc@#1-#2-anchor\endcsname}
1534 \def\ctikzgetdirection#1{\csname pgfcirc@#1-direction\endcsname}
1535 %
1536 % shaping the +/- sign, see pgfcircvoltage.tex
1537 \ctikzset{voltage/american font/.initial={}}
1538 \ctikzset{voltage/american plus/.initial={$+$}}
1539 % In the mayority of fonts, the size of - is smaller than +, so we have
1540 % unaligned signs when positioned independently.
1541 % See https://github.com/circuitikz/circuitikz/issues/721
1542 \ctikzset{voltage/american minus/.initial={$\vphantom{+}-$}}
1543 % here we start the voltage adjustments for special components.
1544 % default values:
1545 %
1546 % this is the distance of the "point" marking the voltage along the line
1547 % 0.0 is on the external nodes of the to path
1548 % 1.0 is cramped on the object
1549 % this can be overriden component by component
1550 \ctikzset{voltage/distance from node/.initial=.5}% pos, 0->1
1551 %
1552 % this is the distance from the line (perpendicular to) where the voltage is drawn.
1553 % It is global, and not adjustable by component (use the "label distance" or locally
1554 % if you need it)
1555 \ctikzset{voltage/distance from line/.initial=.08}% in \pgf@circ@scaled@Rlen units
1556 %
1557 % bend paramenters for european arc. You can override them component-based
1558 \ctikzset{voltage/bump b/.initial=1.5}
1559 %
1560 % generator voltages symbols or arrows (always straight) are put along the
1561 % 60 ... 120 angles of the symbol (don't ask why). The distance here is on the
1562 % center..angle line. It's called bump a because I don't know...
1563 %
1564 \ctikzset{voltage/bump a/.initial=1.2}
1565 %
1566 % these are the label distances FROM the drawings.
1567 % You can override them component by component.
1568 \ctikzset{voltage/european label distance/.initial=1.4}
1569 \ctikzset{voltage/straight label distance/.initial=1.4}
1570 \ctikzset{voltage/american label distance/.initial=1.4}
1571 % american open voltage adjusting
1572 %
1573 \newif\ifpgf@adjust@open@voltage\pgf@adjust@open@voltagetrue
1574 \ctikzset{open voltage position/.is choice}
1575 \ctikzset{open voltage position/center/.code={\pgf@adjust@open@voltagetrue}}
1576 \ctikzset{open voltage position/legacy/.code={\pgf@adjust@open@voltagefalse}}
1577 % bad names, kept for compatibility, don't use
1578 \ctikzset{american open voltage/.is choice}
1579 \ctikzset{american open voltage/center/.code={\pgf@adjust@open@voltagetrue}}
1580 \ctikzset{american open voltage/legacy/.code={\pgf@adjust@open@voltagefalse}}
1581 %
1582 % voltage and current styles
1583 %
1584 \tikzset{american currents/.style = {\circuitikzbasekey/current = american}}
1585 \tikzset{european currents/.style = {\circuitikzbasekey/current = european}}
1586 \tikzset{american voltages/.style = {\circuitikzbasekey/voltage = american}}
1587 \tikzset{european voltages/.style = {\circuitikzbasekey/voltage = european}}
1588 \tikzset{straight voltages/.style = {\circuitikzbasekey/voltage = straight}}
1589 \tikzset{raised voltages/.style = {\circuitikzbasekey/voltage = raised}}
1590 %%>>>
1591
1592 % vim: set fdm=marker fmr=%<<<,%>>>:
1593 %%%---------- close: tex/pgfcirc.defines
1594
1595 % setup option defaults and process them
1596 % notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning
1597 \ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages, americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels}
1598 \ProcessOptions\relax
1599
1600 %%%%%%%%%%% Springe nach tex/pgfcircutils
1601 %%%---------- open: tex/pgfcircutils.tex
1602 % Copyright 2018-2026 by Romano Giannetti
1603 % Copyright 2015-2026 by Stefan Lindner
1604 % Copyright 2013-2026 by Stefan Erhardt
1605 % Copyright 2007-2026 by Massimo Redaelli
1606 %
1607 % This file may be distributed and/or modified
1608 %
1609 % 1. under the LaTeX Project Public License and/or
1610 % 2. under the GNU Public License.
1611 %
1612 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
1613
1614 \def\pgf@circ@handleSI#1{
1615 \noexpandarg
1616 \def\pgf@temp{}
1617 \StrBetween{#1}{<}{>}[\pgf@circ@handleSI@unit]
1618 \StrLen{\pgf@circ@handleSI@unit}[\pgf@circ@handleSI@unit@len]
1619
1620 \ifnum\pgf@circ@handleSI@unit@len=0
1621 \pgf@circ@siunitx@resfalse
1622 \else
1623 \IfEndWith{#1}{>}{
1624 \pgf@circ@siunitx@restrue
1625 \noexpandarg
1626 \StrBefore{#1}{<}[\pgf@circ@handleSI@val]
1627 %\typeout{si |#1|}
1628 }{
1629 \pgf@circ@siunitx@resfalse
1630 %\typeout{no si |#1|}
1631 }
1632 \fi
1633 }
1634
1635 \def\pgf@circ@ifkeyempty#1{
1636 \pgfextra{
1637 \ctikzset{#1/.get=\pgf@circ@temp}
1638 \edef\pgf@temp{}
1639 }
1640 \ifx\pgf@circ@temp\pgf@temp
1641 }
1642
1643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1644 %% Math routines
1645
1646 \def\pgf@circ@stripdecimals#1.#2\pgf@nil{#1}
1647
1648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1649 %% useful commands
1650
1651 \ifpgfutil@format@is@latex
1652 %% flipping text
1653 \def\ctikzflipx#1{\scalebox{-1}[1]{#1}}
1654 \def\ctikzflipy#1{\scalebox{1}[-1]{#1}}
1655 \def\ctikzflipxy#1{\scalebox{-1}[-1]{#1}}
1656 % text mode overbar
1657 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1658 \def\ctikztextnot#1{$\overline{\hbox{#1}}\m@th$}
1659 \else\ifpgfutil@format@is@plain
1660 % text mode overbar
1661 % but really circuitikz will not work in plain...
1662 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1663 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
1664 \else\ifpgfutil@format@is@context
1665 %% flipping text
1666 \def\ctikzflipx#1{\mirror{#1}}
1667 \def\ctikzflipy#1{\mirror{\rotate[rotation=180]{#1}}}
1668 \def\ctikzflipxy#1{\rotate[rotation=180]{#1}}
1669 % text mode overbar
1670 % Thanks to @egreg https://tex.stackexchange.com/a/24133/38080
1671 \def\ctikztextnot#1{$\overline{\hbox{#1}}$}
1672 \fi\fi\fi
1673
1674 %%%%%%%%%%%%%%%%%%%%%%%%%%%
1675 %% switch to use fpu in reciprocal scale transformations
1676 %%
1677 %% this code has been contributed by Schrödinger's cat
1678 %% https://tex.stackexchange.com/a/529159/38080
1679 %%
1680 %% Use the official key to use the fpu if installed, see
1681 %% https://github.com/pgf-tikz/pgf/issues/861
1682 %%
1683 %% Thanks to "muzimuzhi Z" https://tex.stackexchange.com/a/547085/38080
1684 %% Thanks to Henri Menke for a faster approach https://github.com/circuitikz/circuitikz/commit/00966c45c42b464fab5429f89f2b7fb414e9b3f7#commitcomment-54592494
1685 %%
1686 \pgfkeysifdefined{/pgf/fpu/install only/.@cmd}{%
1687 \pgfqkeys{/pgf}{use fpu reciprocal/.code={\pgfkeys{/pgf/fpu/install only={reciprocal}}}}%
1688 }{%
1689 \pgfkeysifdefined{/pgf/use fpu reciprocal/.@cmd}{% use stock one
1690 }{
1691 \pgfqkeys{/pgf}{use fpu reciprocal/.code={%
1692 \def\pgfmathreciprocal@##1{%
1693 \begingroup
1694 \pgfmathfloatparsenumber{##1}%
1695 \pgfmathfloatreciprocal@{\pgfmathresult}%
1696 \pgfmathfloattofixed@{\pgfmathresult}%
1697 \pgfmath@smuggleone\pgfmathresult
1698 \endgroup
1699 }}}}%
1700 }
1701
1702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1703 %% subcircuits (experimental)
1704 %%
1705 %% introduced by Romano Giannetti around April 2021
1706 %% changes suggested by Jonathan P. Spratte
1707 %%
1708 \newbox\ctikz@scratchbox
1709 \pgfutil@protected\def\ctikzsubcircuitdef#1#2#3{%
1710 \expandafter\gdef\csname #1@Anchor\endcsname{}%
1711 \expandafter\gdef\csname #1@setanchors\endcsname{%
1712 \setbox\ctikz@scratchbox=\hbox{%
1713 \tikzpicture
1714 \draw (0,0) \csname#1\endcsname{T-#1}{};
1715 \foreach [count=\i] \anchor in {#2}
1716 % reference anchor is -center
1717 \draw (0,{2-\i/2}) let \p1 = ($(T-#1-subckt@reference)-(T-#1-\anchor)$) in
1718 node[right]{\anchor: \x1,\y1 \expandafter\xdef\csname #1@Anchor\anchor\endcsname{++(\x1,\y1)}};
1719 \endtikzpicture
1720 }%
1721 }%
1722 \expandafter\gdef\csname#1\endcsname##1##2{%
1723 \csname #1@Anchor##2\endcsname coordinate(##1-subckt@reference)#3%
1724 }%
1725 }
1726 \long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname}
1727
1728
1729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1730 %% Basic utility macros
1731 %%
1732 %% Functions provided here are:
1733 %% \pgf@circ@ifempty{<argument>}{<true>}{<false>}
1734 %% Tests whether <argument> is completely empty.
1735 %% \pgf@circ@ifblank{<argument>}{<true>}{<false>}
1736 %% Tests whether <argument> is either empty or only contains spaces.
1737 %% \pgf@circ@trimspaces@do{<argument>}{<next>}
1738 %% Trims at most one space from either end of <argument> and forwards the
1739 %% result to <next> as <next>{<trimmed argument>}
1740
1741 % these two are pretty standard code
1742 \long\def\pgf@circ@ifempty#1%
1743 {%
1744 \if\relax\detokenize{#1}\relax
1745 \expandafter\pgfutil@firstoftwo
1746 \else
1747 \expandafter\pgfutil@secondoftwo
1748 \fi
1749 }
1750 \long\def\pgf@circ@ifblank#1%
1751 {%
1752 \if\relax\detokenize\expandafter{\pgfutil@gobble#1.}\relax
1753 \expandafter\pgfutil@firstoftwo
1754 \else
1755 \expandafter\pgfutil@secondoftwo
1756 \fi
1757 }
1758
1759 % \pgfutil@trimspaces needs two expansions. The first expansion we'll do during
1760 % the definition.
1761 \def\pgf@circ@trimspaces@do#1%
1762 {%
1763 \def\pgf@circ@trimspaces@do##1%
1764 {\expandafter\pgf@circ@trimspaces@do@\expandafter{#1}}%
1765 }
1766 \expandafter\pgf@circ@trimspaces@do\expandafter{\pgfutil@trimspaces{#1}}
1767 \def\pgf@circ@trimspaces@do@#1#2{#2{#1}}
1768
1769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1770 %% list handling
1771 %%
1772 %% Contribution by Jonathan P. Spratte (blame him!)
1773 %%
1774 %% The list implementation here has a few limitations. Those are:
1775 %% 1. not long, so no \par in the lists (but many used functions in pgfutil
1776 %% aren't long as well)
1777 %% 2. list elements can't contain a Q with category code 3 (but the used
1778 %% function \pgfutil@trimspaces doesn't support them as well, and this
1779 %% should be a very rare token anyway)
1780 %% 3. list elements can't contain the token \pgf@circ@set@list as that is used
1781 %% as the end marker
1782 %% 4. currently these lists are meant for numeric data (hence only
1783 %% \pgf@circ@if@num@in@list is provided as a test), as a result there is
1784 %% another limitation for the data here. If the list element contains no
1785 %% hyphen '-', the element will be stored without further processing
1786 %% 'as-is' (well, after trimming spaces). If there is a hyphen we assume
1787 %% well-behaved input data and will interpret this as a num-range without
1788 %% further tests.
1789 %%
1790 %% Functions provided here are:
1791 %% \pgf@circ@set@list<macro>{<csv-list>}
1792 %% Parses the <csv-list> and stores the result inside <macro> (local
1793 %% assignment). If a num-range given as <start - stop> (with or without
1794 %% spaces) is found it will be expanded to <start>,<start+1>,...,<stop>.
1795 %% \pgf@circ@if@num@in@list<macro>{<value>}{<true>}{<false>}
1796 %% Checks whether <value> (numeric value, evaluated once with \numexpr) is
1797 %% found inside the list stored in <macro>. There are two special cases: If
1798 %% <macro> is undefined <false> is executed. If the list contains only one
1799 %% element and that is `all' <true> is executed.
1800
1801 % set the catcode of our marker
1802 \chardef\pgf@circ@temp=\the\catcode`\Q
1803 \catcode`\Q=3
1804
1805 % lists will have the structure
1806 % <marker><element 1><marker>...<element n><marker>
1807 % As marker we use a Q with category 3. Under the assumption that no list
1808 % element does ever contain that token we can set the elements without braces,
1809 % allowing us to use \pgfutil@in@ to search for elements (see above). The other
1810 % token that isn't allowed to show up in the list is \pgf@circ@set@list, that we
1811 % use as another marker during parsing.
1812 % The other big restriction in this implementation is that lists can't contain a
1813 % \par (but \pgfutil@in@ doesn't support that anyway so there is not much
1814 % sense in supporting it here)
1815 \pgfutil@protected\def\pgf@circ@set@list#1#2%
1816 {%
1817 % clear the error flag
1818 \let\pgf@circ@error@marker\pgf@circ@undefined
1819 % set the list
1820 \edef#1%
1821 {Q\pgf@circ@set@list@sanitize#2,\pgf@circ@set@list,\pgf@circ@set@list}%
1822 % there was an error, throw the error message, recovery was already done by
1823 % ignoring the offending elements.
1824 \ifx\pgf@circ@error@marker\relax
1825 \begingroup
1826 \newlinechar`\^^J
1827 \pgfutil@packageerror{circuitikz}
1828 {%
1829 Unallowed marker found in list^^J%
1830 \pgfutil@unexpanded{#2}.^^J%
1831 Offending elements were ignored.%
1832 }
1833 {Lists can't contain a Q with category code 3}%
1834 \endgroup
1835 \fi
1836 }
1837 % just a utility for the <marker> test
1838 \def\pgf@circ@set@list@gobbletomarker#1Q{}
1839 % quick way to check whether list parsing is done by gobbling up to a marker, in
1840 % this case the marker is \pgf@circ@set@list
1841 \def\pgf@circ@set@list@sanitize@checkend#1\pgf@circ@set@list{}
1842 % will only be called after the last element is handled, will gobble the
1843 % remainder of the current sanitizing step
1844 \def\pgf@circ@set@list@sanitize@end\pgf@circ@set@list#1\pgf@circ@set@list{}
1845 % grabs the next list element, checks whether we're done, and if not sanitizes
1846 % it (meaning stripping spaces from either end and placing the <marker>).
1847 \def\pgf@circ@set@list@sanitize#1,%
1848 {%
1849 \pgf@circ@set@list@sanitize@checkend
1850 #1\pgf@circ@set@list@sanitize@end\pgf@circ@set@list
1851 \pgf@circ@set@list@sanitize@a{#1}%
1852 }
1853 % testing whether a list element contains the used <marker> expandably, if it
1854 % does set the flag, else continue sanitizing.
1855 \def\pgf@circ@set@list@sanitize@a#1%
1856 {%
1857 \expandafter\pgf@circ@ifempty\expandafter
1858 % if this is empty no marker was found
1859 {\pgf@circ@set@list@gobbletomarker#1Q}
1860 {%
1861 \pgf@circ@ifblank{#1}
1862 {}% ignore blank entries
1863 {\pgf@circ@trimspaces@do{#1}\pgf@circ@set@list@sanitize@b}%
1864 }
1865 {%
1866 % panic, there was a marker found in a list element. We'll recover by
1867 % ignoring the current element after setting a flag. When we do
1868 % \csname ...\endcsname on an undefined macro name TeX will let that
1869 % macro to relax and we exploit this to expandable set a flag and
1870 % gobbling the result.
1871 \expandafter\pgfutil@gobble\csname pgf@circ@error@marker\endcsname
1872 }%
1873 % get the next element
1874 \pgf@circ@set@list@sanitize
1875 }
1876 % we'll protect any element from further expanding using \unexpanded and place
1877 % the marker after the element, and ignore empty/blank elements
1878 \def\pgf@circ@set@list@sanitize@b#1%
1879 {%
1880 \expandafter\pgf@circ@ifempty\expandafter
1881 % if this is empty no hyphen is found
1882 {\pgf@circ@gobbletohyphen#1-}
1883 {\pgfutil@unexpanded{#1}Q}
1884 {\pgf@circ@set@list@parse@range{#1}}%
1885 }
1886 \def\pgf@circ@gobbletohyphen#1-{}
1887 \def\pgf@circ@set@list@parse@range#1{\pgf@circ@set@list@parse@range@a#1Q}
1888 \def\pgf@circ@set@list@parse@range@a#1-#2Q%
1889 {%
1890 \expandafter\pgf@circ@set@list@parse@range@b
1891 \the\numexpr#1\expandafter Q\the\numexpr#2Q%
1892 }
1893 \def\pgf@circ@set@list@parse@range@b#1Q#2Q%
1894 {%
1895 \ifnum#1<#2
1896 % expand to the range from #1 to #2 (inclusive)
1897 \pgf@circ@set@list@range{#1}{#2}%
1898 \else
1899 \ifnum#2<#1
1900 % if #2 is smaller than #1 just swap the order
1901 \pgf@circ@set@list@range{#2}{#1}%
1902 \else
1903 % last case, they are equal, so just put the result here
1904 #1Q%
1905 \fi
1906 \fi
1907 }
1908 \def\pgf@circ@set@list@parse@range@norange#1Q#2{\pgfutil@unexpanded{#2}Q}
1909 \def\pgf@circ@set@list@range#1#2%
1910 {%
1911 #1Q%
1912 \ifnum#1<#2
1913 \expandafter\pgfutil@secondoftwo
1914 \fi
1915 \pgfutil@gobble
1916 {\expandafter\pgf@circ@set@list@range\expandafter{\the\numexpr#1+1}{#2}}%
1917 }
1918
1919 % flag for special value
1920 \def\pgf@circ@all@flag{QallQ}
1921 \pgfutil@protected\def\pgf@circ@if@num@in@list#1#2%
1922 {%
1923 % test whether the list macro is defined, if it isn't result is false
1924 \pgfutil@ifx\pgf@circ@undefined#1%
1925 {\pgfutil@secondoftwo}
1926 {%
1927 % test whether the list macro is just the special value 'all', if so
1928 % true, else search (and start that by evaluating a numexpr)
1929 \pgfutil@ifx\pgf@circ@all@flag#1%
1930 {\pgfutil@firstoftwo}
1931 {%
1932 \expandafter\pgf@circ@if@num@in@list@a\expandafter
1933 {\the\numexpr#2}%
1934 #1%
1935 }%
1936 }%
1937 }
1938 % next step is expanding the list macro
1939 \pgfutil@protected\def\pgf@circ@if@num@in@list@a#1#2%
1940 {\expandafter\pgf@circ@if@num@in@list@b\expandafter{#2}{#1}}
1941 % now use \pgfutil@in@ to check whether there is the searched list element
1942 \pgfutil@protected\def\pgf@circ@if@num@in@list@b#1#2%
1943 {%
1944 \begingroup
1945 % put the <marker> around the number to make sure only full matches are
1946 % found. \pgfutil@in@ will set \ifpgfutil@in@ to true if it finds a match
1947 \pgfutil@in@{Q#2Q}{#1}%
1948 \expandafter
1949 \endgroup
1950 \ifpgfutil@in@
1951 \expandafter\pgfutil@firstoftwo
1952 \else
1953 \expandafter\pgfutil@secondoftwo
1954 \fi
1955 }
1956
1957 % reset the catcode of Q
1958 \catcode`\Q=\pgf@circ@temp
1959
1960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1961 %% temporary fix for old TikZ versions (remove me)
1962 %%
1963 %% All blame to Romano Giannetti for this code!
1964 %%
1965 %% This tries to be smart and provide \pgfutil@unexpanded and \pgfutil@ifx if
1966 %% PGF doesn't provide them.
1967
1968 \ifx\pgfutil@unexpanded\pgf@circ@undefined
1969 \ifpgfutil@format@is@context
1970 \let\pgfutil@unexpanded\normalunexpanded
1971 \else
1972 \let\pgfutil@unexpanded\unexpanded
1973 \fi
1974 \fi
1975
1976 \ifx\pgfutil@ifx\pgf@circ@undefined
1977 \long\def\pgfutil@ifx#1#2{%
1978 \ifx#1#2%
1979 \expandafter\pgfutil@firstoftwo
1980 \else
1981 \expandafter\pgfutil@secondoftwo
1982 \fi}
1983 \fi
1984
1985 %%
1986 %% generic tunable arrow for components that have no "variable" thing
1987 %%
1988 \def\ctikztunablearrow{\pgfutil@ifnextchar[{\ctikztunablearrow@full}{\ctikztunablearrow@simple}}%
1989 \def\ctikztunablearrow@simple{\ctikztunablearrow@full[]}%
1990 \def\ctikztunablearrow@full[#1]#2#3#4#5{%
1991 % add tunable arrow to a component
1992 % relative thickness, relative length, rotation from axis, name of the component
1993 \scope
1994 \draw
1995 \pgfextra{\pgfcirc@set@arrows{tunable}{}{latexslim}
1996 \pgfsetlinewidth{#2\pgflinewidth}} [#1]
1997 let \p1=($(#5.north east)-(#5.south west)$), \p2=($(#5.east)-(#5.west)$),
1998 \n1 = {veclen(\x1,\y1)},
1999 \n2 = {atan2(\y2,\x2)} in
2000 % node[above]{\n1, \n2}
2001 % notice that some node has the "center" on one side, so
2002 % midway from east to west is a safer bet for the center
2003 ($(#5.west)!0.5!(#5.east)$) ++({\n2+(#4)}:{-0.5*(\n1)*(#3)}) -- ++({\n2+(#4)}:{(\n1)*(#3)});
2004 \endscope
2005 }
2006 %%%---------- close: tex/pgfcircutils
2007 %%%%%%%%%%% Springe nach tex/pgfcircpath
2008 %%%---------- open: tex/pgfcircpath.tex
2009 % Copyright 2018-2026 by Romano Giannetti
2010 % Copyright 2015-2026 by Stefan Lindner
2011 % Copyright 2013-2026 by Stefan Erhardt
2012 % Copyright 2007-2026 by Massimo Redaelli
2013 %
2014 % This file may be distributed and/or modified
2015 %
2016 % 1. under the LaTeX Project Public License and/or
2017 % 2. under the GNU Public License.
2018 %
2019 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2020
2021
2022 \def\pgf@circ@direction{0.0}
2023
2024 % swap two coordinates
2025 \def\pgfcirc@swap@coordinates#1#2{%
2026 coordinate (pgfcirc@tmp@swap) at (#1)
2027 coordinate (#1) at (#2)
2028 coordinate (#2) at (pgfcirc@tmp@swap)
2029 }
2030
2031 % Names
2032 \ctikzset{name/.style = { n={#1} } } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
2033 \ctikzset{n/.code = {
2034 \pgfkeys{/tikz/circuitikz/bipole/name={#1}}
2035 }}
2036
2037 % Reflect the node along
2038 \ctikzset{mirrored/.is choice}
2039 \ctikzset{mirror value/.initial=1}
2040 \ctikzset{mirrored/true/.code = {\ctikzsetvalof{mirror value}{-1}} }
2041 \ctikzset{mirrored/false/.code = {\ctikzsetvalof{mirror value}{1}} }
2042 \ctikzset{mirror/.style = {/tikz/circuitikz/mirrored=true}}
2043
2044 % Invert node along path
2045 \ctikzset{inverted/.is choice}
2046 \ctikzset{invert value/.initial=1}
2047 \ctikzset{inverted/true/.code = {\ctikzsetvalof{invert value}{-1}\pgf@circuit@bipole@invertedtrue}}
2048 \ctikzset{inverted/false/.code = {\ctikzsetvalof{invert value}{1}\pgf@circuit@bipole@invertedfalse}}
2049 \ctikzset{invert/.style = {/tikz/circuitikz/inverted=true}}
2050 \newif\ifpgf@circuit@bipole@inverted
2051 \ctikzset{bipole/inverted/.is if=pgf@circuit@bipole@inverted}
2052
2053 \newif\ifpgf@circuit@bipole@voltage@backward
2054 \ctikzset{bipole/voltage/direction/.is choice}
2055 \ctikzset{bipole/voltage/direction/forward/.code={\pgf@circuit@bipole@voltage@backwardfalse}}
2056 \ctikzset{bipole/voltage/direction/backward/.code={\pgf@circuit@bipole@voltage@backwardtrue}}
2057
2058 % Initialize paths
2059 \def\pgfcircresetpath{
2060 \ctikzset{bipole/name=, bipole/label/name=, bipole/label/position=90, ,bipole/annotation/name=, bipole/annotation/position=-90,
2061 bipole/inverted=false, bipole/kind=,
2062 bipole/voltage/direction=backward, bipole/voltage/label/name=, bipole/voltage/position=below,
2063 bipole/nodes/left=none, bipole/nodes/right=none, bipole/is voltage=false,bipole/is voltageoutsideofsymbol=false,bipole/is strokedsymbol=false,
2064 bipole/is current=false, bipole/current/label/name=, bipole/current/x position=after,
2065 bipole/current/y position=above, bipole/current/direction=forward,
2066 mirrored=false
2067 }
2068 }
2069
2070 %
2071 % expandable IF for the extra nodes (thanks to Henri Menke)
2072 % see https://chat.stackexchange.com/transcript/message/56560808#56560808
2073 %
2074 \def\pgfcirc@if@has@i{%
2075 \ifpgfcirc@has@i
2076 \expandafter\pgfutil@firstoftwo
2077 \else
2078 \expandafter\pgfutil@secondoftwo
2079 \fi}
2080 \def\pgfcirc@if@has@v{%
2081 \ifpgfcirc@has@v
2082 \expandafter\pgfutil@firstoftwo
2083 \else
2084 \expandafter\pgfutil@secondoftwo
2085 \fi}
2086 \def\pgfcirc@if@has@f{%
2087 \ifpgfcirc@has@f
2088 \expandafter\pgfutil@firstoftwo
2089 \else
2090 \expandafter\pgfutil@secondoftwo
2091 \fi}
2092
2093
2094
2095 %% Generic bipole path
2096 \def\pgf@circ@bipole@path#1#2{
2097 % Create a bipole path from the shapes defined with \pgfcircdeclarebipole
2098 % or \pgfcircdeclarebipolescaled; the node shapes are named with a "shape"
2099 % appended to the main (path-style) name
2100 % #1 path-style node name
2101 % #2 the argument passed from the to-path structure; don't touch
2102 %
2103 % Example:
2104 % \def\pgf@circ@capacitor@path#1{\pgf@circ@bipole@path{capacitor}{#1}}
2105 %
2106 \pgf@circ@bipole@path@base{shape}{}{#1}{#2}
2107 }
2108 %%
2109 %% ultra-generic bipole path
2110 %% I am not sure what the last argument is needed for, but don't touch it or everything explodes
2111 %%
2112 \def\pgf@circ@bipole@path@base#1#2#3#4{%
2113 %
2114 % Create a path-style component based on a node-style shape
2115 % #1: postfix to be added to the name path to obtain the main shape name
2116 % #2: text to be passed as text to the node
2117 % #3: name of the bipole component
2118 % #4: this will be filled by the argument of the to-path
2119 %
2120 \pgfextra{
2121 \ctikzset{bipole/kind = #3}
2122 \edef\pgf@temp{\ctikzvalof{bipole/name}}
2123 \def\pgf@circ@temp{}
2124 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
2125 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
2126 \ctikzset{bipole/name = pgfcirc@#3\pgf@circ@rand} % create it (re-usage should not create problem, but...)
2127 \edef\pgfcirc@a@prefix{pgfcirc}% do not pollute the namespace for nothing
2128 \else
2129 \edef\pgfcirc@a@prefix{\ctikzvalof{bipole/name}}% for exporting v-i-f anchors
2130 \fi
2131 }
2132 % save start and stop values
2133 % notice that we DO NOT MOVE the path position at all!
2134 coordinate (\ctikzvalof{bipole/name}start) at (\tikztostart)
2135 coordinate (\ctikzvalof{bipole/name}end) at (\tikztotarget)
2136 \pgfextra{
2137 % find the direction (angle) of the path
2138 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
2139 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
2140 \edef\pgf@circ@direction{\pgfmathresult}
2141 % the global macro pgfcirc@whatever-direction is accessible as \ctikzgetdirection{whatever}
2142 % this gives access to the element path direction
2143 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-direction\endcsname{\pgf@circ@direction}
2144 }
2145 % position the component in the middle of the path. We DO NOT MOVE the current position!
2146 node[#3#1, rotate=\pgf@circ@direction, yscale=\ctikzvalof{mirror value},
2147 xscale=\ctikzvalof{invert value}] (\ctikzvalof{bipole/name})
2148 at ($(\tikztostart) ! .5 ! (\tikztotarget)$) {#2}
2149 % set start and end labels
2150 \ifpgf@circuit@bipole@inverted
2151 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
2152 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathend)
2153 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathstart)
2154 \else
2155 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.right)
2156 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.left)
2157 \fi
2158 \else
2159 \ifcsname pgf@anchor@#3#1@pathstart\endcsname%if special path-anchors are defined, use them!
2160 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.pathstart)
2161 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.pathend)
2162 \else
2163 coordinate (pgfcirc@anchorstartnode) at (\ctikzvalof{bipole/name}.left)
2164 coordinate (pgfcirc@anchorendnode) at (\ctikzvalof{bipole/name}.right)
2165 \fi
2166 \fi
2167 % draw the leads unless it's an open circuit
2168 % stop at the component
2169 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
2170 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
2171 \else
2172 % it is important to start the path with -- to have correct line joins!
2173 -- (pgfcirc@anchorstartnode)
2174 \fi
2175 % Add all the "ornaments": labels, annotations, voltages, currents and flows
2176 \drawpoles
2177 \pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
2178 \pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
2179 % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a
2180 % it should be logically safe for older version too --- even if TikZ reverted the change
2181 % use explandable ifs too, thanks to Henri Menke
2182 {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}%
2183 {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}%
2184 {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}%
2185 % finish the path from the component to the final target
2186 % you never know --- re-set \pgf@temp to detect open
2187 \pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}
2188 \ifx\pgf@temp\pgf@circ@temp % if it is an open do nothing
2189 (\tikztotarget)
2190 \else
2191 (pgfcirc@anchorendnode) -- (\tikztotarget)
2192 \fi
2193 % reset internal circuit keys
2194 \pgfextra{\pgfcircresetpath}
2195 %draw pending nodes an path
2196 \tikztonodes
2197 }
2198
2199 %% Macros for path and style activation for bipoles or path-style
2200
2201 \def\comnpatname{\ifpgf@circuit@compat *\else\fi}
2202 \def\compattikzset#1{%
2203 % \typeout{BIPOLEDEF:\space \detokenize{#1}}%
2204 \tikzset{\comnpatname#1}}
2205 %
2206 % this is used for components that are mainly node-style but have a path-style form
2207 %
2208 \def\pgfcirc@node@to@path#1#2#3{%
2209 % add a path-style component based on a node-style one without mangling the name
2210 % of the shape.
2211 % #1: node-type shape name (existing)
2212 % #2: path-type name (to be created)
2213 % #3: additional options to add to the path style
2214 %
2215 \expandafter\def\csname pgf@circ@#1@path\endcsname##1{\pgf@circ@bipole@path@base{}{##1}{#1}{}}%
2216 \compattikzset{#2/.style = {\circuitikzbasekey,
2217 /tikz/to path=\csname pgf@circ@#1@path\endcsname{##1},
2218 #3}}%
2219 \ctikzset{bipoles/#1/height/.initial=1}%
2220 }
2221 %
2222 % this one is for normal definition: path to style, directly
2223 % the first parameter (#1) here is l,v,i (l=..., v=..., i=...)
2224 % the last parameter are options to be inserted in the "to path" definition
2225 %
2226 \def\pgfcirc@path@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@#2@path to style #3
2227 \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\csname pgf@circ@#2@path\endcsname, #1={##1}}}%
2228 }
2229 % this one create a alias style from a node definition
2230 \def\pgfcirc@node@to@style#1#2#3#4{% using #1 as label, assign \pgf@circ@bipole@path{#2} to style #3
2231 \compattikzset{#3/.style={\circuitikzbasekey, #4, /tikz/to path=\pgf@circ@bipole@path{#2}, #1={##1}}}%
2232 }
2233 % this create an alias style
2234 \def\pgfcirc@style@to@style#1#2{% alias style #1 to style #2
2235 \compattikzset{#2/.style={\comnpatname #1={##1}}}%
2236 }
2237 % this create an alias style, changing the labelling
2238 \def\pgfcirc@style@to@style@label#1#2#3{% alias style #1 to style #2
2239 \compattikzset{#2/.style={\comnpatname #1, #3={##1}}}%
2240 }
2241 % create a bipole
2242 \def\pgfcirc@activate@bipole#1#2#3#4{% type of label, path name, base node name, style name
2243 % \typeout{Activate bipole:\space #4,}
2244 \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}%
2245 \pgfcirc@path@to@style{#1}{#2}{#4}{}% no options here, let's see
2246 }
2247 \def\pgfcirc@activate@bipole@simple#1#2{\pgfcirc@activate@bipole{#1}{#2}{#2}{#2}}
2248 % create a bipole with options
2249 \def\pgfcirc@activate@bipole@opt#1#2#3#4#5{% type of label, path name, base node name, style name, options
2250 % \typeout{Activate bipole:\space #4,}
2251 \expandafter\def\csname pgf@circ@#2@path\endcsname##1{\pgf@circ@bipole@path{#3}{##1}}%
2252 \pgfcirc@path@to@style{#1}{#2}{#4}{#5}% no options here, let's see
2253 }
2254 \def\pgfcirc@activate@bipole@simple@opt#1#2#3{\pgfcirc@activate@bipole@opt{#1}{#2}{#2}{#2}{#3}}
2255
2256
2257 %% New system, for simple object
2258 %% \pgfcirc@activate@bipole@simple{l}{mass}
2259 %% New system, different names
2260 %% The old system is the following
2261 %% 1 - define just the pgf@circ@path@whatever#1
2262 %% (see for example the variable one)
2263 %% 2 - set the style
2264 %% \compattikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l={#1}}}
2265
2266 %% Path definition with the new mechanism have been moved to where the nodes
2267 %% are defined.
2268
2269 %% Handling of terminals%<<<
2270
2271 \ctikzset{bipole/nodes/.is family}
2272 \ctikzset{bipole/nodes/left/.initial=none}
2273 \ctikzset{bipole/nodes/right/.initial=none}
2274 \tikzset{bipole nodes/.style n args={2}{%
2275 \circuitikzbasekey/bipole/nodes/left=#1,
2276 \circuitikzbasekey/bipole/nodes/right=#2%
2277 }
2278 }
2279
2280 %% Easily usable styles
2281
2282 \ctikzset{o-o/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=ocirc}}
2283 \ctikzset{-o/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=ocirc}}
2284 \ctikzset{o-/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=none}}
2285 \ctikzset{*-o/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=ocirc}}
2286 \ctikzset{o-*/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=circ}}
2287 \ctikzset{d-o/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=ocirc}}
2288 \ctikzset{o-d/.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
2289 \ctikzset{*-/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=none}}
2290 \ctikzset{-*/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=circ}}
2291 \ctikzset{d-/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=none}}
2292 \ctikzset{-d/.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
2293 \ctikzset{*-*/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=circ}}
2294 \ctikzset{d-*/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=circ}}
2295 \ctikzset{*-d/.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
2296 \ctikzset{d-d/.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
2297
2298 % rectjoinfill workarounds
2299
2300 \ctikzset{.-/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=none}}
2301 \ctikzset{.-*/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=circ}}
2302 \ctikzset{.-o/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=ocirc}}
2303 \ctikzset{.-d/.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=diamondpole}}
2304 \ctikzset{-./.style = {\circuitikzbasekey/bipole/nodes/left=none, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2305 \ctikzset{o-./.style = {\circuitikzbasekey/bipole/nodes/left=ocirc, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2306 \ctikzset{*-./.style = {\circuitikzbasekey/bipole/nodes/left=circ, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2307 \ctikzset{d-./.style = {\circuitikzbasekey/bipole/nodes/left=diamondpole, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2308 \ctikzset{.-./.style = {\circuitikzbasekey/bipole/nodes/left=rectjoinfill, \circuitikzbasekey/bipole/nodes/right=rectjoinfill}}
2309
2310 \tikzset{reversed/.style = {\circuitikzbasekey/bipole/inverted=true}}
2311
2312 \def\drawpoles{
2313 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/left}} \def\pgf@temp{none}}
2314 \ifx\pgf@temp\pgf@circ@temp\else(\tikztostart) node[\pgf@circ@temp] {}\fi
2315 \pgfextra{ \edef\pgf@circ@temp{\ctikzvalof{bipole/nodes/right}} }
2316 \ifx\pgf@temp\pgf@circ@temp\else(\tikztotarget) node[\pgf@circ@temp] {}\fi
2317 }
2318 % %>>>
2319
2320 %%
2321 %% Definition of path for transistors
2322 %%
2323 % Transistor like bipoles
2324
2325 \def\pgf@circ@trans@path#1#2{
2326 \pgfextra{
2327 \edef\pgf@temp{\ctikzvalof{bipole/name}}
2328 \def\pgf@circ@temp{#2}
2329 \ifx\pgf@temp\pgf@circ@temp % if it has not a name
2330 \pgfmathrandominteger{\pgf@circ@rand}{1000}{9999}
2331 \ctikzset{bipole/name = trans\pgf@circ@rand} % create it
2332 \fi
2333 }
2334 \ifpgf@circuit@bipole@inverted
2335 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}end) {}
2336 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}start) {}
2337 \else
2338 (\tikztostart) node[coordinate] (\ctikzvalof{bipole/name}start) {}
2339 (\tikztotarget) node[coordinate] (\ctikzvalof{bipole/name}end) {}
2340 \fi
2341 \pgfextra{
2342 \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
2343 {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}
2344 \pgfmathadd{\pgfmathresult}{-90}
2345 \pgfmathround{\pgfmathresult}
2346 \edef\pgf@circ@direction{\pgfmathresult}
2347 }
2348 ($(\tikztostart) ! .5 ! (\tikztotarget)$)
2349 node[#1, /tikz/rotate=\pgf@circ@direction, xscale=\ctikzvalof{mirror value}]
2350 (\ctikzvalof{bipole/name}) {}
2351 node {\ctikzvalof{bipole/label/name}}
2352 \ifcsname pgf@anchor@#1@pathstart\endcsname%if special path-anchors are defined, use them!
2353 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.pathstart)
2354 (\ctikzvalof{bipole/name}.pathend) -- (\ctikzvalof{bipole/name}end.center)
2355 \else
2356 (\ctikzvalof{bipole/name}start.center) --(\ctikzvalof{bipole/name}.left)
2357 (\ctikzvalof{bipole/name}.right) -- (\ctikzvalof{bipole/name}end.center)
2358 \fi
2359 \drawpoles
2360 \pgfextra{
2361 \pgfcircresetpath
2362 }
2363 (\tikztotarget) \tikztonodes % and go on!
2364 }
2365
2366 \def\pgf@circ@definetranspath#1{
2367 \compattikzset{T#1/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@trans@path{#1}{}, l=##1}}
2368 }
2369
2370 %
2371 % vim: set fdm=marker fmr=%<<<,%>>>:
2372 %%%---------- close: tex/pgfcircpath
2373
2374 %%%%%%%%%%% Springe nach tex/pgfcircshapes
2375 %%%---------- open: tex/pgfcircshapes.tex
2376 % Copyright 2018-2026 by Romano Giannetti
2377 % Copyright 2015-2026 by Stefan Lindner
2378 % Copyright 2013-2026 by Stefan Erhardt
2379 % Copyright 2007-2026 by Massimo Redaelli
2380 %
2381 % This file may be distributed and/or modified
2382 %
2383 % 1. under the LaTeX Project Public License and/or
2384 % 2. under the GNU Public License.
2385 %
2386 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
2387 %
2388 % This file has folding marks for vim (See last line).
2389 %
2390
2391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2392 %% Other shapes
2393
2394 %% Nothing: empty shape%<<<
2395
2396 \pgfdeclareshape{emptyshape}{
2397 \savedanchor{\northeast}{%
2398 \pgf@x=.5\wd\pgfnodeparttextbox%
2399 \pgf@y=.5\ht\pgfnodeparttextbox%
2400 }
2401 % geo anchors based on north-east
2402 \pgfcirc@northeast@symmetric@geoanchors
2403 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
2404 \anchor{center}{
2405 \pgfpointorigin
2406 }
2407 }%
2408 %>>>
2409
2410 %% Poles%<<<
2411 %
2412 % Provision for changing opacity. Only expert use, see the manual.
2413 %
2414 \ctikzset{poles/open fill opacity/.initial=1.0}% better not touch it
2415 \tikzset{open poles opacity/.code={%
2416 \ctikzset{poles/open fill opacity=#1}%
2417 }}
2418 \ctikzset{poles/full fill opacity/.initial=1.0}% better not touch it
2419 \tikzset{full poles opacity/.code={%
2420 \ctikzset{poles/full fill opacity=#1}%
2421
2422 }}
2423
2424 %
2425 % Provision for changing default background
2426 %
2427
2428 \ctikzset{open poles fill/.initial={white}}
2429
2430 %% Full terminal
2431
2432 \pgfdeclareshape{circ}{
2433 \anchor{center}{
2434 \pgfpointorigin
2435 }
2436 \savedanchor\northwest{%
2437 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2438 \pgf@x=-\pgf@y
2439 }
2440 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2441 % geo anchors based on north-west
2442 \pgfcirc@northwest@symmetric@geoanchors
2443 \anchorborder{
2444 \pgf@circ@res@left=\pgf@x
2445 \pgf@circ@res@up=\pgf@y
2446 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2447 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2448 }
2449 \pgf@circ@draw@component{
2450 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2451 \pgf@circ@setcolor
2452 \pgf@circ@fill@strokecolor
2453 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2454 \pgfusepath{draw,fill}
2455 }
2456 }
2457
2458 %% Empty round terminal
2459
2460 \pgfdeclareshape{ocirc}{
2461 \anchor{center}{
2462 \pgfpointorigin
2463 }
2464 \savedanchor\northwest{%
2465 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
2466 \pgf@x=-\pgf@y
2467 }
2468 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2469 % geo anchors based on north-west
2470 \pgfcirc@northwest@symmetric@geoanchors
2471 \anchorborder{
2472 \pgf@circ@res@left=\pgf@x
2473 \pgf@circ@res@up=\pgf@y
2474 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
2475 }{\pgfpoint{\ctikzvalof{nodes width}*\pgf@circ@Rlen}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}}
2476 }
2477 \pgf@circ@draw@component{
2478 \pgfpathcircle{\pgfpointorigin}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2479 \pgf@circ@setcolor
2480 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2481 \ifx\tikz@fillcolor\pgfutil@empty
2482 % set the default fill color to white
2483 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2484 % ...but override it if the class is defined!
2485 % note that this element has no class, but will inherit it when used
2486 % into another component
2487 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2488 \else
2489 \pgfsetfillcolor{\tikz@fillcolor}
2490 \fi
2491 \pgfusepath{draw,fill}
2492 }
2493 }
2494
2495 %% Diamond terminal
2496
2497 \pgfdeclareshape{diamondpole}{
2498 \anchor{center}{
2499 \pgfpointorigin
2500 }
2501 \savedanchor\northwest{%
2502 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2503 \pgf@x=-\pgf@y
2504 }
2505 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2506 % geo anchors based on north-west
2507 \pgfcirc@northwest@symmetric@geoanchors
2508 \anchorborder{
2509 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2510 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2511 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2512 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2513 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2514 \pgfextracty{\pgf@circ@res@up}{\northwest}
2515 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2516 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2517 \pgfpointintersectionoflines
2518 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2519 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2520 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2521 \pgf@x=\@@switchx\pgf@x
2522 \pgf@y=\@@switchy\pgf@y
2523 }
2524 \pgf@circ@draw@component{
2525 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2526 \pgftransformrotate{45}
2527 \pgfpathrectanglecorners
2528 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2529 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2530 \pgf@circ@setcolor
2531 \pgf@circ@fill@strokecolor
2532 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2533 \pgfusepath{draw,fill}
2534 }
2535 }
2536
2537 %% Diamond terminal, unfilled
2538
2539 \pgfdeclareshape{odiamondpole}{
2540 \anchor{center}{
2541 \pgfpointorigin
2542 }
2543 \savedanchor\northwest{%
2544 \pgfmathsetlength{\pgf@y}{sqrt(2)*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2545 \pgf@x=-\pgf@y
2546 }
2547 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2548 % geo anchors based on north-west
2549 \pgfcirc@northwest@symmetric@geoanchors
2550 \anchorborder{
2551 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
2552 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
2553 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
2554 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
2555 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
2556 \pgfextracty{\pgf@circ@res@up}{\northwest}
2557 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
2558 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
2559 \pgfpointintersectionoflines
2560 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
2561 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
2562 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
2563 \pgf@x=\@@switchx\pgf@x
2564 \pgf@y=\@@switchy\pgf@y
2565 }
2566 \pgf@circ@draw@component{
2567 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2568 \pgftransformrotate{45}
2569 \pgfpathrectanglecorners
2570 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2571 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2572 \pgf@circ@setcolor
2573 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2574 \ifx\tikz@fillcolor\pgfutil@empty
2575 % set the default fill color to white
2576 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2577 % ...but override it if the class is defined!
2578 % note that this element has no class, but will inherit it when used
2579 % into another component
2580 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2581 \else
2582 \pgfsetfillcolor{\tikz@fillcolor}
2583 \fi
2584 \pgfusepath{draw,fill}
2585 }
2586 }
2587
2588 %% square terminal, filled
2589
2590 \pgfdeclareshape{squarepole}{
2591 \anchor{center}{
2592 \pgfpointorigin
2593 }
2594 \savedanchor\northwest{%
2595 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2596 \pgf@x=-\pgf@y
2597 }
2598 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2599 % geo anchors based on north-west
2600 \pgfcirc@northwest@symmetric@geoanchors
2601 \anchorborder{
2602 \pgf@xa=\pgf@x
2603 \pgf@ya=\pgf@y
2604 \pgfextracty{\pgf@circ@res@up}{\northwest}
2605 \pgfpointborderrectangle
2606 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2607 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2608 }
2609 \pgf@circ@draw@component{
2610 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2611 \pgfpathrectanglecorners
2612 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2613 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2614 \pgf@circ@setcolor
2615 \pgf@circ@fill@strokecolor
2616 \pgfsetfillopacity{\ctikzvalof{poles/full fill opacity}}% normally 1.0
2617 \pgfusepath{draw,fill}
2618 }
2619 }
2620 %% square terminal, unfilled
2621
2622 \pgfdeclareshape{osquarepole}{
2623 \anchor{center}{
2624 \pgfpointorigin
2625 }
2626 \savedanchor\northwest{%
2627 \pgfmathsetlength{\pgf@y}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2628 \pgf@x=-\pgf@y
2629 }
2630 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2631 % geo anchors based on north-west
2632 \pgfcirc@northwest@symmetric@geoanchors
2633 \anchorborder{
2634 \pgf@xa=\pgf@x
2635 \pgf@ya=\pgf@y
2636 \pgfextracty{\pgf@circ@res@up}{\northwest}
2637 \pgfpointborderrectangle
2638 {\pgfqpoint{\pgf@xa}{\pgf@ya}}
2639 {\pgfqpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
2640 }
2641 \pgf@circ@draw@component{
2642 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
2643 \pgfpathrectanglecorners
2644 {\pgfpoint{-\pgf@circ@res@temp}{-\pgf@circ@res@temp}}
2645 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
2646 \pgf@circ@setcolor
2647 \pgfsetfillopacity{\ctikzvalof{poles/open fill opacity}}% normally 1.0
2648 \ifx\tikz@fillcolor\pgfutil@empty
2649 % set the default fill color to white
2650 \pgfsetfillcolor{\ctikzvalof{open poles fill}}
2651 % ...but override it if the class is defined!
2652 % note that this element has no class, but will inherit it when used
2653 % into another component
2654 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
2655 \else
2656 \pgfsetfillcolor{\tikz@fillcolor}
2657 \fi
2658 \pgfusepath{draw,fill}
2659 }
2660 }
2661
2662 %% Fill for correct rectangular joins
2663
2664 \pgfdeclareshape{rectjoinfill}{
2665 \savedanchor{\northeast}{%
2666 \pgf@x=.5\pgflinewidth%
2667 \pgf@y=.5\pgflinewidth%
2668 }
2669 % geo anchors based on north-east
2670 \pgfcirc@northeast@symmetric@geoanchors
2671 \anchor{center}{
2672 \pgfpointorigin
2673 }
2674 \anchorborder{
2675 \pgf@circ@res@left=\pgf@x
2676 \pgf@circ@res@up=\pgf@y
2677 }
2678 \pgf@circ@draw@component{
2679 \pgfpathrectanglecorners
2680 {\pgfpoint{0}{.5\pgflinewidth}}
2681 {\pgfpoint{0}{-.5\pgflinewidth}}
2682 \pgf@circ@setcolor
2683 \pgf@circ@fill@strokecolor
2684 \pgfusepath{draw,fill}
2685 }
2686 }
2687 % %>>>
2688
2689 %% Arrows%<<<
2690 %% transistor arrow
2691
2692 \def\pgf@circ@find@linescale{
2693 % find the scale inverse of the scale factor: line width do not scale
2694 % with scale=..., transform shape so we have to counteract it.
2695 \iftikz@fullytransformed % this is true if `transform shape` is active
2696 % from @Circumscribe https://tex.stackexchange.com/a/474035/38080
2697 % Note that this trick is not working inside a `spy` environment...
2698 \pgfgettransformentries{\scaleA}{\scaleB}{\scaleC}{\scaleD}{\whatevs}{\whatevs}%
2699 \pgfmathsetmacro{\@@factor}{1.0/sqrt(abs(\scaleA*\scaleD-\scaleB*\scaleC))}%
2700 \else
2701 \pgfmathsetmacro{\@@factor}{1.0}
2702 \fi
2703 }
2704
2705 \pgfdeclareshape{trarrow}{%
2706 % this arrow is only filled but grows with the linewidth, more or less
2707 % like currarrow do
2708 \savedanchor{\northeast}{%
2709 \pgf@circ@res@step = \pgf@circ@Rlen
2710 \pgf@circ@find@linescale
2711 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2712 \pgfpoint{0.7*\pgf@circ@res@step +0.5*\@@factor*\pgflinewidth}
2713 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2714 }
2715 % The arrow size should be more or less the same of a currarrow, which is
2716 % both filled and stroke, for backward output compatibility (more or less)
2717 %
2718 % angle \beta W is \pgf@circ@Rlen/\ctikzvalof{current arrow scale}
2719 % |-\__ currarrow as the tip at (W,0)
2720 % | | and the upper tail at (-0.7*W, 0.8*W)
2721 % | \__ it then "overshoot" do to the linew width L
2722 % | \__ xangle \alpha
2723 % ---0------->
2724 %
2725 % \beta = atan(0.7/0.8) \alpha=atan(0.8/1.7)
2726 % tip overshoot is (L/2)/sin(\alpha) = 1.743*L only in x direction
2727 % tail overshoot is -(L/2) in x, and (L/2)/sin(\beta) = 0.7539*L in y
2728 %
2729 \savedanchor{\northwest}{%
2730 \pgf@circ@res@step = \pgf@circ@Rlen
2731 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2732 \pgf@circ@find@linescale
2733 \pgfpoint{-0.7*\pgf@circ@res@step -0.5*\@@factor*\pgflinewidth}
2734 {0.8*\pgf@circ@res@step+0.7593*\@@factor*\pgflinewidth}
2735 }
2736 \savedanchor{\tip}{%
2737 \pgf@circ@res@step = \pgf@circ@Rlen
2738 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2739 \pgf@circ@find@linescale
2740 \pgfpoint{\pgf@circ@res@step + 1.743*\@@factor*\pgflinewidth}{0pt}
2741 }
2742 \anchor{north}{\northeast\pgf@x=0cm\relax}
2743 \anchor{east}{\northeast\pgf@y=0cm\relax}
2744 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2745 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2746 \anchor{north east}{\northeast}
2747 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2748 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2749 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2750 \anchor{center}{
2751 \pgfpointorigin
2752 }
2753 \anchor{tip}{
2754 \tip
2755 }
2756 \anchor{btip}{% this anchor is behind the tip of half a linewidth
2757 \tip
2758 \pgf@circ@find@linescale
2759 \pgf@circ@res@temp=\@@factor\pgflinewidth
2760 \advance\pgf@x by -.5\pgf@circ@res@temp
2761 }
2762 \pgf@circ@draw@component{
2763 \northwest
2764 \pgf@circ@res@up=\pgf@y
2765 \pgf@circ@res@left=\pgf@x
2766 \tip
2767 \pgf@circ@res@step = \pgf@x
2768 %
2769 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2770 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
2771 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2772 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
2773 \pgfpathclose
2774 \pgf@circ@fill@strokecolor
2775 \pgfusepath{fill} % just fill
2776 }
2777 }
2778
2779 %% Current arrow
2780
2781 %% we need a phantom version of this shape for advanced v-i-f
2782 %% use strange names to keep ot private
2783 \newif\ifpgfcirc@really@draw@currarrow\pgfcirc@really@draw@currarrowtrue
2784 \ctikzset{phantom@currarrow/.code=\pgfcirc@really@draw@currarrowfalse}
2785 \ctikzset{normal@currarrow/.code=\pgfcirc@really@draw@currarrowtrue}
2786
2787 \pgfdeclareshape{currarrow}{
2788 \savedanchor{\northeast}{%
2789 \pgf@circ@res@step = \pgf@circ@Rlen
2790 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2791 \pgf@x=.5\pgf@circ@res@step
2792 \pgf@y=\pgf@x%
2793 }
2794 \anchor{north}{\northeast\pgf@x=0cm\relax}
2795 \anchor{east}{\northeast\pgf@y=0cm\relax}
2796 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2797 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2798 \anchor{north east}{\northeast}
2799 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2800 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2801 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2802 \anchor{center}{
2803 \pgfpointorigin
2804 }
2805 \anchor{tip}{
2806 \pgfpointorigin
2807 \pgf@circ@res@step = \pgf@circ@Rlen
2808 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2809 \pgf@x =\pgf@circ@res@step
2810 }
2811 \pgf@circ@draw@component{
2812 \ifpgfcirc@really@draw@currarrow
2813 \pgf@circ@reset@arrows@rounded
2814 \pgf@circ@res@step = \pgf@circ@Rlen
2815 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2816
2817 \pgfpathmoveto{\pgfpoint{-.7\pgf@circ@res@step}{0pt}}
2818 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2819 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{0pt}}
2820 \pgfpathlineto{\pgfpoint{-.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2821 \pgfpathclose
2822 \pgf@circ@setcolor
2823 \pgf@circ@fill@strokecolor
2824 \pgfusepath{draw,fill}
2825 \fi
2826 }
2827 }
2828
2829 %% Flow arrow
2830 %% we need a phantom version of this shape for advanced v-i-f
2831 %% use strange names to keep ot private
2832 \newif\ifpgfcirc@really@draw@flowarrow\pgfcirc@really@draw@flowarrowtrue
2833 \ctikzset{phantom@flowarrow/.code=\pgfcirc@really@draw@flowarrowfalse}
2834 \ctikzset{normal@flowarrow/.code=\pgfcirc@really@draw@flowarrowtrue}
2835
2836 \pgfdeclareshape{flowarrow}{
2837 \savedanchor{\northeast}{%
2838 \pgf@circ@res@step = \pgf@circ@Rlen
2839 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2840 \pgf@y=.5\pgf@circ@res@step
2841 \pgf@circ@res@step = \pgf@circ@Rlen
2842 \divide \pgf@circ@res@step by 4
2843 \pgf@x=\pgf@circ@res@step%
2844 }
2845 \anchor{north}{\northeast\pgf@x=0cm\relax}
2846 \anchor{east}{\northeast\pgf@y=0cm\relax}
2847 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2848 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2849 \anchor{north east}{\northeast}
2850 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2851 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
2852 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2853 \anchor{text}{% text centered above
2854 \pgfpointorigin
2855 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox}
2856 }
2857 \anchor{center}{
2858 \pgfpointorigin
2859 }
2860 \anchor{tip}{
2861 \pgfpointorigin
2862 \pgf@circ@res@step = \pgf@circ@Rlen
2863 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2864 \pgf@x =\pgf@circ@res@step
2865 }
2866 \pgf@circ@draw@component{
2867 \ifpgfcirc@really@draw@flowarrow
2868 \pgf@circ@reset@arrows@rounded
2869 \pgf@circ@res@step = \pgf@circ@Rlen
2870 \divide \pgf@circ@res@step by 4
2871 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{0pt}}
2872 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
2873 \pgf@circ@setcolor
2874 \pgfusepath{draw}
2875 \pgf@circ@fill@strokecolor
2876 \pgftransformshift{\pgfpoint{\pgf@circ@res@step}{0pt}}
2877 \pgfnode{currarrow}{tip}{}{}{\pgfusepath{fill}}
2878 \fi
2879 }
2880 }
2881
2882 %% Input arrow
2883
2884 \pgfdeclareshape{inputarrow}{
2885 \savedanchor{\northeast}{% this is really not northeast, really -northwest
2886 \pgf@circ@res@step = \pgf@circ@Rlen
2887 \divide \pgf@circ@res@step by \ctikzvalof{current arrow scale}
2888 \pgf@y=.5\pgf@circ@res@step
2889 \pgf@x=1.7\pgf@circ@res@step
2890 }
2891 \anchor{north}{\northeast\pgf@x=0cm\relax}
2892 \anchor{east}{\northeast\pgf@y=0cm\relax\pgf@x=0cm\relax}
2893 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0cm\relax}
2894 \anchor{west}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x}
2895 \anchor{north east}{\northeast\pgf@x=0cm\relax}
2896 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
2897 \anchor{south east}{\northeast\pgf@y=-\pgf@y\pgf@x=0cm\relax}
2898 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
2899 \savedanchor{\tip}{
2900 \pgfpointorigin
2901 }
2902 \anchor{center}{
2903 \tip
2904 }
2905 \anchor{tip}{
2906 \tip
2907 }
2908 \pgf@circ@draw@component{
2909 \pgf@circ@reset@arrows@rounded
2910 \pgf@circ@res@step = \pgf@circ@Rlen
2911 \divide \pgf@circ@res@step by 16
2912 \pgfpathmoveto{\pgfpoint{-1.7\pgf@circ@res@step}{0pt}}
2913 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
2914 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
2915 \pgfpathlineto{\pgfpoint{-1.7\pgf@circ@res@step}{.8\pgf@circ@res@step}}
2916 \pgfpathclose
2917 \pgf@circ@setcolor
2918 \pgf@circ@fill@strokecolor
2919 \pgfusepath{fill}
2920 }
2921 }
2922 % %>>>
2923
2924 %% boxes%<<<
2925 %% box
2926
2927 \pgfdeclareshape{box}{
2928 \anchor{center}{
2929 \pgfpointorigin
2930 }
2931 \pgf@circ@draw@component{
2932 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@Rlen
2933 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2934 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2935 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2936 \pgf@circ@draworfill
2937 }
2938 }
2939
2940 %% box scaled with blocks
2941
2942 \pgfdeclareshape{blockbox}{
2943 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}}
2944 \anchor{center}{
2945 \pgfpointorigin
2946 }
2947 \pgf@circ@draw@component{
2948 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{blocks/scale}\pgf@circ@Rlen}
2949 \pgf@circ@res@step = \ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
2950 \pgf@circ@res@step = 0.5\pgf@circ@res@step
2951 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
2952 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@step}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
2953 \pgf@circ@draworfill
2954 }
2955 }
2956 % %>>>
2957
2958 %% crossings%<<<
2959 % full nodes for wire crossing
2960 % styling for the vertical wire (default: do none)
2961 \ctikzset{crossing vertical/relative thickness/.initial=1}
2962 \ctikzset{crossing vertical/color/.initial=default}
2963 \ctikzset{crossing vertical/dash/.initial=default}
2964
2965 \pgfdeclareshape{jump crossing}
2966 {
2967 \savedanchor\northwest{%
2968 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
2969 \pgf@y=.5\pgf@y
2970 \pgf@x=-\pgf@y
2971 }
2972 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
2973 \pgfcirc@northwest@symmetric@geoanchors
2974 \pgf@circ@draw@component{
2975 \northwest
2976 \pgf@circ@res@up = \pgf@y
2977 \pgf@circ@res@down = -\pgf@y
2978 \pgf@circ@res@right = -\pgf@x
2979 \pgf@circ@res@left = \pgf@x
2980 % horizontal jumper
2981 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
2982 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0pt}}
2983 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
2984 \pgfsetbeveljoin
2985 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
2986 \pgfusepath{draw}
2987 % vertical, broken path
2988 % styling of vertical line
2989 \pgfsetlinewidth{\ctikzvalof{crossing vertical/relative thickness}\pgflinewidth}
2990 \pgf@circ@subset@color@dash{crossing vertical}
2991 %
2992 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
2993 \pgfpathlineto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
2994 \pgfpathmoveto{\pgfpoint{0pt}{0.3\pgf@circ@res@up}}
2995 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
2996 \pgfusepath{draw}
2997 }
2998 }
2999 \pgfdeclareshape{plain crossing}
3000 {
3001 \savedanchor\northwest{%
3002 \pgf@y=\ctikzvalof{bipoles/crossing/size}\pgf@circ@Rlen
3003 \pgf@y=.5\pgf@y
3004 \pgf@x=-\pgf@y
3005 }
3006 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
3007 \pgfcirc@northwest@symmetric@geoanchors
3008 \pgf@circ@draw@component{
3009 \northwest
3010 \pgf@circ@res@up = \pgf@y
3011 \pgf@circ@res@down = -\pgf@y
3012 \pgf@circ@res@right = -\pgf@x
3013 \pgf@circ@res@left = \pgf@x
3014 % horizontal jumper
3015 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
3016 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3017 \pgfusepath{draw}
3018 % vertical, broken path
3019 % styling of vertical line
3020 \pgfsetlinewidth{\ctikzvalof{crossing vertical/relative thickness}\pgflinewidth}
3021 \pgf@circ@subset@color@dash{crossing vertical}
3022 %
3023 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3024 \pgfpathlineto{\pgfpoint{0pt}{0.1\pgf@circ@res@up}}
3025 \pgfpathmoveto{\pgfpoint{0pt}{0.1\pgf@circ@res@down}}
3026 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
3027 \pgfusepath{draw}
3028 }
3029 }
3030 % %>>>
3031
3032 %% Connectors (BNC and IEC connectors; see https://github.com/circuitikz/circuitikz/issues/611)%<<<
3033
3034 % define new class
3035 \ctikzset{connectors/scale/.initial=1.0}
3036 \ctikzset{connectors/fill/.initial=none}
3037 \ctikzset{connectors/thickness/.initial=none}
3038 % parameters. To have round sockets, 3*height==2*width
3039 \ctikzset{bipoles/iecconn/height/.initial=.2}
3040 \ctikzset{bipoles/iecconn/width/.initial=.3}
3041 % objects
3042 \pgfcircdeclarebipolescaled{connectors}
3043 {
3044 \anchor{plug center}{\northeast\pgf@y=0pt\divide\pgf@x by 3 }
3045 \anchor{socket center}{\northeast\pgf@y=0pt\pgf@x=-0.333333\pgf@x}
3046 % put the node text above and centered
3047 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
3048 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3049 \dimexpr.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3050 }
3051 }
3052 }
3053 {\ctikzvalof{bipoles/iecconn/height}}%symmetrical
3054 {iecconn}
3055 {\ctikzvalof{bipoles/iecconn/height}}
3056 {\ctikzvalof{bipoles/iecconn/width}}
3057 {
3058 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3059 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
3060 \pgfpatharc{90}{-90}{0.66666\pgf@circ@res@left and \pgf@circ@res@up}
3061 \pgfusepath{draw}
3062 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up/2}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down/2}}
3063 \pgf@circ@fill@strokecolor
3064 \pgfusepath{draw, fill}
3065 }
3066 \pgfcirc@activate@bipole@simple{l}{iecconn}
3067 \pgfcirc@style@to@style{iecconn}{iec connector}
3068
3069 \long\def\pgfcirc@declare@iecsocket#1#2#3{% #1 name, #2 anchors, #3 drawing code
3070 \pgfdeclareshape{#1}{%
3071 \savedmacro{\ctikzclass}{\edef\ctikzclass{connectors}}
3072 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3073 \savedanchor\northwest{%
3074 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3075 \pgf@y=\ctikzvalof{bipoles/iecconn/height}\pgf@circ@scaled@Rlen
3076 \pgf@y=.5\pgf@y
3077 \pgf@x=-\ctikzvalof{bipoles/iecconn/width}\pgf@circ@scaled@Rlen
3078 \divide\pgf@x by 6
3079 }
3080 \pgfcirc@northwest@symmetric@geoanchors
3081 #2%
3082 \pgf@circ@draw@component{%
3083 \pgf@circ@scaled@Rlen=\scaledRlen
3084 \pgfstartlinewidth=\pgflinewidth
3085 \northwest
3086 \pgf@circ@res@up=\pgf@y
3087 \pgf@circ@res@left=\pgf@x
3088 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3089 #3%
3090 \pgfusepath{draw}
3091 }
3092 }
3093 }
3094
3095 \long\def\pgfcirc@declare@iecplug#1#2{% #1 name, #2 anchors (drawing code is the same)
3096 \pgfdeclareshape{#1}{%
3097 \savedmacro{\ctikzclass}{\edef\ctikzclass{connectors}}
3098 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3099 \savedanchor\northwest{%
3100 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3101 \pgf@y=\ctikzvalof{bipoles/iecconn/height}\pgf@circ@scaled@Rlen
3102 \pgf@y=.25\pgf@y
3103 \pgf@x=-\ctikzvalof{bipoles/iecconn/width}\pgf@circ@scaled@Rlen
3104 \divide\pgf@x by 3
3105 }
3106 \pgfcirc@northwest@symmetric@geoanchors
3107 \anchor{plug center}{\pgfpointorigin}
3108 #2%
3109 \pgf@circ@draw@component{%
3110 \pgf@circ@scaled@Rlen=\scaledRlen
3111 \pgfstartlinewidth=\pgflinewidth
3112 \northwest
3113 \pgf@circ@res@up=\pgf@y
3114 \pgf@circ@res@left=\pgf@x
3115 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3116 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@up}}
3117 \pgf@circ@setcolor
3118 \pgf@circ@fill@strokecolor
3119 \pgfusepath{draw, fill}
3120 }
3121 }
3122 }
3123
3124 \pgfcirc@declare@iecsocket{iecsocketR}{%
3125 % notice: center is on the left side
3126 \anchor{center}{\northwest\pgf@y=0pt}
3127 \anchor{socket center}{\northwest\pgf@y=0pt}
3128 % put the node text above and to the left, ignore depth
3129 \anchor{text}{%
3130 \pgfextractx{\pgf@circ@res@left}{\northwest}
3131 \pgfextracty{\pgf@circ@res@up}{\northwest}
3132 \pgfpoint{-\pgf@circ@res@left}{%
3133 .5\ht\pgfnodeparttextbox+\pgf@circ@res@up
3134 }%
3135 }%
3136 }{% drawing
3137 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
3138 \pgfpatharc{90}{270}{2\pgf@circ@res@left and \pgf@circ@res@up}
3139 }
3140 \pgfcirc@declare@iecsocket{iecsocketL}{%
3141 % notice: center is on the left side
3142 \anchor{center}{\northwest\pgf@y=0pt}
3143 \anchor{socket center}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
3144 % put the node text above and to the left, ignore depth
3145 \anchor{text}{%
3146 \pgfextractx{\pgf@circ@res@left}{\northwest}
3147 \pgfextracty{\pgf@circ@res@up}{\northwest}
3148 \pgfpoint{-\wd\pgfnodeparttextbox+\pgf@circ@res@left}{%
3149 .5\ht\pgfnodeparttextbox+\pgf@circ@res@up
3150 }%
3151 }%
3152 }{% drawing
3153 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
3154 \pgfpatharc{90}{-90}{2\pgf@circ@res@left and \pgf@circ@res@up}
3155 }
3156
3157 \pgfcirc@declare@iecplug{iecplugL}{%
3158 % notice: center is on the left side
3159 \anchor{center}{\northwest\pgf@y=0pt}
3160 % put the node text above and to the right, ignore depth
3161 % the text is higher to match the iec socket position
3162 \anchor{text}{%
3163 \pgfextractx{\pgf@circ@res@left}{\northwest}
3164 \pgfextracty{\pgf@circ@res@up}{\northwest}
3165 \pgfpoint{-\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
3166 .5\ht\pgfnodeparttextbox+2\pgf@circ@res@up
3167 }
3168 }
3169 }
3170 \pgfcirc@declare@iecplug{iecplugR}{%
3171 % notice: center is on the left side
3172 \anchor{center}{\northwest\pgf@y=0pt}
3173 % put the node text above and to the right, ignore depth
3174 % the text is higher to match the iec socket position
3175 \anchor{text}{%
3176 \pgfextractx{\pgf@circ@res@left}{\northwest}
3177 \pgfextracty{\pgf@circ@res@up}{\northwest}
3178 \pgfpoint{-\pgf@circ@res@left}{
3179 .5\ht\pgfnodeparttextbox+2\pgf@circ@res@up
3180 }
3181 }
3182 }
3183 % BNC connector
3184
3185 \pgfdeclareshape{bnc}{
3186 \savedmacro{\ctikzclass}{\edef\ctikzclass{connectors}}
3187 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3188 \anchor{center}{
3189 \pgfpointorigin
3190 }
3191 % BNC size is 2.5 times the size of the internal "ocirc", when class scale is=1
3192 \savedanchor\northwest{%
3193 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3194 \pgf@y=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
3195 \pgf@y=2.5\pgf@y
3196 \pgf@x=-\pgf@y
3197 }
3198 % center is on the opening
3199 \anchor{center}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
3200 \anchor{zero}{\pgfpointorigin}
3201 \anchor{hot}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
3202 \anchor{shield}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
3203 % geo-anchors
3204 \pgfcirc@northwest@symmetric@geoanchors
3205 % put the node text above and centered
3206 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
3207 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
3208 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
3209 }
3210 }
3211 \anchorborder{
3212 \pgf@circ@res@left=\pgf@x
3213 \pgf@circ@res@up=\pgf@y
3214 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3215 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
3216 }{\pgfpoint{2.5*\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}{2.5*\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}}
3217 }
3218 \pgf@circ@draw@component{
3219 \pgfextracty{\pgf@circ@res@other}{\northwest}
3220 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{nodes width}*\scaledRlen}
3221 \pgfstartlinewidth=\pgflinewidth
3222 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
3223 \pgf@circ@setcolor
3224 % external circle
3225 \pgfscope
3226 % clipping path: first a rectangle bigger then the shape
3227 % to avoid problems with the line thickness
3228 \pgfpathrectanglecorners{\pgfpoint{-2\pgf@circ@res@other}{-2\pgf@circ@res@other}}
3229 {\pgfpoint{2\pgf@circ@res@other}{2\pgf@circ@res@other}}
3230 % next the opening to the right
3231 \pgfpathrectanglecorners{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
3232 {\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@step}}
3233 % do the difference and clip before drawing
3234 \pgfseteorule
3235 \pgfusepath{clip}
3236 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@other}
3237 \pgfusepath{draw}
3238 \endpgfscope
3239 % internal circle
3240 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@step}
3241 \pgf@circ@draworfill
3242 % and the contact line to the right
3243 \pgfsetlinewidth{\pgfstartlinewidth}
3244 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
3245 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
3246 \pgfusepath{draw}
3247 }
3248 }
3249 % %>>>
3250
3251 % vim: set fdm=marker fmr=%<<<,%>>>:
3252 %%%---------- close: tex/pgfcircshapes
3253 %%%%%%%%%%% Springe nach tex/pgfcircmonopoles
3254 %%%---------- open: tex/pgfcircmonopoles.tex
3255 % Copyright 2018-2026 by Romano Giannetti
3256 % Copyright 2015-2026 by Stefan Lindner
3257 % Copyright 2013-2026 by Stefan Erhardt
3258 % Copyright 2007-2026 by Massimo Redaelli
3259 %
3260 % This file may be distributed and/or modified
3261 %
3262 % 1. under the LaTeX Project Public License and/or
3263 % 2. under the GNU Public License.
3264 %
3265 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
3266
3267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3268 %% Monopoles
3269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3270
3271 %%%%%%%%%%%%%
3272 %% Grounds
3273 %%%%%%%%%%%%%
3274
3275
3276 % grounds and power supplies%<<<1
3277
3278 \ctikzset{monopoles/.is family}
3279 \ctikzset{monopoles/ground/width/.initial=.25}
3280 \ctikzset{monopoles/ground/connectionthickness/.initial=1}
3281 \ctikzset{monopoles/ground/thickness/.initial=2}
3282 \ctikzset{monopoles/rground/thickness/.initial=2}
3283 \ctikzset{monopoles/tground/thickness/.initial=3}
3284 \ctikzset{monopoles/vcc/width/.initial=.2}
3285 \ctikzset{monopoles/vcc/arrow/.initial=legacy}
3286 \ctikzset{monopoles/vee/arrow/.initial=legacy}
3287 \ctikzset{monopoles/match/width/.initial=.4}
3288 \ctikzset{monopoles/chassis/width/.initial=.25}
3289 \ctikzset{monopoles/alternative chassis/width/.initial=.25}
3290 \ctikzset{monopoles/equipotentiality/width/.initial=.25}
3291 \ctikzset{monopoles/antenna/width/.initial=.25}
3292 \ctikzset{monopoles/antenna/label/xanchor/.initial=.4}
3293 \ctikzset{monopoles/antenna/label/yanchor/.initial=.75}
3294 \ctikzset{monopoles/txantenna/label/xanchor/.initial=.4}
3295 \ctikzset{monopoles/txantenna/label/yanchor/.initial=.75}
3296 \ctikzset{monopoles/txantenna/width/.initial=.25}
3297 \ctikzset{monopoles/rxantenna/label/xanchor/.initial=.4}
3298 \ctikzset{monopoles/rxantenna/label/yanchor/.initial=.75}
3299 \ctikzset{monopoles/rxantenna/width/.initial=.25}
3300 \ctikzset{monopoles/bareantenna/width/.initial=.25}
3301 \ctikzset{monopoles/bareantenna/label/xanchor/.initial=1}
3302 \ctikzset{monopoles/bareantenna/label/yanchor/.initial=0.5}
3303 \ctikzset{monopoles/dinantenna/width/.initial=.2}
3304 \ctikzset{monopoles/dinantenna/height/.initial=.6}
3305 \ctikzset{monopoles/waves/width/.initial=0.5}%
3306 \ctikzset{monopoles/harmonics/width/.initial=0.5}%
3307 %>>>
3308
3309 %% Node shapes for grounds and power supply%<<<
3310
3311 %% Ground symbol
3312 % #1 -> name
3313 % #2 -> width
3314 % #3 -> depth
3315 % #4 -> code
3316 \long\def\pgf@circ@declareground#1#2#3#4{
3317 \pgfdeclareshape{#1}{
3318 \savedmacro{\ctikzclass}{\edef\ctikzclass{grounds}} % class of these components
3319 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3320 \savedanchor{\southeast}{
3321 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3322 \pgf@x=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3323 \pgf@x=#2\pgf@x
3324 \pgf@y=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3325 \pgf@y=-#3\pgf@y
3326 }
3327 \anchor{north}{\pgfpointorigin}
3328 \anchor{north east}{\southeast\pgf@y=0pt\relax}
3329 \anchor{east}{\southeast\pgf@y=.5\pgf@y}
3330 \anchor{south east}{\southeast}
3331 \anchor{south}{\southeast\pgf@x=0pt\relax}
3332 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
3333 \anchor{west}{\southeast\pgf@y=.5\pgf@y\pgf@x=-\pgf@x}
3334 \anchor{north west}{\southeast\pgf@y=0pt\pgf@x=-\pgf@x}
3335 \anchor{left}{\pgfpointorigin}
3336 \anchor{right}{\pgfpointorigin}
3337 \anchor{center}{\pgfpointorigin}
3338 \pgf@circ@draw@component{
3339 \pgf@circ@scaled@Rlen=\scaledRlen
3340 \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@scaled@Rlen
3341 \pgfscope
3342 \pgfstartlinewidth=\pgflinewidth
3343 #4
3344 \endpgfscope
3345 }
3346 }
3347 }
3348
3349
3350 \pgf@circ@declareground{ground}{0.6}{1.6}{
3351 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3352 \pgfpathmoveto{\pgfpointorigin}
3353 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3354 \pgfusepath{draw}
3355 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3356 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3357 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3358 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3359 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3360 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3361 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3362 \pgfusepath{draw}
3363 }
3364
3365 \pgf@circ@declareground{tlground}{0.6}{0.4}{
3366 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3367 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3368 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3369 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3370 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
3371 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3372 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
3373 \pgfusepath{draw}
3374 }
3375
3376
3377 \pgf@circ@declareground{rground}{0.6}{1}{
3378 \pgfpathmoveto{\pgfpointorigin}
3379 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3380 \pgfusepath{draw}
3381
3382 \pgfstartlinewidth=\pgflinewidth
3383 \pgf@circ@setlinewidth{monopoles/rground}{\pgfstartlinewidth}
3384
3385 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3386 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3387 \pgfsetroundcap\pgfusepath{draw}
3388 }
3389
3390 \pgf@circ@declareground{tground}{0.6}{0}{
3391 \pgfpathmoveto{\pgfpointorigin}
3392 \pgfusepath{draw}
3393
3394 \pgfstartlinewidth=\pgflinewidth
3395 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3396
3397 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
3398 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
3399 \pgfusepath{draw}
3400 }
3401
3402 \pgf@circ@declareground{sground}{0.6}{1.8}{
3403 \pgfpathmoveto{\pgfpointorigin}
3404 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3405 \pgfusepath{draw}
3406
3407 \pgfstartlinewidth=\pgflinewidth
3408 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3409
3410 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3411 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-\pgf@circ@res@step}}
3412 \pgfpathlineto{\pgfpoint{0}{-1.8\pgf@circ@res@step}}
3413 \pgfpathclose
3414 \pgf@circ@draworfill
3415 }
3416
3417 % noiseless ground
3418 \pgf@circ@declareground{nground}{0.9}{1.6}{
3419 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3420 \pgfpathmoveto{\pgfpointorigin}
3421 \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
3422 \pgfusepath{draw}
3423 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3424 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3425 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3426 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3427 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3428 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3429 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3430 \pgfusepath{draw}
3431 \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
3432 \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
3433 \pgfusepath{draw}
3434 }
3435
3436 % protective ground
3437 \pgf@circ@declareground{pground}{0.9}{1.8}{
3438 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3439 \pgfpathcircle{\pgfpoint{0pt}{-0.9\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
3440 \pgf@circ@draworfill
3441 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3442 \pgfpathmoveto{\pgfpointorigin}
3443 \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
3444 \pgfusepath{draw}
3445 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3446 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3447 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3448 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3449 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
3450 \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3451 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
3452 \pgfusepath{draw}
3453 }
3454
3455 % chassis ground
3456 \pgf@circ@declareground{cground}{1}{2}{
3457 \pgfsetlinewidth{\ctikzvalof{monopoles/ground/connectionthickness}\pgfstartlinewidth}
3458 \pgfpathmoveto{\pgfpointorigin}
3459 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3460 \pgfusepath{draw}
3461 \pgf@circ@setlinewidth{monopoles/ground}{\pgfstartlinewidth}
3462 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3463 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3464 \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3465 \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3466 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
3467 \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
3468 \pgfusepath{draw}
3469 }
3470
3471 % Contributed by @fotesan https://github.com/fotesan
3472 % european ground
3473 \pgf@circ@declareground{eground}{1.1}{1.7}{
3474 \pgfpathmoveto{\pgfpointorigin}
3475 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3476 \pgfusepath{draw}
3477
3478 \pgfstartlinewidth=\pgflinewidth
3479 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3480
3481 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3482 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3483 \pgfusepath{draw}
3484
3485 \pgfsetlinewidth{\pgfstartlinewidth}
3486 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3487 \pgfpathlineto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3488 \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3489 \pgfpathlineto{\pgfpoint{-.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3490 \pgfpathmoveto{\pgfpoint{-.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3491 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3492 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3493 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3494 \pgfusepath{draw}
3495 }
3496
3497 \pgf@circ@declareground{eground2}{1.1}{1.7}{
3498 \pgfpathmoveto{\pgfpointorigin}
3499 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
3500 \pgfusepath{draw}
3501
3502 \pgfstartlinewidth=\pgflinewidth
3503 \pgf@circ@setlinewidth{monopoles/tground}{\pgfstartlinewidth}
3504
3505 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3506 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@step}{-\pgf@circ@res@step}}
3507 \pgfusepath{draw}
3508
3509 \pgfsetlinewidth{\pgfstartlinewidth}
3510 \pgfpathmoveto{\pgfpoint{-1.1\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3511 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3512 \pgfpathmoveto{\pgfpoint{-.45\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3513 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3514 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@step}{-1.7\pgf@circ@res@step}}
3515 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3516 \pgfusepath{draw}
3517 }
3518
3519 %%%%%%%%%%%%%%%%%%
3520 %% Power supplies
3521 %%%%%%%%%%%%%%%%%%
3522
3523 % Vcc
3524 \pgfdeclareshape{vcc}{
3525 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3526 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3527 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3528 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3529 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3530 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3531 }
3532 \savedanchor{\northeast}{%
3533 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3534 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3535 \pgf@x=.5\pgf@circ@res@step
3536 \pgf@y=3\pgf@x%
3537 }
3538 \anchor{north}{\northeast\pgf@x=0cm\relax}
3539 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3540 \anchor{south}{\pgfpointorigin}
3541 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3542 \anchor{north east}{\northeast}
3543 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3544 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3545 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3546 \anchor{center}{\pgfpointorigin}
3547 \anchor{left}{\pgfpointorigin}
3548 \anchor{right}{\pgfpointorigin}
3549 \anchor{text}{
3550 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3551 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3552 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3553 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{2\pgf@circ@res@step+2\ht\pgfnodeparttextbox}}
3554 \pgf@x=0pt
3555 \pgf@y=2\pgf@circ@res@step
3556 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
3557 \pgf@x=-.5\wd\pgfnodeparttextbox
3558 }
3559 \pgf@circ@draw@component{
3560 \pgf@circ@scaled@Rlen=\scaledRlen
3561 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3562 \pgfscope
3563 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vcc/arrow}}\edef\pgf@temp{legacy}
3564 \ifx\pgf@temp\pgf@circ@temp
3565 \pgfstartlinewidth=\pgflinewidth
3566 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3567
3568 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3569 \pgfpathlineto{\pgfpoint{0}{1.5\pgf@circ@res@step}}
3570 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{.8\pgf@circ@res@step}}
3571 \pgfusepath{draw}
3572
3573 \pgfsetlinewidth{\pgfstartlinewidth}
3574 \else
3575 \pgfsetarrowsend{\pgf@circ@temp}
3576 \fi
3577 \pgfpathmoveto{\pgfpointorigin}
3578 \pgfpathlineto{\pgfpoint{0pt}{1.5\pgf@circ@res@step}}
3579 \pgfusepath{draw}
3580 \endpgfscope
3581 }
3582 }
3583
3584 % Vee
3585 \pgfdeclareshape{vee}{
3586 \savedmacro{\ctikzclass}{\edef\ctikzclass{power supplies}} % class of these components
3587 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3588 \saveddimen{\scaledwidth}{% thanks to @Schrödinger's cat on https://tex.stackexchange.com/a/506249/38080
3589 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
3590 \pgfmathsetmacro{\gscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
3591 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{\ctikzclass/scale}*\gscale*\ctikzvalof{monopoles/vcc/width})*\pgf@circ@Rlen}%
3592 }
3593 \savedanchor{\northeast}{%
3594 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3595 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3596 \pgf@x=.5\pgf@circ@res@step
3597 \pgf@y=-3\pgf@x%
3598 }
3599 \anchor{south}{\northeast\pgf@x=0cm\relax}
3600 \anchor{east}{\northeast\pgf@y=0.5\pgf@y\relax}
3601 \anchor{north}{\pgfpointorigin}
3602 \anchor{west}{\northeast\pgf@y=0.5\pgf@y\pgf@x=-\pgf@x}
3603 \anchor{south east}{\northeast}
3604 \anchor{south west}{\northeast\pgf@x=-\pgf@x}
3605 \anchor{north east}{\northeast\pgf@y=0pt\relax}
3606 \anchor{north west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3607 \anchor{center}{\pgfpointorigin}
3608 \anchor{left}{\pgfpointorigin}
3609 \anchor{right}{\pgfpointorigin}
3610 \anchor{text}{
3611 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3612 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3613 \pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3614 \pgfpathmoveto{\pgfpoint{.5\wd\pgfnodeparttextbox}{-2\pgf@circ@res@step-2\ht\pgfnodeparttextbox}}
3615 \pgf@x=0pt
3616 \pgf@y=-2\pgf@circ@res@step
3617 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
3618 \pgf@x=-.5\wd\pgfnodeparttextbox
3619 }
3620
3621 \pgf@circ@draw@component{
3622 \pgf@circ@scaled@Rlen=\scaledRlen
3623 \pgf@circ@res@step=\ctikzvalof{monopoles/vcc/width}\pgf@circ@scaled@Rlen
3624 \pgfscope
3625 \edef\pgf@circ@temp{\ctikzvalof{monopoles/vee/arrow}}\edef\pgf@temp{legacy}
3626 \ifx\pgf@temp\pgf@circ@temp
3627
3628 \pgfstartlinewidth=\pgflinewidth
3629 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3630
3631 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3632 \pgfpathlineto{\pgfpoint{0}{-1.5\pgf@circ@res@step}}
3633 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-.8\pgf@circ@res@step}}
3634 \pgfusepath{draw}
3635 \pgfsetlinewidth{\pgfstartlinewidth}
3636 \else
3637 \pgfsetarrowsend{\pgf@circ@temp}
3638 \fi
3639 \pgfpathmoveto{\pgfpointorigin}
3640 \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
3641 \pgfusepath{draw}
3642 \endpgfscope
3643 }
3644 }% %>>>
3645
3646
3647 %% This are strange, and probably wrong FIXME
3648 % \compattikzset{vdd/.style = {\comnpatname vcc = #1}}
3649 % \compattikzset{vss/.style = {\comnpatname vee = #1}}
3650 \pgfcirc@style@to@style{vcc}{vdd}
3651 \pgfcirc@style@to@style{vee}{vss}
3652
3653
3654 %%%%%%%%%%%%%%
3655 %% RF bipoles and monopoles
3656 %%%%%%%%%%%%%%
3657
3658 %% RF bipoles and monopoles settings %<<<1
3659 \ctikzset{bipoles/mstline/height/.initial=0.3}
3660 \ctikzset{bipoles/mstline/width/.initial=1.2}
3661 \pgfkeys{/tikz/mstlinelen/.add code={}{\ctikzset{bipoles/mstline/width=#1}}}
3662 \ctikzset{monopoles/msport/width/.initial=.5}
3663 \ctikzset{monopoles/msrstub/height/.initial=1.0}
3664 \ctikzset{monopoles/msrstub/width/.initial=0.6}%
3665 %>>>
3666
3667 %% Node shapes for RF bipoles%<<<
3668 \ctikzset{bipoles/tline/height/.initial=.3}
3669 \ctikzset{bipoles/tline/width/.initial=.6}
3670 \newif\ifpgf@circ@bare@tline
3671 \ctikzset{bipoles/tline/bare/.is if=pgf@circ@bare@tline}
3672 \pgfcircdeclarebipolescaled{RF}
3673 {
3674 \savedmacro{\recessright}{\edef\recessright{\ifpgf@circ@bare@tline -0.4\else 0.0\fi}}
3675 \anchor{center right}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@y=0pt}
3676 \anchor{top right}{\northeast \advance\pgf@x by -0.4\pgf@y}
3677 \anchor{bottom right}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@y=-\pgf@y}
3678 \anchor{center left}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@x=-\pgf@x\pgf@y=0pt}
3679 \anchor{top left}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@x=-\pgf@x}
3680 \anchor{bottom left}{\northeast \advance\pgf@x by -0.4\pgf@y\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
3681 \anchor{right}{\northeast \advance\pgf@x by \recessright\pgf@y\pgf@y=0pt}
3682 }
3683 {\ctikzvalof{bipoles/tline/height}}
3684 {tline}
3685 {\ctikzvalof{bipoles/tline/height}}
3686 {\ctikzvalof{bipoles/tline/width}}
3687 {
3688 \pgf@circ@res@step=.4\pgf@circ@res@up % the size of the ellipsis is proportional to the height
3689 \pgfscope
3690 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3691 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
3692 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
3693 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
3694 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
3695 \pgfpatharc{-90}{90}{\pgf@circ@res@step and \pgf@circ@res@up}
3696 \pgf@circ@draworfill
3697 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
3698 \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
3699 \pgfusepath{stroke}
3700 \endpgfscope
3701 \ifpgf@circ@bare@tline\else
3702 \pgfsetlinewidth{\pgfstartlinewidth}
3703 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
3704 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
3705 \pgfusepath{stroke}
3706 \fi
3707 }
3708
3709 % microstrip transmission line
3710 \pgfcircdeclarebipolescaled{RF}
3711 {}
3712 {\ctikzvalof{bipoles/mstline/height}}
3713 {mstline}
3714 {\ctikzvalof{bipoles/mstline/height}}
3715 {\ctikzvalof{bipoles/mstline/width}}
3716 {
3717 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
3718 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3719 \pgf@circ@draworfill
3720 }% %>>>
3721
3722 %% Path definitions for RF path objects%<<<
3723 \pgfcirc@activate@bipole@simple{l}{mstline}
3724 \pgfcirc@activate@bipole@simple{l}{tline}
3725 \pgfcirc@style@to@style{tline}{transmission line}
3726 \pgfcirc@style@to@style{tline}{TL}
3727 % %>>>
3728
3729 %% Node shapes for RF monopoles%<<<
3730
3731 % Legacy tlinestub
3732 % Contributed by Leonardo Azzinnari
3733 \pgfdeclareshape{tlinestub}{
3734 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3735 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3736 \savedanchor{\northeast}{%
3737 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3738 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3739 \pgf@x=1.2\pgf@circ@res@step
3740 \pgf@circ@res@step = \ctikzvalof{bipoles/tline/width} \pgf@circ@scaled@Rlen
3741 \pgf@y=.2\pgf@circ@res@step%
3742 }
3743 % the center is on the left side of the shape for facility of usage
3744 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
3745 \anchor{east}{\northeast\pgf@y=0cm\relax}
3746 \anchor{south}{\northeast\pgf@y=-\pgf@y \pgf@x=0.5\pgf@x\relax}
3747 \anchor{west}{\pgfpointorigin}
3748 \anchor{north east}{\northeast}
3749 \anchor{north west}{\northeast\pgf@x=0cm\relax}
3750 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3751 \anchor{south west}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
3752 \anchor{center}{\pgfpointorigin}
3753 % this is not exact, but it's better than nothing
3754 \anchor{text}{\northeast\pgf@xa=\pgf@x\pgf@ya=\pgf@y
3755 \pgfpoint{\dimexpr-.5\wd\pgfnodeparttextbox+.8\pgf@xa}
3756 {\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@ya}}
3757 \pgf@circ@draw@component{
3758 \pgfstartlinewidth=\pgflinewidth
3759
3760 \pgf@circ@scaled@Rlen=\scaledRlen
3761 \pgf@circ@res@step=\ctikzvalof{bipoles/tline/width}\pgf@circ@scaled@Rlen
3762
3763 \pgfscope
3764 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3765 \pgfpathlineto{\pgfpoint{1.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3766 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3767 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
3768 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3769 \pgfpatharc{90}{-90}{-0.125\pgf@circ@res@step and -0.25\pgf@circ@res@step}
3770 \pgf@circ@draworfill
3771 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
3772 \pgfpatharc{90}{-90}{0.125\pgf@circ@res@step and 0.25\pgf@circ@res@step}
3773 \pgfusepath{stroke}
3774 \endpgfscope
3775 \pgfpathmoveto{\pgfpointorigin}
3776 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0pt}}
3777 \pgfusepath{draw}
3778 }
3779 }
3780
3781 %% New antennas without tails
3782
3783 % main body of antennas
3784 \def\pgf@circ@antennabody{%
3785 \pgfstartlinewidth=\pgflinewidth
3786 \pgf@circ@scaled@Rlen=\scaledRlen
3787 \pgf@circ@setcolor
3788 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3789 \pgfscope
3790 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3791 \pgfpathmoveto{\pgfpointorigin}
3792 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{2\pgf@circ@res@step}}
3793 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{2\pgf@circ@res@step}}
3794 \pgfsetbeveljoin
3795 \pgfpathclose
3796 \pgf@circ@draworfill
3797 \endpgfscope
3798 \pgfsetlinewidth{\pgfstartlinewidth}
3799 \pgfpathmoveto{\pgfpointorigin}
3800 \pgfpathlineto{\pgfpoint{0pt}{2\pgf@circ@res@step}}
3801 \pgfusepath{draw}
3802 }
3803
3804 % Waves for the antennas.
3805 \def\pgf@circ@antennawaves{%
3806 \pgfscope
3807 % define a triangle for clipping the waves
3808 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@step}}
3809 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{3\pgf@circ@res@step}}
3810 \pgfpathlineto{\pgfpoint{4.2\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3811 \pgfpathclose
3812 \pgfusepath{clip}
3813 % ...and build the waves as clipped circles
3814 \pgf@circ@count@a=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3815 \pgfmathloop%
3816 \ifnum\pgf@circ@count@a>2
3817 \pgfpathcircle{\pgfpoint{0pt}{\pgf@circ@res@step}}{\the\pgf@circ@count@a*\pgf@circ@res@other}
3818 \advance\pgf@circ@count@a-1\relax%
3819 \repeatpgfmathloop
3820 \pgfusepath{draw}
3821 \endpgfscope
3822 }
3823
3824 % additional shape with the waves
3825 \pgfdeclareshape{waves}{
3826 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3827 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3828 \anchor{center}{\pgfpointorigin}
3829 \savedanchor{\northeast}{
3830 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3831 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3832 \pgf@x=\pgf@circ@res@step
3833 \pgf@y=\pgf@circ@res@step
3834 }
3835 \anchor{text}{
3836 \northeast
3837 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3838 }
3839 \anchor{top}{\northeast\pgf@x=0pt}
3840 \anchor{right}{\northeast\pgf@y=0pt}
3841 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3842 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3843 \anchor{north}{\northeast\pgf@x=0pt}
3844 \anchor{north east}{\northeast}
3845 \anchor{east}{\northeast\pgf@y=0pt}
3846 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3847 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3848 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3849 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3850 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3851 \pgf@circ@draw@component{
3852 \pgf@circ@scaled@Rlen=\scaledRlen
3853 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3854 \pgf@circ@res@step=0.5\pgf@circ@res@step
3855 \pgf@circ@setcolor
3856 \pgfscope
3857 % define a triangle for clipping the waves
3858 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3859 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{2\pgf@circ@res@step}}
3860 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-2\pgf@circ@res@step}}
3861 \pgfpathclose
3862 \pgfusepath{clip}
3863 % ...and build the waves as clipped circles
3864 \c@pgf@counta=8\pgf@circ@res@other=0.5\pgf@circ@res@step
3865 \pgfmathloop%
3866 \ifnum\c@pgf@counta>1
3867 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3868 \advance\c@pgf@counta-1\relax%
3869 \repeatpgfmathloop
3870 \pgfusepath{draw}
3871 \endpgfscope
3872 }
3873 }
3874
3875 \pgfdeclareshape{harmonics}{
3876 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3877 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3878 \anchor{center}{\pgfpointorigin}
3879 \savedanchor{\northeast}{
3880 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3881 \pgf@circ@res@step=\ctikzvalof{monopoles/harmonics/width}\pgf@circ@scaled@Rlen
3882 \pgf@x=\pgf@circ@res@step
3883 \pgf@y=\pgf@circ@res@step
3884 }
3885 \anchor{text}{
3886 \northeast
3887 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3888 }
3889 \anchor{top}{\northeast\pgf@x=0pt}
3890 \anchor{right}{\northeast\pgf@y=0pt}
3891 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3892 \anchor{bottom}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3893 \anchor{north}{\northeast\pgf@x=0pt}
3894 \anchor{north east}{\northeast}
3895 \anchor{east}{\northeast\pgf@y=0pt}
3896 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
3897 \anchor{south}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt}
3898 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
3899 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0pt}
3900 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3901 \pgf@circ@draw@component{
3902 \pgf@circ@scaled@Rlen=\scaledRlen
3903 \pgf@circ@res@step=\ctikzvalof{monopoles/waves/width}\pgf@circ@scaled@Rlen
3904 \pgf@circ@res@step=0.5\pgf@circ@res@step
3905 \pgf@circ@setcolor
3906 \pgfscope
3907 % define a triangle for clipping the waves
3908 \pgfpathmoveto{\pgfpoint{-2\pgf@circ@res@step}{0pt}}
3909 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{1\pgf@circ@res@step}}
3910 \pgfpathlineto{\pgfpoint{2.1\pgf@circ@res@step}{-1\pgf@circ@res@step}}
3911 \pgfpathclose
3912 \pgfusepath{clip}
3913 % ...and build the waves as clipped circles
3914 \c@pgf@counta=32\pgf@circ@res@other=0.125\pgf@circ@res@step
3915 \pgfmathloop%
3916 \ifnum\c@pgf@counta>1
3917 \pgfpathcircle{\pgfpoint{-2\pgf@circ@res@step}{0pt}}{\the\c@pgf@counta*\pgf@circ@res@other}
3918 \advance\c@pgf@counta-1\relax%
3919 \repeatpgfmathloop
3920 \pgfusepath{draw}
3921 \endpgfscope
3922 }
3923 }
3924
3925 % the four types of antennas: simple, din, TX, RX. Notice that you can flip them...
3926 %
3927 \pgfdeclareshape{bareantenna}{
3928 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3929 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3930 \anchor{center}{\pgfpointorigin}
3931 \savedanchor{\northeast}{
3932 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3933 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
3934 \pgf@x=\pgf@circ@res@step
3935 \pgf@y=2\pgf@circ@res@step
3936 }
3937 \anchor{text}{
3938 \northeast
3939 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
3940 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
3941 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3942 }
3943 \anchor{top}{\northeast\pgf@x=0pt}
3944 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3945 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3946 \anchor{bottom}{\pgfpointorigin}
3947 \anchor{north}{\northeast\pgf@x=0pt}
3948 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3949 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3950 \anchor{south}{\pgfpointorigin}
3951 \anchor{north east}{\northeast}
3952 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3953 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3954 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3955 \pgf@circ@draw@component{
3956 \pgf@circ@antennabody
3957 }
3958 }
3959 %
3960 \pgfdeclareshape{dinantenna}{
3961 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
3962 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
3963 \anchor{center}{\pgfpointorigin}
3964 \savedanchor{\northeast}{
3965 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
3966 \pgf@circ@res@step=\ctikzvalof{monopoles/dinantenna/width}\pgf@circ@scaled@Rlen
3967 \pgf@circ@res@other=\ctikzvalof{monopoles/dinantenna/height}\pgf@circ@scaled@Rlen
3968 \pgf@x=\pgf@circ@res@step
3969 \pgf@y=\pgf@circ@res@other
3970 }
3971 \anchor{text}{
3972 \northeast
3973 \pgf@y=\dimexpr.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
3974 }
3975 \anchor{top}{\northeast\pgf@x=0pt}
3976 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
3977 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3978 \anchor{bottom}{\pgfpointorigin}
3979 \anchor{north}{\northeast\pgf@x=0pt}
3980 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
3981 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
3982 \anchor{south}{\pgfpointorigin}
3983 \anchor{north east}{\northeast}
3984 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
3985 \anchor{south east}{\northeast\pgf@y=0pt\relax}
3986 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
3987 \pgf@circ@draw@component{
3988 \pgfstartlinewidth=\pgflinewidth
3989 \pgf@circ@scaled@Rlen=\scaledRlen
3990 \pgf@circ@setcolor
3991 \pgf@circ@res@right=\ctikzvalof{monopoles/dinantenna/width}\pgf@circ@scaled@Rlen
3992 \pgf@circ@res@up=\ctikzvalof{monopoles/dinantenna/height}\pgf@circ@scaled@Rlen
3993 \pgfscope
3994 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
3995 \pgfpathmoveto{\pgfpointorigin}
3996 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
3997 \pgfpathmoveto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
3998 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}}
3999 \pgfpathmoveto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
4000 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4001 \pgfpathmoveto{\pgfpoint{0pt}{0.5\pgf@circ@res@up}}
4002 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4003 \pgfusepath{draw}
4004 \endpgfscope
4005 }
4006 }
4007
4008 \pgfdeclareshape{bareTXantenna}{
4009 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4010 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4011 \anchor{center}{\pgfpointorigin}
4012 \savedanchor{\northeast}{
4013 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4014 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4015 \pgf@x=\pgf@circ@res@step
4016 \pgf@y=2\pgf@circ@res@step
4017 }
4018 \savedanchor{\savedwaves}{
4019 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4020 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4021 \pgf@x=4.2\pgf@circ@res@step
4022 \pgf@y=\pgf@circ@res@step
4023 }
4024 \anchor{text}{
4025 \northeast
4026 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
4027 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
4028 \pgf@x=\dimexpr-\pgf@x-\wd\pgfnodeparttextbox\relax
4029 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4030 }
4031 \anchor{waves}{\savedwaves}
4032 \anchor{top}{\northeast\pgf@x=0pt}
4033 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
4034 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4035 \anchor{bottom}{\pgfpointorigin}
4036 \anchor{north}{\northeast\pgf@x=0pt}
4037 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
4038 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4039 \anchor{south}{\pgfpointorigin}
4040 \anchor{north east}{\northeast}
4041 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
4042 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4043 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
4044 \pgf@circ@draw@component{
4045 \pgf@circ@antennabody
4046 \pgf@circ@antennawaves
4047 }
4048 }
4049
4050 \pgfdeclareshape{bareRXantenna}{
4051 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4052 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4053 \anchor{center}{\pgfpointorigin}
4054 \savedanchor{\northeast}{
4055 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4056 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4057 \pgf@x=\pgf@circ@res@step
4058 \pgf@y=2\pgf@circ@res@step
4059 }
4060 \savedanchor{\savedwaves}{
4061 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4062 \pgf@circ@res@step=\ctikzvalof{monopoles/bareantenna/width}\pgf@circ@scaled@Rlen
4063 \pgf@x=-4.2\pgf@circ@res@step
4064 \pgf@y=\pgf@circ@res@step
4065 }
4066 \anchor{text}{
4067 \northeast
4068 \pgf@x=\ctikzvalof{monopoles/bareantenna/label/xanchor}\pgf@x
4069 \pgf@y=\ctikzvalof{monopoles/bareantenna/label/yanchor}\pgf@y
4070 \pgf@y=\dimexpr\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4071 }
4072 \anchor{waves}{\savedwaves}
4073 \anchor{top}{\northeast\pgf@x=0pt}
4074 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
4075 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4076 \anchor{bottom}{\pgfpointorigin}
4077 \anchor{north}{\northeast\pgf@x=0pt}
4078 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
4079 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4080 \anchor{south}{\pgfpointorigin}
4081 \anchor{north east}{\northeast}
4082 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
4083 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4084 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
4085 \pgf@circ@draw@component{
4086 \pgf@circ@antennabody
4087 \pgftransformxshift{-5.2\pgf@circ@res@step}
4088 \pgf@circ@antennawaves
4089 }
4090 }
4091
4092 %%% dynodes (see https://github.com/circuitikz/circuitikz/issues/469)
4093 \ctikzset{monopoles/dynode/width/.initial=0.4}
4094 \ctikzset{monopoles/dynode/height/.initial=0.8}
4095 \ctikzset{monopoles/dynode/arc pos/.initial=0.5}
4096 \ctikzset{monopoles/dynode/arc angle/.initial=30}
4097 \ctikzset{monopoles/dynode/top width/.initial=1.0}
4098
4099 \pgfdeclareshape{dynode}{
4100 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
4101 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4102 \anchor{center}{\pgfpointorigin}
4103 \savedanchor{\northeast}{
4104 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4105 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
4106 \pgf@x=0.5\pgf@x
4107 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
4108 }
4109 \savedanchor{\arcpos}{% bottom part of the arc pos
4110 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4111 \pgf@x=0pt
4112 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
4113 \pgf@y=\ctikzvalof{monopoles/dynode/arc pos}\pgf@y
4114 }
4115 \savedanchor{\topright}{%
4116 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4117 \pgf@x=\ctikzvalof{monopoles/dynode/width}\pgf@circ@scaled@Rlen
4118 \pgf@x=\ctikzvalof{monopoles/dynode/top width}\pgf@x
4119 \pgf@x=0.5\pgf@x
4120 \pgf@y=\ctikzvalof{monopoles/dynode/height}\pgf@circ@scaled@Rlen
4121 }
4122 \anchor{arc}{\arcpos}
4123 \anchor{top right}{\topright}
4124 \anchor{top left}{\topright\pgf@x=-\pgf@x}
4125 \anchor{text}{
4126 \northeast
4127 \advance\pgf@x by 4pt\relax
4128 \pgf@y=\dimexpr0.5\pgf@y+.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4129 }
4130 \anchor{top}{\northeast\pgf@x=0pt}
4131 \anchor{right}{\northeast\pgf@y=0.5\pgf@y}
4132 \anchor{left}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4133 \anchor{bottom}{\pgfpointorigin}
4134 \anchor{north}{\northeast\pgf@x=0pt}
4135 \anchor{east}{\northeast\pgf@y=0.5\pgf@y}
4136 \anchor{west}{\northeast\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
4137 \anchor{south}{\pgfpointorigin}
4138 \anchor{north east}{\northeast}
4139 \anchor{north west}{\northeast\pgf@x=-\pgf@x}
4140 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4141 \anchor{south west}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
4142 \pgf@circ@draw@component{
4143 \pgfstartlinewidth=\pgflinewidth
4144 \pgf@circ@scaled@Rlen=\scaledRlen
4145 \pgf@circ@setcolor
4146 \northeast
4147 \pgf@circ@res@right=\pgf@x
4148 \pgf@circ@res@up=\pgf@y
4149 \arcpos
4150 \pgf@circ@res@step=\pgf@y
4151 % top
4152 \pgfscope
4153 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4154 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
4155 \pgfpathlineto{\pgfpoint{\ctikzvalof{monopoles/dynode/top width}*\pgf@circ@res@right}{\pgf@circ@res@up}}
4156 \pgfusepath{draw}
4157 \endpgfscope
4158 % arc
4159 \edef\@@angle{\ctikzvalof{monopoles/dynode/arc angle}}
4160 \ifnum90=\@@angle\else % avoid divisions by zero
4161 % radius
4162 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right/cos(\@@angle)}
4163 % start angle y position
4164 \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@step+\pgf@circ@res@other*(1-sin(\@@angle))}
4165 \pgfsetlinewidth{\pgfstartlinewidth}
4166 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@step}}
4167 \pgfpatharc{-180+\@@angle}{-\@@angle}{\pgf@circ@res@other}
4168 \fi
4169 % tail
4170 \pgfpathmoveto{\pgfpointorigin}
4171 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4172 \pgfusepath{draw}
4173 }
4174 }
4175 % Microstrip monopoles
4176
4177 \pgfdeclareshape{mslstub}{
4178 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4179 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4180 \savedanchor{\southeast}{
4181 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4182 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
4183 \pgf@x=.5\pgf@x
4184 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4185 \pgf@y=-.5\pgf@y
4186 }
4187 \savedanchor{\northwest}{
4188 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4189 \pgf@x=\ctikzvalof{bipoles/mstline/width}\pgf@circ@scaled@Rlen
4190 \pgf@x=-.5\pgf@x
4191 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4192 \pgf@y=.5\pgf@y
4193 }
4194 \anchor{north}{\northwest\pgf@x=0pt\relax}
4195 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4196 \anchor{east}{\southeast\pgf@y=0pt\relax}
4197 \anchor{south east}{\southeast}
4198 \anchor{south}{\southeast\pgf@x=0pt\relax}
4199 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4200 \anchor{west}{\northwest\pgf@y=0pt\relax}
4201 \anchor{north west}{\northwest}
4202 %
4203 \anchor{center}{\northwest\pgf@y=0pt\relax}
4204 \anchor{left}{\northwest\pgf@y=0pt\relax}
4205 \anchor{right}{\southeast\pgf@y=0pt\relax}
4206 % put the node text above and centered
4207 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4208 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4209 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
4210 }
4211 }
4212 \pgf@circ@draw@component{
4213 \pgfextracty{\pgf@circ@res@up}{\northwest}
4214 \pgfextractx{\pgf@circ@res@right}{\southeast}
4215 \pgfextractx{\pgf@circ@res@left}{\northwest}
4216 \pgfextracty{\pgf@circ@res@down}{\southeast}
4217 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
4218 \pgfstartlinewidth=\pgflinewidth
4219 \pgfscope
4220 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4221 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4222 \pgf@circ@draworfill
4223 \endpgfscope
4224 }
4225 }
4226
4227 \pgfdeclareshape{msrstub}{
4228 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4229 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4230 \savedanchor{\southeast}{
4231 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4232 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
4233 \pgf@x=.5\pgf@x
4234 \pgf@y=0pt\relax
4235 }
4236 \savedanchor{\northwest}{
4237 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4238 \pgf@x=\ctikzvalof{monopoles/msrstub/width}\pgf@circ@scaled@Rlen
4239 \pgf@x=-.5\pgf@x
4240 \pgf@y=\ctikzvalof{monopoles/msrstub/height}\pgf@circ@scaled@Rlen
4241 \pgf@y=.5\pgf@y
4242 }
4243 \anchor{north}{\northwest\pgf@x=0pt\relax}
4244 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4245 \anchor{east}{\southeast\pgf@y=0pt\relax}
4246 \anchor{south east}{\southeast}
4247 \anchor{south}{\southeast\pgf@x=0pt\relax}
4248 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4249 \anchor{west}{\northwest\pgf@y=0pt\relax}
4250 \anchor{north west}{\northwest}
4251 %
4252 \anchor{center}{\pgfpointorigin}
4253 \anchor{left}{\pgfpointorigin}
4254 \anchor{right}{\pgfpointorigin}
4255 % put the node text above and centered
4256 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4257 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4258 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
4259 }
4260 }
4261 \pgf@circ@draw@component{
4262 \pgfextracty{\pgf@circ@res@up}{\northwest}
4263 \pgfextractx{\pgf@circ@res@right}{\southeast}
4264 \pgfextractx{\pgf@circ@res@left}{\northwest}
4265 \pgfextracty{\pgf@circ@res@down}{\southeast}
4266 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
4267 \pgfstartlinewidth=\pgflinewidth
4268 \pgfscope
4269 \pgfpathmoveto{\pgfpointorigin}
4270 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@step}}
4271 \pgfusepath{draw}
4272 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4273 \pgfpathmoveto{\pgfpointpolar{135}{\pgf@circ@res@step}}
4274 \pgfpatharc{135}{45}{\pgf@circ@res@step}
4275 \pgfpathlineto{\pgfpointpolar{45}{\pgf@circ@res@up}}
4276 \pgfpatharc{45}{135}{\pgf@circ@res@up}
4277 \pgfpathclose
4278 \pgf@circ@draworfill
4279 \endpgfscope
4280 }
4281 }
4282
4283 \pgfdeclareshape{msport}{
4284 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4285 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4286 \savedanchor{\southeast}{
4287 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4288 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4289 \pgf@x=.5\pgf@x
4290 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4291 \pgf@y=-.5\pgf@y
4292 }
4293 \savedanchor{\northwest}{
4294 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4295 \pgf@x=\ctikzvalof{monopoles/msport/width}\pgf@circ@scaled@Rlen
4296 \pgf@x=-.5\pgf@x
4297 \pgf@y=\ctikzvalof{bipoles/mstline/height}\pgf@circ@scaled@Rlen
4298 \pgf@y=.5\pgf@y
4299 }
4300 \anchor{north}{\northwest\pgf@x=0pt\relax}
4301 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
4302 \anchor{east}{\southeast\pgf@y=0pt\relax}
4303 \anchor{south east}{\southeast}
4304 \anchor{south}{\southeast\pgf@x=0pt\relax}
4305 \anchor{south west}{\southeast\pgf@x=-\pgf@x}
4306 \anchor{west}{\northwest\pgf@y=0pt\relax}
4307 \anchor{north west}{\northwest}
4308 %
4309 \anchor{center}{\northwest\pgf@y=0pt\relax}
4310 \anchor{left}{\northwest\pgf@y=0pt\relax}
4311 \anchor{right}{\southeast\pgf@y=0pt\relax}
4312 % put the node text above and centered
4313 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northwest}
4314 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
4315 \dimexpr-.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
4316 }
4317 }
4318 \pgf@circ@draw@component{
4319 \pgfextracty{\pgf@circ@res@up}{\northwest}
4320 \pgfextractx{\pgf@circ@res@right}{\southeast}
4321 \pgfextractx{\pgf@circ@res@left}{\northwest}
4322 \pgfextracty{\pgf@circ@res@down}{\southeast}
4323 \pgfmathsetlength{\pgf@circ@res@step}{0.5*\pgf@circ@res@up}
4324 \pgfstartlinewidth=\pgflinewidth
4325 \pgfscope
4326 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4327 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4328 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
4329 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4330 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4331 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@down}}
4332 \pgfpathclose
4333 \pgf@circ@draworfill
4334 \endpgfscope
4335 }
4336 }
4337
4338 % Legacy antennas (with tails)
4339 \def\pgf@circ@shift@antenna@xy#1#2{%
4340 \pgf@y=\dimexpr\pgf@y+#2\pgf@circ@res@step
4341 \pgf@x=\dimexpr\pgf@x+#1\pgf@circ@res@step
4342 \relax}
4343
4344 % Legacy antenna
4345 \pgfdeclareshape{antenna}{
4346 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4347 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4348 \anchor{center}{\pgfpointorigin}
4349 \savedanchor{\northeast}{
4350 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4351 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4352 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4353 \pgf@y=4\pgf@circ@res@step
4354 }
4355 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{2}}
4356 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{0}{3}\relax}
4357 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{0}{4}\relax}
4358 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{3}}
4359 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4360 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{0}{2}}
4361 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{0}{4}}
4362 \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}}
4363 \anchor{text}{
4364 \northeast
4365 \pgf@x=\ctikzvalof{monopoles/antenna/label/xanchor}\pgf@x
4366 \pgf@y=\ctikzvalof{monopoles/antenna/label/yanchor}\pgf@y
4367 }
4368 \pgf@circ@draw@component{
4369 \pgfstartlinewidth=\pgflinewidth
4370 \pgf@circ@scaled@Rlen=\scaledRlen
4371 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4372
4373 \pgftransformxshift{ -4\pgf@circ@res@step }
4374
4375 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4376 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4377
4378 \pgfusepath{draw}
4379
4380 \pgfscope
4381 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4382 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4383 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4384 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4385 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4386 \pgf@circ@setcolor
4387 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4388 \pgfusepath{draw}
4389 \endpgfscope
4390 \pgfsetlinewidth{\pgfstartlinewidth}
4391
4392 }
4393 }
4394
4395 % Legacy TX antenna
4396 \pgfdeclareshape{txantenna}{
4397 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4398 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4399 \anchor{center}{\pgfpointorigin}
4400 \savedanchor{\northeast}{
4401 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4402 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4403 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4404 \pgf@y=4\pgf@circ@res@step
4405 }
4406 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4407 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4408 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4409 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4410 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4411 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4412 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4413 \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}}
4414 \anchor{text}{
4415 \northeast
4416 \pgf@x=\ctikzvalof{monopoles/txantenna/label/xanchor}\pgf@x
4417 \pgf@y=\ctikzvalof{monopoles/txantenna/label/yanchor}\pgf@y
4418 }
4419 \pgf@circ@draw@component{
4420 \pgfstartlinewidth=\pgflinewidth
4421 \pgf@circ@scaled@Rlen=\scaledRlen
4422 \pgf@circ@res@step=\ctikzvalof{monopoles/txantenna/width}\pgf@circ@scaled@Rlen
4423
4424 \pgfpathmoveto{\pgfpointorigin}
4425 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4426 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4427 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4428
4429 \pgfusepath{draw}
4430
4431 \pgfscope
4432 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4433 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4434 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4435 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4436 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4437 \pgf@circ@setcolor
4438 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4439 \pgfusepath{draw}
4440 \endpgfscope
4441 \pgfpathmoveto{\pgfpoint{5.5\pgf@circ@res@step}{6\pgf@circ@res@step}}
4442 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4443 \pgfpatharc{30}{-30}{2\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4444 \pgfpatharc{30}{-30}{2.5\pgf@circ@res@step}
4445 \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4446 \pgfpatharc{30}{-30}{3\pgf@circ@res@step}
4447 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4448 \pgfpatharc{30}{-30}{3.5\pgf@circ@res@step}
4449 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{7\pgf@circ@res@step}}
4450 \pgfpatharc{30}{-30}{4\pgf@circ@res@step}
4451 \pgfusepath{draw}
4452 \pgfsetlinewidth{\pgfstartlinewidth}
4453
4454 }
4455 }
4456
4457 % Legacy RX antenna
4458 \pgfdeclareshape{rxantenna}{
4459 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4460 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4461 \anchor{center}{\pgfpointorigin}
4462 \savedanchor{\northeast}{
4463 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4464 \pgf@circ@res@step=\ctikzvalof{monopoles/antenna/width}\pgf@circ@scaled@Rlen
4465 \pgf@x=\pgf@circ@res@step%-0.5\pgflinewidth
4466 \pgf@y=4\pgf@circ@res@step
4467 }
4468 \anchor{north}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{2}}
4469 \anchor{east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@circ@shift@antenna@xy{4}{3}\relax}
4470 \anchor{south}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y \pgf@x=0cm\pgf@circ@shift@antenna@xy{2}{4}\relax}
4471 \anchor{west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=0cm\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{3}}
4472 \anchor{north east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@circ@shift@antenna@xy{4}{2}}
4473 \anchor{north west}{\northeast\pgf@circ@res@step=\pgf@x\pgf@x=-\pgf@x\pgf@circ@shift@antenna@xy{1}{2}}
4474 \anchor{south east}{\northeast\pgf@circ@res@step=\pgf@x\pgf@y=-\pgf@y\pgf@circ@shift@antenna@xy{4}{4}}
4475 \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}}
4476 \anchor{text}{
4477 \northeast
4478 \pgf@x=\ctikzvalof{monopoles/rxantenna/label/xanchor}\pgf@x
4479 \pgf@y=\ctikzvalof{monopoles/rxantenna/label/yanchor}\pgf@y
4480 }
4481 \pgf@circ@draw@component{
4482 \pgfstartlinewidth=\pgflinewidth
4483 \pgf@circ@scaled@Rlen=\scaledRlen
4484 \pgf@circ@res@step=\ctikzvalof{monopoles/rxantenna/width}\pgf@circ@scaled@Rlen
4485
4486 \pgfpathmoveto{\pgfpointorigin}
4487 \pgfpathlineto{\pgfpoint{4\pgf@circ@res@step}{0pt}}
4488 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{0pt}}
4489 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4490
4491 \pgfusepath{draw}
4492
4493 \pgfscope
4494 \pgfpathmoveto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4495 \pgfpathlineto{\pgfpoint{5\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4496 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{4\pgf@circ@res@step}}
4497 \pgfpathlineto{\pgfpoint{3\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4498 \pgfpathlineto{\pgfpoint{4\pgf@circ@[email protected]\pgflinewidth}{6\pgf@circ@res@step}}
4499 \pgf@circ@setcolor
4500 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4501 \pgfusepath{draw}
4502 \endpgfscope
4503
4504 \pgfpathmoveto{\pgfpoint{6\pgf@circ@res@step}{7\pgf@circ@res@step}}
4505 % \pgfpatharc{60}{-60}{\pgf@circ@res@step and \pgf@circ@res@step}
4506 \pgfpatharc{150}{210}{4\pgf@circ@res@step} \pgfpathmoveto{\pgfpoint{6.5\pgf@circ@res@step}{6.75\pgf@circ@res@step}}
4507 \pgfpatharc{150}{210}{3.5\pgf@circ@res@step}
4508 \pgfpathmoveto{\pgfpoint{7\pgf@circ@res@step}{6.5\pgf@circ@res@step}}
4509 \pgfpatharc{150}{210}{3\pgf@circ@res@step}
4510 \pgfpathmoveto{\pgfpoint{7.5\pgf@circ@res@step}{6.25\pgf@circ@res@step}}
4511 \pgfpatharc{150}{210}{2.5\pgf@circ@res@step}
4512 \pgfpathmoveto{\pgfpoint{8\pgf@circ@res@step}{6\pgf@circ@res@step}}
4513 \pgfpatharc{150}{210}{2\pgf@circ@res@step}
4514 \pgfusepath{draw}
4515 \pgfsetlinewidth{\pgfstartlinewidth}
4516 }
4517 }
4518
4519 % Legacy match
4520 \pgfdeclareshape{match}{
4521 \savedmacro{\ctikzclass}{\edef\ctikzclass{RF}}
4522 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
4523 \savedanchor{\northeast}{%
4524 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4525 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4526 \pgf@x=2\pgf@circ@res@step
4527 \pgf@circ@res@step = \ctikzvalof{monopoles/match/width} \pgf@circ@scaled@Rlen
4528 \pgf@y=.5\pgf@circ@res@step%
4529 }
4530 % the center is on the left side of the shape for facility of usage
4531 \anchor{north}{\northeast\pgf@x=0.5\pgf@x\relax}
4532 \anchor{east}{\northeast\pgf@y=0cm\relax}
4533 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x\relax}
4534 \anchor{west}{\pgfpointorigin}
4535 \anchor{north east}{\northeast}
4536 \anchor{north west}{\northeast\pgf@x=0cm\relax}
4537 \anchor{south east}{\northeast\pgf@y=0pt\relax}
4538 \anchor{south west}{\pgfpointorigin}
4539 \anchor{center}{\pgfpointorigin}
4540 \anchor{text}{
4541 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
4542 \pgf@x=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4543 \pgf@x=1.5\pgf@x
4544 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
4545 \pgf@y=-1.5\ht\pgfnodeparttextbox
4546 }
4547 \pgf@circ@draw@component{
4548 \pgf@circ@scaled@Rlen=\scaledRlen
4549 \pgf@circ@res@step=\ctikzvalof{monopoles/match/width}\pgf@circ@scaled@Rlen
4550
4551 \pgfscope
4552 \pgfpathmoveto{\pgfpointorigin}
4553 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0pt}}
4554 \pgfusepath{draw}
4555
4556 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
4557 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
4558 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@step}{0}}
4559 \pgf@circ@fill@strokecolor
4560 \pgfusepath{fill}
4561
4562 \pgfsetlinewidth{\pgfstartlinewidth}
4563 \endpgfscope
4564 }
4565 }
4566 % %>>>
4567
4568 % vim: set fdm=marker fmr=%<<<,%>>>:
4569 %%%---------- close: tex/pgfcircmonopoles
4570 %%%%%%%%%%% Springe nach tex/pgfcircbipoles
4571 %%%---------- open: tex/pgfcircbipoles.tex
4572 % Copyright 2018-2026 by Romano Giannetti
4573 % Copyright 2015-2026 by Stefan Lindner
4574 % Copyright 2013-2026 by Stefan Erhardt
4575 % Copyright 2007-2026 by Massimo Redaelli
4576 %
4577 % This file may be distributed and/or modified
4578 %
4579 % 1. under the LaTeX Project Public License and/or
4580 % 2. under the GNU Public License.
4581 %
4582 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
4583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4584 %% Standard bipole shapes declarations
4585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4586
4587 %% Generic macro and flags for bipoles %<<<
4588 % Fixing tunable directions
4589 \newif\ifpgf@circ@fixtunable@dir
4590 \ctikzset{bipoles/fix tunable direction/.is if=pgf@circ@fixtunable@dir}
4591 \ctikzset{bipoles/fix tunable direction=true}
4592 % choosing several arrows
4593 \pgf@circ@declare@family@arrows{tunable}
4594 \pgf@circ@declare@family@arrows{wiper}
4595 \pgf@circ@declare@family@arrows{switch}
4596 \pgf@circ@declare@family@arrows{gto gate}
4597 \pgf@circ@declare@family@arrows{opto}
4598
4599 %>>>
4600
4601
4602 %%%%%%%%%%%%%%%%%%%%%%%%
4603 % Resistive components: generics, resistors, wires
4604 %%%%%%%%%%%%%%%%%%%%%%%%
4605
4606 %% Definitions for resistive components %<<<
4607
4608 % Zig Zag resistors
4609 \ctikzset{resistors/zigs/.initial=3}
4610 \ctikzset{resistors/width/.code={%
4611 \ctikzset{bipoles/resistor/width=#1}%
4612 \ctikzset{bipoles/vresistor/width=#1}%
4613 \ctikzset{bipoles/potentiometer/width=#1}%
4614 \ctikzset{bipoles/resistivesens/width=#1}%
4615 \ctikzset{bipoles/photoresistor/width=#1}%
4616 \ctikzset{bipoles/thermistor/width=#1}%
4617 \ctikzset{bipoles/thermistorntc/width=#1}%
4618 \ctikzset{bipoles/thermistorptc/width=#1}%
4619 \ctikzset{bipoles/varistor/width=#1}%
4620 \ctikzset{bipoles/generic/width=#1}%
4621 \ctikzset{bipoles/generic potentiometer/width=#1}%
4622 \ctikzset{bipoles/ageneric/width=#1}%
4623 \ctikzset{bipoles/tgeneric/width=#1}%
4624 \ctikzset{bipoles/ldresistor/width=#1}%
4625 \ctikzset{bipoles/ldgeneric/width=#1}%
4626 }}
4627 \ctikzset{wiper pos/.code={%
4628 \ctikzset{bipoles/potentiometer/wiper pos=#1}%
4629 \ctikzset{bipoles/generic potentiometer/wiper pos=#1}%
4630 }}
4631 % zigzag resistor
4632 \ctikzset{bipoles/resistor/height/.initial=.3}
4633 \ctikzset{bipoles/resistor/width/.initial=.8}
4634 \ctikzset{bipoles/potentiometer/height/.initial=.8}
4635 \ctikzset{bipoles/potentiometer/height 2/.initial=.3}
4636 \ctikzset{bipoles/potentiometer/width/.initial=.8}
4637 \ctikzset{bipoles/potentiometer/wiper pos/.initial=.5}
4638 \ctikzset{bipoles/vresistor/height/.initial=.6}
4639 \ctikzset{bipoles/vresistor/width/.initial=.8}
4640 \ctikzset{bipoles/resistivesens/height/.initial=.6}
4641 \ctikzset{bipoles/resistivesens/width/.initial=.8}
4642 \ctikzset{bipoles/ldresistor/height/.initial=.8}
4643 \ctikzset{bipoles/ldresistor/width/.initial=.8}
4644 \ctikzset{bipoles/ldresistor/internal scale/.initial=.8}
4645 % square resistors
4646 \ctikzset{bipoles/photoresistor/height/.initial=.6}
4647 \ctikzset{bipoles/photoresistor/height 2/.initial=.3}
4648 \ctikzset{bipoles/photoresistor/width/.initial=.8}
4649 \ctikzset{bipoles/thermistor/main/.initial=.7}
4650 \ctikzset{bipoles/thermistor/height/.initial=.428}%.3/.7
4651 \ctikzset{bipoles/thermistorntc/width/.initial=.8}
4652 \ctikzset{bipoles/thermistorntc/main/.initial=.7}
4653 \ctikzset{bipoles/thermistorntc/height/.initial=.428}%.3/.7
4654 \ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.3/.7
4655 \ctikzset{bipoles/thermistorptc/width/.initial=.8}
4656 \ctikzset{bipoles/thermistorptc/main/.initial=.7}
4657 \ctikzset{bipoles/thermistorptc/height/.initial=.428}%.3/.7
4658 \ctikzset{bipoles/thermistorptc/height 2/.initial=.75}%.3/.7
4659 \ctikzset{bipoles/thermistor/width/.initial=.8}
4660 \ctikzset{bipoles/varistor/main/.initial=.7}
4661 \ctikzset{bipoles/varistor/height/.initial=.428}%.3/.7
4662 \ctikzset{bipoles/varistor/width/.initial=.8}
4663 \ctikzset{bipoles/generic/height/.initial=.30}
4664 \ctikzset{bipoles/generic/width/.initial=.80}
4665 \ctikzset{bipoles/generic potentiometer/height/.initial=.80}
4666 \ctikzset{bipoles/generic potentiometer/height 2/.initial=.30}
4667 \ctikzset{bipoles/generic potentiometer/width/.initial=.80}
4668 \ctikzset{bipoles/generic potentiometer/wiper pos/.initial=.5}
4669 \ctikzset{bipoles/ageneric/height/.initial=.30}
4670 \ctikzset{bipoles/tgeneric/height/.initial=.70}
4671 \ctikzset{bipoles/tgeneric/width/.initial=.80}
4672 \ctikzset{bipoles/ageneric/width/.initial=.80}
4673 \ctikzset{bipoles/memristor/height/.initial=.30}
4674 \ctikzset{bipoles/memristor/wave height/.initial=.5}
4675 \ctikzset{bipoles/memristor/width/.initial=.80}
4676 \ctikzset{bipoles/ldgeneric/height/.initial=.8}
4677 \ctikzset{bipoles/ldgeneric/width/.initial=.8}
4678 \ctikzset{bipoles/ldgeneric/internal scale/.initial=.8}
4679
4680 \newif\ifpgf@circuit@europeanresistor
4681 \ctikzset{resistor/.is choice}
4682 \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
4683 \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
4684 \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
4685 \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}%
4686
4687 % wires (open, shorts, ...)
4688
4689 \ctikzset{bipoles/open/height/.initial=.3} %necessary for curly voltages
4690 \ctikzset{bipoles/open/width/.initial=.3} %necessary for curly voltages
4691 \ctikzset{bipoles/open/voltage/straight label distance/.initial=0}
4692 \ctikzset{bipoles/open/voltage/distance from node/.initial=.2}
4693 \ctikzset{bipoles/short/height/.initial=.1} %dummy height for voltage positioning
4694 \ctikzset{bipoles/short/width/.initial=.1} %dummy width for voltage positioning
4695 % multiwire
4696 \ctikzset{bipoles/multiwire/height/.initial=0.4}
4697 \ctikzset{bipoles/multiwire/width/.initial=0.2}
4698 \ctikzset{bipoles/multiwire/spacing/.initial=0.05}
4699 % crossing wires
4700 \ctikzset{bipoles/crossing/size/.initial=.2}
4701
4702 %%>>>
4703
4704 %% Shapes for generic, resistives and wires components %<<<
4705 %% Short circuit
4706
4707 %%% NOTICE that the short is really NOT drawn; we trust the fact that its
4708 %%% natural length is zero.
4709 \pgfcircdeclarebipole
4710 {% fix the anchor border to add a bit of space for voltage and labels
4711 % it uses the dummy width and height
4712 \anchorborder{%
4713 \ifpgf@circuit@bipole@inverted
4714 \pgf@circ@res@left=-\pgf@x
4715 \pgf@circ@res@up=-\pgf@y
4716 \else
4717 \pgf@circ@res@left=\pgf@x
4718 \pgf@circ@res@up=\pgf@y
4719 \fi
4720 \ifdim\pgf@circ@res@up>0cm
4721 \pgf@x=\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4722 \pgf@y=\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4723 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4724 {\pgfpoint{\pgf@x}{\pgf@y}}
4725 \else
4726 \pgf@x=-\ctikzvalof{bipoles/short/width}\pgf@circ@Rlen
4727 \pgf@y=-\ctikzvalof{bipoles/short/height}\pgf@circ@Rlen
4728 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4729 {\pgfpoint{-\pgf@x}{-\pgf@y}}
4730 \fi
4731 }
4732 }
4733 {0}
4734 {short}
4735 {0}
4736 {0}
4737 {}
4738
4739 %% Open circuit
4740 \pgfcircdeclarebipole
4741 {}
4742 {\ctikzvalof{bipoles/open/height}}
4743 {open}
4744 {\ctikzvalof{bipoles/open/height}}
4745 {\ctikzvalof{bipoles/open/width}}
4746 {}
4747
4748 % multiwire(s)
4749 \pgfcircdeclarebipole
4750 {}
4751 {\ctikzvalof{bipoles/multiwire/height}}
4752 {multiwire}
4753 {\ctikzvalof{bipoles/multiwire/height}}
4754 {\ctikzvalof{bipoles/multiwire/width}}
4755 {
4756 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4757 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4758 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4759 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4760 \pgfusepath{draw}
4761 }
4762
4763 \pgfcircdeclarebipole
4764 {}
4765 {\ctikzvalof{bipoles/multiwire/height}}
4766 {bmultiwire}
4767 {\ctikzvalof{bipoles/multiwire/height}}
4768 {\ctikzvalof{bipoles/multiwire/width}}
4769 {
4770 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4771 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4772 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4773 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4774 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4775 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4776 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4777 \pgfusepath{draw}
4778 }
4779
4780 \pgfcircdeclarebipole
4781 {}
4782 {\ctikzvalof{bipoles/multiwire/height}}
4783 {tmultiwire}
4784 {\ctikzvalof{bipoles/multiwire/height}}
4785 {\ctikzvalof{bipoles/multiwire/width}}
4786 {
4787 \pgf@circ@res@other=\ctikzvalof{bipoles/multiwire/spacing}\pgf@circ@Rlen
4788 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4789 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
4790 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@other}{\pgf@circ@res@down}}
4791 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
4792 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+2\pgf@circ@res@other}{\pgf@circ@res@down}}
4793 \pgfpathlineto{\pgfpoint{2\pgf@circ@res@other}{\pgf@circ@res@up}}
4794 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4795 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
4796 \pgfusepath{draw}
4797 }
4798
4799 %%%%%%%%%%%%%%%%
4800 %% Crossing
4801 %%%%%%%%%%%%%%%%
4802
4803 %% crossing bipole (but see also nodes)
4804 \pgfcircdeclarebipole
4805 {}
4806 {\ctikzvalof{bipoles/crossing/size}}
4807 {crossing}
4808 {\ctikzvalof{bipoles/crossing/size}}
4809 {\ctikzvalof{bipoles/crossing/size}}{
4810 \pgfscope
4811 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
4812 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
4813 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
4814 \pgfsetbeveljoin
4815 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
4816 \pgfusepath{draw}
4817 \endpgfscope
4818 }
4819 %
4820 %
4821 %% Generic bipole - used as resistor by some
4822 \pgfcircdeclarebipolescaled{resistors}
4823 {}
4824 {\ctikzvalof{bipoles/generic/height}}
4825 {generic}
4826 {\ctikzvalof{bipoles/generic/height}}
4827 {\ctikzvalof{bipoles/generic/width}}
4828 {
4829 % \pgf@circ@debug@colors
4830 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4831 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4832 \pgf@circ@draworfill
4833 }
4834
4835 %
4836 % generic crossed, suggested by Radványi Patrik Tamás <[email protected]>
4837 % inherit "generic" properties
4838 %
4839 \pgfcircdeclarebipolescaled{resistors}
4840 {}
4841 {\ctikzvalof{bipoles/generic/height}}
4842 {xgeneric}
4843 {\ctikzvalof{bipoles/generic/height}}
4844 {\ctikzvalof{bipoles/generic/width}}
4845 {
4846 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4847 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4848 \pgf@circ@draworfill
4849 % cross it
4850 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
4851 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4852 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4853 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4854 \pgfusepath{draw}
4855 }
4856 %
4857 % generic slashed, suggested by Jana on TeX.stackexchange.com
4858 % https://tex.stackexchange.com/questions/711702/european-relay-with-circuitikz
4859 % inherit "generic" properties
4860 %
4861 \pgfcircdeclarebipolescaled{resistors}
4862 {}
4863 {\ctikzvalof{bipoles/generic/height}}
4864 {sgeneric}
4865 {\ctikzvalof{bipoles/generic/height}}
4866 {\ctikzvalof{bipoles/generic/width}}
4867 {
4868 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4869 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4870 \pgf@circ@draworfill
4871 % slash it
4872 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
4873 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
4874 \pgfusepath{draw}
4875 }
4876 %% Generic empty tunable
4877 \pgfcircdeclarebipolescaled{resistors}
4878 {
4879 \anchor{wiper}{\northeast\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
4880 \anchor{W}{\northeast\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
4881 \anchor{tip}{\northeast\pgf@x=0.5\pgf@x}
4882 }
4883 {\ctikzvalof{bipoles/tgeneric/height}}
4884 {tgeneric}
4885 {\ctikzvalof{bipoles/tgeneric/height}}
4886 {\ctikzvalof{bipoles/tgeneric/width}}
4887 {
4888 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
4889 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4890 \pgf@circ@draworfill
4891 \pgfscope
4892 \pgf@circ@set@relative@thickness{modifier thickness}
4893 \pgfcirc@set@arrows{tunable}{}{latexslim}
4894 \ifpgf@circ@fixtunable@dir
4895 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4896 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4897 \else
4898 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
4899 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
4900 \fi
4901 \pgfusepath{draw}
4902 \endpgfscope
4903 }
4904
4905 %% Generic asymmetric bipole
4906 \pgfcircdeclarebipolescaled{resistors}
4907 {}
4908 {\ctikzvalof{bipoles/ageneric/height}}
4909 {ageneric}
4910 {\ctikzvalof{bipoles/ageneric/height}}
4911 {\ctikzvalof{bipoles/ageneric/width}}
4912 {
4913 \pgfscope
4914 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4915 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4916 \pgf@circ@draworfill
4917 \endpgfscope
4918
4919 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4920 \pgfusepath{stroke,fill}
4921 }
4922
4923 %% Memristor
4924 \pgfcircdeclarebipolescaled{resistors}
4925 {}
4926 {\ctikzvalof{bipoles/memristor/height}}
4927 {memristor}
4928 {\ctikzvalof{bipoles/memristor/height}}
4929 {\ctikzvalof{bipoles/memristor/width}}
4930 {
4931 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
4932 \divide \pgf@circ@res@step by 14
4933
4934 \pgfscope
4935 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4936 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4937 \pgf@circ@draworfill
4938 \endpgfscope
4939 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
4940 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{0pt}}
4941 \pgfpathlineto{\pgfpoint{.72*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4942 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4943 \pgfpathlineto{\pgfpoint{.35*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4944 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{-\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4945 \pgfpathlineto{\pgfpoint{-.05*\pgf@circ@res@left}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4946 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{\ctikzvalof{bipoles/memristor/wave height}\pgf@circ@res@up}}
4947 \pgfpathlineto{\pgfpoint{.42*\pgf@circ@res@right}{0pt}}
4948 \pgfpathlineto{\pgfpoint{.8*\pgf@circ@res@right}{0pt}}
4949
4950 \pgfusepath{draw}
4951
4952 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
4953 \pgfusepath{stroke,fill}
4954 }
4955
4956 %% Photoresistor
4957 \pgfcircdeclarebipolescaled{resistors}
4958 {% anchor for light arrows
4959 \anchor{arrows}{\northeast\pgf@x=0.575\pgf@x\pgf@y=1.1\pgf@y}%
4960 }
4961 {\ctikzvalof{bipoles/photoresistor/height 2}}
4962 {photoresistor}
4963 {\ctikzvalof{bipoles/photoresistor/height}}
4964 {\ctikzvalof{bipoles/photoresistor/width}}
4965 {
4966 \pgfscope
4967 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@down}}
4968 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
4969 \pgf@circ@draworfill
4970 \endpgfscope
4971
4972 \pgfscope
4973 \pgf@circ@set@optoarrow@style
4974 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}
4975 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4976 \pgfusepath{draw}
4977 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@right}{\pgf@circ@res@up}}
4978 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@right}{-1.2\pgf@circ@res@down}}
4979 \pgfusepath{draw}
4980 \endpgfscope
4981 }
4982
4983
4984
4985 %% Thermistor
4986 \pgfcircdeclarebipolescaled{resistors}
4987 {% anchor for labelling the type of dependency
4988 \anchor{label}{%
4989 \southwest
4990 \pgf@x=0.4\pgf@x
4991 \pgf@y=1.2\pgf@y
4992 }%
4993 \pgfcirc@border@extend@updown{1}{1.2}
4994 \anchor{wiper}{\northeast\pgf@x=-\pgf@x\pgf@y=-1.2\pgf@y}
4995 \anchor{W}{\northeast\pgf@x=-\pgf@x\pgf@y=-1.2\pgf@y}
4996 \anchor{tip}{\northeast}
4997 }
4998 {\ctikzvalof{bipoles/thermistor/height}}
4999 {thermistor}
5000 {\ctikzvalof{bipoles/thermistor/height}}
5001 {\ctikzvalof{bipoles/thermistor/width}}
5002 {
5003 \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}}
5004 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5005 \pgf@circ@draworfill
5006 \pgf@circ@set@relative@thickness{modifier thickness}
5007 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
5008 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
5009 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
5010 \pgfusepath{draw}
5011 }
5012
5013 %% Thermistor PTC
5014 \pgfcircdeclarebipolescaled{resistors}
5015 {}
5016 {\ctikzvalof{bipoles/thermistorptc/height 2}}
5017 {thermistorptc}
5018 {\ctikzvalof{bipoles/thermistorptc/height}}
5019 {\ctikzvalof{bipoles/thermistorptc/width}}
5020 {
5021 \pgfscope
5022 \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}}
5023 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5024 \pgf@circ@draworfill
5025 \pgf@circ@set@relative@thickness{modifier thickness}
5026 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
5027 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
5028 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
5029 \pgfusepath{draw}
5030 \endpgfscope
5031
5032 \pgfsetlinewidth{\pgfstartlinewidth}
5033 \pgfsetarrowsend{latexslim}
5034 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
5035 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
5036 \pgfusepath{draw}
5037 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
5038 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
5039 \pgfusepath{draw}
5040 \pgf@circ@text@strokecolor
5041 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
5042 }
5043
5044 %% Thermistor NTC
5045 \pgfcircdeclarebipolescaled{resistors}
5046 {}
5047 {\ctikzvalof{bipoles/thermistorntc/height 2}}
5048 {thermistorntc}
5049 {\ctikzvalof{bipoles/thermistorntc/height}}
5050 {\ctikzvalof{bipoles/thermistorntc/width}}
5051 {
5052 \pgfscope
5053 \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}}
5054 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5055 \pgf@circ@draworfill
5056 \pgf@circ@set@relative@thickness{modifier thickness}
5057 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
5058 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{-\pgf@circ@res@up}}
5059 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
5060 \pgfusepath{draw}
5061 \endpgfscope
5062
5063 \pgfsetlinewidth{\pgfstartlinewidth}
5064 \pgfsetarrowsend{latexslim}
5065 \pgfpathmoveto{\pgfpoint{.62\pgf@circ@res@left}{\pgf@circ@res@down}}
5066 \pgfpathlineto{\pgfpoint{.62\pgf@circ@res@left}{.7\pgf@circ@res@down}}
5067 \pgfusepath{draw}
5068 \pgfpathmoveto{\pgfpoint{.45\pgf@circ@res@left}{.7\pgf@circ@res@down}}
5069 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@left}{\pgf@circ@res@down}}
5070 \pgfusepath{draw}
5071 \pgf@circ@text@strokecolor
5072 \pgftext[top,x=.85\pgf@circ@res@left,y=.75\pgf@circ@res@down]{\pgf@circ@font@tiny$\vartheta$}
5073 }
5074
5075 %% Varistor
5076 \pgfcircdeclarebipolescaled{resistors}
5077 {
5078 \pgfcirc@border@extend@updown{1}{1.4}
5079 }
5080 {\ctikzvalof{bipoles/varistor/height}}
5081 {varistor}
5082 {\ctikzvalof{bipoles/varistor/height}}
5083 {\ctikzvalof{bipoles/varistor/width}}
5084 {
5085 \pgfscope
5086 \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}}
5087 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5088 \pgf@circ@draworfill
5089 \pgf@circ@set@relative@thickness{modifier thickness}
5090 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-\pgf@circ@res@down}}
5091 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5092 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5093 \pgfusepath{draw}
5094 \endpgfscope
5095 \pgf@circ@text@strokecolor
5096 \pgftext[top,x=.65\pgf@circ@res@left,y=1.2\pgf@circ@res@down]{{\pgf@circ@font@tiny\textsf{U}}}
5097 }
5098 %% MOV
5099 \pgfcircdeclarebipolescaled{resistors}
5100 {
5101 \pgfcirc@border@extend@updown{1.2}{1.2}
5102 }
5103 {\ctikzvalof{bipoles/varistor/height}}
5104 {mov}
5105 {\ctikzvalof{bipoles/varistor/height}}
5106 {\ctikzvalof{bipoles/varistor/width}}
5107 {
5108 \pgfscope
5109 \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}}
5110 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5111 \pgf@circ@draworfill
5112 \pgf@circ@set@relative@thickness{modifier thickness}
5113 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-1.1\pgf@circ@res@down}}
5114 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@left}{-1.1\pgf@circ@res@down}}
5115 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@left}{1.1\pgf@circ@res@down}}
5116 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{1.1\pgf@circ@res@down}}
5117 \pgfusepath{draw}
5118 \endpgfscope
5119 }
5120 %% Generic tunable
5121 \pgfcircdeclarebipolescaled{resistors}
5122 {
5123 \savedanchor{\wiper}{
5124 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
5125 \pgf@ya=\ctikzvalof{bipoles/generic potentiometer/height}\pgf@circ@scaled@Rlen
5126 \pgf@y=.5\pgf@ya
5127 \pgf@xa=\ctikzvalof{bipoles/generic potentiometer/width}\pgf@circ@scaled@Rlen
5128 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/generic potentiometer/wiper pos}-0.5)*\pgf@xa}
5129 }
5130 \anchor{wiper}{\wiper}
5131 \anchor{W}{\wiper}
5132 \anchor{tip}{\wiper\pgf@xa=\pgf@x\southwest\pgf@x=\pgf@xa\pgf@y=-\pgf@y}
5133 }
5134 {\ctikzvalof{bipoles/generic potentiometer/height 2}}
5135 {genericpotentiometer}
5136 {\ctikzvalof{bipoles/generic potentiometer/height}}
5137 {\ctikzvalof{bipoles/generic potentiometer/width}}
5138 {
5139
5140 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@scaled@Rlen
5141 \divide \pgf@circ@res@step by 14
5142
5143 \pgfscope
5144 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5145 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5146 \pgf@circ@draworfill
5147 \endpgfscope
5148 \pgfscope
5149 %\pgfsetlinewidth{\pgfstartlinewidth}
5150 \pgfcirc@set@arrows{wiper}{}{latexslim}
5151 \pgfextractx{\pgf@circ@res@other}{\wiper}
5152 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
5153 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
5154 \pgfusepath{draw}
5155 \endpgfscope
5156 }
5157
5158 %% european style LDR
5159 \pgfcircdeclarebipolescaled{resistors}
5160 {% anchor for light arrows
5161 \anchor{arrows}{\northeast\pgf@x=1.6\pgf@x\pgf@y=1.4\pgf@y}%
5162 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5163 }
5164 {\ctikzvalof{bipoles/ldgeneric/height}}
5165 {ldgeneric}
5166 {\ctikzvalof{bipoles/ldgeneric/height}}
5167 {\ctikzvalof{bipoles/ldgeneric/width}}
5168 {%
5169 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5170 \pgfscope
5171 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5172 \pgf@circ@draworfill
5173 \endpgfscope
5174 \pgfscope
5175 % arrows
5176 \pgf@circ@set@optoarrow@style
5177 \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{1.4\pgf@circ@res@up}}
5178 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
5179 \pgfusepath{draw}
5180 \pgfpathmoveto{\pgfpoint{1.6\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
5181 \pgfpathlineto{\pgfpoint{1.0\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
5182 \pgfusepath{draw}
5183 \endpgfscope
5184 \edef\@@intscale{\ctikzvalof{bipoles/ldgeneric/internal scale}}%
5185 \pgfmathsetmacro{\@@hscale}{0.5*\@@intscale}%
5186 \pgftransformscale{\@@intscale}% the end of the bipole will deactivate it
5187 % the generic will be reduced by @@intscale; let's undo the scaling to
5188 % connect the leads to the end of the component.
5189 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left/\@@intscale-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5190 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5191 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right/\@@intscale+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5192 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5193 \pgftransformationadjustments
5194 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/ldgeneric/width}*\scaledRlen+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}
5195 \pgfusepath{draw}
5196 \pgfscope
5197 % reset the up at the "generic" thing
5198 \pgf@circ@res@up=\ctikzvalof{bipoles/generic/height}\pgf@circ@scaled@Rlen
5199 \pgf@circ@res@up=0.5\pgf@circ@res@up
5200 \pgf@circ@res@down=-\pgf@circ@res@up
5201 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5202 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5203 \pgfusepath{draw}
5204 \endpgfscope
5205 }%
5206 %% Zig-zag resistors
5207 % see https://github.com/circuitikz/circuitikz/discussions/814
5208 \ctikzset{resistors/zigzag stub/.initial=0}
5209 \ctikzset{resistors/zigzag hook/.code={}}
5210 \def\pgf@circ@zigzag#1{%
5211 \pgf@circ@res@temp=\ctikzvalof{resistors/zigzag stub}\pgf@circ@res@step
5212 \advance \pgf@circ@res@step by -2\pgf@circ@res@temp
5213 \divide \pgf@circ@res@step by \numexpr4*\zigs\relax
5214
5215 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
5216 \ifdim\pgf@circ@res@temp>0pt
5217 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@temp -\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
5218 \fi
5219 \pgf@circ@res@other = \pgf@circ@res@left
5220 \advance\pgf@circ@res@other by \pgf@circ@res@temp
5221 \pgf@circ@count@a=\zigs\relax
5222 % first half zig
5223 \advance\pgf@circ@res@other by \pgf@circ@res@step
5224 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
5225 \pgfmathloop%
5226 \advance\pgf@circ@count@a by -1\relax% Loop zigs -1 times
5227 \ifnum\pgf@circ@count@a>0
5228 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
5229 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
5230 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
5231 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-#1\pgf@circ@res@down}}
5232 \repeatpgfmathloop%
5233 % last zig and a half
5234 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
5235 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{#1\pgf@circ@res@down}}
5236 \advance\pgf@circ@res@other by \pgf@circ@res@step
5237 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
5238 \ifdim\pgf@circ@res@temp>0pt
5239 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgf@circ@res@temp+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
5240 \fi
5241 \pgfsetbeveljoin
5242 \pgfkeys{/tikz/circuitikz/resistors/zigzag hook}
5243 \pgfusepath{draw}
5244 }
5245 %% Resistor
5246 \pgfcircdeclarebipolescaled{resistors}
5247 {
5248 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5249 }
5250 {\ctikzvalof{bipoles/resistor/height}}
5251 {resistor}
5252 {\ctikzvalof{bipoles/resistor/height}}
5253 {\ctikzvalof{bipoles/resistor/width}}
5254 {
5255 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5256 \pgftransformationadjustments
5257 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistor/width}*\scaledRlen}
5258 \pgf@circ@zigzag{1}
5259 }
5260
5261
5262 %% Variable resistor
5263 \pgfcircdeclarebipolescaled{resistors}
5264 {
5265 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5266 \anchor{wiper}{\northeast\pgf@x=-0.4\pgf@x\pgf@y=-\pgf@y}
5267 \anchor{W}{\northeast\pgf@x=-0.4\pgf@x\pgf@y=-\pgf@y}
5268 \anchor{tip}{\northeast\pgf@x=0.4\pgf@x}
5269 }
5270 {\ctikzvalof{bipoles/vresistor/height}}
5271 {vresistor}
5272 {\ctikzvalof{bipoles/vresistor/height}}
5273 {\ctikzvalof{bipoles/vresistor/width}}
5274 {
5275 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5276 \pgftransformationadjustments
5277 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/vresistor/width}*\scaledRlen}
5278 \pgf@circ@zigzag{.5}
5279
5280 \pgfscope
5281 \pgf@circ@set@relative@thickness{modifier thickness}
5282 \pgfcirc@set@arrows{tunable}{}{latexslim}
5283 \ifpgf@circ@fixtunable@dir
5284 \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5285 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5286 \else
5287 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5288 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5289 \fi
5290 \pgfusepath{draw}
5291 \endpgfscope
5292 }
5293
5294 %% Potentiometer
5295 \pgfcircdeclarebipolescaled{resistors}
5296 {
5297 \savedanchor{\wiper}{
5298 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
5299 \pgf@ya=\ctikzvalof{bipoles/potentiometer/height}\pgf@circ@scaled@Rlen
5300 \pgf@y=.5\pgf@ya
5301 \pgf@xa=\ctikzvalof{bipoles/potentiometer/width}\pgf@circ@scaled@Rlen
5302 \pgfmathsetlength{\pgf@x}{(\ctikzvalof{bipoles/potentiometer/wiper pos}-0.5)*\pgf@xa}
5303 }
5304 \anchor{wiper}{\wiper}
5305 \anchor{W}{\wiper}
5306 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5307 \anchor{tip}{\wiper\pgf@xa=\pgf@x\southwest\pgf@x=\pgf@xa\pgf@y=-\pgf@y}
5308 }
5309 {\ctikzvalof{bipoles/potentiometer/height 2}}
5310 {potentiometer}
5311 {\ctikzvalof{bipoles/potentiometer/height}}
5312 {\ctikzvalof{bipoles/potentiometer/width}}
5313 {
5314 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5315 \pgftransformationadjustments
5316 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/potentiometer/width}*\scaledRlen}
5317 \pgf@circ@zigzag{1}
5318
5319 \pgfscope
5320 %\pgfsetlinewidth{\pgfstartlinewidth}
5321 \pgf@circ@set@relative@thickness{modifier thickness}
5322 \pgfcirc@set@arrows{wiper}{}{latexslim}
5323 \pgfextractx{\pgf@circ@res@other}{\wiper}
5324 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
5325 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
5326 \pgfusepath{draw}
5327 \endpgfscope
5328 }
5329
5330 %% Resistive sensor
5331 \pgfcircdeclarebipolescaled{resistors}
5332 {% anchor for labelling the type of dependency
5333 \anchor{label}{\southwest\pgf@x=0.4\pgf@x}%
5334 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5335 \anchor{wiper}{\northeast\pgf@x=-0.9\pgf@x\pgf@y=-\pgf@y}
5336 \anchor{W}{\northeast\pgf@x=-0.9\pgf@x\pgf@y=-\pgf@y}
5337 \anchor{tip}{\northeast\pgf@x=0.4\pgf@x}
5338 }
5339 {\ctikzvalof{bipoles/resistivesens/height}}
5340 {resistivesens}
5341 {\ctikzvalof{bipoles/resistivesens/height}}
5342 {\ctikzvalof{bipoles/resistivesens/width}}
5343 {%
5344 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5345 \pgftransformationadjustments
5346 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/resistivesens/width}*\scaledRlen}
5347 \pgf@circ@zigzag{.5}
5348
5349 \pgfscope
5350 \pgf@circ@set@relative@thickness{modifier thickness}
5351 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5352 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5353 \pgfpathlineto{\pgfpoint{-.9\pgf@circ@res@right}{\pgf@circ@res@down}}
5354 \pgfusepath{draw}
5355 \endpgfscope
5356 }%
5357
5358 %% american style LDR
5359 \pgfcircdeclarebipolescaled{resistors}
5360 {% anchor for light arrows
5361 \anchor{arrows}{\northeast\pgf@x=1.6\pgf@x\pgf@y=1.4\pgf@y}%
5362 \savedmacro{\zigs}{\edef\zigs{\ctikzvalof{resistors/zigs}}}
5363 % \pgfcirc@border@extend@full{1.2}{1.2}{1.2}{1.2}
5364 }
5365 {\ctikzvalof{bipoles/ldresistor/height}}
5366 {ldresistor}
5367 {\ctikzvalof{bipoles/ldresistor/height}}
5368 {\ctikzvalof{bipoles/ldresistor/width}}
5369 {%
5370 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5371 \pgfscope
5372 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
5373 \pgf@circ@draworfill
5374 \endpgfscope
5375 \pgfscope
5376 % arrows
5377 \pgf@circ@set@optoarrow@style
5378 \pgfpathmoveto{\pgfpoint{1.4\pgf@circ@res@right}{1.4\pgf@circ@res@up}}
5379 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
5380 \pgfusepath{draw}
5381 \pgfpathmoveto{\pgfpoint{1.6\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
5382 \pgfpathlineto{\pgfpoint{1.0\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
5383 \pgfusepath{draw}
5384 \endpgfscope
5385 \edef\@@intscale{\ctikzvalof{bipoles/ldresistor/internal scale}}%
5386 \pgfmathsetmacro{\@@hscale}{0.5*\@@intscale}%
5387 \pgftransformscale{\@@intscale}% the end of the bipole will deactivate it
5388 % the zigzag will be reduced by @@intscale; let's undo the scaling to
5389 % connect the leads to the end of the component.
5390 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left/\@@intscale-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5391 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5392 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right/\@@intscale+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5393 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{+0pt}}
5394 \pgftransformationadjustments
5395 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{bipoles/ldresistor/width}*\scaledRlen}
5396 \pgf@circ@zigzag{\@@hscale}
5397 }%
5398
5399
5400 %>>>
5401
5402 %% Paths for resistive components: generic, resistors and wires% %<<<
5403
5404 %% GENERICS
5405 \def\pgf@circ@empty@path#1{}
5406 \pgfcirc@activate@bipole@simple{l}{generic}
5407 \pgfcirc@activate@bipole@simple{l}{ageneric}
5408 \pgfcirc@activate@bipole@simple{l}{tgeneric}
5409 \pgfcirc@activate@bipole@simple{l}{xgeneric}
5410 \pgfcirc@activate@bipole@simple{l}{sgeneric}
5411 \pgfcirc@activate@bipole@simple{l}{fullgeneric}
5412 \pgfcirc@activate@bipole@simple{l}{tfullgeneric}
5413 \pgfcirc@activate@bipole@simple{l}{short}
5414 \pgfcirc@activate@bipole@simple{l}{open}
5415
5416 %% wires and crossings
5417
5418 \pgfcirc@activate@bipole@simple{l}{crossing}
5419 \pgfcirc@style@to@style{crossing}{xing}
5420 \pgfcirc@activate@bipole@simple{l}{multiwire}
5421 \pgfcirc@activate@bipole@simple{l}{bmultiwire}
5422 \pgfcirc@activate@bipole@simple{l}{tmultiwire}
5423
5424 % automatically switching path --- to be defined manually
5425 \def\pgf@circ@resistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}\else\pgf@circ@bipole@path{resistor}{#1}\fi}
5426 \pgfcirc@path@to@style{l}{resistor}{resistor}{}
5427 \pgfcirc@node@to@style{l}{resistor}{american resistor}{}
5428 \pgfcirc@node@to@style{l}{generic}{european resistor}{}
5429 \pgfcirc@style@to@style{resistor}{R}
5430
5431 \def\pgf@circ@vresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{tgeneric}{#1}\else\pgf@circ@bipole@path{vresistor}{#1}\fi}
5432 \pgfcirc@path@to@style{l}{vresistor}{variable resistor}{}
5433 \pgfcirc@node@to@style{l}{vresistor}{variable american resistor}{}
5434 \pgfcirc@node@to@style{l}{tgeneric}{variable european resistor}{}
5435 \pgfcirc@style@to@style{variable resistor}{vR}
5436
5437 \def\pgf@circ@resistivesens@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{thermistor}{#1}\else\pgf@circ@bipole@path{resistivesens}{#1}\fi}
5438 \pgfcirc@path@to@style{l}{resistivesens}{resistive sensor}{}
5439 \pgfcirc@node@to@style{l}{resistivesens}{american resistive sensor}{}
5440 \pgfcirc@node@to@style{l}{thermistor}{european resistive sensor}{}
5441 \pgfcirc@style@to@style{resistive sensor}{sR}
5442
5443 \def\pgf@circ@ldresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{ldgeneric}{#1}\else\pgf@circ@bipole@path{ldresistor}{#1}\fi}
5444 \pgfcirc@path@to@style{l}{ldresistor}{light dependent resistor}{}
5445 \pgfcirc@node@to@style{l}{ldresistor}{american light dependent resistor}{}
5446 \pgfcirc@node@to@style{l}{ldgeneric}{european light dependent resistor}{}
5447 \pgfcirc@style@to@style{light dependent resistor}{ldR}
5448
5449 \def\pgf@circ@potentiometer@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{genericpotentiometer}{#1}\else\pgf@circ@bipole@path{potentiometer}{#1}\fi}
5450 \pgfcirc@path@to@style{l}{potentiometer}{potentiometer}{}
5451 \pgfcirc@node@to@style{l}{potentiometer}{american potentiometer}{}
5452 \pgfcirc@node@to@style{l}{genericpotentiometer}{european potentiometer}{}
5453 \pgfcirc@style@to@style{potentiometer}{pR}
5454
5455 \pgfcirc@activate@bipole@simple{l}{thermistor}
5456 \pgfcirc@style@to@style{thermistor}{thR}
5457 \pgfcirc@activate@bipole{l}{thermistorptc}{thermistorptc}{thermistor ptc}
5458 \pgfcirc@style@to@style{thermistor ptc}{thRp}
5459 \pgfcirc@activate@bipole{l}{thermistorntc}{thermistorntc}{thermistor ntc}
5460 \pgfcirc@style@to@style{thermistor ntc}{thRn}
5461 \pgfcirc@activate@bipole@simple{l}{photoresistor}
5462 \pgfcirc@style@to@style{photoresistor}{phR}
5463 \pgfcirc@activate@bipole@simple{l}{varistor}
5464 \pgfcirc@activate@bipole@simple{l}{mov}
5465 \pgfcirc@activate@bipole@simple{l}{memristor}
5466 \pgfcirc@style@to@style{memristor}{Mr}%
5467 % %>>>
5468
5469 %%%%%%%%%%%%%%
5470 %% Capacitors
5471 %%%%%%%%%%%%%
5472
5473 %% Definitions for Capacitors%<<<1
5474 \ctikzset{bipoles/capacitor/height/.initial=.6}
5475 \ctikzset{bipoles/capacitor/width/.initial=.2}
5476 \ctikzset{bipoles/ecapacitor/height/.initial=.5}
5477 \ctikzset{bipoles/ecapacitor/width/.initial=.2}
5478 \ctikzset{bipoles/ecapacitor/font/.initial=\pgf@circ@font@sixbm}
5479 %%% pcapacitor is deprecated
5480 \ctikzset{bipoles/pcapacitor/height/.initial=.6}
5481 \ctikzset{bipoles/pcapacitor/width/.initial=.2}
5482 \ctikzset{bipoles/pcapacitor/bend width/.initial=1.1}
5483 \ctikzset{bipoles/ccapacitor/height/.initial=.6}
5484 \ctikzset{bipoles/ccapacitor/width/.initial=.2}
5485 \ctikzset{bipoles/ccapacitor/bend width/.initial=1.1}
5486 \ctikzset{bipoles/vcapacitor/height/.initial=.6}
5487 \ctikzset{bipoles/vcapacitor/width/.initial=.2}
5488 \ctikzset{bipoles/vcapacitor/tunable width/.initial=3}
5489 \ctikzset{bipoles/vcapacitor/capacitor width/.code={%
5490 \pgfutil@packagewarning{circuitikz}{vcapacitor/capacitor width deprecated; ignored}%
5491 }}% deprecated
5492 % piezoelectric (double size by default)
5493 \ctikzset{bipoles/piezoelectric/height/.initial=.7}
5494 \ctikzset{bipoles/piezoelectric/width/.initial=.4}%
5495 % constant phase element (double size by default)
5496 \ctikzset{bipoles/cpe/height/.initial=.6}
5497 \ctikzset{bipoles/cpe/width/.initial=.4}
5498 %
5499 % style settings
5500 %
5501 \ctikzset{capacitors/width/.code={%
5502 \pgfmathsetmacro{\pgfcirc@@double}{2*#1}%
5503 \ctikzset{bipoles/.cd,
5504 capacitor/width=#1, ecapacitor/width=#1, ccapacitor/width=#1,
5505 vcapacitor/width=#1,
5506 piezoelectric/width=\pgfcirc@@double,
5507 cpe/width=\pgfcirc@@double,
5508 }}}
5509 \ctikzset{capacitors/height/.code={%
5510 \ctikzset{bipoles/.cd,
5511 capacitor/height=#1, ecapacitor/height=#1, ccapacitor/height=#1,
5512 vcapacitor/height=#1,
5513 piezoelectric/height=#1,
5514 cpe/height=#1,
5515 }}}
5516 \def\pgfcirc@maybe@fill@straight@capacitor{%
5517 \pgfscope
5518 \pgfpathrectanglecorners
5519 {\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5520 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5521 \pgf@circ@maybefill
5522 \endpgfscope
5523 }
5524 %>>>
5525
5526 %% Shapes for capacitors%<<<
5527 %% Plain Capacitor
5528 \pgfcircdeclarebipolescaled{capacitors}
5529 {}
5530 {\ctikzvalof{bipoles/capacitor/height}}
5531 {capacitor}
5532 {\ctikzvalof{bipoles/capacitor/height}}
5533 {\ctikzvalof{bipoles/capacitor/width}}
5534 {
5535 \pgfcirc@maybe@fill@straight@capacitor
5536
5537 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5538 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5539 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5540
5541 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5542 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5543 \pgfusepath{draw}
5544
5545 }
5546
5547 %% Capacitive sensor
5548 \pgfcircdeclarebipolescaled{capacitors}
5549 {
5550 \anchor{label}{\southwest\pgf@x=2.6\pgf@x\pgf@y=1.2\pgf@y}%
5551 \pgfcirc@border@extend@full{2.6}{1}{4.4}{1.2}
5552 \anchor{wiper}{\northeast\pgf@x=-4.4\pgf@x\pgf@y=-1.2\pgf@y}
5553 \anchor{W}{\northeast\pgf@x=-4.4\pgf@x\pgf@y=-1.2\pgf@y}
5554 \anchor{tip}{\northeast\pgf@x=2.6\pgf@x}
5555 }
5556 {\ctikzvalof{bipoles/capacitor/height}}
5557 {capacitivesens}
5558 {\ctikzvalof{bipoles/capacitor/height}}
5559 {\ctikzvalof{bipoles/capacitor/width}}
5560 {
5561 \pgfcirc@maybe@fill@straight@capacitor
5562 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5563 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5564 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5565
5566 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5567 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5568 \pgfusepath{draw}
5569 \pgfscope
5570 \pgf@circ@set@relative@thickness{modifier thickness}
5571 \pgfpathmoveto{\pgfpoint{2.6\pgf@circ@res@right}{\pgf@circ@res@up}}
5572 \pgfpathlineto{\pgfpoint{-2.6\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5573 \pgfpathlineto{\pgfpoint{-4.4\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
5574 \pgfusepath{draw}
5575 \endpgfscope
5576 }
5577
5578 %% Polar Capacitor (DEPRECATED)
5579 \pgfcircdeclarebipolescaled{capacitors}
5580 {}
5581 {\ctikzvalof{bipoles/pcapacitor/height}}
5582 {polarcapacitor}
5583 {\ctikzvalof{bipoles/pcapacitor/height}}
5584 {\ctikzvalof{bipoles/pcapacitor/width}}
5585 {
5586
5587 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5588
5589 \pgfutil@packagewarning{circuitikz}{polar capacitor has been deprecated; change to curved capacitor (see manual)}%
5590
5591 \pgfscope
5592 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+ \ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}{\pgf@circ@res@up}}
5593 \pgftransformrotate{-90}
5594 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5595 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@left}}
5596 \pgfusepath{draw}
5597 \endpgfscope
5598
5599 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5600 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5601 \pgfusepath{draw}
5602 }
5603
5604
5605 %% Curved capacitor
5606 % see https://tex.stackexchange.com/questions/509594/polar-capacitor-orientation-in-circuitikz-seems-wrong
5607 % for a rationale
5608 %
5609 \pgfcircdeclarebipolescaled{capacitors}
5610 {}
5611 {\ctikzvalof{bipoles/ccapacitor/height}}
5612 {ccapacitor}
5613 {\ctikzvalof{bipoles/ccapacitor/height}}
5614 {\ctikzvalof{bipoles/ccapacitor/width}}
5615 {
5616 \pgfscope
5617 \pgfscope
5618 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5619 \pgftransformrotate{-90}
5620 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5621 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}}
5622 \pgftransformrotate{90}
5623 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5624 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5625 \pgfpathclose{}
5626 \pgf@circ@maybefill
5627 \endpgfscope
5628 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5629 \pgfscope
5630 % \pgfsetcolor{red}
5631 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5632 \pgftransformrotate{-90}
5633 \pgfpathsine{\pgfpoint{\pgf@circ@res@up}{-\ctikzvalof{bipoles/ccapacitor/bend width}\pgf@circ@res@right}}
5634 \pgfpathcosine{\pgfpoint{\pgf@circ@res@up}{\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}}
5635 \pgfusepath{draw}
5636 \endpgfscope
5637 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5638 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5639 \pgfusepath{draw}
5640 \endpgfscope
5641 % extend wire to the curved capacitor
5642 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\ctikzvalof{bipoles/pcapacitor/bend width}\pgf@circ@res@right}{0pt}}
5643 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5644 \pgfusepath{draw}
5645 }
5646
5647 %% Electrolytic Capacitor
5648 \pgfcircdeclarebipolescaled{capacitors}
5649 {}
5650 {\ctikzvalof{bipoles/ecapacitor/height}}
5651 {ecapacitor}
5652 {\ctikzvalof{bipoles/ecapacitor/height}}
5653 {\ctikzvalof{bipoles/ecapacitor/width}}
5654 {
5655 \pgfscope
5656 \pgfsetrectcap
5657 % % % Draw plus pole
5658 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5659 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5660 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@up}}
5661 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
5662 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5663 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5664 \pgf@circ@draworfill
5665 % % Draw minus pole
5666 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5667 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
5668 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@down}}
5669 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5670 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5671 \pgf@circ@setcolor
5672 \pgf@circ@fill@strokecolor
5673 \pgfusepath{draw,fill}
5674 \endpgfscope
5675 % % plus pole annotation
5676 \pgf@circ@text@strokecolor
5677 \pgftext[right,at=\pgfpoint{1.2\pgf@circ@res@left}{.6\pgf@circ@res@up}]
5678 {\ctikzvalof{bipoles/ecapacitor/font} $+$}
5679 }
5680
5681 %% Variable Capacitor
5682 \pgfcircdeclarebipolescaled{capacitors}
5683 {
5684 \saveddimen{\tunablewidth}{%
5685 \pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/vcapacitor/tunable width}*
5686 \ctikzvalof{bipoles/vcapacitor/width}*0.5*
5687 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
5688 }
5689 \anchor{wiper}{\northeast\pgf@x=-\tunablewidth\pgf@y=-\pgf@y}
5690 \anchor{W}{\northeast\pgf@x=-\tunablewidth\pgf@y=-\pgf@y}
5691 \anchor{tip}{\northeast\pgf@x=\tunablewidth}
5692 }
5693 {\ctikzvalof{bipoles/vcapacitor/height}}
5694 {vcapacitor}
5695 {\ctikzvalof{bipoles/vcapacitor/height}}
5696 {\ctikzvalof{bipoles/vcapacitor/width}}
5697 {
5698 \pgfcirc@maybe@fill@straight@capacitor
5699 \pgf@circ@res@step = \ctikzvalof{bipoles/vcapacitor/tunable width} \pgf@circ@res@right
5700
5701 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5702 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}}
5703 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@down}}
5704
5705 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5706 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5707 \pgfusepath{draw}
5708
5709 \pgfscope
5710 \pgf@circ@set@relative@thickness{modifier thickness}
5711 \pgfcirc@set@arrows{tunable}{}{latexslim}
5712 \ifpgf@circ@fixtunable@dir
5713 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
5714 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
5715 \else
5716 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
5717 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
5718 \fi
5719 \pgfusepath{draw}
5720 \endpgfscope
5721
5722 \pgfsetlinewidth{\pgfstartlinewidth}
5723 \pgfusepath{draw}
5724 }
5725
5726
5727 %% Piezoelectric Element
5728
5729 \pgfcircdeclarebipolescaled{capacitors}
5730 {}
5731 {\ctikzvalof{bipoles/piezoelectric/height}}
5732 {piezoelectric}
5733 {\ctikzvalof{bipoles/piezoelectric/height}}
5734 {\ctikzvalof{bipoles/piezoelectric/width}}
5735 {
5736 % \pgf@circ@res@step = \ctikzvalof{bipoles/piezoelectric/width}\pgf@circ@Rlen
5737 % \divide \pgf@circ@res@step by 5
5738
5739 %% Outer markings
5740 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5741 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5742 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5743
5744 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5745 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5746 \pgfusepath{draw}
5747
5748 %% Inner Box
5749 \pgf@circ@res@step = \pgf@circ@res@right \divide \pgf@circ@res@step by 10
5750 \pgfscope
5751 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5752 \pgfpathrectanglecorners
5753 {\pgfpoint{\pgf@circ@res@left+4*\pgf@circ@res@step}{\pgf@circ@res@up-\pgf@circ@res@step}}
5754 {\pgfpoint{\pgf@circ@res@right-4*\pgf@circ@res@step}{\pgf@circ@res@down+\pgf@circ@res@step}}
5755 \pgf@circ@draworfill
5756 \endpgfscope
5757 }
5758
5759 % Ferroelectric capacitor, suggested by Mayeul Cantan
5760 % (see https://github.com/circuitikz/circuitikz/issues/515)
5761 \pgfcircdeclarebipolescaled{capacitors}
5762 {
5763 \anchor{curve right}{\southwest\pgf@x=-1.8\pgf@x\pgf@y=\pgf@y}%
5764 \anchor{curve left}{\southwest\pgf@x=1.8\pgf@x\pgf@y=-\pgf@y}%
5765 \anchor{kink right}{\southwest\pgf@x=-1.8\pgf@x\pgf@y=0.5\pgf@y}%
5766 \anchor{kink left}{\southwest\pgf@x=1.8\pgf@x\pgf@y=-0.5\pgf@y}%
5767 \pgfcirc@border@extend@full{1.8}{1}{1.8}{1}
5768 }
5769 {\ctikzvalof{bipoles/capacitor/height}}
5770 {ferrocap}
5771 {\ctikzvalof{bipoles/capacitor/height}}
5772 {\ctikzvalof{bipoles/capacitor/width}}
5773 {
5774 \pgfcirc@maybe@fill@straight@capacitor
5775
5776 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5779
5780 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
5781 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
5782 \pgfusepath{draw}
5783 \pgfscope
5784 \pgf@circ@set@relative@thickness{modifier thickness}
5785 \pgfsetcornersarced{\pgfpoint{0.2\pgf@circ@res@right}{0.2\pgf@circ@res@up}}
5786 \pgfpathmoveto{\pgfpoint{-1.8\pgf@circ@res@right}{\pgf@circ@res@up}}
5787 \pgfpathlineto{\pgfpoint{-1.8\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
5788 \pgfpathlineto{\pgfpoint{1.8\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
5789 \pgfpathlineto{\pgfpoint{1.8\pgf@circ@res@right}{\pgf@circ@res@down}}
5790 \pgfusepath{draw}
5791 \endpgfscope
5792 }
5793
5794 %% Constant phase element
5795 \pgfcircdeclarebipolescaled{capacitors}
5796 {}
5797 {\ctikzvalof{bipoles/cpe/height}}
5798 {cpe}
5799 {\ctikzvalof{bipoles/cpe/height}}
5800 {\ctikzvalof{bipoles/cpe/width}}
5801 {
5802 \pgfscope
5803 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5804 \pgfpathlineto{\pgfpointorigin}
5805 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5806 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5807 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5808 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5809 \pgfpathclose
5810 \pgf@circ@maybefill
5811 \endpgfscope
5812
5813 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
5814 \pgfpathlineto{\pgfpointorigin}
5815 \pgfusepath{draw}
5816 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5817 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
5818 \pgfpathlineto{\pgfpointorigin}
5819 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
5820
5821 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
5822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
5823 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
5824 \pgfusepath{draw}
5825 }
5826
5827 % %>>>
5828
5829 %% Paths for capacitors%<<<
5830 \pgfcirc@activate@bipole@simple{l}{capacitor}
5831 \pgfcirc@style@to@style{capacitor}{C}
5832 \pgfcirc@activate@bipole@simple{l}{ecapacitor}
5833 \pgfcirc@style@to@style{ecapacitor}{eC}
5834 \pgfcirc@style@to@style{ecapacitor}{elko}
5835 \pgfcirc@activate@bipole{l}{polarcapacitor}{polarcapacitor}{polar capacitor}
5836 %% polar capacitor is deprecated, use curved capacitor instead
5837 \pgfcirc@style@to@style{polar capacitor}{pC}
5838 \pgfcirc@activate@bipole{l}{ccapacitor}{ccapacitor}{curved capacitor}
5839 \pgfcirc@style@to@style{curved capacitor}{cC}
5840 \pgfcirc@activate@bipole{l}{vcapacitor}{vcapacitor}{variable capacitor}
5841 \pgfcirc@style@to@style{variable capacitor}{vC}
5842 \pgfcirc@activate@bipole@simple{l}{piezoelectric}
5843 \pgfcirc@style@to@style{piezoelectric}{PZ}
5844 \pgfcirc@activate@bipole{l}{capacitivesens}{capacitivesens}{capacitive sensor}
5845 \pgfcirc@style@to@style{capacitive sensor}{sC}
5846 \pgfcirc@activate@bipole@simple{l}{ferrocap}
5847 \pgfcirc@style@to@style{ferrocap}{feC}
5848 \pgfcirc@activate@bipole@simple{l}{cpe}
5849 % %>>>
5850
5851 %%%%%%%%%%%%%%%
5852 %% Inductors
5853 %%%%%%%%%%%%%%%
5854
5855 % Definitions of Inductors%<<<1
5856
5857 \ctikzset{inductors/coils/.code={%
5858 \ctikzset{bipoles/cuteinductor/coils=#1}%
5859 \ctikzset{bipoles/cutechoke/coils=#1}%
5860 \ctikzset{bipoles/americaninductor/coils=#1}%
5861 \ctikzset{bipoles/vcuteinductor/coils=#1}%
5862 \ctikzset{bipoles/vamericaninductor/coils=#1}%
5863 }}
5864 \ctikzset{inductors/width/.code={%
5865 \ctikzset{bipoles/cuteinductor/width=#1}%
5866 \ctikzset{bipoles/cutechoke/width=#1}%
5867 \ctikzset{bipoles/americaninductor/width=#1}%
5868 \ctikzset{bipoles/vcuteinductor/width=#1}%
5869 \ctikzset{bipoles/vamericaninductor/width=#1}%
5870 \ctikzset{bipoles/fullgeneric/width=#1}%
5871 \ctikzset{bipoles/tfullgeneric/width=#1}%
5872 }}
5873 \ctikzset{bipoles/cuteinductor/height/.initial=.3}
5874 \ctikzset{bipoles/cuteinductor/lower coil height/.initial=.15}
5875 \ctikzset{bipoles/cuteinductor/width/.initial=.6}
5876 \ctikzset{bipoles/cuteinductor/coils/.initial=5}
5877 \ctikzset{bipoles/cuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
5878 %% Cute choke settings
5879 \ctikzset{bipoles/cutechoke/height/.initial=.3}
5880 \ctikzset{bipoles/cutechoke/lower coil height/.initial=.15}
5881 \ctikzset{bipoles/cutechoke/width/.initial=.6}
5882 \ctikzset{bipoles/cutechoke/coils/.initial=5}
5883 \ctikzset{bipoles/cutechoke/coil aspect/.initial=.5}%percentage of choke width, which is covered by lower coil
5884 \ctikzset{bipoles/cutechoke/cstep/.initial=.3}
5885 \ctikzset{bipoles/cutechoke/cdist/.initial=1.3}
5886 \ctikzset{bipoles/cutechoke/cthick/.initial=1}
5887 \newif\ifpgf@circuit@bipole@twolineschoke
5888 \pgf@circuit@bipole@twolineschokefalse
5889 \pgfkeys{/tikz/onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
5890 \ctikzset{onelinechoke/.add code={}{\pgf@circuit@bipole@twolineschokefalse}}
5891 \pgfkeys{/tikz/twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
5892 \ctikzset{twolineschoke/.add code={}{\pgf@circuit@bipole@twolineschoketrue}}
5893 %
5894 % generic core anchor settings
5895 \ctikzset{bipoles/inductors/core distance/.initial={2pt}}
5896 \ctikzset{bipoles/inductors/dot x distance/.initial={4pt}}
5897 \ctikzset{bipoles/inductors/dot y distance/.initial={1pt}}
5898 \def\pgfcir@basic@core@anchors{%
5899 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
5900 \saveddimen{\dotXdistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/dot x distance}}}
5901 \saveddimen{\dotYdistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/dot y distance}}}
5902 \anchor{core east}{%
5903 \northeast\advance\pgf@y by\coredistance
5904 }
5905 \anchor{core west}{%
5906 \northeast\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
5907 }
5908 \anchor{ll dot}{%
5909 \southwestborder
5910 \advance\pgf@x by -\dotXdistance
5911 \advance\pgf@y by -\dotYdistance
5912 }
5913 \anchor{ul dot}{%
5914 \northeastborder
5915 \advance\pgf@x by \dotXdistance\pgf@x=-\pgf@x
5916 \advance\pgf@y by \dotYdistance
5917 }
5918 \anchor{lr dot}{%
5919 \southwestborder
5920 \advance\pgf@x by -\dotXdistance\pgf@x=-\pgf@x
5921 \advance\pgf@y by -\dotYdistance
5922 }
5923 \anchor{ur dot}{%
5924 \northeastborder
5925 \advance\pgf@x by \dotXdistance
5926 \advance\pgf@y by \dotYdistance
5927 }
5928 }
5929 %
5930 \ctikzset{bipoles/americaninductor/height/.initial=.3}
5931 \ctikzset{bipoles/americaninductor/height 2/.initial=.1}
5932 \ctikzset{bipoles/americaninductor/width/.initial=.8}
5933 \ctikzset{bipoles/americaninductor/coils/.initial=4}
5934 \ctikzset{bipoles/americaninductor/coil height/.initial=.15}
5935 \ctikzset{bipoles/vcuteinductor/height/.initial=.6}
5936 \ctikzset{bipoles/vcuteinductor/lower coil height/.initial=.3}
5937 \ctikzset{bipoles/vcuteinductor/width/.initial=.6}
5938 \ctikzset{bipoles/vcuteinductor/coils/.initial=5}
5939 \ctikzset{bipoles/vcuteinductor/coil aspect/.initial=.5}%percentage of inductor width, which is covered by lower coil
5940 \ctikzset{bipoles/vamericaninductor/height/.initial=.6}
5941 \ctikzset{bipoles/vamericaninductor/height 2/.initial=.2}
5942 \ctikzset{bipoles/vamericaninductor/width/.initial=.8}
5943 \ctikzset{bipoles/vamericaninductor/coils/.initial=4}
5944 \ctikzset{bipoles/vamericaninductor/coil height/.initial=.15}
5945 \ctikzset{bipoles/tfullgeneric/height/.initial=.70}
5946 \ctikzset{bipoles/tfullgeneric/width/.initial=.80}
5947 \ctikzset{bipoles/fullgeneric/height/.initial=.30}
5948 \ctikzset{bipoles/fullgeneric/width/.initial=.80}
5949 \ctikzset{inductor/.is choice}
5950 \ctikzset{inductor/cute/.code={\ctikzsetvalof{inductor}{cute}}}
5951 \ctikzset{inductor/european/.code={\ctikzsetvalof{inductor}{european}}}
5952 \ctikzset{inductor/american/.code={\ctikzsetvalof{inductor}{american}}}
5953
5954 \tikzset{american inductors/.style = {\circuitikzbasekey/inductor = american}}
5955 \tikzset{european inductors/.style = {\circuitikzbasekey/inductor = european}}
5956 \tikzset{cute inductors/.style = {\circuitikzbasekey/inductor = cute}}
5957 \tikzset{american ports/.style = {\circuitikzbasekey/logic ports = american}}
5958 \tikzset{european ports/.style = {\circuitikzbasekey/logic ports = european}}
5959
5960 %%>>>
5961
5962 %% Shapes for inductors%<<<
5963 %% cute inductor
5964 \pgfcircdeclarebipolescaled{inductors}
5965 {
5966 \savedanchor{\midtap}{%
5967 \pgf@x=0pt\relax
5968 \pgfmathsetlength{\pgf@y}{%
5969 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
5970 \ctikzvalof{bipoles/cuteinductor/height} :% even
5971 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
5972 *\pgf@circ@scaled@Rlen/2
5973 }
5974 }
5975 \anchor{midtap}{\midtap}
5976 \pgfcir@basic@core@anchors
5977 }
5978 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
5979 {cuteinductor}
5980 {\ctikzvalof{bipoles/cuteinductor/height}}
5981 {\ctikzvalof{bipoles/cuteinductor/width}}
5982 {
5983 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
5984 \pgftransformationadjustments
5985
5986 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
5987 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
5988
5989
5990 \pgfmathsetlength{\pgf@circ@res@step}
5991 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
5992
5993 \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
5994 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
5995 {
5996 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
5997 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
5998 }
5999 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
6000 \pgfsetbuttcap
6001 \pgfsetbeveljoin
6002 \pgfusepath{stroke}
6003 }
6004
6005 %% cute inductive sensor
6006 \pgfcircdeclarebipolescaled{inductors}
6007 {% anchor for labelling the type of dependency
6008 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
6009 \savedanchor{\midtap}{%
6010 \pgf@x=0pt\relax
6011 \pgfmathsetlength{\pgf@y}{%
6012 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
6013 \ctikzvalof{bipoles/cuteinductor/height} :% even
6014 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
6015 *\pgf@circ@scaled@Rlen/2
6016 }
6017 }
6018 \anchor{midtap}{\midtap}
6019 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
6020 \pgfcir@basic@core@anchors
6021 \anchor{wiper}{\southwest\pgf@x=1.6\pgf@x\pgf@y=2.6\pgf@y}
6022 \anchor{W}{\southwest\pgf@x=1.6\pgf@x\pgf@y=2.6\pgf@y}
6023 \anchor{tip}{\northeast\pgf@x=0.8\pgf@x\pgf@y=2\pgf@y}
6024 }
6025 {\ctikzvalof{bipoles/cuteinductor/lower coil height}}
6026 {scuteinductor}
6027 {\ctikzvalof{bipoles/cuteinductor/height}}
6028 {\ctikzvalof{bipoles/cuteinductor/width}}
6029 {
6030 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6031 \pgftransformationadjustments
6032
6033 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
6034 {0.5*\ctikzvalof{bipoles/cuteinductor/coil aspect}*\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/cuteinductor/coils}-1)}
6035
6036
6037 \pgfmathsetlength{\pgf@circ@res@step}
6038 {(\ctikzvalof{bipoles/cuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cuteinductor/coils}/2}
6039
6040 \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
6041 \foreach \x in {2,...,\ctikzvalof{bipoles/cuteinductor/coils}}
6042 {
6043 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
6044 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
6045 }
6046 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
6047 \pgfsetbuttcap
6048 \pgfsetbeveljoin
6049 \pgfusepath{stroke}
6050 \pgfscope
6051 \pgf@circ@set@relative@thickness{modifier thickness}
6052 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
6053 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
6054 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
6055 \pgfusepath{draw}
6056 \endpgfscope
6057 }
6058
6059 %% cute choke
6060 \pgfcircdeclarebipolescaled{inductors}
6061 {
6062 \savedanchor{\midtap}{%
6063 \pgf@x=0pt\relax
6064 \pgfmathsetlength{\pgf@y}{%
6065 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
6066 \ctikzvalof{bipoles/cuteinductor/height} :% even
6067 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
6068 *\pgf@circ@scaled@Rlen/2
6069 }
6070 }
6071 \anchor{midtap}{\midtap}
6072 }
6073 {\ctikzvalof{bipoles/cutechoke/lower coil height}}
6074 {cutechoke}
6075 {\ctikzvalof{bipoles/cutechoke/height}}
6076 {\ctikzvalof{bipoles/cutechoke/width}}
6077 {
6078 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6079 \pgftransformationadjustments
6080
6081 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
6082 {0.5*\ctikzvalof{bipoles/cutechoke/coil aspect}*\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen/(\ctikzvalof{bipoles/cutechoke/coils}-1)}
6083
6084
6085 \pgfmathsetlength{\pgf@circ@res@step}
6086 {(\ctikzvalof{bipoles/cutechoke/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/cutechoke/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/cutechoke/coils}/2}
6087
6088 \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
6089 \foreach \x in {2,...,\ctikzvalof{bipoles/cutechoke/coils}}
6090 {
6091 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
6092 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -\pgf@circ@res@down}
6093 }
6094 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@up}
6095 \pgfsetbuttcap
6096 \pgfsetbeveljoin
6097 \pgfusepath{stroke}
6098
6099 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
6100 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfverticaltransformationadjustment*0.4*\pgfstartlinewidth+\ctikzvalof{bipoles/cutechoke/cdist}\pgf@circ@res@up}}
6101 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6102 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
6103 \pgfusepath{stroke}
6104
6105 \ifpgf@circuit@bipole@twolineschoke
6106 \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}}
6107 \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}}
6108 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6109 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}\pgflinewidth}
6110 \pgfusepath{stroke}
6111 \fi
6112 }
6113
6114 %% variable cute inductor
6115 \pgfcircdeclarebipolescaled{inductors}
6116 {
6117 \savedanchor{\midtap}{%
6118 \pgf@x=0pt\relax
6119 \pgfmathsetlength{\pgf@y}{%
6120 (mod(\ctikzvalof{bipoles/cuteinductor/coils},2) ?%
6121 \ctikzvalof{bipoles/cuteinductor/height} :% even
6122 -\ctikzvalof{bipoles/cuteinductor/lower coil height}) %odd
6123 *\pgf@circ@scaled@Rlen/2
6124 }
6125 }
6126 \anchor{midtap}{\midtap}
6127 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
6128 \anchor{core east}{%
6129 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance
6130 }
6131 \anchor{core west}{%
6132 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
6133 }
6134 \anchor{wiper}{\southwest\pgf@x=0.4\pgf@x\pgf@y=\pgf@y}
6135 \anchor{W}{\southwest\pgf@x=0.4\pgf@x\pgf@y=\pgf@y}
6136 \anchor{tip}{\northeast\pgf@x=0.4\pgf@x}
6137 }
6138 {\ctikzvalof{bipoles/vcuteinductor/lower coil height}}
6139 {vcuteinductor}
6140 {\ctikzvalof{bipoles/vcuteinductor/height}}
6141 {\ctikzvalof{bipoles/vcuteinductor/width}}
6142 {
6143 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6144 \pgftransformationadjustments
6145
6146 \pgfmathsetlength{\pgf@circ@res@other}%width of small coil
6147 {0.5*\ctikzvalof{bipoles/vcuteinductor/coil aspect}*\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen/(\ctikzvalof{bipoles/vcuteinductor/coils}-1)}
6148
6149
6150 \pgfmathsetlength{\pgf@circ@res@step}
6151 {(\ctikzvalof{bipoles/vcuteinductor/width}*\scaledRlen+\pgfhorizontaltransformationadjustment\pgflinewidth+(\ctikzvalof{bipoles/vcuteinductor/coils}-1)*2*\pgf@circ@res@other)/\ctikzvalof{bipoles/vcuteinductor/coils}/2}
6152
6153 \pgfscope
6154 \pgf@circ@set@relative@thickness{modifier thickness}
6155 \pgfcirc@set@arrows{tunable}{}{latexslim}
6156 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
6157 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@right}{\pgf@circ@res@up}}
6158 \pgfusepath{draw}
6159 \endpgfscope
6160
6161 \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
6162 \foreach \x in {2,...,\ctikzvalof{bipoles/vcuteinductor/coils}}
6163 {
6164 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
6165 \pgfpatharc{0}{-180}{\pgf@circ@res@other and -.5\pgf@circ@res@down}
6166 }
6167 \pgfpatharc{180}{0}{\pgf@circ@res@step and .5\pgf@circ@res@up}
6168 \pgfsetbuttcap
6169 \pgfsetbeveljoin
6170 \pgfusepath{stroke}
6171 }
6172
6173 %% american inductor
6174 \pgfcircdeclarebipolescaled{inductors}
6175 {
6176 \savedanchor{\midtap}{%
6177 \pgf@x=0pt\relax
6178 \pgfmathsetlength{\pgf@y}{%
6179 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
6180 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
6181 0) %odd
6182 *\pgf@circ@scaled@Rlen/2
6183 }
6184 }
6185 \anchor{midtap}{\midtap}
6186 \pgfcir@basic@core@anchors
6187 }
6188 {\ctikzvalof{bipoles/americaninductor/height 2}}
6189 {americaninductor}
6190 {\ctikzvalof{bipoles/americaninductor/height}}
6191 {\ctikzvalof{bipoles/americaninductor/width}}
6192 {
6193 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
6194 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6195 \pgftransformationadjustments
6196 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
6197 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
6198 \divide \pgf@circ@res@step by 2
6199 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
6200
6201 \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
6202 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
6203 {
6204 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
6205 }
6206 \pgfsetbuttcap
6207 \pgfsetbeveljoin
6208 \pgfusepath{stroke}
6209 }
6210
6211
6212 %% american inductive sensor
6213 \pgfcircdeclarebipolescaled{inductors}
6214 {% anchor for labelling the type of dependency
6215 \anchor{label}{\southwest\pgf@x=0.8\pgf@x\pgf@y=2.6\pgf@y}%
6216 \savedanchor{\midtap}{%
6217 \pgf@x=0pt\relax
6218 \pgfmathsetlength{\pgf@y}{%
6219 (mod(\ctikzvalof{bipoles/americaninductor/coils},2) ?%
6220 2*\ctikzvalof{bipoles/americaninductor/coil height} :% even
6221 0) %odd
6222 *\pgf@circ@scaled@Rlen/2
6223 }
6224 }
6225 \anchor{midtap}{\midtap}
6226 \pgfcirc@border@extend@full{1}{2}{1.6}{2.6}
6227 \pgfcir@basic@core@anchors
6228 \anchor{wiper}{\southwest\pgf@x=1.6\pgf@x\pgf@y=2.6\pgf@y}
6229 \anchor{W}{\southwest\pgf@x=1.6\pgf@x\pgf@y=2.6\pgf@y}
6230 \anchor{tip}{\northeast\pgf@x=0.8\pgf@x\pgf@y=2\pgf@y}
6231 }
6232 {\ctikzvalof{bipoles/americaninductor/height 2}}
6233 {samericaninductor}
6234 {\ctikzvalof{bipoles/americaninductor/height}}
6235 {\ctikzvalof{bipoles/americaninductor/width}}
6236 {
6237 \pgf@circ@res@step=\ctikzvalof{bipoles/americaninductor/width}\pgf@circ@scaled@Rlen
6238 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6239 \pgftransformationadjustments
6240 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
6241 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/americaninductor/coils}
6242 \divide \pgf@circ@res@step by 2
6243 \pgf@circ@res@other = \ctikzvalof{bipoles/americaninductor/coil height}\pgf@circ@scaled@Rlen
6244
6245 \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
6246 \foreach \x in {1,...,\ctikzvalof{bipoles/americaninductor/coils}}
6247 {
6248 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
6249 }
6250 \pgfsetbuttcap
6251 \pgfsetbeveljoin
6252 \pgfusepath{stroke}
6253 \pgfscope
6254 \pgf@circ@set@relative@thickness{modifier thickness}
6255 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@right}{2\pgf@circ@res@up}}
6256 \pgfpathlineto{\pgfpoint{-.8\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
6257 \pgfpathlineto{\pgfpoint{-1.6\pgf@circ@res@right}{2.6\pgf@circ@res@down}}
6258 \pgfusepath{draw}
6259 \endpgfscope
6260 }
6261
6262 %% variable american inductor
6263 \pgfcircdeclarebipolescaled{inductors}
6264 {
6265 \savedanchor{\midtap}{%
6266 \pgf@x=0pt\relax
6267 \pgfmathsetlength{\pgf@y}{%
6268 (mod(\ctikzvalof{bipoles/vamericaninductor/coils},2) ?%
6269 2*\ctikzvalof{bipoles/vamericaninductor/coil height} :% even
6270 0) %odd
6271 *\pgf@circ@scaled@Rlen/2
6272 }
6273 }
6274 \anchor{midtap}{\midtap}
6275 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
6276 \anchor{core east}{%
6277 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance
6278 }
6279 \anchor{core west}{%
6280 \northeast\pgf@y=0.5\pgf@y\advance\pgf@y by\coredistance\pgf@x=-\pgf@x
6281 }
6282 \anchor{wiper}{\southwest\pgf@x=0.4\pgf@x\pgf@y=\pgf@y}
6283 \anchor{W}{\southwest\pgf@x=0.4\pgf@x\pgf@y=\pgf@y}
6284 \anchor{tip}{\northeast\pgf@x=0.4\pgf@x}
6285 }
6286 {\ctikzvalof{bipoles/vamericaninductor/height 2}}
6287 {vamericaninductor}
6288 {\ctikzvalof{bipoles/vamericaninductor/height}}
6289 {\ctikzvalof{bipoles/vamericaninductor/width}}
6290 {
6291 \pgf@circ@res@step=\ctikzvalof{bipoles/vamericaninductor/width}\pgf@circ@scaled@Rlen
6292 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6293 \pgftransformationadjustments
6294 \advance \pgf@circ@res@step by \pgfhorizontaltransformationadjustment\pgflinewidth
6295 \divide \pgf@circ@res@step by \ctikzvalof{bipoles/vamericaninductor/coils}
6296 \divide \pgf@circ@res@step by 2
6297 \pgf@circ@res@other = \ctikzvalof{bipoles/vamericaninductor/coil height}\pgf@circ@scaled@Rlen
6298
6299 \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
6300 \foreach \x in {1,...,\ctikzvalof{bipoles/vamericaninductor/coils}}
6301 {
6302 \pgfpatharc{180}{0}{\pgf@circ@res@step and \pgf@circ@res@other}
6303 }
6304 \pgfsetbuttcap
6305 \pgfsetbeveljoin
6306 \pgfusepath{stroke}
6307
6308 \pgfscope
6309 \pgf@circ@set@relative@thickness{modifier thickness}
6310 \pgfcirc@set@arrows{tunable}{}{latexslim}
6311 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{\pgf@circ@res@down}}
6312 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@left}{\pgf@circ@res@up}}
6313 \pgfusepath{draw}
6314 \endpgfscope
6315 }
6316
6317 %% Generic bipole, filled - used as inductor by some
6318 \pgfcircdeclarebipolescaled{inductors}
6319 {
6320 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
6321 \pgfcir@basic@core@anchors
6322 }
6323 {\ctikzvalof{bipoles/fullgeneric/height}}
6324 {fullgeneric}
6325 {\ctikzvalof{bipoles/fullgeneric/height}}
6326 {\ctikzvalof{bipoles/fullgeneric/width}}
6327 {
6328 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6329 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6330
6331 \pgf@circ@fill@strokecolor
6332 \pgfusepath{draw,fill}
6333 }
6334
6335 %% Generic sensor, filled - used as inductive sensor by some
6336 \pgfcircdeclarebipolescaled{inductors}
6337 {% anchor for labelling the type of dependency
6338 \anchor{label}{\southwest\pgf@x=0.4\pgf@x\pgf@y=2\pgf@y}%
6339 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
6340 \pgfcirc@border@extend@full{1}{2}{1}{2}
6341 \pgfcir@basic@core@anchors
6342 \anchor{wiper}{\northeast\pgf@x=-\pgf@x\pgf@y=-2\pgf@y}
6343 \anchor{W}{\northeast\pgf@x=-\pgf@x\pgf@y=-2\pgf@y}
6344 \anchor{tip}{\northeast\pgf@y=2\pgf@y}
6345 }
6346 {\ctikzvalof{bipoles/fullgeneric/height}}
6347 {sfullgeneric}
6348 {\ctikzvalof{bipoles/fullgeneric/height}}
6349 {\ctikzvalof{bipoles/fullgeneric/width}}
6350 {
6351
6352 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6353 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6354 \pgf@circ@fill@strokecolor
6355 \pgfusepath{draw,fill}
6356 \pgfscope
6357 \pgf@circ@set@relative@thickness{modifier thickness}
6358 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left}{-2\pgf@circ@res@down}}
6359 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{2\pgf@circ@res@down}}
6360 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{2\pgf@circ@res@down}}
6361 \pgfusepath{draw}
6362 \endpgfscope
6363 }
6364
6365 %% Generic full tunable
6366 \pgfcircdeclarebipolescaled{inductors}
6367 {
6368 \anchor{midtap}{\northeast\pgf@x=0pt\relax}
6369 \saveddimen{\coredistance}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{bipoles/inductors/core distance}}}
6370 \anchor{core east}{%
6371 \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance
6372 }
6373 \anchor{core west}{%
6374 \northeast\pgf@y=0.4\pgf@y\advance\pgf@y by \coredistance\pgf@x=-\pgf@x
6375 }
6376 \anchor{wiper}{\northeast\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
6377 \anchor{W}{\northeast\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
6378 \anchor{tip}{\northeast\pgf@x=0.5\pgf@x}
6379 }
6380 {\ctikzvalof{bipoles/tfullgeneric/height}}
6381 {tfullgeneric}
6382 {\ctikzvalof{bipoles/tfullgeneric/height}}
6383 {\ctikzvalof{bipoles/tfullgeneric/width}}
6384 {
6385 \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
6386 \divide \pgf@circ@res@step by 14
6387
6388 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{.4\pgf@circ@res@down}}
6389 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6390 \pgf@circ@fill@strokecolor
6391 \pgfusepath{draw,fill}
6392
6393 \pgfscope
6394 \pgf@circ@set@relative@thickness{modifier thickness}
6395 \pgfcirc@set@arrows{tunable}{}{latexslim}
6396 \ifpgf@circ@fixtunable@dir
6397 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@down}}
6398 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@up}}
6399 \else
6400 \pgfpathmoveto{\pgfpoint{.5\pgf@circ@res@left}{\pgf@circ@res@up}}
6401 \pgfpathlineto{\pgfpoint{-.5\pgf@circ@res@left}{\pgf@circ@res@down}}
6402 \fi
6403 \pgfusepath{draw}
6404 \endpgfscope
6405 }
6406 % %>>>
6407
6408 %% Paths for Inductors%<<<
6409 %% these are complex because of the three-way set
6410 %% should be simplified
6411 \def\pgf@circ@inductor@path#1{%
6412 \pgfextra{
6413 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
6414 \def\pgf@temp{european}%
6415 }
6416 \ifx\pgf@temp\pgf@circ@temp%
6417 \pgf@circ@europeaninductor@path{#1}%
6418 \else%
6419 \pgfextra{ \def\pgf@temp{cute} }%
6420 \ifx\pgf@temp\pgf@circ@temp%
6421 \pgf@circ@cuteinductor@path{#1}%
6422 \else%
6423 \pgf@circ@americaninductor@path{#1}%
6424 \fi%
6425 \fi%
6426 }
6427 \pgfcirc@path@to@style{l}{inductor}{inductor}{}
6428 \pgfcirc@style@to@style{inductor}{L}
6429 \pgfcirc@activate@bipole{l}{europeaninductor}{fullgeneric}{european inductor}
6430 \pgfcirc@activate@bipole{l}{americaninductor}{americaninductor}{american inductor}
6431 \pgfcirc@activate@bipole{l}{cuteinductor}{cuteinductor}{cute inductor}
6432
6433 \def\pgf@circ@vinductor@path#1{
6434 \pgfextra{
6435 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
6436 \def\pgf@temp{european}%
6437 }
6438 \ifx\pgf@temp\pgf@circ@temp%
6439 \pgf@circ@veuropeaninductor@path{#1}%
6440 \else%
6441 \pgfextra{ \def\pgf@temp{cute} }%
6442 \ifx\pgf@temp\pgf@circ@temp%
6443 \pgf@circ@vcuteinductor@path{#1}%
6444 \else%
6445 \pgf@circ@vamericaninductor@path{#1}%
6446 \fi%
6447 \fi%
6448 }
6449 \pgfcirc@path@to@style{l}{vinductor}{variable inductor}{}
6450 \pgfcirc@style@to@style{variable inductor}{vL}
6451 \pgfcirc@activate@bipole{l}{veuropeaninductor}{tfullgeneric}{variable european inductor}
6452 \pgfcirc@activate@bipole{l}{vamericaninductor}{vamericaninductor}{variable american inductor}
6453 \pgfcirc@activate@bipole{l}{vcuteinductor}{vcuteinductor}{variable cute inductor}
6454
6455 \def\pgf@circ@inductivesens@path#1{%
6456 \pgfextra{
6457 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
6458 \def\pgf@temp{european}%
6459 }
6460 \ifx\pgf@temp\pgf@circ@temp%
6461 \pgf@circ@europeaninductivesens@path{#1}%
6462 \else%
6463 \pgfextra{ \def\pgf@temp{cute} }%
6464 \ifx\pgf@temp\pgf@circ@temp%
6465 \pgf@circ@cuteinductivesens@path{#1}%
6466 \else%
6467 \pgf@circ@americaninductivesens@path{#1}%
6468 \fi%
6469 \fi%
6470 }
6471 \pgfcirc@path@to@style{l}{inductivesens}{inductive sensor}{}
6472 \pgfcirc@style@to@style{inductive sensor}{sL}
6473 \pgfcirc@activate@bipole{l}{europeaninductivesens}{sfullgeneric}{european inductive sensor}
6474 \pgfcirc@activate@bipole{l}{americaninductivesens}{samericaninductor}{american inductive sensor}
6475 \pgfcirc@activate@bipole{l}{cuteinductivesens}{scuteinductor}{cute inductive sensor}
6476
6477 \pgfcirc@activate@bipole{l}{cutechoke}{cutechoke}{cute choke}
6478 % %>>>
6479
6480 %%%%%%%%%%%
6481 %% Sources (batteries, independent, dependents and so on
6482 %%%%%%%%%%%
6483
6484 % Definitions for Sources%<<<1
6485
6486 \ctikzset{bipoles/esource/height/.initial=.60}
6487 \ctikzset{bipoles/esource/width/.initial=.60}
6488 \ctikzset{bipoles/pvsource/height/.initial=.60}
6489 \ctikzset{bipoles/pvsource/width/.initial=.60}
6490 \ctikzset{bipoles/pvmodule/height/.initial=.60}
6491 \ctikzset{bipoles/pvmodule/width/.initial=1.20}
6492 \ctikzset{bipoles/isource/height/.initial=.60}
6493 \ctikzset{bipoles/isource/width/.initial=.60}
6494 \ctikzset{bipoles/oosource/height/.initial=.60}
6495 \ctikzset{bipoles/oosource/width/.initial=.60}
6496 \ctikzset{bipoles/oosource/circlesize/.initial=.65}%circlesize+circleoffset should be =1
6497 \ctikzset{bipoles/oosource/circleoffset/.initial=.35}%circlesize+circleoffset should be =1
6498 \ctikzset{bipoles/dcisource/angle/.initial=80}
6499 \ctikzset{bipoles/dcisource/height/.initial=.60}
6500 \ctikzset{bipoles/dcisource/width/.initial=.60}
6501 \ctikzset{bipoles/dcvsource/height/.initial=.60}
6502 \ctikzset{bipoles/dcvsource/width/.initial=.60}
6503 \ctikzset{bipoles/vsourcetri/height/.initial=.60}
6504 \ctikzset{bipoles/vsourcetri/width/.initial=.60}
6505 \ctikzset{bipoles/isourceam/height/.initial=.60}
6506 \ctikzset{bipoles/isourceam/width/.initial=.60}
6507 \ctikzset{bipoles/vsource/height/.initial=.60}
6508 \ctikzset{bipoles/vsource/width/.initial=.60}
6509 \ctikzset{bipoles/vsourceam/height/.initial=.60}
6510 \ctikzset{bipoles/vsourceam/width/.initial=.60}
6511 \ctikzset{bipoles/vsourceam/margin/.initial=.7}
6512 \ctikzset{bipoles/isourcesin/angle/.initial=90}
6513 \ctikzset{bipoles/isourcesin/height/.initial=.60}
6514 \ctikzset{bipoles/isourcesin/width/.initial=.60}
6515 \ctikzset{bipoles/vsourcesin/height/.initial=.60}
6516 \ctikzset{bipoles/vsourcesin/width/.initial=.60}
6517 \ctikzset{bipoles/vsourcesquare/height/.initial=.60}
6518 \ctikzset{bipoles/vsourcesquare/width/.initial=.60}
6519 \ctikzset{bipoles/cisource/height/.initial=.7}
6520 \ctikzset{bipoles/cisource/width/.initial=.7}
6521 \ctikzset{bipoles/cisourceam/height/.initial=.7}
6522 \ctikzset{bipoles/cisourceam/width/.initial=.7}
6523 \ctikzset{bipoles/ecsource/height/.initial=.7}
6524 \ctikzset{bipoles/ecsource/width/.initial=.7}
6525 \ctikzset{bipoles/cvsource/height/.initial=.7}
6526 \ctikzset{bipoles/cvsource/width/.initial=.7}
6527 \ctikzset{bipoles/cvsourceam/height/.initial=.7}
6528 \ctikzset{bipoles/cvsourceam/width/.initial=.7}
6529 \ctikzset{bipoles/cvsourceam/margin/.initial=.7}
6530 \ctikzset{bipoles/cvsourceam/text scale/.initial=1}
6531 \ctikzset{bipoles/cisourcesin/width/.initial=.7}
6532 \ctikzset{bipoles/cvsourcesin/height/.initial=.7}
6533 \ctikzset{bipoles/cvsourcesin/width/.initial=.7}
6534 \ctikzset{bipoles/battery/height/.initial=.6}
6535 \ctikzset{bipoles/battery/width/.initial=.3}
6536 \ctikzset{bipoles/battery1/height/.initial=.6}
6537 \ctikzset{bipoles/battery1/width/.initial=.3}
6538 \ctikzset{bipoles/battery2/height/.initial=.6}
6539 \ctikzset{bipoles/battery2/width/.initial=.3}
6540 \ctikzset{bipoles/solar/height/.initial=.6}
6541 \ctikzset{bipoles/solar/width/.initial=.3}
6542
6543 % noise sources
6544 \ctikzset{bipoles/noise sources/fillcolor/.initial=gray!50}
6545
6546 % for special symbols in the sources: sin, square, triangle, delta, wye, eyw, zig, etc.
6547 \ctikzset{sources/symbol/thickness/.initial={1}}
6548 \ctikzset{csources/symbol/thickness/.initial={1}}
6549 \ctikzset{sources/symbol/rotate/.initial={90}}
6550 \ctikzset{csources/symbol/rotate/.initial={90}}
6551
6552 % % % oo autotransformer
6553 \ctikzset{bipoles/oosourceatrans/height/.initial=.6}
6554 \ctikzset{bipoles/oosourceatrans/width/.initial=.5}
6555 \ctikzset{bipoles/oosourceatrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
6556 % we do not use the offset here; the circle is "seated" to the right side
6557 % \ctikzset{bipoles/oosourceatrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
6558 \ctikzset{bipoles/oosourceatrans/vectorgroupscale/.initial=1.2}% better if it's a bit bigger
6559
6560 % % % ootransformer
6561 \ctikzset{bipoles/oosourcetrans/height/.initial=.6}
6562 \ctikzset{bipoles/oosourcetrans/width/.initial=.6}
6563 \ctikzset{bipoles/oosourcetrans/circlesize/.initial=.6}%circlesize+circleoffset should be =1
6564 \ctikzset{bipoles/oosourcetrans/circleoffset/.initial=.4}%circlesize+circleoffset should be =1
6565 \ctikzset{bipoles/oosourcetrans/vectorgroupscale/.initial=1}
6566
6567 % % % oootransformer
6568 \ctikzset{bipoles/ooosource/height/.initial=.6}
6569 \ctikzset{bipoles/ooosource/circlesize/.initial=.55}%circlesize+circleoffset should be =1
6570 \ctikzset{bipoles/ooosource/circleoffset/.initial=.45}%circlesize+circleoffset should be =1
6571 \ctikzset{bipoles/ooosource/vectorgroupscale/.initial=1}
6572
6573 % % % primary windings
6574 \newif\ifpgf@circ@prim@delta
6575 \newif\ifpgf@circ@prim@wye
6576 \newif\ifpgf@circ@prim@eyw
6577 \newif\ifpgf@circ@prim@zig
6578 \pgfkeys{tikz/prim/.is choice}
6579 \pgfkeys{tikz/prim/delta/.add code={}{\pgf@circ@prim@deltatrue}}
6580 \pgfkeys{tikz/prim/wye/.add code={}{\pgf@circ@prim@wyetrue}}
6581 \pgfkeys{tikz/prim/eyw/.add code={}{\pgf@circ@prim@eywtrue}}
6582 \pgfkeys{tikz/prim/zig/.add code={}{\pgf@circ@prim@zigtrue}}
6583
6584 % % % secondary windings
6585 \newif\ifpgf@circ@sec@delta
6586 \newif\ifpgf@circ@sec@wye
6587 \newif\ifpgf@circ@sec@eyw
6588 \newif\ifpgf@circ@sec@zig
6589 \pgfkeys{tikz/sec/.is choice}
6590 \pgfkeys{tikz/sec/delta/.add code={}{\pgf@circ@sec@deltatrue}}
6591 \pgfkeys{tikz/sec/wye/.add code={}{\pgf@circ@sec@wyetrue}}
6592 \pgfkeys{tikz/sec/eyw/.add code={}{\pgf@circ@sec@eywtrue}}
6593 \pgfkeys{tikz/sec/zig/.add code={}{\pgf@circ@sec@zigtrue}}
6594
6595 % % % tertiary windings (ooosource)
6596 \newif\ifpgf@circ@tert@delta
6597 \newif\ifpgf@circ@tert@wye
6598 \newif\ifpgf@circ@tert@eyw
6599 \newif\ifpgf@circ@tert@zig
6600 \pgfkeys{tikz/tert/.is choice}
6601 \pgfkeys{tikz/tert/delta/.add code={}{\pgf@circ@tert@deltatrue}}
6602 \pgfkeys{tikz/tert/wye/.add code={}{\pgf@circ@tert@wyetrue}}
6603 \pgfkeys{tikz/tert/eyw/.add code={}{\pgf@circ@tert@eywtrue}}
6604 \pgfkeys{tikz/tert/zig/.add code={}{\pgf@circ@tert@zigtrue}}%
6605
6606 % nullator and norator
6607 \ctikzset{bipoles/nullator/height/.initial=.30}
6608 \ctikzset{bipoles/nullator/width/.initial=.60}
6609 \ctikzset{bipoles/norator/height/.initial=.25}
6610 \ctikzset{bipoles/norator/width/.initial=.60}%must be greater than 2*height
6611
6612 %%>>>
6613
6614 %% Nodes definitions for sources%<<<
6615
6616 %% Battery
6617 \pgfcircdeclarebipolescaled{batteries}
6618 {}
6619 {\ctikzvalof{bipoles/battery/height}}
6620 {battery}
6621 {\ctikzvalof{bipoles/battery/height}}
6622 {\ctikzvalof{bipoles/battery/width}}
6623 {
6624 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
6625 \divide \pgf@circ@res@step by 6
6626
6627 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6628
6629 \ifpgf@circ@fixbatteries
6630 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6631 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6632
6633 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@up}}
6634 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{\pgf@circ@res@down}}
6635
6636 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@up}}
6637 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.5\pgf@circ@res@down}}
6638
6639 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6640 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6641 \else
6642 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
6643 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
6644
6645 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
6646 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
6647
6648 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6649 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6650
6651 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6652 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6653 \fi
6654 \pgfusepath{draw}
6655 }
6656
6657
6658 %% Battery 1 % poles with equl thickness
6659
6660 \pgfcircdeclarebipolescaled{batteries}
6661 {}
6662 {\ctikzvalof{bipoles/battery1/height}}
6663 {battery1}
6664 {\ctikzvalof{bipoles/battery1/height}}
6665 {\ctikzvalof{bipoles/battery1/width}}
6666 {
6667 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
6668 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6669 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
6670 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6671 \pgfusepath{draw}
6672
6673 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6674 \ifpgf@circ@fixbatteries
6675 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
6676 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
6677
6678 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6679 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6680 \else
6681 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6682 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6683
6684 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
6685 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
6686 \fi
6687 \pgfusepath{draw}
6688 }
6689
6690 %% Battery 2 % negative pole thicker
6691
6692 \pgfcircdeclarebipolescaled{batteries}
6693 {}
6694 {\ctikzvalof{bipoles/battery2/height}}
6695 {battery2}
6696 {\ctikzvalof{bipoles/battery2/height}}
6697 {\ctikzvalof{bipoles/battery2/width}}
6698 {
6699 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
6700 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6701 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
6702 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6703 \pgfusepath{draw}
6704
6705 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6706 \ifpgf@circ@fixbatteries
6707 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
6708 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
6709 \pgfusepath{draw}
6710 \pgfsetlinewidth{3\pgflinewidth}
6711 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6712 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6713 \else
6714 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
6715 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
6716 \pgfusepath{draw}
6717 \pgfsetlinewidth{3\pgflinewidth}
6718 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6719 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6720 \fi
6721 \pgfusepath{draw}
6722 }
6723
6724 % Solar cell
6725 \pgfcircdeclarebipolescaled{batteries}
6726 {}
6727 {\ctikzvalof{bipoles/solar/height}}
6728 {solar}
6729 {\ctikzvalof{bipoles/solar/height}}
6730 {\ctikzvalof{bipoles/solar/width}}
6731 {
6732 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{0}}
6733 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6734 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{0}}
6735 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6736 \pgfusepath{draw}
6737
6738 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6739 \ifpgf@circ@fixbatteries
6740 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@up}}
6741 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{\pgf@circ@res@down}}
6742 \pgfusepath{draw}
6743 \pgfsetlinewidth{3\pgflinewidth}
6744 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6745 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6746 \else
6747 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@up}}
6748 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@left}{\pgf@circ@res@down}}
6749 \pgfusepath{draw}
6750 \pgfsetlinewidth{3\pgflinewidth}
6751 \pgfpathmoveto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@up}}
6752 \pgfpathlineto{\pgfpoint{.33\pgf@circ@res@right}{.5\pgf@circ@res@down}}
6753 \fi
6754
6755 \pgfusepath{draw}
6756 \pgf@circ@draw@pdarrows
6757 }
6758
6759 %%%
6760 %%% https://xkcd.com/2818/
6761 %%% Also https://chat.stackexchange.com/transcript/message/64238058#64238058
6762 %%%
6763 \pgfcircdeclarebipolescaled{batteries}
6764 {}
6765 {\ctikzvalof{bipoles/battery/height}}
6766 {baertty}
6767 {\ctikzvalof{bipoles/battery/height}}
6768 {\ctikzvalof{bipoles/battery/width}}
6769 {
6770 \pgf@circ@res@step = \ctikzvalof{bipoles/battery/width}\pgf@circ@scaled@Rlen
6771 \divide \pgf@circ@res@step by 6
6772 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6773 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
6774 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
6775 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@up}}
6776 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@step}{.5\pgf@circ@res@down}}
6777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
6779 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
6780 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
6781 \pgfusepath{draw}
6782 }
6783 \pgfcirc@activate@bipole@simple@opt{v}{baertty}{\circuitikzbasekey/bipole/is voltage=true,
6784 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
6785
6786 %%%%%%%%%%%
6787 %% Round and diamond sources
6788 %%%%%%%%%%%
6789
6790 % % % symbol drawing macros (NOT for delta, wye, eyw, zig)
6791 \def\pgf@circ@sources@symbol@setup{% called in a pgfscope
6792 \edef\@@@auto{auto}\edef\@@@rotate{\ctikzvalof{\ctikzclass/symbol/rotate}}
6793 \ifx\@@@auto\@@@rotate
6794 \pgfgettransformentries\a\b\temp\temp\temp\temp
6795 \pgfmathsetmacro{\@@@rotate}{-atan2(\b,\a)}
6796 \fi
6797 \pgftransformrotate{\@@@rotate}%
6798 \pgf@circ@set@relative@thickness{symbol/thickness}%
6799 }
6800
6801 %% Independent voltage source
6802 \pgfcircdeclarebipolescaled{sources}
6803 {}
6804 {\ctikzvalof{bipoles/vsource/height}}
6805 {vsource}
6806 {\ctikzvalof{bipoles/vsource/height}}
6807 {\ctikzvalof{bipoles/vsource/width}}
6808 {
6809
6810 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6811
6812 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6813 \pgf@circ@draworfill
6814 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
6815 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
6816 \pgfusepath{draw}
6817 }
6818
6819
6820 %% macros for the sources with plus and minus internally
6821 %% To change the internal symbols of the voltage source american style
6822 \ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
6823 % In the mayority of fonts, the size of - is smaller than +, so we have
6824 % unaligned signs when positioned independently.
6825 % See https://github.com/circuitikz/circuitikz/issues/721
6826 \ctikzset{bipoles/vsourceam/inner minus/.initial={$\vphantom{+}-$}}
6827 %%
6828 %% add the possibility to change the orientation of signs
6829 \ctikzset{sources/symbol/sign rotation/.initial=default}% default, auto, or value
6830 %% this should be more or less equivalent to \ctikzset{sources/symbol/sign rotation=90}, but it's font-dependent,
6831 %% so you never know. Let's keep the traditional one here.
6832 \def\pgf@circ@vsources@signs@default{%
6833 \ifpgf@circ@oldvoltagedirection
6834 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}%
6835 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}%
6836 \else
6837 \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}%
6838 \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}%
6839 \fi
6840 }
6841 \def\pgf@circ@vsources@sign@auto@or@fix{%
6842 \pgfgettransformentries\a\b\temp\temp\temp\temp
6843 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
6844 % the distance here is choosen so that it seems ok with standard fonts... probably, it must be changed.
6845 \pgfmathsetlength{\pgf@circ@res@temp}{%
6846 \ctikzvalof{bipoles/vsourceam/margin}*\pgf@circ@res@up
6847 -0.5*height("\ctikzvalof{bipoles/vsourceam/inner plus}")}
6848 \ifx\@@rotmode\@@auto
6849 \pgfmathsetmacro{\innerrot}{abs(\rot)<46?0:(abs(\rot)>134?0:90)}
6850 \else
6851 \ifx\@@rotmode\@@straight
6852 \pgfmathsetmacro{\innerrot}{\rot}
6853 \else
6854 \pgfmathsetmacro{\innerrot}{\@@rotmode}
6855 \fi
6856 \fi
6857 \ifpgf@circ@oldvoltagedirection
6858 \pgfscope
6859 \pgftransformxshift{\pgf@circ@res@temp}
6860 \pgftext[rotate=\innerrot]{\ctikzvalof{bipoles/vsourceam/inner plus}}
6861 \endpgfscope
6862 \pgfscope
6863 \pgftransformxshift{-\pgf@circ@res@temp}
6864 \pgftext[rotate=\innerrot]{\ctikzvalof{bipoles/vsourceam/inner minus}}
6865 \endpgfscope
6866 \else
6867 \pgfscope
6868 \pgftransformxshift{\pgf@circ@res@temp}
6869 \pgftext[rotate=\innerrot]{\ctikzvalof{bipoles/vsourceam/inner minus}}
6870 \endpgfscope
6871 \pgfscope
6872 \pgftransformxshift{-\pgf@circ@res@temp}
6873 \pgftext[rotate=\innerrot]{\ctikzvalof{bipoles/vsourceam/inner plus}}
6874 \endpgfscope
6875 \fi
6876 }
6877 \def\pgf@circ@vsources@draw@signs{%
6878 \edef\@@auto{auto}\edef\@@default{default}\edef\@@straight{straight}%
6879 \edef\@@rotmode{\ctikzvalof{sources/symbol/sign rotation}}%
6880 \ifx\@@rotmode\@@default
6881 \pgf@circ@vsources@signs@default
6882 \else
6883 \pgf@circ@vsources@sign@auto@or@fix
6884 \fi
6885 }
6886
6887 %% Independent voltage source - American style
6888 \pgfcircdeclarebipolescaled{sources}
6889 {}
6890 {\ctikzvalof{bipoles/vsourceam/height}}
6891 {vsourceAM}
6892 {\ctikzvalof{bipoles/vsourceam/height}}
6893 {\ctikzvalof{bipoles/vsourceam/width}}
6894 {
6895
6896 \pgfscope
6897 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6898 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6899 \pgf@circ@draworfill
6900 \endpgfscope
6901 \pgf@circ@text@strokecolor
6902 \pgf@circ@vsources@draw@signs
6903 }
6904
6905 %% Independent sinusoidal voltage source
6906 \pgfcircdeclarebipolescaled{sources}
6907 {}
6908 {\ctikzvalof{bipoles/vsourcesin/height}}
6909 {vsourcesin}
6910 {\ctikzvalof{bipoles/vsourcesin/height}}
6911 {\ctikzvalof{bipoles/vsourcesin/width}}
6912 {
6913
6914 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6915 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6916 \pgf@circ@draworfill
6917
6918 \pgf@circ@res@up = .5\pgf@circ@res@up
6919 \pgfscope
6920 \pgf@circ@sources@symbol@setup
6921 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
6922 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6923 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6924 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
6925 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
6926 \pgfusepath{draw}
6927 \endpgfscope
6928 }
6929
6930 % Square Voltage source - contributed by Alistair Kwan
6931 \pgfcircdeclarebipolescaled{sources}
6932 {}
6933 {\ctikzvalof{bipoles/vsourcesquare/height}}
6934 {vsourcesquare}
6935 {\ctikzvalof{bipoles/vsourcesquare/height}}
6936 {\ctikzvalof{bipoles/vsourcesquare/width}}
6937 {
6938 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6939 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6940 \pgf@circ@draworfill
6941 \pgf@circ@res@up = .5\pgf@circ@res@up
6942 \pgfscope
6943 \pgf@circ@sources@symbol@setup
6944 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
6945 \pgfpathlineto{\pgfpoint{-1\pgf@circ@res@up}{1\pgf@circ@res@up}}
6946 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{1\pgf@circ@res@up}}
6947 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@up}{-1\pgf@circ@res@up}}
6948 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{-1\pgf@circ@res@up}}
6949 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
6950 \pgfusepath{draw}
6951 \endpgfscope
6952 }
6953
6954 % Triangle Voltage source - contributed by Ralf Farkas
6955 \pgfcircdeclarebipolescaled{sources}
6956 {}
6957 {\ctikzvalof{bipoles/vsourcetri/height}}
6958 {vsourcetri}
6959 {\ctikzvalof{bipoles/vsourcetri/height}}
6960 {\ctikzvalof{bipoles/vsourcetri/width}}
6961 {
6962
6963 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6964 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6965 \pgf@circ@draworfill
6966
6967 \pgf@circ@res@up = .5\pgf@circ@res@up
6968 \pgfscope
6969 \pgf@circ@sources@symbol@setup
6970 \pgfpathmoveto{\pgfpoint{-1\pgf@circ@res@up}{0cm}}
6971 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@up}{0.75\pgf@circ@res@up}}
6972 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@up}{-0.75\pgf@circ@res@up}}
6973 \pgfpathlineto{\pgfpoint{1\pgf@circ@res@up}{0\pgf@circ@res@up}}
6974 \pgfusepath{draw}
6975 \endpgfscope
6976 }
6977
6978 %% PV Source
6979 \pgfcircdeclarebipolescaled{sources}
6980 {}
6981 {\ctikzvalof{bipoles/pvsource/height}}
6982 {pvsource}
6983 {\ctikzvalof{bipoles/pvsource/height}}
6984 {\ctikzvalof{bipoles/pvsource/width}}
6985 {
6986 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6987 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
6988 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
6989 \pgf@circ@draworfill
6990
6991 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{0}}
6992 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
6993 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{0}}
6994 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0}}
6995 \pgfusepath{draw}
6996
6997 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
6998 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@up}}
6999 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@left}{.4\pgf@circ@res@down}}
7000
7001 \pgfpathmoveto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@up}}
7002 \pgfpathlineto{\pgfpoint{.15\pgf@circ@res@right}{.6\pgf@circ@res@down}}
7003 \pgfusepath{draw}
7004
7005 %Arrow Part
7006 \pgfscope
7007 \pgfsetarrowsend{latex}
7008 \pgfpathmoveto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
7009 \pgfpathlineto{\pgfpointadd{\pgfpoint{.3\pgf@circ@res@left}{0}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
7010 \pgfusepath{draw}
7011 \pgfpathmoveto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{2.2\pgf@circ@res@up}}}
7012 \pgfpathlineto{\pgfpointadd{\pgfpoint{0}{0.3\pgf@circ@res@up}}{\pgfpointpolar{-45}{1.3\pgf@circ@res@up}}}
7013 \pgfusepath{draw}
7014 \endpgfscope
7015
7016 }
7017
7018 %% PV Module - contributed by Andre Alves
7019 \pgfcircdeclarebipolescaled{sources}
7020 {}
7021 {\ctikzvalof{bipoles/pvmodule/height}}
7022 {pvmodule}
7023 {\ctikzvalof{bipoles/pvmodule/height}}
7024 {\ctikzvalof{bipoles/pvmodule/width}}
7025 {
7026
7027 % Draw rectangle
7028 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7029 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7030 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7031 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7032 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7033 \pgfpathclose
7034 \pgf@circ@draworfill
7035
7036 % Draw triangle
7037 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7038 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0}}
7039 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7040 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
7041 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7042 \pgf@circ@draworfill
7043 \pgfusepath{draw}
7044 }
7045
7046 %% Empty Source
7047 \pgfcircdeclarebipolescaled{sources}
7048 {}
7049 {\ctikzvalof{bipoles/esource/height}}
7050 {esource}
7051 {\ctikzvalof{bipoles/esource/height}}
7052 {\ctikzvalof{bipoles/esource/width}}
7053 {
7054 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7055 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7056 \pgf@circ@draworfill
7057 }
7058
7059 %% DC Current Source with open shape
7060 \pgfcircdeclarebipolescaled{sources}
7061 {}
7062 {\ctikzvalof{bipoles/dcisource/height}}
7063 {dcisource}
7064 {\ctikzvalof{bipoles/dcisource/height}}
7065 {\ctikzvalof{bipoles/dcisource/width}}
7066 {
7067 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7068 \pgfpathmoveto{\pgfpointorigin}
7069 \pgfscope
7070 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7071 \pgf@circ@maybefill
7072 \endpgfscope
7073 \edef\@@angle{\ctikzvalof{bipoles/dcisource/angle}}
7074 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
7075 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
7076 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
7077 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
7078 \pgfusepath{draw}
7079
7080 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
7081 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
7082 \pgfusepath{draw}
7083 \pgfscope
7084 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
7085 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
7086 \endpgfscope
7087 }
7088
7089 %% DC-Voltage source
7090 \pgfcircdeclarebipolescaled{sources}
7091 {}
7092 {\ctikzvalof{bipoles/dcvsource/height}}
7093 {dcvsource}
7094 {\ctikzvalof{bipoles/dcvsource/height}}
7095 {\ctikzvalof{bipoles/dcvsource/width}}
7096 {
7097 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7098 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7099 \pgf@circ@draworfill
7100 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@left}}
7101 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{.5\pgf@circ@res@right}}
7102 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@left}}
7103 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@down}{.5\pgf@circ@res@right}}
7104 \pgfusepath{draw}
7105 }
7106
7107 %% Independent current source
7108 \pgfcircdeclarebipolescaled{sources}
7109 {}
7110 {\ctikzvalof{bipoles/isource/height}}
7111 {isource}
7112 {\ctikzvalof{bipoles/isource/height}}
7113 {\ctikzvalof{bipoles/isource/width}}
7114 {
7115 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7116 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7117 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@up}}
7118 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
7119 \pgf@circ@draworfill
7120 }
7121
7122 %% Independent double oo source
7123 \pgfcircdeclarebipolescaled{sources}
7124 {
7125 \anchor{centerprim}{
7126 \northeast
7127 \pgf@y=0pt\relax
7128 \pgf@x=-\ctikzvalof{bipoles/oosource/circleoffset}\pgf@x
7129 }
7130 \anchor{centersec}{
7131 \northeast
7132 \pgf@y=0pt\relax
7133 \pgf@x=\ctikzvalof{bipoles/oosource/circleoffset}\pgf@x
7134 }
7135 }
7136 {\ctikzvalof{bipoles/oosource/height}}
7137 {oosource}
7138 {\ctikzvalof{bipoles/oosource/height}}
7139 {\ctikzvalof{bipoles/oosource/width}}
7140 {
7141 % the offset is relative to the width (...@left/@right), and the size to the height (...@up/@down)
7142 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7143 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
7144 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@up}
7145 \pgf@circ@maybefill
7146 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@right}{0}}
7147 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@up}
7148 \pgf@circ@draworfill
7149 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosource/circleoffset}\pgf@circ@res@left}{0}}
7150 {\ctikzvalof{bipoles/oosource/circlesize}\pgf@circ@res@up}
7151 \pgfusepath{draw}
7152 }
7153
7154 % % % winding symbols
7155 \ctikzset{sources/symbol/delta scale/.initial={1}}
7156 \ctikzset{sources/symbol/wye scale/.initial={1}}
7157 \ctikzset{sources/symbol/eyw scale/.initial={1}}
7158 \ctikzset{sources/symbol/zig scale/.initial={1}}
7159 % Notice that the scale of the symbol should go with the size of the circle, which in the oo-type
7160 % components is linked to the .../height key, which translates in ...res@up and ...res@down
7161 % triangle
7162 \def\pgf@circ@delta#1{
7163 \pgfscope
7164 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/delta scale}*\pgf@circ@res@up*#1}
7165 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7166 \pgftransformrotate{-\pgfcircmathresult}
7167
7168 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7169 \pgf@circ@set@relative@thickness{symbol/thickness}
7170 % \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
7171 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7172 % \pgfpathlineto{\pgfpoint{0}{.866\pgf@circ@res@up}}
7173 \pgfpathmoveto{\pgfpointpolar{90}{\pgf@circ@res@up}}
7174 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@up}}
7175 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@up}}
7176 \pgfpathclose
7177 \pgfusepath{stroke}
7178 \endpgfscope
7179 }
7180 % star
7181 \def\pgf@circ@wye#1{
7182 \pgfscope
7183 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/wye scale}*\pgf@circ@res@up*#1}
7184 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7185 \pgftransformrotate{-\pgfcircmathresult}
7186
7187 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7188 \pgf@circ@set@relative@thickness{symbol/thickness}
7189 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@down}}
7190 \pgfpathlineto{\pgfpointorigin}
7191 \pgfpathlineto{\pgfpointpolar{-30}{\pgf@circ@res@down}}
7192 \pgfpathmoveto{\pgfpointorigin}
7193 \pgfpathlineto{\pgfpointpolar{-150}{\pgf@circ@res@down}}
7194 \pgfusepath{stroke}
7195 \endpgfscope
7196 }
7197 % reverse star
7198 \def\pgf@circ@eyw#1{
7199 \pgfscope
7200 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/eyw scale}*\pgf@circ@res@up*#1}
7201 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7202 \pgftransformrotate{-\pgfcircmathresult}
7203
7204 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7205 \pgf@circ@set@relative@thickness{symbol/thickness}
7206 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
7207 \pgfpathlineto{\pgfpointorigin}
7208 \pgfpathlineto{\pgfpointpolar{30}{\pgf@circ@res@down}}
7209 \pgfpathmoveto{\pgfpointorigin}
7210 \pgfpathlineto{\pgfpointpolar{150}{\pgf@circ@res@down}}
7211 \pgfusepath{stroke}
7212 \endpgfscope
7213 }
7214 % zigzag
7215 \def\pgf@circ@zig#1{
7216 \pgfscope
7217 \pgftransformscale{-.015*\ctikzvalof{\ctikzclass/symbol/zig scale}*\pgf@circ@res@up*#1}
7218 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
7219 \pgftransformrotate{-\pgfcircmathresult}
7220
7221 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7222 \pgf@circ@set@relative@thickness{symbol/thickness}
7223 \pgfpathmoveto{\pgfpointorigin}
7224 \pgfpathlineto{\pgfpointpolar{90}{.5\pgf@circ@res@up}}
7225 \pgfpathlineto{\pgfpointpolar{60}{\pgf@circ@res@up}}
7226
7227 \pgfpathmoveto{\pgfpointorigin}
7228 \pgfpathlineto{\pgfpointpolar{210}{.5\pgf@circ@res@up}}
7229 \pgfpathlineto{\pgfpointpolar{0}{\pgf@circ@res@down}}
7230
7231 \pgfpathmoveto{\pgfpointorigin}
7232 \pgfpathlineto{\pgfpointpolar{330}{.5\pgf@circ@res@up}}
7233 \pgfpathlineto{\pgfpointpolar{-60}{\pgf@circ@res@up}}
7234 \pgfusepath{stroke}
7235 \endpgfscope
7236 }
7237 % % % % round three-phase auto transformer
7238 \pgfcircdeclarebipolescaled{sources}
7239 {
7240 \anchor{centerprim}{
7241 \northeast
7242 \advance\pgf@x by -\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@y
7243 \pgf@y=0pt\relax
7244 }
7245 \anchor{symbolprim}{
7246 \northeast
7247 \advance\pgf@x by -\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@y
7248 \pgf@y=0pt\relax
7249 }
7250 }
7251 {\ctikzvalof{bipoles/oosourceatrans/height}}
7252 {oosourceatrans}
7253 {\ctikzvalof{bipoles/oosourceatrans/height}}
7254 {\ctikzvalof{bipoles/oosourceatrans/width}}
7255 {
7256 % we do not use the offset here; the circle is "seated" to the right side
7257 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7258 \pgf@circ@res@other=\dimexpr\pgf@circ@res@right-\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@circ@res@up\relax
7259 \pgfpathcircle{\pgfpoint{\pgf@circ@res@other}{0}}
7260 {\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@circ@res@up}
7261 \pgf@circ@draworfill
7262 % draw arc
7263 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}%
7264 {\ctikzvalof{bipoles/oosourceatrans/circlesize}*\pgf@circ@res@up}}
7265 \pgfpathcurveto{\pgfpoint{0.3\pgf@circ@res@left}{\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@circ@res@up}}
7266 {\pgfpoint{0.5\pgf@circ@res@left}{\ctikzvalof{bipoles/oosourceatrans/circlesize}\pgf@circ@res@up}}
7267 {\pgfpoint{\pgf@circ@res@left}{0}}
7268 \pgfusepath{draw}
7269 % % % % draw inner symbols
7270 %%only (primary) winding
7271 \ifpgf@circ@prim@delta
7272 \pgfscope
7273 \pgftransformxshift{\pgf@circ@res@other}
7274 \pgf@circ@delta{\ctikzvalof{bipoles/oosourceatrans/vectorgroupscale}}
7275 \endpgfscope
7276
7277 \else\ifpgf@circ@prim@wye
7278 \pgfscope
7279 \pgftransformxshift{\pgf@circ@res@other}
7280 \pgf@circ@wye{\ctikzvalof{bipoles/oosourceatrans/vectorgroupscale}}
7281 \endpgfscope
7282
7283 \else\ifpgf@circ@prim@eyw
7284 \pgfscope
7285 \pgftransformxshift{\pgf@circ@res@other}
7286 \pgf@circ@eyw{\ctikzvalof{bipoles/oosourceatrans/vectorgroupscale}}
7287 \endpgfscope
7288
7289 \else\ifpgf@circ@prim@zig
7290 \pgfscope
7291 \pgftransformxshift{\pgf@circ@res@other}
7292 \pgf@circ@zig{\ctikzvalof{bipoles/oosourceatrans/vectorgroupscale}}
7293 \endpgfscope
7294 \fi\fi\fi\fi
7295 }
7296 % % % % round three-phase transformer
7297 \pgfcircdeclarebipolescaled{sources}
7298 {
7299 \anchor{centerprim}{
7300 \northeast
7301 \pgf@y=0pt\relax
7302 \pgf@x=-\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@x
7303 }
7304 \anchor{centersec}{
7305 \northeast
7306 \pgf@y=0pt\relax
7307 \pgf@x=\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@x
7308 }
7309 \anchor{symbolprim}{
7310 \northeast
7311 \pgf@y=0pt\relax
7312 \pgf@x=-\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@x
7313 }
7314 \anchor{symbolsec}{
7315 \northeast
7316 \pgf@y=0pt\relax
7317 \pgf@x=\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@x
7318 }
7319 }
7320 {\ctikzvalof{bipoles/oosourcetrans/height}}
7321 {oosourcetrans}
7322 {\ctikzvalof{bipoles/oosourcetrans/height}}
7323 {\ctikzvalof{bipoles/oosourcetrans/width}}
7324 {
7325 % the offset is relative to the width (...@left/@right), and the size to the height (...@up/@down)
7326 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7327 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
7328 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@up}
7329 \pgf@circ@maybefill
7330 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@right}{0}}
7331 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@up}
7332 \pgf@circ@draworfill
7333 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/oosourcetrans/circleoffset}\pgf@circ@res@left}{0}}
7334 {\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@up}
7335 \pgfusepath{draw}
7336 % % % % draw inner symbols
7337 %%primary winding
7338 \ifpgf@circ@prim@delta
7339 \pgfscope
7340 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
7341 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7342 \endpgfscope
7343
7344 \else\ifpgf@circ@prim@wye
7345 \pgfscope
7346 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
7347 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7348 \endpgfscope
7349
7350 \else\ifpgf@circ@prim@eyw
7351 \pgfscope
7352 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
7353 \pgf@circ@eyw{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7354 \endpgfscope
7355
7356 \else\ifpgf@circ@prim@zig
7357 \pgfscope
7358 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@left}
7359 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7360 \endpgfscope
7361 \fi\fi\fi\fi
7362
7363 %%secondary winding
7364 \ifpgf@circ@sec@delta
7365 \pgfscope
7366 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
7367 \pgf@circ@delta{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7368 \endpgfscope
7369
7370 \else\ifpgf@circ@sec@wye
7371 \pgfscope
7372 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
7373 \pgf@circ@wye{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7374 \endpgfscope
7375
7376 \else\ifpgf@circ@sec@eyw
7377 \pgfscope
7378 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
7379 \pgf@circ@eyw{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7380 \endpgfscope
7381
7382 \else\ifpgf@circ@sec@zig
7383 \pgfscope
7384 \pgftransformxshift{\ctikzvalof{bipoles/oosourcetrans/circlesize}\pgf@circ@res@right}
7385 \pgf@circ@zig{\ctikzvalof{bipoles/oosourcetrans/vectorgroupscale}}
7386 \endpgfscope
7387 \fi\fi\fi\fi
7388 }
7389 % % % % ooosource for three phase transformer
7390 % This component is 3-way symmetric. It uses ONLY bipoles/ooosource/height for sizing
7391 \pgfcircdeclarebipolescaled{sources}
7392 {
7393 \anchor{right}{
7394 \northeast
7395 \pgf@y=0pt
7396 \pgfmathparse{
7397 \ctikzvalof{bipoles/ooosource/circleoffset}* sin(30) +
7398 %%the sqrt must be > 0, the circles have to intersect
7399 sqrt(
7400 pow(\ctikzvalof{bipoles/ooosource/circlesize},2) -
7401 pow(\ctikzvalof{bipoles/ooosource/circleoffset}*cos(30),2)
7402 )
7403 }
7404 \pgf@x=\pgfmathresult\pgf@x
7405 }
7406 \anchor{east}{
7407 \northeast
7408 \pgf@y=0pt
7409 }
7410 \savedanchor{\centerprim}{
7411 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7412 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7413 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
7414 \pgf@y=0pt
7415 \pgf@x=.5\pgf@circ@res@other
7416 }
7417 \anchor{centerprim}{
7418 \centerprim
7419 }
7420 \savedanchor{\centersec}{
7421 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7422 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7423 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
7424 \pgfpointpolar{60}{.5\pgf@circ@res@other}
7425 \pgf@y=-\pgf@y
7426 \pgf@x=-\pgf@x
7427 }
7428 \anchor{centersec}{
7429 \centersec
7430 }
7431 \savedanchor{\centertert}{
7432 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7433 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7434 \pgf@circ@res@other=-\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@other
7435 \pgfpointpolar{60}{.5\pgf@circ@res@other}
7436 \pgf@y=\pgf@y
7437 \pgf@x=-\pgf@x
7438 }
7439 \anchor{centertert}{
7440 \centertert
7441 }
7442 % add some anchors in case the are needed :)
7443 \anchor{prim1}{
7444 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7445 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7446 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7447 \pgfpointadd{\centerprim}{\pgfpointpolar{135}{.5\pgf@circ@res@other}}
7448 }
7449 \anchor{prim2}{
7450 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7451 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7452 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7453 \pgfpointadd{\centerprim}{\pgfpointpolar{-135}{.5\pgf@circ@res@other}}
7454 }
7455 \anchor{sec1}{
7456 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7457 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7458 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7459 \pgfpointadd{\centersec}{\pgfpointpolar{0}{.5\pgf@circ@res@other}}
7460 }
7461 \anchor{sec2}{
7462 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7463 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7464 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7465 \pgfpointadd{\centersec}{\pgfpointpolar{45}{.5\pgf@circ@res@other}}
7466 }
7467 \anchor{sec3}{
7468 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7469 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7470 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7471 \pgfpointadd{\centersec}{\pgfpointpolar{90}{.5\pgf@circ@res@other}}
7472 }
7473 \anchor{tert1}{
7474 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7475 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7476 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7477 \pgfpointadd{\centertert}{\pgfpointpolar{0}{.5\pgf@circ@res@other}}
7478 }
7479 \anchor{tert2}{
7480 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7481 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7482 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7483 \pgfpointadd{\centertert}{\pgfpointpolar{-45}{.5\pgf@circ@res@other}}
7484 }
7485 \anchor{tert3}{
7486 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
7487 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/height}\pgf@circ@scaled@Rlen
7488 \pgf@circ@res@other=\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@other
7489 \pgfpointadd{\centertert}{\pgfpointpolar{-90}{.5\pgf@circ@res@other}}
7490 }
7491 % symbol "center" anchors
7492 \anchor{symbolprim}{
7493 \northeast
7494 \pgf@y=0pt
7495 \pgf@x=-0.6\pgf@x
7496 }
7497 \anchor{symbolsec}{
7498 \northeast
7499 \pgf@ya=\pgf@y
7500 \pgf@xa=\pgf@x
7501 \pgfpointpolar{60}{0.6\pgf@ya}
7502 }
7503 \anchor{symboltert}{
7504 \northeast
7505 \pgf@ya=\pgf@y
7506 \pgf@xa=\pgf@x
7507 \pgfpointpolar{-60}{0.6\pgf@ya}
7508 }
7509 }
7510 {\ctikzvalof{bipoles/ooosource/height}}
7511 {ooosource}
7512 {\ctikzvalof{bipoles/ooosource/height}}
7513 {\ctikzvalof{bipoles/ooosource/height}}% Notice that here right=down and left=up
7514 {
7515 % % filling
7516 % left
7517 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7518 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
7519 \pgf@circ@maybefill
7520
7521 % up
7522 \pgfscope
7523 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
7524 \pgf@circ@maybefill
7525 \endpgfscope
7526 % down
7527 \pgfscope
7528 \pgfpathcircle{\pgfpointpolar{-60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
7529 \pgf@circ@draworfill
7530 \endpgfscope
7531
7532 % drawing
7533 % left
7534 \pgfpathcircle{\pgfpoint{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@left}{0}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@left}
7535 \pgfusepath{draw}
7536
7537 % up
7538 \pgfscope
7539 \pgfpathcircle{\pgfpointpolar{60}{\ctikzvalof{bipoles/ooosource/circleoffset}\pgf@circ@res@right}}{\ctikzvalof{bipoles/ooosource/circlesize}\pgf@circ@res@right}
7540 \pgfusepath{draw}
7541 \endpgfscope
7542
7543 % % % draw inner symbols
7544
7545 % % primary winding
7546 \ifpgf@circ@prim@delta
7547 \pgfscope
7548 \pgftransformxshift{.6\pgf@circ@res@left}
7549 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7550 \endpgfscope
7551
7552 \else\ifpgf@circ@prim@wye
7553 \pgfscope
7554 \pgftransformxshift{.6\pgf@circ@res@left}
7555 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7556 \endpgfscope
7557
7558 \else\ifpgf@circ@prim@eyw
7559 \pgfscope
7560 \pgftransformxshift{.6\pgf@circ@res@left}
7561 \pgf@circ@eyw{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7562 \endpgfscope
7563
7564 \else\ifpgf@circ@prim@zig
7565 \pgfscope
7566 \pgftransformxshift{.6\pgf@circ@res@left}
7567 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7568 \endpgfscope
7569 \fi\fi\fi\fi
7570
7571 % % secondary winding
7572 \ifpgf@circ@sec@delta
7573 \pgfscope
7574 \pgftransformshift{\pgfpointpolar{60}{0.6\pgf@circ@res@right}}
7575 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7576 \endpgfscope
7577
7578 \else\ifpgf@circ@sec@wye
7579 \pgfscope
7580 \pgftransformshift{\pgfpointpolar{60}{0.6\pgf@circ@res@right}}
7581 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7582 \endpgfscope
7583
7584 \else\ifpgf@circ@sec@eyw
7585 \pgfscope
7586 \pgftransformshift{\pgfpointpolar{60}{0.6\pgf@circ@res@right}}
7587 \pgf@circ@eyw{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7588 \endpgfscope
7589
7590 \else\ifpgf@circ@sec@zig
7591 \pgfscope
7592 \pgftransformshift{\pgfpointpolar{60}{0.6\pgf@circ@res@right}}
7593 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7594 \endpgfscope
7595 \fi\fi\fi\fi
7596
7597 % % tertiary winding
7598 \ifpgf@circ@tert@delta
7599 \pgfscope
7600 \pgftransformshift{\pgfpointpolar{-60}{0.6\pgf@circ@res@right}}
7601 \pgf@circ@delta{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7602 \endpgfscope
7603
7604 \else\ifpgf@circ@tert@wye
7605 \pgfscope
7606 \pgftransformshift{\pgfpointpolar{-60}{0.6\pgf@circ@res@right}}
7607 \pgf@circ@wye{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7608 \endpgfscope
7609
7610 \else\ifpgf@circ@tert@eyw
7611 \pgfscope
7612 \pgftransformshift{\pgfpointpolar{-60}{0.6\pgf@circ@res@right}}
7613 \pgf@circ@eyw{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7614 \endpgfscope
7615
7616 \else\ifpgf@circ@tert@zig
7617 \pgfscope
7618 \pgftransformshift{\pgfpointpolar{-60}{0.6\pgf@circ@res@right}}
7619 \pgf@circ@zig{\ctikzvalof{bipoles/ooosource/vectorgroupscale}}
7620 \endpgfscope
7621 \fi\fi\fi\fi
7622 }
7623
7624 %% Independent current source - American
7625 \pgfcircdeclarebipolescaled{sources}
7626 {}
7627 {\ctikzvalof{bipoles/isourceam/height}}
7628 {isourceAM}
7629 {\ctikzvalof{bipoles/isourceam/height}}
7630 {\ctikzvalof{bipoles/isourceam/width}}
7631 {
7632 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7633 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7634 \pgf@circ@draworfill
7635
7636 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
7637 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
7638 \pgfusepath{draw}
7639 \pgfscope
7640 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
7641 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
7642 \endpgfscope
7643 }
7644
7645 %% Independent sinusoidal current source with open shape
7646 \pgfcircdeclarebipolescaled{sources}
7647 {}
7648 {\ctikzvalof{bipoles/isource/height}}
7649 {isourcesin}
7650 {\ctikzvalof{bipoles/isource/height}}
7651 {\ctikzvalof{bipoles/isource/width}}
7652 {
7653 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7654 \pgfscope
7655 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7656 \pgf@circ@maybefill
7657 \endpgfscope
7658 \edef\@@angle{\ctikzvalof{bipoles/isourcesin/angle}}
7659 \pgfpathmoveto{\pgfpointpolar{\@@angle}{\pgf@circ@res@up}}
7660 \pgfpatharc{\@@angle}{-\@@angle}{\pgf@circ@res@up}
7661 \pgfpathmoveto{\pgfpointpolar{180-\@@angle}{\pgf@circ@res@up}}
7662 \pgfpatharc{180-\@@angle}{180+\@@angle}{\pgf@circ@res@up}
7663 \pgfusepath{draw}
7664
7665 \pgf@circ@res@up = .5\pgf@circ@res@up
7666 \pgfscope
7667 \pgf@circ@sources@symbol@setup
7668 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
7669 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7670 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7671 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7672 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7673 \pgfusepath{draw}
7674 \endpgfscope
7675 }
7676
7677 %% Empty controlled source
7678 \pgfcircdeclarebipolescaled{csources}
7679 {}
7680 {\ctikzvalof{bipoles/ecsource/height}}
7681 {ecsource}
7682 {\ctikzvalof{bipoles/ecsource/height}}
7683 {\ctikzvalof{bipoles/ecsource/width}}
7684 {
7685
7686 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7687
7688 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7689 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7690 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7691 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7692 \pgfpathclose
7693 \pgf@circ@draworfill
7694 }
7695
7696 %% Controlled voltage source
7697 \pgfcircdeclarebipolescaled{csources}
7698 {}
7699 {\ctikzvalof{bipoles/cvsource/height}}
7700 {cvsource}
7701 {\ctikzvalof{bipoles/cvsource/height}}
7702 {\ctikzvalof{bipoles/cvsource/width}}
7703 {
7704
7705 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7706
7707 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7708 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7709 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7710 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7711 \pgfpathclose
7712 \pgf@circ@draworfill
7713
7714 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7715 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7716 \pgfusepath{draw}
7717 }
7718
7719 %% To change the internal symbols of the controlled voltage source american style
7720 \ctikzset{bipoles/cvsourceam/inner plus/.initial={$+$}}
7721 % In the mayority of fonts, the size of - is smaller than +, so we have
7722 % unaligned signs when positioned independently.
7723 % See https://github.com/circuitikz/circuitikz/issues/721
7724 \ctikzset{bipoles/cvsourceam/inner minus/.initial={$\vphantom{+}-$}}
7725 %% Controlled voltage source - American
7726 \pgfcircdeclarebipolescaled{csources}
7727 {}
7728 {\ctikzvalof{bipoles/cvsourceam/height}}
7729 {cvsourceAM}
7730 {\ctikzvalof{bipoles/cvsourceam/height}}
7731 {\ctikzvalof{bipoles/cvsourceam/width}}
7732 {
7733 \pgfscope
7734 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7735 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7736 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7737 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7738 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7739 \pgfpathclose
7740 \pgf@circ@draworfill
7741 \endpgfscope
7742 \pgf@circ@text@strokecolor
7743 \pgf@circ@vsources@draw@signs
7744 }
7745
7746 %% Controlled sinusoidal voltage source
7747 \pgfcircdeclarebipolescaled{csources}
7748 {}
7749 {\ctikzvalof{bipoles/cvsourcesin/height}}
7750 {cvsourcesin}
7751 {\ctikzvalof{bipoles/cvsourcesin/height}}
7752 {\ctikzvalof{bipoles/cvsourcesin/width}}
7753 {
7754
7755 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7756
7757 \pgfscope
7758 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7759 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7760 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7761 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7762 \pgfpathclose
7763 \pgf@circ@draworfill
7764 \endpgfscope
7765
7766 \pgf@circ@res@up = .5\pgf@circ@res@up
7767 \pgfscope
7768 \pgf@circ@sources@symbol@setup
7769 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
7770 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7771 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7772 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7773 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7774 \pgfusepath{draw}
7775 \endpgfscope
7776 }
7777
7778 %% Controlled sinusoidal current source
7779 \pgfcircdeclarebipolescaled{csources}
7780 {}
7781 {\ctikzvalof{bipoles/cvsourcesin/height}}
7782 {cisourcesin}
7783 {\ctikzvalof{bipoles/cvsourcesin/height}}
7784 {\ctikzvalof{bipoles/cvsourcesin/width}}
7785 {
7786
7787 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7788
7789 \pgfscope
7790 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7791 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7792 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7793 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7794 \pgfpathclose
7795 \pgf@circ@draworfill
7796 \endpgfscope
7797
7798 \pgf@circ@res@up = .5\pgf@circ@res@up
7799 \pgfscope
7800 \pgf@circ@sources@symbol@setup
7801 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@up}{0cm}}
7802 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7803 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7804 \pgfpathsine{\pgfpoint{.5\pgf@circ@res@up}{-.5\pgf@circ@res@up}}
7805 \pgfpathcosine{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
7806 \pgfusepath{draw}
7807 \endpgfscope
7808 }
7809
7810 %% Controlled current source
7811 \pgfcircdeclarebipolescaled{csources}
7812 {}
7813 {\ctikzvalof{bipoles/cisource/height}}
7814 {cisource}
7815 {\ctikzvalof{bipoles/cisource/height}}
7816 {\ctikzvalof{bipoles/cisource/width}}
7817 {
7818
7819 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7820
7821 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7822 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7823 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7824 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7825 \pgfpathclose
7826 \pgf@circ@draworfill
7827
7828 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7829 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7830 \pgfusepath{draw}
7831 }
7832
7833 %% Controlled current source - American
7834 \pgfcircdeclarebipolescaled{csources}
7835 {}
7836 {\ctikzvalof{bipoles/cisourceam/height}}
7837 {cisourceAM}
7838 {\ctikzvalof{bipoles/cisourceam/height}}
7839 {\ctikzvalof{bipoles/cisourceam/width}}
7840 {
7841 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7842
7843 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7844 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7845 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7846 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7847 \pgfpathclose
7848 \pgf@circ@draworfill
7849 \pgfpathmoveto{\pgfpoint{.7\pgf@circ@res@left}{\pgf@circ@res@zero}}
7850 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@zero}}
7851 \pgfusepath{draw}
7852 \pgfscope
7853 \pgftransformshift{\pgfpoint{.5\pgf@circ@res@right}{\pgf@circ@res@zero}}
7854 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
7855 \endpgfscope
7856 }
7857
7858 %% Cute Independent voltage source
7859 \pgfcircdeclarebipolescaled{sources}
7860 {}
7861 {\ctikzvalof{bipoles/vsource/height}}
7862 {vsourceC}
7863 {\ctikzvalof{bipoles/vsource/height}}
7864 {\ctikzvalof{bipoles/vsource/width}}
7865 {
7866 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7867 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7868 \pgf@circ@draworfill
7869 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7870 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7871 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
7872 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
7873 \pgfsetroundcap\pgfusepath{draw}
7874 }
7875
7876 %% Cute Independent current source
7877 \pgfcircdeclarebipolescaled{sources}
7878 {}
7879 {\ctikzvalof{bipoles/isource/height}}
7880 {isourceC}
7881 {\ctikzvalof{bipoles/isource/height}}
7882 {\ctikzvalof{bipoles/isource/width}}
7883 {
7884 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7885 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7886 \pgf@circ@draworfill
7887 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7888 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7889 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
7890 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
7891 \pgfsetroundcap\pgfusepath{draw}
7892 }
7893
7894 %% Cute Controlled voltage source
7895 \pgfcircdeclarebipolescaled{csources}
7896 {}
7897 {\ctikzvalof{bipoles/cvsource/height}}
7898 {cvsourceC}
7899 {\ctikzvalof{bipoles/cvsource/height}}
7900 {\ctikzvalof{bipoles/cvsource/width}}
7901 {
7902 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7903 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7904 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7905 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7906 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7907 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7908 \pgf@circ@draworfill
7909 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7910 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7911 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
7912 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
7913 \pgfsetroundcap\pgfusepath{draw}
7914 }
7915
7916 %% Cute Controlled current source
7917 \pgfcircdeclarebipolescaled{csources}
7918 {}
7919 {\ctikzvalof{bipoles/cisource/height}}
7920 {cisourceC}
7921 {\ctikzvalof{bipoles/cisource/height}}
7922 {\ctikzvalof{bipoles/cisource/width}}
7923 {
7924 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7925 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7926 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
7927 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
7928 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@down}}
7929 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
7930 \pgf@circ@draworfill
7931 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7932 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7933 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@up}}
7934 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{.6\pgf@circ@res@down}}
7935 \pgfsetroundcap\pgfusepath{draw}
7936 }
7937
7938 %% Noise voltage source
7939 \pgfcircdeclarebipolescaled{sources}
7940 {}
7941 {\ctikzvalof{bipoles/vsource/height}}
7942 {vsourceN}
7943 {\ctikzvalof{bipoles/vsource/height}}
7944 {\ctikzvalof{bipoles/vsource/width}}
7945 {
7946 \pgfscope
7947 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
7948 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
7949 %
7950 \pgf@circ@scaled@Rlen=\scaledRlen
7951 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
7952 \edef\pgf@noise@temp{dashed}
7953 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
7954 \ifx\pgf@noise@temp\pgf@noise@fill
7955 % fillable in this case
7956 \pgf@circ@draworfillandclip
7957 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
7958 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
7959 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7960 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7961 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7962 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7963 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7964 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7965 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7966 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7967 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
7968 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7969 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7970 %
7971 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
7972 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7973 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7974 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
7975 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7976 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7977 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
7978 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
7979 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
7980 \pgfusepath{draw}
7981 \else
7982 \pgfsetfillcolor{\pgf@noise@fill}
7983 \pgfusepath{draw,fill}
7984 \fi
7985 \endpgfscope
7986 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
7987 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
7988 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@zero}}
7989 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@zero}}
7990 \pgfsetroundcap\pgfusepath{draw}
7991 }
7992 %% Noise current source
7993
7994 \pgfcircdeclarebipolescaled{sources}
7995 {}
7996 {\ctikzvalof{bipoles/isource/height}}
7997 {isourceN}
7998 {\ctikzvalof{bipoles/isource/height}}
7999 {\ctikzvalof{bipoles/isource/width}}
8000 {
8001 \pgfscope
8002 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8003 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8004 %
8005 \pgf@circ@scaled@Rlen=\scaledRlen
8006 \pgf@circ@res@step=0.125\pgf@circ@scaled@Rlen\relax
8007 \edef\pgf@noise@temp{dashed}
8008 \edef\pgf@noise@fill{\ctikzvalof{bipoles/noise sources/fillcolor}}
8009 \ifx\pgf@noise@temp\pgf@noise@fill
8010 % fillable in this case
8011 \pgf@circ@draworfillandclip
8012 \pgfmathsetmacro{\@@thinner}{.5*\ctikzvalof{bipoles/thickness}}
8013 \pgfsetlinewidth{\@@thinner\pgfstartlinewidth}
8014 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8015 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8016 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
8017 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8018 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8019 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
8020 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8021 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8022 \advance\pgf@circ@res@up by \pgf@circ@res@step\advance\pgf@circ@res@down by \pgf@circ@res@step
8023 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8024 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8025 %
8026 \advance\pgf@circ@res@up by -4\pgf@circ@res@step \advance\pgf@circ@res@down by -4\pgf@circ@res@step
8027 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8028 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8029 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
8030 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8031 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8032 \advance\pgf@circ@res@up by -\pgf@circ@res@step\advance\pgf@circ@res@down by -\pgf@circ@res@step
8033 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8034 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8035 \pgfusepath{draw}
8036 \else
8037 \pgfsetfillcolor{\pgf@noise@fill}
8038 \pgfusepath{draw,fill}
8039 \fi
8040 \endpgfscope
8041 \pgfmathsetmacro{\@@thicker}{3*\ctikzvalof{bipoles/thickness}}
8042 \pgfsetlinewidth{\@@thicker\pgfstartlinewidth}
8043 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@up}}
8044 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{.6\pgf@circ@res@down}}
8045 \pgfsetroundcap\pgfusepath{draw}
8046 }
8047
8048 % nullator
8049 \pgfcircdeclarebipolescaled{sources}
8050 {}
8051 {\ctikzvalof{bipoles/nullator/height}}
8052 {nullator}
8053 {\ctikzvalof{bipoles/nullator/height}}
8054 {\ctikzvalof{bipoles/nullator/width}}
8055 {
8056 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8057 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
8058 \pgf@circ@draworfill
8059 }
8060 % norator
8061 \pgfcircdeclarebipolescaled{sources}
8062 {}
8063 {\ctikzvalof{bipoles/norator/height}}
8064 {norator}
8065 {\ctikzvalof{bipoles/norator/height}}
8066 {\ctikzvalof{bipoles/norator/width}}
8067 {
8068 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8069 \pgf@circ@res@other=\dimexpr\pgf@circ@res@right-\pgf@circ@res@up\relax
8070 \pgfmathsetmacro{\@@angle}{atan2(\pgf@circ@res@other,\pgf@circ@res@up)}
8071 % \typeout{ANGLE\space\@@angle}
8072 \pgfmathsetlength{\pgf@circ@res@step}{\pgf@circ@res@up*cos(\@@angle)}
8073 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up*sin(\@@angle)}
8074 % right semicircle
8075 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgf@circ@res@temp}}
8076 \pgfpatharc{180-\@@angle}{-180+\@@angle}{\pgf@circ@res@up}
8077 % connect to left semicircle
8078 \pgfpathlineto
8079 {\pgfpoint{-\pgf@circ@res@other+\pgf@circ@res@step}{\pgf@circ@res@temp}}
8080 % left semicircle
8081 \pgfpatharc{\@@angle}{360-\@@angle}{\pgf@circ@res@up}
8082 % connect to right semicircle
8083 \pgfpathlineto
8084 {\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@step}{\pgf@circ@res@temp}}
8085 \pgfpathclose
8086 \pgf@circ@draworfill
8087 }
8088
8089 % %>>>
8090
8091 %% Paths definitions for Sources%<<<
8092
8093 %% Batteries
8094
8095 \pgfcirc@activate@bipole@simple@opt{v}{battery}{\circuitikzbasekey/bipole/is voltage=true,
8096 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8097 \pgfcirc@activate@bipole@opt{v}{batteryone}{battery1}{battery1}{\circuitikzbasekey/bipole/is voltage=true,
8098 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8099 \pgfcirc@activate@bipole@opt{v}{batterytwo}{battery2}{battery2}{\circuitikzbasekey/bipole/is voltage=true,
8100 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8101 \pgfcirc@activate@bipole@opt{v}{solarsource}{solar}{solar}{\circuitikzbasekey/bipole/is voltage=true,
8102 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8103
8104 %% Sources: voltage
8105
8106 \pgfcirc@activate@bipole@opt{v}{vsource}{vsource}{european voltage source}{%
8107 \circuitikzbasekey/bipole/is voltage=true,
8108 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8109 \pgfcirc@activate@bipole@opt{v}{vsourceam}{vsourceAM}{american voltage source}{%
8110 \circuitikzbasekey/bipole/is voltage=true,
8111 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false}
8112 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi voltage source}{voltage source}
8113 \pgfcirc@style@to@style{voltage source}{vsource}
8114 \pgfcirc@style@to@style{voltage source}{V}
8115
8116 \pgfcirc@activate@bipole@opt{v}{cvsource}{cvsource}{european controlled voltage source}{%
8117 \circuitikzbasekey/bipole/is voltage=true,
8118 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8119 \pgfcirc@activate@bipole@opt{v}{cvsourceam}{cvsourceAM}{american controlled voltage source}{%
8120 \circuitikzbasekey/bipole/is voltage=true,
8121 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=false}
8122 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled voltage source}{controlled voltage source}
8123 \pgfcirc@style@to@style{controlled voltage source}{cvsource}
8124 \pgfcirc@style@to@style{controlled voltage source}{controlled vsource}
8125 \pgfcirc@style@to@style{controlled voltage source}{cV}
8126 %% fix the mess about not having the shortcut accessible in every mode...
8127 \pgfcirc@style@to@style{american voltage source}{vsourceAM}
8128 \pgfcirc@style@to@style{american controlled voltage source}{cvsourceAM}
8129 \pgfcirc@style@to@style{european voltage source}{vsourceEU}
8130 \pgfcirc@style@to@style{european controlled voltage source}{cvsourceEU}
8131
8132 \pgfcirc@activate@bipole@simple@opt{v}{esource}{%
8133 \circuitikzbasekey/bipole/is voltage=true,
8134 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8135
8136 \pgfcirc@activate@bipole@opt{v}{ecsource}{ecsource}{empty controlled source}{%
8137 \circuitikzbasekey/bipole/is voltage=true,
8138 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8139 \pgfcirc@style@to@style{empty controlled source}{ecsource}
8140
8141 \pgfcirc@activate@bipole@opt{v}{vsourcesin}{vsourcesin}{sinusoidal voltage source}{%
8142 \circuitikzbasekey/bipole/is voltage=true,
8143 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8144 \pgfcirc@style@to@style{sinusoidal voltage source}{vsourcesin}
8145 \pgfcirc@style@to@style{sinusoidal voltage source}{sV}
8146
8147 \pgfcirc@activate@bipole@opt{v}{cvsourcesin}{cvsourcesin}{controlled sinusoidal voltage source}{%
8148 \circuitikzbasekey/bipole/is voltage=true,
8149 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8150 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{cvsourcesin}
8151 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{controlled vsourcesin}
8152 \pgfcirc@style@to@style{controlled sinusoidal voltage source}{csV}
8153
8154 \pgfcirc@activate@bipole@opt{v}{vsourcesquare}{vsourcesquare}{square voltage source}{%
8155 \circuitikzbasekey/bipole/is voltage=true,
8156 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8157 \pgfcirc@style@to@style{square voltage source}{vsourcesquare}
8158 \pgfcirc@style@to@style{square voltage source}{sqV}
8159
8160 \pgfcirc@activate@bipole@opt{v}{vsourcetri}{vsourcetri}{triangle voltage source}{%
8161 \circuitikzbasekey/bipole/is voltage=true,
8162 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8163 \pgfcirc@style@to@style{triangle voltage source}{vsourcetri}
8164 \pgfcirc@style@to@style{triangle voltage source}{tV}
8165
8166 \pgfcirc@activate@bipole@simple@opt{v}{pvsource}{%
8167 \circuitikzbasekey/bipole/is voltage=true,
8168 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8169
8170 \pgfcirc@activate@bipole@simple@opt{v}{pvmodule}{%
8171 \circuitikzbasekey/bipole/is voltage=true,
8172 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8173
8174 \pgfcirc@activate@bipole@simple@opt{v}{dcvsource}{%
8175 \circuitikzbasekey/bipole/is voltage=true,
8176 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8177
8178 \pgfcirc@activate@bipole@opt{v}{oosource}{oosource}{voosource}{%
8179 \circuitikzbasekey/bipole/is voltage=true,
8180 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8181
8182 \pgfcirc@activate@bipole@simple@opt{v}{ooosource}{%
8183 \circuitikzbasekey/bipole/is voltage=true,
8184 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8185
8186 \pgfcirc@activate@bipole@simple@opt{v}{oosourceatrans}{%
8187 \circuitikzbasekey/bipole/is voltage=true,
8188 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8189
8190 \pgfcirc@activate@bipole@simple@opt{v}{oosourcetrans}{%
8191 \circuitikzbasekey/bipole/is voltage=true,
8192 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8193
8194 \pgfcirc@activate@bipole@opt{v}{vsourceC}{vsourceC}{cute european voltage source}{%
8195 \circuitikzbasekey/bipole/is voltage=true,
8196 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8197 \pgfcirc@style@to@style{cute european voltage source}{vsourceC}
8198 \pgfcirc@style@to@style{cute european voltage source}{ceV}
8199
8200 \pgfcirc@activate@bipole@opt{v}{cvsourceC}{cvsourceC}{cute european controlled voltage source}{%
8201 \circuitikzbasekey/bipole/is voltage=true,
8202 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8203 \pgfcirc@style@to@style{cute european controlled voltage source}{cvsourceC}
8204 \pgfcirc@style@to@style{cute european controlled voltage source}{cceV}
8205
8206 \pgfcirc@activate@bipole@opt{v}{vsourceN}{vsourceN}{noise voltage source}{%
8207 \circuitikzbasekey/bipole/is voltage=true,
8208 \circuitikzbasekey/bipole/is voltageoutsideofsymbol=true}
8209 \pgfcirc@style@to@style{noise voltage source}{vsourceN}
8210 \pgfcirc@style@to@style{noise voltage source}{nV}
8211
8212 %% Sources: current
8213
8214 \pgfcirc@activate@bipole@opt{i}{isource}{isource}{european current source}{%
8215 \circuitikzbasekey/bipole/is current=true}
8216 \pgfcirc@activate@bipole@opt{i}{isourceam}{isourceAM}{american current source}{%
8217 \circuitikzbasekey/bipole/is current=true}
8218 \pgfcirc@style@to@style{\ifpgf@circuit@europeancurrent european \else american \fi current source}{current source}
8219 \pgfcirc@style@to@style{current source}{isource}
8220 \pgfcirc@style@to@style{current source}{I}
8221
8222 \pgfcirc@activate@bipole@opt{i}{cisource}{cisource}{european controlled current source}{%
8223 \circuitikzbasekey/bipole/is current=true}
8224 \pgfcirc@activate@bipole@opt{i}{cisourceam}{cisourceAM}{american controlled current source}{%
8225 \circuitikzbasekey/bipole/is current=true}
8226 \pgfcirc@style@to@style{\ifpgf@circuit@europeanvoltage european \else american \fi controlled current source}{controlled current source}
8227 \pgfcirc@style@to@style{controlled current source}{cisource}
8228 \pgfcirc@style@to@style{controlled current source}{controlled isource}
8229 \pgfcirc@style@to@style{controlled current source}{cI}
8230 %% fix the mess about not having the shortcut accessible in every mode...
8231 \pgfcirc@style@to@style{american current source}{isourceAM}
8232 \pgfcirc@style@to@style{american controlled current source}{cisourceAM}
8233 \pgfcirc@style@to@style{european current source}{isourceEU}
8234 \pgfcirc@style@to@style{european controlled current source}{cisourceEU}
8235
8236 \pgfcirc@activate@bipole@opt{i}{isourcesin}{isourcesin}{sinusoidal current source}{%
8237 \circuitikzbasekey/bipole/is current=true}
8238 \pgfcirc@style@to@style{sinusoidal current source}{isourcesin}
8239 \pgfcirc@style@to@style{sinusoidal current source}{sI}
8240
8241 \pgfcirc@activate@bipole@opt{i}{cisourcesin}{cisourcesin}{controlled sinusoidal current source}{%
8242 \circuitikzbasekey/bipole/is current=true}
8243 \pgfcirc@style@to@style{controlled sinusoidal current source}{cisourcesin}
8244 \pgfcirc@style@to@style{controlled sinusoidal current source}{controlled isourcesin}
8245 \pgfcirc@style@to@style{controlled sinusoidal current source}{csI}
8246
8247 \pgfcirc@activate@bipole@simple@opt{i}{dcisource}{%
8248 \circuitikzbasekey/bipole/is current=true}
8249
8250 \pgfcirc@activate@bipole@opt{i}{oosource}{oosource}{ioosource}{%
8251 \circuitikzbasekey/bipole/is current=true}
8252
8253 \pgfcirc@activate@bipole@opt{i}{isourceC}{isourceC}{cute european current source}{%
8254 \circuitikzbasekey/bipole/is current=true}
8255 \pgfcirc@style@to@style{cute european current source}{isourceC}
8256 \pgfcirc@style@to@style{cute european current source}{ceI}
8257
8258 \pgfcirc@activate@bipole@opt{i}{cisourceC}{cisourceC}{cute european controlled current source}{%
8259 \circuitikzbasekey/bipole/is current=true}
8260 \pgfcirc@style@to@style{cute european controlled current source}{cisourceC}
8261 \pgfcirc@style@to@style{cute european controlled current source}{cceI}
8262
8263 \pgfcirc@activate@bipole@opt{i}{isourceN}{isourceN}{noise current source}{%
8264 \circuitikzbasekey/bipole/is current=true}
8265 \pgfcirc@style@to@style{noise current source}{isourceN}
8266 \pgfcirc@style@to@style{noise current source}{nI}
8267
8268 % norator, nullator
8269 \pgfcirc@activate@bipole@simple{l}{nullator}
8270 \pgfcirc@activate@bipole@simple{l}{norator}
8271
8272 % build alias with voltage and current directions (legacy)
8273
8274 \def\pgf@temp#1{
8275 \pgfcirc@style@to@style@label{voltage source}{V#1}{v#1}
8276 \pgfcirc@style@to@style@label{controlled voltage source}{cV#1}{v#1}
8277 \pgfcirc@style@to@style@label{sinusoidal voltage source}{sV#1}{v#1}
8278 \pgfcirc@style@to@style@label{controlled sinusoidal voltage source}{csV#1}{v#1}
8279 }
8280 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
8281 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
8282 \def\pgf@temp#1{
8283 \pgfcirc@style@to@style@label{current source}{I#1}{i#1}
8284 \pgfcirc@style@to@style@label{controlled current source}{cI#1}{i#1}
8285 \pgfcirc@style@to@style@label{sinusoidal current source}{sI#1}{i#1}
8286 \pgfcirc@style@to@style@label{controlled sinusoidal current source}{csI#1}{i#1}
8287 }
8288 \pgf@temp{_>} \pgf@temp{_<} \pgf@temp{^>} \pgf@temp{^<}
8289 \pgf@temp{>_} \pgf@temp{<_} \pgf@temp{>^} \pgf@temp{<^}
8290 \pgf@temp{>} \pgf@temp{<} \pgf@temp{^} \pgf@temp{_}
8291 % %>>>
8292
8293
8294 %%%%%%%%%%%%%%
8295 %% Diodes
8296 %%%%%%%%%%%%%%
8297
8298 % Definitions for diodes%<<<1
8299
8300 \ctikzset{bipoles/diode/height/.initial=.50}
8301 \ctikzset{bipoles/diode/width/.initial=.40}
8302 % for horizontally-double-sided diodes, like tvs diodes (transorb)
8303 \ctikzset{bipoles/ddiode/width/.initial=.80}% must be 2*diode width
8304 % for vertically taller diodes
8305 \ctikzset{bipoles/bidirectionaldiode/height/.initial=1.1}
8306 \ctikzset{bipoles/bidirectionaldiode/width/.initial=1}
8307 \ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
8308 \ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
8309 \ctikzset{bipoles/varcap/height/.initial=.50}
8310 \ctikzset{bipoles/varcap/width/.initial=.45}
8311
8312 \ctikzset{tripoles/thyristor/height/.initial=1.10}
8313 \ctikzset{tripoles/thyristor/height 2/.initial=.5}
8314 \ctikzset{tripoles/thyristor/width/.initial=1.0}
8315 \ctikzset{tripoles/thyristor/diode height/.initial=.5}
8316 \ctikzset{tripoles/thyristor/diode width left/.initial=.4}
8317 \ctikzset{tripoles/thyristor/diode width right/.initial=.3}
8318 \ctikzset{tripoles/thyristor/gate height/.initial=0.0} % legacy 0
8319 \ctikzset{tripoles/thyristor/gate kink/.initial=1.0} % legacy 1.0
8320 \ctikzset{tripoles/thyristor/gto space up/.initial=0.5} % legacy 0.5
8321 \ctikzset{tripoles/thyristor/gto space down/.initial=0.0} % legacy 0.0
8322 \ctikzset{tripoles/thyristor/gto bar width/.initial=0.2} % legacy 0.2
8323
8324 \ctikzset{tripoles/triac/height/.initial=1.1}
8325 \ctikzset{tripoles/triac/width/.initial=1}
8326 \ctikzset{tripoles/triac/diode width left/.initial=.3}
8327 \ctikzset{tripoles/triac/diode width right/.initial=.3}
8328 \ctikzset{tripoles/triac/gate kink/.initial=1}
8329
8330 \ctikzset{thyristor style/.is choice}
8331 \ctikzset{thyristor style/legacy/.code={%
8332 \ctikzset{tripoles/thyristor/height=1.1}%
8333 \ctikzset{tripoles/thyristor/height 2=.5}%
8334 \ctikzset{tripoles/thyristor/width=1.0}%
8335 \ctikzset{tripoles/thyristor/diode height=.5}%
8336 \ctikzset{tripoles/thyristor/diode width left=.4}%
8337 \ctikzset{tripoles/thyristor/diode width right=.3}%
8338 \ctikzset{tripoles/thyristor/gate height=0.0}%
8339 \ctikzset{tripoles/thyristor/gate kink=1.0}%
8340 \ctikzset{tripoles/thyristor/gto space up=0.5}%
8341 \ctikzset{tripoles/thyristor/gto space down=0.0}%
8342 \ctikzset{tripoles/thyristor/gto bar width=0.2}%
8343 \ctikzset{tripoles/triac/gate kink=1}%
8344 }}
8345 \ctikzset{thyristor style/compact/.code={%
8346 \ctikzset{tripoles/thyristor/height=0.8}% legacy 1.1
8347 \ctikzset{tripoles/thyristor/height 2=.5}%
8348 \ctikzset{tripoles/thyristor/width=1.0}%
8349 \ctikzset{tripoles/thyristor/diode height=.5}%
8350 \ctikzset{tripoles/thyristor/diode width left=.4}%
8351 \ctikzset{tripoles/thyristor/diode width right=.4}%legacy 0.3
8352 \ctikzset{tripoles/thyristor/gate height=0.5}% legacy 0
8353 \ctikzset{tripoles/thyristor/gate kink=0.7}% legacy 1.0
8354 \ctikzset{tripoles/thyristor/gto space up=0.25}% legacy 0.5
8355 \ctikzset{tripoles/thyristor/gto space down=0.25}% legacy 0.0
8356 \ctikzset{tripoles/thyristor/gto bar width=0.2}%
8357 \ctikzset{tripoles/triac/gate kink=.7}%
8358 }}
8359
8360 %
8361 % Whiskers for ZZener and TVS
8362 %
8363 \newif\ifpgf@zz@straightwhisk
8364 \pgf@zz@straightwhiskfalse
8365 \ctikzset{diode straight whiskers/.code=\pgf@zz@straightwhisktrue}
8366 \ctikzset{diode sloped whiskers/.code=\pgf@zz@straightwhiskfalse}
8367 %
8368 % Flipping arrows in LED and photodiodes
8369 %
8370 \newif\ifpgf@led@fliparrows
8371 \newif\ifpgf@pd@fliparrows
8372 \pgf@led@fliparrowsfalse
8373 \pgf@pd@fliparrowsfalse
8374 %
8375 % by default the arrows start (LED) and go (PD) to the anode.
8376 %
8377 \ctikzset{led arrows from anode/.code=\pgf@led@fliparrowsfalse}
8378 \ctikzset{pd arrows to anode/.code=\pgf@pd@fliparrowsfalse}
8379 %
8380 % but they can start form the cathode (LED) or go to it (PD)
8381 %
8382 \ctikzset{led arrows from cathode/.code=\pgf@led@fliparrowstrue}
8383 \ctikzset{pd arrows to cathode/.code=\pgf@pd@fliparrowstrue}
8384
8385 \newif\ifpgf@circuit@strokediode
8386 \newif\ifpgf@circuit@fulldiode
8387 \pgf@circuit@strokediodefalse
8388 \pgf@circuit@fulldiodefalse
8389
8390 \ctikzset{diode/.is choice}
8391 \ctikzset{diode/empty/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodefalse}%default
8392 \ctikzset{diode/full/.code = \pgf@circuit@fulldiodetrue\pgf@circuit@strokediodefalse}
8393 \ctikzset{diode/stroke/.code = \pgf@circuit@fulldiodefalse\pgf@circuit@strokediodetrue}
8394
8395 \tikzset{full diodes/.style = { \circuitikzbasekey/diode = full}}
8396 \tikzset{empty diodes/.style = { \circuitikzbasekey/diode = empty}}
8397 \tikzset{stroke diodes/.style = { \circuitikzbasekey/diode = stroke}}
8398
8399 %%>>>
8400
8401 %% Node components for diodes %<<<1
8402
8403 % beware, this shift to the left the coordinates
8404 \def\pgf@circ@fulldiode@triangle@shift{%
8405 \pgftransformxshift{\pgf@circ@res@left}
8406 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
8407 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8408 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
8409 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
8410 \pgf@circ@fill@strokecolor
8411 \pgfusepath{draw,fill}
8412 % \pgf@circ@debug@colors
8413 }
8414
8415 %% Black generic diode
8416 \pgfcircdeclarebipolescaled{diodes}
8417 {}
8418 {\ctikzvalof{bipoles/diode/height}}
8419 {fulldiode}
8420 {\ctikzvalof{bipoles/diode/height}}
8421 {\ctikzvalof{bipoles/diode/width}}
8422 {
8423
8424 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8425 \pgfscope
8426 \pgf@circ@fulldiode@triangle@shift
8427 \endpgfscope
8428 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8429 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8430 \pgfusepath{draw}
8431 }
8432
8433 %% Black Zener diode
8434 \pgfcircdeclarebipolescaled{diodes}
8435 {}
8436 {\ctikzvalof{bipoles/diode/height}}
8437 {fullzdiode}
8438 {\ctikzvalof{bipoles/diode/height}}
8439 {\ctikzvalof{bipoles/diode/width}}
8440 {
8441 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8442 \pgf@circ@fulldiode@triangle@shift
8443 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8444 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8445 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8446 \pgfusepath{draw}
8447 }
8448
8449 %% Black alternative zigzag Zener diode
8450 \pgfcircdeclarebipolescaled{diodes}
8451 {% fix the anchor border
8452 \pgfcirc@border@extend@updown{1.3}{1.3}
8453 }
8454 {\ctikzvalof{bipoles/diode/height}}
8455 {fullzzdiode}
8456 {\ctikzvalof{bipoles/diode/height}}
8457 {\ctikzvalof{bipoles/diode/width}}
8458 {
8459 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8460 \pgf@circ@fulldiode@triangle@shift
8461 \ifpgf@zz@straightwhisk
8462 \edef\@@tmp{0.0}
8463 \else
8464 \edef\@@tmp{0.5}
8465 \fi
8466 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down-\@@tmp\pgf@circ@res@up}}
8467 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8468 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8469 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up-\@@tmp\pgf@circ@res@down}}
8470 \pgfusepath{draw}
8471 }
8472
8473 %% Black Schottky diode
8474 \pgfcircdeclarebipolescaled{diodes}
8475 {}
8476 {\ctikzvalof{bipoles/diode/height}}
8477 {fullsdiode}
8478 {\ctikzvalof{bipoles/diode/height}}
8479 {\ctikzvalof{bipoles/diode/width}}
8480 {
8481 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8482 \pgf@circ@fulldiode@triangle@shift
8483 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
8484 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
8485 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8486 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8487 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8488 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8489 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
8490 \pgfusepath{draw}
8491 }
8492
8493 %% Black tunnel diode
8494 \pgfcircdeclarebipolescaled{diodes}
8495 {}
8496 {\ctikzvalof{bipoles/diode/height}}
8497 {fulltdiode}
8498 {\ctikzvalof{bipoles/diode/height}}
8499 {\ctikzvalof{bipoles/diode/width}}
8500 {
8501 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8502 \pgf@circ@fulldiode@triangle@shift
8503 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
8504 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8505 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8506 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8507 \pgfusepath{draw}
8508 }
8509 % the styling of optical arrows is defined in pgfcirc.define.tex because
8510 % they are common to phototransistors
8511
8512 %
8513 % draw LED arrows
8514 %
8515 \def\pgf@circ@draw@ledarrows{%
8516 \pgfsetlinewidth{\pgfstartlinewidth}
8517 \pgf@circ@fill@strokecolor
8518 \pgf@circ@set@optoarrow@style
8519 \ifpgf@led@fliparrows
8520 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
8521 \pgfpathlineto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
8522 \pgfusepath{draw}
8523 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
8524 \pgfpathlineto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
8525 \pgfusepath{draw}
8526 \else
8527 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
8528 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
8529 \pgfusepath{draw}
8530 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
8531 \pgfpathlineto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
8532 \pgfusepath{draw}
8533 \fi
8534 }
8535 %
8536 % ---and photodiode arrows
8537 %
8538 \def\pgf@circ@draw@pdarrows{%
8539 \pgfsetlinewidth{\pgfstartlinewidth}
8540 \pgf@circ@fill@strokecolor
8541 \pgf@circ@set@optoarrow@style
8542 \ifpgf@pd@fliparrows
8543 \pgfpathmoveto{\pgfpoint{-0.6\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
8544 \pgfpathlineto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
8545 \pgfusepath{draw}
8546 \pgfpathmoveto{\pgfpoint{0pt}{1.6\pgf@circ@res@up}}
8547 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
8548 \pgfusepath{draw}
8549 \else
8550 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@right}{2\pgf@circ@res@up}}
8551 \pgfpathlineto{\pgfpoint{-0.4\pgf@circ@res@right}{\pgf@circ@res@up}}
8552 \pgfusepath{draw}
8553 \pgfpathmoveto{\pgfpoint{1.2\pgf@circ@res@right}{1.8\pgf@circ@res@up}}
8554 \pgfpathlineto{\pgfpoint{0.2\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
8555 \pgfusepath{draw}
8556 \fi
8557 }
8558 %
8559 % --and laser diode arrows - contributed by Andre Alves
8560 %
8561 \def\pgf@circ@draw@laserarrows{%
8562 \pgfsetlinewidth{\pgfstartlinewidth}
8563 \pgf@circ@fill@strokecolor
8564 \pgf@circ@set@optoarrow@style
8565 \pgfpathmoveto{\pgfpoint{-0.4\pgf@circ@res@right}{1.1\pgf@circ@res@up}}
8566 \pgfpathlineto{\pgfpoint{-0.4\pgf@circ@res@right}{2.1\pgf@circ@res@up}}
8567 \pgfusepath{draw}
8568 \pgfpathmoveto{\pgfpoint{0.2\pgf@circ@res@right}{1.1\pgf@circ@res@up}}
8569 \pgfpathlineto{\pgfpoint{0.2\pgf@circ@res@right}{2.1\pgf@circ@res@up}}
8570 \pgfusepath{draw}
8571 }
8572
8573 \def\pgf@circ@generate@diode@saved@arrows#1#2#3#4#5{%
8574 \savedanchor{\arrows}{%
8575 \pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen
8576 \pgf@ya=\ctikzvalof{bipoles/diode/height}\pgf@circ@scaled@Rlen
8577 \pgf@xa=\ctikzvalof{bipoles/diode/width}\pgf@circ@scaled@Rlen
8578 \pgf@x=.5\pgf@xa\pgf@y=.5\pgf@ya
8579 \csname ifpgf@#5@fliparrows\endcsname
8580 \pgf@x=#1\pgf@x\pgf@y=#2\pgf@y
8581 \else
8582 \pgf@x=#3\pgf@x\pgf@y=#4\pgf@y
8583 \fi
8584 }
8585 }
8586 %% Black light emitting diode
8587 \pgfcircdeclarebipolescaled{diodes}
8588 {% fix the anchor border
8589 \pgfcirc@border@extend@updown{1.8}{1}
8590 \pgf@circ@generate@diode@saved@arrows{-0.2}{2.0}{1.0}{2.0}{led}
8591 \anchor{arrows}{\arrows}
8592 }
8593 {\ctikzvalof{bipoles/diode/height}}
8594 {fulllediode}
8595 {\ctikzvalof{bipoles/diode/height}}
8596 {\ctikzvalof{bipoles/diode/width}}
8597 {
8598 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8599 \pgfscope
8600 \pgf@circ@fulldiode@triangle@shift
8601 \endpgfscope
8602 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8603 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8604 \pgfusepath{draw}
8605 \pgf@circ@draw@ledarrows
8606 }
8607
8608 %% Black laser diode - contributed by Andre Alves
8609 \pgfcircdeclarebipolescaled{diodes}
8610 {% fix the anchor border
8611 \pgfcirc@border@extend@updown{1.8}{1}
8612 \pgf@circ@generate@diode@saved@arrows{-0.1}{2.2}{-0.1}{2.2}{pd}%pd or led dosen't matter
8613 \anchor{arrows}{\arrows}
8614 }
8615 {\ctikzvalof{bipoles/diode/height}}
8616 {fulllaserdiode}
8617 {\ctikzvalof{bipoles/diode/height}}
8618 {\ctikzvalof{bipoles/diode/width}}
8619 {
8620 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8621 \pgfscope
8622 \pgf@circ@fulldiode@triangle@shift
8623 \endpgfscope
8624 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8625 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8626 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@up}}
8627 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@down}}
8628 \pgfusepath{draw}
8629 \pgf@circ@draw@laserarrows
8630 }
8631
8632 %% Black photodiode
8633 \pgfcircdeclarebipolescaled{diodes}
8634 {% fix the anchor border
8635 \pgfcirc@border@extend@updown{1.8}{1}
8636 \pgf@circ@generate@diode@saved@arrows{-0.2}{2.0}{1.0}{2.0}{pd}
8637 \anchor{arrows}{\arrows}
8638 }
8639 {\ctikzvalof{bipoles/diode/height}}
8640 {fullpdiode}
8641 {\ctikzvalof{bipoles/diode/height}}
8642 {\ctikzvalof{bipoles/diode/width}}
8643 {
8644 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8645 \pgfscope
8646 \pgf@circ@fulldiode@triangle@shift
8647 \endpgfscope
8648 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8649 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8650 \pgfusepath{draw}
8651 \pgf@circ@draw@pdarrows
8652 }
8653
8654 %% Black varcap
8655 \pgfcircdeclarebipolescaled{diodes}
8656 {}
8657 {\ctikzvalof{bipoles/varcap/height}}
8658 {fullvarcap}
8659 {\ctikzvalof{bipoles/varcap/height}}
8660 {\ctikzvalof{bipoles/varcap/width}}
8661 {
8662 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8663 \pgfsetlinewidth{\pgf@circ@res@temp}
8664 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8665 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8666 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8667 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8668 \pgf@circ@fill@strokecolor
8669 \pgfusepath{draw,fill}
8670 %
8671 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
8672 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
8673 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8674 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8675 \pgfusepath{draw}
8676 }
8677
8678 %% Code for the diode triangle
8679 \def\pgf@circ@basicdiodeshape{
8680 % \pgfscope
8681 \pgftransformxshift{\pgf@circ@res@left}
8682 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
8683 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8684 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
8685 \pgfpathclose
8686 \pgf@circ@draworfill
8687 \pgfscope
8688 % to allow filling, we need to draw explicitly the stroke here.
8689 \pgfsetlinewidth{\pgfstartlinewidth}
8690 \ifpgf@circuit@bipole@strokedsymbol
8691 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{0pt}}
8692 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
8693 \pgfusepath{draw}
8694 \fi
8695 \endpgfscope
8696 % \endpgfscope
8697 }
8698
8699 %% Empty generic diode
8700 \pgfcircdeclarebipolescaled{diodes}
8701 {}
8702 {\ctikzvalof{bipoles/diode/height}}
8703 {emptydiode}
8704 {\ctikzvalof{bipoles/diode/height}}
8705 {\ctikzvalof{bipoles/diode/width}}
8706 {
8707 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8708 \pgfscope
8709 \pgf@circ@basicdiodeshape
8710 \endpgfscope
8711 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8712 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8713 \pgfusepath{draw}
8714 }
8715
8716 %% Empty Zener diode
8717 \pgfcircdeclarebipolescaled{diodes}
8718 {}
8719 {\ctikzvalof{bipoles/diode/height}}
8720 {emptyzdiode}
8721 {\ctikzvalof{bipoles/diode/height}}
8722 {\ctikzvalof{bipoles/diode/width}}
8723 {
8724
8725 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8726
8727 \pgfscope
8728 \pgf@circ@basicdiodeshape
8729 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8730 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8731 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8732 \pgfusepath{draw}
8733 \endpgfscope
8734 }
8735
8736 %% Empty alternative zigzag Zener diode
8737 \pgfcircdeclarebipolescaled{diodes}
8738 {% fix the anchor border
8739 \pgfcirc@border@extend@updown{1.3}{1.3}
8740 }
8741 {\ctikzvalof{bipoles/diode/height}}
8742 {emptyzzdiode}
8743 {\ctikzvalof{bipoles/diode/height}}
8744 {\ctikzvalof{bipoles/diode/width}}
8745 {
8746
8747 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8748
8749 \pgfscope
8750 \pgf@circ@basicdiodeshape
8751 \ifpgf@zz@straightwhisk
8752 \edef\@@tmp{0.0}
8753 \else
8754 \edef\@@tmp{0.5}
8755 \fi
8756 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down-\@@tmp\pgf@circ@res@up}}
8757 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8758 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8759 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up-\@@tmp\pgf@circ@res@down}}
8760 \pgfusepath{draw}
8761 \endpgfscope
8762 }
8763 %% Empty Schottky diode
8764 \pgfcircdeclarebipolescaled{diodes}
8765 {}
8766 {\ctikzvalof{bipoles/diode/height}}
8767 {emptysdiode}
8768 {\ctikzvalof{bipoles/diode/height}}
8769 {\ctikzvalof{bipoles/diode/width}}
8770 {
8771
8772 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8773 \pgfscope
8774 \pgf@circ@basicdiodeshape
8775 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@down}}
8776 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
8777 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8779 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8780 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8781 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{.6\pgf@circ@res@up}}
8782 \pgfusepath{draw}
8783 \endpgfscope
8784
8785 }
8786
8787 %% Empty tunnel diode
8788 \pgfcircdeclarebipolescaled{diodes}
8789 {}
8790 {\ctikzvalof{bipoles/diode/height}}
8791 {emptytdiode}
8792 {\ctikzvalof{bipoles/diode/height}}
8793 {\ctikzvalof{bipoles/diode/width}}
8794 {
8795
8796 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8797 \pgfscope
8798 \pgf@circ@basicdiodeshape
8799 \pgfpathmoveto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@down}}
8800 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@down}}
8801 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@left}{\pgf@circ@res@up}}
8802 \pgfpathlineto{\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@left}{\pgf@circ@res@up}}
8803 \pgfusepath{draw}
8804 \endpgfscope
8805 }
8806
8807 %% Empty light emitting diode
8808 \pgfcircdeclarebipolescaled{diodes}
8809 {% fix the anchor border
8810 \pgfcirc@border@extend@updown{1.8}{1}
8811 \pgf@circ@generate@diode@saved@arrows{-0.2}{2.0}{1.0}{2.0}{led}
8812 \anchor{arrows}{\arrows}
8813 }
8814 {\ctikzvalof{bipoles/diode/height}}
8815 {emptylediode}
8816 {\ctikzvalof{bipoles/diode/height}}
8817 {\ctikzvalof{bipoles/diode/width}}
8818 {
8819
8820 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8821 \pgfscope
8822 \pgf@circ@basicdiodeshape
8823 \endpgfscope
8824 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8825 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8826 \pgfusepath{draw}
8827
8828 \pgf@circ@draw@ledarrows
8829 }
8830
8831 %% Empty laser diode - contributed by Andre Alves
8832 \pgfcircdeclarebipolescaled{diodes}
8833 {% fix the anchor border
8834 \pgfcirc@border@extend@updown{1.8}{1}
8835 \pgf@circ@generate@diode@saved@arrows{-0.1}{2.2}{-0.1}{2.2}{pd}%pd or led dosen't matter
8836 \anchor{arrows}{\arrows}
8837 }
8838 {\ctikzvalof{bipoles/diode/height}}
8839 {emptylaserdiode}
8840 {\ctikzvalof{bipoles/diode/height}}
8841 {\ctikzvalof{bipoles/diode/width}}
8842 {
8843
8844 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8845 \pgfscope
8846 \pgf@circ@basicdiodeshape
8847 \endpgfscope
8848 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8849 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8850 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@up}}
8851 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgf@circ@res@left}{\pgf@circ@res@down}}
8852 \pgfusepath{draw}
8853
8854 \pgf@circ@draw@laserarrows
8855 }
8856
8857 %% Empty photodiode
8858 \pgfcircdeclarebipolescaled{diodes}
8859 {% fix the anchor border
8860 \pgfcirc@border@extend@updown{1.8}{1}
8861 \pgf@circ@generate@diode@saved@arrows{-0.2}{2.0}{1.0}{2.0}{pd}
8862 \anchor{arrows}{\arrows}
8863 }
8864 {\ctikzvalof{bipoles/diode/height}}
8865 {emptypdiode}
8866 {\ctikzvalof{bipoles/diode/height}}
8867 {\ctikzvalof{bipoles/diode/width}}
8868 {
8869
8870 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8871 \pgfscope
8872 \pgf@circ@basicdiodeshape
8873 \endpgfscope
8874 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8875 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8876 \pgfusepath{draw}
8877
8878 \pgf@circ@draw@pdarrows
8879 }
8880
8881 %% Empty varcap
8882 \pgfcircdeclarebipolescaled{diodes}
8883 {}
8884 {\ctikzvalof{bipoles/varcap/height}}
8885 {emptyvarcap}
8886 {\ctikzvalof{bipoles/varcap/height}}
8887 {\ctikzvalof{bipoles/varcap/width}}
8888 {
8889 \pgf@circ@res@temp=\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
8890 \pgfsetlinewidth{\pgf@circ@res@temp}
8891 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8892 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8893 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8894 % \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8895 \pgfpathclose
8896 \pgf@circ@draworfill
8897 \pgfscope
8898 % to allow filling, we need to draw explicitily the stroke here.
8899 \pgfsetlinewidth{\pgfstartlinewidth}
8900 \ifpgf@circuit@bipole@strokedsymbol
8901 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{0pt}}
8902 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8903 \pgfusepath{draw}
8904 \fi
8905 \endpgfscope
8906 %
8907 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@down}}
8908 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-2\pgf@circ@res@temp}{\pgf@circ@res@up}}
8909 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
8910 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
8911 \pgfusepath{draw}
8912 }
8913
8914 %% Transorbs
8915 %% Empty zigzag TVS diode (transorb)
8916 \pgfcircdeclarebipolescaled{diodes}
8917 {% fix the anchor border
8918 \pgfcirc@border@extend@updown{1.3}{1.3}
8919 }
8920 {\ctikzvalof{bipoles/diode/height}}
8921 {emptytvsdiode}
8922 {\ctikzvalof{bipoles/diode/height}}
8923 {\ctikzvalof{bipoles/ddiode/width}}
8924 {
8925 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8926 \pgfscope
8927 \pgfscope
8928 \pgftransformxscale{0.5}
8929 \pgftransformxshift{\pgf@circ@res@left}
8930 \pgf@circ@basicdiodeshape
8931 \endpgfscope
8932 \pgfscope
8933 \pgftransformxscale{-0.5}
8934 \pgftransformxshift{\pgf@circ@res@left}
8935 \pgf@circ@basicdiodeshape
8936 \endpgfscope
8937 \ifpgf@zz@straightwhisk
8938 \edef\@@tmp{1.0}
8939 \else
8940 \edef\@@tmp{1.3}
8941 \fi
8942 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{\@@tmp\pgf@circ@res@up}}
8943 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8944 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
8945 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{\@@tmp\pgf@circ@res@down}}
8946 \pgfusepath{draw}
8947 \endpgfscope
8948 }
8949 %% Black zigzag TVS diode (transorb)
8950 \pgfcircdeclarebipolescaled{diodes}
8951 {% fix the anchor border
8952 \pgfcirc@border@extend@updown{1.3}{1.3}
8953 }
8954 {\ctikzvalof{bipoles/diode/height}}
8955 {fulltvsdiode}
8956 {\ctikzvalof{bipoles/diode/height}}
8957 {\ctikzvalof{bipoles/ddiode/width}}
8958 {
8959 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8960 \pgfscope
8961 \pgftransformxscale{0.5}
8962 \pgftransformxshift{\pgf@circ@res@left}
8963 \pgf@circ@fulldiode@triangle@shift
8964 \endpgfscope
8965 \pgfscope
8966 \pgftransformxscale{-0.5}
8967 \pgftransformxshift{\pgf@circ@res@left}
8968 \pgf@circ@fulldiode@triangle@shift
8969 \endpgfscope
8970 \ifpgf@zz@straightwhisk
8971 \edef\@@tmp{1.0}
8972 \else
8973 \edef\@@tmp{1.3}
8974 \fi
8975 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{\@@tmp\pgf@circ@res@up}}
8976 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
8977 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
8978 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{\@@tmp\pgf@circ@res@down}}
8979 \pgfusepath{draw}
8980 }
8981
8982 %% Black Shockley diode
8983 \pgfcircdeclarebipolescaled{diodes}
8984 {}
8985 {\ctikzvalof{bipoles/diode/height}}
8986 {fullshdiode}
8987 {\ctikzvalof{bipoles/diode/height}}
8988 {\ctikzvalof{bipoles/diode/width}}
8989 {
8990
8991 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
8992 \pgfscope
8993 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
8994 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
8995 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
8996 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
8997 \pgfpathclose
8998 \pgf@circ@fill@strokecolor
8999 \pgfusepath{draw,fill}
9000 \endpgfscope
9001 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9002 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9003 \pgfusepath{draw}
9004 }
9005 %% Empty generic diode
9006 \pgfcircdeclarebipolescaled{diodes}
9007 {}
9008 {\ctikzvalof{bipoles/diode/height}}
9009 {emptyshdiode}
9010 {\ctikzvalof{bipoles/diode/height}}
9011 {\ctikzvalof{bipoles/diode/width}}
9012 {
9013 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9014 \pgfscope
9015 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
9016 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
9017 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9018 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9019 \pgfpathclose
9020 \pgf@circ@draworfill
9021 \endpgfscope
9022 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
9023 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9024 \pgfusepath{draw}
9025 }
9026
9027 %% Empty bidirectionaldiode
9028 \pgfcircdeclarebipolescaled{diodes}
9029 {}
9030 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
9031 {emptybidirectionaldiode}
9032 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
9033 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
9034 {
9035
9036 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9037
9038 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
9039 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
9040
9041 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9042 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9043 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9044 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9045
9046 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9047 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9048 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9049 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9050
9051 \pgf@circ@draworfill
9052
9053 \pgfsetlinewidth{\pgfstartlinewidth}
9054
9055 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9056 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9057
9058 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9059 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9060
9061 \pgfusepath{draw}
9062 }
9063
9064 %% Full bidirectionaldiode
9065 \pgfcircdeclarebipolescaled{diodes}
9066 {}
9067 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
9068 {fullbidirectionaldiode}
9069 {\ctikzvalof{bipoles/bidirectionaldiode/height}}
9070 {\ctikzvalof{bipoles/bidirectionaldiode/width}}
9071 {
9072
9073 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9074
9075 \pgf@circ@res@other = \ctikzvalof{bipoles/bidirectionaldiode/diode width left}\pgf@circ@res@left
9076 \pgf@circ@res@step = \ctikzvalof{bipoles/bidirectionaldiode/diode width right}\pgf@circ@res@right
9077
9078 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9079 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9080 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9081 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9082
9083 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9084 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9085 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9086 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9087
9088 \pgf@circ@fill@strokecolor
9089 \pgfusepath{draw, fill}
9090
9091 \pgfsetlinewidth{\pgfstartlinewidth}
9092
9093 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9094 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9095
9096 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9097 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9098
9099 \pgfusepath{draw}
9100 }
9101
9102 %%% Thyristors in general
9103
9104
9105 \def\pgfcircdeclarethyristor#1#2#3#4{%name, fill (0-> black; 1-empty), gate position (1: catode, -1: anode), extra code
9106 \pgfcircdeclarebipolescaled{diodes}
9107 {
9108 \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/thyristor/gate kink}}}
9109 \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x}
9110 \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x\pgf@x=#3\pgf@x}
9111 \anchor{anode}{\southwest\pgf@y=0cm}
9112 \anchor{cathode}{\northeast\pgf@y=0cm }
9113 }
9114 {\ctikzvalof{tripoles/thyristor/height 2}}
9115 {#1}
9116 {\ctikzvalof{tripoles/thyristor/height}}
9117 {\ctikzvalof{tripoles/thyristor/width}}
9118 {
9119 \pgf@circ@res@other = \ctikzvalof{tripoles/thyristor/diode width left}\pgf@circ@res@left
9120 \pgf@circ@res@step = \ctikzvalof{tripoles/thyristor/diode width right}\pgf@circ@res@right
9121
9122 \pgfscope
9123 % draw the thick parts here (shifted horizontally)
9124 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9125 % draw the basic triangle
9126 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9127
9128 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-\pgf@circ@res@down}}
9129 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
9130 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9131 \pgfpathclose
9132 \ifnum#2=0\relax
9133 \pgf@circ@fill@strokecolor
9134 \pgfusepath{draw,fill}
9135 \else
9136 \pgf@circ@draworfill
9137 \fi
9138 % draw the vertical bar
9139 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@down}}
9140 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@down}}
9141 \pgfusepath{draw}
9142 \endpgfscope
9143
9144 % back to normal linewidth
9145 % stroke if needed
9146 \ifpgf@circuit@bipole@strokedsymbol
9147 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9148 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9149 \pgfusepath{draw}
9150 \fi
9151
9152 % draw the gate thing;
9153 #4%
9154
9155 % draw the leads in/out
9156 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9157 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9158
9159 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9160 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9161
9162 \pgfusepath{draw}
9163 }
9164 }
9165
9166 \def\pgfcirc@thyristor@simplegate{%
9167 \pgfpathmoveto{\pgfpoint
9168 {\pgf@circ@res@step}
9169 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9170 }
9171 \pgfpathlineto{\pgfpoint
9172 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
9173 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
9174 }
9175 \pgfpathlineto{\pgfpoint
9176 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
9177 {\pgf@circ@res@up}
9178 }
9179 \pgfusepath{draw}
9180 }
9181
9182 %% Black thyristor
9183 \pgfcircdeclarethyristor{fullthyristor}{0}{1}{\pgfcirc@thyristor@simplegate}
9184 %% Empty thyristor
9185 \pgfcircdeclarethyristor{emptythyristor}{1}{1}{\pgfcirc@thyristor@simplegate}
9186 %% black and empty GTO (standard: double line symbol, no arrow)
9187
9188 \def\pgfcirc@doublegate@gto@add{
9189 % connection to gate terminal
9190 \pgfpathmoveto{\pgfpoint
9191 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
9192 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up -
9193 \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9194 }
9195 \pgfpathlineto{\pgfpoint
9196 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
9197 {\pgf@circ@res@up}
9198 }
9199 \pgfusepath{draw}
9200 \pgfscope
9201 \pgfcirc@set@arrows{gto gate}{}{}
9202 % \pgfsetarrowsstart{latexslim}
9203 % first (lower) gto line: from body to gate
9204 \pgfpathmoveto{\pgfpoint
9205 {\pgf@circ@res@step}
9206 {(\ctikzvalof{tripoles/thyristor/gate height}-\ctikzvalof{tripoles/thyristor/gto space down})
9207 *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9208 }
9209 \pgfpathlineto{\pgfpoint
9210 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
9211 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up -
9212 \ctikzvalof{tripoles/thyristor/gto space down}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9213 }
9214 \pgfusepath{draw}
9215 % second (higher) gto line: from gate to body
9216 \pgfpathmoveto{\pgfpoint
9217 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
9218 {\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up +
9219 \ctikzvalof{tripoles/thyristor/gto space up}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9220 }
9221 \pgfpathlineto{\pgfpoint
9222 {\pgf@circ@res@step}
9223 {(\ctikzvalof{tripoles/thyristor/gate height}+\ctikzvalof{tripoles/thyristor/gto space up})
9224 *\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9225 }
9226 \pgfusepath{draw}
9227 \endpgfscope
9228 }
9229 \pgfcircdeclarethyristor{fullgto}{0}{1}{\pgfcirc@doublegate@gto@add}
9230 \pgfcircdeclarethyristor{emptygto}{1}{1}{\pgfcirc@doublegate@gto@add}
9231
9232 \def\pgfcirc@bargate@gto@add{%
9233 \pgfpathmoveto{\pgfpoint
9234 {\pgf@circ@res@step}
9235 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9236 }
9237 \pgfpathlineto{\pgfpoint
9238 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
9239 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
9240 }
9241 \pgfpathlineto{\pgfpoint
9242 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@right}
9243 {\pgf@circ@res@up}
9244 }
9245 % draw bar line.
9246 \pgfpathmoveto{\pgfpoint
9247 {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right}
9248 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
9249 }
9250 \pgfpathlineto{\pgfpoint
9251 {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@right}
9252 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
9253 }
9254 \pgfusepath{draw}
9255 }
9256
9257 \pgfcircdeclarethyristor{fullgtobar}{0}{1}{\pgfcirc@bargate@gto@add}
9258 \pgfcircdeclarethyristor{emptygtobar}{1}{1}{\pgfcirc@bargate@gto@add}
9259
9260 %% Thyristors with anode-connected gate
9261
9262 \def\pgfcirc@thyristor@anodegate{%
9263 \pgfpathmoveto{\pgfpoint
9264 {\pgf@circ@res@other}
9265 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9266 }
9267 \pgfpathlineto{\pgfpoint
9268 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
9269 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
9270 }
9271 \pgfpathlineto{\pgfpoint
9272 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
9273 {\pgf@circ@res@up}
9274 }
9275 \pgfusepath{draw}
9276 }
9277
9278 %% Black PUT
9279 \pgfcircdeclarethyristor{fullput}{0}{-1}{\pgfcirc@thyristor@anodegate}
9280 %% Empty PUT
9281 \pgfcircdeclarethyristor{emptyput}{1}{-1}{\pgfcirc@thyristor@anodegate}
9282 %% black and empty GTO (standard: double line symbol, no arrow)
9283
9284 \def\pgfcirc@anodebargate@gto@add{%
9285 \pgfpathmoveto{\pgfpoint
9286 {\pgf@circ@res@other}
9287 {\ctikzvalof{tripoles/thyristor/gate height}*\ctikzvalof{tripoles/thyristor/diode height}*\pgf@circ@res@up}
9288 }
9289 \pgfpathlineto{\pgfpoint
9290 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
9291 {\ctikzvalof{tripoles/thyristor/diode height}\pgf@circ@res@up}
9292 }
9293 \pgfpathlineto{\pgfpoint
9294 {\ctikzvalof{tripoles/thyristor/gate kink}*\pgf@circ@res@left}
9295 {\pgf@circ@res@up}
9296 }
9297 % draw bar line.
9298 \pgfpathmoveto{\pgfpoint
9299 {(\ctikzvalof{tripoles/thyristor/gate kink}-\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left}
9300 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
9301 }
9302 \pgfpathlineto{\pgfpoint
9303 {(\ctikzvalof{tripoles/thyristor/gate kink}+\ctikzvalof{tripoles/thyristor/gto bar width})*\pgf@circ@res@left}
9304 {(1+\ctikzvalof{tripoles/thyristor/diode height})*0.5*\pgf@circ@res@up}
9305 }
9306 \pgfusepath{draw}
9307 }
9308
9309 \pgfcircdeclarethyristor{fullagtobar}{0}{-1}{\pgfcirc@anodebargate@gto@add}
9310 \pgfcircdeclarethyristor{emptyagtobar}{1}{-1}{\pgfcirc@anodebargate@gto@add}
9311
9312 % Triacs
9313
9314 \def\pgfcircdeclaretriac#1#2{%name, fill (0-> black; 1-empty)
9315 \pgfcircdeclarebipolescaled{diodes}
9316 {
9317 \savedmacro{\gatekink}{\edef\gatekink{\ctikzvalof{tripoles/triac/gate kink}}}
9318 \anchor{gate}{\northeast\pgf@x=\gatekink\pgf@x}
9319 \anchor{G}{\northeast\pgf@x=\gatekink\pgf@x}
9320 \anchor{anode}{\southwest\pgf@y=0cm}
9321 \anchor{cathode}{\northeast\pgf@y=0cm }
9322 }
9323 {\ctikzvalof{tripoles/triac/height}}
9324 {#1}
9325 {\ctikzvalof{tripoles/triac/height}}
9326 {\ctikzvalof{tripoles/triac/width}}
9327 {
9328 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9329
9330 \pgf@circ@res@other = \ctikzvalof{tripoles/triac/diode width left}\pgf@circ@res@left
9331 \pgf@circ@res@step = \ctikzvalof{tripoles/triac/diode width right}\pgf@circ@res@right
9332
9333 % diodes forms
9334 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9335 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@step}{0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9336 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9337 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9338
9339 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9340 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@other}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9341 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9342 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}}
9343
9344 \ifnum#2=0\relax
9345 \pgf@circ@fill@strokecolor
9346 \pgfusepath{draw,fill}
9347 \else
9348 \pgf@circ@draworfill
9349 \fi
9350
9351 \pgfsetlinewidth{\pgfstartlinewidth}
9352
9353 % draw gate
9354 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{-0.707*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9355 \pgfpathlineto{\pgfpoint
9356 {\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}
9357 {-1.414*(\pgf@circ@res@other-\pgf@circ@res@step)}} % sqrt(1/2)
9358 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/triac/gate kink}*\pgf@circ@res@right}{\pgf@circ@res@up}} % sqrt(1/2)
9359
9360 % draw leads
9361 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}
9362 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9363
9364 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
9365 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9366
9367 \pgfusepath{draw}
9368
9369 }
9370 }
9371
9372 \pgfcircdeclaretriac{fulltriac}{0}
9373 \pgfcircdeclaretriac{emptytriac}{1}
9374
9375 % end of shape definitions for diodes%>>>
9376
9377 %% Paths definitions for Diodes%<<<
9378
9379 \def\pgfcirc@tmp@generatediodes#1#2{
9380 \pgfcirc@activate@bipole{l}{#1diode}{#1diode}{#1 diode}
9381 \pgfcirc@style@to@style{#1 diode}{D#2}
9382 \pgfcirc@activate@bipole{l}{#1zdiode}{#1zdiode}{#1 Zener diode}
9383 \pgfcirc@style@to@style{#1 Zener diode}{zD#2}
9384 \pgfcirc@activate@bipole{l}{#1zzdiode}{#1zzdiode}{#1 ZZener diode}
9385 \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2}
9386 \pgfcirc@activate@bipole{l}{#1sdiode}{#1sdiode}{#1 Schottky diode}
9387 \pgfcirc@style@to@style{#1 Schottky diode}{sD#2}
9388 \pgfcirc@activate@bipole{l}{#1tdiode}{#1tdiode}{#1 tunnel diode}
9389 \pgfcirc@style@to@style{#1 tunnel diode}{tD#2}
9390 \pgfcirc@activate@bipole{l}{#1lediode}{#1lediode}{#1 led}
9391 \pgfcirc@style@to@style{#1 led}{leD#2}
9392 \pgfcirc@activate@bipole{l}{#1laserdiode}{#1laserdiode}{#1 laser diode}
9393 \pgfcirc@style@to@style{#1 laser diode}{lasD#2}
9394 \pgfcirc@activate@bipole{l}{#1pdiode}{#1pdiode}{#1 photodiode}
9395 \pgfcirc@style@to@style{#1 photodiode}{pD#2}
9396 \pgfcirc@activate@bipole{l}{#1varcap}{#1varcap}{#1 varcap}
9397 \pgfcirc@style@to@style{#1 varcap}{VC#2}
9398 \pgfcirc@activate@bipole{l}{#1tvsdiode}{#1tvsdiode}{#1 TVS diode}
9399 \pgfcirc@style@to@style{#1 TVS diode}{tvsD#2}
9400 \pgfcirc@activate@bipole{l}{#1shdiode}{#1shdiode}{#1 Shockley diode}
9401 \pgfcirc@style@to@style{#1 Shockley diode}{shD#2}
9402 \pgfcirc@activate@bipole{l}{#1bidirectionaldiode}{#1bidirectionaldiode}{#1 bidirectionaldiode}
9403 \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2}
9404 \pgfcirc@activate@bipole{l}{#1thyristor}{#1thyristor}{#1 thyristor}
9405 \pgfcirc@style@to@style{#1 thyristor}{Ty#2}
9406 \pgfcirc@activate@bipole{l}{#1put}{#1put}{#1 put}
9407 \pgfcirc@style@to@style{#1 put}{PUT#2}
9408 \pgfcirc@activate@bipole{l}{#1gto}{#1gto}{#1 gto}
9409 \pgfcirc@style@to@style{#1 gto}{GTO#2}
9410 \pgfcirc@activate@bipole{l}{#1gtobar}{#1gtobar}{#1 gtobar}
9411 \pgfcirc@style@to@style{#1 gtobar}{GTOb#2}
9412 \pgfcirc@activate@bipole{l}{#1agtobar}{#1agtobar}{#1 agtobar}
9413 \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2}
9414 \pgfcirc@activate@bipole{l}{#1triac}{#1triac}{#1 triac}
9415 \pgfcirc@style@to@style{#1 triac}{Tr#2}
9416 }
9417 \pgfcirc@tmp@generatediodes{full}{*}
9418 \pgfcirc@tmp@generatediodes{empty}{o}
9419 \def\pgfcirc@tmp@generatestrokeddiodes#1#2{
9420 \pgfcirc@node@to@style{l}{emptydiode}{#1 diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9421 \pgfcirc@style@to@style{#1 diode}{D#2}
9422 \pgfcirc@node@to@style{l}{emptyzdiode}{#1 Zener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9423 \pgfcirc@style@to@style{#1 Zener diode}{zD#2}
9424 \pgfcirc@node@to@style{l}{emptyzzdiode}{#1 ZZener diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9425 \pgfcirc@style@to@style{#1 ZZener diode}{zzD#2}
9426 \pgfcirc@node@to@style{l}{emptysdiode}{#1 Schottky diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9427 \pgfcirc@style@to@style{#1 Schottky diode}{sD#2}
9428 \pgfcirc@node@to@style{l}{emptytdiode}{#1 tunnel diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9429 \pgfcirc@style@to@style{#1 tunnel diode}{tD#2}
9430 \pgfcirc@node@to@style{l}{emptylediode}{#1 led}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9431 \pgfcirc@style@to@style{#1 led}{leD#2}
9432 \pgfcirc@node@to@style{l}{emptylaserdiode}{#1 laser diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9433 \pgfcirc@style@to@style{#1 laser diode}{lasD#2}
9434 \pgfcirc@node@to@style{l}{emptypdiode}{#1 photodiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9435 \pgfcirc@style@to@style{#1 photodiode}{pD#2}
9436 \pgfcirc@node@to@style{l}{emptyvarcap}{#1 varcap}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9437 \pgfcirc@style@to@style{#1 varcap}{VC#2}
9438 \pgfcirc@node@to@style{l}{emptytvsdiode}{#1 TVS diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9439 \pgfcirc@style@to@style{#1 TVS diode}{tvsD#2}
9440 \pgfcirc@node@to@style{l}{emptyshdiode}{#1 Shockley diode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9441 \pgfcirc@style@to@style{#1 Shockley diode}{shD#2}
9442 \pgfcirc@node@to@style{l}{emptybidirectionaldiode}{#1 bidirectionaldiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9443 \pgfcirc@style@to@style{#1 bidirectionaldiode}{biD#2}
9444 \pgfcirc@node@to@style{l}{emptythyristor}{#1 thyristor}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9445 \pgfcirc@style@to@style{#1 thyristor}{Ty#2}
9446 \pgfcirc@node@to@style{l}{emptyput}{#1 put}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9447 \pgfcirc@style@to@style{#1 put}{PUT#2}
9448 \pgfcirc@node@to@style{l}{emptygto}{#1 gto}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9449 \pgfcirc@style@to@style{#1 gto}{GTO#2}
9450 \pgfcirc@node@to@style{l}{emptygtobar}{#1 gtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9451 \pgfcirc@style@to@style{#1 gtobar}{GTOb#2}
9452 \pgfcirc@node@to@style{l}{emptyagtobar}{#1 agtobar}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9453 \pgfcirc@style@to@style{#1 agtobar}{aGTOb#2}
9454 \pgfcirc@node@to@style{l}{emptytriac}{#1 triac}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9455 \pgfcirc@style@to@style{#1 triac}{Tr#2}
9456 \pgfcirc@node@to@style{l}{emptytvsdiode}{#1 tvsdiode}{\circuitikzbasekey/bipole/is strokedsymbol=true}
9457 \pgfcirc@style@to@style{#1 tvsdiode}{Tr#2}
9458 }
9459 \pgfcirc@tmp@generatestrokeddiodes{stroke}{-}
9460 \def\pgfcircdiodestylemacro{\ifpgf@circuit@strokediode stroke \else\ifpgf@circuit@fulldiode full \else empty \fi\fi}
9461 % these are auto-switching styles
9462 \pgfcirc@style@to@style{\pgfcircdiodestylemacro diode}{diode}
9463 \pgfcirc@style@to@style{diode}{D}
9464 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Zener diode}{Zener diode}
9465 \pgfcirc@style@to@style{Zener diode}{zD}
9466 \pgfcirc@style@to@style{\pgfcircdiodestylemacro ZZener diode}{ZZener diode}
9467 \pgfcirc@style@to@style{ZZener diode}{zzD}
9468 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Schottky diode}{Schottky diode}
9469 \pgfcirc@style@to@style{Schottky diode}{sD}
9470 \pgfcirc@style@to@style{\pgfcircdiodestylemacro tunnel diode}{tunnel diode}
9471 \pgfcirc@style@to@style{tunnel diode}{tD}
9472 \pgfcirc@style@to@style{\pgfcircdiodestylemacro led}{led}
9473 \pgfcirc@style@to@style{led}{leD}
9474 \pgfcirc@style@to@style{\pgfcircdiodestylemacro photodiode}{photodiode}
9475 \pgfcirc@style@to@style{photodiode}{pD}
9476 \pgfcirc@style@to@style{\pgfcircdiodestylemacro laser diode}{laser diode}
9477 \pgfcirc@style@to@style{laser diode}{lasD}
9478 \pgfcirc@style@to@style{\pgfcircdiodestylemacro varcap}{varcap}
9479 \pgfcirc@style@to@style{varcap}{VC}
9480 \pgfcirc@style@to@style{\pgfcircdiodestylemacro TVS diode}{TVS diode}
9481 \pgfcirc@style@to@style{TVS diode}{tvsD}
9482 \pgfcirc@style@to@style{\pgfcircdiodestylemacro Shockley diode}{Shockley diode}
9483 \pgfcirc@style@to@style{Shockley diode}{shD}
9484 \pgfcirc@style@to@style{\pgfcircdiodestylemacro bidirectionaldiode}{bidirectionaldiode}
9485 \pgfcirc@style@to@style{bidirectionaldiode}{biD}
9486 \pgfcirc@style@to@style{\pgfcircdiodestylemacro thyristor}{thyristor}
9487 \pgfcirc@style@to@style{thyristor}{Ty}
9488 \pgfcirc@style@to@style{\pgfcircdiodestylemacro put}{put}
9489 \pgfcirc@style@to@style{put}{PUT}
9490 \pgfcirc@style@to@style{\pgfcircdiodestylemacro gto}{gto}
9491 \pgfcirc@style@to@style{gto}{GTO}
9492 \pgfcirc@style@to@style{\pgfcircdiodestylemacro gtobar}{gtobar}
9493 \pgfcirc@style@to@style{gtobar}{GTOb}
9494 \pgfcirc@style@to@style{\pgfcircdiodestylemacro agtobar}{agtobar}
9495 \pgfcirc@style@to@style{agtobar}{aGTOb}
9496 \pgfcirc@style@to@style{\pgfcircdiodestylemacro triac}{triac}
9497 \pgfcirc@style@to@style{triac}{Tr}
9498 % %>>>
9499
9500 %%%%%%%%%%%%%
9501 %% switches, buttons and jumpers
9502 %%%%%%%%%%%%%
9503
9504 %% Definitions for switches%<<<1
9505
9506 \ctikzset{bipoles/spst/height/.initial=.35}
9507 \ctikzset{bipoles/spst/width/.initial=.35}
9508 \ctikzset{bipoles/spst/depth/.initial=.2}
9509 \ctikzset{bipoles/nos/height/.initial=.3}
9510 \ctikzset{bipoles/nos/width/.initial=.35}
9511 \ctikzset{bipoles/nos/depth/.initial=.2}
9512 \ctikzset{bipoles/ncs/height/.initial=.35}
9513 \ctikzset{bipoles/ncs/width/.initial=.35}
9514 \ctikzset{bipoles/ncs/depth/.initial=.2}
9515 \ctikzset{bipoles/pushbutton/height/.initial=.5}
9516 \ctikzset{bipoles/pushbutton/height 2/.initial=.2}
9517 \ctikzset{bipoles/pushbutton/width/.initial=.50}
9518 %%% reed switch
9519 \ctikzset{bipoles/reed/height/.initial=.4}
9520 \ctikzset{bipoles/reed/width/.initial=.8}% 0.35 in nos
9521 \ctikzset{bipoles/reed/depth/.initial=.4}
9522 %% Cute switches
9523 \ctikzset{bipoles/cuteswitch/shape/.initial={ocirc}}
9524 \ctikzset{bipoles/cuteswitch/height/.initial=.6}
9525 \ctikzset{bipoles/cuteswitch/height 2/.initial=.2}
9526 \ctikzset{bipoles/cuteswitch/width/.initial=.50}
9527 \ctikzset{bipoles/cuteswitch/thickness/.initial=1}
9528
9529 \ctikzset{tripoles/spdt/width/.initial=.85}
9530 \ctikzset{tripoles/spdt/height/.initial=.45}
9531 \ctikzset{tripoles/spdt/margin/.initial=.45}
9532
9533 \ctikzset{tripoles/toggleswitch/height/.initial=.8}
9534 \ctikzset{tripoles/toggleswitch/height 2/.initial=.0}
9535 \ctikzset{tripoles/toggleswitch/width/.initial=.80}
9536 %% arrow configurability
9537 \ctikzset{switch arrows/.is family}
9538 \ctikzset{switch arrows/relative thickness/.initial=1}
9539 \ctikzset{switch arrows/color/.initial=default}
9540 \ctikzset{switch arrows/dash/.initial=default}
9541 \def\pgf@circ@set@switcharrow@style{%
9542 % You *must* be sure that this is called inside a \pgfscope!
9543 \pgfsetlinewidth{\ctikzvalof{switch arrows/relative thickness}\pgflinewidth}
9544 \pgf@circ@subset@color@dash{switch arrows}
9545 \pgfcirc@set@arrows{switch}{}{latexslim}
9546 }
9547 \def\pgf@circ@savedanchor@trad@midlever#1#2{% #1 -> name #2 -> relative height
9548 \savedanchor\midlever{% this is the full height of the "handle" of switch
9549 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9550 \pgf@y=\ctikzvalof{bipoles/#1/height}\pgf@circ@scaled@Rlen
9551 \pgf@x=0pt\pgf@y=0.5\pgf@y
9552 }
9553 \anchor{mid}{\midlever\pgf@y=#2\pgf@y}
9554 }
9555 %%>>>
9556
9557 %% Shapes Node for bipoles switches and similar things%<<<
9558 %% (Closing) SPST
9559 \pgfcircdeclarebipolescaled{switches}
9560 {
9561 \pgf@circ@savedanchor@trad@midlever{spst}{0.6}
9562 }
9563 {\ctikzvalof{bipoles/spst/depth}}
9564 {cspst}
9565 {\ctikzvalof{bipoles/spst/height}}
9566 {\ctikzvalof{bipoles/spst/width}}
9567 {
9568 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9569 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9570 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
9571 \pgfusepath{draw}
9572 \pgfscope
9573 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9574 \pgfpathmoveto{\pgfpointpolar{90}{1.2\pgf@circ@res@right}}
9575 \pgfpatharc{90}{-20}{1.2\pgf@circ@res@right}
9576 \pgf@circ@set@switcharrow@style
9577 \pgfsetbeveljoin
9578 \pgfusepath{draw}
9579 \endpgfscope
9580 }
9581
9582 %% Opening SPST
9583 \pgfcircdeclarebipolescaled{switches}
9584 {
9585 \pgf@circ@savedanchor@trad@midlever{spst}{0.6}
9586 }
9587 {\ctikzvalof{bipoles/spst/depth}}
9588 {ospst}
9589 {\ctikzvalof{bipoles/spst/height}}
9590 {\ctikzvalof{bipoles/spst/width}}
9591 {
9592 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9593 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9594 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@up}}
9595 \pgfusepath{draw}
9596 \pgfscope
9597 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9598 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
9599 \pgfpatharc{-10}{90}{1.2\pgf@circ@res@right}
9600 \pgf@circ@set@switcharrow@style
9601 \pgfsetbeveljoin
9602 \pgfusepath{draw}
9603 \endpgfscope
9604 }
9605
9606 %% Normal open Switch
9607 \pgfcircdeclarebipolescaled{switches}
9608 {
9609 \pgf@circ@savedanchor@trad@midlever{nos}{0.5}
9610 }
9611 {\ctikzvalof{bipoles/nos/depth}}
9612 {nos}
9613 {\ctikzvalof{bipoles/nos/height}}
9614 {\ctikzvalof{bipoles/nos/width}}
9615 {
9616 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9617 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9618 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9619 \pgfsetbuttcap
9620 \pgfusepath{draw}
9621 }
9622
9623 %% Normal closed Switch
9624 \pgfcircdeclarebipolescaled{switches}
9625 {
9626 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9627 }
9628 {\ctikzvalof{bipoles/ncs/depth}}
9629 {ncs}
9630 {\ctikzvalof{bipoles/ncs/height}}
9631 {\ctikzvalof{bipoles/ncs/width}}
9632 {
9633 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9634 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9635 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9636 \pgfusepath{draw}
9637 \pgfsetlinewidth{\pgfstartlinewidth}
9638 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9639 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9640 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
9641 \pgfusepath{draw}
9642 }
9643
9644 % Opening normal closed Switch
9645 \pgfcircdeclarebipolescaled{switches}
9646 {
9647 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9648 }
9649 {\ctikzvalof{bipoles/ncs/depth}}
9650 {oncs}
9651 {\ctikzvalof{bipoles/ncs/height}}
9652 {\ctikzvalof{bipoles/ncs/width}}
9653 {
9654 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9655 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9656 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9657 \pgfusepath{draw}
9658 \pgfsetlinewidth{\pgfstartlinewidth}
9659 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9660 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9661 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
9662 \pgfusepath{draw}
9663 \pgfscope
9664 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9665 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9666 \pgfpathmoveto{\pgfpointpolar{-10}{.9\pgf@circ@res@right}}
9667 \pgfpatharc{-10}{95}{.9\pgf@circ@res@right}
9668 \pgf@circ@set@switcharrow@style
9669 \pgfsetbeveljoin
9670 \pgfusepath{draw}
9671 \endpgfscope
9672 }
9673
9674 %% Closing normal closed Switch
9675 \pgfcircdeclarebipolescaled{switches}
9676 {
9677 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9678 }
9679 {\ctikzvalof{bipoles/ncs/depth}}
9680 {cncs}
9681 {\ctikzvalof{bipoles/ncs/height}}
9682 {\ctikzvalof{bipoles/ncs/width}}
9683 {
9684 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9685 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9686 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9687 \pgfusepath{draw}
9688 \pgfsetlinewidth{\pgfstartlinewidth}
9689 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9690 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9691 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
9692 \pgfusepath{draw}
9693 \pgfscope
9694 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9695 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9696 \pgfpathmoveto{\pgfpointpolar{90}{.9\pgf@circ@res@right}}
9697 \pgfpatharc{90}{-35}{.9\pgf@circ@res@right}
9698 \pgf@circ@set@switcharrow@style
9699 \pgfsetbeveljoin
9700 \pgfusepath{draw}
9701 \endpgfscope
9702 }
9703
9704 %% Opening normal open Switch
9705 \pgfcircdeclarebipolescaled{switches}
9706 {
9707 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9708 }
9709 {\ctikzvalof{bipoles/ncs/depth}}
9710 {onos}
9711 {\ctikzvalof{bipoles/ncs/height}}
9712 {\ctikzvalof{bipoles/ncs/width}}
9713 {
9714 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9715 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9716 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9717 \pgfusepath{draw}
9718 \pgfsetlinewidth{\pgfstartlinewidth}
9719 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9720 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9721 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{.4\pgf@circ@res@up}}
9722 \pgfusepath{draw}
9723 \pgfscope
9724 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9725 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9726 \pgfpathmoveto{\pgfpointpolar{-10}{.9\pgf@circ@res@right}}
9727 \pgfpatharc{-10}{95}{.9\pgf@circ@res@right}
9728 \pgf@circ@set@switcharrow@style
9729 \pgfsetbeveljoin
9730 \pgfusepath{draw}
9731 \endpgfscope
9732 }
9733
9734 %% Closing normal open Switch
9735 \pgfcircdeclarebipolescaled{switches}
9736 {
9737 \pgf@circ@savedanchor@trad@midlever{ncs}{0.5}
9738 }
9739 {\ctikzvalof{bipoles/ncs/depth}}
9740 {cnos}
9741 {\ctikzvalof{bipoles/ncs/height}}
9742 {\ctikzvalof{bipoles/ncs/width}}
9743 {
9744 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9745 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9746 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@up}}
9747 \pgfusepath{draw}
9748 \pgfsetlinewidth{\pgfstartlinewidth}
9749 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9750 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{0pt}}
9751 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{.4\pgf@circ@res@up}}
9752 \pgfusepath{draw}
9753 \pgfscope
9754 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9755 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9756 \pgfpathmoveto{\pgfpointpolar{90}{.9\pgf@circ@res@right}}
9757 \pgfpatharc{90}{-35}{.9\pgf@circ@res@right}
9758 \pgf@circ@set@switcharrow@style
9759 \pgfsetbeveljoin
9760 \pgfusepath{draw}
9761 \endpgfscope
9762 }
9763
9764 %% Push Button
9765 \pgfcircdeclarebipolescaled{switches}
9766 {
9767 \anchor{tip}{\northeast\pgf@x=0pt\relax}
9768 % we can use the generic here, the "bar" is related to bipoles/*/height
9769 \pgf@circ@savedanchor@trad@midlever{pushbutton}{0.5}
9770 }
9771 {\ctikzvalof{bipoles/pushbutton/height 2}}
9772 {pushbutton}
9773 {\ctikzvalof{bipoles/pushbutton/height}}
9774 {\ctikzvalof{bipoles/pushbutton/width}}
9775 {
9776 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9777 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@up}}
9778 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@up}}
9779 \pgfpathmoveto{\pgfpoint{0}{.5\pgf@circ@res@up}}
9780 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
9781 \pgfusepath{draw}
9782
9783 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9784 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9785 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9786 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9787 }
9788
9789 %% Normally closed Push Button
9790 \pgfcircdeclarebipolescaled{switches}
9791 {
9792 \anchor{tip}{\northeast\pgf@x=0pt\relax}
9793 \savedanchor{\nodeheight}{
9794 \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
9795 }
9796 \anchor{mid}{\nodeheight\pgf@y=-\pgf@y}
9797 % \pgf@circ@savedanchor@trad@midlever{pushbutton}{0.5}
9798 }
9799 {\ctikzvalof{bipoles/pushbutton/height 2}}
9800 {ncpushbutton}
9801 {\ctikzvalof{bipoles/pushbutton/height}}
9802 {\ctikzvalof{bipoles/pushbutton/width}}
9803 {
9804 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9805 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9806 % Warning, if the nodes will have a class, we have to touch this.
9807 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
9808 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
9809 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@temp}}
9810 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@temp}}
9811 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up}}
9812 \pgfusepath{draw}
9813 %
9814 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9815 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9816 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9817 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9818 }
9819 %% Push Button (normally closed but now open :-) see
9820 %% https://github.com/circuitikz/circuitikz/issues/128#issuecomment-731771299
9821 \pgfcircdeclarebipolescaled{switches}
9822 {
9823 \savedanchor{\nodeheight}{
9824 \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
9825 }
9826 \anchor{tip}{
9827 \nodeheight\pgf@circ@res@temp=\pgf@y
9828 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
9829 \pgf@x=0pt\relax
9830 }
9831 \anchor{mid}{\nodeheight}
9832 }
9833 {\ctikzvalof{bipoles/pushbutton/height 2}}
9834 {pushbuttonc}
9835 {\ctikzvalof{bipoles/pushbutton/height}}
9836 {\ctikzvalof{bipoles/pushbutton/width}}
9837 {
9838 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9839 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
9840 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
9841 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}
9842 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@temp}}
9843 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
9844 \pgfusepath{draw}
9845
9846 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9847 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9848 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9849 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9850 }
9851
9852 %% Normally closed Push Button now open
9853 \pgfcircdeclarebipolescaled{switches}
9854 {
9855 \savedanchor{\nodeheight}{
9856 \pgf@x=0pt\pgf@y=\ctikzvalof{nodes width}\pgf@circ@Rlen
9857 }
9858 \anchor{tip}{
9859 \nodeheight\pgf@circ@res@temp=\pgf@y
9860 \northeast\divide\pgf@y by 2\advance\pgf@y by \pgf@circ@res@temp
9861 \pgf@x=0pt\relax
9862 }
9863 \anchor{mid}{\northeast\pgf@x=0pt\pgf@y=-0.5\pgf@y}
9864 }
9865 {\ctikzvalof{bipoles/pushbutton/height 2}}
9866 {ncpushbuttono}
9867 {\ctikzvalof{bipoles/pushbutton/height}}
9868 {\ctikzvalof{bipoles/pushbutton/width}}
9869 {
9870 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9871 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9872 % Warning, if the nodes will have a class, we have to touch this.
9873 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
9874 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up/2}}
9875 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up/2}}
9876 \pgfpathmoveto{\pgfpoint{0}{-\pgf@circ@res@up/2}}
9877 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@up/2+\pgf@circ@res@temp}}
9878 \pgfusepath{draw}
9879 %
9880 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9881 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9882 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9883 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw}}
9884 }
9885 %%% reed switches
9886 \pgfcircdeclarebipolescaled{switches}
9887 {
9888 \pgf@circ@savedanchor@trad@midlever{nos}{0.5}
9889 }
9890 {\ctikzvalof{bipoles/reed/depth}}
9891 {reed}
9892 {\ctikzvalof{bipoles/reed/height}}
9893 {\ctikzvalof{bipoles/reed/width}}
9894 {
9895 % this is designed to be the same as a "nos".
9896 \pgfmathsetmacro{\@@tmpx}{0.9*\ctikzvalof{bipoles/nos/width}/\ctikzvalof{bipoles/reed/width}}
9897 \pgfmathsetmacro{\@@tmpy}{\ctikzvalof{bipoles/nos/height}/\ctikzvalof{bipoles/reed/height}}
9898 \pgfscope
9899 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9900 % eclosure
9901 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
9902 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
9903 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{-\pgf@circ@res@up}}
9904 \pgfpatharc{270}{90}{\pgf@circ@res@up}
9905 \pgfpathclose
9906 \pgf@circ@draworfill
9907 % switch
9908 \pgfpathmoveto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
9909 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{\@@tmpy\pgf@circ@res@up}}
9910 % connection lines
9911 \pgfsetbuttcap
9912 \pgfusepath{draw}
9913 \endpgfscope
9914 % connection lines
9915 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9916 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@left}{0pt}}
9917 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
9918 \pgfpathlineto{\pgfpoint{\@@tmpx\pgf@circ@res@right}{0pt}}
9919 \pgfusepath{draw}
9920 }
9921
9922 % cute switch "to" shapes help function
9923 % #1 -> name
9924 % #2 -> barposition
9925 % #3 -> arrowcode
9926 \long\def\pgfcircdeclarecutesw#1#2#3{
9927 \pgfcircdeclarebipolescaled{switches}
9928 {
9929 \savedanchor\midlever{
9930 % these values are calculated when we create the definition of the shape.
9931 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
9932 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
9933 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
9934 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
9935 \pgf@circ@res@down = -.5\pgf@y
9936 \pgf@circ@res@up = .5\pgf@y
9937 \pgfextracty{\pgf@circ@res@other}{#2}
9938 \pgf@x=0pt
9939 \pgf@y=.5\pgf@circ@res@other
9940 }
9941 % radius of the connector
9942 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9943 % If cnnecting nodes are scaled, we have to modify this
9944 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
9945 % shapename
9946 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
9947 % shape type
9948 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
9949 % mid of the lever, to stack switches
9950 \anchor{mid}{\midlever}
9951 \anchor{cout}{\northeast \pgf@y=0cm}
9952 \anchor{cin}{\southwest\pgf@y=0cm}
9953 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
9954 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
9955 }
9956 {\ctikzvalof{bipoles/cuteswitch/height 2}}
9957 {#1}
9958 {\ctikzvalof{bipoles/cuteswitch/height}}
9959 {\ctikzvalof{bipoles/cuteswitch/width}}{
9960 \pgfscope
9961 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
9962 % If connecting nodes are scaled, we have to modify this
9963 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@Rlen
9964 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
9965 \pgfsetlinewidth{2\pgf@circ@res@temp}
9966 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
9967 \pgfpathlineto{#2}
9968 \pgfsetroundcap\pgfusepath{draw}
9969 \endpgfscope
9970 \pgfscope % arrow
9971 \pgf@circ@fill@strokecolor
9972 #3%
9973 \endpgfscope
9974 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
9975 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
9976 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
9977 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
9978 }
9979 }
9980
9981 %% closed cute switch
9982 \pgfcircdeclarecutesw{cuteclosedswitch}
9983 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
9984 {}
9985
9986 %% open cute switch
9987 \pgfcircdeclarecutesw{cuteopenswitch}
9988 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9989 {}
9990
9991 %% closing cute switch
9992 \pgfcircdeclarecutesw{cuteclosingswitch}
9993 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
9994 {
9995 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
9996 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
9997 \pgfpathmoveto{\pgfpointpolar{70}{1.2\pgf@circ@res@right}}
9998 \pgfpatharc{70}{-10}{1.2\pgf@circ@res@right}
9999 \pgf@circ@set@switcharrow@style
10000 \pgfusepath{draw}
10001 }
10002
10003 %% opening cute switch
10004 \pgfcircdeclarecutesw{cuteopeningswitch}
10005 {\pgfpoint{\pgf@circ@res@right}{1.5\pgf@circ@res@temp}}
10006 {
10007 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10008 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10009 \pgfpathmoveto{\pgfpointpolar{-10}{1.2\pgf@circ@res@right}}
10010 \pgfpatharc{-10}{60}{1.2\pgf@circ@res@right}
10011 \pgf@circ@set@switcharrow@style
10012 \pgfusepath{draw}
10013 }
10014
10015 \pgfcircdeclarebipole{
10016 \anchor{out 1}{\northeast\pgf@y=0pt\relax}
10017 \anchor{out 2}{\northeast\pgf@y=.8\pgf@y}
10018 \anchor{in}{\northeast\pgf@y=0pt\pgf@x=-\pgf@x}
10019 \anchor{mid}{\northeast\pgf@x=0.2\pgf@x\pgf@y=0.25\pgf@y}
10020 }
10021 {\ctikzvalof{tripoles/toggleswitch/height 2}}
10022 {toggleswitch}
10023 {\ctikzvalof{tripoles/toggleswitch/height}}
10024 {\ctikzvalof{tripoles/toggleswitch/width}}
10025 {
10026
10027 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10028 \pgfpathlineto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
10029 \pgfusepath{draw}
10030 \pgfscope
10031 \pgfpathmoveto{\pgfpoint{.3\pgf@circ@res@left}{0pt}}
10032 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10033 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{.5\pgf@circ@res@up}}
10034 \pgfusepath{draw}
10035 \endpgfscope
10036
10037 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
10038 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{0}}
10039
10040 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{.8\pgf@circ@res@up}}
10041 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.8\pgf@circ@res@up}}
10042 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@right}{.15\pgf@circ@res@up}}
10043 \pgfusepath{draw}
10044
10045
10046 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@left}{\pgf@circ@res@up}}
10047 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@right}{\pgf@circ@res@up}}
10048 \pgfusepath{draw}
10049
10050 \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}
10051 \pgfpathmoveto{\pgfpoint{0}{\pgf@circ@res@up}}
10052 \pgfpathlineto{\pgfpoint{0}{.8\pgf@circ@res@up}}
10053 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@left}{.6\pgf@circ@res@up}}
10054 \pgfpathlineto{\pgfpoint{0}{.4\pgf@circ@res@up}}
10055 \pgfpathlineto{\pgfpoint{0}{.2\pgf@circ@res@up}}
10056 \pgfusepath{draw}
10057 \pgfsetdash{}{0cm}
10058 }
10059
10060 % %>>>
10061
10062 %% Shape nodes for switches (non-bipoles)%<<<
10063
10064 %%%%%%%%%%%%%
10065 %% switches
10066 %%%%%%%%%%%%%
10067
10068 % Legacy spdt
10069 \pgfdeclareshape{spdt}{
10070 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10071 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10072 \savedanchor\northwest{%
10073 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10074 \pgf@y=\ctikzvalof{tripoles/spdt/height}\pgf@circ@scaled@Rlen
10075 \pgf@y=.5\pgf@y
10076 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10077 \pgf@x=.5\pgf@x
10078 }
10079 \pgfcirc@northwest@symmetric@geoanchors
10080 \anchor{in}{\northwest\pgf@y=0pt}
10081 \anchor{out 1}{\northwest\pgf@x=-\pgf@x}
10082 % this is "by eye", it'll be wrong with non-standard ocirc
10083 \anchor{mid}{\northwest\pgf@x=0pt\pgf@y=0.37\pgf@y}
10084 \anchor{out 2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
10085 \anchor{center}{\pgf@y=0pt\pgf@x=0pt}
10086 \pgf@circ@draw@component{
10087 \pgf@circ@setcolor
10088 \northwest
10089 \pgf@circ@res@up = \pgf@y
10090 \pgf@circ@res@down = -\pgf@y
10091 \pgf@circ@res@right = -\pgf@x
10092 \pgf@circ@res@left = \pgf@x
10093 \pgf@circ@res@other = \ctikzvalof{tripoles/spdt/margin}\pgf@circ@res@left
10094 %
10095 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10096 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10097 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10098 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10099 %
10100 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10101 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
10102 \pgfusepath{draw}
10103 \pgfscope
10104 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
10105 \pgfnode{ocirc}{center}{}{spdt1}{\pgfusepath{stroke}}
10106 \endpgfscope
10107 \pgfscope
10108 \pgftransformshift{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
10109 \pgfnode{ocirc}{center}{}{}{\pgfusepath{stroke}}
10110 \endpgfscope
10111 \pgfscope
10112 \pgftransformshift{\pgfpoint{\pgf@circ@res@other}{0pt}}
10113 \pgfnode{ocirc}{center}{}{spdt2}{\pgfusepath{stroke}}
10114 \endpgfscope
10115 \pgfscope
10116 \pgfpathmoveto{\pgfpointshapeborder{spdt2}{\pgfpointorigin}}
10117 \pgfpathlineto{
10118 \pgfpointadd{\pgfpointshapeborder{spdt1}{\pgfpoint{-\pgf@circ@res@other}{-100pt}}}
10119 {\pgfpoint{-.05\pgf@circ@res@up}{-.05\pgf@circ@res@up}}
10120 }
10121 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10122 \pgfusepath{draw}
10123 \endpgfscope
10124 }
10125 }
10126
10127
10128 % cute switch "node" shapes, matching with cute "to" shapes
10129 % #1 -> name
10130 % #2 -> barposition
10131 % #3 -> arrowcode
10132 \long\def\pgfcircdeclarecutespdt#1#2#3{
10133 \pgfdeclareshape{#1}
10134 {
10135 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10136 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10137 \savedanchor\northwest{%
10138 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10139 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10140 \pgf@y=.5\pgf@y
10141 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
10142 \pgf@x=.25\pgf@x
10143 }
10144 \savedanchor\midlever{
10145 % these values are calculated when we create the definition of the shape.
10146 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
10147 \pgf@y=\ctikzvalof{bipoles/cuteswitch/height}\pgf@circ@scaled@Rlen
10148 \pgf@circ@res@temp=\ctikzvalof{nodes width}\pgf@circ@scaled@Rlen
10149 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10150 \pgf@circ@res@down = -.5\pgf@y
10151 \pgf@circ@res@up = .5\pgf@y
10152 \pgfextracty{\pgf@circ@res@other}{#2}
10153 \pgf@x=0pt
10154 \pgf@y=.5\pgf@circ@res@other
10155 }
10156 % radius of the connector
10157 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10158 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10159 % shapename
10160 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
10161 % shape type
10162 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/cuteswitch/shape}}}
10163 % mid of the lever, to stack switches
10164 \anchor{mid}{\midlever}
10165 % center anchors
10166 \anchor{cin}{ \northwest \pgf@y=0pt}
10167 \anchor{cout 1}{ \northwest \pgf@x=-\pgf@x }
10168 \anchor{cout 2}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10169 % horizontal angles
10170 \anchor{in}{ \northwest \pgf@y=0pt\advance\pgf@x by -\radius}
10171 \anchor{out 1}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius}
10172 \anchor{out 2}{ \northwest \pgf@x=-\pgf@x \advance\pgf@x by \radius \pgf@y=-\pgf@y }
10173
10174 \anchor{center}{ \pgf@y=0pt \pgf@x=0pt }
10175 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
10176 \anchor{west}{ \northwest \pgf@y=0pt }
10177 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
10178 \anchor{north}{ \northwest \pgf@x=0pt }
10179 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
10180 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
10181 \anchor{north west}{ \northwest }
10182 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
10183
10184 \pgf@circ@draw@component{
10185 \pgf@circ@setcolor
10186 \northwest
10187 \pgf@circ@res@up = \pgf@y
10188 \pgf@circ@res@down = -\pgf@y
10189 \pgf@circ@res@right = -\pgf@x
10190 \pgf@circ@res@left = \pgf@x
10191
10192 \pgfscope
10193 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10194 \pgf@circ@res@temp=\radius\relax
10195 \pgf@circ@res@temp=\ctikzvalof{bipoles/cuteswitch/thickness}\pgf@circ@res@temp
10196 \pgfsetlinewidth{2\pgf@circ@res@temp}
10197 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
10198 \pgfpathlineto{#2}
10199 \pgfsetroundcap\pgfusepath{draw}
10200 \endpgfscope
10201 \pgfscope % arrow
10202 \pgf@circ@fill@strokecolor
10203 #3%
10204 \endpgfscope
10205 % terminals
10206 \pgfscope
10207 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10208 \pgfnode{\cshape}{center}{}{\thisshape-out 1}{\pgfusepath{stroke}}
10209 \endpgfscope
10210 \pgfscope
10211 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
10212 \pgfnode{\cshape}{center}{}{\thisshape-out 2}{\pgfusepath{stroke}}
10213 \endpgfscope
10214 \pgfscope
10215 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10216 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
10217 \endpgfscope
10218
10219 }
10220 }
10221 }
10222
10223 \pgfcircdeclarecutespdt{cute spdt up}
10224 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
10225 {}
10226
10227 \pgfcircdeclarecutespdt{cute spdt mid}
10228 {\pgfpoint{\pgf@circ@res@right}{0pt}}
10229 {}
10230
10231 \pgfcircdeclarecutespdt{cute spdt down}
10232 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
10233 {}
10234
10235 \pgfcircdeclarecutespdt{cute spdt up arrow}
10236 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@[email protected]\pgf@circ@res@temp}}
10237 {
10238 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10239 \pgfsetlinewidth{\ctikzvalof{switch arrows/relative thickness}\pgflinewidth}
10240 \pgf@circ@subset@color@dash{switch arrows}
10241 \pgfcirc@set@arrows{switch}{}{latexslim}
10242 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10243 \pgfpathmoveto{\pgfpointpolar{70}{1.5\pgf@circ@res@right}}
10244 \pgfpatharc{70}{-50}{1.5\pgf@circ@res@right}
10245 \pgfusepath{draw}
10246 }
10247
10248 \pgfcircdeclarecutespdt{cute spdt mid arrow}
10249 {\pgfpoint{\pgf@circ@res@right}{0pt}}
10250 {
10251 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10252 \pgfsetlinewidth{\ctikzvalof{switch arrows/relative thickness}\pgflinewidth}
10253 \pgf@circ@subset@color@dash{switch arrows}
10254 \pgfcirc@set@arrows{switch}{latexslim}{latexslim}
10255 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10256 \pgfpathmoveto{\pgfpointpolar{-60}{1.5\pgf@circ@res@right}}
10257 \pgfpatharc{-60}{60}{1.5\pgf@circ@res@right}
10258 \pgfusepath{draw}
10259 }
10260
10261 \pgfcircdeclarecutespdt{cute spdt down arrow}
10262 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down+1.5\pgf@circ@res@temp}}
10263 {
10264 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
10265 \pgfsetlinewidth{\ctikzvalof{switch arrows/relative thickness}\pgflinewidth}
10266 \pgf@circ@subset@color@dash{switch arrows}
10267 \pgfcirc@set@arrows{switch}{}{latexslim}
10268 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % in node
10269 \pgfpathmoveto{\pgfpointpolar{-50}{1.5\pgf@circ@res@right}}
10270 \pgfpatharc{-50}{70}{1.5\pgf@circ@res@right}
10271 \pgfusepath{draw}
10272 }
10273 % %>>>
10274
10275 %% Paths Switches and buttons%<<<
10276
10277 \pgfcirc@activate@bipole{l}{cspst}{cspst}{closing switch}
10278 \pgfcirc@style@to@style{closing switch}{switch}
10279 \pgfcirc@style@to@style{closing switch}{cspst}
10280 \pgfcirc@style@to@style{switch}{spst}
10281 \pgfcirc@activate@bipole{l}{ospst}{ospst}{opening switch}
10282 \pgfcirc@style@to@style{opening switch}{ospst}
10283
10284 \pgfcirc@activate@bipole@simple{l}{nos}
10285 \pgfcirc@style@to@style{nos}{normal open switch}
10286 \pgfcirc@activate@bipole@simple{l}{ncs}
10287 \pgfcirc@style@to@style{ncs}{normal closed switch}
10288 \pgfcirc@activate@bipole@simple{l}{oncs}
10289 \pgfcirc@style@to@style{oncs}{opening normal closed switch}
10290 \pgfcirc@activate@bipole@simple{l}{cncs}
10291 \pgfcirc@style@to@style{cncs}{closing normal closed switch}
10292 \pgfcirc@activate@bipole@simple{l}{onos}
10293 \pgfcirc@style@to@style{onos}{opening normal open switch}
10294 \pgfcirc@activate@bipole@simple{l}{cnos}
10295 \pgfcirc@style@to@style{cnos}{closing normal open switch}
10296
10297 \pgfcirc@activate@bipole{l}{pushbutton}{pushbutton}{push button}
10298 \pgfcirc@style@to@style{push button}{nopb}
10299 \pgfcirc@style@to@style{push button}{normally open push button}
10300 \pgfcirc@activate@bipole{l}{ncpushbutton}{ncpushbutton}{ncpb}
10301 \pgfcirc@style@to@style{ncpb}{normally closed push button}
10302 \pgfcirc@activate@bipole{l}{pushbuttonc}{pushbuttonc}{nopbc}
10303 \pgfcirc@style@to@style{nopbc}{normally open push button closed}
10304 \pgfcirc@activate@bipole{l}{ncpushbuttono}{ncpushbuttono}{ncpbo}
10305 \pgfcirc@style@to@style{ncpbo}{normally closed push button open}
10306
10307 \pgfcirc@activate@bipole{l}{toggleswitch}{toggleswitch}{toggle switch}
10308 \pgfcirc@activate@bipole@simple{l}{reed}
10309
10310 \pgfcirc@activate@bipole{l}{cuteclosedswitch}{cuteclosedswitch}{cute closed switch}
10311 \pgfcirc@style@to@style{cute closed switch}{ccsw}
10312 \pgfcirc@activate@bipole{l}{cuteopenswitch}{cuteopenswitch}{cute open switch}
10313 \pgfcirc@style@to@style{cute open switch}{cosw}
10314 \pgfcirc@activate@bipole{l}{cuteclosingswitch}{cuteclosingswitch}{cute closing switch}
10315 \pgfcirc@style@to@style{cute closing switch}{ccgsw}
10316 \pgfcirc@activate@bipole{l}{cuteopeningswitch}{cuteopeningswitch}{cute opening switch}
10317 \pgfcirc@style@to@style{cute opening switch}{cogsw}% %>>>
10318
10319 %% Proximity switch auxiliary shapes%<<<
10320 %% proximeter shape, for usage with switches
10321 \ctikzset{proximeter/width/.initial=0.3}
10322 \ctikzset{proximeter/hlines thickness/.initial=0.5}
10323 \ctikzset{proximeter/hlines position/.initial=0.3}
10324 \pgfdeclareshape{proximeter}
10325 {
10326 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
10327 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
10328 \savedmacro{\hlinepos}{\edef\hlinepos{\ctikzvalof{proximeter/hlines position}}}
10329 \savedanchor\northeast{%
10330 \pgfmathsetlength{\pgf@y}{\ctikzvalof{proximeter/width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
10331 \pgf@x=\pgf@y
10332 }
10333 \anchor{center}{\pgfpointorigin}
10334 % geo anchors based on north-east
10335 \pgfcirc@northeast@symmetric@geoanchors
10336 \anchor{text}{%
10337 \northeast
10338 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
10339 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
10340 }
10341 \anchor{hlines ne}{%
10342 \northeast
10343 \pgf@y=\hlinepos\pgf@y
10344 \advance\pgf@x by -\pgf@y
10345 }
10346 \anchor{hlines nw}{%
10347 \northeast
10348 \pgf@y=\hlinepos\pgf@y
10349 \advance\pgf@x by -\pgf@y\pgf@x=-\pgf@x
10350 }
10351 \anchor{hlines se}{%
10352 \northeast
10353 \pgf@y=\hlinepos\pgf@y
10354 \advance\pgf@x by -\pgf@y
10355 \pgf@y=-\pgf@y
10356 }
10357 \anchor{hlines sw}{%
10358 \northeast
10359 \pgf@y=\hlinepos\pgf@y
10360 \advance\pgf@x by -\pgf@y\pgf@x=-\pgf@x
10361 \pgf@y=-\pgf@y
10362 }
10363 \anchorborder{
10364 % \typeout{IN\space X:\the\pgf@x\space Y:\the\pgf@y}
10365 \pgfmathsetmacro{\@@switchx}{ifthenelse(\pgf@x>0,1,-1)}
10366 \pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
10367 \pgfmathsetlength{\pgf@xa}{abs(\pgf@x)}
10368 \pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
10369 \pgfextracty{\pgf@circ@res@up}{\northeast}
10370 % \typeout{MID\space X:\the\pgf@xa\space Y:\the\pgf@ya\space L:\the\pgf@circ@res@up}
10371 % \typeout{MID\space SX:\@@switchx\space SY:\@@switchy}
10372 \pgfpointintersectionoflines
10373 {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
10374 {\pgfqpoint{0pt}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@up}{0pt}}
10375 % \typeout{CROSS \space X:\the\pgf@x\space Y:\the\pgf@y}
10376 \pgf@x=\@@switchx\pgf@x
10377 \pgf@y=\@@switchy\pgf@y
10378 }
10379 \pgf@circ@draw@component{
10380 \northeast\pgf@circ@res@temp=\pgf@y
10381 \pgf@circ@setcolor
10382 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
10383 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@temp}{0pt}}
10384 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
10385 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{0pt}}
10386 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@temp}}
10387 \pgfpathclose
10388 \pgf@circ@draworfill
10389 \pgfsetlinewidth{\ctikzvalof{proximeter/hlines thickness}*\pgflinewidth}
10390 \pgfmathsetlength{\pgf@circ@res@up}{\hlinepos*\pgf@circ@res@temp}
10391 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@temp-\pgf@circ@res@up}
10392 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@up}}
10393 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10394 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{-\pgf@circ@res@up}}
10395 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
10396 \pgfusepath{draw}
10397 }
10398
10399 }
10400 \pgfcirc@node@to@path{proximeter}{inline proximeter}{}
10401 % %>>>
10402
10403 % jumpers: definitions and code %<<<
10404 % definitons for jumpers
10405 \ctikzset{bipoles/jumper/width/.initial=0.4}
10406 \ctikzset{bipoles/tjumper/width/.initial=0.6}% normally is less than 0.4*2
10407 \ctikzset{tjumper connections/.initial=00}% bare-bare
10408 \ctikzset{bipoles/jumper/height/.initial=0.4}
10409 \ctikzset{bipoles/jumper/depth/.initial=0.1}
10410 \ctikzset{bipoles/jumper/shape/.initial=ocirc}
10411 \ctikzset{bipoles/jumper/curvature/.initial=2} % curvature of the arc
10412 \ctikzset{bipoles/jumper/open shift/.initial=3} % displacement to open the arc
10413
10414 % jumpers
10415 % simple jumpers
10416 % #1 -> name
10417 % #2 -> height of the link arc (0 means no link, 1 closed, 2 open)
10418 \long\def\pgfcircdeclarejumper#1#2{
10419 \pgfcircdeclarebipolescaled{switches}
10420 {
10421 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10422 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10423 % shapename
10424 \savedmacro{\thisshape}{\edef\thisshape{\tikz@fig@name}}
10425 % shape type
10426 \savedmacro{\cshape}{\edef\cshape{\ctikzvalof{bipoles/jumper/shape}}}
10427 % arc characteristics (can vary, must be saved...)
10428 \savedmacro{\curvature}{\edef\curvature{\ctikzvalof{bipoles/jumper/curvature}}}
10429 \savedmacro{\openshift}{\edef\openshift{\ctikzvalof{bipoles/jumper/open shift}}}
10430 %
10431 \anchor{cout}{\northeast \pgf@y=0cm}
10432 \anchor{cin}{\southwest\pgf@y=0cm}
10433 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
10434 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
10435 \anchor{text}{\northeast
10436 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
10437 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
10438 }
10439 \anchor{top arc}{\northeast
10440 \pgf@circ@res@other=\pgf@x
10441 \pgf@circ@res@temp=\radius
10442 \ifnum #2=1 \edef\@@b{1}\else\edef\@@b{\openshift}\fi
10443 \pgfpointcurveattime{0.5}
10444 {\pgfpoint{-0.9\pgf@circ@res@other}{{(\@@b)*\radius}}}
10445 {\pgfpoint{-0.5\pgf@circ@res@other}{{(\@@b+\curvature)*\radius}}}
10446 {\pgfpoint{0.5\pgf@circ@res@other}{{(\@@b+\curvature)*\radius}}}
10447 {\pgfpoint{0.9\pgf@circ@res@other}{{(\@@b)*\radius}}}
10448 }
10449 }
10450 {\ctikzvalof{bipoles/jumper/depth}}
10451 {#1}
10452 {\ctikzvalof{bipoles/jumper/height}}
10453 {\ctikzvalof{bipoles/jumper/width}}{
10454 %
10455 \ifnum #2=0 \else
10456 \ifnum #2=1 \edef\@@b{1}\else\edef\@@b{\openshift}\fi
10457 \pgfpathmoveto{\pgfpoint{0.9*\pgf@circ@res@left}{(\@@b)*\radius}}
10458 \pgfpathcurveto
10459 {\pgfpoint{.5\pgf@circ@res@left}{(\@@b+\curvature)*\radius}}
10460 {\pgfpoint{.5\pgf@circ@res@right}{(\@@b+\curvature)*\radius}}
10461 {\pgfpoint{0.9*\pgf@circ@res@right}{(\@@b)*\radius}}
10462 \pgfusepath{draw}
10463 \fi
10464 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10465 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
10466 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
10467 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
10468 }
10469 }
10470 \pgfcircdeclarejumper{bjumper}{0}
10471 \pgfcircdeclarejumper{cjumper}{1}
10472 \pgfcircdeclarejumper{ojumper}{2}
10473 \pgfcirc@activate@bipole{l}{bjumper}{bjumper}{bare jumper}
10474 \pgfcirc@activate@bipole{l}{ojumper}{ojumper}{open jumper}
10475 \pgfcirc@activate@bipole{l}{cjumper}{cjumper}{closed jumper}
10476 % jumpers
10477 % three pins (two-ways) jumpers
10478 % #1 -> name
10479 % #2 -> height of the first link arc (0 means no link, 1 closed, 2 open)
10480 % #3 -> height of the second link arc (0 means no link, 1 closed, 2 open)
10481 \def\pgf@circ@tjumper@splitstatus#1#2\relax{%split the two values
10482 \edef\@@a{#1}\edef\@@b{#2}%
10483 }
10484 \pgfcircdeclarebipolescaled{switches}
10485 {
10486 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
10487 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
10488 % shapename
10489 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
10490 % shape type
10491 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/jumper/shape}}}
10492 % arc characteristics (can vary, must be saved...)
10493 \savedmacro{\curvature}{\edef\curvature{\ctikzvalof{bipoles/jumper/curvature}}}
10494 \savedmacro{\openshift}{\edef\openshift{\ctikzvalof{bipoles/jumper/open shift}}}
10495 \savedmacro{\jumpertype}{\edef\jumpertype{\ctikzvalof{tjumper connections}}}
10496 %
10497 \anchor{cout}{\northeast \pgf@y=0cm}
10498 \anchor{cin}{\southwest\pgf@y=0cm}
10499 \anchor{ctap}{\pgf@x=0cm\pgf@y=0cm}
10500 \anchor{out}{\northeast \pgf@y=0cm\advance\pgf@x by \radius}
10501 \anchor{in}{\southwest\pgf@y=0cm\advance\pgf@x by -\radius}
10502 \anchor{tap}{\pgf@x=0cm\pgf@y=0cm\advance\pgf@y by -\radius}
10503 \anchor{top arc left}{\northeast
10504 \pgf@circ@res@other=-\pgf@x
10505 \pgf@circ@res@temp=\pgf@x
10506 %
10507 % read the status of the jumper
10508 %
10509 \expandafter\pgf@circ@tjumper@splitstatus\jumpertype\relax% a bit of magic...
10510 \edef\@@S{S}%the "S" letter
10511 \ifx\@@a\@@S %span, it's in the center
10512 \ifnum \@@b=0\pgfpointorigin\else % no arc, anchor on the center-base
10513 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1}\relax \fi
10514 \pgfpointcurveattime{0.5}
10515 {\pgfpoint{0.9*\pgf@circ@res@other}{(\@@b)*\radius}}
10516 {\pgfpoint{.5*\pgf@circ@res@other}{(\@@b+\curvature)*\radius}}
10517 {\pgfpoint{.5*\pgf@circ@res@temp}{(\@@b+\curvature)*\radius}}
10518 {\pgfpoint{0.9*\pgf@circ@res@temp}{(\@@b)*\radius}}
10519 \fi
10520 \else
10521 % adjust the lengths of the gap, if needed
10522 \ifnum \@@a=2 \edef\@@a{\openshift} \else \edef\@aa{1} \relax \fi
10523 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1} \relax \fi
10524 % left join
10525 \ifnum \@@a=0 \pgfpoint{0.475*\pgf@circ@res@other}{0pt}\else
10526 \pgfpointcurveattime{0.5}
10527 {\pgfpoint{0.95*\pgf@circ@res@other}{\@@a*\radius}}
10528 {\pgfpoint{.75*\pgf@circ@res@other}{(\@@a+\curvature)*\radius}}
10529 {\pgfpoint{.25*\pgf@circ@res@other}{(\@@a+\curvature)*\radius}}
10530 {\pgfpoint{0.05*\pgf@circ@res@other}{\@@a*\radius}}
10531 \fi
10532 \fi
10533 }
10534 \anchor{top arc right}{\northeast
10535 \pgf@circ@res@other=-\pgf@x
10536 \pgf@circ@res@temp=\pgf@x
10537 %
10538 % read the status of the jumper
10539 %
10540 \expandafter\pgf@circ@tjumper@splitstatus\jumpertype\relax% a bit of magic...
10541 \edef\@@S{S}%the "S" letter
10542 \ifx\@@a\@@S %span, it's in the center
10543 \ifnum \@@b=0\pgfpointorigin\else % no arc, anchor on the center-base
10544 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1}\relax \fi
10545 \pgfpointcurveattime{0.5}
10546 {\pgfpoint{0.9*\pgf@circ@res@other}{(\@@b)*\radius}}
10547 {\pgfpoint{.5*\pgf@circ@res@other}{(\@@b+\curvature)*\radius}}
10548 {\pgfpoint{.5*\pgf@circ@res@temp}{(\@@b+\curvature)*\radius}}
10549 {\pgfpoint{0.9*\pgf@circ@res@temp}{(\@@b)*\radius}}
10550 \fi
10551 \else
10552 % adjust the lengths of the gap, if needed
10553 \ifnum \@@a=2 \edef\@@a{\openshift} \else \edef\@aa{1} \relax \fi
10554 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1} \relax \fi
10555 % right join
10556 \ifnum \@@b=0 \pgfpoint{0.475*\pgf@circ@res@temp}{0pt}\else
10557 \pgfpointcurveattime{0.5}
10558 {\pgfpoint{0.95*\pgf@circ@res@temp}{\@@b*\radius}}
10559 {\pgfpoint{.75\pgf@circ@res@temp}{(\@@b+\curvature)*\radius}}
10560 {\pgfpoint{.25\pgf@circ@res@temp}{(\@@b+\curvature)*\radius}}
10561 {\pgfpoint{0.05*\pgf@circ@res@temp}{\@@b*\radius}}
10562 \fi
10563 \fi
10564 }
10565 }
10566 {\ctikzvalof{bipoles/jumper/depth}}
10567 {tjumper}
10568 {\ctikzvalof{bipoles/jumper/height}}
10569 {\ctikzvalof{bipoles/tjumper/width}}{
10570 %
10571 % read the status of the jumper
10572 %
10573 \expandafter\pgf@circ@tjumper@splitstatus\jumpertype\relax% a bit of magic...
10574 \edef\@@S{S}%the "S" letter
10575 \ifx\@@a\@@S %span
10576 \ifnum \@@b=0 \else
10577 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1}\relax \fi
10578 \pgfpathmoveto{\pgfpoint{0.9*\pgf@circ@res@left}{(\@@b)*\radius}}
10579 \pgfpathcurveto
10580 {\pgfpoint{.5\pgf@circ@res@left}{(\@@b+\curvature)*\radius}}
10581 {\pgfpoint{.5\pgf@circ@res@right}{(\@@b+\curvature)*\radius}}
10582 {\pgfpoint{0.9*\pgf@circ@res@right}{(\@@b)*\radius}}
10583 \pgfusepath{draw}
10584 \fi
10585 \else
10586 % let's do the connection, if needed
10587 % adjust the lengths of the gap, if needed
10588 \ifnum \@@a=2 \edef\@@a{\openshift} \else \edef\@aa{1} \relax \fi
10589 \ifnum \@@b=2 \edef\@@b{\openshift} \else \edef\@bb{1} \relax \fi
10590 % left arc
10591 \ifnum \@@a=0 \else
10592 \pgfpathmoveto{\pgfpoint{0.95*\pgf@circ@res@left}{\@@a*\radius}}
10593 \pgfpathcurveto
10594 {\pgfpoint{.75\pgf@circ@res@left}{(\@@a+\curvature)*\radius}}
10595 {\pgfpoint{.25\pgf@circ@res@left}{(\@@a+\curvature)*\radius}}
10596 {\pgfpoint{0.05*\pgf@circ@res@left}{\@@a*\radius}}
10597 \pgfusepath{draw}
10598 \fi
10599 % right arc
10600 \ifnum \@@b=0 \else
10601 \pgfpathmoveto{\pgfpoint{0.95*\pgf@circ@res@right}{\@@b*\radius}}
10602 \pgfpathcurveto
10603 {\pgfpoint{.75\pgf@circ@res@right}{(\@@b+\curvature)*\radius}}
10604 {\pgfpoint{.25\pgf@circ@res@right}{(\@@b+\curvature)*\radius}}
10605 {\pgfpoint{0.05*\pgf@circ@res@right}{\@@b*\radius}}
10606 \pgfusepath{draw}
10607 \fi
10608 \fi
10609 % draw the poles (always filled!)
10610 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
10611 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{draw}}
10612 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
10613 \pgfnode{\cshape}{center}{}{\thisshape-tap}{\pgfusepath{draw}}
10614 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
10615 \pgfnode{\cshape}{center}{}{\thisshape-out}{\pgfusepath{draw}}
10616 }
10617
10618 \pgfcirc@activate@bipole{l}{tjumper}{tjumper}{three-pins jumper}
10619
10620 % %>>>
10621
10622 % solder jumpers: definitions and code %<<<
10623 \ctikzset{bipoles/solder jumper/width/.initial=0.36}
10624 \ctikzset{bipoles/solder jumper/height/.initial=0.3} % must be less than width, otherwise no gap!
10625 \ctikzset{bipoles/solder jumper/close height/.initial=0.6}% fraction of the vertical gap filled
10626 \ctikzset{bipoles/double solder jumper/width/.initial=0.57}
10627 %
10628 \def\pgfcirc@base@solder@jumper{%
10629 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{\pgf@circ@res@up}}
10630 \pgfpatharc{90}{270}{\pgf@circ@res@up}
10631 \pgfpathclose
10632 \pgfusepath{draw,fill}
10633 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\pgf@circ@res@up}}
10634 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
10635 \pgfpathclose
10636 \pgfusepath{draw,fill}
10637 }
10638 % simple solder jumpers
10639 % #1 -> name
10640 % #2 -> open or close (0 means open, 1 closed)
10641 \long\def\pgfcircdeclaresolderjumper#1#2{
10642 \pgfcircdeclarebipolescaled{switches}
10643 {
10644 \anchor{out}{\northeast \pgf@y=0cm}
10645 \anchor{in}{\southwest\pgf@y=0cm}
10646 \anchor{text}{\northeast
10647 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
10648 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
10649 }
10650 }
10651 {\ctikzvalof{bipoles/solder jumper/height}}
10652 {#1}
10653 {\ctikzvalof{bipoles/solder jumper/height}}
10654 {\ctikzvalof{bipoles/solder jumper/width}}{
10655 %
10656 \pgfcirc@base@solder@jumper
10657 \ifnum #2=0 \else
10658 \pgfpathrectanglecorners
10659 {\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}
10660 {\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@up}}
10661 {\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}
10662 {\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@down}}
10663 \pgfusepath{fill, draw}
10664 \fi
10665 }
10666 }
10667 \pgfcircdeclaresolderjumper{osjumper}{0}
10668 \pgfcircdeclaresolderjumper{csjumper}{1}
10669 \pgfcirc@activate@bipole{l}{osjumper}{osjumper}{open solder jumper}
10670 \pgfcirc@activate@bipole{l}{csjumper}{csjumper}{closed solder jumper}
10671 % three pins (two-ways) solder jumpers
10672 % #1 -> name
10673 % #2 -> first side open or closed
10674 % #3 -> second side open or closed
10675 \long\def\pgfcircdeclaredoublesolderjumper#1#2#3{
10676 \pgfcircdeclarebipolescaled{switches}
10677 {
10678 %
10679 \anchor{out}{\northeast \pgf@y=0cm}
10680 \anchor{in}{\southwest\pgf@y=0cm}
10681 \anchor{tap}{\northeast\pgf@x=0cm}
10682 \anchor{tap up}{\northeast\pgf@x=0cm}
10683 \anchor{tap down}{\northeast\pgf@x=0cm\pgf@y=-\pgf@y}
10684 \anchor{text}{\northeast
10685 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
10686 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
10687 }
10688 }
10689 {\ctikzvalof{bipoles/solder jumper/height}}
10690 {#1}
10691 {\ctikzvalof{bipoles/solder jumper/height}}
10692 {\ctikzvalof{bipoles/double solder jumper/width}}
10693 {
10694 \pgfcirc@base@solder@jumper
10695 \pgfpathrectanglecorners
10696 {\pgfpoint{-.5\pgf@circ@res@up}{\pgf@circ@res@up}}
10697 {\pgfpoint{.5\pgf@circ@res@up}{\pgf@circ@res@down}}
10698 \pgfusepath{fill, draw}
10699 \ifnum #2=0 \else
10700 \pgfpathrectanglecorners
10701 {\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@up}{\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@up}}
10702 {\pgfpoint{-.5\pgf@circ@res@up}{\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@down}}
10703 \pgfusepath{fill, draw}
10704 \fi
10705 \ifnum #3=0 \else
10706 \pgfpathrectanglecorners
10707 {\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@up}{\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@up}}
10708 {\pgfpoint{.5\pgf@circ@res@up}{\ctikzvalof{bipoles/solder jumper/close height}\pgf@circ@res@down}}
10709 \pgfusepath{fill, draw}
10710 \fi
10711 }
10712 }
10713 %
10714 \pgfcircdeclaredoublesolderjumper{odsjumper}{0}{0}
10715 \pgfcircdeclaredoublesolderjumper{ldsjumper}{1}{0}
10716 \pgfcircdeclaredoublesolderjumper{rdsjumper}{0}{1}
10717 \pgfcircdeclaredoublesolderjumper{cdsjumper}{1}{1}
10718 \pgfcirc@activate@bipole{l}{odsjumper}{odsjumper}{open double solder jumper}
10719 \pgfcirc@activate@bipole{l}{ldsjumper}{ldsjumper}{left double solder jumper}
10720 \pgfcirc@activate@bipole{l}{rdsjumper}{rdsjumper}{right double solder jumper}
10721 \pgfcirc@activate@bipole{l}{cdsjumper}{cdsjumper}{closed double solder jumper}
10722
10723 % %>>>
10724
10725 %%%%%%%%%%%%%%%%%
10726 %% Instruments
10727 %%%%%%%%%%%%%%%%%
10728
10729 %% Definitions for Instruments %<<<1
10730 \ctikzset{bipoles/ammeter/height/.initial=.60}
10731 \ctikzset{bipoles/ammeter/width/.initial=.60}
10732 \ctikzset{bipoles/ohmmeter/height/.initial=.60}
10733 \ctikzset{bipoles/ohmmeter/width/.initial=.60}
10734 \ctikzset{bipoles/voltmeter/height/.initial=.60}
10735 \ctikzset{bipoles/voltmeter/width/.initial=.60}
10736 \ctikzset{bipoles/smeter/height/.initial=.60}
10737 \ctikzset{bipoles/smeter/width/.initial=.60}
10738 \ctikzset{bipoles/smeter/index position/.initial=80}
10739 \ctikzset{bipoles/smeter/voltage/additional shift/.initial=1}
10740 \ctikzset{bipoles/qmeter/depth/.initial=.40}
10741 \ctikzset{bipoles/qmeter/height/.initial=.80}
10742 \ctikzset{bipoles/qmeter/width/.initial=.60}
10743 \ctikzset{bipoles/qmeter/index position/.initial=80}
10744 % this must be specified for each one
10745 \ctikzset{bipoles/qvprobe/voltage/additional shift/.initial=.5}
10746 \ctikzset{bipoles/qiprobe/voltage/additional shift/.initial=.5}
10747 \ctikzset{bipoles/qpprobe/voltage/additional shift/.initial=.5}
10748 \ctikzset{bipoles/iloop/width/.initial=.40}
10749 \ctikzset{bipoles/iloop/height/.initial=.60}
10750 % currtap see https://github.com/circuitikz/circuitikz/issues/807
10751 \ctikzset{bipoles/currtap/height/.initial=0.4}
10752 \ctikzset{bipoles/currtap/dot size/.initial=0.5}
10753 \ctikzset{bipoles/currtap/fill/.initial=default}
10754 \ctikzset{bipoles/currtap/dash/.initial=none}
10755 \ctikzset{bipoles/currtap/color/.initial=default}
10756 \ctikzset{bipoles/currtap/thickness/.initial=default}
10757
10758 \ctikzset{bipoles/oscope/height/.initial=.60}
10759 \ctikzset{bipoles/oscope/width/.initial=.60}
10760 \ctikzset{bipoles/oscope/voltage/additional shift/.initial=1}
10761
10762
10763 % option to not rotate the new (Romano's) instruments
10764 \newif\ifpgf@circuit@straightinstruments\pgf@circuit@straightinstrumentstrue
10765 \pgfkeys{/tikz/straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
10766 \ctikzset{straight instruments/.add code={}{\pgf@circuit@straightinstrumentstrue}}
10767 \pgfkeys{/tikz/rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
10768 \ctikzset{rotated instruments/.add code={}{\pgf@circuit@straightinstrumentsfalse}}
10769 %%>>>
10770
10771 %% Node shapes for instruments%<<<
10772
10773 % % METERINGSHAPE
10774 \long\def\drawmeteringcircle{
10775 \def\pgf@circ@temp{right}
10776 \ifx\tikz@res@label@pos\pgf@circ@temp
10777 \pgf@circ@res@step=-1.2\pgf@circ@res@up
10778 \else
10779 \def\pgf@circ@temp{below}
10780 \ifx\tikz@res@label@pos\pgf@circ@temp
10781 \pgf@circ@res@step=-1.2\pgf@circ@res@up
10782 \else
10783 \pgf@circ@res@step=1.2\pgf@circ@res@up
10784 \fi
10785 \fi
10786 %draw connections to circle
10787 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
10788 \pgfpathlineto{\pgfpoint{.9\pgf@circ@res@left}{\pgf@circ@res@zero}}
10789 \pgfpathmoveto{\pgfpoint{.9\pgf@circ@res@right}{\pgf@circ@res@zero}}
10790 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
10791 \pgfusepath{draw}
10792 %draw circle
10793 \pgfscope
10794 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10795 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
10796 \pgf@circ@draworfill
10797 \endpgfscope
10798 %draw arrow
10799 \pgfscope
10800 \pgfsetarrowsend{latex}
10801 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
10802 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
10803 \pgfusepath{draw}
10804 \endpgfscope
10805 }
10806
10807 %AMPEREMETER
10808 \pgfcircdeclarebipolescaled{instruments}
10809 {}
10810 {\ctikzvalof{bipoles/ammeter/height}}
10811 {ammeter}
10812 {\ctikzvalof{bipoles/ammeter/height}}
10813 {\ctikzvalof{bipoles/ammeter/width}}
10814 {
10815 \drawmeteringcircle
10816 \pgfnode{circle}{center}{\pgf@circ@font@bold{A}}{}{}
10817 }
10818 %OHMMETER
10819 \pgfcircdeclarebipolescaled{instruments}
10820 {}
10821 {\ctikzvalof{bipoles/ohmmeter/height}}
10822 {ohmmeter}
10823 {\ctikzvalof{bipoles/ohmmeter/height}}
10824 {\ctikzvalof{bipoles/ohmmeter/width}}
10825 {
10826 \drawmeteringcircle
10827 \pgfnode{circle}{center}{\boldmath$\Omega$}{}{}
10828 }
10829 %VOLTMETER
10830 \pgfcircdeclarebipolescaled{instruments}
10831 {}
10832 {\ctikzvalof{bipoles/voltmeter/height}}
10833 {voltmeter}
10834 {\ctikzvalof{bipoles/voltmeter/height}}
10835 {\ctikzvalof{bipoles/voltmeter/width}}
10836 {
10837 \drawmeteringcircle
10838 \pgfnode{circle}{center}{\pgf@circ@font@bold{V}}{}{}
10839
10840 }
10841
10842 % oscilloscope, suggested by @nobrl https://github.com/circuitikz/circuitikz/issues/176
10843 %
10844 % oscilloscope waveforms
10845
10846 \ctikzset{%
10847 bipoles/oscope/waveform/sin/.code={%
10848 \pgfpathmoveto{\pgfpoint{-0.6cm}{0cm}}
10849 \pgfpathsine{\pgfpoint{0.3cm}{0.4cm}}
10850 \pgfpathcosine{\pgfpoint{0.3cm}{-0.4cm}}
10851 \pgfpathsine{\pgfpoint{0.3cm}{-0.4cm}}
10852 \pgfpathcosine{\pgfpoint{0.3cm}{0.4cm}}
10853 \pgfusepath{draw}
10854 },
10855 bipoles/oscope/waveform/ramps/.code={%
10856 \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}}
10857 \pgfpathlineto{\pgfpoint{-0.05cm}{0.25cm}}
10858 \pgfpathlineto{\pgfpoint{-0.05cm}{-0.25cm}}
10859 \pgfpathlineto{\pgfpoint{0.65cm}{0.25cm}}
10860 \pgfpathlineto{\pgfpoint{0.65cm}{-0.25cm}}
10861 \pgfusepath{draw}
10862 },
10863 bipoles/oscope/waveform/square/.code={%
10864 \pgfpathmoveto{\pgfpoint{-0.75cm}{-0.25cm}}
10865 \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}}
10866 \pgfpathlineto{\pgfpoint{-0.6cm}{0.25cm}}
10867 \pgfpathlineto{\pgfpoint{0cm}{0.25cm}}
10868 \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}}
10869 \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}}
10870 \pgfpathlineto{\pgfpoint{0.6cm}{0.25cm}}
10871 \pgfpathlineto{\pgfpoint{0.75cm}{0.25cm}}
10872 \pgfusepath{draw}
10873 },
10874 bipoles/oscope/waveform/triangle/.code={%
10875 \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}}
10876 \pgfpathlineto{\pgfpoint{-0.6cm}{-0.25cm}}
10877 \pgfpathlineto{\pgfpoint{-0.3cm}{0.25cm}}
10878 \pgfpathlineto{\pgfpoint{0cm}{-0.25cm}}
10879 \pgfpathlineto{\pgfpoint{0.3cm}{0.25cm}}
10880 \pgfpathlineto{\pgfpoint{0.6cm}{-0.25cm}}
10881 \pgfpathlineto{\pgfpoint{0.75cm}{0cm}}
10882 \pgfusepath{draw}
10883 },
10884 bipoles/oscope/waveform/zero/.code={
10885 \pgfpathmoveto{\pgfpoint{-0.75cm}{0cm}}
10886 \pgfpathlineto{\pgfpoint{0.75cm}{0cm}}
10887 \pgfusepath{draw}
10888 },%
10889 bipoles/oscope/waveform/lissajous/.code={%
10890 \pgfpathellipse{\pgfpoint{0cm}{0cm}}
10891 {\pgfpoint{0.5cm}{0.35cm}}{\pgfpoint{-0.3cm}{0.2cm}}
10892 \pgfusepath{draw}
10893 },
10894 bipoles/oscope/waveform/none/.code={},%
10895 }
10896 % default waveform (backward compatible)
10897 \ctikzset{bipoles/oscope/waveform/.initial=ramps}
10898
10899 \pgfcircdeclarebipolescaled{instruments}
10900 {
10901 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
10902 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
10903 % put the node text above and centered
10904 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
10905 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
10906 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
10907 }
10908 }
10909 }
10910 {\ctikzvalof{bipoles/oscope/height}}
10911 {oscope}
10912 {\ctikzvalof{bipoles/oscope/height}}
10913 {\ctikzvalof{bipoles/oscope/width}}
10914 {
10915 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10916 \pgfextracty{\pgf@circ@res@up}{\northeast}
10917 \pgfextractx{\pgf@circ@res@right}{\northeast}
10918 \pgfextractx{\pgf@circ@res@left}{\southwest}
10919 \pgfextracty{\pgf@circ@res@down}{\southwest}
10920 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
10921 \pgfscope
10922 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
10923 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
10924 \pgf@circ@draworfill
10925 \endpgfscope
10926 % get the rotation
10927 \ifpgf@circuit@straightinstruments
10928 \pgfgettransformentries\a\b\temp\temp\temp\temp
10929 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
10930 \else
10931 \edef\rot{0}
10932 \fi
10933 % and unrotate the scope
10934 \pgfscope
10935 \pgftransformrotate{\rot}
10936 % grid
10937 \pgfscope
10938 \pgfsetlinewidth{0.5\pgfstartlinewidth}
10939 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
10940 % the "almost one" make the grid complete most of the time --- beware of antialiasing
10941 \pgfpathgrid[stepx=0.995\pgf@circ@res@step, stepy=0.995\pgf@circ@res@step]%
10942 {\pgfpoint{0.75\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
10943 {\pgfpoint{0.75\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
10944 \pgfsetstrokeopacity{0.5}
10945 \pgfusepath{draw}
10946 \endpgfscope
10947 % function displayed
10948 \pgfscope
10949 \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm}
10950 \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm}
10951 \pgftransformxscale{\@@scalex}
10952 \pgftransformyscale{\@@scaley}
10953 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10954 \pgfkeys{\circuitikzbasekey/bipoles/oscope/waveform/\ctikzvalof{bipoles/oscope/waveform}}
10955 \endpgfscope
10956 \endpgfscope
10957 }
10958 % generic round meter with always horizontal text, no arrow
10959 \pgfcircdeclarebipolescaled{instruments}
10960 {}
10961 {\ctikzvalof{bipoles/esource/height}}
10962 {rmeter}
10963 {\ctikzvalof{bipoles/esource/height}}
10964 {\ctikzvalof{bipoles/esource/width}}
10965 {
10966 \pgfscope
10967 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10968 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10969 \pgf@circ@draworfill
10970 \endpgfscope
10971 % draw the text label
10972 % get the rotation
10973 \ifpgf@circuit@straightinstruments
10974 \pgfgettransformentries\a\b\temp\temp\temp\temp
10975 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
10976 \else
10977 \edef\rot{0}
10978 \fi
10979 % and unrotate the scope
10980 \pgfscope
10981 \pgf@circ@text@strokecolor
10982 \pgftransformrotate{\rot}
10983 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
10984 \endpgfscope
10985 }
10986
10987 % generic round meter with always horizontal text, with arrow
10988 \pgfcircdeclarebipolescaled{instruments}
10989 {}
10990 {\ctikzvalof{bipoles/esource/height}}
10991 {rmeterwa}
10992 {\ctikzvalof{bipoles/esource/height}}
10993 {\ctikzvalof{bipoles/esource/width}}
10994 {
10995 \pgfscope
10996 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
10997 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
10998 \pgf@circ@draworfill
10999 \endpgfscope
11000 % draw the text label
11001 % get the rotation
11002 \ifpgf@circuit@straightinstruments
11003 \pgfgettransformentries\a\b\temp\temp\temp\temp
11004 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
11005 \else
11006 \edef\rot{0}
11007 \fi
11008 % and unrotate the scope
11009 \pgfscope
11010 \pgftransformrotate{\rot}
11011 \pgf@circ@setcolor
11012 \pgfsetlinewidth{\pgfstartlinewidth}
11013 % arrow: create a center hole to have better visual
11014 \pgfscope
11015 % clipping path: first a rectangle bigger then the shape
11016 % to avoid problems with the line thickness
11017 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
11018 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
11019 % next open a circle into it
11020 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{.6\pgf@circ@res@up}}{\pgfpoint{.6\pgf@circ@res@left}{0}}
11021 % do the difference and clip before drawing
11022 \pgfseteorule
11023 \pgfusepath{clip}
11024 \pgfsetarrowsend{latexslim}
11025 % the arrow is better if it has a bit of breath and it's not 45º
11026 \pgfpathmoveto{\pgfpoint{.8\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
11027 \pgfpathlineto{\pgfpoint{.8\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
11028 \pgfusepath{draw}
11029 \endpgfscope
11030 \pgf@circ@text@strokecolor
11031 \pgftext[center]{\ctikzvalof{bipoles/twoport/text}}
11032 \endpgfscope
11033 }
11034
11035 % generic square meter with always horizontal text
11036 \pgfcircdeclarebipolescaled{instruments}
11037 {
11038 \anchor{in 1}{\southwest\pgf@y=0.75\pgf@y\pgf@x=0.4\pgf@x}
11039 \anchor{in 2}{\southwest\pgf@y=0.75\pgf@y\pgf@x=-0.4\pgf@x}
11040 % put the node text above and centered
11041 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
11042 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
11043 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
11044 }
11045 }
11046 }
11047 {\ctikzvalof{bipoles/smeter/height}}
11048 {smeter}
11049 {\ctikzvalof{bipoles/smeter/height}}
11050 {\ctikzvalof{bipoles/smeter/width}}
11051 {
11052 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11053 \pgfextracty{\pgf@circ@res@up}{\northeast}
11054 \pgfextractx{\pgf@circ@res@right}{\northeast}
11055 \pgfextractx{\pgf@circ@res@left}{\southwest}
11056 \pgfextracty{\pgf@circ@res@down}{\southwest}
11057 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
11058 \pgfscope
11059 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
11060 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11061 \pgf@circ@draworfill
11062 \endpgfscope
11063 % get the rotation
11064 \ifpgf@circuit@straightinstruments
11065 \pgfgettransformentries\a\b\temp\temp\temp\temp
11066 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
11067 \else
11068 \edef\rot{0}
11069 \fi
11070 % and unrotate the scope
11071 \pgfscope
11072 \pgftransformrotate{\rot}
11073 % the metering window
11074 \pgfscope
11075 \def\@starta{105}\def\@stopa{75}
11076 \pgfsetlinewidth{\pgfstartlinewidth}
11077 \pgftransformshift{\pgfpoint{0pt}{-1.8\pgf@circ@res@up}}
11078 \pgfpathmoveto{\pgfpointpolar{\@starta}{2\pgf@circ@res@up}}
11079 \pgfpatharc{\@starta}{\@stopa}{2\pgf@circ@res@up}
11080 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
11081 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
11082 \pgfpathclose
11083 \pgfmathsetmacro{\@indexa}{\@starta - \ctikzvalof{bipoles/smeter/index position}*(\@starta - \@stopa)/100}
11084 \pgfpathmoveto{\pgfpointpolar{\@indexa}{2\pgf@circ@res@up}}
11085 \pgfpathlineto{\pgfpointpolar{\@indexa}{2.4\pgf@circ@res@up}}
11086 \pgfusepath{draw}
11087 \endpgfscope
11088 \pgf@circ@text@strokecolor
11089 \pgftext[center, y=0.5\pgf@circ@res@down]{\ctikzvalof{bipoles/twoport/text}}
11090 \endpgfscope
11091 }
11092
11093 % probes qucs style:
11094 % #1 : name
11095 % #2 : extra code
11096 \long\def\pgfcirc@qucsprobe#1#2{
11097 \pgfcircdeclarebipolescaled{instruments}
11098 {
11099 \anchor{v+}{\southwest\pgf@x=0.6\pgf@x}
11100 \anchor{v-}{\southwest\pgf@x=-0.6\pgf@x}
11101 % put the node text above and centered
11102 \anchor{text}{\pgfextracty{\pgf@circ@res@up}{\northeast}
11103 \pgfpoint{-.5\wd\pgfnodeparttextbox}{
11104 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
11105 }
11106 }
11107 }
11108 {\ctikzvalof{bipoles/qmeter/depth}}
11109 {#1}
11110 {\ctikzvalof{bipoles/qmeter/height}}
11111 {\ctikzvalof{bipoles/qmeter/width}}
11112 {
11113 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11114 \pgfextracty{\pgf@circ@res@up}{\northeast}
11115 \pgfextractx{\pgf@circ@res@right}{\northeast}
11116 \pgfextractx{\pgf@circ@res@left}{\southwest}
11117 \pgfextracty{\pgf@circ@res@down}{\southwest}
11118 \pgfmathsetlength{\pgf@circ@res@step}{0.25*\pgf@circ@res@up}
11119 \pgfscope
11120 \pgfscope
11121 \pgfsetcornersarced{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@step}}
11122 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11123 \pgf@circ@draworfill
11124 \endpgfscope
11125 \def\@starta{103}\def\@stopa{77}
11126 \pgfsetlinewidth{\pgfstartlinewidth}
11127 \pgfscope
11128 \pgftransformshift{\pgfpoint{0pt}{-1.7\pgf@circ@res@up}}
11129 \pgfpathmoveto{\pgfpointpolar{\@starta}{2.1\pgf@circ@res@up}}
11130 \pgfpatharc{\@starta}{\@stopa}{2.1\pgf@circ@res@up}
11131 \pgfpathlineto{\pgfpointpolar{\@stopa}{2.5\pgf@circ@res@up}}
11132 \pgfpatharc{\@stopa}{\@starta}{2.5\pgf@circ@res@up}
11133 \pgfpathclose
11134 \pgfmathsetmacro{\@indexa}{\@starta - \ctikzvalof{bipoles/qmeter/index position}*(\@starta - \@stopa)/100}
11135 \pgfpathmoveto{\pgfpointpolar{\@indexa}{2.1\pgf@circ@res@up}}
11136 \pgfpathlineto{\pgfpointpolar{\@indexa}{2.4\pgf@circ@res@up}}
11137 \pgfusepath{draw}
11138 \pgf@circ@draworfill
11139 \endpgfscope
11140 #2%
11141 \endpgfscope
11142 }
11143 }
11144
11145 \pgfcirc@qucsprobe{qiprobe}{
11146 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11147 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11148 \pgfusepath{draw}
11149 \pgfnode{currarrow}{center}{}{}{}
11150 }
11151
11152 \pgfcirc@qucsprobe{qvprobe}{
11153 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
11154 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11155 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{0pt}}
11156 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
11157 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{0pt}}
11158 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11159 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}{\pgf@circ@res@other}
11160 \pgfusepath{draw}
11161 \pgfscope
11162 % "+" and "-", drawn so that they scale correctly
11163 \pgfsetlinewidth{2\pgfstartlinewidth}
11164 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-1.5\pgf@circ@res@other}}
11165 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+\pgf@circ@res@other}{-3.5\pgf@circ@res@other}}
11166 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
11167 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
11168 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right+0\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
11169 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-2.5\pgf@circ@res@other}}
11170 \pgfusepath{draw}
11171 \endpgfscope
11172 }
11173
11174 \pgfcirc@qucsprobe{qpprobe}{
11175 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11176 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11177 \pgfusepath{draw}
11178 \pgfnode{currarrow}{center}{}{}{}
11179 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{nodes width}*\pgf@circ@scaled@Rlen}
11180 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@left}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
11181 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{-4\pgf@circ@res@other}}
11182 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left}{\pgf@circ@res@down}}
11183 \pgfpathcircle{\pgfpoint{.6\pgf@circ@res@right}{-3\pgf@circ@res@other}}{\pgf@circ@res@other}
11184 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right}{-4\pgf@circ@res@other}}
11185 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right}{\pgf@circ@res@down}}
11186 \pgfusepath{draw}
11187 \pgfscope
11188 % "+" and "-", drawn so that they scale correctly
11189 \pgfsetlinewidth{2\pgfstartlinewidth}
11190 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-2\pgf@circ@res@other}}
11191 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+3\pgf@circ@res@other}{-4\pgf@circ@res@other}}
11192 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left+2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
11193 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@left+4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
11194 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@right-4\pgf@circ@res@other}{-3\pgf@circ@res@other}}
11195 \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@right-2\pgf@circ@res@other}{-3\pgf@circ@res@other}}
11196 \pgfusepath{draw}
11197 \endpgfscope
11198 }
11199
11200 % current loop for oscope and similar: stylized
11201 \pgfcircdeclarebipolescaled{instruments}
11202 {
11203 \anchor{i}{\northeast\pgf@x=0pt\relax}
11204 \anchor{text}{
11205 \pgfextracty{\pgf@circ@res@up}{\northeast}
11206 \pgfextractx{\pgf@circ@res@left}{\northeast}
11207 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
11208 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
11209 }
11210 }
11211 }
11212 {\ctikzvalof{bipoles/iloop/height}}
11213 {iloop}
11214 {\ctikzvalof{bipoles/iloop/height}}
11215 {\ctikzvalof{bipoles/iloop/width}}
11216 {
11217 \pgfextracty{\pgf@circ@res@up}{\northeast}
11218 \pgfextractx{\pgf@circ@res@right}{\northeast}
11219 \pgf@circ@res@down=-\pgf@circ@res@up
11220 \pgf@circ@res@left=-\pgf@circ@res@right
11221 \pgfscope
11222 \pgfstartlinewidth=\pgflinewidth
11223 \pgf@circ@setcolor
11224 % external ellipse
11225 \pgfscope
11226 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
11227 % clipping path: first a rectangle bigger then the shape
11228 % to avoid problems with the line thickness
11229 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
11230 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
11231 % next the opening to the left
11232 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
11233 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
11234 % do the difference and clip before drawing
11235 \pgfseteorule
11236 \pgfusepath{clip}
11237 \pgfpathellipse{\pgfpointorigin}{
11238 \pgfpoint{0pt}{0.8\pgf@circ@res@up}}{
11239 \pgfpoint{0.4\pgf@circ@res@right}{0pt}}
11240 \pgfusepath{draw}
11241 \endpgfscope
11242 % internal wire
11243 \pgfsetlinewidth{\pgfstartlinewidth}
11244 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11245 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
11246 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
11247 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11248 % and the contact line up
11249 \pgfpathmoveto{\pgfpoint{0pt}{0.8\pgf@circ@res@up}}
11250 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
11251 \pgfusepath{draw}
11252 \endpgfscope
11253 }
11254
11255 % current loop for oscope and similar: real (double connection)
11256 \pgfcircdeclarebipolescaled{instruments}
11257 {
11258 \anchor{i+}{
11259 \pgfextracty{\pgf@circ@res@up}{\northeast}
11260 \pgfextractx{\pgf@circ@res@right}{\northeast}
11261 \pgf@circ@res@step=0.4\pgf@circ@res@right
11262 \pgf@circ@res@other=0.8\pgf@circ@res@up
11263 \pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}
11264 \pgf@y=\pgf@circ@res@up
11265 }
11266 \anchor{i-}{
11267 \pgfextracty{\pgf@circ@res@up}{\northeast}
11268 \pgfextractx{\pgf@circ@res@right}{\northeast}
11269 \pgf@circ@res@step=0.4\pgf@circ@res@right
11270 \pgf@circ@res@other=0.8\pgf@circ@res@up
11271 \pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}
11272 \pgf@y=\pgf@circ@res@up
11273 }
11274 \anchor{text}{
11275 \pgfextracty{\pgf@circ@res@up}{\northeast}
11276 \pgfextractx{\pgf@circ@res@left}{\northeast}
11277 \pgfpoint{-.5\wd\pgfnodeparttextbox+\pgf@circ@res@left}{
11278 \dimexpr.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox+\pgf@circ@res@up\relax
11279 }
11280 }
11281 }
11282 {\ctikzvalof{bipoles/iloop/height}}
11283 {iloop2}
11284 {\ctikzvalof{bipoles/iloop/height}}
11285 {\ctikzvalof{bipoles/iloop/width}}
11286 {
11287 \pgfextracty{\pgf@circ@res@up}{\northeast}
11288 \pgfextractx{\pgf@circ@res@right}{\northeast}
11289 \pgf@circ@res@down=-\pgf@circ@res@up
11290 \pgf@circ@res@left=-\pgf@circ@res@right
11291 % must be the same than internal i+ and i- anchors definition
11292 \pgf@circ@res@step=0.4\pgf@circ@res@right
11293 \pgf@circ@res@other=0.8\pgf@circ@res@up
11294 \def\@plus{\pgfpointpolar{105}{\pgf@circ@res@step and \pgf@circ@res@other}}
11295 \def\@minus{\pgfpointpolar{75}{\pgf@circ@res@step and \pgf@circ@res@other}}
11296 \pgfscope
11297 \pgfstartlinewidth=\pgflinewidth
11298 \pgf@circ@setcolor
11299 % external ellipse
11300 \pgfscope
11301 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
11302 % clipping path: first a rectangle bigger then the shape
11303 % to avoid problems with the line thickness
11304 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{2\pgf@circ@res@down}}
11305 {\pgfpoint{2\pgf@circ@res@right}{2\pgf@circ@res@up}}
11306 % next the opening to the left
11307 \pgfpathrectanglecorners{\pgfpoint{2\pgf@circ@res@left}{.1\pgf@circ@res@down}}
11308 {\pgfpoint{0pt}{.1\pgf@circ@res@up}}
11309 % do the difference and clip before drawing
11310 \pgfseteorule
11311 \pgfusepath{clip}
11312 \pgfpathmoveto{\@plus}
11313 \pgfpatharc{105}{435}{\pgf@circ@res@step and \pgf@circ@res@other}
11314 \pgfusepath{draw}
11315 \endpgfscope
11316 % internal wire
11317 \pgfsetlinewidth{\pgfstartlinewidth}
11318 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11319 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{0pt}}
11320 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
11321 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11322 % and the contact line up
11323 % I use ...left and ---right as temporal lengths here to avoid defining more
11324 \pgfextractx{\pgf@circ@res@left}{\@plus}
11325 \pgfextractx{\pgf@circ@res@right}{\@minus}
11326 \pgfpathmoveto{\@plus}
11327 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11328 \pgfpathmoveto{\@minus}
11329 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11330 \pgfusepath{draw}
11331 \endpgfscope
11332 }
11333 %% currtap
11334 \pgfcircdeclarebipolescaled{instruments}
11335 {
11336 \savedmacro{\@@dotsize}{\def\@@dotsize{\ctikzvalof{bipoles/currtap/dot size}}}
11337 \anchor{tap}{\northeast\pgf@x=0pt\pgf@y=\@@dotsize\pgf@y\pgf@y=-\pgf@y}
11338 }
11339 {\ctikzvalof{bipoles/currtap/height}}
11340 {currtap}
11341 {\ctikzvalof{bipoles/currtap/height}}
11342 {\ctikzvalof{bipoles/currtap/height}}
11343 {
11344 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11345 \pgfpathlineto{\pgfpoint{0.95\pgf@circ@res@left}{0pt}}
11346 \pgfpatharc{180}{0}{0.95\pgf@circ@res@right}
11347 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11348 \pgfusepath{draw}
11349 \pgf@circ@subset@color@dash{bipoles/currtap}
11350 \pgf@circ@subset@thickness{bipoles/currtap}
11351 \pgfusepath{draw}
11352 \pgfpathcircle{\pgfpoint{0pt}{0pt}}{\@@dotsize*\pgf@circ@res@up}
11353 \pgf@circ@subset@fill@or@draw{bipoles/currtap}
11354 }
11355 % %>>>
11356
11357 % Path definitions for Instruments%<<<
11358
11359 \pgfcirc@activate@bipole@simple{l}{ammeter}
11360 \pgfcirc@activate@bipole@simple{l}{ohmmeter}
11361 \pgfcirc@activate@bipole@simple{l}{voltmeter}
11362 \pgfcirc@activate@bipole@simple{l}{oscope}
11363 \pgfcirc@activate@bipole@simple{l}{rmeter}
11364 \pgfcirc@activate@bipole@simple{l}{rmeterwa}
11365 \pgfcirc@activate@bipole@simple{l}{smeter}
11366 \pgfcirc@activate@bipole@simple{l}{iloop}
11367 \pgfcirc@activate@bipole{l}{ilooptwo}{iloop2}{iloop2}
11368 \pgfcirc@activate@bipole@simple{l}{currtap}
11369 \pgfcirc@activate@bipole@simple{l}{qvprobe}
11370 \pgfcirc@activate@bipole@simple{l}{qiprobe}
11371 \pgfcirc@activate@bipole@simple{l}{qpprobe}
11372 % %>>>
11373
11374 %%%%%%%%%%%%%%%%%%%%%%%
11375 %% MECHANICAL SYMBOLS
11376 %%%%%%%%%%%%%%%%%%%%%%%
11377
11378 %% Settings for Mechanical section%<<<1
11379 \ctikzset{/tikz/circuitikz/tripoles/elmech/height/.initial=.8}
11380 \ctikzset{/tikz/circuitikz/tripoles/elmech/width/.initial=.6}
11381 \ctikzset{bipoles/spring/height/.initial=.5}
11382 \ctikzset{bipoles/spring/width/.initial=.5}
11383 \ctikzset{bipoles/inerter/height/.initial=.7}
11384 \ctikzset{bipoles/inerter/width/.initial=.175}
11385 \ctikzset{bipoles/mass/height/.initial=.55}
11386 \ctikzset{bipoles/mass/box height/.initial=.4}
11387 \ctikzset{bipoles/mass/width/.initial=.5}
11388
11389 \ctikzset{bipoles/damper/height/.initial=.35}
11390 \ctikzset{bipoles/damper/length/.initial=.3}
11391 \ctikzset{bipoles/damper/width/.initial=.4}
11392 %%>>>
11393
11394 %% Node shapes Mechanical analog system%<<<
11395 %% mechanical capacitance - stiffness/spring
11396
11397 \pgfcircdeclarebipolescaled{mechanicals}
11398 {}
11399 {\ctikzvalof{bipoles/spring/height}}
11400 {spring}
11401 {\ctikzvalof{bipoles/spring/height}}
11402 {\ctikzvalof{bipoles/spring/width}}{
11403 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11404 \pgftransformationadjustments
11405
11406 \pgfmathsetlength{\pgf@circ@res@step}
11407 {(\ctikzvalof{bipoles/spring/width}*\pgf@circ@scaled@Rlen+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth)/16}
11408
11409 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
11410 \pgfsetcornersarced{\pgfpoint{.5\pgf@circ@res@up}{.5\pgf@circ@res@up}}
11411 \pgf@circ@res@other = \pgf@circ@res@left
11412 \advance\pgf@circ@res@other by \pgf@circ@res@step
11413 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11414 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11415 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11416 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11417 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11418 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11419 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11420 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11421 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11422 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11423 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11424 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11425 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
11426 \advance\pgf@circ@res@other by 2\pgf@circ@res@step
11427 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
11428 \advance\pgf@circ@res@other by \pgf@circ@res@step
11429 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
11430 \pgfsetbuttcap
11431 \pgfsetbeveljoin
11432 \pgfusepath{stroke}
11433 }
11434
11435 %% mechanical capacitance - inerter
11436 \pgfcircdeclarebipolescaled{mechanicals}
11437 {}
11438 {\ctikzvalof{bipoles/inerter/height}}
11439 {inerter}
11440 {\ctikzvalof{bipoles/inerter/height}}
11441 {\ctikzvalof{bipoles/inerter/width}}
11442 {
11443 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11444 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11445 \pgf@circ@draworfill
11446 }
11447
11448
11449 %% mechanical inductance - mass
11450 \pgfcircdeclarebipolescaled{mechanicals}
11451 {}
11452 {\ctikzvalof{bipoles/mass/box height}}
11453 {mass}
11454 {\ctikzvalof{bipoles/mass/height}}
11455 {\ctikzvalof{bipoles/mass/width}}
11456 {
11457 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11458 \pgftransformationadjustments
11459 \pgfpathrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
11460 {\pgfpoint{-2\pgf@circ@res@down}{-2\pgf@circ@res@down}}
11461 \pgf@circ@draworfill
11462
11463 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11464 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11465 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11466 \pgfsetrectcap
11467 \pgfsetmiterjoin
11468 \pgfusepath{stroke}
11469 }
11470
11471 %% mechanical resistor - damper
11472 \pgfcircdeclarebipolescaled{mechanicals}
11473 {}
11474 {\ctikzvalof{bipoles/damper/height}}
11475 {damper}
11476 {\ctikzvalof{bipoles/damper/height}}
11477 {\ctikzvalof{bipoles/damper/width}}
11478 {
11479 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11480 \pgf@circ@maybefill
11481
11482 % line into the damper
11483 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
11484 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11485 {\pgf@circ@res@zero}}
11486 \pgfusepath{stroke}
11487
11488 % damper box
11489 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11490 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
11491 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11492 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11493 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11494
11495 \pgfsetrectcap
11496 \pgfsetmiterjoin
11497 \pgfusepath{stroke}
11498
11499 % damper vertical element
11500 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11501 {.8\pgf@circ@res@down}}
11502 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11503 {.8\pgf@circ@res@up}}
11504 \pgfsetbuttcap
11505 \pgfusepath{stroke}
11506
11507 }
11508 %% mechanical viscoelastic element, suggested by @alex
11509 %% in https://tex.stackexchange.com/questions/484268/combined-spring-damper-in-circuitikz
11510 \pgfcircdeclarebipolescaled{mechanicals}
11511 {} % extra anchors
11512 {\ctikzvalof{bipoles/damper/height}} % depth (under the path line)
11513 {viscoe} % name
11514 {\ctikzvalof{bipoles/damper/height}} % height (above the path line)
11515 {\ctikzvalof{bipoles/damper/width}} % width
11516 { % draw the bipole
11517 \pgfpathrectanglecorners{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{\pgf@circ@res@down}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11518 \pgf@circ@maybefill
11519
11520 % spring into the damper
11521 \pgfscope
11522 \pgfscope
11523 \pgftransformationadjustments
11524 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11525 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*0.5*\pgflinewidth}{\pgf@circ@res@zero}}
11526 \pgfpathlineto{\pgfpoint{.95\pgf@circ@res@left}{\pgf@circ@res@zero}}
11527 \pgfsetcornersarced{\pgfpoint{.25\pgf@circ@res@up}{.25\pgf@circ@res@up}}
11528 \pgfpathlineto{\pgfpoint{.75\pgf@circ@res@left}{.75\pgf@circ@res@up}}
11529 \pgfpathlineto{\pgfpoint{.5\pgf@circ@res@left}{-.75\pgf@circ@res@up}}
11530 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.75\pgf@circ@res@up}}
11531 \pgfpathlineto{\pgfpoint{0pt}{-.75\pgf@circ@res@up}}
11532 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}{.75\pgf@circ@res@up}}
11533 \pgfsetbuttcap
11534 \pgfsetbeveljoin
11535 \pgfusepath{stroke}
11536 \endpgfscope
11537 \endpgfscope
11538 % damper box
11539 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11540 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
11541 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11542 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
11543 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
11544
11545 \pgfsetrectcap
11546 \pgfsetmiterjoin
11547 \pgfusepath{stroke}
11548
11549 % damper vertical element
11550 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11551 {.8\pgf@circ@res@down}}
11552 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/damper/length}\pgf@circ@res@right}
11553 {.8\pgf@circ@res@up}}
11554 \pgfsetbuttcap
11555 \pgfusepath{stroke}
11556
11557 }
11558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11559 %% electromechanical device (motor/generator)
11560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11561
11562 \pgfdeclareshape{elmech}
11563 {
11564 \savedmacro{\ctikzclass}{\edef\ctikzclass{electromechanicals}}
11565 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
11566 \savedanchor\northwest{
11567 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
11568 \pgf@y=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
11569 \pgf@y=.5\pgf@y
11570 \pgf@x=-\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
11571 \pgf@x=.5\pgf@x
11572 }
11573 \anchor{center}{
11574 \pgfpointorigin
11575 }
11576 \anchor{text}{
11577 \pgfpointorigin
11578 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
11579 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
11580 }
11581 \anchor{left}{%
11582 \northwest
11583 \pgf@y=0pt
11584 }
11585 \anchor{right}{%
11586 \northwest
11587 \pgf@y=0pt
11588 \pgf@x=-\pgf@x
11589 }
11590 \anchor{top}{
11591 \northwest
11592 \pgf@x=0pt
11593 }
11594 \anchor{pathstart}{
11595 \northwest
11596 \pgf@x=0pt
11597 }
11598 \anchor{pathend}{
11599 \northwest
11600 \pgf@x=0pt
11601 \pgf@y=-\pgf@y
11602 }
11603 \anchor{bottom}{
11604 \northwest
11605 \pgf@x=0pt
11606 \pgf@y=-\pgf@y
11607 }
11608 \anchor{center}{
11609 \pgf@y=0pt
11610 \pgf@x=0pt
11611 }
11612 \anchor{east}{
11613 \northwest
11614 \pgf@y=0pt
11615 \pgf@x=-\pgf@x
11616 }
11617 \anchor{west}{
11618 \northwest
11619 \pgf@y=0pt
11620 }
11621 \anchor{south}{
11622 \northwest
11623 \pgf@x=0pt
11624 \pgf@y=-\pgf@y
11625 }
11626 \anchor{north}{
11627 \northwest
11628 \pgf@x=0pt
11629 }
11630 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
11631 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
11632 \anchor{north west}{ \northwest }
11633 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
11634 \anchorborder{%
11635 \@tempdima=\pgf@x\@tempdimb=\pgf@y
11636 \northwest\pgf@circ@res@other=-\pgf@x
11637 \pgfpointborderellipse{\pgfqpoint{\@tempdima}{\@tempdimb}}{\pgfqpoint{\pgf@circ@res@other}{\pgf@circ@res@other}}
11638 }
11639 \anchor{block north west}{\northwest\pgf@x=0.5\pgf@x}
11640 \anchor{block south west}{\northwest\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
11641 \anchor{block north east}{\northwest\pgf@x=-0.5\pgf@x}
11642 \anchor{block south east}{\northwest\pgf@x=-0.5\pgf@x\pgf@y=-\pgf@y}
11643 \anchor{block up right}{
11644 \northwest
11645 % remember that pgf@x is negative
11646 % center of the block is at 0.5*H+W*cos(30)/2
11647 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
11648 \pgf@x=-0.5\pgf@x
11649 }
11650 \anchor{block up left}{
11651 \northwest
11652 % remember that pgf@x is negative
11653 % center of the block is at 0.5*H+W*cos(30)/2
11654 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
11655 \pgf@x=0.5\pgf@x
11656 }
11657 \anchor{block down right}{
11658 \northwest
11659 % remember that pgf@x is negative
11660 % center of the block is at 0.5*H+W*cos(30)/2
11661 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
11662 \pgf@y=-\pgf@y
11663 \pgf@x=-0.5\pgf@x
11664 }
11665 \anchor{block down left}{
11666 \northwest
11667 % remember that pgf@x is negative
11668 % center of the block is at 0.5*H+W*cos(30)/2
11669 \pgf@y=\dimexpr0.5\pgf@y - 0.433\pgf@x\relax
11670 \pgf@y=-\pgf@y
11671 \pgf@x=0.5\pgf@x
11672 }
11673 \pgf@circ@draw@component{
11674 \pgf@circ@setcolor
11675 \pgf@circ@scaled@Rlen=\scaledRlen
11676 \pgf@circ@res@step=\ctikzvalof{tripoles/elmech/width}\pgf@circ@scaled@Rlen
11677 \pgf@circ@res@up=\ctikzvalof{tripoles/elmech/height}\pgf@circ@scaled@Rlen
11678 \pgfscope
11679 \pgfstartlinewidth=\pgflinewidth
11680 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11681 \pgfscope % clip the bar: whole size minus the circle
11682 \pgfpathrectanglecorners{\pgfpoint{-.5\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{.5\pgf@circ@res@up}}
11683 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
11684 \pgfseteorule
11685 \pgfusepath{clip}
11686 \pgfpathrectangle{\pgfpoint{-.25\pgf@circ@res@step}{-.5\pgf@circ@res@up}}{\pgfpoint{.5\pgf@circ@res@step}{\pgf@circ@res@up}}
11687 \pgf@circ@fill@strokecolor
11688 \pgfusepath{fill, draw}
11689 \endpgfscope
11690 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
11691 \ifx\tikz@fillcolor\pgfutil@empty
11692 % set the default fill color to white
11693 \pgfsetfillcolor{white}
11694 % ...but override it if the class is defined!
11695 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
11696 \else
11697 \pgfsetfillcolor{\tikz@fillcolor}
11698 \pgfusepath{draw, fill}
11699 \fi
11700 \endpgfscope
11701 }
11702 }
11703
11704 % %>>>
11705
11706 %% Path definitions for Mechanical%<<<
11707
11708 \pgf@circ@definetranspath{elmech}
11709 \pgfcirc@activate@bipole@simple{l}{spring}
11710 \pgfcirc@activate@bipole@simple{l}{inerter}
11711 \pgfcirc@activate@bipole@simple{l}{mass}
11712 \pgfcirc@activate@bipole@simple{l}{damper}
11713 \pgfcirc@activate@bipole@simple{l}{viscoe}
11714 % %>>>
11715
11716 %%%%%%%%%%%%%%%%%%%%%%%%%
11717 %% Miscellaneous bipoles
11718 %%%%%%%%%%%%%%%%%%%%%%%%%
11719
11720 % settings for microphone, loudspeaker, fuses and misc%<<<1
11721
11722 \ctikzset{bipoles/loudspeaker/height/.initial=.8}
11723 \ctikzset{bipoles/loudspeaker/depth/.initial=.3}
11724 \ctikzset{bipoles/loudspeaker/width/.initial=.8}
11725 \ctikzset{bipoles/mic/height/.initial=1.2}
11726 \ctikzset{bipoles/mic/depth/.initial=.1}
11727 \ctikzset{bipoles/mic/width/.initial=.8}%
11728 \ctikzset{bipoles/tlmic/width/.initial=.5}% it MUST be mic width *5/8
11729 \ctikzset{bipoles/mic/bar thickness/.initial=1}
11730
11731 % arresters, fuses, relais, lamps, etc
11732
11733 \ctikzset{bipoles/european gas filled surge arrester/height/.initial=.30}
11734 \ctikzset{bipoles/european gas filled surge arrester/width/.initial=.80}
11735 \ctikzset{bipoles/european gas filled surge arrester/inside/.initial=.30}
11736 \ctikzset{bipoles/american gas filled surge arrester/height/.initial=.60}
11737 \ctikzset{bipoles/american gas filled surge arrester/width/.initial=.60}
11738 \ctikzset{bipoles/american gas filled surge arrester/inside/.initial=.15}
11739 \ctikzset{bipoles/american gas filled surge arrester/dot x/.initial=.25}
11740 \ctikzset{bipoles/american gas filled surge arrester/dot y/.initial=.45}
11741 % fuses: normal, asymmetric, wiggle
11742 \ctikzset{bipoles/american gas filled surge arrester/size/.initial=.1}
11743 \ctikzset{bipoles/fuse/height/.initial=.20}
11744 \ctikzset{bipoles/fuse/width/.initial=.50}
11745 \ctikzset{bipoles/afuse/height/.initial=.20}
11746 \ctikzset{bipoles/afuse/width/.initial=.50}
11747 \ctikzset{bipoles/lamp/height/.initial=.60}
11748 \ctikzset{bipoles/lamp/width/.initial=.60}
11749 \ctikzset{bipoles/wfuse/height/.initial=.20}
11750 \ctikzset{bipoles/wfuse/width/.initial=.50}
11751 \ctikzset{bipoles/wfuse/shape/.initial=ocirc}
11752 \newif\ifpgf@circ@wfuse@dots\pgf@circ@wfuse@dotstrue
11753 \ctikzset{bipoles/wfuse/dots/.is choice}
11754 \ctikzset{bipoles/wfuse/dots/.is if=pgf@circ@wfuse@dots}
11755 %
11756 \ctikzset{bipoles/relais/height/.initial=.8}
11757 \ctikzset{bipoles/relais/width/.initial=.3}
11758 %
11759 \ctikzset{bipoles/bulb/height/.initial=.8}
11760 \ctikzset{bipoles/bulb/width/.initial=.8}
11761 \ctikzset{bipoles/wbulb/height/.initial=.8}
11762 \ctikzset{bipoles/wbulb/width/.initial=.8}
11763 % suggested by @bogger33, see https://github.com/circuitikz/circuitikz/issues/793
11764 \ctikzset{bipoles/neonlampcc/height/.initial=.60}
11765 \ctikzset{bipoles/neonlampac/height/.initial=.60}
11766 \pgf@circ@declare@family@arrows{sparkgap}
11767 \newif\ifpgf@sparkgap@dot
11768 \newif\ifpgf@sparkgap@circle
11769 \ctikzset{sparkgap/circle/.is if=pgf@sparkgap@circle}
11770 \ctikzset{sparkgap/dot/.is if=pgf@sparkgap@dot}
11771 \ctikzset{sparkgap/gap/.initial=.05}
11772 \ctikzset{bipoles/sparkgap/height/.initial=.60}
11773 %
11774 \ctikzset{bipoles/squid/height/.initial=.60}
11775 \ctikzset{bipoles/squid/width/.initial=.60}
11776 \ctikzset{bipoles/barrier/height/.initial=.21}
11777 \ctikzset{bipoles/barrier/width/.initial=.0}
11778 \ctikzset{bipoles/openbarrier/width/.initial=.3}
11779 \ctikzset{bipoles/openbarrier/gap/.initial=1}
11780 \ctikzset{bipoles/thermocouple/height/.initial=.250}
11781 \ctikzset{bipoles/thermocouple/height 2/.initial=.60}
11782 \ctikzset{bipoles/thermocouple/width/.initial=.140}
11783 \newif\ifpgf@circuit@europeangfsurgearrester
11784 \ctikzset{gas filled surge arrester choice/.is choice}
11785 \ctikzset{gas filled surge arrester choice/european/.code= {\pgf@circuit@europeangfsurgearrestertrue}}
11786 \ctikzset{gas filled surge arrester choice/american/.code= {\pgf@circuit@europeangfsurgearresterfalse}}
11787
11788 \tikzset{american gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=american}}
11789 \tikzset{european gas filled surge arrester set/.style = {\circuitikzbasekey/gas filled surge arrester choice=european}}
11790 %%>>>
11791
11792 %% Node shapes for miscellaneous symbols %<<<
11793 %% loudspeaker and microphone
11794
11795 \pgfcircdeclarebipolescaled{misc}
11796 {}
11797 {\ctikzvalof{bipoles/loudspeaker/depth}}
11798 {loudspeaker}
11799 {\ctikzvalof{bipoles/loudspeaker/height}}
11800 {\ctikzvalof{bipoles/loudspeaker/width}}{
11801
11802 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.4\pgf@circ@res@up}}
11803 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11804 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.4\pgf@circ@res@up}}
11805 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
11806 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
11807 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.4\pgf@circ@res@up}}
11808 \pgfpathclose
11809 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11810 \pgf@circ@draworfill
11811 }
11812
11813 \def\pgf@circ@draw@mic@bar#1{%relative length of the bar
11814 \pgfsetroundcap
11815 \pgfsetlinewidth{\ctikzvalof{bipoles/mic/bar thickness}\pgflinewidth}%
11816 % adjust the vertical position; the symbol looks better if the circle touch the bar
11817 \pgfpathmoveto{\pgfpoint{#1\pgf@circ@res@left}{\pgf@circ@res@up+0.4\pgflinewidth}}
11818 \pgfpathlineto{\pgfpoint{#1\pgf@circ@res@right}{\pgf@circ@res@up+0.4\pgflinewidth}}
11819 \pgfusepath{draw}
11820 }
11821
11822 \pgfcircdeclarebipolescaled{misc}
11823 {}
11824 {\ctikzvalof{bipoles/mic/depth}}
11825 {mic}
11826 {\ctikzvalof{bipoles/mic/height}}
11827 {\ctikzvalof{bipoles/mic/width}}{
11828
11829 \pgfscope
11830 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11831 \pgfpathcircle{\pgfpoint{0pt}{.6\pgf@circ@res@up}}{.4\pgf@circ@res@up}
11832 \pgf@circ@draworfill
11833 \pgf@circ@draw@mic@bar{.6}
11834 \endpgfscope
11835 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11836 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{0pt}}
11837 % 0.25358 is 0.6-0.4*cos(30)
11838 \pgfpathlineto{\pgfpoint{-.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
11839 \pgfpathmoveto{\pgfpoint{.2\pgf@circ@res@up}{.25358\pgf@circ@res@up}}
11840 \pgfpathlineto{\pgfpoint{.2\pgf@circ@res@up}{0pt}}
11841 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
11842 \pgfusepath{draw}
11843 }
11844 \pgfcircdeclarebipolescaled{misc}
11845 {}
11846 {\ctikzvalof{bipoles/tlmic/width}}
11847 {tlmic}
11848 {\ctikzvalof{bipoles/tlmic/width}}
11849 {\ctikzvalof{bipoles/tlmic/width}}{
11850
11851 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11852 \pgfpathcircle{\pgfpoint{0pt}{0pt}}{\pgf@circ@res@up}
11853 \pgf@circ@draworfill
11854 \pgf@circ@draw@mic@bar{1}
11855 }
11856
11857 %% european gas filled surge arrester
11858 \pgfcircdeclarebipolescaled{misc}
11859 {}
11860 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
11861 {european gas filled surge arrester}
11862 {\ctikzvalof{bipoles/european gas filled surge arrester/height}}
11863 {\ctikzvalof{bipoles/european gas filled surge arrester/width}}
11864 {
11865
11866 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11867 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11868
11869 \pgf@circ@draworfill
11870
11871 \pgfscope
11872 \pgfsetarrowsend{latexslim}
11873 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11874 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/european gas filled surge arrester/inside}\pgf@circ@res@left}{0pt}}
11875 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11876 \pgfusepath{draw}
11877
11878 \endpgfscope
11879 }
11880
11881 %% american gas filled surge arrester
11882 \pgfcircdeclarebipolescaled{misc}
11883 {}
11884 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
11885 {american gas filled surge arrester}
11886 {\ctikzvalof{bipoles/american gas filled surge arrester/height}}
11887 {\ctikzvalof{bipoles/american gas filled surge arrester/width}}{
11888
11889 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
11890 \pgf@circ@res@other=-\pgf@circ@res@up
11891 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
11892 \pgfusepath{draw}
11893
11894 \pgfscope
11895 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11896 \pgfpathcircle{\pgfpointorigin}{.9\pgf@circ@res@up}
11897 \pgf@circ@draworfill
11898 \endpgfscope
11899
11900 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@zero}}
11901 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
11902 \pgfusepath{draw}
11903
11904 \pgfscope
11905 \pgfsetarrowsend{latex}
11906
11907 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
11908 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@right}{\pgf@circ@res@zero}}
11909 \pgfusepath{draw}
11910
11911 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
11912 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/american gas filled surge arrester/inside}\pgf@circ@res@left}{\pgf@circ@res@zero}}
11913 \pgfusepath{draw}
11914 \endpgfscope{}
11915
11916 \pgfpathcircle{\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}
11917 \pgfusepath{fill}
11918 }
11919
11920 %% thermocouple
11921 \pgfcircdeclarebipolescaled{misc}
11922 {}
11923 {\ctikzvalof{bipoles/thermocouple/height 2}}
11924 {thermocouple}
11925 {\ctikzvalof{bipoles/thermocouple/height}}
11926 {\ctikzvalof{bipoles/thermocouple/width}}
11927 {
11928 \pgfsetrectcap
11929 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
11930 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
11931 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
11932 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{.5\pgf@circ@res@down}}
11933 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
11934 \pgfusepath{draw}
11935 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11936 \pgfsetroundcap
11937 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{.5\pgf@circ@res@down}}
11938 \pgfpathlineto{\pgfpoint{0}{\pgf@circ@res@down}}
11939 \pgfusepath{draw}
11940 }
11941 %% fuse
11942 \pgfcircdeclarebipolescaled{misc}
11943 {}
11944 {\ctikzvalof{bipoles/fuse/height}}
11945 {fuse}
11946 {\ctikzvalof{bipoles/fuse/height}}
11947 {\ctikzvalof{bipoles/fuse/width}}
11948 {
11949 \pgfscope
11950 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11951 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11952 \pgf@circ@draworfill
11953 \endpgfscope
11954
11955 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
11956 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
11957 \pgfusepath{draw}
11958
11959 }
11960 %% asymmetric fuse
11961 \pgfcircdeclarebipolescaled{misc}
11962 {}
11963 {\ctikzvalof{bipoles/afuse/height}}
11964 {afuse}
11965 {\ctikzvalof{bipoles/afuse/height}}
11966 {\ctikzvalof{bipoles/afuse/width}}
11967 {
11968 \pgfscope
11969 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11970 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
11971 \pgf@circ@draworfill
11972 \endpgfscope
11973
11974 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0}}
11975 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0}}
11976 \pgfusepath{draw}
11977
11978 \pgfpathrectanglecorners{\pgfpoint{.7\pgf@circ@res@right}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
11979 \pgf@circ@fill@strokecolor
11980 \pgfusepath{stroke,fill}
11981 }
11982 %% wiggly fuse
11983 \pgfcircdeclarebipolescaled{misc}
11984 {
11985 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
11986 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{bipoles/wfuse/shape}}}
11987 }
11988 {\ctikzvalof{bipoles/wfuse/height}}
11989 {wfuse}
11990 {\ctikzvalof{bipoles/wfuse/height}}
11991 {\ctikzvalof{bipoles/wfuse/width}}
11992 {
11993 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
11994 \pgfpatharc{0}{180}{.5\pgf@circ@res@left}
11995 \pgfpatharc{0}{-180}{.5\pgf@circ@res@left}
11996 \pgfusepath{draw}
11997 \ifpgf@circ@wfuse@dots
11998 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
11999 \pgfnode{\cshape}{center}{}{\thisshape-left}{\pgfusepath{draw}}
12000 \pgftransformshift{\pgfpoint{2\pgf@circ@res@right}{0pt}}
12001 \pgfnode{\cshape}{center}{}{\thisshape-right}{\pgfusepath{draw}}
12002 \fi
12003 }
12004
12005 %% Relais
12006 \pgfcircdeclarebipolescaled{misc}
12007 {}
12008 {\ctikzvalof{bipoles/relais/height}}
12009 {relais}
12010 {\ctikzvalof{bipoles/relais/height}}
12011 {\ctikzvalof{bipoles/relais/width}}
12012 {
12013 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12014 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12015 \pgf@circ@draworfill
12016 \pgfscope
12017 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12018 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12019 \pgfusepath{draw}
12020 \endpgfscope
12021 }
12022
12023 %% SQUID added by Cor Molenaar 5 March 2010
12024 \pgfcircdeclarebipolescaled{misc}
12025 {}
12026 {\ctikzvalof{bipoles/squid/height}}
12027 {squid}
12028 {\ctikzvalof{bipoles/squid/height}}
12029 {\ctikzvalof{bipoles/squid/width}}
12030 {
12031 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12032
12033 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
12034 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@up}}
12035 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@up}}
12036 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@up}}
12037 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@up}}
12038 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{1.35*\pgf@circ@res@down}}
12039 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{0.65*\pgf@circ@res@down}}
12040 \pgfpathmoveto{\pgfpoint{0.35*\pgf@circ@res@left}{0.65*\pgf@circ@res@down}}
12041 \pgfpathlineto{\pgfpoint{0.35*\pgf@circ@res@right}{1.35*\pgf@circ@res@down}}
12042
12043 \pgfusepath{draw}
12044 }
12045
12046 % Generic barrier added by Cor Molenaar 5 March 2010
12047 \pgfcircdeclarebipolescaled{misc}
12048 {}
12049 {\ctikzvalof{bipoles/barrier/height}}
12050 {barrier}
12051 {\ctikzvalof{bipoles/barrier/height}}
12052 {\ctikzvalof{bipoles/barrier/width}}
12053 {
12054 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@step}}
12055 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@step}}
12056 \pgfusepath{draw}
12057 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12058 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@down}{\pgf@circ@res@up}}
12059 \pgfpathlineto{\pgfpoint{\pgf@circ@res@up}{\pgf@circ@res@down}}
12060 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@down}{\pgf@circ@res@down}}
12061 \pgfpathlineto{\pgfpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
12062 \pgfusepath{draw}
12063 }
12064
12065 % open version of the barrier symbol
12066 % suggested by Radványi Patrik Tamás <[email protected]>
12067 \pgfcircdeclarebipolescaled{misc}
12068 {}
12069 {\ctikzvalof{bipoles/barrier/height}}
12070 {openbarrier}
12071 {\ctikzvalof{bipoles/barrier/height}}
12072 {\ctikzvalof{bipoles/openbarrier/width}}
12073 {
12074 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12075 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@left}{0pt}}
12076 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12077 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/openbarrier/gap}*\pgf@circ@res@right}{0pt}}
12078 \pgfusepath{draw}
12079 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12080 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@down}{\pgf@circ@res@up}}
12081 \pgfpathlineto{\pgfpoint{\pgf@circ@res@up}{\pgf@circ@res@down}}
12082 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@down}{\pgf@circ@res@down}}
12083 \pgfpathlineto{\pgfpoint{\pgf@circ@res@up}{\pgf@circ@res@up}}
12084 \pgfusepath{draw}
12085 }
12086
12087 %% Lamp
12088 \pgfcircdeclarebipolescaled{misc}
12089 {}
12090 {\ctikzvalof{bipoles/lamp/height}}
12091 {lamp}
12092 {\ctikzvalof{bipoles/lamp/height}}
12093 {\ctikzvalof{bipoles/lamp/width}}
12094 {
12095 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12096
12097 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
12098 \pgf@circ@draworfill
12099 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@up}}
12100 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@down}}
12101 \pgfpathmoveto{\pgfpoint{.7071*\pgf@circ@res@left}{.7071*\pgf@circ@res@down}}
12102 \pgfpathlineto{\pgfpoint{.7071*\pgf@circ@res@right}{.7071*\pgf@circ@res@up}}
12103 \pgfusepath{draw}
12104 }
12105
12106 %% bulb
12107 \pgfcircdeclarebipolescaled{misc}
12108 {}
12109 {\ctikzvalof{bipoles/bulb/height}}
12110 {bulb}
12111 {\ctikzvalof{bipoles/bulb/height}}
12112 {\ctikzvalof{bipoles/bulb/width}}
12113 {%
12114 % circles are smaller than the size of the component, for historical reasons.
12115 % Join the circle to the wires
12116 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
12117 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@zero}}
12118 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
12119 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@zero}}
12120 \pgfusepath{draw}
12121 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12122 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
12123 \pgf@circ@draworfill
12124 \pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@zero}}
12125 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{\pgf@circ@res@zero}}
12126 \pgfpatharc{0}{-180}{0.4*\pgf@circ@res@left}
12127 \pgfsetbeveljoin
12128 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@zero}}
12129 \pgfusepath{draw}
12130 }%
12131 % Wiggly bulbm see https://github.com/circuitikz/circuitikz/issues/845
12132 \pgfcircdeclarebipolescaled{misc}
12133 {}
12134 {\ctikzvalof{bipoles/wbulb/height}}
12135 {wbulb}
12136 {\ctikzvalof{bipoles/wbulb/height}}
12137 {\ctikzvalof{bipoles/wbulb/width}}
12138 {%
12139 % circles are smaller than the size of the component, for historical reasons.
12140 % Join the circle to the wires
12141 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
12142 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@zero}}
12143 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
12144 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@zero}}
12145 \pgfusepath{draw}
12146 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12147 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{0.8\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@left}{0}}
12148 \pgf@circ@draworfill
12149 \pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@zero}}
12150 % CP: Control Point; FP: Final Point
12151 \pgfpathcurveto
12152 {\pgfpoint{0.5\pgf@circ@res@left}{+0pt}} % CP1
12153 {\pgfpoint{0.4\pgf@circ@res@left}{0.6\pgf@circ@res@left}} % CP2
12154 {\pgfpoint{+0pt}{+0pt}} % FPA
12155 \pgfpathcurveto
12156 {\pgfpoint{.2\pgf@circ@res@right}{.2\pgf@circ@res@right}} % CP3
12157 {\pgfpoint{.2\pgf@circ@res@right}{0.6\pgf@circ@res@right}} % CP4
12158 {\pgfpoint{+0pt}{0.6\pgf@circ@res@right}} % FPB
12159 \pgfpathcurveto
12160 {\pgfpoint{.2\pgf@circ@res@left}{0.6\pgf@circ@res@right}} % symmetric to CP4
12161 {\pgfpoint{.2\pgf@circ@res@left}{.2\pgf@circ@res@right}} % symmetric to CP3
12162 {\pgfpoint{+0pt}{+0pt}} % same as FPA
12163 \pgfpathcurveto
12164 {\pgfpoint{0.4\pgf@circ@res@right}{0.6\pgf@circ@res@left}} % symmetric to CP2
12165 {\pgfpoint{0.5\pgf@circ@res@right}{+0pt}} % symmetric to CP1
12166 {\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@zero}} % symmetric to FPB
12167 \pgfusepath{draw}
12168 }%
12169 % neon lamps, suggested by @bogger33 https://github.com/circuitikz/circuitikz/issues/793
12170 % implemented by Romano
12171 % double-cathode (capacitor) style
12172 \pgfcircdeclarebipolescaled{misc}
12173 {}
12174 {\ctikzvalof{bipoles/neonlampcc/height}}
12175 {neonlampcc}
12176 {\ctikzvalof{bipoles/neonlampcc/height}}
12177 {\ctikzvalof{bipoles/neonlampcc/height}}
12178 {
12179 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12180 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
12181 \pgf@circ@draworfill
12182 %% leads in
12183 \pgfsetlinewidth{\pgfstartlinewidth}
12184 \def\@@w{0.2}\def\@@h{0.6}
12185 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12186 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{0pt}}
12187 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12188 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}}
12189 %% "capacitor style" symbol
12190 \pgfusepath{draw}
12191 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12192 \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@down}}
12193 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@up}}
12194 \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@down}}
12195 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@up}}
12196 \pgfusepath{draw}
12197 %% dot
12198 \pgftransformshift{\pgfpoint{\@@w\pgf@circ@res@left-3*\ctikzvalof{nodes width}\pgf@circ@Rlen}
12199 {\@@h\pgf@circ@res@down + 2*\ctikzvalof{nodes width}\pgf@circ@Rlen}}
12200 \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}}
12201 }
12202 % anode-cathode style
12203 \pgfcircdeclarebipolescaled{misc}
12204 {}
12205 {\ctikzvalof{bipoles/neonlampac/height}}
12206 {neonlampac}
12207 {\ctikzvalof{bipoles/neonlampac/height}}
12208 {\ctikzvalof{bipoles/neonlampac/height}}
12209 {
12210 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12211 \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
12212 \pgf@circ@draworfill
12213 %% leads in
12214 \pgfsetlinewidth{\pgfstartlinewidth}
12215 \def\@@w{0.5}\def\@@h{0.5}
12216 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12217 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{0pt}}
12218 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12219 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}}
12220 \pgfusepath{draw}
12221 %% one terminal is a straight plate
12222 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12223 \pgfpathmoveto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@down}}
12224 \pgfpathlineto{\pgfpoint{\@@w\pgf@circ@res@left}{\@@h\pgf@circ@res@up}}
12225 \pgfusepath{draw}
12226 %% the other is an "ocirc" shape
12227 \pgftransformshift{\pgfpoint{\@@w\pgf@circ@res@right}{0pt}}
12228 \pgfnode{ocirc}{center}{}{}{\pgfusepath{draw,fill}}
12229 %% dot
12230 \pgftransformshift{\pgfpoint{-\@@w\pgf@circ@res@right}{\@@h\pgf@circ@res@down}}
12231 \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}}
12232 }
12233 % spark gap, suggested by @bogger33 https://github.com/circuitikz/circuitikz/issues/800
12234 \pgfcircdeclarebipolescaled{misc}
12235 {
12236 \savedmacro{\changeh}{\edef\changeh{\ifpgf@sparkgap@circle 1 \else 0.5 \fi}}
12237 \pgfcirc@border@extend@updown{\changeh}{\changeh}
12238 }
12239 {\ctikzvalof{bipoles/sparkgap/height}}
12240 {sparkgap}
12241 {\ctikzvalof{bipoles/sparkgap/height}}
12242 {\ctikzvalof{bipoles/sparkgap/height}}{
12243 % circle (if requested)
12244 \pgfscope
12245 \ifpgf@sparkgap@circle
12246 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12247 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@up}
12248 \pgf@circ@draworfill
12249 \fi
12250 \endpgfscope
12251 % arrows
12252 \pgfscope
12253 \pgfcirc@set@arrows{sparkgap}{}{Triangle[scale=2]}
12254 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12255 \pgfpathlineto{\pgfpoint{\ctikzvalof{sparkgap/gap}\pgf@circ@res@right}{0pt}}
12256 \pgfusepath{draw}
12257 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12258 \pgfpathlineto{\pgfpoint{\ctikzvalof{sparkgap/gap}\pgf@circ@res@left}{0pt}}
12259 \pgfusepath{draw}
12260 \endpgfscope{}
12261 % dot (if requested)
12262 \ifpgf@sparkgap@dot
12263 \pgftransformshift{\pgfpoint
12264 {\ctikzvalof{sparkgap/gap}\pgf@circ@res@left-1*\ctikzvalof{nodes width}\pgf@circ@Rlen}
12265 {-4*\ctikzvalof{nodes width}\pgf@circ@Rlen}}
12266 \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}}
12267 \fi
12268 }
12269
12270 %>>>
12271
12272 %% Path definitions for Miscellaneous%<<<
12273
12274 \pgfcirc@activate@bipole@simple{l}{lamp}
12275 \pgfcirc@activate@bipole@simple{l}{neonlampcc}
12276 \pgfcirc@activate@bipole@simple{l}{neonlampac}
12277 \pgfcirc@activate@bipole@simple{l}{sparkgap}
12278 \pgfcirc@activate@bipole@simple{l}{bulb}
12279 \pgfcirc@activate@bipole@simple{l}{wbulb}
12280 \pgfcirc@activate@bipole@simple{l}{squid}
12281 \pgfcirc@activate@bipole@simple{l}{barrier}
12282 \pgfcirc@activate@bipole@simple{l}{openbarrier}
12283 \pgfcirc@activate@bipole@simple{l}{thermocouple}
12284 \pgfcirc@activate@bipole@simple{l}{fuse}
12285 \pgfcirc@activate@bipole{l}{afuse}{afuse}{asymmetric fuse}
12286 \pgfcirc@style@to@style{asymmetric fuse}{afuse}
12287 \pgfcirc@activate@bipole@simple{l}{wfuse}
12288 \pgfcirc@activate@bipole{l}{wfuse}{wfuse}{wiggly fuse}
12289 \pgfcirc@activate@bipole@simple{l}{relais}
12290 \def\pgf@circ@gfsurgearrester@path#1{\ifpgf@circuit@europeangfsurgearrester\pgf@circ@europeangfsurgearrester@path{#1}\else\pgf@circ@americangfsurgearrester@path{#1}\fi}
12291 \pgfcirc@activate@bipole{l}{europeangfsurgearrester}{european gas filled surge arrester}{european gas filled surge arrester}
12292 \pgfcirc@activate@bipole{l}{americangfsurgearrester}{american gas filled surge arrester}{american gas filled surge arrester}
12293 \pgfcirc@path@to@style{l}{gfsurgearrester}{gas filled surge arrester}{}
12294 \pgfcirc@path@to@style{l}{gfsurgearrester}{gf surge arrester}{}
12295 \pgfcirc@activate@bipole@simple{l}{mic}
12296 \pgfcirc@activate@bipole@simple{l}{tlmic}
12297 \pgfcirc@activate@bipole@simple{l}{loudspeaker}
12298 % %>>>
12299
12300 %% Buzzer and reverse buzzer %<<<
12301 \ctikzset{bipoles/buzzer/height/.initial=0.6}
12302 \ctikzset{bipoles/buzzer/width/.initial=.4}%
12303 \ctikzset{bipoles/buzzer/span/.initial=.6}%
12304
12305 \pgfcircdeclarebipolescaled{misc}
12306 {}
12307 {0}
12308 {buzzer}
12309 {\ctikzvalof{bipoles/buzzer/height}}
12310 {\ctikzvalof{bipoles/buzzer/width}}{
12311 % this is the height of the semicircle
12312 \pgf@circ@res@other=\dimexpr\pgf@circ@res@up-\pgf@circ@res@right\relax
12313 \pgfscope
12314 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12315 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@other}}
12316 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
12317 \pgfpatharc{0}{180}{\pgf@circ@res@right}
12318 \pgfpathclose
12319 \pgf@circ@draworfill
12320 \endpgfscope
12321 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@left}{\pgf@circ@res@other}}
12322 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@left}{0pt}}
12323 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12324 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@right}{\pgf@circ@res@other}}
12325 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@right}{0pt}}
12326 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12327 \pgfusepath{draw}
12328 }
12329 \pgfcirc@activate@bipole@simple{l}{buzzer}
12330 %
12331 \pgfcircdeclarebipolescaled{misc}
12332 {}
12333 {0}
12334 {rbuzzer}
12335 {\ctikzvalof{bipoles/buzzer/height}}
12336 {\ctikzvalof{bipoles/buzzer/width}}{
12337 % this is the height of the semicircle
12338 \pgf@circ@res@other=\dimexpr\pgf@circ@res@up-\pgf@circ@res@right\relax
12339 % this is the height where the pins touch the semicircle
12340 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@res@up-
12341 \pgf@circ@res@right*sqrt(1-\ctikzvalof{bipoles/buzzer/span}*\ctikzvalof{bipoles/buzzer/span})}
12342 \pgfscope
12343 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
12344 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12345 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12346 \pgfpatharc{0}{-180}{\pgf@circ@res@right}
12347 \pgfpathclose
12348 \pgf@circ@draworfill
12349 \endpgfscope
12350 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@left}{\pgf@circ@res@temp}}
12351 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@left}{0pt}}
12352 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
12353 \pgfpathmoveto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@right}{\pgf@circ@res@temp}}
12354 \pgfpathlineto{\pgfpoint{\ctikzvalof{bipoles/buzzer/span}*\pgf@circ@res@right}{0pt}}
12355 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12356 \pgfusepath{draw}
12357 }
12358 \pgfcirc@activate@bipole@simple{l}{rbuzzer}
12359 % %>>>
12360
12361 % end of pgfcircbipoles.tex
12362 % vim: set fdm=marker fmr=%<<<,%>>>:
12363 %%%---------- close: tex/pgfcircbipoles
12364 %%%%%%%%%%% Springe nach tex/pgfcirctripoles
12365 %%%---------- open: tex/pgfcirctripoles.tex
12366 % Copyright 2018-2026 by Romano Giannetti
12367 % Copyright 2015-2026 by Stefan Lindner
12368 % Copyright 2013-2026 by Stefan Erhardt
12369 % Copyright 2007-2026 by Massimo Redaelli
12370 %
12371 % This file may be distributed and/or modified
12372 %
12373 % 1. under the LaTeX Project Public License and/or
12374 % 2. under the GNU Public License.
12375 %
12376 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
12377
12378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12379 %% Tripoles
12380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12381
12382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12383 %% Logic Ports
12384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12385
12386 %% Settings for Logic ports%<<<1
12387 %% beware that the third option is in IEEE ports in pgfcircmultipoles.tex
12388
12389 % switches for logic gates
12390 %
12391 \pgfkeys{/tikz/number inputs/.initial=0}
12392 \pgfkeys{/tikz/number inputs/.default=0}
12393 % by default, use the default font (and color, etc.)
12394 \ctikzset{european ports font/.initial={}}
12395 \newif\ifpgf@circuit@europeanlogicport
12396 \ctikzset{logic ports/.is choice}
12397 \ctikzset{logic ports/european/.code= {\pgf@circuit@europeanlogicporttrue
12398 \tikzset{and port/.style={shape=european and port}}%
12399 \tikzset{or port/.style={shape=european or port}}%
12400 \tikzset{xor port/.style={shape=european xor port}}%
12401 \tikzset{buffer port/.style={shape=european buffer port}}%
12402 \tikzset{not port/.style={shape=european not port}}%
12403 \tikzset{nand port/.style={shape=european nand port}}%
12404 \tikzset{nor port/.style={shape=european nor port}}%
12405 \tikzset{xnor port/.style={shape=european xnor port}}%
12406 \tikzset{blank port/.style={shape=european blank port}}%
12407 \tikzset{blank not port/.style={shape=european blank not port}}%
12408 % there is no Schmitt ports in european style (yet)
12409 \tikzset{schmitt port/.style={shape=schmitt}}%
12410 \tikzset{invschmitt port/.style={shape=invschmitt}}%
12411 }}
12412 \ctikzset{logic ports/american/.code= {\pgf@circuit@europeanlogicportfalse
12413 \tikzset{and port/.style={shape=american and port}}%
12414 \tikzset{or port/.style={shape=american or port}}%
12415 \tikzset{xor port/.style={shape=american xor port}}%
12416 \tikzset{buffer port/.style={shape=american buffer port}}%
12417 \tikzset{not port/.style={shape=american not port}}%
12418 \tikzset{nand port/.style={shape=american nand port}}%
12419 \tikzset{nor port/.style={shape=american nor port}}%
12420 \tikzset{xnor port/.style={shape=american xnor port}}%
12421 \tikzset{schmitt port/.style={shape=schmitt}}%
12422 \tikzset{invschmitt port/.style={shape=invschmitt}}%
12423 %%% there are no blank ports for american (no sense to have them)
12424 \tikzset{blank port/.style={shape=european blank port}}%
12425 \tikzset{blank not port/.style={shape=european blank not port}}%
12426 }}
12427
12428 \ctikzset{logic ports origin/.is choice}
12429 \ctikzset{logic ports origin/legacy/.code={
12430 \ctikzset{tripoles/american and port/origin/.initial=0.8}%
12431 \ctikzset{tripoles/american nand port/origin/.initial=0.8}%
12432 \ctikzset{tripoles/american nor port/origin/.initial=0.8}%
12433 \ctikzset{tripoles/american or port/origin/.initial=0.8}%
12434 \ctikzset{tripoles/american xor port/origin/.initial=0.8}%
12435 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}%
12436 \ctikzset{tripoles/european and port/origin/.initial=0.8}%
12437 \ctikzset{tripoles/european nand port/origin/.initial=0.8}%
12438 \ctikzset{tripoles/european or port/origin/.initial=0.8}%
12439 \ctikzset{tripoles/european nor port/origin/.initial=0.8}%
12440 \ctikzset{tripoles/european xor port/origin/.initial=0.8}%
12441 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}%
12442 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}%
12443 \ctikzset{tripoles/european not port/origin/.initial=0.8}%
12444 \ctikzset{tripoles/european blank port/origin/.initial=0.8}%
12445 \ctikzset{tripoles/european blank not port/origin/.initial=0.8}%
12446 }%
12447 }
12448 \ctikzset{logic ports origin/center/.code={%
12449 \ctikzset{tripoles/american and port/origin/.initial=0}%
12450 \ctikzset{tripoles/american nand port/origin/.initial=0}%
12451 \ctikzset{tripoles/american nor port/origin/.initial=0}%
12452 \ctikzset{tripoles/american or port/origin/.initial=0}%
12453 \ctikzset{tripoles/american xor port/origin/.initial=0}%
12454 \ctikzset{tripoles/american xnor port/origin/.initial=0}%
12455 \ctikzset{tripoles/european and port/origin/.initial=0}%
12456 \ctikzset{tripoles/european nand port/origin/.initial=0}%
12457 \ctikzset{tripoles/european or port/origin/.initial=0}%
12458 \ctikzset{tripoles/european nor port/origin/.initial=0}%
12459 \ctikzset{tripoles/european xor port/origin/.initial=0}%
12460 \ctikzset{tripoles/european xnor port/origin/.initial=0}%
12461 \ctikzset{tripoles/european buffer port/origin/.initial=0}%
12462 \ctikzset{tripoles/european not port/origin/.initial=0}%
12463 \ctikzset{tripoles/european blank port/origin/.initial=0}%
12464 \ctikzset{tripoles/european blank not port/origin/.initial=0}%
12465 }%
12466 }
12467
12468 \newif\ifpgfcirc@roundy@or@shapes\pgfcirc@roundy@or@shapesfalse
12469 \ctikzset{american or shape/.is choice}
12470 \ctikzset{american or shape/roundy/.code={\pgfcirc@roundy@or@shapestrue}}
12471 \ctikzset{american or shape/pointy/.code={\pgfcirc@roundy@or@shapesfalse}}
12472
12473 \newif\ifpgfcirc@draw@input@leads\pgfcirc@draw@input@leadstrue
12474 \ctikzset{logic ports draw input leads/.is choice}
12475 \ctikzset{logic ports draw input leads/true/.code={\pgfcirc@draw@input@leadstrue}}
12476 \ctikzset{logic ports draw input leads/false/.code={\pgfcirc@draw@input@leadsfalse}}
12477 \tikzset{input leads/.code={\pgfcirc@draw@input@leadstrue}}
12478 \tikzset{no input leads/.code={\pgfcirc@draw@input@leadsfalse}}
12479
12480 \newif\ifpgfcirc@draw@output@leads\pgfcirc@draw@output@leadstrue
12481 \ctikzset{logic ports draw output leads/.is choice}
12482 \ctikzset{logic ports draw output leads/true/.code={\pgfcirc@draw@output@leadstrue}}
12483 \ctikzset{logic ports draw output leads/false/.code={\pgfcirc@draw@output@leadsfalse}}
12484 \tikzset{output leads/.code={\pgfcirc@draw@output@leadstrue}}
12485 \tikzset{no output leads/.code={\pgfcirc@draw@output@leadsfalse}}
12486
12487 \ctikzset{logic ports draw leads/.is choice}
12488 \ctikzset{logic ports draw leads/true/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
12489 \ctikzset{logic ports draw leads/false/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
12490 \tikzset{all leads/.code={\pgfcirc@draw@output@leadstrue\pgfcirc@draw@input@leadstrue}}
12491 \tikzset{no leads/.code={\pgfcirc@draw@output@leadsfalse\pgfcirc@draw@input@leadsfalse}}
12492
12493 % adding a different style of xnor port
12494 % see https://github.com/circuitikz/circuitikz/issues/467
12495 \ctikzset{european xnor style/.is choice}
12496 \ctikzset{european xnor style/default/.code={%
12497 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}}%
12498 }
12499 \ctikzset{european xnor style/direct/.code={%
12500 \pgfcircdeclareeurologicport{xnor}{$=$}{\pgf@circ@res@count}{}}%
12501 }
12502
12503
12504 % old, legacy keys that should be killed over
12505 \ctikzset{bipoles/buffer/height/.initial=1}
12506 \ctikzset{bipoles/buffer/width/.initial=1}
12507 \ctikzset{bipoles/not port/width/.initial=1}
12508 \ctikzset{bipoles/not port/height/.initial=.8}
12509 \ctikzset{bipoles/not port/circle width/.initial=.15}
12510
12511 \ctikzset{tripoles/american and port/width/.initial=1.1}
12512 \ctikzset{tripoles/american and port/height/.initial=.8}
12513 \ctikzset{tripoles/american and port/port width/.initial=.7}
12514 \ctikzset{tripoles/american and port/input height/.initial=.5}
12515 \ctikzset{tripoles/american nand port/width/.initial=1.1}
12516 \ctikzset{tripoles/american nand port/height/.initial=.8}
12517 \ctikzset{tripoles/american nand port/port width/.initial=.7}
12518 \ctikzset{tripoles/american nand port/circle width/.initial=.15}
12519 \ctikzset{tripoles/american nand port/input height/.initial=.5}
12520 \ctikzset{tripoles/american or port/width/.initial=1.1}
12521 \ctikzset{tripoles/american or port/height/.initial=.8}
12522 \ctikzset{tripoles/american or port/port width/.initial=.7}
12523 \ctikzset{tripoles/american or port/input height/.initial=.5}
12524 \ctikzset{tripoles/american or port/input skip/.initial=.25}
12525 \ctikzset{tripoles/american or port/aaa/.initial=.6}
12526 \ctikzset{tripoles/american or port/bbb/.initial=.4}
12527 \ctikzset{tripoles/american or port/ccc/.initial=.5}
12528 \ctikzset{tripoles/american or port/ddd/.initial=.0}
12529 \ctikzset{tripoles/american nor port/width/.initial=1.1}
12530 \ctikzset{tripoles/american nor port/height/.initial=.8}
12531 \ctikzset{tripoles/american nor port/port width/.initial=.7}
12532 \ctikzset{tripoles/american nor port/input height/.initial=.5}
12533 \ctikzset{tripoles/american nor port/input skip/.initial=.25}
12534 \ctikzset{tripoles/american nor port/circle width/.initial=.15}
12535 \ctikzset{tripoles/american nor port/aaa/.initial=.6}
12536 \ctikzset{tripoles/american nor port/bbb/.initial=.4}
12537 \ctikzset{tripoles/american nor port/ccc/.initial=.5}
12538 \ctikzset{tripoles/american nor port/ddd/.initial=.0}
12539 \ctikzset{tripoles/american xor port/width/.initial=1.1}
12540 \ctikzset{tripoles/american xor port/height/.initial=.8}
12541 \ctikzset{tripoles/american xor port/port width/.initial=.7}
12542 \ctikzset{tripoles/american xor port/input height/.initial=.5}
12543 \ctikzset{tripoles/american xor port/input skip/.initial=.15}
12544 \ctikzset{tripoles/american xor port/distance/.initial=.1}
12545 \ctikzset{tripoles/american xnor port/width/.initial=1.1}
12546 \ctikzset{tripoles/american xnor port/height/.initial=.8}
12547 \ctikzset{tripoles/american xnor port/port width/.initial=.7}
12548 \ctikzset{tripoles/american xnor port/input height/.initial=.5}
12549 \ctikzset{tripoles/american xnor port/input skip/.initial=.15}
12550 \ctikzset{tripoles/american xnor port/distance/.initial=.1}
12551 \ctikzset{tripoles/american xnor port/circle width/.initial=.15}
12552 \ctikzset{tripoles/american and port/origin/.initial=0.8}
12553 \ctikzset{tripoles/american and port/inputs/.initial=2}
12554 % variable number of inputs
12555 \ctikzset{tripoles/american nand port/origin/.initial=0.8}
12556 \ctikzset{tripoles/american nand port/inputs/.initial=2}
12557 \ctikzset{tripoles/american nor port/origin/.initial=0.8}
12558 \ctikzset{tripoles/american nor port/inputs/.initial=2}
12559 \ctikzset{tripoles/american nor port/angle/.initial=70}
12560 \ctikzset{tripoles/american nor port/inner/.initial=0.3}
12561 \ctikzset{tripoles/american or port/origin/.initial=0.8}
12562 \ctikzset{tripoles/american or port/inputs/.initial=2}
12563 \ctikzset{tripoles/american or port/angle/.initial=70}
12564 \ctikzset{tripoles/american or port/inner/.initial=0.3}
12565 \ctikzset{tripoles/american xor port/origin/.initial=0.8}
12566 \ctikzset{tripoles/american xor port/inputs/.initial=2}
12567 \ctikzset{tripoles/american xor port/angle/.initial=70}
12568 \ctikzset{tripoles/american xor port/inner/.initial=0.3}
12569 \ctikzset{tripoles/american xnor port/origin/.initial=0.8}
12570 \ctikzset{tripoles/american xnor port/inputs/.initial=2}
12571 \ctikzset{tripoles/american xnor port/angle/.initial=70}
12572 \ctikzset{tripoles/american xnor port/inner/.initial=0.3}
12573 %
12574 \ctikzset{tripoles/european and port/width/.initial=1.4}
12575 \ctikzset{tripoles/european and port/height/.initial=.65}
12576 \ctikzset{tripoles/european and port/reserved/.initial=.6}
12577 \ctikzset{tripoles/european and port/input height/.initial=.6}
12578 \ctikzset{tripoles/european or port/width/.initial=1.4}
12579 \ctikzset{tripoles/european or port/height/.initial=.65}
12580 \ctikzset{tripoles/european or port/reserved/.initial=.6}
12581 \ctikzset{tripoles/european or port/input height/.initial=.6}
12582 \ctikzset{tripoles/european xor port/width/.initial=1.4}
12583 \ctikzset{tripoles/european xor port/height/.initial=.65}
12584 \ctikzset{tripoles/european xor port/reserved/.initial=.6}
12585 \ctikzset{tripoles/european xor port/input height/.initial=.6}
12586 \ctikzset{tripoles/european nand port/width/.initial=1.4}
12587 \ctikzset{tripoles/european nand port/not height/.initial=.3}
12588 \ctikzset{tripoles/european nand port/not width/.initial=.9}
12589 \ctikzset{tripoles/european nand port/height/.initial=.65}
12590 \ctikzset{tripoles/european nand port/reserved/.initial=.6}
12591 \ctikzset{tripoles/european nand port/input height/.initial=.6}
12592 \ctikzset{tripoles/european buffer port/width/.initial=1.4}
12593 \ctikzset{tripoles/european buffer port/not height/.initial=.3}
12594 \ctikzset{tripoles/european buffer port/not width/.initial=.9}
12595 \ctikzset{tripoles/european buffer port/height/.initial=.65}
12596 \ctikzset{tripoles/european buffer port/reserved/.initial=.6}
12597 \ctikzset{tripoles/european buffer port/input height/.initial=0}
12598 \ctikzset{tripoles/european not port/width/.initial=1.4}
12599 \ctikzset{tripoles/european not port/not height/.initial=.3}
12600 \ctikzset{tripoles/european not port/not width/.initial=.9}
12601 \ctikzset{tripoles/european not port/height/.initial=.65}
12602 \ctikzset{tripoles/european not port/reserved/.initial=.6}
12603 \ctikzset{tripoles/european not port/input height/.initial=0}
12604 \ctikzset{tripoles/european xnor port/width/.initial=1.4}
12605 \ctikzset{tripoles/european xnor port/not height/.initial=.3}
12606 \ctikzset{tripoles/european xnor port/not width/.initial=.9}
12607 \ctikzset{tripoles/european xnor port/height/.initial=.65}
12608 \ctikzset{tripoles/european xnor port/reserved/.initial=.6}
12609 \ctikzset{tripoles/european xnor port/input height/.initial=.6}
12610 \ctikzset{tripoles/european nor port/width/.initial=1.4}
12611 \ctikzset{tripoles/european nor port/not height/.initial=.3}
12612 \ctikzset{tripoles/european nor port/not width/.initial=.9}
12613 \ctikzset{tripoles/european nor port/height/.initial=.65}
12614 \ctikzset{tripoles/european nor port/reserved/.initial=.6}
12615 \ctikzset{tripoles/european nor port/input height/.initial=.6}
12616 % variable number of inputs
12617 \ctikzset{tripoles/european and port/origin/.initial=0.8}
12618 \ctikzset{tripoles/european and port/inputs/.initial=2}
12619 \ctikzset{tripoles/european nand port/origin/.initial=0.8}
12620 \ctikzset{tripoles/european nand port/inputs/.initial=2}
12621 \ctikzset{tripoles/european or port/origin/.initial=0.8}
12622 \ctikzset{tripoles/european or port/inputs/.initial=2}
12623 \ctikzset{tripoles/european nor port/origin/.initial=0.8}
12624 \ctikzset{tripoles/european nor port/inputs/.initial=2}
12625 \ctikzset{tripoles/european xor port/origin/.initial=0.8}
12626 \ctikzset{tripoles/european xor port/inputs/.initial=2}
12627 \ctikzset{tripoles/european xnor port/origin/.initial=0.8}
12628 \ctikzset{tripoles/european xnor port/inputs/.initial=2}
12629 \ctikzset{tripoles/european buffer port/origin/.initial=0.8}
12630 \ctikzset{tripoles/european buffer port/inputs/.initial=1}%
12631 \ctikzset{tripoles/european not port/origin/.initial=0.8}
12632 \ctikzset{tripoles/european not port/inputs/.initial=1}%
12633 %% "blank" ports
12634 \ctikzset{tripoles/european blank port/width/.initial=1.4}
12635 \ctikzset{tripoles/european blank port/height/.initial=.65}
12636 \ctikzset{tripoles/european blank port/reserved/.initial=.6}
12637 \ctikzset{tripoles/european blank port/input height/.initial=.6}
12638 \ctikzset{tripoles/european blank not port/width/.initial=1.4}
12639 \ctikzset{tripoles/european blank not port/not height/.initial=.3}
12640 \ctikzset{tripoles/european blank not port/not width/.initial=.9}
12641 \ctikzset{tripoles/european blank not port/height/.initial=.65}
12642 \ctikzset{tripoles/european blank not port/reserved/.initial=.6}
12643 \ctikzset{tripoles/european blank not port/input height/.initial=.6}
12644 \ctikzset{tripoles/european blank port/origin/.initial=0.8}
12645 \ctikzset{tripoles/european blank port/inputs/.initial=2}
12646 \ctikzset{tripoles/european blank not port/origin/.initial=0.8}
12647 \ctikzset{tripoles/european blank not port/inputs/.initial=2}
12648 %%% parameters that are not used anymore after multi-input
12649 %%% gates --- left for compatibility of source code.
12650 \ctikzset{tripoles/american xor port/aaa/.initial=.6}
12651 \ctikzset{tripoles/american xor port/bbb/.initial=.4}
12652 \ctikzset{tripoles/american xor port/ccc/.initial=.5}
12653 \ctikzset{tripoles/american xor port/ddd/.initial=.0}
12654 \ctikzset{tripoles/american xnor port/aaa/.initial=.6}
12655 \ctikzset{tripoles/american xnor port/bbb/.initial=.4}
12656 \ctikzset{tripoles/american xnor port/ccc/.initial=.5}
12657 \ctikzset{tripoles/american xnor port/ddd/.initial=.0}
12658 %%>>>
12659
12660 %% Node shapes for Logic ports%<<<
12661 %%
12662 %% Code from John Kormylo at tex.stackexchange.com
12663 %% See https://tex.stackexchange.com/questions/372993/is-it-possible-to-implement-multiple-input-logic-ports-with-circuitikz
12664 %% Integration and fixes from Romano Giannetti and TheTeXnician <[email protected]>
12665 %%
12666
12667 \newcount\pgf@circ@res@count% reserve global register
12668
12669 \def\pgf@circ@logicport@input#1% #1 = \pgfmathcounter
12670 {%
12671 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12672 \step
12673 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12674 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12675 }%
12676
12677 % #1 = \pgfmathcounter #2=type #3 specificic port
12678 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor, 4 for european.
12679 \def\pgf@circ@logicport@baseinput#1#2#3%
12680 {%
12681 % and and nand
12682 \ifnum #2=1\relax
12683 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12684 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12685 \step
12686 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12687 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12688 \pgf@x=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@left
12689 \fi
12690 % or and nor
12691 \ifnum #2=2\relax
12692 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12693 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12694 \pgfextractx{\pgf@circ@res@right}{\northeast}%
12695 \step
12696 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12697 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12698 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american #3 port/angle}}%
12699 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
12700 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12701 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
12702 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
12703 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12704 \pgf@circ@res@temp=\pgf@y
12705 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
12706 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12707 \pgf@x=\pgf@circ@res@other
12708 \fi
12709 % xor and xnor
12710 \ifnum #2=3\relax
12711 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12712 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12713 \pgfextractx{\pgf@circ@res@right}{\northeast}%
12714 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american #3 port/angle}{\pgf@circ@math@angle}%
12715 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/inner}\pgf@circ@res@right
12716 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12717 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
12718 \pgf@circ@res@other=\ctikzvalof{tripoles/american #3 port/port width}\pgf@circ@res@right
12719 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12720 \pgf@circ@res@temp=\ctikzvalof{tripoles/american #3 port/distance}\pgf@circ@res@right
12721 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
12722 % this compensates for the effect of the line width on the gap between the arcs
12723 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
12724 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
12725
12726 \step
12727 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12728 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12729 \pgf@circ@res@temp=\pgf@y
12730 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
12731 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12732 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
12733 \pgf@x=\pgf@circ@res@other
12734 \fi
12735 % european
12736 \ifnum #2=4\relax
12737 \pgfextracty{\pgf@circ@res@up}{\northeast}%
12738 \pgfextractx{\pgf@circ@res@other}{\left}%
12739 \step
12740 \pgf@circ@res@step=\dimexpr 2\pgf@y -2\pgf@circ@res@up\relax
12741 \advance\pgf@y by -#1\pgf@circ@res@step\relax
12742 \pgf@x=\pgf@circ@res@other
12743 \fi
12744 }%
12745
12746 %%% american
12747 \long\def\pgfcircdeclarelogicport#1#2#3{%
12748 \pgfdeclareshape{american #1 port}%
12749 {%
12750 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
12751 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
12752 \savedmacro\resize{% automatic
12753 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12754 \pgf@circ@res@up = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
12755 \pgf@circ@res@up = .5\pgf@circ@res@up
12756 \pgf@circ@res@down = -\pgf@circ@res@up
12757 \pgf@circ@res@right = \ctikzvalof{tripoles/american #1 port/width}\pgf@circ@scaled@Rlen
12758 \pgf@circ@res@right = .5\pgf@circ@res@right
12759 \pgf@circ@res@left = -\pgf@circ@res@right
12760 }%
12761 \savedmacro\inputs{% get number of inputs
12762 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
12763 \ifnum\pgf@circ@res@count=0
12764 \pgf@circ@res@count=\ctikzvalof{tripoles/american #1 port/inputs}\relax%
12765 \fi
12766 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
12767 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
12768 \def\inputs{\the\pgf@circ@res@count}%
12769 }%
12770 \savedanchor\step{% 1/2 gap at edges
12771 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
12772 \pgf@circ@res@step = \ctikzvalof{tripoles/american #1 port/height}\pgf@circ@scaled@Rlen
12773 \divide\pgf@circ@res@step by \pgf@circ@res@count
12774 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
12775 }%
12776 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
12777 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
12778 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@left}{0pt}}
12779 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/american #1 port/port width}\pgf@circ@res@right}{0pt}}
12780 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/american #1 port/origin}\pgf@circ@res@right}{0pt}}
12781
12782 \anchor{center}{\origin}% for backwards compatibility
12783 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}
12784
12785 % create input anchors
12786 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@american #1 port\endcsname{%
12787 \pgfmathloop%
12788 \ifnum\pgfmathcounter>\pgf@circ@res@count%
12789 \else%
12790 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
12791 \expandafter\xdef\csname pgf@anchor@american #1 port@in \pgfmathcounter\endcsname{%
12792 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
12793 }%
12794 \expandafter\xdef\csname pgf@anchor@american #1 port@bin \pgfmathcounter\endcsname{%
12795 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{#2}{#1}% defined above
12796 }%
12797 %}{}%
12798 \repeatpgfmathloop%
12799 }
12800
12801 \anchor{out}{\northeast\pgf@y=0pt}
12802 \anchor{bout}{\right\pgf@y=0pt}
12803
12804
12805 \anchor{left}{\left}% edges of component minus leads
12806 \anchor{right}{\right}
12807
12808 \anchor{north east}{\northeast}% see \Compass macro
12809 \anchor{south west}{\southwest}
12810 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
12811 \pgfpoint{0cm}{\pgf@circ@res@up}}
12812 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
12813 \pgfextractx{\pgf@circ@res@left}{\southwest}%
12814 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
12815 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
12816 \pgfpoint{\pgf@circ@res@left}{0cm}}
12817 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
12818 \pgfpoint{0cm}{\pgf@circ@res@down}}
12819 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
12820 \pgfextractx{\pgf@circ@res@right}{\northeast}%
12821 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
12822 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
12823 \pgfpoint{\pgf@circ@res@right}{0cm}}
12824
12825 \pgf@circ@draw@component{
12826 \pgf@circ@setcolor
12827 % \pgf@circ@debug@colors
12828 #3%
12829 }
12830 }
12831 }
12832 %%% american and %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12833 \pgfcircdeclarelogicport{and}{1}{
12834 \pgfextracty{\pgf@circ@res@temp}{\step}%
12835 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12836 \pgf@circ@res@count = \inputs\relax
12837 \ifpgfcirc@draw@input@leads
12838 %input leads
12839 \loop\ifnum\pgf@circ@res@count>0
12840 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12841 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12842 \pgfpathlineto{\pgfpoint
12843 {\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left}
12844 {\pgf@circ@res@temp}}
12845 \advance\pgf@circ@res@count by -1
12846 \repeat
12847 \fi
12848 % output lead
12849 \ifpgfcirc@draw@output@leads
12850 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12851 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@right} {0pt}}
12852 \pgfusepath{draw}
12853 \fi
12854
12855
12856 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12857 \pgf@circ@res@other=\ctikzvalof{tripoles/american and port/port width}\pgf@circ@res@left
12858
12859 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
12860 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
12861 \pgfpatharc{-90}{90}{-2\pgf@circ@res@other and \pgf@circ@res@up}
12862 \pgfpathclose
12863 \pgf@circ@draworfill
12864 }
12865 %%% american nand %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12866 \pgfcircdeclarelogicport{nand}{1}{
12867 \pgfextracty{\pgf@circ@res@temp}{\step}%
12868 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12869 \pgf@circ@res@count = \inputs\relax
12870 \ifpgfcirc@draw@input@leads
12871 %input leads
12872 \loop\ifnum\pgf@circ@res@count>0
12873 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12874 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12875 \pgfpathlineto{\pgfpoint
12876 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@left}
12877 {\pgf@circ@res@temp}}
12878 \advance\pgf@circ@res@count by -1
12879 \repeat
12880 \fi
12881
12882 \ifpgfcirc@draw@output@leads
12883 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12884 \pgfpathlineto{\pgfpoint
12885 {\ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right} {0pt}}
12886 \pgfusepath{draw}
12887 \fi
12888 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12889 \pgf@circ@res@step = \ctikzvalof{tripoles/american nand port/circle width}\pgf@circ@res@right
12890 \pgf@circ@res@other = \ctikzvalof{tripoles/american nand port/port width}\pgf@circ@res@right
12891 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
12892
12893 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@up}}
12894 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{\pgf@circ@res@down}}
12895 \pgfpatharc{-90}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}
12896 \pgfpathclose
12897
12898 \pgfpathellipse
12899 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@step}{0pt}}
12900 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
12901 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
12902
12903 \pgf@circ@draworfill
12904 }
12905 %%% american nor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12906 \pgfcircdeclarelogicport{nor}{2}{
12907 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
12908 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/inner}\pgf@circ@res@right
12909 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12910 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
12911 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
12912 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12913
12914 \pgfextracty{\pgf@circ@res@temp}{\step}%
12915 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12916 \pgf@circ@res@count = \inputs\relax
12917 \ifpgfcirc@draw@input@leads
12918 %input leads
12919 \loop\ifnum\pgf@circ@res@count>0
12920 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12921 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12922 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
12923 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12924 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
12925 \advance\pgf@circ@res@count by -1
12926 \repeat
12927 \fi
12928
12929 \pgf@circ@res@other=\ctikzvalof{tripoles/american nor port/port width}\pgf@circ@res@right
12930 \ifpgfcirc@draw@output@leads
12931 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12932 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12933 \pgfusepath{draw}
12934 \fi
12935
12936 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12937
12938 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american nor port/angle}}%
12939 \pgf@circ@res@step = \ctikzvalof{tripoles/american nor port/circle width}\pgf@circ@res@right
12940 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
12941 \advance\pgf@circ@res@other by -\pgf@circ@res@step
12942
12943 % main shape
12944 \ifpgfcirc@roundy@or@shapes
12945 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
12946 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
12947 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12948 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
12949 \pgfpathclose
12950 \else
12951 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12952 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
12953 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
12954 \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}}
12955 \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}}
12956 \pgfpathclose
12957 \fi
12958
12959 % not dot
12960 \pgfpathellipse
12961 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
12962 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
12963 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
12964
12965 \pgf@circ@draworfill
12966 }
12967 %%% american or %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12968 \pgfcircdeclarelogicport{or}{2}{
12969 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
12970 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/inner}\pgf@circ@res@right
12971 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
12972 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up /sin(\pgf@circ@math@angle)}%
12973 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
12974 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
12975
12976 \pgfextracty{\pgf@circ@res@temp}{\step}%
12977 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
12978 \pgf@circ@res@count = \inputs\relax
12979 \ifpgfcirc@draw@input@leads
12980 %input leads
12981 \loop\ifnum\pgf@circ@res@count>0
12982 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
12983 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
12984 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp/\pgf@circ@math@yradius)}%
12985 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
12986 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
12987 \advance\pgf@circ@res@count by -1
12988 \repeat
12989 \fi
12990
12991 \pgf@circ@res@other=\ctikzvalof{tripoles/american or port/port width}\pgf@circ@res@right
12992 \ifpgfcirc@draw@output@leads
12993 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
12994 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
12995 \pgfusepath{draw}
12996 \fi
12997
12998 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
12999
13000 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american or port/angle}}%
13001
13002 % main shape
13003 \ifpgfcirc@roundy@or@shapes
13004 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
13005 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
13006 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
13007 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
13008 \pgfpathclose
13009 \else
13010 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
13011 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
13012 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
13013 \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}}
13014 \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}}
13015 \pgfpathclose
13016 \fi
13017
13018 \pgf@circ@draworfill
13019 }
13020 %%% american xor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13021 \pgfcircdeclarelogicport{xor}{3}{
13022 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xor port/angle}{\pgf@circ@math@angle}%
13023 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/inner}\pgf@circ@res@right
13024 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
13025 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
13026 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
13027 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
13028 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
13029 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
13030 % this compensates for the effect of the line width on the gap between the arcs
13031 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
13032 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
13033
13034 \pgfextracty{\pgf@circ@res@temp}{\step}%
13035 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
13036 \pgf@circ@res@count = \inputs\relax
13037 \ifpgfcirc@draw@input@leads
13038 %input leads
13039 \loop\ifnum\pgf@circ@res@count>0
13040 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
13041 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
13042 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
13043 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
13044 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
13045 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
13046 \advance\pgf@circ@res@count by -1
13047 \repeat
13048 \fi
13049
13050 \pgf@circ@res@other=\ctikzvalof{tripoles/american xor port/port width}\pgf@circ@res@right
13051 \ifpgfcirc@draw@output@leads
13052 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13053 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
13054 \pgfusepath{draw}
13055 \fi
13056
13057 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13058
13059 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xor port/angle}}%
13060
13061 % main shape
13062 \ifpgfcirc@roundy@or@shapes
13063 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
13064 \pgfpatharc{0}{90}{2\pgf@circ@res@other and \pgf@circ@res@up}%
13065 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
13066 \pgfpatharc{-90}{0}{2\pgf@circ@res@other and \pgf@circ@res@up}%
13067 \pgfpathclose
13068 \else
13069 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
13070 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
13071 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
13072 \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}}
13073 \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}}
13074 \pgfpathclose
13075 \fi
13076 \pgf@circ@draworfill
13077
13078 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
13079
13080 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
13081 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
13082
13083 \pgfusepath{draw}
13084 }
13085 %%% american xnor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13086 \pgfcircdeclarelogicport{xnor}{3}{
13087 \pgfkeysgetvalue{/tikz/circuitikz/tripoles/american xnor port/angle}{\pgf@circ@math@angle}%
13088 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/inner}\pgf@circ@res@right
13089 \pgfmathsetlengthmacro{\pgf@circ@math@xradius}{\pgf@circ@res@other /(1 - cos(\pgf@circ@math@angle)}%
13090 \pgfmathsetlengthmacro{\pgf@circ@math@yradius}{\pgf@circ@res@up / sin(\pgf@circ@math@angle))}%
13091 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
13092 \pgfmathsetlengthmacro{\pgf@circ@math@xorigin}{\pgf@circ@res@other + \pgf@circ@math@xradius*cos(\pgf@circ@math@angle)}%
13093 \pgf@circ@res@temp=\ctikzvalof{tripoles/american xor port/distance}\pgf@circ@res@right
13094 \pgfmathsetlengthmacro{\pgf@circ@math@distance}{\pgf@circ@res@temp}
13095 % this compensates for the effect of the line width on the gap between the arcs
13096 \pgfmathsetlengthmacro{\pgf@circ@math@yradiusA}{\pgf@circ@math@yradius -2\pgflinewidth}%
13097 \pgfmathsetlengthmacro{\pgf@circ@math@xradiusA}{\pgf@circ@math@xradius -2\pgflinewidth}%
13098
13099 \pgfextracty{\pgf@circ@res@temp}{\step}%
13100 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
13101 \pgf@circ@res@count = \inputs\relax
13102 \ifpgfcirc@draw@input@leads
13103 %input leads
13104 \loop\ifnum\pgf@circ@res@count>0
13105 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
13106 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
13107 \pgfmathsetmacro{\pgf@circ@math@angle}{asin(\pgf@circ@res@temp / \pgf@circ@math@yradiusA)}%
13108 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@math@xradiusA*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
13109 \advance\pgf@circ@res@other by -\pgf@circ@math@distance
13110 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@temp}}%
13111 \advance\pgf@circ@res@count by -1
13112 \repeat
13113 \fi
13114
13115 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@right
13116 \ifpgfcirc@draw@output@leads
13117 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13118 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
13119 \pgfusepath{draw}
13120 \fi
13121
13122 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13123
13124 \edef\pgf@circ@math@angle{\ctikzvalof{tripoles/american xnor port/angle}}%
13125 \pgf@circ@res@step = \ctikzvalof{tripoles/american xnor port/circle width}\pgf@circ@res@right
13126 \pgf@circ@res@temp = \dimexpr 2\pgf@circ@res@other - \pgf@circ@res@step\relax
13127 \advance\pgf@circ@res@other by -\pgf@circ@res@step
13128
13129 % main shape
13130 \ifpgfcirc@roundy@or@shapes
13131 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{0pt}}% for symmetry
13132 \pgfpatharc{0}{90}{\pgf@circ@res@temp and \pgf@circ@res@up}%
13133 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
13134 \pgfpatharc{-90}{0}{\pgf@circ@res@temp and \pgf@circ@res@up}%
13135 \pgfpathclose
13136 \else
13137 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@math@xradius*cos(\pgf@circ@math@angle)-\pgf@circ@math@xorigin}%
13138 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@up}}
13139 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradius and \pgf@circ@math@yradius}%
13140 \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}}
13141 \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}}
13142 \pgfpathclose
13143 \fi
13144
13145 \pgfpathellipse
13146 {\pgfpoint{\pgf@circ@res@other+.5\pgf@circ@res@step}{0pt}}
13147 {\pgfpoint{.5\pgf@circ@res@step}{0pt}}
13148 {\pgfpoint{0pt}{.5\pgf@circ@res@step}}
13149 \pgf@circ@draworfill
13150
13151 \pgf@circ@res@other=\ctikzvalof{tripoles/american xnor port/port width}\pgf@circ@res@left
13152 \pgfmathsetlength{\pgf@circ@res@temp}{(\pgf@circ@math@yradiusA)*sin(\pgf@circ@math@angle)}%
13153
13154 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@math@distance}{\pgf@circ@res@temp}}% first arc
13155 \pgfpatharc{\pgf@circ@math@angle}{-\pgf@circ@math@angle}{\pgf@circ@math@xradiusA and \pgf@circ@math@yradiusA}%
13156
13157 \pgfusepath{draw}
13158 }
13159
13160 %%% Original one-input ports
13161
13162 \pgfdeclareshape{american not port}{
13163 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13164 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13165 \anchor{center}{\pgfpointorigin}
13166 \savedanchor\northwest{%
13167 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13168 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
13169 \pgf@y=.5\pgf@y
13170 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
13171 \pgf@x=.5\pgf@x
13172 }
13173 \anchor{in}{
13174 \northwest
13175 \pgf@y=0pt
13176 }
13177 \anchor{in 1}{
13178 \northwest
13179 \pgf@y=0pt
13180 }
13181 \anchor{left}{
13182 \northwest
13183 \pgf@x=0.7\pgf@x
13184 \pgf@y=0pt
13185 }
13186 \anchor{bin}{
13187 \northwest
13188 \pgf@x=0.7\pgf@x
13189 \pgf@y=0pt
13190 }
13191 \anchor{bin 1}{
13192 \northwest
13193 \pgf@y=0pt
13194 \pgf@x=0.7\pgf@x
13195 }
13196 \anchor{out}{
13197 \northwest
13198 \pgf@y=0pt
13199 \pgf@x=-\pgf@x
13200 }
13201 \anchor{right}{
13202 \northwest
13203 \pgf@y=0pt
13204 \pgf@x=-0.7\pgf@x
13205 }
13206 \anchor{bout}{
13207 \northwest
13208 \pgf@y=0pt
13209 \pgf@x=-0.7\pgf@x
13210 }
13211 \anchor{center}{
13212 \pgfpointorigin
13213 }
13214 \anchor{east}{
13215 \northwest
13216 \pgf@y=0pt
13217 \pgf@x=-\pgf@x
13218 }
13219 \anchor{west}{
13220 \northwest
13221 \pgf@y=0pt
13222 }
13223 \anchor{south}{
13224 \northwest
13225 \pgf@x=0pt
13226 \pgf@y=-\pgf@y
13227 }
13228 \anchor{north}{
13229 \northwest
13230 \pgf@x=0pt
13231 }
13232 \anchor{south west}{
13233 \northwest
13234 \pgf@y=-\pgf@y
13235 }
13236 \anchor{north east}{
13237 \northwest
13238 \pgf@x=-\pgf@x
13239 }
13240 \anchor{north west}{
13241 \northwest
13242 }
13243 \anchor{south east}{
13244 \northwest
13245 \pgf@x=-\pgf@x
13246 \pgf@y=-\pgf@y
13247 }
13248 \anchorborder{% this is used when the node is used as a path element
13249 \pgf@xa=\pgf@x
13250 \pgf@ya=\pgf@y
13251 \pgfextracty{\pgf@circ@res@up}{\northwest}
13252 \pgfextractx{\pgf@circ@res@left}{\northwest}
13253 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13254 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
13255 }
13256 \anchor{text}{%
13257 % centered and a bit to the left (it's a triangle)!
13258 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13259 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13260 }
13261 \pgf@circ@draw@component{
13262 \pgf@circ@setcolor
13263
13264 \northwest
13265 \pgf@circ@res@up = \pgf@y
13266 \pgf@circ@res@down = -\pgf@y
13267 \pgf@circ@res@right = -\pgf@x
13268 \pgf@circ@res@left = \pgf@x
13269
13270 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
13271
13272 \pgfscope
13273 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13274 \pgftransformxshift{.7\pgf@circ@res@left}
13275 \pgf@circ@res@step=\pgf@circ@res@right
13276 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13277 \pgf@circ@res@step=.7\pgf@circ@res@step
13278
13279 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
13280 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13281 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13282 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
13283 \pgf@circ@draworfill
13284 \pgfpathellipse
13285 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
13286 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
13287 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
13288 \pgf@circ@draworfill
13289 \endpgfscope
13290
13291 \ifpgfcirc@draw@input@leads
13292 %input leads
13293 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13294 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13295 \fi
13296
13297 \ifpgfcirc@draw@output@leads
13298 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13299 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13300 \fi
13301
13302 \pgfusepath{draw}
13303 }
13304 }
13305
13306 \pgfdeclareshape{american buffer port}{
13307 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13308 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13309 \anchor{center}{\pgfpointorigin}
13310 \savedanchor\northwest{%
13311 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13312 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
13313 \pgf@y=.5\pgf@y
13314 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
13315 \pgf@x=.5\pgf@x
13316 }
13317 \anchor{in}{
13318 \northwest
13319 \pgf@y=0pt
13320 }
13321 \anchor{in 1}{
13322 \northwest
13323 \pgf@y=0pt
13324 }
13325 \anchor{left}{
13326 \northwest
13327 \pgf@x=0.7\pgf@x
13328 \pgf@y=0pt
13329 }
13330 \anchor{bin}{
13331 \northwest
13332 \pgf@x=0.7\pgf@x
13333 \pgf@y=0pt
13334 }
13335 \anchor{bin 1}{
13336 \northwest
13337 \pgf@y=0pt
13338 \pgf@x=0.7\pgf@x
13339 }
13340 \anchor{out}{
13341 \northwest
13342 \pgf@y=0pt
13343 \pgf@x=-\pgf@x
13344 }
13345 \anchor{right}{
13346 \northwest
13347 \pgf@y=0pt
13348 \pgf@x=-0.7\pgf@x
13349 }
13350 \anchor{bout}{
13351 \northwest
13352 \pgf@y=0pt
13353 \pgf@x=-0.7\pgf@x
13354 }
13355 \anchor{center}{
13356 \pgfpointorigin
13357 }
13358 \anchor{east}{
13359 \northwest
13360 \pgf@y=0pt
13361 \pgf@x=-\pgf@x
13362 }
13363 \anchor{west}{
13364 \northwest
13365 \pgf@y=0pt
13366 }
13367 \anchor{south}{
13368 \northwest
13369 \pgf@x=0pt
13370 \pgf@y=-\pgf@y
13371 }
13372 \anchor{north}{
13373 \northwest
13374 \pgf@x=0pt
13375 }
13376 \anchor{south west}{
13377 \northwest
13378 \pgf@y=-\pgf@y
13379 }
13380 \anchor{north east}{
13381 \northwest
13382 \pgf@x=-\pgf@x
13383 }
13384 \anchor{north west}{
13385 \northwest
13386 }
13387 \anchor{south east}{
13388 \northwest
13389 \pgf@x=-\pgf@x
13390 \pgf@y=-\pgf@y
13391 }
13392 \anchorborder{% this is used when the node is used as a path element
13393 \pgf@xa=\pgf@x
13394 \pgf@ya=\pgf@y
13395 \pgfextracty{\pgf@circ@res@up}{\northwest}
13396 \pgfextractx{\pgf@circ@res@left}{\northwest}
13397 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13398 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
13399 }
13400 \anchor{text}{%
13401 % centered and a bit to the left (it's a triangle)!
13402 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13403 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13404 }
13405 \pgf@circ@draw@component{
13406 \pgf@circ@setcolor
13407
13408 \northwest
13409 \pgf@circ@res@up = \pgf@y
13410 \pgf@circ@res@down = -\pgf@y
13411 \pgf@circ@res@right = -\pgf@x
13412 \pgf@circ@res@left = \pgf@x
13413
13414 \pgfscope
13415 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13416 \pgftransformxshift{.7\pgf@circ@res@left}
13417 \pgf@circ@res@step=\pgf@circ@res@right
13418 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13419 \pgf@circ@res@step=.7\pgf@circ@res@step
13420
13421 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13422 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13423 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13424 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13425 \pgf@circ@draworfill
13426 \endpgfscope
13427
13428 \ifpgfcirc@draw@input@leads
13429 %input leads
13430 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13431 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13432 \fi
13433
13434 \ifpgfcirc@draw@output@leads
13435 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13436 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13437 \fi
13438
13439 \pgfusepath{draw}
13440 }
13441 }
13442 \pgfdeclareshape{invschmitt}{
13443 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13444 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13445 \anchor{center}{\pgfpointorigin}
13446 \savedanchor\northwest{%
13447 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13448 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
13449 \pgf@y=.5\pgf@y
13450 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
13451 \pgf@x=.5\pgf@x
13452 }
13453 \anchor{in}{
13454 \northwest
13455 \pgf@y=0pt
13456 }
13457 \anchor{in 1}{
13458 \northwest
13459 \pgf@y=0pt
13460 }
13461 \anchor{left}{
13462 \northwest
13463 \pgf@y=0pt
13464 \pgf@x=0.7\pgf@x
13465 }
13466 \anchor{bin}{
13467 \northwest
13468 \pgf@y=0pt
13469 \pgf@x=0.7\pgf@x
13470 }
13471 \anchor{bin 1}{
13472 \northwest
13473 \pgf@y=0pt
13474 \pgf@x=0.7\pgf@x
13475 }
13476 \anchor{out}{
13477 \northwest
13478 \pgf@y=0pt
13479 \pgf@x=-\pgf@x
13480 }
13481 \anchor{right}{
13482 \northwest
13483 \pgf@y=0pt
13484 \pgf@x=-0.7\pgf@x
13485 }
13486 \anchor{bout}{
13487 \northwest
13488 \pgf@y=0pt
13489 \pgf@x=-0.7\pgf@x
13490 }
13491 \anchor{center}{
13492 \pgfpointorigin
13493 }
13494 \anchor{east}{
13495 \northwest
13496 \pgf@y=0pt
13497 \pgf@x=-\pgf@x
13498 }
13499 \anchor{west}{
13500 \northwest
13501 \pgf@y=0pt
13502 }
13503 \anchor{south}{
13504 \northwest
13505 \pgf@x=0pt
13506 \pgf@y=-\pgf@y
13507 }
13508 \anchor{north}{
13509 \northwest
13510 \pgf@x=0pt
13511 }
13512 \anchor{south west}{
13513 \northwest
13514 \pgf@y=-\pgf@y
13515 }
13516 \anchor{north east}{
13517 \northwest
13518 \pgf@x=-\pgf@x
13519 }
13520 \anchor{north west}{
13521 \northwest
13522 }
13523 \anchor{south east}{
13524 \northwest
13525 \pgf@x=-\pgf@x
13526 \pgf@y=-\pgf@y
13527 }
13528 \anchorborder{% this is used when the node is used as a path element
13529 \pgf@xa=\pgf@x
13530 \pgf@ya=\pgf@y
13531 \pgfextracty{\pgf@circ@res@up}{\northwest}
13532 \pgfextractx{\pgf@circ@res@left}{\northwest}
13533 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13534 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
13535 }
13536 \anchor{text}{%
13537 % centered and a bit to the left (it's a triangle)!
13538 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13539 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13540 }
13541 \pgf@circ@draw@component{
13542 \pgf@circ@setcolor
13543
13544 \northwest
13545 \pgf@circ@res@up = \pgf@y
13546 \pgf@circ@res@down = -\pgf@y
13547 \pgf@circ@res@right = -\pgf@x
13548 \pgf@circ@res@left = \pgf@x
13549
13550 \pgf@circ@res@other = \ctikzvalof{bipoles/not port/circle width}\pgf@circ@res@right
13551
13552 \pgfscope
13553 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13554 \pgftransformxshift{.7\pgf@circ@res@left}
13555 \pgf@circ@res@step=\pgf@circ@res@right
13556 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13557 \pgf@circ@res@step=.7\pgf@circ@res@step
13558
13559 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step-\pgf@circ@res@other}{0pt}}
13560 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13561 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13562 \pgfpathclose
13563 \pgf@circ@draworfill
13564 \pgfpathellipse
13565 {\pgfpoint{\pgf@circ@[email protected]\pgf@circ@res@other}{0pt}}
13566 {\pgfpoint{.5\pgf@circ@res@other}{0pt}}
13567 {\pgfpoint{0pt}{.5\pgf@circ@res@other}}
13568 \pgf@circ@draworfill
13569 \endpgfscope
13570
13571 \ifpgfcirc@draw@input@leads
13572 %input leads
13573 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13574 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13575 \fi
13576
13577 \ifpgfcirc@draw@output@leads
13578 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13579 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
13580 \fi
13581 \pgfusepath{draw}
13582 %draw inner shape
13583
13584 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13585
13586 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13587 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13588 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13589 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13590 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13591 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13592 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13593 \pgfusepath{draw}
13594
13595 }
13596 }
13597
13598 \pgfdeclareshape{schmitt}{
13599 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13600 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13601 \anchor{center}{\pgfpointorigin}
13602 \savedanchor\northwest{%
13603 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13604 \pgf@y=\ctikzvalof{bipoles/not port/height}\pgf@circ@scaled@Rlen
13605 \pgf@y=.5\pgf@y
13606 \pgf@x=-\ctikzvalof{bipoles/not port/width}\pgf@circ@scaled@Rlen
13607 \pgf@x=.5\pgf@x
13608 }
13609 \anchor{in}{
13610 \northwest
13611 \pgf@y=0pt
13612 }
13613 \anchor{in 1}{
13614 \northwest
13615 \pgf@y=0pt
13616 }
13617 \anchor{left}{
13618 \northwest
13619 \pgf@y=0pt
13620 \pgf@x=0.7\pgf@x
13621 }
13622 \anchor{bin}{
13623 \northwest
13624 \pgf@y=0pt
13625 \pgf@x=0.7\pgf@x
13626 }
13627 \anchor{bin 1}{
13628 \northwest
13629 \pgf@y=0pt
13630 \pgf@x=0.7\pgf@x
13631 }
13632 \anchor{out}{
13633 \northwest
13634 \pgf@y=0pt
13635 \pgf@x=-\pgf@x
13636 }
13637 \anchor{right}{
13638 \northwest
13639 \pgf@y=0pt
13640 \pgf@x=-.7\pgf@x
13641 }
13642 \anchor{bout}{
13643 \northwest
13644 \pgf@y=0pt
13645 \pgf@x=-.7\pgf@x
13646 }
13647 \anchor{center}{
13648 \pgfpointorigin
13649 }
13650 \anchor{east}{
13651 \northwest
13652 \pgf@y=0pt
13653 \pgf@x=-\pgf@x
13654 }
13655 \anchor{west}{
13656 \northwest
13657 \pgf@y=0pt
13658 }
13659 \anchor{south}{
13660 \northwest
13661 \pgf@x=0pt
13662 \pgf@y=-\pgf@y
13663 }
13664 \anchor{north}{
13665 \northwest
13666 \pgf@x=0pt
13667 }
13668 \anchor{south west}{
13669 \northwest
13670 \pgf@y=-\pgf@y
13671 }
13672 \anchor{north east}{
13673 \northwest
13674 \pgf@x=-\pgf@x
13675 }
13676 \anchor{north west}{
13677 \northwest
13678 }
13679 \anchor{south east}{
13680 \northwest
13681 \pgf@x=-\pgf@x
13682 \pgf@y=-\pgf@y
13683 }
13684 \anchorborder{% this is used when the node is used as a path element
13685 \pgf@xa=\pgf@x
13686 \pgf@ya=\pgf@y
13687 \pgfextracty{\pgf@circ@res@up}{\northwest}
13688 \pgfextractx{\pgf@circ@res@left}{\northwest}
13689 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13690 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
13691 }
13692 \anchor{text}{%
13693 % centered and a bit to the left (it's a triangle)!
13694 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
13695 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
13696 }
13697 \pgf@circ@draw@component{
13698 \pgf@circ@setcolor
13699
13700
13701 \northwest
13702 \pgf@circ@res@up = \pgf@y
13703 \pgf@circ@res@down = -\pgf@y
13704 \pgf@circ@res@right = -\pgf@x
13705 \pgf@circ@res@left = \pgf@x
13706
13707 \pgfscope
13708 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13709 \pgftransformxshift{.7\pgf@circ@res@left}
13710 \pgf@circ@res@step=\pgf@circ@res@right
13711 \advance\pgf@circ@res@step by -\pgf@circ@res@left
13712 \pgf@circ@res@step=.7\pgf@circ@res@step
13713
13714 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
13715 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
13716 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
13717 \pgfpathclose
13718 \pgf@circ@draworfill
13719 \endpgfscope
13720
13721 \ifpgfcirc@draw@input@leads
13722 %input leads
13723 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
13724 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
13725 \fi
13726
13727 \ifpgfcirc@draw@output@leads
13728 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13729 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right-\pgf@circ@res@other}{0pt}}
13730 \fi
13731 \pgfusepath{draw}
13732 %draw inner shape
13733
13734 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13735
13736 \pgfpathmoveto{\pgfpoint{.6\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13737 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13738 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13739 \pgfpathlineto{\pgfpoint{.05\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13740 \pgfpathmoveto{\pgfpoint{.4\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13741 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@down}}
13742 \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@left}{.3\pgf@circ@res@up}}
13743 \pgfusepath{draw}
13744
13745 }
13746 }
13747
13748
13749 %%% start european logic ports, from John Kormylo
13750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13751 %%
13752
13753 % #1 - name
13754 % #2 - text inside
13755 % #3 - number of inputs
13756 % #4 = is it a not?
13757 %
13758 % option to add a circle for not-output, see
13759 % https://github.com/circuitikz/circuitikz/issues/385
13760 %
13761 \newif\ifpgf@circ@european@port@circle\pgf@circ@european@port@circlefalse
13762 \newif\ifpgf@circ@european@port@circle@ieee\pgf@circ@european@port@circle@ieeefalse
13763 \ctikzset{tripoles/european not shape/.initial=ocirc}
13764 \ctikzset{tripoles/european not symbol/.is choice}
13765 \ctikzset{tripoles/european not symbol/triangle/.code={\pgf@circ@european@port@circlefalse}}
13766 \ctikzset{tripoles/european not symbol/circle/.code={%
13767 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeefalse\ctikzset{tripoles/european not shape=ocirc}}}
13768 \ctikzset{tripoles/european not symbol/ieee circle/.code={%
13769 \pgf@circ@european@port@circletrue\pgf@circ@european@port@circle@ieeetrue\ctikzset{tripoles/european not shape=notcirc}}}
13770
13771 \long\def\pgfcircdeclareeurologicport#1#2#3#4{
13772 \pgfdeclareshape{european #1 port}
13773 {
13774 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
13775 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
13776 \saveddimen{\boutshift}{%
13777 \edef\pgf@temp{not}
13778 \edef\pgf@circ@temp{#4}
13779 \ifx\pgf@temp\pgf@circ@temp % is a not
13780 \ifpgf@circ@european@port@circle
13781 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13782 \edef\pgf@temp{ocirc}
13783 \edef\pgf@circ@temp{\ctikzvalof{tripoles/european not shape}}
13784 \ifx\pgf@temp\pgf@circ@temp % it's ocirc
13785 \pgfmathsetlength{\pgf@x}{2*\ctikzvalof{nodes width}*\pgf@circ@Rlen}
13786 \else % it's ieee not circ
13787 \pgf@circ@notradius % defined together with ieeestd ports
13788 \pgf@x=2\pgf@circ@res@temp
13789 \fi
13790 \else
13791 \pgf@x=0pt
13792 \fi
13793 \else
13794 \pgf@x=0pt
13795 \fi
13796 }
13797 \savedmacro\resize{% automatic
13798 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13799 \pgf@circ@res@up = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
13800 \pgf@circ@res@up = .5\pgf@circ@res@up
13801 \pgf@circ@res@down = -\pgf@circ@res@up
13802 \pgf@circ@res@right = \ctikzvalof{tripoles/european #1 port/width}\pgf@circ@scaled@Rlen
13803 \pgf@circ@res@right = .5\pgf@circ@res@right
13804 \pgf@circ@res@left = -\pgf@circ@res@right
13805 }%
13806 \savedmacro\inputs{% get number of inputs
13807 \pgf@circ@res@count=\pgfkeysvalueof{/tikz/number inputs}\relax%
13808 \ifnum\pgf@circ@res@count=0
13809 \pgf@circ@res@count=\ctikzvalof{tripoles/european #1 port/inputs}\relax%
13810 \fi
13811 \ifnum\pgf@circ@res@count<2 \pgf@circ@res@count=2\fi
13812 \ifnum\pgf@circ@res@count>16 \pgf@circ@res@count=16\fi
13813 \def\inputs{\the\pgf@circ@res@count}%
13814 }%
13815 \savedanchor\step{% 1/2 gap at edges
13816 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
13817 \pgf@circ@res@step = \ctikzvalof{tripoles/european #1 port/height}\pgf@circ@scaled@Rlen
13818 \divide\pgf@circ@res@step by #3
13819 \pgfpoint{\pgf@circ@res@left}{\dimexpr\pgf@circ@res@up+0.5\pgf@circ@res@step}%
13820 }%
13821 \savedanchor\northeast{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}%
13822 \savedanchor\southwest{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}%
13823 \savedanchor\left{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
13824 \savedanchor\right{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}%
13825 \savedanchor\origin{\pgfpoint{\ctikzvalof{tripoles/european #1 port/origin}\pgf@circ@res@right}{0pt}}%
13826
13827 \anchor{center}{\origin}% for backwards compatibility
13828 % the text anchor overlaps the logic symbol
13829 \anchor{text}{\pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}}%
13830 % create input anchors
13831 \ifnum#3=1\relax
13832 \anchor{in}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
13833 \anchor{in 1}{\southwest\pgfpoint{\pgf@x}{0pt}}% or \step
13834 \anchor{bin}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
13835 \anchor{bin 1}{\left\pgfpoint{\pgf@x}{0pt}}% or \step
13836 \else
13837 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@european #1 port\endcsname{%
13838 \pgfmathloop%
13839 \ifnum\pgfmathcounter>#3
13840 \else%
13841 %\pgfutil@ifundefined{pgf@anchor@european #1 port@in \pgfmathcounter}{% redundant
13842 \expandafter\xdef\csname pgf@anchor@european #1 port@in \pgfmathcounter\endcsname{%
13843 \noexpand\pgf@circ@logicport@input{\pgfmathcounter}% defined above
13844 }%
13845 \expandafter\xdef\csname pgf@anchor@european #1 port@bin \pgfmathcounter\endcsname{%
13846 \noexpand\pgf@circ@logicport@baseinput{\pgfmathcounter}{4}{#1}% defined above
13847 }%
13848 %}{}%
13849 \repeatpgfmathloop%
13850 }
13851 \fi
13852 \anchor{out}{\northeast\pgf@y=0pt}
13853 \anchor{bout}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
13854
13855 \anchor{left}{\left}% edges of component minus leads
13856 \anchor{right}{\right\advance\pgf@x by \boutshift\pgf@y=0pt}
13857
13858 \anchor{north east}{\northeast}% see \Compass macro
13859 \anchor{south west}{\southwest}
13860 \anchor{north}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
13861 \pgfpoint{0cm}{\pgf@circ@res@up}}
13862 \anchor{north west}{\pgfextracty{\pgf@circ@res@up}{\northeast}%
13863 \pgfextractx{\pgf@circ@res@left}{\southwest}%
13864 \pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
13865 \anchor{west}{\pgfextractx{\pgf@circ@res@left}{\southwest}%
13866 \pgfpoint{\pgf@circ@res@left}{0cm}}
13867 \anchor{south}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
13868 \pgfpoint{0cm}{\pgf@circ@res@down}}
13869 \anchor{south east}{\pgfextracty{\pgf@circ@res@down}{\southwest}%
13870 \pgfextractx{\pgf@circ@res@right}{\northeast}%
13871 \pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
13872 \anchor{east}{\pgfextractx{\pgf@circ@res@right}{\northeast}%
13873 \pgfpoint{\pgf@circ@res@right}{0cm}}
13874
13875 \anchorborder{% this is used when the node is used as a path element
13876 \pgf@xa=\pgf@x
13877 \pgf@ya=\pgf@y
13878 \pgfextracty{\pgf@circ@res@up}{\northeast}
13879 \pgfextractx{\pgf@circ@res@right}{\northeast}
13880 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
13881 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
13882 }
13883 \pgf@circ@draw@component{
13884 \pgf@circ@setcolor
13885 \pgfstartlinewidth=\pgflinewidth
13886 \pgfscope
13887 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13888 \pgfpathrectanglecorners
13889 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{\pgf@circ@res@up}}
13890 {\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{\pgf@circ@res@down}}
13891 \pgf@circ@draworfill
13892 \endpgfscope
13893 \ifpgfcirc@draw@input@leads
13894 %input leads
13895 \ifnum#3=1\relax
13896 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}%
13897 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}{0pt}}%
13898 \else
13899 \pgfextracty{\pgf@circ@res@temp}{\step}%
13900 \pgf@circ@res@step = \dimexpr 2\pgf@circ@res@temp -2\pgf@circ@res@up\relax
13901 %\pgf@circ@res@count = #3\relax% redundant
13902 \loop\ifnum\pgf@circ@res@count>0
13903 \advance\pgf@circ@res@temp by -\pgf@circ@res@step
13904 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
13905 \pgfpathlineto{\pgfpoint
13906 {\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@left}
13907 {\pgf@circ@res@temp}}
13908 \advance\pgf@circ@res@count by -1
13909 \repeat
13910 \fi
13911 \pgfusepath{draw}
13912 \fi
13913 %
13914 \ifpgfcirc@draw@output@leads
13915 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
13916 \pgfpathlineto{ \pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}{0pt}}
13917 \pgfusepath{draw}
13918 \fi
13919 %
13920 \edef\pgf@temp{not}
13921 \edef\pgf@circ@temp{#4}
13922 \ifx\pgf@temp\pgf@circ@temp % is a not
13923 \ifpgf@circ@european@port@circle
13924 \pgfscope
13925 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
13926 \pgftransformxshift{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}
13927 % reset linewidth for IEEE ports, otherwise they will multiply...
13928 \ifpgf@circ@european@port@circle@ieee\pgfsetlinewidth{\pgfstartlinewidth}\fi
13929 \pgfnode{\ctikzvalof{tripoles/european not shape}}{west}{}{NOT}{\pgfusepath{stroke}}
13930 \endpgfscope
13931 \else
13932 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/not width}\pgf@circ@res@right}{0pt}}
13933 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/european #1 port/reserved}\pgf@circ@res@right}%
13934 {\ctikzvalof{tripoles/european #1 port/not height}\pgf@circ@res@up}}
13935 \pgfusepath{draw}
13936 \fi
13937 \fi
13938 \pgf@circ@text@strokecolor
13939 \pgfpathmoveto{\pgfpointorigin}
13940 \pgfscope
13941 % text is always in standard direction
13942 \pgftransformresetnontranslations
13943 \pgftext{\ctikzvalof{european ports font}#2}%
13944 \endpgfscope
13945 }
13946 }
13947 }
13948 \pgfcircdeclareeurologicport{and}{\&}{\pgf@circ@res@count}{}
13949 \pgfcircdeclareeurologicport{or}{$\ge 1$}{\pgf@circ@res@count}{}
13950 \pgfcircdeclareeurologicport{xor}{$=1$}{\pgf@circ@res@count}{}
13951 \pgfcircdeclareeurologicport{not}{$1$}{1}{not}
13952 \pgfcircdeclareeurologicport{buffer}{$1$}{1}{}
13953 \pgfcircdeclareeurologicport{nand}{\&}{\pgf@circ@res@count}{not}
13954 \pgfcircdeclareeurologicport{nor}{$\ge 1$}{\pgf@circ@res@count}{not}
13955 \pgfcircdeclareeurologicport{xnor}{$=1$}{\pgf@circ@res@count}{not}
13956 \pgfcircdeclareeurologicport{blank}{}{\pgf@circ@res@count}{}
13957 \pgfcircdeclareeurologicport{blank not}{}{\pgf@circ@res@count}{not}
13958 %% end european logic ports
13959 % %>>>
13960
13961 %% IEEE standard logic ports module%<<<
13962
13963 %%
13964 %% Original multi-input code from John Kormylo at tex.stackexchange.com
13965 %% Help by TheTeXnician <[email protected]>
13966 %% Suggested idea and example code by Jason Sachs <[email protected]>
13967 %% Please see https://github.com/circuitikz/circuitikz/issues/383 for a lot of details
13968 %% Most of the code, all errors and bugs by Romano Giannetti <[email protected]>
13969 %% Everything is in the same place here --- more or less; first step to move towards
13970 %% a module interface for circutikz
13971 %%
13972
13973 % base settings for ieeestd ports.
13974
13975 \ctikzset{ieeestd ports/.is family}
13976 % baselen is relative to pgfcirc@Rlen as ever; scaled if the class says so.
13977 % the value of 0.4 is the standard pin distance for a port with height=num pins
13978 % and matches the chip distance
13979 \ctikzset{ieeestd ports/baselen/.initial=0.4}
13980 % these are in term of baselen; width depends on height (fixed proportions)
13981 \ctikzset{ieeestd ports/height/.initial=2}
13982 \ctikzset{ieeestd ports/pin length/.initial=0.7}
13983 % the standard "not" circle should be 1/6.5 of height (diameter);
13984 % so radius/baselen=1/3.25/2 --- using 0.1 and no scaling is as a pole
13985 \ctikzset{ieeestd ports/not radius/.initial=0.154}
13986 \ctikzset{ieeestd ports/not radius fill/.initial=1}% change ony if you know why
13987 % the suggested xnor distance is is 1.24, so 1.25/3.25/2
13988 % xor/xnor leads go full in in IEEE; let this be optional
13989 \ctikzset{ieeestd ports/xor bar distance/.initial=0.192}%
13990 \ctikzset{ieeestd ports/xor leads in/.initial=1}%
13991 %
13992 % base size of a small external schmitt symbol
13993 %
13994 \ctikzset{ieeestd ports/schmitt symbol size/.initial=0.3}%
13995 %
13996 % input management
13997 % we are using the same /tikz/number inputs than the legacy ports
13998 %
13999 \tikzset{/tikz/inner inputs/.initial=0} % using 0 means that all inputs are inner
14000 %
14001 % integrate with the other logic ports
14002 %
14003 %
14004 \newif\ifpgf@circuit@ieeelogicport\pgf@circuit@ieeelogicportfalse
14005 \ctikzset{logic ports/ieee/.code= {%
14006 \pgf@circuit@ieeelogicporttrue
14007 \pgf@circuit@europeanlogicportfalse
14008 \tikzset{and port/.style={shape=ieeestd and port}}%
14009 \tikzset{or port/.style={shape=ieeestd or port}}%
14010 \tikzset{xor port/.style={shape=ieeestd xor port}}%
14011 \tikzset{buffer port/.style={shape=ieeestd buffer port}}%
14012 \tikzset{not port/.style={shape=ieeestd not port}}%
14013 \tikzset{nand port/.style={shape=ieeestd nand port}}%
14014 \tikzset{nor port/.style={shape=ieeestd nor port}}%
14015 \tikzset{xnor port/.style={shape=ieeestd xnor port}}%
14016 \tikzset{schmitt port/.style={shape=ieeestd schmitt port}}%
14017 \tikzset{invschmitt port/.style={shape=ieeestd invschmitt port}}%
14018 }}
14019 % add code to be compatible with the other ports
14020 \ctikzset{logic ports/european/.add code={\pgf@circuit@ieeelogicportfalse}}
14021 \ctikzset{logic ports/american/.add code={\pgf@circuit@ieeelogicportfalse}}
14022 \tikzset{ieee ports/.style = {\circuitikzbasekey/logic ports = ieee}}
14023 %
14024 % the base angle for the or port. See the drawings. This will not change with height
14025 %
14026 \pgfmathsetmacro{\pgf@circ@orangle}{atan(3.25/6.5)}
14027 % \typeout{ANGLE-IS\space\pgf@circ@orangle}
14028 \def\pgf@circ@ieeeport@input#1% #1 = \pgfmathcounter
14029 {%
14030 \ifnum#1>\inputs
14031 \PackageError{circuitikz}{%
14032 You requested input pin #1 for logic port shape \thisshape\space \MessageBreak
14033 which has been defined with \inputs\space pins%
14034 }{Please check the manual about logic ports; if you press return I'll try to continue}
14035 \fi
14036 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
14037 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14038 \pgf@circ@res@step=\pind
14039 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -#1\pgf@circ@res@step\relax
14040 \pgf@x=\pgf@circ@res@left\advance\pgf@x by -\pinlen
14041 }%
14042
14043 % #1 = \pgfmathcounter #2=type
14044 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
14045 \def\pgf@circ@ieeeport@baseinput#1#2%
14046 {%
14047 \ifnum#1>\inputs
14048 \PackageError{circuitikz}{%
14049 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
14050 which has been defined with \inputs\space pins%
14051 }{Please check the manual about logic ports; if you press return I'll try to continue}
14052 \fi
14053 % Find the vertical position (this is the same for any port)
14054 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
14055 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
14056 % rack (extended) pins; they are the same for all the ports
14057 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
14058 % above: 1..K (included)
14059 % below: inputs-K..inputs
14060 % Find the pins on the rack; they are 1...
14061 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
14062 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
14063 % border anchors for rack should be ok
14064 \pgfextractx{\pgf@circ@res@left}{\topleft}
14065 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
14066 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
14067 % we have finished if we are in the rack
14068 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
14069 % we are on the inner ports; we have to do the hard work here
14070 % and and nand
14071 \ifnum #2=1
14072 \relax % It's an and/nand, all border ports are on the rack line
14073 \fi
14074 % or and nor
14075 \ifnum #2=2
14076 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
14077 \fi
14078 % xor and xnor
14079 \ifnum #2=3\relax
14080 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-\xorbar-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
14081 \fi
14082 \fi\fi
14083 }%
14084 % inner base ports for xor types port
14085 % #1 = \pgfmathcounter #2=type
14086 % type is 1 for and,nand; 2 for or,nor; 3 for xor,xnor
14087 \def\pgf@circ@ieeeport@innerbaseinput#1%
14088 {%
14089 \ifnum#1>\inputs
14090 \PackageError{circuitikz}{%
14091 You requested border input pin #1 for logic port shape \thisshape\space \MessageBreak
14092 which has been defined with \inputs\space pins%
14093 }{Please check the manual about logic ports; if you press return I'll try to continue}
14094 \fi
14095 % Find the vertical position (this is the same for any port)
14096 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind+0.5*\pind}% pin "0", above the rack/port
14097 \pgf@circ@res@step=\pind\advance\pgf@circ@res@up by -#1\pgf@circ@res@step\relax
14098 % rack (extended) pins; they are the same for all the ports
14099 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
14100 % above: 1..K (included)
14101 % below: inputs-K..inputs
14102 % Find the pins on the rack; they are 1...
14103 \pgf@circ@count@a=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
14104 \pgf@circ@count@b=\numexpr \inputs - \pgf@circ@count@a +1 \relax % =inputs - K +1
14105 % border anchors for rack should be ok
14106 \pgfextractx{\pgf@circ@res@left}{\topleft}
14107 \pgfextractx{\pgf@circ@res@right}{\bodyleft}
14108 \pgf@y=\pgf@circ@res@up\pgf@x=\pgf@circ@res@left
14109 % we have finished if we are in the rack
14110 \ifnum #1 > \pgf@circ@count@a \ifnum #1 < \pgf@circ@count@b
14111 % we are on the inner ports; we have to do the hard work here
14112 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@right-2*\stdH*(1-cos(atan(\pgf@circ@res@up/(2*\stdH))))}
14113 \fi\fi
14114 }%
14115
14116 %%% macro to find basic lenghts --- they leave it in \pgf@circ@res@temp
14117 \def\pgf@circ@ieeestd@baselen{%
14118 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14119 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*\pgf@circ@scaled@Rlen}
14120 }
14121 \def\pgf@circ@ieeestd@stdH{%
14122 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14123 \pgfmathsetlength{\pgf@circ@res@temp}{0.5*\ctikzvalof{ieeestd ports/baselen}*
14124 \ctikzvalof{ieeestd ports/height}*\pgf@circ@scaled@Rlen}
14125 }
14126 \def\pgf@circ@ieeestd@pinlen{%
14127 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14128 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
14129 \ctikzvalof{ieeestd ports/pin length}*\pgf@circ@scaled@Rlen}
14130 }
14131 \def\pgf@circ@ieeestd@xorbar{%
14132 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
14133 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/baselen}*
14134 \ctikzvalof{ieeestd ports/xor bar distance}*\pgf@circ@scaled@Rlen}
14135 }
14136 %% Not circle
14137 \def\pgf@circ@notradius{
14138 \pgf@circ@ieeestd@stdH % got the standard length. Notice that his is 3.25H for IEEE
14139 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{ieeestd ports/not radius}*\pgf@circ@res@temp}
14140 % \typeout{NOTRADIUS\space\the\pgf@circ@res@temp}
14141 }
14142 %% Find (in ...@other) the height of the rack
14143 \def\pgf@circ@findrackH{%
14144 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
14145 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
14146 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
14147 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
14148 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
14149 \pgf@circ@ieeestd@stdH
14150 \multiply\pgf@circ@res@temp by 2\relax% full height
14151 \divide\pgf@circ@res@temp by \pgf@circ@count@b % the pin spacing
14152 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@circ@count@a/2)*\pgf@circ@res@temp} %top of the rack/port
14153 % \typeout{RACK-\thisshape\space\the\pgf@circ@res@other}
14154 }
14155 %%
14156 \def\pgf@circ@find@ieeeport@up{% leave it in up
14157 % Normal port limits
14158 \pgf@circ@ieeestd@stdH
14159 \pgfmathsetlength{\pgf@circ@res@up}{\pgf@circ@res@temp}
14160 % rack top size
14161 \pgf@circ@findrackH
14162 \ifdim\pgf@circ@res@other > \pgf@circ@res@up
14163 \pgf@circ@res@up=\pgf@circ@res@other
14164 \else
14165 \fi
14166 }
14167 \def\pgf@circ@find@ieeeport@left#1{% leave it in left; #1 is type
14168 % Normal port limits
14169 \pgf@circ@ieeestd@stdH
14170 \pgfmathsetlength{\pgf@circ@res@left}{8*\pgf@circ@res@temp/6.5}
14171 \pgf@circ@res@right=\pgf@circ@res@left % save the border value
14172 \pgf@circ@res@step=\pgf@circ@res@temp % save the stdH value
14173 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@left by \pgf@circ@res@temp
14174 % \typeout{LEFT1-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
14175 % this is the normal left border
14176 % For the or or xor port, the limit can be the pointy thing (in case the
14177 % pinlen is zero or too small)
14178 % add to the body margin the or/nor peak:
14179 \ifnum #1 > 1\relax% "or", "nor", "xor", "xnor" gates.
14180 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@step*(1-cos(\pgf@circ@orangle))}
14181 \advance\pgf@circ@res@right by \pgf@circ@res@other
14182 % \typeout{LEFT2-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
14183 \fi
14184 % add to the body margin the xor/xnor distance
14185 \ifnum #1 = 3\relax% "xor" or "xnor" gates.
14186 \pgf@circ@ieeestd@xorbar
14187 \advance\pgf@circ@res@right by \pgf@circ@res@temp
14188 % \typeout{LEFT3-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
14189 \fi
14190 % and if this exceeds the normal margin, this is it
14191 % \typeout{LEFT4-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
14192 \ifdim \pgf@circ@res@right > \pgf@circ@res@left
14193 \pgf@circ@res@left=\pgf@circ@res@right
14194 \fi
14195 % \typeout{LEFT5-\thisshape\space L\space\the\pgf@circ@res@left\space R\space\the\pgf@circ@res@right}
14196 \pgf@circ@res@left=-\pgf@circ@res@left
14197 }
14198 \def\pgf@circ@find@ieeeport@right#1{% leave it in right; #1 is plain or negated
14199 % Normal port limits
14200 \pgf@circ@ieeestd@stdH
14201 \pgfmathsetlength{\pgf@circ@res@right}{8*\pgf@circ@res@temp/6.5}
14202 \pgf@circ@notradius
14203 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
14204 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
14205 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
14206 \pgf@circ@res@right=\pgf@circ@res@other
14207 \fi
14208 }
14209 \def\pgf@circ@find@ieeeport@not@right#1{% leave it in right; #1 is plain or negated
14210 % Normal port limits
14211 \pgf@circ@ieeestd@stdH
14212 % notice 0.8660254 is cos(30)
14213 \pgfmathsetlength{\pgf@circ@res@right}{0.8660254*\pgf@circ@res@temp}
14214 \pgf@circ@notradius
14215 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@right+2*#1*\pgf@circ@res@temp}
14216 \pgf@circ@ieeestd@pinlen\advance\pgf@circ@res@right by \pgf@circ@res@temp
14217 \ifdim\pgf@circ@res@other > \pgf@circ@res@right
14218 \pgf@circ@res@right=\pgf@circ@res@other
14219 \fi
14220 }
14221
14222
14223 %%% ieeestd multi-input ports
14224 %%% #1: name
14225 %%% #2: type: 1 for and,nand; 2 for or,nor; 3 for xor,xnor
14226 %%% #3: polarity: 0 for direct, 1 for inverted (not at the output)
14227 %%% #4: drawing for the port
14228 \long\def\pgfcircdeclareieeeport#1#2#3#4{%
14229 \pgfdeclareshape{ieeestd #1 port}%
14230 {%
14231 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14232 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14233 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
14234 \saveddimen{\baselen}{%
14235 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
14236 }
14237 \saveddimen{\stdH}{% This is HALF the height of the inner port
14238 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
14239 }
14240 \saveddimen{\notdiameter}{
14241 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
14242 }
14243 \saveddimen{\pind}{% pin distance;
14244 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax%
14245 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax%
14246 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
14247 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi %
14248 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi%
14249 \pgf@circ@ieeestd@stdH\pgf@x=2\pgf@circ@res@temp % full height
14250 \divide\pgf@x by \pgf@circ@count@b
14251 }
14252 \saveddimen{\pinlen}{%
14253 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
14254 }
14255 \saveddimen{\xorbar}{%
14256 \pgf@circ@ieeestd@xorbar\pgf@x=\pgf@circ@res@temp
14257 }
14258 % anchors for the body (no pins included here)
14259 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
14260 \pgf@circ@ieeestd@stdH
14261 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5}
14262 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14263 }
14264 \savedanchor{\topleft}{%
14265 \pgf@circ@ieeestd@xorbar\pgf@circ@res@right=\pgf@circ@res@temp % save \xorbar
14266 \pgf@circ@ieeestd@stdH
14267 \pgf@circ@res@other=0pt\relax
14268 \ifnum #2 = 2\relax% "or" or "nor" gates.
14269 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))}
14270 \fi
14271 \ifnum #2 = 3\relax% "xor" or "xnor" gates.
14272 \pgfmathsetlength{\pgf@circ@res@other}{2*\pgf@circ@res@temp*(1-cos(\pgf@circ@orangle))
14273 +\pgf@circ@res@right}
14274 \fi
14275 \pgfmathsetlength{\pgf@x}{-8*\pgf@circ@res@temp/6.5-\pgf@circ@res@other}
14276 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14277 }
14278 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
14279 \pgf@circ@ieeestd@stdH
14280 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5}
14281 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
14282 }
14283 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
14284 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
14285 \pgf@circ@ieeestd@stdH
14286 % #3 is =1 if the port is a negated output one
14287 \pgfmathsetlength{\pgf@x}{8*\pgf@circ@res@temp/6.5+#3*2*\pgf@circ@res@other}
14288 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
14289 }
14290 % geographical anchors --- must be rectangulars!
14291 \savedanchor{\northwest}{%
14292 \pgf@circ@find@ieeeport@up
14293 \pgf@circ@find@ieeeport@left{#2}
14294 % \typeout{ANCH5-\thisshape\space L\space\the\pgf@circ@res@left\space U\space\the\pgf@circ@res@up}
14295 \pgf@x=\pgf@circ@res@left
14296 \pgf@y=\pgf@circ@res@up
14297 }
14298 \savedanchor{\southwest}{%
14299 \pgf@circ@find@ieeeport@up
14300 \pgf@circ@find@ieeeport@left{#2}
14301 \pgf@x=\pgf@circ@res@left
14302 \pgf@y=-\pgf@circ@res@up
14303 }
14304 \savedanchor{\southeast}{%
14305 \pgf@circ@find@ieeeport@up
14306 \pgf@circ@find@ieeeport@right{#3}
14307 \pgf@x=\pgf@circ@res@right
14308 \pgf@y=-\pgf@circ@res@up
14309 }
14310 \savedanchor{\northeast}{%
14311 \pgf@circ@find@ieeeport@up
14312 \pgf@circ@find@ieeeport@right{#3}
14313 \pgf@x=\pgf@circ@res@right
14314 \pgf@y=\pgf@circ@res@up
14315 }
14316 \savedmacro\inputs{% get number of inputs
14317 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
14318 \ifnum\pgf@circ@count@a=0\pgf@circ@count@a=2\fi % default
14319 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
14320 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
14321 \def\inputs{\the\pgf@circ@count@a}%
14322 }%
14323 \savedmacro\inners{% get number of "inner" inputs (for racks)
14324 \pgf@circ@count@a=\pgfkeysvalueof{/tikz/number inputs}\relax
14325 \pgf@circ@count@b=\pgfkeysvalueof{/tikz/inner inputs}\relax
14326 \ifnum\pgf@circ@count@a=0 \pgf@circ@count@a=2\fi % default pins
14327 \ifnum\pgf@circ@count@a<2 \pgf@circ@count@a=2\fi % minimum pins
14328 \ifnum\pgf@circ@count@b=0 \pgf@circ@count@b=\pgf@circ@count@a\fi
14329 % \typeout{INNER is \the\pgf@circ@count@b}%
14330 % \ifnum\pgf@circ@count@a>16 \pgf@circ@count@a=16\fi
14331 \def\inners{\the\pgf@circ@count@b}%
14332 }%
14333 \anchor{center}{\pgfpointorigin}
14334 \anchor{text}{
14335 \ifpgf@circ@center@text
14336 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14337 \else
14338 \pgf@circ@ieeestd@stdH
14339 \pgfmathsetlength{\pgf@circ@res@left}{-8*\pgf@circ@res@temp/6.5} % left border
14340 \pgfpoint{\pgf@circ@res@left + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14341 \fi
14342 }
14343 % create input anchors
14344 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@ieeestd #1 port\endcsname{%
14345 \pgf@circ@count@a=\inputs
14346 \pgfmathloop%
14347 \ifnum\pgfmathcounter>\pgf@circ@count@a%
14348 \else%
14349 %\pgfutil@ifundefined{pgf@anchor@american #1 port@in \pgfmathcounter}{%
14350 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@in \pgfmathcounter\endcsname{%
14351 \noexpand\pgf@circ@ieeeport@input{\pgfmathcounter}% defined above
14352 }%
14353 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@bin \pgfmathcounter\endcsname{%
14354 \noexpand\pgf@circ@ieeeport@baseinput{\pgfmathcounter}{#2}% defined above
14355 }%
14356 \ifnum #2 = 3\relax % xor/xnor inner border pins
14357 \expandafter\xdef\csname pgf@anchor@ieeestd #1 port@ibin \pgfmathcounter\endcsname{%
14358 \noexpand\pgf@circ@ieeeport@innerbaseinput{\pgfmathcounter}% defined above
14359 }%
14360 \fi
14361 %}{}%
14362 \repeatpgfmathloop%
14363 }
14364 % output anchor
14365 \anchor{out}{%
14366 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
14367 \advance\pgf@circ@res@other by\pinlen
14368 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
14369 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
14370 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
14371 \fi
14372 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
14373 }
14374 \anchor{bout}{\bottomright\pgf@y=0pt}
14375
14376 \anchor{body right}{\bodyright\pgf@y=0pt}
14377 \anchor{right}{\bottomright\pgf@y=0pt}
14378 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
14379 \anchor{left}{% central edge of the component
14380 \bodyleft\pgf@y=0pt
14381 \ifnum #2=3\relax
14382 \advance\pgf@x by -\xorbar
14383 \fi
14384 }
14385 \anchor{up}{%
14386 \bodyleft
14387 \ifnum #2 > 1 % pointy shapes
14388 \pgf@circ@ieeestd@stdH
14389 % horizontal coordinate where the right semicircle starts
14390 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
14391 % vertical drop of the circle at the above coordinate
14392 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
14393 \advance \pgf@y by -\pgf@circ@res@step
14394 \fi
14395 \pgf@x=0pt
14396 }
14397 \anchor{down}{%
14398 \bodyleft
14399 \ifnum #2 > 1 % pointy shapes
14400 \pgf@circ@ieeestd@stdH
14401 % horizontal coordinate where the right semicircle starts
14402 \pgfmathsetlength{\pgf@circ@res@other}{-8*\pgf@circ@res@temp/6.5+2*\pgf@circ@res@temp*cos(\pgf@circ@orangle)}
14403 % vertical drop of the circle at the above coordinate
14404 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@temp*(1-cos(atan(\pgf@circ@res@other/(2*\pgf@circ@res@temp))))}
14405 \advance \pgf@y by -\pgf@circ@res@step
14406 \fi
14407 \pgf@y=-\pgf@y\pgf@x=0pt
14408 }
14409
14410 % geographical anchors
14411 \anchor{nw}{\northwest}
14412 \anchor{ne}{\northeast}
14413 \anchor{se}{\southeast}
14414 \anchor{sw}{\southwest}
14415 \anchor{north west}{\northwest}
14416 \anchor{north east}{\northeast}
14417 \anchor{south east}{\southeast}
14418 \anchor{south west}{\southwest}
14419 % over 0,0 even if asymmetric
14420 % will break if the geocoords are not rectangular
14421 \anchor{n}{\northwest\pgf@x=0pt\relax}
14422 \anchor{e}{\northeast\pgf@y=0pt\relax}
14423 \anchor{s}{\southwest\pgf@x=0pt\relax}
14424 \anchor{w}{\northwest\pgf@y=0pt\relax}
14425 \anchor{north}{\northwest\pgf@x=0pt\relax}
14426 \anchor{east}{\northeast\pgf@y=0pt\relax}
14427 \anchor{south}{\southwest\pgf@x=0pt\relax}
14428 \anchor{west}{\northwest\pgf@y=0pt\relax}
14429
14430 \pgf@circ@draw@component{
14431 \pgfscope
14432 \pgf@circ@setcolor
14433 #4%
14434 \endpgfscope
14435 % output lead:
14436 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
14437 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
14438 \advance\pgf@circ@res@other by \pinlen\relax
14439 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
14440 \ifpgfcirc@draw@output@leads
14441 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14442 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
14443 \pgfusepath{draw}
14444 \fi
14445 \fi
14446 \ifnum #3=1\relax\pgfscope
14447 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
14448 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
14449 \endpgfscope\fi
14450 }
14451 }
14452 }
14453
14454 %%% #1 direct name #2 negated name #3 type #4 drawing (without output)
14455 \long\def\pgfcircdeclareieeeportpair#1#2#3#4{%
14456 \pgfcircdeclareieeeport{#1}{#3}{0}{#4}% direct
14457 \pgfcircdeclareieeeport{#2}{#3}{1}{#4}% negated
14458 }
14459 %
14460 % ieeestd "and" and "nand"
14461 %
14462 \pgfcircdeclareieeeportpair{and}{nand}{1}{%
14463 \pgf@circ@count@a = \inputs\relax
14464 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
14465 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
14466 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14467 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
14468 \ifpgfcirc@draw@input@leads
14469 %input leads --- all the same for AND ports
14470 \loop\ifnum\pgf@circ@count@a>0
14471 \advance\pgf@circ@res@temp by -\pind
14472 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}%
14473 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
14474 \advance\pgf@circ@count@a by -1
14475 \repeat
14476 \fi
14477 \pgfusepath{draw}
14478 %% Body. let's start from the top left
14479 \pgfscope
14480 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14481 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
14482 \pgfpathlineto{\pgfpoint{1.5*\stdH/6.5}{\stdH}}
14483 \pgfpatharc{90}{-90}{\stdH}
14484 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5}{-\stdH}}
14485 \pgfpathclose
14486 \pgf@circ@draworfill
14487 % rack now; skip if not needed.
14488 % \typeout{WHAT\space \inputs\space \inners}
14489 \ifnum\inputs>\inners
14490 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14491 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
14492 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
14493 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14494 \pgfusepath{draw}
14495 \fi
14496 \endpgfscope
14497 }
14498 %
14499 % or/nor and xor/xnor are practically the same. Let factor out everything
14500 % the argument #1 is put just before the drawing of the inner pins
14501 % the argument #2 is put after the drawing of the body
14502 %
14503 \long\def\pgf@circ@ieeeport@orxor#1#2{%
14504 \pgf@circ@count@a = \inputs\relax
14505 \pgfmathsetlength{\pgf@circ@res@up}{(\inputs/2)*\pind} %top of the rack/port
14506 \pgfmathsetlength{\pgf@circ@res@temp}{\pgf@circ@res@up+0.5*\pind}
14507 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14508 \pgfextracty{\pgf@circ@res@down}{\bodyleft}
14509 % rack (extended) pins; they are the same for all the ports
14510 % call K = (inputs-inner)/2, rounded up; pins on the rack are:
14511 % above: 1..K (included)
14512 % below: inputs-K..inputs
14513 % Find the pins on the rack; they are 1...
14514 \pgf@circ@count@b=\numexpr (\inputs - \inners)/2\relax % =K; numexpr rounds up!
14515 \pgf@circ@count@c=\numexpr \inputs - \pgf@circ@count@b +1 \relax % =inputs - K +1
14516 \ifpgfcirc@draw@input@leads
14517 %input leads --- for or ports
14518 \loop\ifnum\pgf@circ@count@a>0
14519 \pgfextractx{\pgf@circ@res@right}{\topleft}
14520 \advance\pgf@circ@res@temp by -\pind
14521 % this is the height; let's find the "right" position
14522 \ifnum \pgf@circ@count@a > \pgf@circ@count@b \ifnum \pgf@circ@count@a < \pgf@circ@count@c
14523 % inner pins
14524 % \typeout{INNER\space\pgf@circ@count@a}
14525 \pgfmathsetlength{\pgf@circ@res@right}{\pgf@circ@res@left-2*\stdH*(1-cos(atan(\pgf@circ@res@temp/(2*\stdH))))}
14526 % hook for xor/xnor
14527 #1%
14528 \fi\fi
14529 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@temp}}%
14530 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{\pgf@circ@res@temp}}%
14531 \pgfusepath{draw}
14532 \advance\pgf@circ@count@a by -1
14533 \repeat
14534 \fi
14535 %% Body. let's start from the top left
14536 \pgfscope
14537 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14538 % it should start here, but with this trick the close comes out better.
14539 % \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
14540 \pgfpathmoveto{\pgfpoint{-8*\stdH/6.5}{\stdH}}
14541 \pgfpathlineto{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{\stdH}} %
14542 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5}{0pt}}
14543 \pgfpatharcto{2*\stdH}{2*\stdH}{0}{0}{0}{\pgfpoint{8*\stdH/6.5-2*\stdH*cos(\pgf@circ@orangle)}{-\stdH}}
14544 \pgfpathlineto{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
14545 %% this should be 2 and 2; but the round part is not a perfect circle that way
14546 %% so the 2.15 is ajusted "by taste" to touch the anchors exactly.
14547 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
14548 \pgfpathclose
14549 \pgf@circ@draworfill
14550 % hook for xor/xnor
14551 #2%
14552 % rack now; skip if not needed.
14553 % \typeout{WHAT\space \inputs\space \inners}
14554 \ifnum\inputs>\inners
14555 \pgfextractx{\pgf@circ@res@left}{\topleft}
14556 \pgfextracty{\pgf@circ@res@down}{\topleft}
14557 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14558 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
14559 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@down}}
14560 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14561 \pgfusepath{draw}
14562 \fi
14563 \endpgfscope
14564 }
14565 %
14566 % ieeestd "or" and "nor"
14567 %
14568 \pgfcircdeclareieeeportpair{or}{nor}{2}{%
14569 \pgf@circ@ieeeport@orxor{}{}
14570 }
14571 \pgfcircdeclareieeeportpair{xor}{xnor}{3}{%
14572 \pgf@circ@ieeeport@orxor{
14573 \edef\@@tmp{\ctikzvalof{ieeestd ports/xor leads in}}
14574 \ifnum\@@tmp=0\relax
14575 % move pin start to the left to leave the xor gap free (not standard)
14576 \advance\pgf@circ@res@right by -\xorbar
14577 \fi
14578 }{%
14579 % add the xor/xnor bar
14580 \pgfpathmoveto{\pgfpoint{-\xorbar-8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{-\stdH}}
14581 % see the comment on the main body about the 2.2
14582 \pgfpatharcto{2*\stdH}{2.2*\stdH}{0}{0}{1}{\pgfpoint{-\xorbar -8*\stdH/6.5-2*\stdH*(1-cos(\pgf@circ@orangle))}{\stdH}}
14583 \pgfusepath{draw}
14584 }
14585 }
14586 %
14587 % Buffer and inverters
14588 %
14589 % #1: name
14590 % #2: polarity
14591 % #3: content
14592 \long\def\pgfcircdeclareieeebufferport#1#2#3{%
14593 \pgfdeclareshape{ieeestd #1 port}%
14594 {%
14595 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14596 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14597 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
14598 \saveddimen{\baselen}{%
14599 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
14600 }
14601 \saveddimen{\stdH}{% This is HALF the height of the inner port
14602 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
14603 }
14604 \saveddimen{\notdiameter}{
14605 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
14606 }
14607 \saveddimen{\pinlen}{%
14608 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
14609 }
14610 % anchors for the body (no pins included here)
14611 % Notice that 0.8660254 is cos(30)
14612 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
14613 \pgf@circ@ieeestd@stdH
14614 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
14615 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14616 }
14617 \savedanchor{\topleft}{%
14618 \pgf@circ@ieeestd@stdH
14619 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
14620 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14621 }
14622 \savedanchor{\bodyright}{% This DOES NOT take into account the "NOT" circle
14623 \pgf@circ@ieeestd@stdH
14624 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp}
14625 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14626 }
14627 \savedanchor{\bottomright}{% This DOES take into account the "NOT" circle
14628 \pgf@circ@notradius\pgf@circ@res@other=\pgf@circ@res@temp
14629 \pgf@circ@ieeestd@stdH
14630 % #2 is =1 if the port is a negated output one
14631 \pgfmathsetlength{\pgf@x}{0.8660254*\pgf@circ@res@temp+#2*2*\pgf@circ@res@other}
14632 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
14633 }
14634 % geographical anchors --- must be rectangulars!
14635 \savedanchor{\northwest}{%
14636 \pgf@circ@ieeestd@stdH
14637 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
14638 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp}
14639 }
14640 \savedanchor{\southwest}{%
14641 \pgf@circ@ieeestd@stdH
14642 \pgfmathsetlength{\pgf@x}{-0.8660254*\pgf@circ@res@temp}
14643 \pgfmathsetlength{\pgf@y}{-\pgf@circ@res@temp}
14644 }
14645 \savedanchor{\southeast}{%
14646 \pgf@circ@ieeestd@stdH
14647 \pgf@circ@res@up=\pgf@circ@res@temp
14648 \pgf@circ@find@ieeeport@not@right{#2}
14649 \pgf@x=\pgf@circ@res@right
14650 \pgf@y=-\pgf@circ@res@up
14651 }
14652 \savedanchor{\northeast}{%
14653 \pgf@circ@ieeestd@stdH
14654 \pgf@circ@res@up=\pgf@circ@res@temp
14655 \pgf@circ@find@ieeeport@not@right{#2}
14656 \pgf@x=\pgf@circ@res@right
14657 \pgf@y=\pgf@circ@res@up
14658 }
14659 \anchor{center}{\pgfpointorigin}
14660 \anchor{text}{
14661 \ifpgf@circ@center@text
14662 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14663 \else
14664 \pgf@circ@ieeestd@stdH
14665 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
14666 \fi
14667 }
14668 % input anchors
14669 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
14670 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
14671 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
14672 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
14673 % output anchors
14674 \anchor{out}{%
14675 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
14676 \advance\pgf@circ@res@other by\pinlen
14677 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
14678 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
14679 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
14680 \fi
14681 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
14682 }
14683 \anchor{bout}{\bottomright\pgf@y=0pt}
14684
14685 \anchor{body right}{\bodyright\pgf@y=0pt}
14686 \anchor{right}{\bottomright\pgf@y=0pt}
14687 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
14688 \anchor{left}{\bodyleft\pgf@y=0pt}
14689 \anchor{up}{%
14690 \bodyleft
14691 \pgf@y=+0.5\pgf@y\pgf@x=0pt
14692 }
14693 \anchor{down}{%
14694 \bodyleft
14695 \pgf@y=-0.5\pgf@y\pgf@x=0pt
14696 }
14697 % this is for when it's used as a bipole
14698 % we use the enclosing rectangle (see below)
14699 \anchorborder{%
14700 %% This (commented out) is the correct border anchor. But if we use the correct
14701 %% border anchor there is no horizontal space for the label ;-) because
14702 %% the triangle is too steep. So we will use a simple square border
14703 %%
14704 %% find the border anchor of a triangle (like a not port or an
14705 %% amplifier) ---
14706 %%
14707 %% -----^ up
14708 %% I --- |
14709 %% I -|--
14710 %%left I | --- right
14711 %% ----I-----|-------I-----
14712 %%
14713 %%
14714 %\pgf@xa=\pgf@x
14715 %% it's simmetrical w/ vertical side, use only positive y
14716 %\pgfmathsetmacro{\@@switchy}{ifthenelse(\pgf@y>0,1,-1)}
14717 %\pgfmathsetlength{\pgf@ya}{abs(\pgf@y)}
14718 %\pgfextracty{\pgf@circ@res@up}{\bodyleft}
14719 %\pgfextractx{\pgf@circ@res@left}{\bodyleft}
14720 %\pgfextractx{\pgf@circ@res@right}{\bodyright}
14721 %% limit angle for the left (vertical) side
14722 %\pgfmathsetmacro{\@@phimax}{atan2(\pgf@circ@res@up,\pgf@circ@res@left)}
14723 %\pgfmathsetmacro{\@@phi}{atan2(\pgf@ya,\pgf@xa)}
14724 %\pgfmathsetmacro{\@@leftside}{ifthenelse(\@@phi>\@@phimax,1,0)}
14725 %% find the border
14726 %\ifnum\@@leftside>0
14727 % % vertical side
14728 % \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
14729 % {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
14730 %\else
14731 % % triangle upper line
14732 % \pgfpointintersectionoflines
14733 % {\pgfpointorigin}{\pgfqpoint{\pgf@xa}{\pgf@ya}}
14734 % {\pgfqpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfqpoint{\pgf@circ@res@right}{0pt}}
14735 %\fi
14736 %% readjust y sign
14737 %\pgf@y=\@@switchy\pgf@y
14738 %
14739 % this is the square border to position the path label with a bit of horizontal space
14740 %
14741 \pgf@xa=\pgf@x
14742 \pgf@ya=\pgf@y
14743 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
14744 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14745 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
14746 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
14747 }
14748 % geographical anchors
14749 \anchor{nw}{\northwest}
14750 \anchor{ne}{\northeast}
14751 \anchor{se}{\southeast}
14752 \anchor{sw}{\southwest}
14753 \anchor{north west}{\northwest}
14754 \anchor{north east}{\northeast}
14755 \anchor{south east}{\southeast}
14756 \anchor{south west}{\southwest}
14757 % over 0,0 even if asymmetric
14758 % will break if the geocoords are not rectangular
14759 \anchor{n}{\northwest\pgf@x=0pt\relax}
14760 \anchor{e}{\northeast\pgf@y=0pt\relax}
14761 \anchor{s}{\southwest\pgf@x=0pt\relax}
14762 \anchor{w}{\northwest\pgf@y=0pt\relax}
14763 \anchor{north}{\northwest\pgf@x=0pt\relax}
14764 \anchor{east}{\northeast\pgf@y=0pt\relax}
14765 \anchor{south}{\southwest\pgf@x=0pt\relax}
14766 \anchor{west}{\northwest\pgf@y=0pt\relax}
14767
14768 \pgf@circ@draw@component{
14769 \pgfscope
14770 \pgf@circ@setcolor
14771 #3%
14772 \endpgfscope
14773 % output lead:
14774 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
14775 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
14776 \advance\pgf@circ@res@other by \pinlen\relax
14777 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
14778 \ifpgfcirc@draw@output@leads
14779 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14780 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
14781 \pgfusepath{draw}
14782 \fi
14783 \fi
14784 \ifnum #2=1\relax\pgfscope
14785 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
14786 \pgfnode{notcirc}{east}{}{\thisshape-not}{\pgfusepath{stroke}}
14787 \endpgfscope\fi
14788 }
14789 }
14790 }
14791
14792 %%% #1 direct name #2 negated name #3 drawing (without output)
14793 \long\def\pgfcircdeclareieeebufferportpair#1#2#3{%
14794 \pgfcircdeclareieeebufferport{#1}{0}{#3}% direct
14795 \pgfcircdeclareieeebufferport{#2}{1}{#3}% negated
14796 }
14797
14798 \pgfcircdeclareieeebufferportpair{buffer}{not}{%
14799 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14800 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
14801 \pgfextractx{\pgf@circ@res@right}{\bodyright}
14802 % \draw input pin
14803 \ifpgfcirc@draw@input@leads
14804 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14805 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
14806 \pgfusepath{draw}
14807 \fi
14808 \pgfscope
14809 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14810 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14811 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14812 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14813 \pgfpathclose
14814 \pgf@circ@draworfill
14815 \endpgfscope
14816 }
14817
14818 \pgfcircdeclareieeebufferportpair{schmitt}{invschmitt}{%
14819 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
14820 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
14821 \pgfextractx{\pgf@circ@res@right}{\bodyright}
14822 % \draw input pin
14823 \ifpgfcirc@draw@input@leads
14824 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
14825 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
14826 \pgfusepath{draw}
14827 \fi
14828 \pgfscope
14829 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14830 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
14831 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
14832 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14833 \pgfpathclose
14834 \pgf@circ@draworfill
14835 \endpgfscope
14836 % draw schmitt symbol in normal line thickness
14837 \pgfpathmoveto{\pgfpoint{0.75*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
14838 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
14839 \pgfpathlineto{\pgfpoint{0.50*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
14840 \pgfpathlineto{\pgfpoint{0.00*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
14841 \pgfpathmoveto{\pgfpoint{0.25*\pgf@circ@res@left}{0.25*\pgf@circ@res@up}}
14842 \pgfpathlineto{\pgfpoint{0.25*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
14843 \pgfpathlineto{\pgfpoint{0.5*\pgf@circ@res@left}{-0.25*\pgf@circ@res@up}}
14844 \pgfusepath{draw}
14845 }
14846
14847
14848 \pgfdeclareshape{schmitt symbol}{
14849 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14850 \anchor{center}{\pgfpointorigin}
14851 \savedanchor\northwest{%
14852 \pgf@circ@ieeestd@stdH
14853 \pgf@y=\ctikzvalof{ieeestd ports/schmitt symbol size}\pgf@circ@res@temp
14854 \pgf@x=-1.5\pgf@y
14855 }
14856 \anchor{center}{\pgf@y=0pt \pgf@x=0pt}
14857 \anchor{east}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
14858 \anchor{e}{\northwest\pgf@y=0pt \pgf@x=-\pgf@x}
14859 \anchor{west}{\northwest\pgf@y=0pt}
14860 \anchor{w}{\northwest \pgf@y=0pt}
14861 \anchor{south}{\northwest \pgf@x=0pt\pgf@y=-\pgf@y}
14862 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
14863 \anchor{north}{\northwest\pgf@x=0pt}
14864 \anchor{n}{\northwest\pgf@x=0pt}
14865 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
14866 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
14867 \anchor{north west}{\northwest}
14868 \anchor{south east}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
14869 \pgf@circ@draw@component{
14870 \pgfscope
14871 \pgf@circ@setcolor
14872 \pgfextractx{\pgf@circ@res@left}{\northwest}
14873 \pgfextracty{\pgf@circ@res@up}{\northwest}
14874 \pgf@circ@res@left=0.7\pgf@circ@res@left
14875 \pgf@circ@res@up=0.7\pgf@circ@res@up
14876 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14877 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
14878 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left/3}{\pgf@circ@res@up}}
14879 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
14880 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@left/3}{\pgf@circ@res@up}}
14881 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@left/3}{-\pgf@circ@res@up}}
14882 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
14883 \pgfusepath{draw}
14884 \endpgfscope
14885 }
14886 }
14887
14888 \pgfdeclareshape{notcirc}{
14889 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14890 \savedanchor\northwest{%
14891 \pgf@circ@notradius
14892 \pgf@y=\pgf@circ@res@temp
14893 \pgf@x=-\pgf@y
14894 }
14895 \pgfcirc@northwest@symmetric@geoanchors
14896 \anchor{center}{\pgfpointorigin}
14897 \anchorborder{
14898 \pgf@circ@res@left=\pgf@x
14899 \pgf@circ@res@up=\pgf@y
14900 \northwest\pgf@circ@res@temp=\pgf@y
14901 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
14902 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
14903 }
14904 \pgf@circ@draw@component{
14905 \pgfscope
14906 \northwest\pgf@circ@res@temp=\pgf@y
14907 \pgf@circ@setcolor
14908 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
14909 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
14910 \ifx\tikz@fillcolor\pgfutil@empty
14911 % set the default fill color to white
14912 \pgfsetfillcolor{white}
14913 % ...but override it if the class is defined!
14914 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
14915 \else
14916 \pgfsetfillcolor{\tikz@fillcolor}
14917 \fi
14918 \pgfsetfillopacity{\ctikzvalof{ieeestd ports/not radius fill}}% normally 1.0
14919 \pgfusepath{draw,fill}
14920 \endpgfscope
14921 }
14922 }
14923
14924 %%%% Transmission gates
14925 % tgates are only ieee style for now
14926 \tikzset{%
14927 tgate/.style ={shape=ieee tgate},
14928 double tgate/.style ={shape=ieee double tgate},
14929 }
14930 \ctikzset{tgate scale/.initial=0.7}
14931 % Buffer and inverters
14932 %
14933 % #1: name
14934 % #2: 1: one-not, 2:double-not
14935 % #3: content
14936 \long\def\pgfcircdeclareieeetgate#1#2#3{%
14937 \pgfdeclareshape{ieee #1}%
14938 {%
14939 \savedmacro{\ctikzclass}{\edef\ctikzclass{logic ports}}
14940 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
14941 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
14942 \saveddimen{\baselen}{%
14943 \pgf@circ@ieeestd@baselen\pgf@x=\pgf@circ@res@temp
14944 }
14945 \saveddimen{\stdH}{% This is HALF the height of the inner port
14946 \pgf@circ@ieeestd@stdH\pgf@x=\pgf@circ@res@temp
14947 }
14948 \saveddimen{\notdiameter}{
14949 \pgf@circ@notradius\pgf@x=2\pgf@circ@res@temp
14950 }
14951 \saveddimen{\notradius}{
14952 \pgf@circ@notradius\pgf@x=\pgf@circ@res@temp
14953 }
14954 \saveddimen{\pinlen}{%
14955 \pgf@circ@ieeestd@pinlen\pgf@x=\pgf@circ@res@temp
14956 }
14957 % anchors for the body (no pins included here)
14958 % Notice that 0.8660254 is cos(30)
14959 \savedanchor{\bodyleft}{% This DOES NOT take into account the pointy or/xor thing
14960 \pgf@circ@ieeestd@stdH
14961 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14962 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14963 }
14964 \savedanchor{\topleft}{%
14965 \pgf@circ@ieeestd@stdH
14966 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14967 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14968 }
14969 \savedanchor{\bodyright}{%
14970 \pgf@circ@ieeestd@stdH
14971 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14972 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14973 }
14974 \savedanchor{\bottomright}{% Here it is the same as \bodyright
14975 \pgf@circ@ieeestd@stdH
14976 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14977 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14978 }
14979 % geographical anchors --- must be rectangulars!
14980 \savedanchor{\northwest}{%
14981 \pgf@circ@ieeestd@stdH
14982 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14983 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14984 }
14985 \savedanchor{\southwest}{%
14986 \pgf@circ@ieeestd@stdH
14987 \pgfmathsetlength{\pgf@x}{-2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14988 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14989 }
14990 \savedanchor{\southeast}{%
14991 \pgf@circ@ieeestd@stdH
14992 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14993 \pgfmathsetlength{\pgf@y}{-#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14994 }
14995 \savedanchor{\northeast}{%
14996 \pgf@circ@ieeestd@stdH
14997 \pgfmathsetlength{\pgf@x}{2*0.8660254*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14998 \pgfmathsetlength{\pgf@y}{#2*\pgf@circ@res@temp*\ctikzvalof{tgate scale}}
14999 }
15000 \anchor{center}{\pgfpointorigin}
15001 \anchor{text}{
15002 \ifpgf@circ@center@text
15003 \pgfpoint{-.5\wd\pgfnodeparttextbox}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
15004 \else
15005 \pgf@circ@ieeestd@stdH
15006 \pgfpoint{-0.8660254*\pgf@circ@res@temp + \ctikzvalof{left text distance}}{\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox}
15007 \fi
15008 }
15009 % input anchors
15010 \anchor{in}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
15011 \anchor{in 1}{\bodyleft\pgf@y=0pt\advance\pgf@x by-\pinlen}
15012 \anchor{bin}{\bodyleft\pgf@y=0pt\relax}
15013 \anchor{bin 1}{\bodyleft\pgf@y=0pt\relax}
15014 % gates
15015 \anchor{gate}{\bodyleft\pgf@circ@res@up=\pgf@y
15016 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
15017 \anchor{bgate}{\bodyleft\pgf@circ@res@up=\pgf@y
15018 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{-(#2-1)*0.5*\pgf@circ@res@up}}
15019 % gate (up) (2.1547 = 1+1/cos(30)
15020 \anchor{notgate}{\bodyleft\pgf@circ@res@up=\pgf@y
15021 \pgf@x=0pt\relax
15022 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
15023 \ifdim\pinlen>\pgf@circ@res@temp
15024 \pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}
15025 \else
15026 \pgf@y=\pgf@circ@res@temp
15027 \fi
15028 }
15029 \anchor{bnotgate}{\bodyleft\pgf@circ@res@up=\pgf@y
15030 \pgf@x=0pt\pgfmathsetlength{\pgf@y}{(#2-1)*0.5*\pgf@circ@res@up+2.1547*\notradius}}
15031
15032 % output anchors
15033 \anchor{out}{%
15034 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without not ball
15035 \advance\pgf@circ@res@other by\pinlen
15036 \pgfextractx{\pgf@circ@res@temp}{\bottomright} %body + ball border
15037 \ifdim \pgf@circ@res@temp > \pgf@circ@res@other
15038 \pgf@circ@res@other = \pgf@circ@res@temp % do not enter in the ball...
15039 \fi
15040 \pgf@x=\pgf@circ@res@other\pgf@y=0pt
15041 }
15042 \anchor{bout}{\bottomright\pgf@y=0pt}
15043
15044 \anchor{body right}{\bodyright\pgf@y=0pt}
15045 \anchor{right}{\bottomright\pgf@y=0pt}
15046 \anchor{body left}{\bodyleft\pgf@y=0pt}% central edge of the body
15047 \anchor{left}{\bodyleft\pgf@y=0pt}
15048 \anchor{up}{%
15049 \bodyleft
15050 \pgf@x=0pt
15051 \ifnum#2=1\relax
15052 \pgf@y=0pt
15053 \else
15054 \pgf@y=.5\pgf@y
15055 \fi
15056 \advance\pgf@y by \notdiameter
15057 }
15058 \anchor{down}{%
15059 \bodyleft
15060 \pgf@x=0pt
15061 \ifnum#2=1\relax
15062 \pgf@y=0pt
15063 \else
15064 \pgf@y=-.5\pgf@y
15065 \fi
15066 }
15067 % this is for when it's used as a bipole
15068 % we use the enclosing rectangle (see below)
15069 \anchorborder{%
15070 %
15071 % this is the square border to position the path label with a bit of horizontal space
15072 %
15073 \pgf@xa=\pgf@x
15074 \pgf@ya=\pgf@y
15075 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
15076 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
15077 \pgfpointborderrectangle{\pgfpoint{\pgf@xa}{\pgf@ya}}
15078 {\pgfpoint{-\pgf@circ@res@left}{\pgf@circ@res@up}}
15079 }
15080 % geographical anchors
15081 \anchor{nw}{\northwest}
15082 \anchor{ne}{\northeast}
15083 \anchor{se}{\southeast}
15084 \anchor{sw}{\southwest}
15085 \anchor{north west}{\northwest}
15086 \anchor{north east}{\northeast}
15087 \anchor{south east}{\southeast}
15088 \anchor{south west}{\southwest}
15089 % over 0,0 even if asymmetric
15090 % will break if the geocoords are not rectangular
15091 \anchor{n}{\northwest\pgf@x=0pt\relax}
15092 \anchor{e}{\northeast\pgf@y=0pt\relax}
15093 \anchor{s}{\southwest\pgf@x=0pt\relax}
15094 \anchor{w}{\northwest\pgf@y=0pt\relax}
15095 \anchor{north}{\northwest\pgf@x=0pt\relax}
15096 \anchor{east}{\northeast\pgf@y=0pt\relax}
15097 \anchor{south}{\southwest\pgf@x=0pt\relax}
15098 \anchor{west}{\northwest\pgf@y=0pt\relax}
15099
15100 \pgf@circ@draw@component{
15101 \pgfscope
15102 \pgf@circ@setcolor
15103 \pgfextractx{\pgf@circ@res@left}{\bodyleft}
15104 \pgfextracty{\pgf@circ@res@up}{\bodyleft}
15105 \pgfextractx{\pgf@circ@res@right}{\bodyright}
15106 % \draw input pins
15107 \ifpgfcirc@draw@input@leads
15108 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
15109 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pinlen}{0pt}}
15110 % gate (down)
15111 \pgfpathmoveto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up}}
15112 \pgfpathlineto{\pgfpoint{0pt}{-(#2-1)*0.5*\pgf@circ@res@up-\pinlen}}
15113 % gate (up) (2.1547 = 1+1/cos(30)
15114 \pgfmathsetlength{\pgf@circ@res@temp}{2.1547*\notradius}
15115 \ifdim\pinlen>\pgf@circ@res@temp
15116 \pgfpathmoveto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pgf@circ@res@temp}}
15117 \pgfpathlineto{\pgfpoint{0pt}{(#2-1)*0.5*\pgf@circ@res@up+\pinlen}}
15118 \fi
15119 \pgfusepath{draw}
15120 \fi
15121 #3%
15122 \endpgfscope
15123 % output lead:
15124 \pgfextractx{\pgf@circ@res@right}{\bottomright} %body+ball border
15125 \pgfextractx{\pgf@circ@res@other}{\bodyright} %body border, without "not" ball
15126 \advance\pgf@circ@res@other by \pinlen\relax
15127 \ifdim \pgf@circ@res@other > \pgf@circ@res@right
15128 \ifpgfcirc@draw@output@leads
15129 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15130 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{0pt}}
15131 \pgfusepath{draw}
15132 \fi
15133 \fi
15134 }
15135 }
15136 }
15137
15138 \pgfcircdeclareieeetgate{tgate}{1}{%
15139 \pgfscope
15140 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15141 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
15142 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
15143 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
15144 \pgfpathclose
15145 \pgf@circ@draworfill
15146 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15147 \pgfpathlineto{\pgfpoint{0pt}{0pt}}
15148 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
15149 \pgfpathclose
15150 \pgf@circ@draworfill
15151 \endpgfscope
15152 \pgfscope
15153 % 1.1547 is 1/cos(30)
15154 \pgftransformshift{\pgfpoint{0pt}{1.1547*\notradius}}
15155 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
15156 \endpgfscope
15157 }
15158
15159 \pgfcircdeclareieeetgate{double tgate}{2}{%
15160 \pgfscope
15161 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15162 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
15163 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
15164 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
15165 \pgfpathclose
15166 \pgf@circ@draworfill
15167 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
15168 \pgfpathlineto{\pgfpoint{0pt}{.5\pgf@circ@res@up}}
15169 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15170 \pgfpathclose
15171 \pgf@circ@draworfill
15172 % bottom triangles
15173 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@up}}
15174 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
15175 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0pt}}
15176 \pgfpathclose
15177 \pgf@circ@draworfill
15178 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@up}}
15179 \pgfpathlineto{\pgfpoint{0pt}{-.5\pgf@circ@res@up}}
15180 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
15181 \pgfpathclose
15182 \pgf@circ@draworfill
15183 \endpgfscope
15184 \pgfscope
15185 % 1.1547 is 1/cos(30)
15186 \pgftransformshift{\pgfpoint{0pt}{.5*\pgf@circ@res@up+1.1547*\notradius}}
15187 \pgfnode{notcirc}{center}{}{\thisshape-not}{\pgfusepath{stroke}}
15188 \endpgfscope
15189 }% %>>>
15190
15191 %% Path-style definitions for logical ports%<<<
15192 %
15193 % create path-style element for one input --- one output logical ports
15194 %
15195 \def\pgfcirc@port@node@to@path#1#2{%
15196 %
15197 % add a logic port path style component --- we need to suppress leads
15198 % and use the correct center
15199 %
15200 \pgfcirc@node@to@path{#1}{#2}{/tikz/no leads, \circuitikzbasekey/logic ports origin=center}%
15201 }
15202 \pgfcirc@port@node@to@path{not port}{inline not}
15203 \pgfcirc@port@node@to@path{buffer port}{inline buffer}
15204 \pgfcirc@port@node@to@path{schmitt port}{inline schmitt}
15205 \pgfcirc@port@node@to@path{invschmitt port}{inline invschmitt}
15206
15207 \pgfcirc@port@node@to@path{tgate}{inline tgate}
15208 \pgfcirc@port@node@to@path{double tgate}{inline double tgate}
15209 % %>>>
15210
15211 %%%%%%%%%%%%%%%%%%%%%%%%
15212 %% Transistors
15213 %%%%%%%%%%%%%%%%%%%%%%%%
15214
15215 % Settings for Transistors %<<<1
15216
15217 \newif\ifpgf@circuit@trans@depletiontype
15218 \pgf@circuit@trans@depletiontypefalse
15219
15220 \newif\ifpgf@circuit@mos@arrows
15221 \ctikzset{tripoles/mos style/.is choice}
15222 \ctikzset{tripoles/mos style/no arrows/.code={\pgf@circuit@mos@arrowsfalse}}
15223 \ctikzset{tripoles/mos style/arrows/.code={\pgf@circuit@mos@arrowstrue}}
15224 \pgfkeys{/tikz/arrowmos/.add code={}{\pgf@circuit@mos@arrowstrue}}
15225 \pgfkeys{/tikz/noarrowmos/.add code={}{\pgf@circuit@mos@arrowsfalse}}
15226
15227 % Fixed label positions
15228 \newif\ifpgf@circuit@transisors@fixlabels
15229 \pgf@circuit@transisors@fixlabelstrue
15230 \pgfkeys{/tikz/center transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
15231 \ctikzset{fix transistors text/.add code={}{\pgf@circuit@transisors@fixlabelstrue}}
15232 \pgfkeys{/tikz/legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
15233 \ctikzset{legacy transistors text/.add code={}{\pgf@circuit@transisors@fixlabelsfalse}}
15234
15235 % Option solderdot for fet
15236 \newif\ifpgf@circuit@fet@solderdot
15237 \pgfkeys{/tikz/solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
15238 \ctikzset{solderdot/.add code={}{\pgf@circuit@fet@solderdottrue}}
15239 \pgfkeys{/tikz/nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
15240 \ctikzset{nosolderdot/.add code={}{\pgf@circuit@fet@solderdotfalse}}
15241
15242 %%%% activate doublegate
15243 \newif\ifpgf@circuit@fet@doublegate
15244 \pgfkeys{/tikz/doublegate/.add code={}{\pgf@circuit@fet@doublegatetrue}}
15245 \ctikzset{doublegate/.add code={}{\pgf@circuit@fet@doublegatetrue}}
15246 \pgfkeys{/tikz/nodoublegate/.add code={}{\pgf@circuit@fet@doublegatefalse}}
15247 \ctikzset{nodoublegate/.add code={}{\pgf@circuit@fet@doublegatefalse}}
15248
15249 % Option bodydiode for fet
15250 \newif\ifpgf@circuit@fet@bodydiode
15251 \pgfkeys{/tikz/bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
15252 \ctikzset{bodydiode/.add code={}{\pgf@circuit@fet@bodydiodetrue}}
15253 \pgfkeys{/tikz/nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
15254 \ctikzset{nobodydiode/.add code={}{\pgf@circuit@fet@bodydiodefalse}}
15255
15256 % Option draw fet without gate connection
15257 \newif\ifpgf@circuit@bpt@drawgate
15258 \pgf@circuit@bpt@drawgatetrue
15259 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
15260 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
15261 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
15262 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawgatefalse}}
15263
15264 % Option draw bpt with schottky base
15265 \newif\ifpgf@circuit@bpt@schottky
15266 \pgf@circuit@bpt@schottkyfalse
15267 \pgfkeys{/tikz/schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
15268 \ctikzset{schottky base/.add code={}{\pgf@circuit@bpt@schottkytrue}}
15269 \pgfkeys{/tikz/no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
15270 \ctikzset{no schottky base/.add code={}{\pgf@circuit@bpt@schottkyfalse}}
15271 \ctikzset{tripoles/schottky base size/.initial=0.05}
15272
15273 % Option to add ferroelectric symbol
15274 \newif\ifpgf@circuit@tr@ferroel
15275 \pgf@circuit@tr@ferroelfalse
15276 \pgfkeys{/tikz/ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}}
15277 \ctikzset{ferroel gate/.add code={}{\pgf@circuit@tr@ferroeltrue}}
15278 \pgfkeys{/tikz/no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}}
15279 \ctikzset{no ferroel gate/.add code={}{\pgf@circuit@tr@ferroelfalse}}
15280
15281
15282 % Option draw bpt without base connection
15283 \newif\ifpgf@circuit@bpt@drawbase
15284 \pgf@circuit@bpt@drawbasetrue
15285 \pgfkeys{/tikz/nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
15286 \ctikzset{nobase/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
15287 \pgfkeys{/tikz/nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
15288 \ctikzset{nogate/.add code={}{\pgf@circuit@bpt@drawbasefalse}}
15289
15290 % Option draw bpt with optical input
15291 \newif\ifpgf@circuit@bpt@drawphoto
15292 \pgf@circuit@bpt@drawphotofalse
15293 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
15294 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
15295 \pgfkeys{/tikz/photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
15296 \ctikzset{photo/.add code={}{\pgf@circuit@bpt@drawphototrue}}
15297
15298 % Option draw fet without bulk connection -- Added by Burak Kelleci
15299 \newif\ifpgf@circuit@bpt@drawbulk
15300 \pgfkeys{/tikz/bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
15301 \ctikzset{bulk/.add code={}{\pgf@circuit@bpt@drawbulktrue}}
15302 \pgfkeys{/tikz/nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
15303 \ctikzset{nobulk/.add code={}{\pgf@circuit@bpt@drawbulkfalse}}
15304
15305 % Option draw pmos with empty circle
15306 \newif\ifpgf@circuit@pmos@emptycircle
15307 \pgf@circuit@pmos@emptycirclefalse
15308 \ctikzset{tripoles/pmos style/.is choice}
15309 \pgfkeys{/tikz/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
15310 \ctikzset{tripoles/pmos style/emptycircle/.add code={}{\pgf@circuit@pmos@emptycircletrue}}
15311 % Option draw pmos with no circle
15312 \newif\ifpgf@circuit@pmos@nocircle
15313 \pgf@circuit@pmos@nocirclefalse
15314 \pgfkeys{/tikz/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
15315 \ctikzset{tripoles/pmos style/nocircle/.add code={}{\pgf@circuit@pmos@nocircletrue}}
15316 % back to normal
15317 \pgfkeys{/tikz/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
15318 \ctikzset{tripoles/pmos style/fullcircle/.add code={}{\pgf@circuit@pmos@emptycirclefalse\pgf@circuit@pmos@nocirclefalse}}
15319 % arrows at the end, the correct way
15320 \newif\ifpgf@circuit@trans@arrowatend
15321 \pgf@circuit@trans@arrowatendfalse
15322 \ctikzset{transistors/arrow pos/.is choice}
15323 \ctikzset{transistors/arrow pos/legacy/.code={\pgf@circuit@trans@arrowatendfalse}}
15324 \ctikzset{transistors/arrow pos/end/.code={\pgf@circuit@trans@arrowatendtrue}}
15325
15326 \newif\ifpgf@circuit@trans@ntype
15327 \pgf@circuit@trans@ntypetrue %default true
15328 %\newif\ifpgf@circuit@trans@ptype
15329 %\ctikzset{tripoles/nmos/.add code={\pgf@circuit@trans@ntypetrue}}
15330 \ctikzset{tripoles/nmos/width/.initial=.7}
15331 \ctikzset{tripoles/nmos/gate height/.initial=.35}
15332 \ctikzset{tripoles/nmos/base height/.initial=.5}
15333 \ctikzset{tripoles/nmos/conn height/.initial=0}
15334 \ctikzset{tripoles/nmos/height/.initial=1.1}
15335 \ctikzset{tripoles/nmos/base width/.initial=.5}
15336 \ctikzset{tripoles/nmos/gate width/.initial=.62}
15337 \ctikzset{tripoles/nmos/arrow pos/.initial=.6}
15338 \ctikzset{tripoles/nmos/bodydiode scale/.initial=.3}
15339 \ctikzset{tripoles/nmos/bodydiode distance/.initial=.3}
15340 \ctikzset{tripoles/nmos/bodydiode conn/.initial=.6}
15341 \ctikzset{tripoles/nmos/curr direction/.initial=1}
15342
15343 \ctikzset{tripoles/pmos/width/.initial=.7}
15344 \ctikzset{tripoles/pmos/gate height/.initial=.35}
15345 \ctikzset{tripoles/pmos/base height/.initial=.5}
15346 \ctikzset{tripoles/pmos/conn height/.initial=0}
15347 \ctikzset{tripoles/pmos/height/.initial=1.1}
15348 \ctikzset{tripoles/pmos/base width/.initial=.5}
15349 \ctikzset{tripoles/pmos/gate width/.initial=.62}
15350 \ctikzset{tripoles/pmos/arrow pos/.initial=.4}
15351 \ctikzset{tripoles/pmos/bodydiode scale/.initial=.3}
15352 \ctikzset{tripoles/pmos/bodydiode distance/.initial=.3}
15353 \ctikzset{tripoles/pmos/bodydiode conn/.initial=.6}
15354 \ctikzset{tripoles/pmos/curr direction/.initial=-1}
15355
15356 \ctikzset{tripoles/nmosd/width/.initial=.7}
15357 \ctikzset{tripoles/nmosd/gate height/.initial=.35}
15358 \ctikzset{tripoles/nmosd/base height/.initial=.5}
15359 \ctikzset{tripoles/nmosd/conn height/.initial=0}
15360 \ctikzset{tripoles/nmosd/height/.initial=1.1}
15361 \ctikzset{tripoles/nmosd/base width/.initial=.5}
15362 \ctikzset{tripoles/nmosd/gate width/.initial=.62}
15363 \ctikzset{tripoles/nmosd/arrow pos/.initial=.6}
15364 \ctikzset{tripoles/nmosd/bodydiode scale/.initial=.3}
15365 \ctikzset{tripoles/nmosd/bodydiode distance/.initial=.3}
15366 \ctikzset{tripoles/nmosd/bodydiode conn/.initial=.6}
15367 \ctikzset{tripoles/nmosd/curr direction/.initial=1}
15368 \ctikzset{tripoles/nmosd/depletion width/.initial=.1}
15369 \ctikzset{tripoles/nmosd/depletion color/.initial=default}
15370
15371 \ctikzset{tripoles/pmosd/width/.initial=.7}
15372 \ctikzset{tripoles/pmosd/gate height/.initial=.35}
15373 \ctikzset{tripoles/pmosd/base height/.initial=.5}
15374 \ctikzset{tripoles/pmosd/conn height/.initial=0}
15375 \ctikzset{tripoles/pmosd/height/.initial=1.1}
15376 \ctikzset{tripoles/pmosd/base width/.initial=.5}
15377 \ctikzset{tripoles/pmosd/gate width/.initial=.62}
15378 \ctikzset{tripoles/pmosd/arrow pos/.initial=.4}
15379 \ctikzset{tripoles/pmosd/bodydiode scale/.initial=.3}
15380 \ctikzset{tripoles/pmosd/bodydiode distance/.initial=.3}
15381 \ctikzset{tripoles/pmosd/bodydiode conn/.initial=.6}
15382 \ctikzset{tripoles/pmosd/curr direction/.initial=-1}
15383 \ctikzset{tripoles/pmosd/depletion width/.initial=.1}
15384 \ctikzset{tripoles/pmosd/depletion color/.initial=default}
15385 \ctikzset{tripoles/hemt/width/.initial=.7}
15386 \ctikzset{tripoles/hemt/gate height/.initial=.35}
15387 \ctikzset{tripoles/hemt/base height/.initial=.5}
15388 \ctikzset{tripoles/hemt/conn height/.initial=0}
15389 \ctikzset{tripoles/hemt/height/.initial=1.1}
15390 \ctikzset{tripoles/hemt/base width/.initial=.5}
15391 \ctikzset{tripoles/hemt/gate width/.initial=.5}% the horizontal position is the same
15392 \ctikzset{tripoles/hemt/bodydiode scale/.initial=.3}
15393 \ctikzset{tripoles/hemt/bodydiode distance/.initial=.3}
15394 \ctikzset{tripoles/hemt/bodydiode conn/.initial=.6}
15395 \ctikzset{tripoles/hemt/curr direction/.initial=1}
15396 %% New parameters
15397 \ctikzset{tripoles/hemt/curr direction/.initial=1}
15398 \ctikzset{tripoles/hemt/gate asym/.initial=0}
15399 \newif\ifpgf@circ@hemt@split
15400 \ctikzset{tripoles/hemt/split gate/.is if=pgf@circ@hemt@split}
15401 \ctikzset{tripoles/hemt/source arrow/.initial=0}
15402
15403 \ctikzset{tripoles/nfet/width/.initial=.7}
15404 \ctikzset{tripoles/nfet/gate height/.initial=.35}
15405 \ctikzset{tripoles/nfet/base height/.initial=.5}
15406 \ctikzset{tripoles/nfet/conn height/.initial=0}
15407 \ctikzset{tripoles/nfet/height/.initial=1.1}
15408 \ctikzset{tripoles/nfet/base width/.initial=.5}
15409 \ctikzset{tripoles/nfet/gate width/.initial=.62}
15410 \ctikzset{tripoles/nfet/bodydiode scale/.initial=.3}
15411 \ctikzset{tripoles/nfet/bodydiode distance/.initial=.3}
15412 \ctikzset{tripoles/nfet/bodydiode conn/.initial=.6}
15413 \ctikzset{tripoles/nfet/curr direction/.initial=1}
15414
15415 \ctikzset{tripoles/pfet/width/.initial=.7}
15416 \ctikzset{tripoles/pfet/gate height/.initial=.35}
15417 \ctikzset{tripoles/pfet/base height/.initial=.5}
15418 \ctikzset{tripoles/pfet/conn height/.initial=0}
15419 \ctikzset{tripoles/pfet/height/.initial=1.1}
15420 \ctikzset{tripoles/pfet/base width/.initial=.5}
15421 \ctikzset{tripoles/pfet/gate width/.initial=.62}
15422 \ctikzset{tripoles/pfet/bodydiode scale/.initial=.3}
15423 \ctikzset{tripoles/pfet/bodydiode distance/.initial=.3}
15424 \ctikzset{tripoles/pfet/bodydiode conn/.initial=.6}
15425 \ctikzset{tripoles/pfet/curr direction/.initial=-1}
15426
15427 \ctikzset{tripoles/nfetd/width/.initial=.7}
15428 \ctikzset{tripoles/nfetd/gate height/.initial=.35}
15429 \ctikzset{tripoles/nfetd/base height/.initial=.5}
15430 \ctikzset{tripoles/nfetd/conn height/.initial=0}
15431 \ctikzset{tripoles/nfetd/height/.initial=1.1}
15432 \ctikzset{tripoles/nfetd/base width/.initial=.5}
15433 \ctikzset{tripoles/nfetd/gate width/.initial=.62}
15434 \ctikzset{tripoles/nfetd/bodydiode scale/.initial=.3}
15435 \ctikzset{tripoles/nfetd/bodydiode distance/.initial=.3}
15436 \ctikzset{tripoles/nfetd/bodydiode conn/.initial=.6}
15437 \ctikzset{tripoles/nfetd/curr direction/.initial=1}
15438
15439 \ctikzset{tripoles/pfetd/width/.initial=.7}
15440 \ctikzset{tripoles/pfetd/gate height/.initial=.35}
15441 \ctikzset{tripoles/pfetd/base height/.initial=.5}
15442 \ctikzset{tripoles/pfetd/conn height/.initial=0}
15443 \ctikzset{tripoles/pfetd/height/.initial=1.1}
15444 \ctikzset{tripoles/pfetd/base width/.initial=.5}
15445 \ctikzset{tripoles/pfetd/gate width/.initial=.62}
15446 \ctikzset{tripoles/pfetd/bodydiode scale/.initial=.3}
15447 \ctikzset{tripoles/pfetd/bodydiode distance/.initial=.3}
15448 \ctikzset{tripoles/pfetd/bodydiode conn/.initial=.6}
15449 \ctikzset{tripoles/pfetd/curr direction/.initial=-1}
15450
15451 \ctikzset{tripoles/nigfete/width/.initial=.7}
15452 \ctikzset{tripoles/nigfete/gate height/.initial=.35}
15453 \ctikzset{tripoles/nigfete/base height/.initial=.5}
15454 \ctikzset{tripoles/nigfete/conn height/.initial=.35}
15455 \ctikzset{tripoles/nigfete/height/.initial=1.1}
15456 \ctikzset{tripoles/nigfete/base width/.initial=.5}
15457 \ctikzset{tripoles/nigfete/gate width/.initial=.62}
15458 \ctikzset{tripoles/nigfete/bodydiode scale/.initial=.3}
15459 \ctikzset{tripoles/nigfete/bodydiode distance/.initial=.3}
15460 \ctikzset{tripoles/nigfete/bodydiode conn/.initial=.6}
15461 \ctikzset{tripoles/nigfete/curr direction/.initial=1}
15462
15463 \ctikzset{tripoles/nigfetd/width/.initial=.7}
15464 \ctikzset{tripoles/nigfetd/gate height/.initial=.35}
15465 \ctikzset{tripoles/nigfetd/base height/.initial=.5}
15466 \ctikzset{tripoles/nigfetd/conn height/.initial=.35}
15467 \ctikzset{tripoles/nigfetd/height/.initial=1.1}
15468 \ctikzset{tripoles/nigfetd/base width/.initial=.5}
15469 \ctikzset{tripoles/nigfetd/gate width/.initial=.62}
15470 \ctikzset{tripoles/nigfetd/bodydiode scale/.initial=.3}
15471 \ctikzset{tripoles/nigfetd/bodydiode distance/.initial=.3}
15472 \ctikzset{tripoles/nigfetd/bodydiode conn/.initial=.6}
15473 \ctikzset{tripoles/nigfetd/curr direction/.initial=1}
15474
15475 \ctikzset{tripoles/nigfetebulk/width/.initial=.7}
15476 \ctikzset{tripoles/nigfetebulk/gate height/.initial=.35}
15477 \ctikzset{tripoles/nigfetebulk/base height/.initial=.5}
15478 \ctikzset{tripoles/nigfetebulk/conn height/.initial=.35}
15479 \ctikzset{tripoles/nigfetebulk/height/.initial=1.1}
15480 \ctikzset{tripoles/nigfetebulk/base width/.initial=.5}
15481 \ctikzset{tripoles/nigfetebulk/gate width/.initial=.62}
15482 \ctikzset{tripoles/nigfetebulk/bodydiode scale/.initial=.3}
15483 \ctikzset{tripoles/nigfetebulk/bodydiode distance/.initial=.3}
15484 \ctikzset{tripoles/nigfetebulk/bodydiode conn/.initial=.6}
15485 \ctikzset{tripoles/nigfetebulk/curr direction/.initial=1}
15486
15487 \ctikzset{tripoles/pigfete/width/.initial=.7}
15488 \ctikzset{tripoles/pigfete/gate height/.initial=.35}
15489 \ctikzset{tripoles/pigfete/base height/.initial=.5}
15490 \ctikzset{tripoles/pigfete/conn height/.initial=.35}
15491 \ctikzset{tripoles/pigfete/height/.initial=1.1}
15492 \ctikzset{tripoles/pigfete/base width/.initial=.5}
15493 \ctikzset{tripoles/pigfete/gate width/.initial=.62}
15494 \ctikzset{tripoles/pigfete/bodydiode scale/.initial=.3}
15495 \ctikzset{tripoles/pigfete/bodydiode distance/.initial=.3}
15496 \ctikzset{tripoles/pigfete/bodydiode conn/.initial=.6}
15497 \ctikzset{tripoles/pigfete/curr direction/.initial=-1}
15498
15499 \ctikzset{tripoles/pigfetd/width/.initial=.7}
15500 \ctikzset{tripoles/pigfetd/gate height/.initial=.35}
15501 \ctikzset{tripoles/pigfetd/base height/.initial=.5}
15502 \ctikzset{tripoles/pigfetd/conn height/.initial=.35}
15503 \ctikzset{tripoles/pigfetd/height/.initial=1.1}
15504 \ctikzset{tripoles/pigfetd/base width/.initial=.5}
15505 \ctikzset{tripoles/pigfetd/gate width/.initial=.62}
15506 \ctikzset{tripoles/pigfetd/bodydiode scale/.initial=.3}
15507 \ctikzset{tripoles/pigfetd/bodydiode distance/.initial=.3}
15508 \ctikzset{tripoles/pigfetd/bodydiode conn/.initial=.6}
15509 \ctikzset{tripoles/pigfetd/curr direction/.initial=-1}
15510
15511 \ctikzset{tripoles/pigfetebulk/width/.initial=.7}
15512 \ctikzset{tripoles/pigfetebulk/gate height/.initial=.35}
15513 \ctikzset{tripoles/pigfetebulk/conn height/.initial=.35}
15514 \ctikzset{tripoles/pigfetebulk/base height/.initial=.5}
15515 \ctikzset{tripoles/pigfetebulk/height/.initial=1.1}
15516 \ctikzset{tripoles/pigfetebulk/base width/.initial=.5}
15517 \ctikzset{tripoles/pigfetebulk/gate width/.initial=.62}
15518 \ctikzset{tripoles/pigfetebulk/bodydiode scale/.initial=.3}
15519 \ctikzset{tripoles/pigfetebulk/bodydiode distance/.initial=.3}
15520 \ctikzset{tripoles/pigfetebulk/bodydiode conn/.initial=.6}
15521 \ctikzset{tripoles/pigfetebulk/curr direction/.initial=-1}
15522
15523 \ctikzset{tripoles/npn/width/.initial=.6}
15524 \ctikzset{tripoles/npn/base height/.initial=.45}
15525 \ctikzset{tripoles/npn/base height 2/.initial=.15}
15526 \ctikzset{tripoles/npn/base height/.initial=.4}
15527 \ctikzset{tripoles/npn/conn height/.initial=0}
15528 \ctikzset{tripoles/npn/height/.initial=1.1}
15529 \ctikzset{tripoles/npn/base width/.initial=.5}
15530 \ctikzset{tripoles/npn/arrow pos/.initial=.5}
15531 \ctikzset{tripoles/npn/bodydiode scale/.initial=.3}
15532 \ctikzset{tripoles/npn/bodydiode distance/.initial=.3}
15533 \ctikzset{tripoles/npn/bodydiode conn/.initial=.6}
15534 \ctikzset{tripoles/npn/curr direction/.initial=1}
15535
15536 \ctikzset{tripoles/pnp/width/.initial=.6}
15537 \ctikzset{tripoles/pnp/base height/.initial=.45}
15538 \ctikzset{tripoles/pnp/base height 2/.initial=.15}
15539 \ctikzset{tripoles/pnp/base height/.initial=.4}
15540 \ctikzset{tripoles/pnp/conn height/.initial=0}
15541 \ctikzset{tripoles/pnp/height/.initial=1.1}
15542 \ctikzset{tripoles/pnp/base width/.initial=.5}
15543 \ctikzset{tripoles/pnp/arrow pos/.initial=.5}
15544 \ctikzset{tripoles/pnp/bodydiode scale/.initial=.3}
15545 \ctikzset{tripoles/pnp/bodydiode distance/.initial=.3}
15546 \ctikzset{tripoles/pnp/bodydiode conn/.initial=.6}
15547 \ctikzset{tripoles/pnp/curr direction/.initial=-1}
15548
15549 \ctikzset{tripoles/pigbt/width/.initial=.6}
15550 \ctikzset{tripoles/pigbt/gate height/.initial=.45}
15551 \ctikzset{tripoles/pigbt/gate height 2/.initial=.15}
15552 \ctikzset{tripoles/pigbt/base height/.initial=.4}
15553 \ctikzset{tripoles/pigbt/outer base height/.initial=.4}
15554 \ctikzset{tripoles/pigbt/outer base thickness/.initial=1}
15555 \ctikzset{tripoles/pigbt/conn height/.initial=0}
15556 \ctikzset{tripoles/pigbt/height/.initial=1.1}
15557 \ctikzset{tripoles/pigbt/gate width/.initial=.62}
15558 \ctikzset{tripoles/pigbt/base width/.initial=.5}
15559 \ctikzset{tripoles/pigbt/bodydiode scale/.initial=.3}
15560 \ctikzset{tripoles/pigbt/bodydiode distance/.initial=.3}
15561 \ctikzset{tripoles/pigbt/bodydiode conn/.initial=.6}
15562 \ctikzset{tripoles/pigbt/curr direction/.initial=-1}
15563
15564 \ctikzset{tripoles/nigbt/width/.initial=.6}
15565 \ctikzset{tripoles/nigbt/gate height/.initial=.45}
15566 \ctikzset{tripoles/nigbt/gate height 2/.initial=.15}
15567 \ctikzset{tripoles/nigbt/base height/.initial=.4}
15568 \ctikzset{tripoles/nigbt/outer base height/.initial=.4}
15569 \ctikzset{tripoles/nigbt/outer base thickness/.initial=1}
15570 \ctikzset{tripoles/nigbt/conn height/.initial=0}
15571 \ctikzset{tripoles/nigbt/height/.initial=1.1}
15572 \ctikzset{tripoles/nigbt/gate width/.initial=.62}
15573 \ctikzset{tripoles/nigbt/base width/.initial=.5}
15574 \ctikzset{tripoles/nigbt/bodydiode scale/.initial=.3}
15575 \ctikzset{tripoles/nigbt/bodydiode distance/.initial=.3}
15576 \ctikzset{tripoles/nigbt/bodydiode conn/.initial=.6}
15577 \ctikzset{tripoles/nigbt/curr direction/.initial=1}
15578
15579 \ctikzset{tripoles/Lpigbt/width/.initial=.6}
15580 \ctikzset{tripoles/Lpigbt/gate height/.initial=.45}
15581 \ctikzset{tripoles/Lpigbt/gate height 2/.initial=.15}
15582 \ctikzset{tripoles/Lpigbt/base height/.initial=.4}
15583 \ctikzset{tripoles/Lpigbt/outer base height/.initial=.4}
15584 \ctikzset{tripoles/Lpigbt/outer base thickness/.initial=1}
15585 \ctikzset{tripoles/Lpigbt/conn height/.initial=.4}
15586 \ctikzset{tripoles/Lpigbt/height/.initial=1.1}
15587 \ctikzset{tripoles/Lpigbt/gate width/.initial=.62}
15588 \ctikzset{tripoles/Lpigbt/base width/.initial=.5}
15589 \ctikzset{tripoles/Lpigbt/bodydiode scale/.initial=.3}
15590 \ctikzset{tripoles/Lpigbt/bodydiode distance/.initial=.3}
15591 \ctikzset{tripoles/Lpigbt/bodydiode conn/.initial=.6}
15592 \ctikzset{tripoles/Lpigbt/curr direction/.initial=-1}
15593
15594 \ctikzset{tripoles/Lnigbt/width/.initial=.6}
15595 \ctikzset{tripoles/Lnigbt/gate height/.initial=.45}
15596 \ctikzset{tripoles/Lnigbt/gate height 2/.initial=.15}
15597 \ctikzset{tripoles/Lnigbt/base height/.initial=.4}
15598 \ctikzset{tripoles/Lnigbt/outer base height/.initial=.4}
15599 \ctikzset{tripoles/Lnigbt/outer base thickness/.initial=1}
15600 \ctikzset{tripoles/Lnigbt/conn height/.initial=.4}
15601 \ctikzset{tripoles/Lnigbt/height/.initial=1.1}
15602 \ctikzset{tripoles/Lnigbt/gate width/.initial=.62}
15603 \ctikzset{tripoles/Lnigbt/base width/.initial=.5}
15604 \ctikzset{tripoles/Lnigbt/bodydiode scale/.initial=.3}
15605 \ctikzset{tripoles/Lnigbt/bodydiode distance/.initial=.3}
15606 \ctikzset{tripoles/Lnigbt/bodydiode conn/.initial=.6}
15607 \ctikzset{tripoles/Lnigbt/curr direction/.initial=1}
15608
15609 \ctikzset{tripoles/igbt/outer base height/.code={
15610 \ctikzset{tripoles/nigbt/outer base height/.initial=#1}
15611 \ctikzset{tripoles/pigbt/outer base height/.initial=#1}
15612 \ctikzset{tripoles/Lnigbt/outer base height/.initial=#1}
15613 \ctikzset{tripoles/Lpigbt/outer base height/.initial=#1}
15614 \ctikzset{tripoles/Lnigbt/conn height/.initial=#1}
15615 \ctikzset{tripoles/Lpigbt/conn height/.initial=#1}
15616 }}
15617 \ctikzset{tripoles/igbt/outer base thickness/.code={
15618 \ctikzset{tripoles/nigbt/outer base thickness=#1}
15619 \ctikzset{tripoles/pigbt/outer base thickness=#1}
15620 \ctikzset{tripoles/Lnigbt/outer base thickness=#1}
15621 \ctikzset{tripoles/Lpigbt/outer base thickness=#1}
15622 }}
15623
15624 \ctikzset{tripoles/njfet/width/.initial=.7}
15625 \ctikzset{tripoles/njfet/gate height/.initial=.5}
15626 \ctikzset{tripoles/njfet/gate height 2/.initial=.35}
15627 \ctikzset{tripoles/njfet/gate width/.initial=.5}
15628 \ctikzset{tripoles/njfet/base width/.initial=.5}
15629 \ctikzset{tripoles/njfet/conn height/.initial=.35}% at the exterior
15630 \ctikzset{tripoles/njfet/union height/.initial=.35}% at the gate
15631 \ctikzset{tripoles/njfet/conn kink/.initial=1}% 1=no kink
15632 \ctikzset{tripoles/njfet/height/.initial=1.1}
15633 \ctikzset{tripoles/njfet/bodydiode scale/.initial=.3}
15634 \ctikzset{tripoles/njfet/bodydiode distance/.initial=.3}
15635 \ctikzset{tripoles/njfet/bodydiode conn/.initial=.6}
15636 \ctikzset{tripoles/njfet/curr direction/.initial=1}
15637
15638 \ctikzset{tripoles/pjfet/width/.initial=.7}
15639 \ctikzset{tripoles/pjfet/gate height/.initial=.5}
15640 \ctikzset{tripoles/pjfet/gate height 2/.initial=.35}
15641 \ctikzset{tripoles/pjfet/gate width/.initial=.5}
15642 \ctikzset{tripoles/pjfet/base width/.initial=.5}
15643 \ctikzset{tripoles/pjfet/conn height/.initial=.35}
15644 \ctikzset{tripoles/pjfet/union height/.initial=.35}% at the gate
15645 \ctikzset{tripoles/pjfet/conn kink/.initial=1}% 1=no kink
15646 \ctikzset{tripoles/pjfet/height/.initial=1.1}
15647 \ctikzset{tripoles/pjfet/bodydiode scale/.initial=.3}
15648 \ctikzset{tripoles/pjfet/bodydiode distance/.initial=.3}
15649 \ctikzset{tripoles/pjfet/bodydiode conn/.initial=.6}
15650 \ctikzset{tripoles/pjfet/curr direction/.initial=-1}
15651
15652 \ctikzset{tripoles/nujt/width/.initial=.7}
15653 \ctikzset{tripoles/nujt/gate height/.initial=.5}
15654 \ctikzset{tripoles/nujt/gate height 2/.initial=.35}
15655 \ctikzset{tripoles/nujt/gate width/.initial=.5}
15656 \ctikzset{tripoles/nujt/base width/.initial=.5}
15657 \ctikzset{tripoles/nujt/conn height/.initial=.35}
15658 \ctikzset{tripoles/nujt/union height/.initial=0}% at the gate
15659 \ctikzset{tripoles/nujt/conn kink/.initial=.82}% to match the circle position
15660 \ctikzset{tripoles/nujt/height/.initial=1.1}
15661 \ctikzset{tripoles/nujt/bodydiode scale/.initial=.3}
15662 \ctikzset{tripoles/nujt/bodydiode distance/.initial=.3}
15663 \ctikzset{tripoles/nujt/bodydiode conn/.initial=.6}
15664 \ctikzset{tripoles/nujt/curr direction/.initial=1}
15665
15666 \ctikzset{tripoles/pujt/width/.initial=.7}
15667 \ctikzset{tripoles/pujt/gate height/.initial=.5}
15668 \ctikzset{tripoles/pujt/gate height 2/.initial=.35}
15669 \ctikzset{tripoles/pujt/gate width/.initial=.5}
15670 \ctikzset{tripoles/pujt/base width/.initial=.5}
15671 \ctikzset{tripoles/pujt/conn height/.initial=.35}
15672 \ctikzset{tripoles/pujt/union height/.initial=0}% at the gate
15673 \ctikzset{tripoles/pujt/conn kink/.initial=.82}% to match the circle position
15674 \ctikzset{tripoles/pujt/height/.initial=1.1}
15675 \ctikzset{tripoles/pujt/bodydiode scale/.initial=.3}
15676 \ctikzset{tripoles/pujt/bodydiode distance/.initial=.3}
15677 \ctikzset{tripoles/pujt/bodydiode conn/.initial=.6}
15678 \ctikzset{tripoles/pujt/curr direction/.initial=-1}
15679
15680 \ctikzset{tripoles/isfet/width/.initial=1}
15681 \ctikzset{tripoles/isfet/gate height/.initial=.35}
15682 \ctikzset{tripoles/isfet/base height/.initial=.5}
15683 \ctikzset{tripoles/isfet/height/.initial=1.1}
15684 \ctikzset{tripoles/isfet/base width/.initial=.3}
15685 \ctikzset{tripoles/isfet/gate width/.initial=.5}
15686 \ctikzset{tripoles/isfet/conn height/.initial=0}
15687 \ctikzset{tripoles/isfet/wave width/.initial=.16}
15688 \ctikzset{tripoles/isfet/wave amp/.initial=.06}
15689 \ctikzset{tripoles/isfet/waves y sep/.initial=.22}
15690 \ctikzset{tripoles/isfet/waves x sep/.initial=.8}
15691 \ctikzset{tripoles/isfet/bodydiode scale/.initial=.3}
15692 \ctikzset{tripoles/isfet/bodydiode distance/.initial=.3}
15693 \ctikzset{tripoles/isfet/bodydiode conn/.initial=.6}
15694 \ctikzset{tripoles/isfet/curr direction/.initial=1}
15695 %
15696 % graphene FET
15697 %
15698 \ctikzset{tripoles/pgfet/width/.initial=.6}
15699 \ctikzset{tripoles/pgfet/gate height/.initial=.5}
15700 \ctikzset{tripoles/pgfet/gate height 2/.initial=0.25} % must be "gate height"/2
15701 \ctikzset{tripoles/pgfet/base height/.initial=.5} % must be "gate height"
15702 \ctikzset{tripoles/pgfet/outer base height/.initial=.25} % must be "gate height 2"
15703 \ctikzset{tripoles/pgfet/outer base thickness/.initial=1}
15704 \ctikzset{tripoles/pgfet/conn height/.initial=0}
15705 \ctikzset{tripoles/pgfet/height/.initial=1.1}
15706 \ctikzset{tripoles/pgfet/gate width/.initial=.5}
15707 \ctikzset{tripoles/pgfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width)
15708 \ctikzset{tripoles/pgfet/bodydiode scale/.initial=.3}
15709 \ctikzset{tripoles/pgfet/bodydiode distance/.initial=.6}
15710 \ctikzset{tripoles/pgfet/bodydiode conn/.initial=.6}
15711 \ctikzset{tripoles/pgfet/curr direction/.initial=-1}
15712
15713 \ctikzset{tripoles/ngfet/width/.initial=.6}
15714 \ctikzset{tripoles/ngfet/gate height/.initial=.5}
15715 \ctikzset{tripoles/ngfet/gate height 2/.initial=0.25} % must be "gate height"/2
15716 \ctikzset{tripoles/ngfet/base height/.initial=.5} % must be "gate height"
15717 \ctikzset{tripoles/ngfet/outer base height/.initial=.25} % must be "gate height 2"
15718 \ctikzset{tripoles/ngfet/outer base thickness/.initial=1}
15719 \ctikzset{tripoles/ngfet/conn height/.initial=0}
15720 \ctikzset{tripoles/ngfet/height/.initial=1.1}
15721 \ctikzset{tripoles/ngfet/gate width/.initial=.5}
15722 \ctikzset{tripoles/ngfet/base width/.initial=0.36084} % must be "gate height"*cos(60)/(2*width)
15723 \ctikzset{tripoles/ngfet/bodydiode scale/.initial=.3}
15724 \ctikzset{tripoles/ngfet/bodydiode distance/.initial=.6}
15725 \ctikzset{tripoles/ngfet/bodydiode conn/.initial=.6}
15726 \ctikzset{tripoles/ngfet/curr direction/.initial=1}
15727 %
15728 % multi-emitter and multi-collector BJTs by Romano Giannetti
15729 %
15730 \ctikzset{tripoles/bjt/emitters/.initial=1}
15731 \ctikzset{tripoles/bjt/collectors/.initial=1}
15732 \pgfkeys{/tikz/emitters/.add code={}{\ctikzset{tripoles/bjt/emitters=#1}}}
15733 \pgfkeys{/tikz/collectors/.add code={}{\ctikzset{tripoles/bjt/collectors=#1}}}
15734 \ctikzset{tripoles/bjt/pins width/.initial=0.3}
15735 \pgfkeys{/tikz/bjt pins width/.add code={}{\ctikzset{tripoles/bjt/pins width=#1}}}
15736 \ctikzset{tripoles/bjt/multi height/.initial=.5}
15737 \pgfkeys{/tikz/bjt multi height/.add code={}{\ctikzset{tripoles/bjt/multi height/.initial=#1}}}
15738 %
15739 \ctikzset{tripoles/bjt/width/.initial=.3}
15740 \ctikzset{tripoles/bjt/base height 2/.initial=.4}
15741 \ctikzset{tripoles/bjt/base height/.initial=1.1}
15742 \ctikzset{tripoles/bjt/height/.initial=.4}
15743 \ctikzset{tripoles/bjt/base width/.initial=1}
15744 \ctikzset{tripoles/bjt/arrow pos/.initial=.5}
15745 % do NOT touch these two!
15746 \ctikzset{tripoles/bjt/npn/curr direction/.initial=1}
15747 \ctikzset{tripoles/bjt/pnp/curr direction/.initial=-1}
15748
15749
15750 %
15751 % definitions for transistor circles
15752 %
15753 \ctikzset{transistor circle/.is family}
15754 \ctikzset{transistor circle/relative thickness/.initial=1}
15755 \ctikzset{transistor circle/color/.initial=default}
15756 \ctikzset{transistor circle/dash/.initial=default}
15757 \ctikzset{transistor circle/scale circle radius/.initial=1}
15758 \ctikzset{transistor circle/default base in/.initial=0.9}
15759 \ctikzset{transistor circle/njfet base in/.initial=1.05}
15760 \ctikzset{transistor circle/pjfet base in/.initial=1.05}
15761 \ctikzset{transistor circle/isfet base in/.initial=0.65}
15762
15763 \newif\ifpgf@circ@trcircle\pgf@circ@trcirclefalse
15764 \ctikzset{tr circle/.is if=pgf@circ@trcircle}
15765 \tikzset{tr circle/.is if=pgf@circ@trcircle}
15766 % partial borders styles
15767 % this can be "none" or 4 numbers saying the style for each part:
15768 % 0 --- nothing, 1 --- solid, 2 --- dashed
15769 \ctikzset{transistor circle/partial borders/.initial=none} % Value none for normal borders
15770 \ctikzset{transistor circle/partial border dash/.initial={{2pt}{2pt}}}
15771 %
15772 % body diode style
15773 \ctikzset{transistor bodydiode/.is family}
15774 \ctikzset{transistor bodydiode/relative thickness/.initial=1}
15775 \ctikzset{transistor bodydiode/color/.initial=default}
15776 \ctikzset{transistor bodydiode/dash/.initial=default}
15777 \ctikzset{transistor bodydiode/dot scale/.initial=0.7}
15778 \ctikzset{transistor solderdot scale/.initial=0.7}
15779 % this is unfortunate, but needed for backward compatibility
15780 \ctikzset{transistor bodydiode/scale/.code={%
15781 \ctikzset{tripoles/nmos/bodydiode scale=#1}%
15782 \ctikzset{tripoles/pmos/bodydiode scale=#1}%
15783 \ctikzset{tripoles/nmosd/bodydiode scale=#1}%
15784 \ctikzset{tripoles/pmosd/bodydiode scale=#1}%
15785 \ctikzset{tripoles/hemt/bodydiode scale=#1}%
15786 \ctikzset{tripoles/nfet/bodydiode scale=#1}%
15787 \ctikzset{tripoles/pfet/bodydiode scale=#1}%
15788 \ctikzset{tripoles/nfetd/bodydiode scale=#1}%
15789 \ctikzset{tripoles/pfetd/bodydiode scale=#1}%
15790 \ctikzset{tripoles/nigfete/bodydiode scale=#1}%
15791 \ctikzset{tripoles/nigfetd/bodydiode scale=#1}%
15792 \ctikzset{tripoles/nigfetebulk/bodydiode scale=#1}%
15793 \ctikzset{tripoles/pigfete/bodydiode scale=#1}%
15794 \ctikzset{tripoles/pigfetd/bodydiode scale=#1}%
15795 \ctikzset{tripoles/pigfetebulk/bodydiode scale=#1}%
15796 \ctikzset{tripoles/npn/bodydiode scale=#1}%
15797 \ctikzset{tripoles/pnp/bodydiode scale=#1}%
15798 \ctikzset{tripoles/pigbt/bodydiode scale=#1}%
15799 \ctikzset{tripoles/nigbt/bodydiode scale=#1}%
15800 \ctikzset{tripoles/Lpigbt/bodydiode scale=#1}%
15801 \ctikzset{tripoles/Lnigbt/bodydiode scale=#1}%
15802 \ctikzset{tripoles/njfet/bodydiode scale=#1}%
15803 \ctikzset{tripoles/pjfet/bodydiode scale=#1}%
15804 \ctikzset{tripoles/nujt/bodydiode scale=#1}%
15805 \ctikzset{tripoles/pujt/bodydiode scale=#1}%
15806 \ctikzset{tripoles/isfet/bodydiode scale=#1}%
15807 \ctikzset{tripoles/pgfet/bodydiode scale=#1}%
15808 \ctikzset{tripoles/ngfet/bodydiode scale=#1}%
15809 }}
15810 %%>>>
15811
15812
15813 %% definitions of transistor shapes%<<<
15814 %
15815 % draw partial transistor outline
15816 %
15817 \def\pgf@circ@trcircle@split#1#2#3#4\relax{%split the six numbers
15818 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}%
15819 }
15820 \def\pgf@circ@trcircle@setdash{%
15821 \edef\@@dash{\ctikzvalof{transistor circle/partial border dash}}%
15822 % \typeout{DASH:\@@dash}%
15823 \expandafter\pgfsetdash\expandafter{\@@dash}{0pt}%
15824 }
15825 % this is the same as the tubes' one, but let's keep it separated
15826 \def\pgf@circ@trcircle@draw@style#1{%
15827 \ifcase#1
15828 \pgfusepath{discard}% case 0, will discard the path
15829 \or
15830 \pgfsetdash{}{0pt}\pgfusepath{draw}% case 1, solid
15831 \or
15832 \pgf@circ@trcircle@setdash\pgfusepath{draw}% case 2, dashed
15833 \else
15834 \pgfutil@packagewarning{circuitikz}{Transistor circle draw style not known!}%
15835 \pgfusepath{draw}%
15836 \fi
15837 }
15838 %
15839 % add a circle to the transistor:
15840 \def\pgf@circ@trcircle@draw@partial#1{%
15841 \expandafter\pgf@circ@trcircle@split#1\relax
15842 % \typeout{PARTIAL: \@@a:\@@b:\@@c:\@@d}
15843 \pgfscope % right side upper arc
15844 \pgfpathmoveto{\pgfpoint{\circleleft+\circleradius}{\circleradius}}
15845 \pgfpatharc{90}{0}{\circleradius}
15846 \pgf@circ@trcircle@draw@style{\@@a}
15847 \endpgfscope
15848 \pgfscope % right side lower arc
15849 \pgfpathmoveto{\pgfpoint{\circleleft+2*\circleradius}{0pt}}
15850 \pgfpatharc{0}{-90}{\circleradius}
15851 \pgf@circ@trcircle@draw@style{\@@b}
15852 \endpgfscope
15853 \pgfscope % left side lower arc
15854 \pgfpathmoveto{\pgfpoint{\circleleft+\circleradius}{-\circleradius}}
15855 \pgfpatharc{-90}{-180}{\circleradius}
15856 \pgf@circ@trcircle@draw@style{\@@c}
15857 \endpgfscope
15858 \pgfscope % left side upper arc
15859 \pgfpathmoveto{\pgfpoint{\circleleft}{0pt}}
15860 \pgfpatharc{-180}{-270}{\circleradius}
15861 \pgf@circ@trcircle@draw@style{\@@d}
15862 \endpgfscope
15863 }
15864 %
15865 \def\pgfcirc@transistorcircle{
15866 \ifpgf@circ@trcircle
15867 \pgfscope
15868 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15869 \pgfsetlinewidth{\ctikzvalof{transistor circle/relative thickness}\pgflinewidth}
15870 \pgf@circ@subset@color@dash{transistor circle}
15871 % radius of the circle
15872 % \pgfmathsetlength{\pgf@circ@res@temp}{((#2+\extrabodydiodelen)-(#1)+(#3)*(#3)/((#2+\extrabodydiodelen)-(#1)))/2}
15873 % \pgfpathcircle{\pgfpoint{#1+\pgf@circ@res@temp}{0pt}}{\pgf@circ@res@temp}
15874 \pgfpathcircle{\pgfpoint{\circleleft+\circleradius}{0pt}}{\circleradius}
15875 \edef\@@partial{\ctikzvalof{transistor circle/partial borders}}
15876 \ifx\@@partial\pgf@nonetext
15877 % Circle fill and draw if it's not partial... for speed
15878 \pgf@circ@draworfill
15879 \else
15880 % otherwise, just fill and do the partial fill
15881 \pgf@circ@maybefill
15882 \pgf@circ@trcircle@draw@partial{\@@partial}
15883 \fi
15884 \endpgfscope
15885 \fi
15886 }
15887
15888 % add a ferroelectric squish to transistors
15889
15890 \def\pgfcirc@ferroelectric#1#2{% #1 -> transistor type, #2 horizontal enlargment (prop to ...@left),
15891 \ifpgf@circuit@tr@ferroel\pgfscope
15892 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
15893 \pgf@circ@set@relative@thickness{modifier thickness}
15894 % base-gate center and width of the sigmoid
15895 \pgfmathsetlength{\pgf@circ@res@other}
15896 {0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width}-(#2))*\pgf@circ@res@left}
15897 \pgfmathsetlength{\pgf@circ@res@temp}
15898 {1.2*abs(\ctikzvalof{tripoles/#1/gate width}-\ctikzvalof{tripoles/#1/base width}+0.5*(#2))*\pgf@circ@res@left}
15899 \pgfsetcornersarced{\pgfpoint{-0.2\pgf@circ@res@temp}{-0.2\pgf@circ@res@temp}}
15900 \pgfpathmoveto{\pgfpoint
15901 {\pgf@circ@res@other+\pgf@circ@res@temp}
15902 {1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}}
15903 \pgfpathlineto{\pgfpoint
15904 {\pgf@circ@res@other+\pgf@circ@res@temp}
15905 {0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@up}}
15906 \pgfpathlineto{\pgfpoint
15907 {\pgf@circ@res@other-\pgf@circ@res@temp}
15908 {0.5*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}}
15909 \pgfpathlineto{\pgfpoint
15910 {\pgf@circ@res@other-\pgf@circ@res@temp}
15911 {1.1*\ctikzvalof{tripoles/#1/base height}*\pgf@circ@res@down}}
15912 \pgfusepath{draw}
15913 \endpgfscope\fi
15914 }
15915
15916 \ctikzset{tr gap fill/.initial=none}
15917 \tikzset{tr gap fill/.style={\circuitikzbasekey/tr gap fill={#1}}}
15918 % fill the gap in relevant transistors
15919 \def\pgfcirc@fillgategap#1{% #1 transistor type
15920 \edef\@@@none{none}\edef\@@@color{\ctikzvalof{tr gap fill}}% always exists
15921 \ifx\@@@none\@@@color\relax\else
15922 \begingroup % save the value of @res: other, step, temp
15923 \edef\@@@doit{1}% draw it, set to zero if we give up
15924 % ok, we have the color here. we have to get center position, with and height
15925 % normally is gate height; but in igbt is outer base height (grrrr)
15926 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/outer base height}{
15927 % yes, it's an IGBT
15928 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/outer base height}*\pgf@circ@res@up}
15929 }{
15930 %no. Let's try with gate height
15931 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate height}{
15932 % yes, go for it
15933 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{tripoles/#1/gate height}*\pgf@circ@res@up}
15934 }{
15935 %no, give up, let value to 0
15936 \edef\@@@doit{0}
15937 }
15938 }
15939 % now we have to find x1 and x2: these are base width and gate width
15940 % if do not have one of that, bail out.
15941 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{
15942 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{tripoles/#1/gate width}*\pgf@circ@res@left}
15943 }{
15944 \edef\@@@doit{0}
15945 }
15946 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/base width}{
15947 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{tripoles/#1/base width}*\pgf@circ@res@left}
15948 }{
15949 \edef\@@@doit{0}
15950 }
15951 % if found, draw it.
15952 \ifnum\@@@doit>0\relax
15953 \pgfscope
15954 \pgfsetfillcolor{\@@@color}
15955 \pgfsetcolor{\@@@color}
15956 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@other}}
15957 \pgfusepath{fill, draw}
15958 \endpgfscope
15959 \fi
15960 \endgroup
15961 \fi
15962 }
15963
15964 \long\def\pgfcircdeclaretransistor#1#2#3{
15965 \pgfdeclareshape{#1}
15966 {
15967 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
15968 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
15969 \savedmacro{\circlebase}{
15970 \pgfkeysifdefined{\circuitikzbasekey/transistor circle/#1 base in}%
15971 {% yes, we have it
15972 \edef\circlebase{\ctikzvalof{transistor circle/#1 base in}}%
15973 }{% no, use default
15974 \edef\circlebase{\ctikzvalof{transistor circle/default base in}}
15975 }}
15976 % \savedmacro{\thistypeoftr}{\edef\thistypeoftr{#1}}
15977 \saveddimen{\extrabodydiodelen}{
15978 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15979 \ifpgf@circuit@fet@bodydiode
15980 % try to put the text to the right of the flyback diode
15981 \pgfmathsetlength{\pgf@x}{(
15982 \ctikzvalof{tripoles/#1/bodydiode distance}*
15983 \ctikzvalof{tripoles/#1/width} +
15984 \ctikzvalof{tripoles/#1/bodydiode scale}*
15985 \ctikzvalof{bipoles/diode/height}/2
15986 )*\pgf@circ@scaled@Rlen}
15987 \else
15988 \pgf@x=0pt\relax
15989 \fi
15990 }
15991 \savedmacro{\scalecircleradius}{
15992 \edef\scalecircleradius{\ctikzvalof{transistor circle/scale circle radius}}
15993 }
15994 \saveddimen{\circleradius}{
15995 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
15996 % repeat the extrabodydiodelen (grrr)
15997 \ifpgf@circuit@fet@bodydiode
15998 % try to put the text to the right of the flyback diode
15999 \pgfmathsetlength{\pgf@circ@res@other}{(
16000 \ctikzvalof{tripoles/#1/bodydiode distance}*
16001 \ctikzvalof{tripoles/#1/width} +
16002 \ctikzvalof{tripoles/#1/bodydiode scale}*
16003 \ctikzvalof{bipoles/diode/height}/2
16004 )*\pgf@circ@scaled@Rlen}
16005 \else
16006 \pgf@circ@res@other=0pt\relax
16007 \fi
16008 % left
16009 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
16010 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
16011 % northeast
16012 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
16013 \pgf@yb=.5\pgf@yb
16014 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
16015 %
16016 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
16017 % find the radius of the circle
16018 \pgfmathsetlength{\pgf@x}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
16019 }
16020 \saveddimen{\circleleft}{
16021 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16022 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
16023 \pgf@x=\circlebase\pgf@xa
16024 }
16025 \anchor{circle center}{
16026 \pgf@y=0pt\pgf@x=\circleleft\advance\pgf@x by\circleradius
16027 }
16028 \anchor{circle top}{
16029 \pgf@y=\circleradius\pgf@x=\circleleft\advance\pgf@x by\circleradius
16030 }
16031 \anchor{circle bottom}{
16032 \pgf@y=-\circleradius\pgf@x=\circleleft\advance\pgf@x by\circleradius
16033 }
16034 \anchor{circle left}{
16035 \pgf@y=0pt\pgf@x=\circleleft
16036 }
16037 \anchor{circle right}{
16038 \pgf@y=0pt\pgf@x=\circleleft
16039 \advance\pgf@x by \circleradius\advance\pgf@x by \circleradius
16040 }
16041 \savedanchor{\centergap}{% this is the center position between gate and base
16042 % get "left"
16043 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16044 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
16045 \pgfkeysifdefined{\circuitikzbasekey/tripoles/#1/gate width}{
16046 % yes, we have a separated gate
16047 \pgfmathsetlength{\pgf@x}
16048 {0.5*(\ctikzvalof{tripoles/#1/gate width}+\ctikzvalof{tripoles/#1/base width})*\pgf@xa}
16049 }{
16050 % no, use just the base
16051 \pgfmathsetlength{\pgf@x}
16052 {\ctikzvalof{tripoles/#1/base width}*\pgf@xa}
16053 }
16054 \pgf@y=0pt\relax
16055 }
16056 \anchor{centergap}{\centergap}
16057 \anchor{center}{
16058 \pgfpointorigin
16059 }
16060 \savedanchor\northeast{% upper right
16061 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16062 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
16063 \pgf@y=.5\pgf@y
16064 \pgf@x=0pt
16065 }
16066 \savedanchor\left{%center left
16067 \pgf@y=0pt
16068 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16069 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
16070 }
16071 \savedanchor\right{
16072 \pgf@x=0pt\pgf@y=0pt
16073 \ifpgf@circ@trcircle
16074 % repeat the \circleradius computation (GRRRR)
16075 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16076 % repeat the extrabodydiodelen (grrr)
16077 \ifpgf@circuit@fet@bodydiode
16078 % try to put the text to the right of the flyback diode
16079 \pgfmathsetlength{\pgf@circ@res@other}{(
16080 \ctikzvalof{tripoles/#1/bodydiode distance}*
16081 \ctikzvalof{tripoles/#1/width} +
16082 \ctikzvalof{tripoles/#1/bodydiode scale}*
16083 \ctikzvalof{bipoles/diode/height}/2
16084 )*\pgf@circ@scaled@Rlen}
16085 \else
16086 \pgf@circ@res@other=0pt\relax
16087 \fi
16088 % left
16089 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
16090 \pgf@xa=\circlebase\pgf@xa % this is the base point of the circle
16091 % northeast
16092 \pgf@yb=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen % y of the left point of circle
16093 \pgf@yb=.5\pgf@yb
16094 \pgf@xb=\pgf@circ@res@other % this is the x of the right points of the circle
16095 %
16096 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@yb %this is #3 of the circle
16097 % find the radius of the circle
16098 \pgfmathsetlength{\pgf@circ@res@other}{((\pgf@xb)-(\pgf@xa)+(\pgf@yb)*(\pgf@yb)/((\pgf@xb)-(\pgf@xa)))/2*\scalecircleradius}
16099 % repeat the circleleft computation
16100 \pgf@xa=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
16101 \pgf@xb=\circlebase\pgf@xa
16102 \pgfmathsetlength{\pgf@x}{\pgf@xb+2*\pgf@circ@res@other}
16103 \fi
16104 }
16105 \anchor{text}{
16106 \northeast
16107 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16108 \ifpgf@circuit@transisors@fixlabels
16109 \ifpgf@circuit@fet@bodydiode
16110 \advance \pgf@x by \extrabodydiodelen
16111 \fi
16112 \ifpgf@circ@trcircle
16113 \left\pgf@xa=\pgf@x
16114 \pgfmathsetlength{\pgf@x}{\circleleft+2*\circleradius}
16115 % \advance \pgf@x by \circleradius
16116 \fi
16117 % add a bit of space to avoid central (substrate) terminal if drawn
16118 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
16119 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
16120 \else
16121 \pgf@y=.7\pgf@y
16122 \pgf@x= \pgf@circ@scaled@Rlen
16123 \pgf@x=0.1\pgf@x
16124 \fi
16125 }
16126 \anchor{pathstart}{ % south
16127 \northeast
16128 \pgf@y=-\pgf@y
16129 }
16130 \anchor{pathend}{
16131 \northeast
16132 }
16133 \anchor{north}{
16134 \northeast
16135 \pgf@circ@res@step=\pgf@y
16136 \left
16137 \pgf@y=\pgf@circ@res@step
16138 \pgf@x=.5\pgf@x
16139 }
16140 \anchor{west}{
16141 \left
16142 }
16143 \anchor{left}{
16144 \left
16145 }
16146 \anchor{east}{
16147 \northeast
16148 \pgf@y=0pt
16149 }
16150 \anchor{right}{
16151 \right
16152 }
16153 \anchor{south}{
16154 \northeast
16155 \pgf@circ@res@step=\pgf@y
16156 \left
16157 \pgf@y=-\pgf@circ@res@step
16158 \pgf@x=.5\pgf@x
16159 }
16160 \anchor{south west}{
16161 \northeast
16162 \pgf@circ@res@step=\pgf@y
16163 \left
16164 \pgf@y=-\pgf@circ@res@step
16165 }
16166 \anchor{north east}{
16167 \northeast
16168 }
16169 \anchor{north west}{
16170 \northeast
16171 \pgf@circ@res@step=\pgf@y
16172 \left
16173 \pgf@y=\pgf@circ@res@step
16174 }
16175 \anchor{south east}{
16176 \northeast
16177 \pgf@y=-\pgf@y
16178 }
16179 \anchor{B}{
16180 \northeast
16181 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16182 \left
16183 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16184 }
16185 \anchor{base}{
16186 \northeast
16187 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16188 \left
16189 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16190 }
16191 \anchor{bulk}{ %added by Burak Kelleci
16192 \northeast
16193 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16194 \right
16195 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16196 }
16197 \anchor{nobulk}{ %added by Burak Kelleci
16198 \left
16199 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
16200 }
16201 \anchor{G}{
16202 \northeast
16203 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16204 \left
16205 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16206 }
16207 \anchor{G1}{
16208 \northeast
16209 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16210 \left
16211 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16212 }
16213 \anchor{G2}{
16214 \northeast
16215 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16216 \pgf@circ@res@step=-0.3333333\pgf@circ@res@step
16217 \left
16218 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16219 }
16220 \anchor{gate}{
16221 \northeast
16222 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16223 \left
16224 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16225 }
16226 \anchor{gate1}{
16227 \northeast
16228 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16229 \left
16230 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16231 }
16232 \anchor{gate2}{
16233 \northeast
16234 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn height}\pgf@y
16235 \pgf@circ@res@step=-0.3333333\pgf@circ@res@step
16236 \left
16237 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@circ@res@step
16238 }
16239 \anchor{nobase}{
16240 \left
16241 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@x
16242 }
16243 \anchor{circle base}{
16244 \left
16245 \pgf@x=\circlebase\pgf@x
16246 }
16247 \anchor{nogate}{
16248 \left
16249 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
16250 }
16251 \anchor{E}{
16252 \northeast
16253 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16254 }
16255 \anchor{emitter}{
16256 \northeast
16257 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16258 }
16259 \anchor{C}{
16260 \northeast
16261 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16262 }
16263 \anchor{collector}{
16264 \northeast
16265 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16266 }
16267 \anchor{S}{
16268 \northeast
16269 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16270 }
16271 \anchor{source}{
16272 \northeast
16273 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16274 }
16275 \anchor{D}{
16276 \northeast
16277 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16278 }
16279 \anchor{drain}{
16280 \northeast
16281 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16282 }
16283 \anchor{body C in}{
16284 \northeast
16285 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16286 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
16287 }
16288 \anchor{circle C}{
16289 \left
16290 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
16291 \northeast
16292 \pgf@xb=\pgf@x %this is #2 of the circle
16293 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
16294 % the base of the triangle is x_2 - x_1 - r
16295 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
16296 % so let's go with the height
16297 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
16298 % finally, direction
16299 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
16300 }
16301 \anchor{circle E}{
16302 \left
16303 \pgf@xa=\circlebase\pgf@x % this is #1 of the circle
16304 \northeast
16305 \pgf@xb=\pgf@x %this is #2 of the circle
16306 \pgf@yb=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y %this is #3 of the circle
16307 % the base of the triangle is x_2 - x_1 - r
16308 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@xb-\pgf@xa-\circleradius}
16309 % so let's go with the height
16310 \pgfmathsetlength{\pgf@ya}{sqrt(abs(\circleradius*\circleradius-\pgf@circ@res@other*\pgf@circ@res@other))}
16311 % finally, direction
16312 % finally, direction
16313 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
16314 }
16315 \anchor{body E in}{
16316 \northeast
16317 \pgf@y=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16318 \pgf@y=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@y
16319 }
16320 \anchor{body C out}{
16321 \northeast
16322 \pgf@ya=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16323 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
16324 \pgf@y=\pgf@ya
16325 \left
16326 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
16327 \pgf@y=\pgf@ya
16328 }
16329 \anchor{body E out}{
16330 \northeast
16331 \pgf@ya=-\ctikzvalof{tripoles/#1/curr direction}\pgf@y
16332 \pgf@ya=\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@ya
16333 \pgf@y=\pgf@ya
16334 \left
16335 \pgf@x=-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@x
16336 \pgf@y=\pgf@ya
16337 }
16338 #2%
16339 \pgf@circ@draw@component{
16340 \pgftransformationadjustments
16341 \pgf@circ@setcolor
16342 %
16343 \ifnum \ctikzvalof{tripoles/#1/curr direction} > 0
16344 \pgf@circuit@trans@ntypetrue
16345 \else
16346 \pgf@circuit@trans@ntypefalse
16347 \fi
16348 \northeast
16349 \pgf@circ@res@up = \pgf@y
16350 \pgf@circ@res@down = -\pgf@y
16351 \pgf@circ@res@right = \pgf@x
16352 \left
16353 \pgf@circ@res@left = \pgf@x
16354 \pgf@circ@scaled@Rlen=\scaledRlen
16355 %
16356 #3%
16357 % BODY DIODE
16358 \ifpgf@circuit@fet@bodydiode
16359 \drawbodydiode{#1}
16360 \fi
16361 %
16362 }
16363 }
16364 }
16365
16366 \def\drawdobydiodedot#1#2{
16367 % retrieve dot scale
16368 \edef\@@tmp{\ctikzvalof{transistor bodydiode/dot scale}}
16369 \ifdim\@@tmp pt>0pt
16370 \pgfscope
16371 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}
16372 {\ctikzvalof{tripoles/#1/bodydiode conn}#2}}
16373 \pgftransformscale{\@@tmp}
16374 % I'm not sure why this is needed, but...
16375 \pgf@circ@maybe@color{transistor bodydiode/color}
16376 \pgfnode{circ}{center}{}{}{\pgfusepath{draw,fill}}
16377 \endpgfscope
16378 \fi
16379 }
16380
16381 \long\def\drawbodydiode#1{
16382 \pgfsetlinewidth{\ctikzvalof{transistor bodydiode/relative thickness}\pgflinewidth}
16383 \pgf@circ@subset@color@dash{transistor bodydiode}
16384 \pgfscope
16385 \pgftransformshift{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\pgf@circ@res@up+\pgf@circ@res@down}}
16386 \pgftransformrotate{90}
16387 % diode scale and bodydiode scale interacts. We want the size of the diode
16388 % proportional to the transistor, so we will:
16389 % 1) undo diode scale 2) apply transistor scale (using the current class) 3) apply bodydiode scale
16390 \pgfmathsetmacro{\@@BDscale}{\ctikzvalof{tripoles/#1/bodydiode scale}* \ctikzvalof{\ctikzclass/scale}/\ctikzvalof{diodes/scale}}
16391 \pgftransformscale{\@@BDscale}
16392 \ifpgf@circuit@fulldiode
16393 % I'm not sure why this is needed, but...
16394 \pgf@circ@maybe@color{transistor bodydiode/color}
16395 \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
16396 \else
16397 \pgfnode{emptydiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
16398 \fi
16399 \endpgfscope
16400 % Draw stroke line
16401 \ifpgf@circuit@strokediode
16402 \pgfpathmoveto{\pgfpointanchor{pgf@bodydiode}{west}}
16403 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
16404 \pgfusepath{stroke}
16405 \fi
16406 %Draw upper connection to body diode
16407 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
16408 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
16409 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}
16410 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@up}}
16411 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{east}}
16412 \pgfusepath{draw}
16413 \drawdobydiodedot{#1}{\pgf@circ@res@up}
16414 %Draw lower connection to body diode
16415 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
16416 {\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
16417 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tripoles/#1/bodydiode distance}\pgf@circ@res@left}{\ctikzvalof{tripoles/#1/bodydiode conn}\pgf@circ@res@down}}
16418 \pgfpathlineto{\pgfpointanchor{pgf@bodydiode}{west}}
16419 \pgfusepath{draw}
16420 \drawdobydiodedot{#1}{\pgf@circ@res@down}
16421 }
16422
16423 \long\def\declarebpt#1{
16424 \pgfcircdeclaretransistor{#1}{
16425 \anchor{inner up}{
16426 \northeast
16427 \pgf@y=\ctikzvalof{tripoles/#1/base height}\pgf@y
16428 }
16429 \anchor{inner down}{
16430 \northeast
16431 \pgf@y=-\ctikzvalof{tripoles/#1/base height}\pgf@y
16432 }
16433 \anchor{arrows}{
16434 \northeast
16435 \pgf@circ@res@up = \pgf@y
16436 \left
16437 \pgf@circ@res@left = \pgf@x
16438 \pgf@x=\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left
16439 \advance\pgf@x by 0.6\pgf@circ@res@left
16440 \pgf@y=0.2\pgf@circ@res@up
16441 }
16442 }{
16443 % add the circle if requested (before everything else, so we can fill it)
16444 \pgfcirc@transistorcircle
16445
16446 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16447 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16448 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
16449 \pgfpathlineto{\pgfpoint
16450 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16451 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}}
16452 \pgfusepath{draw}
16453
16454 % drawing base
16455 \pgfscope
16456 \pgfpathmoveto{\pgfpoint
16457 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16458 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
16459 \pgfpathlineto{\pgfpoint
16460 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16461 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
16462 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16463 \ifpgf@circuit@bpt@schottky
16464 % upper
16465 \pgfpathmoveto{\pgfpoint
16466 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16467 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
16468 \pgfpathlineto{\pgfpoint
16469 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16470 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
16471 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16472 \pgfpathlineto{\pgfpoint
16473 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
16474 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16475 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+
16476 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16477 \pgfpathlineto{\pgfpoint
16478 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left+
16479 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16480 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
16481 % % lower
16482 \pgfpathmoveto{\pgfpoint
16483 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16484 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
16485 \pgfpathlineto{\pgfpoint
16486 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16487 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
16488 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16489 \pgfpathlineto{\pgfpoint
16490 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
16491 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16492 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-
16493 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16494 \pgfpathlineto{\pgfpoint
16495 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left-
16496 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16497 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
16498 \fi
16499 \pgfusepath{draw}
16500 \endpgfscope
16501
16502 \pgfpathmoveto{\pgfpoint
16503 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16504 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}}
16505 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16506 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
16507 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16508 \pgfusepath{draw}
16509 %draw arrow depending on type of transistor
16510 \pgfscope
16511 \pgfslopedattimetrue
16512 \pgfallowupsidedownattimetrue
16513 \pgfresetnontranslationattimefalse
16514 \edef\@@anchor{center}
16515 \ifpgf@circuit@trans@ntype
16516 \ifpgf@circuit@trans@arrowatend
16517 \edef\@@anchor{btip}
16518 \pgftransformlineattime{1.0}{%
16519 \pgfpoint%
16520 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16521 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
16522 }{%
16523 \pgfpoint{\pgf@circ@res@right}%
16524 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
16525 }
16526 \else
16527 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
16528 \pgfpoint%
16529 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16530 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@down}%
16531 }{%
16532 \pgfpoint{\pgf@circ@res@right}%
16533 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}%
16534 }
16535 \fi
16536 \else % p-type
16537 \ifpgf@circuit@trans@arrowatend
16538 \edef\@@anchor{tip}
16539 \pgftransformlineattime{1.0}{%
16540 \pgfpoint{\pgf@circ@res@right}%
16541 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
16542 }{%
16543 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16544 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
16545 }
16546 \else
16547 \pgftransformlineattime{\ctikzvalof{tripoles/#1/arrow pos}}{%
16548 \pgfpoint{\pgf@circ@res@right}%
16549 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}%
16550 }{%
16551 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
16552 {\ctikzvalof{tripoles/#1/base height 2}\pgf@circ@res@up}%
16553 }
16554 \fi
16555 \fi
16556 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
16557 \endpgfscope
16558
16559 \ifpgf@circuit@bpt@drawphoto
16560 \pgfscope
16561 \pgf@circ@fill@strokecolor
16562 \pgf@circ@set@optoarrow@style
16563 \pgfpathmoveto{\pgfpoint
16564 {(0.5+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left}
16565 {0.3\pgf@circ@res@up}}
16566 \pgfpathlineto{\pgfpoint
16567 {(0.05+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left}
16568 {0.1\pgf@circ@res@up}}
16569 \pgfusepath{draw}
16570 \pgfpathmoveto{\pgfpoint
16571 {(0.5+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left}
16572 {0.1\pgf@circ@res@up}}
16573 \pgfpathlineto{\pgfpoint
16574 {(0.05+\ctikzvalof{tripoles/#1/base width})*\pgf@circ@res@left}
16575 {-0.1\pgf@circ@res@up}}
16576 \pgfusepath{draw}
16577 \endpgfscope
16578 \else
16579 \ifpgf@circuit@bpt@drawbase
16580 \pgfpathmoveto{\pgfpoint
16581 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16582 {\pgf@circ@res@up+\pgf@circ@res@down}}
16583 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
16584 \pgfusepath{draw}
16585 \fi
16586 \fi
16587 }
16588 }
16589
16590 \declarebpt{npn}
16591 \declarebpt{pnp}
16592 %
16593 % multi-emitter and multi-collector BJTs by Romano Giannetti
16594 %
16595 \def\pgf@circ@bjt@C@anchor#1{% #1: collector number
16596 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
16597 \pgfextracty{\pgf@circ@res@other}{\basedimension}
16598 \ifnum\cdir>0 % NPN, above
16599 \pgfpoint{\pgf@circ@res@temp}{%
16600 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
16601 \else % PNP, below
16602 \pgfpoint{\pgf@circ@res@temp}{%
16603 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
16604 \fi
16605 }
16606 \def\pgf@circ@bjt@E@anchor#1{% #1: collector number
16607 \pgfextractx{\pgf@circ@res@temp}{\basedimension}
16608 \pgfextracty{\pgf@circ@res@other}{\basedimension}
16609 \ifnum\cdir<0 % PNP, above
16610 \pgfpoint{\pgf@circ@res@temp}{%
16611 \pgf@circ@res@other+\pgfverticaltransformationadjustment*.5*\pgflinewidth+(#1-1)*\multistep}
16612 \else % PNP, below
16613 \pgfpoint{\pgf@circ@res@temp}{%
16614 -\pgf@circ@res@other-\pgfverticaltransformationadjustment*.5*\pgflinewidth-(#1-1)*\multistep}
16615 \fi
16616 }
16617
16618 \long\def\declarebjt#1{
16619 \pgfdeclareshape{bjt#1}{
16620 \savedmacro{\ctikzclass}{\edef\ctikzclass{transistors}}
16621 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
16622 % \cdir is 1 for npn, -1 for pnp
16623 \savedmacro{\cdir}{\edef\cdir{\ctikzvalof{tripoles/bjt/#1/curr direction}}}
16624 \savedmacro{\numE}{\edef\numE{\ctikzvalof{tripoles/bjt/emitters}}}
16625 \savedmacro{\numC}{\edef\numC{\ctikzvalof{tripoles/bjt/collectors}}}
16626 % step up or down for the additional C/Es
16627 \saveddimen{\multistep}{\pgfmathsetlength{\pgf@x}{%
16628 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
16629 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
16630 \saveddimen{\external}{\pgfmathsetlength{\pgf@x}{%
16631 \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}}
16632 \savedanchor\basedimension{% these are the dimensions if nC=1 y nE=1
16633 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16634 \pgf@y=\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
16635 \pgf@y=.5\pgf@y
16636 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
16637 \pgf@x=.5\pgf@x
16638 }
16639 \savedanchor\northeast{% upper right
16640 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16641 \pgfmathsetlength{\pgf@circ@res@step}{%
16642 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
16643 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16644 \ifnum\cdir> 0
16645 \edef\numup{\numC}\edef\numdown{\numE}
16646 \else
16647 \edef\numup{\numE}\edef\numdown{\numC}
16648 \fi
16649 \pgfmathsetlength{\pgf@y}{0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
16650 + (\numup-1)*\pgf@circ@res@step+\pgfverticaltransformationadjustment*.5*\pgflinewidth
16651 + \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16652 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
16653 \pgf@x=.5\pgf@x
16654 }
16655 \savedanchor\southeast{% lower right
16656 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16657 \pgfmathsetlength{\pgf@circ@res@step}{%
16658 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
16659 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16660 \ifnum\cdir> 0
16661 \edef\numup{\numC}\edef\numdown{\numE}
16662 \else
16663 \edef\numup{\numE}\edef\numdown{\numC}
16664 \fi
16665 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
16666 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
16667 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16668 \pgf@x=\ctikzvalof{tripoles/bjt/width}\pgf@circ@scaled@Rlen
16669 \pgf@x=.5\pgf@x
16670 }
16671 \savedanchor\southwest{% lower left
16672 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
16673 \pgfmathsetlength{\pgf@circ@res@step}{%
16674 \ctikzvalof{tripoles/bjt/height}*\ctikzvalof{tripoles/bjt/multi height}*
16675 \ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16676 \ifnum\cdir> 0
16677 \edef\numup{\numC}\edef\numdown{\numE}
16678 \else
16679 \edef\numup{\numE}\edef\numdown{\numC}
16680 \fi
16681 \pgfmathsetlength{\pgf@y}{-0.5*\ctikzvalof{tripoles/bjt/height}\pgf@circ@scaled@Rlen
16682 - (\numdown-1)*\pgf@circ@res@step-\pgfverticaltransformationadjustment*.5*\pgflinewidth
16683 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16684 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{tripoles/bjt/width}*\pgf@circ@scaled@Rlen
16685 - \ctikzvalof{tripoles/bjt/pins width}*\ctikzvalof{\ctikzclass/scale}*\pgf@circ@Rlen}
16686 }
16687 \anchor{center}{\pgfpointorigin}
16688 \anchor{north}{\northeast\pgf@x=0cm\relax}
16689 \anchor{east}{\northeast\pgf@y=0cm\relax}
16690 \anchor{south}{\southwest\pgf@x=0cm\relax}
16691 \anchor{west}{\southwest\pgf@y=0cm}
16692 \anchor{north east}{\northeast}
16693 \anchor{north west}{\northeast\pgf@ya=\pgf@y\southwest\pgf@y=\pgf@ya}
16694 \anchor{south west}{\southwest}
16695 \anchor{south east}{\southeast}
16696
16697 \anchor{text}{\northeast\pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}
16698 \anchor{B}{\northeast\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
16699 \anchor{base}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x\advance\pgf@x by -\external}
16700 \anchor{nobase}{\basedimension\pgf@y=0cm\pgf@x=-\pgf@x}
16701 % center of the base "bar"
16702 \anchor{cbase}{\basedimension\pgf@x=-\pgf@x
16703 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
16704 }
16705 % geometrical centers
16706 \anchor{vcenter}{\pgf@x=0cm\relax
16707 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
16708 }
16709 \anchor{gcenter}{%
16710 \northeast\pgf@xa=0.5\pgf@x
16711 \southwest\advance\pgf@xa by 0.5\pgf@x
16712 \pgf@x=\pgf@xa
16713 \pgfmathsetlength{\pgf@y}{\cdir*(\numC-\numE)*\multistep/2}%
16714 }
16715 % external connections
16716 \anchor{E}{
16717 \ifnum\cdir>0% npn, emitter down
16718 \southeast
16719 \else
16720 \northeast
16721 \fi
16722 }% first emitter
16723 \anchor{emitter}{\ifnum\cdir>0\southeast\else\northeast\fi}% first emitter
16724 \anchor{C}{\ifnum\cdir<0\southeast\else\northeast\fi}
16725 \anchor{collector}{\ifnum\cdir<0\southeast\else\northeast\fi}
16726
16727 \pgf@circ@draw@component{
16728 \pgftransformationadjustments
16729 \pgf@circ@setcolor
16730 %
16731 % set the type and up and down number of connections
16732 %
16733 \ifnum\cdir> 0
16734 \pgf@circuit@trans@ntypetrue
16735 \edef\numup{\numC}
16736 \edef\numdown{\numE}
16737 \else
16738 \pgf@circuit@trans@ntypefalse
16739 \edef\numup{\numE}
16740 \edef\numdown{\numC}
16741 \fi
16742 \basedimension
16743 \pgf@circ@res@up = \pgf@y
16744 \pgf@circ@res@down = -\pgf@y
16745 \pgf@circ@res@right = \pgf@x
16746 \pgf@circ@res@left = -\pgf@x
16747 \pgf@circ@scaled@Rlen=\scaledRlen
16748 \pgf@circ@res@step=\multistep
16749 %
16750 % set arrow positions options
16751 %
16752 \edef\@@anchor{center}\edef\@@pos{\ctikzvalof{tripoles/#1/arrow pos}}
16753 \ifpgf@circuit@trans@arrowatend
16754 \edef\@@pos{1.0}
16755 \ifpgf@circuit@trans@ntype % arrow is toward outside, push it a bit
16756 \edef\@@anchor{btip}
16757 \else
16758 \edef\@@anchor{tip}
16759 \fi
16760 \fi
16761 %
16762 % Drawing upper connections
16763 %
16764 \pgfscope
16765 \pgf@circ@count@a=\numup\relax
16766 \pgfmathloop%
16767 \ifnum\pgf@circ@count@a>0
16768 \advance\pgf@circ@count@a-1\relax
16769 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
16770 \ifnum\pgf@circ@count@a=\numexpr\numup-1\relax % draw the external pin connection
16771 \pgfpathmoveto{\pgfpoint
16772 {\pgf@circ@res@right}%
16773 {\pgf@circ@res@up+\external+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
16774 \pgfpathlineto{\pgfpoint
16775 {\pgf@circ@res@right}%
16776 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
16777 \else
16778 \pgfpathmoveto{\pgfpoint
16779 {\pgf@circ@res@right}%
16780 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}}%
16781 \fi
16782 \pgfpathlineto{\pgfpoint
16783 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
16784 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}}%
16785 \pgfsetroundcap % better when connecting to sloped lines
16786 \pgfusepath{draw}
16787 \ifpgf@circuit@trans@ntype\else % it's a PNP; draw arrow
16788 \pgfscope
16789 \pgfslopedattimetrue
16790 \pgfallowupsidedownattimetrue
16791 \pgfresetnontranslationattimefalse
16792 \pgftransformlineattime{\@@pos}{%
16793 \pgfpoint
16794 {\pgf@circ@res@right}%
16795 {\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth+\pgf@circ@res@other}%
16796 }{\pgfpoint
16797 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
16798 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@up+\pgf@circ@res@other}%
16799 }
16800 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
16801 \endpgfscope
16802 \fi
16803 \repeatpgfmathloop
16804 \endpgfscope
16805 %
16806 % Drawing base
16807 %
16808 \pgfscope
16809 \pgfpathmoveto{\pgfpoint
16810 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16811 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
16812 \pgfpathlineto{\pgfpoint
16813 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16814 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
16815 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16816 \ifpgf@circuit@bpt@schottky
16817 % upper
16818 \pgfpathmoveto{\pgfpoint
16819 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16820 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
16821 \pgfpathlineto{\pgfpoint
16822 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16823 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
16824 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16825 \pgfpathlineto{\pgfpoint
16826 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
16827 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16828 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep+
16829 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16830 \pgfpathlineto{\pgfpoint
16831 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left+
16832 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16833 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@up+(\numup-1)*\multistep}}
16834 % lower
16835 \pgfpathmoveto{\pgfpoint
16836 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16837 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
16838 \pgfpathlineto{\pgfpoint
16839 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16840 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
16841 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16842 \pgfpathlineto{\pgfpoint
16843 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
16844 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16845 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep-
16846 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}}
16847 \pgfpathlineto{\pgfpoint
16848 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-
16849 \ctikzvalof{tripoles/schottky base size}\pgf@circ@scaled@Rlen}
16850 {\ctikzvalof{tripoles/bjt/base height}\pgf@circ@res@down-(\numdown-1)*\multistep}}
16851 \fi
16852 \pgfsetroundcap % I like it more...
16853 \pgfusepath{draw}
16854 \endpgfscope
16855 %
16856 % draw base external connection
16857 %
16858 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}{0pt}}
16859 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left-\external}{0pt}}
16860 \pgfusepath{draw}
16861 %
16862 % Drawing lower connections
16863 %
16864 \pgfscope
16865 \pgf@circ@count@a=\numdown\relax
16866 \pgfmathloop%
16867 \ifnum\pgf@circ@count@a>0
16868 \advance\pgf@circ@count@a-1\relax
16869 \pgfmathsetlength{\pgf@circ@res@other}{\the\pgf@circ@count@a*\multistep}%
16870 \pgfpathmoveto{\pgfpoint
16871 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}
16872 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}}
16873 \pgfpathlineto{\pgfpoint
16874 {\pgf@circ@res@right}
16875 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}}
16876 \ifnum\pgf@circ@count@a=\numexpr\numdown-1\relax % draw the external pin connection
16877 \pgfpathlineto{\pgfpoint
16878 {\pgf@circ@res@right}
16879 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other-\external}}
16880 \fi
16881 \pgfsetroundcap % better when connecting to sloped lines
16882 \pgfusepath{draw}
16883 \ifpgf@circuit@trans@ntype % it's a NPN; draw arrow
16884 \pgfscope
16885 \pgfslopedattimetrue
16886 \pgfallowupsidedownattimetrue
16887 \pgfresetnontranslationattimefalse
16888 \pgftransformlineattime{\@@pos}{%
16889 \pgfpoint
16890 {\ctikzvalof{tripoles/bjt/base width}\pgf@circ@res@left}%
16891 {\ctikzvalof{tripoles/bjt/base height 2}\pgf@circ@res@down-\pgf@circ@res@other}%
16892 }{\pgfpoint
16893 {\pgf@circ@res@right}%
16894 {\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth-\pgf@circ@res@other}%
16895 }
16896 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
16897 \endpgfscope
16898 \fi
16899 \repeatpgfmathloop
16900 \endpgfscope
16901 }
16902 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
16903 % and is executed just before a node is drawn.
16904 \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@bjt#1\endcsname{%
16905 % Start with the maximum collector number and go backwards.
16906 \pgf@circ@count@a=\numC\relax
16907 \pgfmathloop%
16908 \ifnum\pgf@circ@count@a>0
16909 % we will create two anchors per pin: the "normal one" like `pin 1` for the
16910 % electrical contact, and the "border one" like `bpin 1` for labels.
16911 % they will coincide if `external pins width` is set to 0.
16912 \expandafter\xdef\csname pgf@anchor@bjt#1@C\the\pgf@circ@count@a\endcsname{%
16913 \noexpand\pgf@circ@bjt@C@anchor{\the\pgf@circ@count@a}%
16914 }
16915 \advance\pgf@circ@count@a by -1\relax%
16916 \repeatpgfmathloop%
16917 % and emitters
16918 \pgf@circ@count@a=\numE\relax
16919 \pgfmathloop%
16920 \ifnum\pgf@circ@count@a>0
16921 % we will create two anchors per pin: the "normal one" like `pin 1` for the
16922 % electrical contact, and the "border one" like `bpin 1` for labels.
16923 % they will coincide if `external pins width` is set to 0.
16924 \expandafter\xdef\csname pgf@anchor@bjt#1@E\the\pgf@circ@count@a\endcsname{%
16925 \noexpand\pgf@circ@bjt@E@anchor{\the\pgf@circ@count@a}%
16926 }
16927 \advance\pgf@circ@count@a by -1\relax%
16928 \repeatpgfmathloop%
16929 }%
16930 }
16931 }
16932
16933 \declarebjt{npn}
16934 \declarebjt{pnp}
16935
16936 % end of multi-bjts
16937
16938 \long\def\declareigbt#1{
16939 \pgfcircdeclaretransistor{#1}{
16940 \anchor{inner up}{
16941 \northeast
16942 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
16943 }
16944 \anchor{inner down}{
16945 \northeast
16946 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
16947 }
16948 \anchor{nobase}{
16949 \left
16950 \pgf@x=\ctikzvalof{tripoles/#1/gate width}\pgf@x
16951 }
16952 }
16953 {
16954 % add the circle if requested (before everything else, so we can fill it)
16955 \pgfcirc@transistorcircle
16956 % fill the gap color if requested
16957 \pgfcirc@fillgategap{#1}
16958 %draw upper connection
16959 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16960 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16961 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
16962 \pgfpathlineto{\pgfpoint
16963 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16964 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
16965 \pgfusepath{draw}
16966
16967 %draw thicker gate lines
16968 \pgfscope
16969 \pgfscope
16970 \pgfpathmoveto{\pgfpoint
16971 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16972 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16973 \pgfpathlineto{\pgfpoint
16974 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
16975 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16976 % set the normal thickness
16977 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16978 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
16979 \pgfsetlinewidth{\@@extrat\pgflinewidth}
16980 \pgfusepath{draw}
16981 \endpgfscope
16982 \pgfpathmoveto{\pgfpoint
16983 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16984 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16985 \pgfpathlineto{\pgfpoint
16986 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16987 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
16988 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
16989 \pgfusepath{draw}
16990 \endpgfscope
16991 %draw lower connection
16992 \pgfpathmoveto{\pgfpoint
16993 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
16994 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
16995 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
16996 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
16997 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
16998 \pgfusepath{draw}
16999 %draw arrow depending on type of transistor
17000 \pgfscope
17001 \pgfslopedattimetrue
17002 \pgfallowupsidedownattimetrue
17003 \pgfresetnontranslationattimefalse
17004 \ifpgf@circuit@trans@arrowatend
17005 \ifpgf@circuit@trans@ntype
17006 \edef\@@anchor{btip}\edef\@@pos{1.0}
17007 \else
17008 \edef\@@anchor{tip}\edef\@@pos{1.0}
17009 \fi
17010 \else
17011 \edef\@@anchor{center}\edef\@@pos{0.5}
17012 \fi
17013 \ifpgf@circuit@trans@ntype
17014 \pgftransformlineattime{\@@pos}{%
17015 \pgfpoint%
17016 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
17017 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
17018 }{%
17019 \pgfpoint{\pgf@circ@res@right}%
17020 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
17021 }
17022 \else
17023 \pgftransformlineattime{\@@pos}{%
17024 \pgfpoint{\pgf@circ@res@right}%
17025 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
17026 }{%
17027 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
17028 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
17029 }
17030 \fi
17031 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
17032 \endpgfscope
17033 %draw gate
17034 \ifpgf@circuit@bpt@drawgate
17035 \ifpgf@circuit@trans@ntype
17036 \pgfpathmoveto{\pgfpoint
17037 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17038 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
17039 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
17040 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
17041 \else
17042 \pgfpathmoveto{\pgfpoint
17043 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17044 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
17045 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
17046 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
17047 \fi
17048 \fi
17049 \pgfusepath{draw}
17050 }
17051 }
17052
17053 \declareigbt{pigbt}
17054 \declareigbt{nigbt}
17055 \declareigbt{Lnigbt}
17056 \declareigbt{Lpigbt}
17057
17058 % Graphene FET, See https://github.com/circuitikz/circuitikz/issues/496
17059 \long\def\declaregfet#1{
17060 \pgfcircdeclaretransistor{#1}{
17061 \anchor{inner up}{
17062 \northeast
17063 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
17064 }
17065 \anchor{inner down}{
17066 \northeast
17067 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
17068 }
17069 \anchor{outer hex up}{
17070 \left
17071 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
17072 \northeast
17073 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
17074 \pgf@x=-\pgf@xa
17075 }
17076 \anchor{outer hex down}{
17077 \left
17078 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
17079 \northeast
17080 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
17081 \pgf@y=-\pgf@y
17082 \pgf@x=-\pgf@xa
17083 }
17084 \anchor{inner hex up}{
17085 \left
17086 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
17087 \northeast
17088 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
17089 \pgf@x=\pgf@xa
17090 }
17091 \anchor{inner hex down}{
17092 \left
17093 \pgf@xa=\ctikzvalof{tripoles/#1/base width}\pgf@x
17094 \northeast
17095 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
17096 \pgf@y=-\pgf@y
17097 \pgf@x=\pgf@xa
17098 }
17099 \anchor{right}{
17100 \northeast\pgf@y=0pt\relax
17101 \pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}*
17102 \ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen}
17103 \advance \pgf@x by \pgf@xa
17104 }
17105 \anchor{text}{% need a different text: no circle, shift to the right
17106 \northeast
17107 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
17108 \ifpgf@circuit@transisors@fixlabels
17109 \ifpgf@circuit@fet@bodydiode
17110 \advance \pgf@x by \extrabodydiodelen
17111 \else
17112 \pgfmathsetlength{\pgf@xa}{\ctikzvalof{tripoles/#1/base width}*
17113 \ctikzvalof{tripoles/#1/width}*\pgf@circ@scaled@Rlen}
17114 \advance \pgf@x by \pgf@xa
17115 \fi
17116 % no circle for gfets
17117 % add a bit of space to avoid central (substrate) terminal if drawn
17118 \advance\pgf@x by 0.05\pgf@circ@scaled@Rlen\relax
17119 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
17120 \else
17121 \pgf@y=.7\pgf@y
17122 \pgf@x= \pgf@circ@scaled@Rlen
17123 \pgf@x=0.1\pgf@x
17124 \fi
17125 }
17126 }
17127 {
17128 % no circle for gfets (clearly!)
17129 %draw upper connection to hexagon
17130 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17131 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17132 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
17133 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}
17134 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
17135 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17136 \pgfusepath{draw}
17137 % draw (fillable) hexagon
17138 \pgfscope
17139 \pgfpathmoveto{\pgfpoint
17140 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17141 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
17142 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17143 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
17144 \pgfpathlineto{\pgfpoint
17145 {-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17146 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
17147 \pgfpathlineto{\pgfpoint
17148 {-\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17149 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
17150 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17151 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
17152 \pgfpathlineto{\pgfpoint
17153 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17154 {-\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
17155 \pgfpathclose
17156 \pgf@circ@draworfill
17157 \endpgfscope
17158 %draw thicker gate lines
17159 \pgfscope
17160 \pgfscope
17161 \pgfpathmoveto{\pgfpoint
17162 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17163 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
17164 \pgfpathlineto{\pgfpoint
17165 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17166 {\ctikzvalof{tripoles/#1/outer base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
17167 % set the normal thickness
17168 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17169 \edef\@@extrat{\ctikzvalof{tripoles/#1/outer base thickness}}
17170 \pgfsetlinewidth{\@@extrat\pgflinewidth}
17171 \pgfusepath{draw}
17172 \endpgfscope
17173 \pgfpathmoveto{\pgfpoint
17174 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17175 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5\pgflinewidth}}
17176 \pgfpathlineto{\pgfpoint
17177 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17178 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5\pgflinewidth}}
17179 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17180 \pgfusepath{draw}
17181 \endpgfscope
17182 %draw arrow depending on type of transistor
17183 \pgfscope
17184 \pgfslopedattimetrue
17185 \pgfallowupsidedownattimetrue
17186 \pgfresetnontranslationattimefalse
17187 \ifpgf@circuit@trans@arrowatend
17188 \ifpgf@circuit@trans@ntype
17189 \edef\@@anchor{btip}\edef\@@pos{1.0}
17190 \else
17191 \edef\@@anchor{tip}\edef\@@pos{1.0}
17192 \fi
17193 \else
17194 \edef\@@anchor{center}\edef\@@pos{0.5}
17195 \fi
17196 \ifpgf@circuit@trans@ntype
17197 \pgftransformlineattime{\@@pos}{%
17198 \pgfpoint%
17199 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
17200 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}%
17201 }{%
17202 \pgfpoint{\pgf@circ@res@right}%
17203 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}%
17204 }
17205 \else
17206 \pgftransformlineattime{\@@pos}{%
17207 \pgfpoint{\pgf@circ@res@right}%
17208 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}%
17209 }{%
17210 \pgfpoint{\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
17211 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}%
17212 }
17213 \fi
17214 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
17215 \endpgfscope
17216 %draw gate
17217 \ifpgf@circuit@trans@ntype
17218 \pgfpathmoveto{\pgfpoint
17219 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17220 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
17221 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
17222 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@down}}
17223 \else
17224 \pgfpathmoveto{\pgfpoint
17225 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17226 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
17227 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}%
17228 {\ctikzvalof{tripoles/#1/conn height}\pgf@circ@res@up}}
17229 \fi
17230 \pgfusepath{draw}
17231 }
17232 }
17233
17234 \declaregfet{pgfet}
17235 \declaregfet{ngfet}
17236
17237 % Plain MOSes
17238
17239 \pgfcircdeclaretransistor{nmos}{
17240 \anchor{inner up}{
17241 \northeast
17242 \pgf@y=\ctikzvalof{tripoles/nmos/gate height}\pgf@y
17243 }
17244 \anchor{inner down}{
17245 \northeast
17246 \pgf@y=-\ctikzvalof{tripoles/nmos/gate height}\pgf@y
17247 }
17248 }{%
17249 % add the circle if requested (before everything else, so we can fill it)
17250 \pgfcirc@transistorcircle
17251 % fill the gap color if requested
17252 \pgfcirc@fillgategap{nmos}
17253
17254 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17255 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17256 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
17257 \pgfpathlineto{\pgfpoint
17258 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
17259 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
17260
17261 \pgfpathmoveto{\pgfpoint
17262 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
17263 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
17264 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17265 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
17266 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17267 \pgfusepath{draw}
17268
17269 \pgfscope
17270 \pgfpathmoveto{\pgfpoint
17271 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
17272 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@up}}
17273 \pgfpathlineto{\pgfpoint
17274 {\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
17275 {\ctikzvalof{tripoles/nmos/base height}\pgf@circ@res@down}}
17276 \pgfpathmoveto{\pgfpoint
17277 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
17278 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@up}}
17279 \pgfpathlineto{\pgfpoint
17280 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
17281 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}}
17282 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17283 \pgfusepath{draw}
17284 \endpgfscope
17285 \ifpgf@circuit@mos@arrows
17286 \pgfscope
17287 \ifpgf@circuit@trans@arrowatend
17288 \pgftransformshift{\pgfpoint
17289 {\pgf@circ@res@right}%
17290 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}%
17291 }
17292 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
17293 \else
17294 \pgfslopedattimetrue
17295 \pgfallowupsidedownattimetrue
17296 \pgfresetnontranslationattimefalse
17297 \pgftransformlineattime{\ctikzvalof{tripoles/nmos/arrow pos}}{%
17298 \pgfpoint%
17299 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}%
17300 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
17301 }{%
17302 \pgfpoint
17303 {\pgf@circ@res@right}%
17304 {\ctikzvalof{tripoles/nmos/gate height}\pgf@circ@res@down}%
17305 }
17306 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
17307 \fi
17308 \endpgfscope
17309 \fi
17310
17311 \ifpgf@circuit@bpt@drawgate
17312 \pgfpathmoveto{\pgfpoint
17313 {\ctikzvalof{tripoles/nmos/gate width}\pgf@circ@res@left}
17314 {\pgf@circ@res@up+\pgf@circ@res@down}}
17315 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
17316 \pgfusepath{draw}
17317 \fi
17318
17319 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
17320 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmos/base width}\pgf@circ@res@left}
17321 {\pgf@circ@res@up+\pgf@circ@res@down}}
17322 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17323 {\pgf@circ@res@up+\pgf@circ@res@down}}
17324 \pgfusepath{draw}
17325 \fi
17326
17327 \pgfcirc@ferroelectric{nmos}{0}
17328 }
17329
17330 \pgfcircdeclaretransistor{pmos}{
17331 \anchor{inner up}{
17332 \northeast
17333 \pgf@y=\ctikzvalof{tripoles/pmos/gate height}\pgf@y
17334 }
17335 \anchor{inner down}{
17336 \northeast
17337 \pgf@y=-\ctikzvalof{tripoles/pmos/gate height}\pgf@y
17338 }
17339 }{%
17340 % add the circle if requested (before everything else, so we can fill it)
17341 \pgfcirc@transistorcircle
17342 % fill the gap color if requested
17343 \pgfcirc@fillgategap{nmos}
17344
17345 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17346 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17347 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
17348 \pgfpathlineto{\pgfpoint
17349 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17350 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
17351 \pgfusepath{draw}
17352
17353 \ifpgf@circuit@mos@arrows
17354 \pgfscope
17355 \ifpgf@circuit@trans@arrowatend
17356 \pgftransformshift{\pgfpoint
17357 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}%
17358 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
17359 }
17360 \pgftransformrotate{180}
17361 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
17362 \else
17363 \pgfslopedattimetrue
17364 \pgfallowupsidedownattimetrue
17365 \pgfresetnontranslationattimefalse
17366 \pgftransformlineattime{\ctikzvalof{tripoles/pmos/arrow pos}}{%
17367 \pgfpoint%
17368 {\pgf@circ@res@right}%
17369 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
17370 }{%
17371 \pgfpoint
17372 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}%
17373 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}%
17374 }
17375 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
17376 \fi
17377 \endpgfscope
17378 \fi
17379
17380 \pgfscope
17381 \pgfpathmoveto{\pgfpoint
17382 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17383 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@up}}
17384 \pgfpathlineto{\pgfpoint
17385 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17386 {\ctikzvalof{tripoles/pmos/base height}\pgf@circ@res@down}}
17387 \pgfpathmoveto{\pgfpoint
17388 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
17389 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@up}}
17390 \pgfpathlineto{\pgfpoint
17391 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
17392 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
17393 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17394 \pgfusepath{draw}
17395 \endpgfscope
17396
17397 \pgfpathmoveto{\pgfpoint
17398 {\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17399 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
17400 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17401 {\ctikzvalof{tripoles/pmos/gate height}\pgf@circ@res@down}}
17402 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17403
17404
17405 \pgfusepath{draw}
17406 \ifpgf@circuit@bpt@drawgate
17407 \pgfpathmoveto{\pgfpoint
17408 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left}
17409 {\pgf@circ@res@up+\pgf@circ@res@down}}
17410 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
17411 \pgfusepath{draw}
17412 \fi
17413
17414 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
17415 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmos/base width}\pgf@circ@res@left}
17416 {\pgf@circ@res@up+\pgf@circ@res@down}}
17417 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17418 {\pgf@circ@res@up+\pgf@circ@res@down}}
17419 \pgfusepath{draw}
17420 \fi
17421
17422 \ifpgf@circuit@pmos@nocircle\else
17423 % we are not scaling the circle with the MOS --- I think it's better to have it
17424 % coherent with the poles/nodes of the rest of the circuit.
17425 \pgfpathcircle{\pgfpoint
17426 {\ctikzvalof{tripoles/pmos/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
17427 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
17428 \ifpgf@circuit@pmos@emptycircle
17429 \pgfsetfillcolor{white}
17430 \fi
17431 \pgfusepath{draw,fill}
17432 \fi
17433
17434 \pgfcirc@ferroelectric{pmos}{0}
17435 }
17436
17437 %%% depletion MOSFET (simplified symbols)
17438
17439 \long\def\pgfcirc@filldraw@depletion#1{%
17440 \ifx\tikz@fillcolor\pgfutil@empty
17441 % if there is no explicit fill check the specific key
17442 \edef\@@tmp{\ctikzvalof{tripoles/#1/depletion color}}\edef\@@none{none}%
17443 \ifx\@@tmp\@@none % if it's none
17444 \pgfusepath{draw}%
17445 \else
17446 \edef\@@default{default}%
17447 \ifx\@@tmp\@@default % fill with the pen color
17448 \pgf@circ@fill@strokecolor
17449 \pgfusepath{draw, fill}%
17450 \else
17451 \pgfsetfillcolor{\@@tmp}%
17452 \pgfusepath{draw, fill}%
17453 \fi
17454 \fi
17455 \else
17456 \pgfsetfillcolor{\tikz@fillcolor}%
17457 \pgfusepath{draw, fill}%
17458 \fi
17459 }
17460
17461 \pgfcircdeclaretransistor{nmosd}{
17462 \anchor{inner up}{
17463 \northeast
17464 \pgf@y=\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
17465 }
17466 \anchor{inner down}{
17467 \northeast
17468 \pgf@y=-\ctikzvalof{tripoles/nmosd/gate height}\pgf@y
17469 }
17470 \anchor{nobulk}{ %override
17471 \left
17472 \pgf@circ@res@temp=\ctikzvalof{tripoles/nmosd/depletion width}\pgf@x
17473 \pgf@x=\ctikzvalof{tripoles/nmosd/base width}\pgf@x
17474 \advance\pgf@x by -\pgf@circ@res@temp
17475 }
17476 }{%
17477 % draw depletion channel
17478 % add the circle if requested (before everything else, so we can fill it)
17479 \pgfcirc@transistorcircle
17480 % fill the gap color if requested
17481 \pgfcirc@fillgategap{nmos}
17482 \pgfscope
17483 \pgfpathrectanglecorners
17484 {\pgfpoint
17485 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17486 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17487 {\pgfpoint
17488 {(\ctikzvalof{tripoles/nmosd/base width} - \ctikzvalof{tripoles/nmosd/depletion width})*\pgf@circ@res@left}
17489 {-\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17490 \pgfcirc@filldraw@depletion{nmosd}
17491 \endpgfscope
17492 % draw drain and source terminals
17493 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17494 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17495 \pgfpathlineto{\pgfpoint
17496 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17497 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17498
17499 \pgfpathmoveto{\pgfpoint
17500 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17501 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
17502 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17503 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
17504 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17505 \pgfusepath{draw}
17506
17507 \pgfscope
17508 \pgfpathmoveto{\pgfpoint
17509 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17510 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@up}}
17511 \pgfpathlineto{\pgfpoint
17512 {\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left}
17513 {\ctikzvalof{tripoles/nmosd/base height}\pgf@circ@res@down}}
17514 \pgfpathmoveto{\pgfpoint
17515 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
17516 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@up}}
17517 \pgfpathlineto{\pgfpoint
17518 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
17519 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}}
17520 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17521 \pgfusepath{draw}
17522 \endpgfscope
17523 \ifpgf@circuit@mos@arrows
17524 \pgfscope
17525 \ifpgf@circuit@trans@arrowatend
17526 \pgftransformshift{\pgfpoint
17527 {\pgf@circ@res@right}%
17528 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}%
17529 }
17530 \pgfnode{trarrow}{btip}{}{}{\pgfusepath{stroke}}
17531 \else
17532 \pgfslopedattimetrue
17533 \pgfallowupsidedownattimetrue
17534 \pgfresetnontranslationattimefalse
17535 \pgftransformlineattime{\ctikzvalof{tripoles/nmosd/arrow pos}}{%
17536 \pgfpoint%
17537 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}%
17538 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
17539 }{%
17540 \pgfpoint
17541 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
17542 {\ctikzvalof{tripoles/nmosd/gate height}\pgf@circ@res@down}%
17543 }
17544 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
17545 \fi
17546 \endpgfscope
17547 \fi
17548
17549 \ifpgf@circuit@bpt@drawgate
17550 \pgfpathmoveto{\pgfpoint
17551 {\ctikzvalof{tripoles/nmosd/gate width}\pgf@circ@res@left}
17552 {\pgf@circ@res@up+\pgf@circ@res@down}}
17553 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
17554 \pgfusepath{draw}
17555 \fi
17556
17557 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
17558 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/nmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
17559 {\pgf@circ@res@up+\pgf@circ@res@down}}
17560 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17561 {\pgf@circ@res@up+\pgf@circ@res@down}}
17562 \pgfusepath{draw}
17563 \fi
17564
17565 \pgfcirc@ferroelectric{nmosd}{\ctikzvalof{tripoles/nmosd/depletion width}}
17566 }
17567
17568 \pgfcircdeclaretransistor{pmosd}{
17569 \anchor{inner up}{
17570 \northeast
17571 \pgf@y=\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
17572 }
17573 \anchor{inner down}{
17574 \northeast
17575 \pgf@y=-\ctikzvalof{tripoles/pmosd/gate height}\pgf@y
17576 }
17577 \anchor{nobulk}{ %override
17578 \left
17579 \pgf@circ@res@temp=\ctikzvalof{tripoles/pmosd/depletion width}\pgf@x
17580 \pgf@x=\ctikzvalof{tripoles/pmosd/base width}\pgf@x
17581 \advance\pgf@x by -\pgf@circ@res@temp
17582 }
17583 }{%
17584 % add the circle if requested (before everything else, so we can fill it)
17585 \pgfcirc@transistorcircle
17586 % fill the gap color if requested
17587 \pgfcirc@fillgategap{nmos}
17588 % draw depletion channel
17589 \pgfscope
17590 \pgfpathrectanglecorners
17591 {\pgfpoint
17592 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17593 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17594 {\pgfpoint
17595 {(\ctikzvalof{tripoles/pmosd/base width} - \ctikzvalof{tripoles/pmosd/depletion width})*\pgf@circ@res@left}
17596 {-\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17597 \pgfcirc@filldraw@depletion{pmosd}
17598 \endpgfscope
17599 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17600 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17601 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17602 \pgfpathlineto{\pgfpoint
17603 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17604 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17605 \pgfusepath{draw}
17606
17607 \ifpgf@circuit@mos@arrows
17608 \pgfscope
17609 \ifpgf@circuit@trans@arrowatend
17610 \pgftransformshift{\pgfpoint
17611 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
17612 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
17613 }
17614 \pgftransformrotate{180}
17615 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
17616 \else
17617 \pgfslopedattimetrue
17618 \pgfallowupsidedownattimetrue
17619 \pgfresetnontranslationattimefalse
17620 \pgftransformlineattime{\ctikzvalof{tripoles/pmosd/arrow pos}}{%
17621 \pgfpoint%
17622 {\pgf@circ@res@right-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}%
17623 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
17624 }{%
17625 \pgfpoint
17626 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}%
17627 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}%
17628 }
17629 \pgfnode{currarrow}{center}{}{}{\pgfusepath{stroke}}
17630 \fi
17631 \endpgfscope
17632 \fi
17633
17634 \pgfscope
17635 \pgfpathmoveto{\pgfpoint
17636 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17637 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@up}}
17638 \pgfpathlineto{\pgfpoint
17639 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17640 {\ctikzvalof{tripoles/pmosd/base height}\pgf@circ@res@down}}
17641 \pgfpathmoveto{\pgfpoint
17642 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
17643 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@up}}
17644 \pgfpathlineto{\pgfpoint
17645 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
17646 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
17647 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17648 \pgfusepath{draw}
17649 \endpgfscope
17650
17651 \pgfpathmoveto{\pgfpoint
17652 {\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left}
17653 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
17654 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17655 {\ctikzvalof{tripoles/pmosd/gate height}\pgf@circ@res@down}}
17656 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17657
17658
17659 \pgfusepath{draw}
17660 \ifpgf@circuit@bpt@drawgate
17661 \pgfpathmoveto{\pgfpoint
17662 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left}
17663 {\pgf@circ@res@up+\pgf@circ@res@down}}
17664 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}{\pgf@circ@res@up+\pgf@circ@res@down}}
17665 \pgfusepath{draw}
17666 \fi
17667
17668 \ifpgf@circuit@bpt@drawbulk % added by Burak Kelleci
17669 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/pmosd/base width}\pgf@circ@res@left-\ctikzvalof{tripoles/nmosd/depletion width}*\pgf@circ@res@left}
17670 {\pgf@circ@res@up+\pgf@circ@res@down}}
17671 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17672 {\pgf@circ@res@up+\pgf@circ@res@down}}
17673 \pgfusepath{draw}
17674 \fi
17675
17676 \ifpgf@circuit@pmos@nocircle\else
17677 % we are not scaling the circle with the MOS --- I think it's better to have it
17678 % coherent with the poles/nodes of the rest of the circuit.
17679 \pgfpathcircle{\pgfpoint
17680 {\ctikzvalof{tripoles/pmosd/gate width}\pgf@circ@res@left - \ctikzvalof{nodes width}*\pgf@circ@Rlen}
17681 {\pgf@circ@res@up+\pgf@circ@res@down}}{\ctikzvalof{nodes width}*\pgf@circ@Rlen}
17682 \ifpgf@circuit@pmos@emptycircle
17683 \pgfsetfillcolor{white}
17684 \fi
17685 \pgfusepath{draw,fill}
17686 \fi
17687
17688 \pgfcirc@ferroelectric{pmosd}{\ctikzvalof{tripoles/pmosd/depletion width}}
17689 }
17690 %% HEMT FET Transistor
17691 \def\pgf@circ@hemt@gate@anchor@helper{%
17692 \northeast
17693 \pgf@circ@res@up = \pgf@y
17694 \pgf@circ@res@down = -\pgf@y
17695 \pgfmathsetlength{\pgf@circ@res@step}{{(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}}
17696 \left
17697 \pgf@y=\pgf@circ@res@step
17698 }
17699 \pgfcircdeclaretransistor{hemt}{
17700 \savedmacro{\gateasym}{\edef\gateasym{\ctikzvalof{tripoles/hemt/gate asym}}}
17701 \anchor{inner up}{
17702 \northeast
17703 \pgf@y=\ctikzvalof{tripoles/hemt/gate height}\pgf@y
17704 }
17705 \anchor{inner down}{
17706 \northeast
17707 \pgf@y=-\ctikzvalof{tripoles/hemt/gate height}\pgf@y
17708 }
17709 % override gate/base anchors
17710 \anchor{G}{\pgf@circ@hemt@gate@anchor@helper}
17711 \anchor{gate}{\pgf@circ@hemt@gate@anchor@helper}
17712 \anchor{nogate}{\pgf@circ@hemt@gate@anchor@helper\pgf@x=\ctikzvalof{tripoles/hemt/base width}\pgf@x}
17713 \anchor{B}{\pgf@circ@hemt@gate@anchor@helper}
17714 \anchor{base}{\pgf@circ@hemt@gate@anchor@helper}
17715 \anchor{nobase}{\pgf@circ@hemt@gate@anchor@helper\pgf@x=\ctikzvalof{tripoles/hemt/base width}\pgf@x}
17716 }{%
17717 % add the circle if requested (before everything else, so we can fill it)
17718 \pgfcirc@transistorcircle
17719 % upper connection
17720 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17721 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17722 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
17723 \pgfpathlineto{\pgfpoint
17724 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17725 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@up}}
17726 % lower connection
17727 \pgfpathmoveto{\pgfpoint
17728 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17729 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17730 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17731 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17732 \pgfpathlineto{\pgfpoint
17733 {\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17734 \pgfusepath{draw}
17735 \pgfscope
17736 \edef\@@tmp{\ctikzvalof{tripoles/hemt/source arrow}}
17737 \ifnum\@@tmp=0 \else
17738 \ifpgf@circuit@trans@arrowatend
17739 \ifnum\@@tmp > 0 %
17740 \pgftransformshift{\pgfpoint
17741 {\pgf@circ@res@right}
17742 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17743 \else
17744 \pgftransformshift{\pgfpoint
17745 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17746 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17747 \ifnum\@@tmp < 0 \pgftransformrotate{180}\fi
17748 \fi
17749 \pgfnode{trarrow}{tip}{}{}{\pgfusepath{stroke}}
17750 \else
17751 % the position here is a bit strange...
17752 \pgftransformshift{\pgfpoint
17753 {0.5*\pgf@circ@res@right+0.5*\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17754 {\ctikzvalof{tripoles/hemt/gate height}\pgf@circ@res@down}}
17755 \ifnum\@@tmp < 0 \pgftransformrotate{180}\fi
17756 \pgfnode{trarrow}{center}{}{}{\pgfusepath{stroke}}
17757 \fi
17758 \fi
17759 \endpgfscope
17760 \pgfscope
17761 % draw gate (base) bar
17762 \ifpgf@circ@hemt@split
17763 \pgfpathmoveto{\pgfpoint
17764 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17765 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
17766 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17767 {(1.1+\gateasym)*\pgf@circ@res@up +
17768 (0.9-\gateasym)*\pgf@circ@res@down}}
17769 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17770 {(1.05+\gateasym)*\pgf@circ@res@up +
17771 (0.95-\gateasym)*\pgf@circ@res@down}}
17772 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17773 {(0.95+\gateasym)*\pgf@circ@res@up +
17774 (1.05-\gateasym)*\pgf@circ@res@down}}
17775 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17776 {(0.9+\gateasym)*\pgf@circ@res@up +
17777 (1.1-\gateasym)*\pgf@circ@res@down}}
17778 \pgfpathlineto{\pgfpoint
17779 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17780 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
17781 \else
17782 \pgfpathmoveto{\pgfpoint
17783 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17784 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@up}}
17785 \pgfpathlineto{\pgfpoint
17786 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17787 {\ctikzvalof{tripoles/hemt/base height}\pgf@circ@res@down}}
17788 \fi
17789 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17790 \pgfusepath{draw}
17791 \endpgfscope
17792 % draw the gate horizontal segment
17793 \ifpgf@circuit@bpt@drawgate
17794 \pgfpathmoveto{\pgfpoint
17795 {\ctikzvalof{tripoles/hemt/base width}\pgf@circ@res@left}
17796 {(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}}
17797 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17798 {(1+\gateasym)*\pgf@circ@res@up+(1-\gateasym)*\pgf@circ@res@down}}
17799 \pgfusepath{draw}
17800 \fi
17801 }
17802 \tikzset{GaN hemt/.style={hemt,
17803 circuitikz/tripoles/hemt/base height=0.6,%length of the "base" vertical bar
17804 circuitikz/tripoles/hemt/gate height=0.5,%distance of the S/D terminals
17805 circuitikz/tripoles/hemt/bodydiode conn=0.85,% attachment point of body diode
17806 circuitikz/tripoles/hemt/gate asym=-0.1,% slightly down
17807 circuitikz/tripoles/hemt/split gate=true,% split gate
17808 circuitikz/tripoles/hemt/source arrow=1,% right-facing arrow
17809 },
17810 }
17811
17812 \long\def\drawfetcore#1{
17813 \pgftransformationadjustments
17814 % add the circle if requested (before everything else, so we can fill it)
17815 \pgfcirc@transistorcircle
17816 % fill the gap color if requested
17817 \pgfcirc@fillgategap{#1}
17818
17819 %top connection
17820 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17821 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17822 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
17823 \pgfpathlineto{\pgfpoint
17824 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17825 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
17826 \pgfusepath{draw}
17827 \pgfscope
17828 \pgfpathmoveto{\pgfpoint
17829 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17830 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up}}
17831 \ifpgf@circuit@trans@depletiontype
17832 \pgfpathlineto{\pgfpoint
17833 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17834 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
17835 \else
17836
17837 \pgfpathlineto{\pgfpoint
17838 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17839 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.45}}
17840 \pgfpathmoveto{\pgfpoint
17841 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17842 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@up*0.25}}
17843 \pgfpathlineto{\pgfpoint
17844 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17845 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down*0.25}}
17846 \pgfpathmoveto{\pgfpoint
17847 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17848 {\ctikzvalof{tripoles/nfet/base height}\pgf@circ@res@down*0.45}}
17849 \pgfpathlineto{\pgfpoint
17850 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17851 {\ctikzvalof{tripoles/#1/base height}\pgf@circ@res@down}}
17852 \fi
17853 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17854 \pgfusepath{draw}
17855 \endpgfscope
17856 %Bulk connection line
17857 \pgfpathmoveto{\pgfpoint
17858 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17859 {\pgf@circ@res@up+\pgf@circ@res@down}}
17860 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17861 {\pgf@circ@res@up+\pgf@circ@res@down}}
17862
17863 %bottom connection
17864 \pgfpathmoveto{\pgfpoint
17865 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}
17866 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
17867 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
17868 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
17869 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17870 \pgfusepath{draw}
17871
17872 %draw thick gate line
17873 \pgfscope%%% gate line
17874 \pgfpathmoveto{\pgfpoint
17875 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17876 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17877 \ifpgf@circuit@fet@doublegate
17878 \edef\@@gateconnheight{(\ctikzvalof{tripoles/#1/conn height})}
17879 \pgfpathlineto{\pgfpoint
17880 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17881 {\@@gateconnheight*\pgf@circ@res@up/3}}
17882 \pgfpathmoveto{\pgfpoint
17883 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17884 {\@@gateconnheight*\pgf@circ@res@down/3}}
17885 \fi
17886 \pgfpathlineto{\pgfpoint
17887 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17888 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
17889 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
17890 \pgfusepath{draw}
17891 \endpgfscope
17892
17893 % arrows
17894 \pgfscope
17895 \pgfslopedattimetrue
17896 \pgfallowupsidedownattimetrue
17897 \pgfresetnontranslationattimefalse
17898 \ifpgf@circuit@trans@arrowatend
17899 \ifpgf@circuit@trans@ntype
17900 \edef\@@anchor{tip}
17901 \edef\@@pos{1.0}
17902 \else
17903 \edef\@@anchor{btip}
17904 \edef\@@pos{0.0}
17905 \fi
17906 \else
17907 \edef\@@anchor{center}\edef\@@pos{0.6}
17908 \fi
17909 \pgftransformlineattime{\@@pos}{%
17910 \pgfpoint
17911 {\pgf@circ@res@right}%
17912 {\pgf@circ@res@up+\pgf@circ@res@down}%
17913 }{%
17914 \pgfpoint%
17915 {\ctikzvalof{tripoles/#1/base width}\pgf@circ@res@left}%
17916 {\pgf@circ@res@up+\pgf@circ@res@down}%
17917 }
17918 \ifpgf@circuit@trans@ntype
17919 \else
17920 \pgftransformrotate{180}
17921 \fi
17922 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
17923 \endpgfscope
17924
17925 % GATE CONNECTION
17926 \ifpgf@circuit@bpt@drawgate
17927 \pgfscope %% gate connection
17928 \ifpgf@circuit@trans@ntype
17929 \edef\@@gateconnheight{(\ctikzvalof{tripoles/#1/conn height})}
17930 \else
17931 \edef\@@gateconnheight{(-\ctikzvalof{tripoles/#1/conn height})}
17932 \fi
17933 \pgfpathmoveto{\pgfpoint
17934 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17935 {\@@gateconnheight*\pgf@circ@res@down}}
17936 \pgfpathlineto{\pgfpoint
17937 {\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17938 {\@@gateconnheight*\pgf@circ@res@down}}
17939 \ifpgf@circuit@fet@doublegate
17940 \pgfpathmoveto{\pgfpoint
17941 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
17942 {-\@@gateconnheight*\pgf@circ@res@down/3}}
17943 \pgfpathlineto{\pgfpoint
17944 {\pgf@circ@res@left-\pgfhorizontaltransformationadjustment*.5*\pgflinewidth}
17945 {-\@@gateconnheight*\pgf@circ@res@down/3}}
17946 \fi
17947 \pgfusepath{draw}
17948 \endpgfscope
17949 \fi
17950
17951 \pgfcirc@ferroelectric{#1}{0}
17952
17953 }
17954
17955 \long\def\pgfdeclaretransistorwrapperaddbulk#1#2#3{
17956 \pgfcircdeclaretransistor{#1}{
17957 \anchor{bulk}{\left\pgf@x=0pt}
17958 \anchor{B}{\left\pgf@x=0pt}%override Base anchor from npn&igbt
17959 \anchor{inner up}{
17960 \northeast
17961 \pgf@y=\ctikzvalof{tripoles/#1/gate height}\pgf@y
17962 }
17963 \anchor{inner down}{
17964 \northeast
17965 \pgf@y=-\ctikzvalof{tripoles/#1/gate height}\pgf@y
17966 }
17967 #2%
17968 }
17969 {#3}
17970 }
17971
17972 \pgfdeclaretransistorwrapperaddbulk{nfet}{}{%
17973 \pgf@circuit@trans@depletiontypefalse
17974 \drawfetcore{nfet}
17975 }
17976
17977 \pgfdeclaretransistorwrapperaddbulk{pfet}{}{%
17978 \pgf@circuit@trans@depletiontypefalse
17979 \drawfetcore{pfet}
17980 }
17981
17982 \pgfdeclaretransistorwrapperaddbulk{nfetd}{}{%
17983 \pgf@circuit@trans@depletiontypetrue
17984 \drawfetcore{nfetd}
17985 }
17986
17987 \pgfdeclaretransistorwrapperaddbulk{pfetd}{}{%
17988 \pgf@circuit@trans@depletiontypetrue
17989 \drawfetcore{pfetd}
17990 }
17991 % N-CHANNEL IGFET ENHANCEMENT TYPE
17992 \pgfdeclaretransistorwrapperaddbulk{nigfete}{}{%
17993 \pgf@circuit@trans@depletiontypefalse
17994 \drawfetcore{nigfete}
17995
17996 % SOURCE CONNECTION
17997 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
17998 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
17999 \pgfusepath{draw}
18000
18001 % SOLDER DOT at source-bulk connection
18002 \ifpgf@circuit@fet@solderdot
18003 \pgfscope
18004 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
18005 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
18006 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
18007 \pgfnode{circ}{center}{}{}{}
18008 \endpgfscope{}
18009 \fi
18010 }
18011
18012 % N-CHANNEL IGFET ENHANCEMENT TYPE with Bulk connector
18013 \pgfdeclaretransistorwrapperaddbulk{nigfetebulk}{}{%
18014 \pgf@circuit@trans@depletiontypefalse
18015 \drawfetcore{nigfetebulk}
18016 % SOLDER DOT at source-bulk connection
18017 \ifpgf@circuit@fet@solderdot
18018 \pgfscope
18019 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
18020 \ctikzvalof{tripoles/nigfetebulk/gate height}\pgf@circ@res@down}}
18021 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
18022 \pgfnode{circ}{center}{}{}{}
18023 \endpgfscope{}
18024 \fi
18025 }
18026
18027 % N-CHANNEL IGFET DEPLETION TYPE
18028 \pgfdeclaretransistorwrapperaddbulk{nigfetd}{}{%
18029 \pgf@circuit@trans@depletiontypetrue
18030 \drawfetcore{nigfetd}
18031
18032 % SOURCE CONNECTION
18033 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18034 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
18035 \pgfusepath{draw}
18036
18037 % SOLDER DOT at source-bulk connection
18038 \ifpgf@circuit@fet@solderdot
18039 \pgfscope
18040 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
18041 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
18042 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
18043 \pgfnode{circ}{center}{}{}{}
18044 \endpgfscope{}
18045 \fi
18046 }
18047
18048 % P-CHANNEL IGFET ENHANCEMENT TYPE
18049 \pgfdeclaretransistorwrapperaddbulk{pigfete}{}{%
18050 \pgf@circuit@trans@depletiontypefalse
18051 \drawfetcore{pigfete}
18052 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
18053
18054 % SOURCE CONNECTION
18055 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18056 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
18057 \pgfusepath{draw}
18058
18059
18060 % SOLDER DOT at source-bulk connection
18061 \ifpgf@circuit@fet@solderdot
18062 \pgfscope
18063 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
18064 \ctikzvalof{tripoles/pigfete/gate height}\pgf@circ@res@up}}
18065 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
18066 \pgfnode{circ}{center}{}{}{}
18067 \endpgfscope
18068 \fi
18069 }
18070
18071 % P-CHANNEL IGFET ENHANCEMENT TYPE with bulk connector
18072 \pgfdeclaretransistorwrapperaddbulk{pigfetebulk}{}{%
18073 \pgf@circuit@trans@depletiontypefalse
18074 \drawfetcore{pigfetebulk}
18075 }
18076
18077 % P-CHANNEL IGFET DEPLETION TYPE
18078 \pgfdeclaretransistorwrapperaddbulk{pigfetd}{}{%
18079 \pgf@circuit@trans@depletiontypetrue
18080 \drawfetcore{pigfetd}
18081
18082 % SOURCE CONNECTION
18083 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18084 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
18085 \pgfusepath{draw}
18086
18087
18088 % SOLDER DOT at source-bulk connection
18089 \ifpgf@circuit@fet@solderdot
18090 \pgfscope
18091 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
18092 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@up}}
18093 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
18094 \pgfnode{circ}{center}{}{}{}
18095 \endpgfscope{}
18096 \fi
18097 }
18098
18099 %%% uni-junction transistors: jfets, ujts
18100
18101 \long\def\pgfcircdeclarejunctiontransistor#1#2#3{% name, extra anchors, extra draw
18102 \pgfcircdeclaretransistor{#1}{
18103 \anchor{inner up}{
18104 \northeast
18105 \pgf@y=\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
18106 }
18107 \anchor{inner down}{
18108 \northeast
18109 \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
18110 }
18111 \anchor{kink}{
18112 \northeast
18113 \pgf@ya=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
18114 \left
18115 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@ya
18116 \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x
18117 }
18118 % extra anchors (or override)
18119 #2%
18120 }{%
18121 % add the circle if requested (before everything else, so we can fill it)
18122 \pgfcirc@transistorcircle
18123
18124 % get direction
18125 \edef\@@dir{\ctikzvalof{tripoles/#1/curr direction}}
18126
18127 % draw drain/source connections: up
18128 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
18129 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
18130 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
18131 \pgfpathlineto{\pgfpoint
18132 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
18133 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up}}
18134
18135 % down
18136 \pgfpathmoveto{\pgfpoint
18137 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
18138 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
18139 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
18140 {\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down}}
18141 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
18142 \pgfusepath{draw}
18143
18144 \pgfscope
18145 \pgfpathmoveto{\pgfpoint
18146 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
18147 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@up}}
18148 \pgfpathlineto{\pgfpoint
18149 {\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left}
18150 {\ctikzvalof{tripoles/#1/gate height}\pgf@circ@res@down}}
18151 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18152 \pgfusepath{draw}
18153 \endpgfscope
18154
18155 % arrow
18156 \pgfscope
18157 \pgfslopedattimetrue
18158 \pgfallowupsidedownattimetrue
18159 \pgfresetnontranslationattimefalse
18160 \ifpgf@circuit@trans@arrowatend
18161 \ifnum\@@dir>0
18162 \edef\@@anchor{tip}\edef\@@pos{1.0}
18163 \else
18164 \edef\@@anchor{btip}\edef\@@pos{1.0}
18165 \fi
18166 \else
18167 \ifnum\@@dir>0
18168 \edef\@@anchor{center}\edef\@@pos{0.6}
18169 \else
18170 \edef\@@anchor{center}\edef\@@pos{0.4}
18171 \fi
18172 \fi
18173 % find x1, x2 and y for the base arrow
18174 \ifnum\@@dir>0
18175 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left
18176 \pgf@circ@res@other=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left
18177 \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@down
18178 \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@down
18179 \else
18180 \pgf@circ@res@step=\ctikzvalof{tripoles/#1/gate width}\pgf@circ@res@left
18181 \pgf@circ@res@other=\ctikzvalof{tripoles/#1/conn kink}\pgf@circ@res@left
18182 \pgf@circ@res@zero=\ctikzvalof{tripoles/#1/gate height 2}\pgf@circ@res@up
18183 \pgf@circ@res@temp=\ctikzvalof{tripoles/#1/union height}\pgf@circ@res@up
18184 \fi
18185 %
18186 % gate line (called emitter in UJT)
18187 %
18188 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}}
18189 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
18190 %
18191 % horizontal gate line
18192 %
18193 \ifpgf@circuit@bpt@drawgate
18194 \ifnum\@@dir>0
18195 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}}
18196 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
18197 \else
18198 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
18199 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
18200 \fi
18201 \fi
18202 \pgfusepath{draw}
18203 %
18204 % gate arrows (called emitter in UJT)
18205 %
18206 \pgftransformlineattime{\@@pos}{%
18207 \pgfpoint{\pgf@circ@res@step}{\pgf@circ@res@temp}
18208 }{%
18209 \pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}
18210 }
18211 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
18212 %
18213 % gate line (called emitter in UJT)
18214 %
18215 \endpgfscope
18216
18217 % extra drawings
18218 #3%
18219 }
18220 }
18221
18222 % NJFET and PJFET
18223
18224 \pgfcircdeclarejunctiontransistor{njfet}{}{}
18225 \pgfcircdeclarejunctiontransistor{pjfet}{}{}
18226
18227 \def\@ujtanchoroverride#1{
18228 \savedanchor{\ujtrealemitter}{
18229 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18230 \pgf@y=\ctikzvalof{tripoles/#1/height}\pgf@circ@scaled@Rlen
18231 \pgf@y=.5\pgf@y %north anchor height
18232 % kink AND conn height, they're the same
18233 \pgf@y=-\ctikzvalof{tripoles/#1/gate height 2}\pgf@y
18234 \pgf@y=\ctikzvalof{tripoles/#1/curr direction}\pgf@y
18235 % horizontal
18236 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen % left
18237 \ifpgf@circuit@bpt@drawgate\else
18238 \pgf@x=\ctikzvalof{tripoles/#1/conn kink}\pgf@x
18239 \fi
18240 }
18241 \anchor{E}{\ujtrealemitter}
18242 \anchor{emitter}{\ujtrealemitter}
18243 \anchor{B2}{\northeast\pgf@y=-\pgf@y}
18244 \anchor{B1}{\northeast}
18245 }
18246
18247
18248 \pgfcircdeclarejunctiontransistor{nujt}{\@ujtanchoroverride{nujt}}{}
18249 \pgfcircdeclarejunctiontransistor{pujt}{\@ujtanchoroverride{pujt}}{}
18250
18251
18252 \pgfdeclaretransistorwrapperaddbulk{isfet}{
18253 }{%
18254 % add the circle if requested (before everything else, so we can fill it)
18255 \pgfcirc@transistorcircle
18256 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
18257 % DRAIN CONNECTION
18258 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
18259 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
18260 % DRAIN
18261 \pgfpathlineto{\pgfpoint
18262 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
18263 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@up}}
18264 \pgfusepath{draw}
18265
18266 % GATE, DEPLETION TYPE
18267 \pgfscope %% added
18268 \pgfpathmoveto{\pgfpoint
18269 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
18270 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@up}}
18271 \pgfpathlineto{\pgfpoint
18272 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
18273 {\ctikzvalof{tripoles/isfet/base height}\pgf@circ@res@down}}
18274 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth} %% added
18275 \pgfusepath{draw} %% added
18276 \endpgfscope %% added
18277
18278 % BULK
18279 \pgfpathmoveto{\pgfpoint
18280 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
18281 {\pgf@circ@res@up+\pgf@circ@res@down}}
18282 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+.5\pgflinewidth}
18283 {\pgf@circ@res@up+\pgf@circ@res@down}}
18284
18285 % SOURCE
18286 \pgfpathmoveto{\pgfpoint
18287 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}
18288 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
18289 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}
18290 {\ctikzvalof{tripoles/isfet/gate height}\pgf@circ@res@down}}
18291 % SOURCE CONNECTION
18292 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18293 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down-\pgfverticaltransformationadjustment*.5*\pgflinewidth}}
18294 \pgfusepath{draw}
18295
18296 % SOLDER DOT at source-bulk connection
18297 \ifpgf@circuit@fet@solderdot
18298 \pgfscope
18299 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{
18300 \ctikzvalof{tripoles/nigfete/gate height}\pgf@circ@res@down}}
18301 \pgftransformscale{\ctikzvalof{transistor solderdot scale}}
18302 \pgfnode{circ}{center}{}{}{}
18303 \endpgfscope{}
18304 \fi
18305 % ARROW
18306 \pgfscope
18307 \pgfslopedattimetrue
18308 \pgfallowupsidedownattimetrue
18309 \pgfresetnontranslationattimefalse
18310 \ifpgf@circuit@trans@arrowatend
18311 \edef\@@anchor{tip}\edef\@@pos{1.0}
18312 \else
18313 \edef\@@anchor{center}\edef\@@pos{0.6}
18314 \fi
18315 \pgftransformlineattime{\@@pos}{%
18316 \pgfpoint
18317 {\pgf@circ@res@right}%
18318 {\pgf@circ@res@up+\pgf@circ@res@down}%
18319 }{%
18320 \pgfpoint%
18321 {\ctikzvalof{tripoles/isfet/base width}\pgf@circ@res@left}%
18322 {\pgf@circ@res@up+\pgf@circ@res@down}%
18323 }
18324 \pgfnode{trarrow}{\@@anchor}{}{}{\pgfusepath{stroke}}
18325 \endpgfscope
18326 \pgfusepath{draw}
18327
18328 % Wavy lines
18329 \pgfscope
18330 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
18331 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18332 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18333 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18334 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18335 \pgfusepath{draw}
18336
18337 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{0cm}}
18338 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18339 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18340 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18341 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18342 \pgfusepath{draw}
18343
18344 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tripoles/isfet/waves x sep}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/waves y sep}\pgf@circ@res@up}}
18345 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18346 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18347 \pgfpathsine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18348 \pgfpathcosine{\pgfpoint{-\ctikzvalof{tripoles/isfet/wave width}\pgf@circ@res@up}{-\ctikzvalof{tripoles/isfet/wave amp}\pgf@circ@res@up}}
18349 \pgfusepath{draw}
18350 \endpgfscope
18351 }
18352
18353 % end of transistors
18354 % %>>>
18355
18356 %% Transistor's path definitions%<<<
18357
18358 \pgf@circ@definetranspath{nmos}
18359 \pgf@circ@definetranspath{pmos}
18360 \pgf@circ@definetranspath{nmosd}
18361 \pgf@circ@definetranspath{pmosd}
18362 \pgf@circ@definetranspath{hemt}
18363 \pgf@circ@definetranspath{npn}
18364 \pgf@circ@definetranspath{pnp}
18365 \pgf@circ@definetranspath{nfet}
18366 \pgf@circ@definetranspath{nigfete}
18367 \pgf@circ@definetranspath{nigfetd}
18368 \pgf@circ@definetranspath{nigfetebulk}
18369 \pgf@circ@definetranspath{pfet}
18370 \pgf@circ@definetranspath{pigfete}
18371 \pgf@circ@definetranspath{pigfetd}
18372 \pgf@circ@definetranspath{pigfetebulk}
18373 \pgf@circ@definetranspath{njfet}
18374 \pgf@circ@definetranspath{pjfet}
18375 \pgf@circ@definetranspath{pigbt}
18376 \pgf@circ@definetranspath{nigbt}
18377 \pgf@circ@definetranspath{Lpigbt}
18378 \pgf@circ@definetranspath{Lnigbt}% %>>>
18379
18380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18381 %% Amplifiers
18382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18383
18384 % Settings for Amplifiers%<<<1
18385 %
18386 % switches for op amps
18387 % changing input polarity
18388 %
18389 \newif\ifpgf@circuit@oa@iplusup\pgf@circuit@oa@iplusupfalse
18390 \pgfkeys{/tikz/noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
18391 \ctikzset{noinv input up/.add code={}{\pgf@circuit@oa@iplusuptrue}}
18392 \pgfkeys{/tikz/noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
18393 \ctikzset{noinv input down/.add code={}{\pgf@circuit@oa@iplusupfalse}}
18394 %
18395 % changing output polarity (for fully diff objects)
18396 %
18397 \newif\ifpgf@circuit@oa@oplusup\pgf@circuit@oa@oplusuptrue
18398 \pgfkeys{/tikz/noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
18399 \ctikzset{noinv output up/.add code={}{\pgf@circuit@oa@oplusuptrue}}
18400 \pgfkeys{/tikz/noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
18401 \ctikzset{noinv output down/.add code={}{\pgf@circuit@oa@oplusupfalse}}
18402
18403 % Operational amplifier
18404 \ctikzset{tripoles/op amp/width/.initial=1.7} % Total width
18405 \ctikzset{tripoles/op amp/port width/.initial=.7} % Terminals length
18406 \ctikzset{tripoles/op amp/height/.initial=1.4} % Total height
18407 \ctikzset{tripoles/op amp/input height/.initial=.5} % Input port vertical separation
18408 \ctikzset{tripoles/op amp/up pos/.initial=.45} % Top and bottom anchor position
18409 \ctikzset{tripoles/op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18410
18411 % Fully differential operational amplifier
18412 \ctikzset{tripoles/fd op amp/width/.initial=1.7} % Total width
18413 \ctikzset{tripoles/fd op amp/port width/.initial=.7} % Terminals length
18414 \ctikzset{tripoles/fd op amp/height/.initial=1.4} % Total height
18415 \ctikzset{tripoles/fd op amp/input height/.initial=.5} % Input port vertical separation
18416 \ctikzset{tripoles/fd op amp/output height/.initial=.5} % Output port vertical separation
18417 \ctikzset{tripoles/fd op amp/up pos/.initial=.45} % Top and bottom anchor position
18418 \ctikzset{tripoles/fd op amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18419
18420 \ctikzset{tripoles/en amp/width/.initial=1.7}
18421 \ctikzset{tripoles/en amp/port width/.initial=.7}
18422 \ctikzset{tripoles/en amp/height/.initial=1.6}
18423 \ctikzset{tripoles/en amp/input height/.initial=.3}
18424 \ctikzset{tripoles/en amp/up pos/.initial=.45}
18425 \ctikzset{tripoles/en amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18426 \ctikzset{tripoles/en amp/font2/.initial=\pgf@circ@font@twelve} % Absolute font size needed!
18427 \ctikzset{tripoles/en amp/text/.initial={$\mathstrut{\triangleright}\,{\infty}$}}
18428 \tikzset{
18429 en amp text/.code = {%
18430 \ctikzsetvalof{tripoles/en amp/text}{#1}%
18431 },
18432 en amp text A/.code = {%
18433 \ctikzsetvalof{tripoles/en amp/text}{$\mathstrut{\triangleright}\,\mathrm{A}$}%
18434 },
18435 }
18436
18437 % Transconductance amplifier
18438 \ctikzset{tripoles/gm amp/width/.initial=1.7} % Total width
18439 \ctikzset{tripoles/gm amp/port width/.initial=.7} % Terminals length
18440 \ctikzset{tripoles/gm amp/height/.initial=1.4} % Left side of the trapezoid
18441 \ctikzset{tripoles/gm amp/height 2/.initial=0.5} % Right side of the trapezoid
18442 \ctikzset{tripoles/gm amp/input height/.initial=.5} % Input port vertical separation
18443 \ctikzset{tripoles/gm amp/up pos/.initial=.45} % Top and bottom anchor position
18444 \ctikzset{tripoles/gm amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18445
18446 % Instrumentation amplifier
18447 \ctikzset{tripoles/inst amp/width/.initial=1.7} % Total width
18448 \ctikzset{tripoles/inst amp/port width/.initial=.7} % Terminals length
18449 \ctikzset{tripoles/inst amp/height/.initial=1.4} % Left side of the trapezoid
18450 \ctikzset{tripoles/inst amp/height 2/.initial=0.6} % Right side of the trapezoid
18451 \ctikzset{tripoles/inst amp/input height/.initial=.5} % Input ports vertical separation
18452 \ctikzset{tripoles/inst amp/up pos/.initial=.4} % Top and bottom anchor position
18453 \ctikzset{tripoles/inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
18454 \ctikzset{tripoles/inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18455
18456 % Instrumentation amplifier with differential output
18457 \ctikzset{tripoles/fd inst amp/width/.initial=1.7} % Total width
18458 \ctikzset{tripoles/fd inst amp/port width/.initial=.7} % Terminals length
18459 \ctikzset{tripoles/fd inst amp/height/.initial=1.4} % Left side of the trapezoid
18460 \ctikzset{tripoles/fd inst amp/height 2/.initial=0.6} % Right side of the trapezoid
18461 \ctikzset{tripoles/fd inst amp/input height/.initial=.5} % Input ports vertical separation
18462 \ctikzset{tripoles/fd inst amp/output height/.initial=.5} % Output ports vertical separation
18463 \ctikzset{tripoles/fd inst amp/up pos/.initial=.4} % Top and bottom anchor position
18464 \ctikzset{tripoles/fd inst amp/refv pos/.initial=.7} % Top and bottom voltage reference position
18465 \ctikzset{tripoles/fd inst amp/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18466
18467 % Instrumentation amplifier with gain resistor terminals
18468 \ctikzset{tripoles/inst amp ra/width/.initial=2.4} % Total width
18469 \ctikzset{tripoles/inst amp ra/port width/.initial=.7} % Terminals length
18470 \ctikzset{tripoles/inst amp ra/height/.initial=2.9} % Left side of the trapezoid
18471 \ctikzset{tripoles/inst amp ra/height 2/.initial=0.4} % Right side of the trapezoid
18472 \ctikzset{tripoles/inst amp ra/input height/.initial=.7} % Input ports vertical separation
18473 \ctikzset{tripoles/inst amp ra/up pos/.initial=.4} % Top and bottom anchor position
18474 \ctikzset{tripoles/inst amp ra/refv pos/.initial=.7} % Top and bottom voltage reference position
18475 \ctikzset{tripoles/inst amp ra/ra pos/.initial=.6} % Gain resistor terminals vertical separation
18476 \ctikzset{tripoles/inst amp ra/font/.initial=\pgf@circ@font@tenbm} % Absolute font size needed!
18477
18478 % Plain amplifier
18479 \ctikzset{tripoles/plain amp/width/.initial=1.7} % Total width
18480 \ctikzset{tripoles/plain amp/port width/.initial=.7} % Terminals length
18481 \ctikzset{tripoles/plain amp/height/.initial=1.4} % Total height
18482 \ctikzset{tripoles/plain amp/input height/.initial=.5} % Input ports vertical separation
18483 \ctikzset{tripoles/plain amp/up pos/.initial=.45} % Top and bottom anchor position
18484
18485 % changing fonts and symbols of amplifiers
18486 \ctikzset{amplifiers/symbol font/.code={%
18487 \ctikzset{tripoles/inst amp ra/font=#1}%
18488 \ctikzset{tripoles/fd inst amp/font=#1}%
18489 \ctikzset{tripoles/inst amp/font=#1}%
18490 \ctikzset{tripoles/gm amp/font=#1}%
18491 \ctikzset{tripoles/en amp/font=#1}%
18492 \ctikzset{tripoles/fd op amp/font=#1}%
18493 \ctikzset{tripoles/op amp/font=#1}%
18494 }}
18495 \ctikzset{amplifiers/plus/.initial={$+$}}
18496 % In the mayority of fonts, the size of - is smaller than +, so we have
18497 % unaligned signs when positioned independently.
18498 % See https://github.com/circuitikz/circuitikz/issues/721
18499 \ctikzset{amplifiers/minus/.initial={$\vphantom{+}-$}}
18500 \tikzset{amp symbol font/.code={%
18501 \ctikzset{amplifiers/symbol font={#1}}%
18502 }
18503 }
18504 \tikzset{amp plus/.code={\ctikzsetvalof{amplifiers/plus}{#1}}}
18505 \tikzset{amp minus/.code={\ctikzsetvalof{amplifiers/minus}{#1}}}
18506 \def\pgf@circ@ampli@plus{\ctikzvalof{amplifiers/plus}}
18507 \def\pgf@circ@ampli@minus{\ctikzvalof{amplifiers/minus}}
18508 %%>>>
18509
18510 %% Nodes for amplifiers%<<<
18511 %% operational and instrumentation amplifiers
18512
18513 \pgfdeclareshape{op amp}
18514 {
18515 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
18516 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18517 \anchor{center}{\pgfpointorigin}
18518 \savedanchor\northwest{%
18519 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18520 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
18521 \pgf@y=.5\pgf@y
18522 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18523 \pgf@x=.5\pgf@x
18524 }
18525 \savedanchor\left{%
18526 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18527 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18528 \pgf@x=.5\pgf@x
18529 \pgf@y=0pt
18530 }
18531 \anchor{south}{
18532 \northwest
18533 \pgf@y=-\pgf@y
18534 \pgf@x=0pt
18535 }
18536 \anchor{north}{
18537 \northwest
18538 \pgf@x=0pt
18539 }
18540 \savedanchor\left{%
18541 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18542 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18543 \pgf@x=.5\pgf@x
18544 \pgf@y=0pt
18545 }
18546 \savedanchor\inOneFixed{%
18547 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18548 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
18549 \pgf@y=.5\pgf@y
18550 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
18551 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18552 \pgf@x=.5\pgf@x
18553 }
18554 \anchor{in up}{
18555 \inOneFixed
18556 }
18557 \anchor{in down}{
18558 \inOneFixed
18559 \pgf@y=-\pgf@y
18560 }
18561 \savedanchor\inOne{%
18562 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18563 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
18564 \pgf@y=.5\pgf@y
18565 \pgf@y=\ctikzvalof{tripoles/op amp/input height}\pgf@y
18566 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18567 \pgf@x=.5\pgf@x
18568 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
18569 }
18570 \anchor{-}{
18571 \inOne
18572 }
18573 \anchor{+}{
18574 \inOne
18575 \pgf@y=-\pgf@y
18576 }
18577 \savedanchor\up{%
18578 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18579 \pgf@y=\ctikzvalof{tripoles/op amp/height}\pgf@circ@scaled@Rlen
18580 \pgf@y=.5\pgf@y
18581 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18582 \pgf@x=.5\pgf@x
18583 \pgf@circ@res@up = \pgf@y
18584 \pgf@circ@res@right = -\pgf@x
18585 \pgf@circ@res@left = \pgf@x
18586 \pgfpointlineattime{
18587 \ctikzvalof{tripoles/op amp/up pos}}{
18588 \pgfpoint{
18589 \ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
18590 {\pgf@circ@res@up}}
18591 {\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
18592 }
18593 \anchor{up}{
18594 \up
18595 }
18596 \anchor{down}{
18597 \up
18598 \pgf@y=-\pgf@y
18599 }
18600 \anchor{out}{
18601 \northwest
18602 \pgf@y=0pt
18603 \pgf@x=-\pgf@x
18604 }
18605 \anchor{west}{
18606 \left
18607 }
18608 \anchor{east}{
18609 \left
18610 \pgf@x=-\pgf@x
18611 }
18612
18613 % support for border anchors
18614 \savedanchor\leftedge{%
18615 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18616 \pgf@x=-\ctikzvalof{tripoles/op amp/width}\pgf@circ@scaled@Rlen
18617 \pgf@x=.5\pgf@x
18618 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
18619 \pgf@y=0pt
18620 }
18621 \anchor{leftedge}{\leftedge}
18622 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
18623 \anchor{bin up}{
18624 \inOneFixed
18625 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18626 }
18627 \anchor{bin down}{
18628 \inOneFixed
18629 \pgf@y=-\pgf@y
18630 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18631 }
18632 \anchor{b-}{
18633 \inOne
18634 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18635 }
18636 \anchor{b+}{
18637 \inOne
18638 \pgf@y=-\pgf@y
18639 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18640 }
18641 \anchor{bout}{
18642 \leftedge
18643 \pgf@y=0pt
18644 \pgf@x=-\pgf@x
18645 }
18646 % end border anchors
18647 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18648 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
18649 \anchor{north west}{ \northwest }
18650 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
18651
18652 \anchor{text}{
18653 \ifpgf@circ@center@text
18654 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
18655 \else
18656 \leftedge
18657 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
18658 \fi
18659 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
18660 }
18661
18662 \pgf@circ@draw@component{
18663 \pgf@circ@setcolor
18664 \northwest
18665 \pgf@circ@res@up = \pgf@y
18666 \pgf@circ@res@down = -\pgf@y
18667 \pgf@circ@res@right = -\pgf@x
18668 \pgf@circ@res@left = \pgf@x
18669 \pgf@circ@scaled@Rlen=\scaledRlen
18670 % Triangle
18671 \pgfscope
18672 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18673 \pgftransformxshift{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
18674 \pgf@circ@res@step=\pgf@circ@res@right
18675 \advance\pgf@circ@res@step by -\pgf@circ@res@left
18676 \pgf@circ@res@step=\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@step
18677 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
18678 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
18679 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
18680 \pgfpathclose
18681 \pgf@circ@draworfill
18682 \endpgfscope
18683 % Negative input terminal
18684 \pgfpathmoveto{\pgfpoint
18685 {\pgf@circ@res@left}
18686 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
18687 \pgfpathlineto{\pgfpoint
18688 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
18689 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@up}}
18690 % Positive input terminal
18691 \pgfpathmoveto{\pgfpoint
18692 {\pgf@circ@res@left}
18693 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
18694 \pgfpathlineto{\pgfpoint
18695 {\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@left}
18696 {\ctikzvalof{tripoles/op amp/input height}\pgf@circ@res@down}}
18697 % Output terminal
18698 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18699 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/op amp/port width}\pgf@circ@res@right}{0pt}}
18700 \pgfsetrectcap
18701 \pgfusepath{draw}
18702 \pgf@circ@text@strokecolor
18703 \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}
18704 \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}
18705 }
18706 }
18707
18708 % Op amp shape as in european standard EN 60617
18709 \pgfdeclareshape{en amp}
18710 {
18711 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
18712 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18713 \anchor{center}{\pgfpointorigin}
18714 \savedanchor\northwest{%
18715 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18716 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
18717 \pgf@y=.5\pgf@y
18718 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18719 \pgf@x=.5\pgf@x
18720 }
18721 \savedanchor\left{%
18722 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18723 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18724 \pgf@x=.5\pgf@x
18725 \pgf@y=0pt
18726 }
18727 \anchor{south}{
18728 \northwest
18729 \pgf@y=-\pgf@y
18730 \pgf@x=0pt
18731 }
18732 \anchor{north}{
18733 \northwest
18734 \pgf@x=0pt
18735 }
18736 \savedanchor\inOneFixed{%
18737 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18738 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
18739 \pgf@y=.5\pgf@y
18740 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
18741 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18742 \pgf@x=.5\pgf@x
18743 }
18744 \anchor{in up}{
18745 \inOneFixed
18746 }
18747 \anchor{in down}{
18748 \inOneFixed
18749 \pgf@y=-\pgf@y
18750 }
18751 \savedanchor\inOne{%
18752 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18753 \pgf@y=\ctikzvalof{tripoles/en amp/height}\pgf@circ@scaled@Rlen
18754 \pgf@y=.5\pgf@y
18755 \pgf@y=\ctikzvalof{tripoles/en amp/input height}\pgf@y
18756 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18757 \pgf@x=.5\pgf@x
18758 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
18759 }
18760 \anchor{-}{
18761 \inOne
18762 }
18763 \anchor{+}{
18764 \inOne
18765 \pgf@y=-\pgf@y
18766 }
18767 \anchor{up}{
18768 \northwest
18769 \pgf@x=0pt
18770 }
18771 \anchor{down}{
18772 \northwest
18773 \pgf@x=0pt
18774 \pgf@y=-\pgf@y
18775 }
18776 \anchor{out}{
18777 \northwest
18778 \pgf@y=0pt
18779 \pgf@x=-\pgf@x
18780 }
18781 \anchor{west}{
18782 \left
18783 }
18784 \anchor{east}{
18785 \left
18786 \pgf@x=-\pgf@x
18787 }
18788 % support for border anchors
18789 \savedanchor\leftedge{%
18790 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18791 \pgf@x=-\ctikzvalof{tripoles/en amp/width}\pgf@circ@scaled@Rlen
18792 \pgf@x=.5\pgf@x
18793 \pgf@x = \ctikzvalof{tripoles/en amp/port width}\pgf@x
18794 \pgf@y=0pt
18795 }
18796 \anchor{leftedge}{\leftedge}
18797 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
18798 \anchor{bin up}{
18799 \inOneFixed
18800 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18801 }
18802 \anchor{bin down}{
18803 \inOneFixed
18804 \pgf@y=-\pgf@y
18805 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18806 }
18807 \anchor{b-}{
18808 \inOne
18809 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18810 }
18811 \anchor{b+}{
18812 \inOne
18813 \pgf@y=-\pgf@y
18814 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
18815 }
18816 \anchor{bout}{
18817 \leftedge
18818 \pgf@y=0pt
18819 \pgf@x=-\pgf@x
18820 }
18821 % end border anchors
18822 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
18823 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
18824 \anchor{north west}{ \northwest }
18825 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
18826 \anchor{text}{
18827 \ifpgf@circ@center@text
18828 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
18829 \else
18830 \leftedge
18831 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
18832 \fi
18833 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
18834 }
18835
18836 \pgf@circ@draw@component{
18837 \pgf@circ@setcolor
18838 \northwest
18839 \pgf@circ@res@up = \pgf@y
18840 \pgf@circ@res@down = -\pgf@y
18841 \pgf@circ@res@right = -\pgf@x
18842 \pgf@circ@res@left = \pgf@x
18843 \pgf@circ@scaled@Rlen=\scaledRlen
18844
18845 \pgfscope
18846 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
18847 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@down}}
18848 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}{\pgf@circ@res@up}}
18849 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@up}}
18850 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@right}{\pgf@circ@res@down}}
18851 \pgfpathclose
18852 \pgf@circ@draworfill
18853 \endpgfscope
18854
18855 \pgfpathmoveto{\pgfpoint
18856 {\pgf@circ@res@left}
18857 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
18858 \pgfpathlineto{\pgfpoint
18859 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
18860 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@up}}
18861
18862 \pgfpathmoveto{\pgfpoint
18863 {\pgf@circ@res@left}
18864 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
18865 \pgfpathlineto{\pgfpoint
18866 {\ctikzvalof{tripoles/en amp/port width}\pgf@circ@res@left}
18867 {\ctikzvalof{tripoles/en amp/input height}\pgf@circ@res@down}}
18868
18869 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
18870 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
18871 \pgfsetrectcap
18872 \pgfusepath{draw}
18873 \pgf@circ@text@strokecolor
18874 \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}
18875 \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}
18876 \pgftext[top, y=-.5ex, at=\pgfpoint{0pt}{\pgf@circ@res@up}]{\hbox{\ctikzvalof{tripoles/en amp/font2}\ctikzvalof{tripoles/en amp/text}}}
18877 }
18878 }
18879
18880 % Fully differential output op amp
18881 % Contributed by Kristofer M. Monisit
18882 \pgfdeclareshape{fd op amp}
18883 {
18884 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
18885 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
18886 \anchor{center}{\pgfpointorigin}
18887 \savedanchor\northwest{%
18888 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18889 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18890 \pgf@y=.5\pgf@y
18891 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18892 \pgf@x=.5\pgf@x
18893 }
18894 \savedanchor\outline{%
18895 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18896 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18897 \pgf@y=.5\pgf@y
18898 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18899 \pgf@x=.5\pgf@x
18900 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
18901 }
18902 \anchor{south}{
18903 \northwest
18904 \pgf@y=-\pgf@y\pgf@x=0pt\relax
18905 }
18906 \anchor{north}{
18907 \northwest\pgf@x=0pt\relax
18908 }
18909 \savedanchor\left{%
18910 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18911 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18912 \pgf@x=.5\pgf@x
18913 \pgf@y=0pt
18914 }
18915 \savedanchor\inOneFixed{%
18916 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18917 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18918 \pgf@y=.5\pgf@y
18919 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
18920 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18921 \pgf@x=.5\pgf@x
18922 }
18923 \anchor{in up}{
18924 \inOneFixed
18925 }
18926 \anchor{in down}{
18927 \inOneFixed
18928 \pgf@y=-\pgf@y
18929 }
18930 \savedanchor\inOne{%
18931 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18932 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18933 \pgf@y=.5\pgf@y
18934 \pgf@y=\ctikzvalof{tripoles/fd op amp/input height}\pgf@y
18935 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18936 \pgf@x=.5\pgf@x
18937 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
18938 }
18939 \anchor{-}{
18940 \inOne
18941 }
18942 \anchor{+}{
18943 \inOne
18944 \pgf@y=-\pgf@y
18945 }
18946 \savedanchor\up{%
18947 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18948 \pgf@y=\ctikzvalof{tripoles/fd op amp/height}\pgf@circ@scaled@Rlen
18949 \pgf@y=.5\pgf@y
18950 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18951 \pgf@x=.5\pgf@x
18952 \pgf@circ@res@up = \pgf@y
18953 \pgf@circ@res@right = -\pgf@x
18954 \pgf@circ@res@left = \pgf@x
18955 \pgfpointlineattime{
18956 \ctikzvalof{tripoles/fd op amp/up pos}}{
18957 \pgfpoint{
18958 \ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
18959 {\pgf@circ@res@up}}
18960 {\pgfpoint{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@right}{0pt}}
18961 }
18962 \anchor{up}{
18963 \up
18964 }
18965 \anchor{down}{
18966 \up
18967 \pgf@y=-\pgf@y
18968 }
18969 \anchor{out up}{
18970 \northwest
18971 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
18972 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18973 }
18974 \anchor{out down}{
18975 \northwest
18976 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
18977 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18978 }
18979 \anchor{out +}{
18980 \outline
18981 \pgf@y=\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
18982 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18983 }
18984 \anchor{out -}{
18985 \outline
18986 \pgf@y=-\ctikzvalof{tripoles/fd op amp/output height}\pgf@y
18987 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18988 }
18989 % support for border anchors
18990 \savedanchor\leftedge{%
18991 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
18992 \pgf@x=-\ctikzvalof{tripoles/fd op amp/width}\pgf@circ@scaled@Rlen
18993 \pgf@x=.5\pgf@x
18994 \pgf@x = \ctikzvalof{tripoles/fd op amp/port width}\pgf@x
18995 \pgf@y=0pt
18996 }
18997 \anchor{leftedge}{\leftedge}
18998 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
18999 \anchor{bin up}{
19000 \inOneFixed
19001 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19002 }
19003 \anchor{bin down}{
19004 \inOneFixed
19005 \pgf@y=-\pgf@y
19006 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19007 }
19008 \anchor{b-}{
19009 \inOne
19010 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19011 }
19012 \anchor{b+}{
19013 \inOne
19014 \pgf@y=-\pgf@y
19015 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19016 }
19017 \anchor{bout}{
19018 \leftedge
19019 \pgf@y=0pt
19020 \pgf@x=-\pgf@x
19021 }
19022 \anchor{bout +}{
19023 \outline
19024 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
19025 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
19026 {\pgfpoint{\pgf@xa}{0pt}}
19027 {\pgfpoint{0pt}{\pgf@ya}}
19028 }
19029 \anchor{bout -}{
19030 \outline
19031 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
19032 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
19033 {\pgfpoint{\pgf@xa}{0pt}}
19034 {\pgfpoint{0pt}{\pgf@ya}}
19035 \pgf@y=-\pgf@y
19036 }
19037 \anchor{bout up}{
19038 \northwest
19039 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
19040 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
19041 {\pgfpoint{\pgf@xa}{0pt}}
19042 {\pgfpoint{0pt}{\pgf@ya}}
19043 }
19044 \anchor{bout down}{
19045 \northwest
19046 \pgf@xa=\pgf@x\pgf@ya=\pgf@y
19047 \pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}
19048 {\pgfpoint{\pgf@xa}{0pt}}
19049 {\pgfpoint{0pt}{\pgf@ya}}
19050 \pgf@y=-\pgf@y
19051 }
19052 % end border anchors
19053 \anchor{west}{
19054 \left
19055 }
19056 \anchor{east}{
19057 \left
19058 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
19059 }
19060 \anchor{out}{% should not be used
19061 \left
19062 \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x
19063 }
19064 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19065 \anchor{north east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x }
19066 \anchor{north west}{ \northwest }
19067 \anchor{south east}{ \northwest \pgf@x=-\ctikzvalof{tripoles/fd op amp/port width}\pgf@x \pgf@y=-\pgf@y }
19068 \anchor{text}{
19069 \ifpgf@circ@center@text
19070 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19071 \else
19072 \leftedge
19073 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
19074 \fi
19075 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19076 }
19077 \pgf@circ@draw@component{
19078 \pgf@circ@setcolor
19079
19080 \northwest
19081 \pgf@circ@res@up = \pgf@y
19082 \pgf@circ@res@down = -\pgf@y
19083 \pgf@circ@res@right = -\pgf@x
19084 \pgf@circ@res@left = \pgf@x
19085 \pgf@circ@scaled@Rlen=\scaledRlen
19086
19087 % Triangle
19088 % Includes output terminals in the traingular shape
19089 % to ensure that diagonal joins are properly displayed
19090 % we first draw the main triangle and the leads with normal thickness,
19091 % and the redraw the main triangle with the component shape
19092 \pgfscope
19093 % shift origin a bit to ease calculations
19094 \pgftransformxshift{\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
19095 \pgf@circ@res@step=\pgf@circ@res@right
19096 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19097 \pgf@circ@res@step=\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@step
19098
19099 % Initial point (right vertex)
19100 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
19101
19102 % Negative output terminal
19103 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
19104 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@up}}
19105 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@up}}}
19106
19107 % Top vertex
19108 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19109
19110 % Bottom vertex
19111 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19112
19113 % Positive output terminal
19114 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
19115 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\ctikzvalof{tripoles/fd op amp/output height}\pgf@circ@res@down}}
19116 \pgfpathlineto{\pgfpointlineattime{\ctikzvalof{tripoles/fd op amp/output height}}{\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{\pgf@circ@res@down}}}
19117
19118 % Right vertex
19119 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{0pt}}
19120
19121 \pgfpathclose
19122 \pgfusepath{stroke}
19123
19124 % ok, now we'll redraw the triangle with the class specific
19125 % thickness and optionally fill
19126
19127 \pgfscope
19128 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
19129
19130 % Initial point (right vertex)
19131 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
19132 % Top vertex
19133 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19134 % Bottom vertex
19135 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19136
19137 \pgfpathclose
19138 \pgf@circ@draworfill
19139 \endpgfscope % thick and fill
19140 \endpgfscope % shift
19141
19142 % Negative input terminal
19143 \pgfpathmoveto{\pgfpoint
19144 {\pgf@circ@res@left}
19145 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
19146 \pgfpathlineto{\pgfpoint
19147 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
19148 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@up}}
19149
19150 % Positive input terminal
19151 \pgfpathmoveto{\pgfpoint
19152 {\pgf@circ@res@left}
19153 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
19154 \pgfpathlineto{\pgfpoint
19155 {\ctikzvalof{tripoles/fd op amp/port width}\pgf@circ@res@left}
19156 {\ctikzvalof{tripoles/fd op amp/input height}\pgf@circ@res@down}}
19157 \pgfsetrectcap
19158 \pgfusepath{draw}
19159 \pgf@circ@text@strokecolor
19160 \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}
19161 \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}
19162 % Negative output terminal label
19163 \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}
19164 % Positive output terminal label
19165 \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}
19166 }
19167 }
19168
19169
19170 % Instrumentation amplifier with differential output
19171 \pgfdeclareshape{fd inst amp}
19172 {
19173 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19174 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19175 % when tikz calls the anchor it wants the relative position in the lengths
19176 % \pgf@x \pgf@y
19177 % \pgfpoint* functions set that variables
19178 % anchors are visible outside and run on use
19179 \anchor{center}{\pgfpointorigin}
19180 % savedanchors are internals and run on node creation (not use)
19181 % bounding-box top left
19182 \savedanchor\northwest{%
19183 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19184 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
19185 \pgf@y=.5\pgf@y
19186 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19187 \pgf@x=.5\pgf@x
19188 }
19189 \anchor{nw}{
19190 \northwest
19191 }
19192 \anchor{south}{
19193 \northwest
19194 \pgf@y=-\pgf@y\pgf@x=0pt\relax
19195 }
19196 \anchor{north}{
19197 \northwest\pgf@x=0pt\relax
19198 }
19199 \savedanchor\left{%
19200 \pgf@y=0pt
19201 }
19202 \anchor{leftedge}
19203 {\left
19204 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
19205 }
19206 \savedanchor\inOneFixed{%
19207 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19208 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
19209 \pgf@y=.5\pgf@y
19210 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
19211 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19212 \pgf@x=.5\pgf@x
19213 }
19214 \anchor{in up}{
19215 \inOneFixed
19216 }
19217 \anchor{in down}{
19218 \inOneFixed
19219 \pgf@y=-\pgf@y
19220 }
19221 \savedanchor\inOne{%
19222 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19223 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
19224 \pgf@y=.5\pgf@y
19225 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
19226 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19227 \pgf@x=.5\pgf@x
19228 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19229 }
19230 \anchor{-}{
19231 \inOne
19232 }
19233 \anchor{+}{
19234 \inOne
19235 \pgf@y=-\pgf@y
19236 }
19237 \savedanchor\up{%
19238 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19239 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
19240 \pgf@y=.5\pgf@y
19241 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19242 \pgf@x=.5\pgf@x
19243 \pgf@circ@res@up = \pgf@y
19244 \pgf@circ@res@right = -\pgf@x
19245 \pgf@circ@res@left = \pgf@x
19246 \pgfpointlineattime{
19247 \ctikzvalof{tripoles/fd inst amp/up pos}}{
19248 \pgfpoint{
19249 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
19250 {\pgf@circ@res@up}}
19251 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
19252 }
19253 \anchor{up}{
19254 \up
19255 }
19256 \anchor{down}{
19257 \up
19258 \pgf@y=-\pgf@y
19259 }
19260 % reference voltage input anchors.
19261 \savedanchor\refv{%
19262 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19263 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
19264 \pgf@y=.5\pgf@y
19265 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19266 \pgf@x=.5\pgf@x
19267 \pgf@circ@res@up = \pgf@y
19268 \pgf@circ@res@right = -\pgf@x
19269 \pgf@circ@res@left = \pgf@x
19270 \pgfpointlineattime{
19271 \ctikzvalof{tripoles/fd inst amp/refv pos}}{
19272 \pgfpoint{
19273 \ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
19274 {\pgf@circ@res@up}}
19275 {\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/height 2}\pgf@circ@res@up}}
19276 }
19277 % we need both because they are normally drawn under the amp, and if you
19278 % mirror it vertically you need them
19279 \anchor{refv up}{
19280 \refv
19281 }
19282 \anchor{refv down}{
19283 \refv
19284 \pgf@y=-\pgf@y
19285 }
19286 \savedanchor\outport{
19287 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19288 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
19289 \pgf@y=.5\pgf@y
19290 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
19291 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19292 \pgf@x=-.5\pgf@x
19293 \ifpgf@circuit@oa@oplusup\else\pgf@y=-\pgf@y\fi
19294 }
19295 \anchor{out}{
19296 \outport
19297 \pgf@y=0pt
19298 }
19299 \anchor{out +}{
19300 \outport
19301 }
19302 \anchor{out -}{
19303 \outport
19304 \pgf@y=-\pgf@y
19305 }
19306 \savedanchor\outportfixed{
19307 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19308 \pgf@y=\ctikzvalof{tripoles/fd inst amp/height}\pgf@circ@scaled@Rlen
19309 \pgf@y=.5\pgf@y
19310 \pgf@y=\ctikzvalof{tripoles/fd inst amp/input height}\pgf@y
19311 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19312 \pgf@x=-.5\pgf@x
19313 }
19314 \anchor{out up}{
19315 \outportfixed
19316 }
19317 \anchor{out down}{
19318 \outportfixed
19319 \pgf@y=-\pgf@y
19320 }
19321 % support for border anchors
19322 \savedanchor\leftedge{%
19323 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19324 \pgf@x=-\ctikzvalof{tripoles/fd inst amp/width}\pgf@circ@scaled@Rlen
19325 \pgf@x=.5\pgf@x
19326 \pgf@x = \ctikzvalof{tripoles/fd inst amp/port width}\pgf@x
19327 \pgf@y=0pt
19328 }
19329 \anchor{leftedge}{\leftedge}
19330 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
19331 \anchor{bin up}{
19332 \inOneFixed
19333 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19334 }
19335 \anchor{bin down}{
19336 \inOneFixed
19337 \pgf@y=-\pgf@y
19338 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19339 }
19340 \anchor{b-}{
19341 \inOne
19342 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19343 }
19344 \anchor{b+}{
19345 \inOne
19346 \pgf@y=-\pgf@y
19347 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19348 }
19349 \anchor{bout}{
19350 \leftedge
19351 \pgf@x=-\pgf@x \pgf@y=0pt
19352 }
19353 \anchor{bout +}{
19354 \outport
19355 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
19356 }
19357 \anchor{bout -}{
19358 \outport
19359 \pgf@y=-\pgf@y
19360 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
19361 }
19362 \anchor{bout up}{
19363 \outportfixed
19364 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
19365 }
19366 \anchor{bout down}{
19367 \outportfixed
19368 \pgf@y=-\pgf@y
19369 \pgf@ya=\pgf@y \leftedge \pgf@x=-\pgf@x \pgf@y=\pgf@ya
19370 }
19371 % end border anchors
19372 %
19373 \anchor{west}{
19374 \left
19375 }
19376 \anchor{east}{
19377 \left
19378 \pgf@x=-\pgf@x
19379 }
19380 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19381 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
19382 \anchor{north west}{ \northwest }
19383 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
19384 \anchor{text}{
19385 \ifpgf@circ@center@text
19386 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19387 \else
19388 \leftedge
19389 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
19390 \fi
19391 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19392 }
19393
19394 % let's start drawing the component
19395 \pgf@circ@draw@component{
19396 \pgf@circ@setcolor
19397 %
19398 \northwest
19399 \pgf@circ@res@up = \pgf@y
19400 \pgf@circ@res@down = -\pgf@y
19401 \pgf@circ@res@right = -\pgf@x
19402 \pgf@circ@res@left = \pgf@x
19403 \pgf@circ@scaled@Rlen=\scaledRlen
19404 % main component, normally in thicker lines
19405 \pgfscope
19406 \newdimen\pgf@circ@res@right@double
19407 \pgf@circ@res@right@double=2\pgf@circ@res@right
19408 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19409 \pgftransformxshift{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
19410 \pgf@circ@res@step=\pgf@circ@res@right
19411 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19412 \pgf@circ@res@step=\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@step
19413 %first point (near output)
19414 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right@double}{0}}
19415 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
19416 \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}}
19417 % and then to the input "front up", "down", to the output short side "down"
19418 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19419 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19420 \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}}
19421 % ...and close
19422 \pgfpathclose
19423 \pgf@circ@draworfill
19424 \endpgfscope
19425
19426 % input terminal up
19427 \pgfpathmoveto{\pgfpoint
19428 {\pgf@circ@res@left}
19429 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
19430 %
19431 \pgfpathlineto{\pgfpoint
19432 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
19433 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@up}}
19434 %
19435
19436 % input terminal down
19437 \pgfpathmoveto{\pgfpoint
19438 {\pgf@circ@res@left}
19439 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
19440 %
19441 \pgfpathlineto{\pgfpoint
19442 {\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@left}
19443 {\ctikzvalof{tripoles/fd inst amp/input height}\pgf@circ@res@down}}
19444
19445 % output leads down and up
19446 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}}
19447 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@down}} %
19448
19449 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}}
19450 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/fd inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/fd inst amp/output height}\pgf@circ@res@up}} %
19451 %
19452 \pgfsetrectcap
19453 \pgfusepath{draw}
19454 \pgf@circ@text@strokecolor
19455 \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}
19456 \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}
19457 \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\pgf@circ@ampli@minus\space\else\pgf@circ@ampli@plus\space\fi}
19458 \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\pgf@circ@ampli@plus\space\else\pgf@circ@ampli@minus\space\fi}
19459 }
19460 }
19461
19462 % Transconductance amplifier (Transkonduktanzverstärker)
19463 \pgfdeclareshape{gm amp}
19464 {
19465 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19466 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19467 \anchor{center}{\pgfpointorigin}
19468 \savedanchor\northwest{%
19469 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19470 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
19471 \pgf@y=.5\pgf@y
19472 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19473 \pgf@x=.5\pgf@x
19474 }
19475 \anchor{south}{
19476 \northwest
19477 \pgf@y=-\pgf@y
19478 }
19479 \anchor{north}{
19480 \northwest
19481 }
19482 \savedanchor\left{%
19483 \pgf@y=0pt
19484 }
19485 \anchor{leftedge}
19486 {\left
19487 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
19488 }
19489 \savedanchor\inOneFixed{%
19490 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19491 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
19492 \pgf@y=.5\pgf@y
19493 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
19494 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19495 \pgf@x=.5\pgf@x
19496 }
19497 \anchor{in up}{
19498 \inOneFixed
19499 }
19500 \anchor{in down}{
19501 \inOneFixed
19502 \pgf@y=-\pgf@y
19503 }
19504 \savedanchor\inOne{%
19505 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19506 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
19507 \pgf@y=.5\pgf@y
19508 \pgf@y=\ctikzvalof{tripoles/gm amp/input height}\pgf@y
19509 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19510 \pgf@x=.5\pgf@x
19511 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19512 }
19513 \anchor{-}{
19514 \inOne
19515 }
19516 \anchor{+}{
19517 \inOne
19518 \pgf@y=-\pgf@y
19519 }
19520 \savedanchor\up{%
19521 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19522 \pgf@y=\ctikzvalof{tripoles/gm amp/height}\pgf@circ@scaled@Rlen
19523 \pgf@y=.5\pgf@y
19524 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19525 \pgf@x=.5\pgf@x
19526 \pgf@circ@res@up = \pgf@y
19527 \pgf@circ@res@right = -\pgf@x
19528 \pgf@circ@res@left = \pgf@x
19529 \pgfpointlineattime{
19530 \ctikzvalof{tripoles/gm amp/up pos}}{
19531 \pgfpoint{
19532 \ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
19533 {\pgf@circ@res@up}}
19534 {\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/gm amp/height 2}\pgf@circ@res@up}}
19535 }
19536 \anchor{up}{
19537 \up
19538 }
19539 \anchor{down}{
19540 \up
19541 \pgf@y=-\pgf@y
19542 }
19543 \anchor{out}{
19544 \northwest
19545 \pgf@y=0pt
19546 \pgf@x=-\pgf@x
19547 }
19548 % support for border anchors
19549 \savedanchor\leftedge{%
19550 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19551 \pgf@x=-\ctikzvalof{tripoles/gm amp/width}\pgf@circ@scaled@Rlen
19552 \pgf@x=.5\pgf@x
19553 \pgf@x = \ctikzvalof{tripoles/gm amp/port width}\pgf@x
19554 \pgf@y=0pt
19555 }
19556 \anchor{leftedge}{\leftedge}
19557 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
19558 \anchor{bin up}{
19559 \inOneFixed
19560 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19561 }
19562 \anchor{bin down}{
19563 \inOneFixed
19564 \pgf@y=-\pgf@y
19565 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19566 }
19567 \anchor{b-}{
19568 \inOne
19569 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19570 }
19571 \anchor{b+}{
19572 \inOne
19573 \pgf@y=-\pgf@y
19574 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19575 }
19576 \anchor{bout}{
19577 \leftedge
19578 \pgf@y=0pt
19579 \pgf@x=-\pgf@x
19580 }
19581 % end border anchors
19582 \anchor{west}{
19583 \left
19584 }
19585 \anchor{east}{
19586 \left
19587 \pgf@x=-\pgf@x
19588 }
19589 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19590 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
19591 \anchor{north west}{ \northwest }
19592 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
19593
19594 \anchor{text}{
19595 \ifpgf@circ@center@text
19596 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19597 \else
19598 \leftedge
19599 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
19600 \fi
19601 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19602 }
19603 \pgf@circ@draw@component{
19604 \pgf@circ@setcolor
19605
19606 \northwest
19607 \pgf@circ@res@up = \pgf@y
19608 \pgf@circ@res@down = -\pgf@y
19609 \pgf@circ@res@right = -\pgf@x
19610 \pgf@circ@res@left = \pgf@x
19611 \pgf@circ@scaled@Rlen=\scaledRlen
19612
19613 \pgfscope
19614 \newdimen\pgf@circ@res@right@double
19615 \pgf@circ@res@right@double=2\pgf@circ@res@right
19616
19617 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19618 \pgftransformxshift{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
19619 \pgf@circ@res@step=\pgf@circ@res@right
19620 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19621 \pgf@circ@res@step=\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@step
19622 %Umrandung:
19623 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right@double}{0}} %geändert startpunkt neu am ausgangsstrich
19624 \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
19625 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}} %neu ecke links oben nach rechts oben
19626 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}} %bei deneigängen runter
19627 \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
19628 \pgfpathclose
19629 \pgf@circ@draworfill
19630 \endpgfscope
19631
19632 \pgfpathmoveto{\pgfpoint
19633 {\pgf@circ@res@left}
19634 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
19635 \pgfpathlineto{\pgfpoint
19636 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
19637 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@up}}
19638 \pgfpathmoveto{\pgfpoint
19639 {\pgf@circ@res@left}
19640 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
19641 \pgfpathlineto{\pgfpoint
19642 {\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@left}
19643 {\ctikzvalof{tripoles/gm amp/input height}\pgf@circ@res@down}}
19644 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19645 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/gm amp/port width}\pgf@circ@res@right}{0pt}} %
19646 \pgfsetrectcap
19647 \pgfusepath{draw}
19648 \pgf@circ@text@strokecolor
19649 \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}
19650 \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}
19651 }
19652 }
19653
19654 % Instrumentation amplifier
19655 \pgfdeclareshape{inst amp}
19656 {
19657 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19658 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19659 % when tikz calls the anchor it wants the relative position in the lengths
19660 % \pgf@x \pgf@y
19661 % \pgfpoint* functions set that variables
19662 % anchors are visible outside and run on use
19663 \anchor{center}{\pgfpointorigin}
19664 % savedanchors are internals and run on node creation (not use)
19665 % bounding-box top left
19666 \savedanchor\northwest{%
19667 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19668 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19669 \pgf@y=.5\pgf@y
19670 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19671 \pgf@x=.5\pgf@x
19672 }
19673 \anchor{nw}{
19674 \northwest
19675 }
19676 \anchor{south}{
19677 \northwest
19678 \pgf@y=-\pgf@y
19679 }
19680 \anchor{north}{
19681 \northwest
19682 }
19683 \savedanchor\left{%
19684 \pgf@y=0pt
19685 }
19686 \anchor{leftedge}
19687 {\left
19688 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
19689 }
19690 \savedanchor\inOneFixed{%
19691 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19692 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19693 \pgf@y=.5\pgf@y
19694 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
19695 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19696 \pgf@x=.5\pgf@x
19697 }
19698 \anchor{in up}{
19699 \inOneFixed
19700 }
19701 \anchor{in down}{
19702 \inOneFixed
19703 \pgf@y=-\pgf@y
19704 }
19705 \savedanchor\inOne{%
19706 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19707 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19708 \pgf@y=.5\pgf@y
19709 \pgf@y=\ctikzvalof{tripoles/inst amp/input height}\pgf@y
19710 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19711 \pgf@x=.5\pgf@x
19712 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19713 }
19714 \anchor{-}{
19715 \inOne
19716 }
19717 \anchor{+}{
19718 \inOne
19719 \pgf@y=-\pgf@y
19720 }
19721 \savedanchor\up{%
19722 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19723 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19724 \pgf@y=.5\pgf@y
19725 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19726 \pgf@x=.5\pgf@x
19727 \pgf@circ@res@up = \pgf@y
19728 \pgf@circ@res@right = -\pgf@x
19729 \pgf@circ@res@left = \pgf@x
19730 \pgfpointlineattime{
19731 \ctikzvalof{tripoles/inst amp/up pos}}{
19732 \pgfpoint{
19733 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19734 {\pgf@circ@res@up}}
19735 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
19736 }
19737 \anchor{up}{
19738 \up
19739 }
19740 \anchor{down}{
19741 \up
19742 \pgf@y=-\pgf@y
19743 }
19744 % reference voltage input anchors.
19745 \savedanchor\refv{%
19746 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19747 \pgf@y=\ctikzvalof{tripoles/inst amp/height}\pgf@circ@scaled@Rlen
19748 \pgf@y=.5\pgf@y
19749 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19750 \pgf@x=.5\pgf@x
19751 \pgf@circ@res@up = \pgf@y
19752 \pgf@circ@res@right = -\pgf@x
19753 \pgf@circ@res@left = \pgf@x
19754 \pgfpointlineattime{
19755 \ctikzvalof{tripoles/inst amp/refv pos}}{
19756 \pgfpoint{
19757 \ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19758 {\pgf@circ@res@up}}
19759 {\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
19760 }
19761 % we need both because they are normally drawn under the amp, and if you
19762 % mirror it vertically you need them
19763 \anchor{refv up}{
19764 \refv
19765 }
19766 \anchor{refv down}{
19767 \refv
19768 \pgf@y=-\pgf@y
19769 }
19770 \anchor{out}{
19771 \northwest
19772 \pgf@y=0pt
19773 \pgf@x=-\pgf@x
19774 }
19775 % support for border anchors
19776 \savedanchor\leftedge{%
19777 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19778 \pgf@x=-\ctikzvalof{tripoles/inst amp/width}\pgf@circ@scaled@Rlen
19779 \pgf@x=.5\pgf@x
19780 \pgf@x = \ctikzvalof{tripoles/inst amp/port width}\pgf@x
19781 \pgf@y=0pt
19782 }
19783 \anchor{leftedge}{\leftedge}
19784 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
19785 \anchor{bin up}{
19786 \inOneFixed
19787 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19788 }
19789 \anchor{bin down}{
19790 \inOneFixed
19791 \pgf@y=-\pgf@y
19792 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19793 }
19794 \anchor{b-}{
19795 \inOne
19796 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19797 }
19798 \anchor{b+}{
19799 \inOne
19800 \pgf@y=-\pgf@y
19801 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
19802 }
19803 \anchor{bout}{
19804 \leftedge
19805 \pgf@y=0pt
19806 \pgf@x=-\pgf@x
19807 }
19808 % end border anchors
19809 \anchor{west}{
19810 \left
19811 }
19812 \anchor{east}{
19813 \left
19814 \pgf@x=-\pgf@x
19815 }
19816 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
19817 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
19818 \anchor{north west}{ \northwest }
19819 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
19820
19821 \anchor{text}{
19822 \ifpgf@circ@center@text
19823 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
19824 \else
19825 \leftedge
19826 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
19827 \fi
19828 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
19829 }
19830
19831 % let's start drawing the component
19832 \pgf@circ@draw@component{
19833 \pgf@circ@setcolor
19834 %
19835 \northwest
19836 \pgf@circ@res@up = \pgf@y
19837 \pgf@circ@res@down = -\pgf@y
19838 \pgf@circ@res@right = -\pgf@x
19839 \pgf@circ@res@left = \pgf@x
19840 \pgf@circ@scaled@Rlen=\scaledRlen
19841
19842 % main component, normally in thicker lines
19843 \pgfscope
19844 \newdimen\pgf@circ@res@right@double
19845 \pgf@circ@res@right@double=2\pgf@circ@res@right
19846
19847 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
19848 \pgftransformxshift{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19849 \pgf@circ@res@step=\pgf@circ@res@right
19850 \advance\pgf@circ@res@step by -\pgf@circ@res@left
19851 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@step
19852 %first point (near output)
19853 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{0}}
19854 %from the exit to the top (short side)... (note that the .6 must be copied in \up and \refv anchors
19855 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@up}}
19856 % and then to the input "front up", "down", to the output short side "down"
19857 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
19858 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
19859 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right@double}{\ctikzvalof{tripoles/inst amp/height 2}\pgf@circ@res@down}}
19860 % ...and close
19861 \pgfpathclose
19862 \pgf@circ@draworfill
19863 \endpgfscope
19864
19865 % Negative input terminal
19866 \pgfpathmoveto{\pgfpoint
19867 {\pgf@circ@res@left}
19868 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
19869 %
19870 \pgfpathlineto{\pgfpoint
19871 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19872 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@up}}
19873 %
19874
19875 % Positive input terminal
19876 \pgfpathmoveto{\pgfpoint
19877 {\pgf@circ@res@left}
19878 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
19879 %
19880 \pgfpathlineto{\pgfpoint
19881 {\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@left}
19882 {\ctikzvalof{tripoles/inst amp/input height}\pgf@circ@res@down}}
19883
19884 % Output terminal
19885 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
19886 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp/port width}\pgf@circ@res@right}{0pt}} %
19887 %
19888 \pgfsetrectcap
19889 \pgfusepath{draw}
19890 \pgf@circ@text@strokecolor
19891 \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}
19892 \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}
19893 }
19894 }
19895
19896 % Instrumentation amplifier with terminals for gain resistance between inputs
19897 \pgfdeclareshape{inst amp ra}
19898 {
19899 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
19900 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
19901 \anchor{center}{\pgfpointorigin}
19902 % bounding-box top left
19903 \savedanchor\northwest{%
19904 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19905 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19906 \pgf@y=.5\pgf@y
19907 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19908 \pgf@x=.5\pgf@x
19909 }
19910 \anchor{nw}{
19911 \northwest
19912 }
19913 \anchor{south}{
19914 \northwest
19915 \pgf@y=-\pgf@y\pgf@x=0pt\relax
19916 }
19917 \anchor{north}{
19918 \northwest\pgf@x=0pt\relax
19919 }
19920 \savedanchor\left{%
19921 \pgf@y=0pt
19922 }
19923 \anchor{leftedge}
19924 {\left
19925 \pgf@x = \ctikzvalof{tripoles/op amp/port width}\pgf@x
19926 }
19927 % inputs (+-)
19928 \savedanchor\inOneFixed{%
19929 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19930 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19931 \pgf@y=.5\pgf@y
19932 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
19933 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19934 \pgf@x=.5\pgf@x
19935 }
19936 \anchor{in up}{
19937 \inOneFixed
19938 }
19939 \anchor{in down}{
19940 \inOneFixed
19941 \pgf@y=-\pgf@y
19942 }
19943 \savedanchor\inOne{%
19944 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19945 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19946 \pgf@y=.5\pgf@y
19947 \pgf@y=\ctikzvalof{tripoles/inst amp ra/input height}\pgf@y
19948 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19949 \pgf@x=.5\pgf@x
19950 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19951 }
19952 \anchor{-}{
19953 \inOne
19954 }
19955 \anchor{+}{
19956 \inOne
19957 \pgf@y=-\pgf@y
19958 }
19959 % R ampli anchors. They are by default at 20% more than R-length distance
19960 % you can change that with the `ra pos` key (use 0.5 for one-R).
19961 \savedanchor\raOneFixed{%
19962 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19963 \pgf@y=\pgf@circ@scaled@Rlen
19964 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
19965 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19966 \pgf@x=.5\pgf@x
19967 }
19968 \anchor{ra up}{
19969 \raOneFixed
19970 }
19971 \anchor{ra down}{
19972 \raOneFixed
19973 \pgf@y=-\pgf@y
19974 }
19975 \savedanchor\raOne{%
19976 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19977 \pgf@y=\pgf@circ@scaled@Rlen
19978 \pgf@y=\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@y
19979 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19980 \pgf@x=.5\pgf@x
19981 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
19982 }
19983 \anchor{ra-}{
19984 \raOne
19985 }
19986 \anchor{ra+}{
19987 \raOne
19988 \pgf@y=-\pgf@y
19989 }
19990 % power supplies
19991 \savedanchor\up{%
19992 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
19993 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
19994 \pgf@y=.5\pgf@y
19995 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
19996 \pgf@x=.5\pgf@x
19997 \pgf@circ@res@up = \pgf@y
19998 \pgf@circ@res@right = -\pgf@x
19999 \pgf@circ@res@left = \pgf@x
20000 \pgfpointlineattime{
20001 \ctikzvalof{tripoles/inst amp ra/up pos}}{
20002 \pgfpoint{
20003 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
20004 {\pgf@circ@res@up}}
20005 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
20006 }
20007 \anchor{up}{
20008 \up
20009 }
20010 \anchor{down}{
20011 \up
20012 \pgf@y=-\pgf@y
20013 }
20014 % reference voltage input anchors.
20015 \savedanchor\refv{%
20016 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20017 \pgf@y=\ctikzvalof{tripoles/inst amp ra/height}\pgf@circ@scaled@Rlen
20018 \pgf@y=0.5\pgf@y
20019 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
20020 \pgf@x=0.5\pgf@x
20021 \pgf@circ@res@up = \pgf@y
20022 \pgf@circ@res@right = -\pgf@x
20023 \pgf@circ@res@left = \pgf@x
20024 \pgfpointlineattime{
20025 \ctikzvalof{tripoles/inst amp ra/refv pos}}{
20026 \pgfpoint{
20027 \ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
20028 {\pgf@circ@res@up}}
20029 {\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{\ctikzvalof{tripoles/inst amp ra/height 2}\pgf@circ@res@up}}
20030 }
20031 % we need both because they are normally drawn under the amp, and if you
20032 % mirror it vertically you need them
20033 \anchor{refv up}{
20034 \refv
20035 }
20036 \anchor{refv down}{
20037 \refv
20038 \pgf@y=-\pgf@y
20039 }
20040 \anchor{out}{
20041 \northwest
20042 \pgf@y=0pt
20043 \pgf@x=-\pgf@x
20044 }
20045 % support for border anchors
20046 \savedanchor\leftedge{%
20047 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20048 \pgf@x=-\ctikzvalof{tripoles/inst amp ra/width}\pgf@circ@scaled@Rlen
20049 \pgf@x=.5\pgf@x
20050 \pgf@x = \ctikzvalof{tripoles/inst amp ra/port width}\pgf@x
20051 \pgf@y=0pt
20052 }
20053 \anchor{leftedge}{\leftedge}
20054 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
20055 \anchor{bin up}{
20056 \inOneFixed
20057 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20058 }
20059 \anchor{bin down}{
20060 \inOneFixed
20061 \pgf@y=-\pgf@y
20062 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20063 }
20064 \anchor{b-}{
20065 \inOne
20066 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20067 }
20068 \anchor{b+}{
20069 \inOne
20070 \pgf@y=-\pgf@y
20071 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20072 }
20073 \anchor{bra up}{
20074 \raOneFixed
20075 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20076 }
20077 \anchor{bra down}{
20078 \raOneFixed
20079 \pgf@y=-\pgf@y
20080 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20081 }
20082 \anchor{bra-}{
20083 \raOne
20084 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20085 }
20086 \anchor{bra+}{
20087 \raOne
20088 \pgf@y=-\pgf@y
20089 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20090 }
20091 \anchor{bout}{
20092 \leftedge
20093 \pgf@y=0pt
20094 \pgf@x=-\pgf@x
20095 }
20096 % end border anchors
20097 \anchor{west}{
20098 \left
20099 }
20100 \anchor{east}{
20101 \left
20102 \pgf@x=-\pgf@x
20103 }
20104 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
20105 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
20106 \anchor{north west}{ \northwest }
20107 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
20108
20109 \anchor{text}{
20110 \ifpgf@circ@center@text
20111 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
20112 \else
20113 \leftedge
20114 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
20115 \fi
20116 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
20117 }
20118
20119 % drawing of the component
20120 \pgf@circ@draw@component{
20121 \pgf@circ@setcolor
20122
20123 \northwest
20124 \pgf@circ@res@up = \pgf@y
20125 \pgf@circ@res@down = -\pgf@y
20126 \pgf@circ@res@right = -\pgf@x
20127 \pgf@circ@res@left = \pgf@x
20128 \pgf@circ@scaled@Rlen=\scaledRlen
20129
20130 \newdimen\pgf@circ@res@right@double
20131 \pgf@circ@res@right@double=2\pgf@circ@res@right
20132
20133 % main component, normally in thicker lines
20134 \pgfscope
20135 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20136 \pgftransformxshift{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
20137 \pgf@circ@res@step=\pgf@circ@res@right
20138 \advance\pgf@circ@res@step by -\pgf@circ@res@left
20139 \pgf@circ@res@step=\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@step
20140 %primer punto: la linea de salida (lado componente)
20141 \pgfpathmoveto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right@double}{0}}
20142 %from the exit to the top (short side)... (note that the .6 must be copied in \up anchor
20143 \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}}
20144 % and then to the input "front up", "down", to the output short side "down"
20145 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20146 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
20147 \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}}
20148 % ...and close
20149 \pgfpathclose
20150 \pgf@circ@draworfill
20151 \endpgfscope
20152
20153 % ra terminal -
20154 \pgfpathmoveto{\pgfpoint
20155 {\pgf@circ@res@left}
20156 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
20157 %
20158 \pgfpathlineto{\pgfpoint
20159 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
20160 {\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
20161 % ra terminal +
20162 \pgfpathmoveto{\pgfpoint
20163 {\pgf@circ@res@left}
20164 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
20165 %
20166 \pgfpathlineto{\pgfpoint
20167 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
20168 {-\ctikzvalof{tripoles/inst amp ra/ra pos}\pgf@circ@scaled@Rlen}}
20169
20170 % Negative input terminal
20171 \pgfpathmoveto{\pgfpoint
20172 {\pgf@circ@res@left}
20173 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
20174 %
20175 \pgfpathlineto{\pgfpoint
20176 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
20177 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@up}}
20178 %
20179
20180 % Positive input terminal
20181 \pgfpathmoveto{\pgfpoint
20182 {\pgf@circ@res@left}
20183 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
20184 %
20185 \pgfpathlineto{\pgfpoint
20186 {\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@left}
20187 {\ctikzvalof{tripoles/inst amp ra/input height}\pgf@circ@res@down}}
20188
20189 % Output terminal
20190 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20191 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/inst amp ra/port width}\pgf@circ@res@right}{0pt}} %
20192 %
20193 \pgfsetrectcap
20194 \pgfusepath{draw}
20195 \pgf@circ@text@strokecolor
20196 \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}
20197 \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}
20198 }
20199 }
20200
20201 % Buffer
20202 % Contributed by Danilo Piazzalunga
20203 \pgfdeclareshape{buffer}
20204 {
20205 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
20206 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20207 \anchor{center}{\pgfpointorigin}
20208 \savedanchor\northwest{%
20209 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20210 \pgf@y=\ctikzvalof{bipoles/buffer/height}\pgf@circ@scaled@Rlen
20211 \pgf@y=.5\pgf@y
20212 \pgf@x=-\ctikzvalof{bipoles/buffer/width}\pgf@circ@scaled@Rlen
20213 \pgf@x=.5\pgf@x
20214 }
20215 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
20216 \anchor{west}{ \northwest \pgf@y=0pt }
20217 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
20218 \anchor{north}{ \northwest \pgf@x=0pt }
20219 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
20220 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
20221 \anchor{north west}{ \northwest }
20222 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
20223 \savedanchor\left{%
20224 \pgf@y=0pt
20225 }
20226 \anchor{in}{
20227 \northwest
20228 \pgf@y=0pt
20229 }
20230 \anchor{out}{
20231 \northwest
20232 \pgf@y=0pt
20233 \pgf@x=-\pgf@x
20234 }
20235 \anchor{bin}{
20236 \northwest
20237 \pgf@y=0pt
20238 \pgf@x=0.7\pgf@x
20239 }
20240 \anchor{bout}{
20241 \northwest
20242 \pgf@y=0pt
20243 \pgf@x=-0.7\pgf@x
20244 }
20245
20246 \anchor{text}{
20247 \ifpgf@circ@center@text
20248 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
20249 \else
20250 \northwest
20251 \pgfmathsetlength{\pgf@x}{0.7*\pgf@x + \ctikzvalof{left text distance}}
20252 \fi
20253 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
20254 }
20255
20256 \pgf@circ@draw@component{
20257 \pgf@circ@setcolor
20258
20259 \northwest
20260 \pgf@circ@res@up = \pgf@y
20261 \pgf@circ@res@down = -\pgf@y
20262 \pgf@circ@res@right = -\pgf@x
20263 \pgf@circ@res@left = \pgf@x
20264 \pgf@circ@scaled@Rlen=\scaledRlen
20265 \pgfscope
20266 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20267 \pgftransformxshift{.7\pgf@circ@res@left}
20268 \pgf@circ@res@step=\pgf@circ@res@right
20269 \advance\pgf@circ@res@step by -\pgf@circ@res@left
20270 \pgf@circ@res@step=.7\pgf@circ@res@step
20271
20272 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
20273 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20274 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
20275 \pgfpathclose
20276 \pgf@circ@draworfill
20277 \endpgfscope
20278
20279 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
20280 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@left}{0pt}}
20281
20282 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20283 \pgfpathlineto{\pgfpoint{.7\pgf@circ@res@right}{0pt}}
20284
20285 \pgfusepath{draw}
20286 }
20287 }
20288
20289 % plain amplifier, no symbols
20290 \pgfdeclareshape{plain amp}
20291 {
20292 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
20293 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20294 \anchor{center}{\pgfpointorigin}
20295 \savedanchor\northwest{%
20296 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20297 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20298 \pgf@y=.5\pgf@y
20299 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20300 \pgf@x=.5\pgf@x
20301 }
20302 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
20303 \anchor{west}{ \northwest \pgf@y=0pt }
20304 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
20305 \anchor{north}{ \northwest \pgf@x=0pt }
20306 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
20307 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
20308 \anchor{north west}{ \northwest }
20309 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
20310 \savedanchor\left{%
20311 \pgf@y=0pt
20312 }
20313 \savedanchor\inOne{%
20314 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20315 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20316 \pgf@y=.5\pgf@y
20317 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
20318 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20319 \pgf@x=.5\pgf@x
20320 \ifpgf@circuit@oa@iplusup\pgf@y=-\pgf@y\fi
20321 }
20322 \savedanchor\inOneFixed{%
20323 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20324 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20325 \pgf@y=.5\pgf@y
20326 \pgf@y=\ctikzvalof{tripoles/plain amp/input height}\pgf@y
20327 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20328 \pgf@x=.5\pgf@x
20329 }
20330 \anchor{-}{
20331 \inOne
20332 }
20333 \anchor{+}{
20334 \inOne
20335 \pgf@y=-\pgf@y
20336 }
20337 \anchor{in up}{
20338 \inOneFixed
20339 }
20340 \anchor{in down}{
20341 \inOneFixed
20342 \pgf@y=-\pgf@y
20343 }
20344 % support for border anchors
20345 \savedanchor\leftedge{%
20346 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20347 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20348 \pgf@x=.5\pgf@x
20349 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
20350 \pgf@y=0pt
20351 }
20352 \anchor{leftedge}{\leftedge}
20353 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
20354 \anchor{bin up}{
20355 \inOneFixed
20356 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20357 }
20358 \anchor{bin down}{
20359 \inOneFixed
20360 \pgf@y=-\pgf@y
20361 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20362 }
20363 \anchor{b-}{
20364 \inOne
20365 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20366 }
20367 \anchor{b+}{
20368 \inOne
20369 \pgf@y=-\pgf@y
20370 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20371 }
20372 \anchor{bout}{
20373 \leftedge
20374 \pgf@y=0pt
20375 \pgf@x=-\pgf@x
20376 }
20377 % end border anchors
20378 \savedanchor\up{%
20379 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20380 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20381 \pgf@y=.5\pgf@y
20382 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20383 \pgf@x=.5\pgf@x
20384 \pgf@circ@res@up = \pgf@y
20385 \pgf@circ@res@right = -\pgf@x
20386 \pgf@circ@res@left = \pgf@x
20387 \pgfpointlineattime{
20388 \ctikzvalof{tripoles/plain amp/up pos}}{
20389 \pgfpoint{
20390 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20391 {\pgf@circ@res@up}}
20392 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
20393 }
20394 \anchor{up}{
20395 \up
20396 }
20397 \anchor{down}{
20398 \up
20399 \pgf@y=-\pgf@y
20400 }
20401 \anchor{out}{
20402 \northwest
20403 \pgf@y=0pt
20404 \pgf@x=-\pgf@x
20405 }
20406
20407 \anchor{text}{
20408 \ifpgf@circ@center@text
20409 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
20410 \else
20411 \leftedge
20412 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
20413 \fi
20414 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
20415 }
20416
20417 \pgf@circ@draw@component{
20418 \pgf@circ@setcolor
20419
20420 \northwest
20421 \pgf@circ@res@up = \pgf@y
20422 \pgf@circ@res@down = -\pgf@y
20423 \pgf@circ@res@right = -\pgf@x
20424 \pgf@circ@res@left = \pgf@x
20425
20426 \pgfscope
20427 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20428 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20429 \pgf@circ@res@step=\pgf@circ@res@right
20430 \advance\pgf@circ@res@step by -\pgf@circ@res@left
20431 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
20432
20433 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
20434 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20435 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
20436 \pgfpathclose
20437 \pgf@circ@draworfill
20438 \endpgfscope
20439 \pgfpathmoveto{\pgfpoint
20440 {\pgf@circ@res@left}
20441 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
20442 \pgfpathlineto{\pgfpoint
20443 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20444 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@up}}
20445
20446
20447 \pgfpathmoveto{\pgfpoint
20448 {\pgf@circ@res@left}
20449 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
20450 \pgfpathlineto{\pgfpoint
20451 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20452 {\ctikzvalof{tripoles/plain amp/input height}\pgf@circ@res@down}}
20453
20454 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20455 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
20456
20457 \pgfusepath{draw}
20458 }
20459 }
20460
20461 % plain amplifier, no symbols, one input
20462 \pgfdeclareshape{plain mono amp}
20463 {
20464 \savedmacro{\ctikzclass}{\edef\ctikzclass{amplifiers}}
20465 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20466 \anchor{center}{\pgfpointorigin}
20467 \savedanchor\northwest{%
20468 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20469 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20470 \pgf@y=.5\pgf@y
20471 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20472 \pgf@x=.5\pgf@x
20473 }
20474 \anchor{east}{ \northwest \pgf@y=0pt \pgf@x=-\pgf@x }
20475 \anchor{west}{ \northwest \pgf@y=0pt }
20476 \anchor{south}{ \northwest \pgf@x=0pt \pgf@y=-\pgf@y }
20477 \anchor{north}{ \northwest \pgf@x=0pt }
20478 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
20479 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
20480 \anchor{north west}{ \northwest }
20481 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
20482 \savedanchor\left{%
20483 \pgf@y=0pt
20484 }
20485 \savedanchor\inOne{%
20486 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20487 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20488 \pgf@x=.5\pgf@x
20489 \pgf@y=0pt\relax
20490 }
20491 \anchor{in}{
20492 \inOne
20493 }
20494 % support for border anchors
20495 \savedanchor\leftedge{%
20496 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20497 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20498 \pgf@x=.5\pgf@x
20499 \pgf@x = \ctikzvalof{tripoles/plain amp/port width}\pgf@x
20500 \pgf@y=0pt
20501 }
20502 \anchor{leftedge}{\leftedge}
20503 \anchor{rightedge}{\leftedge \pgf@x =-\pgf@x }
20504 \anchor{bin}{
20505 \inOne
20506 \pgf@ya=\pgf@y \leftedge \pgf@y=\pgf@ya
20507 }
20508 \anchor{bout}{
20509 \leftedge
20510 \pgf@y=0pt
20511 \pgf@x=-\pgf@x
20512 }
20513 % end border anchors
20514 \savedanchor\up{%
20515 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20516 \pgf@y=\ctikzvalof{tripoles/plain amp/height}\pgf@circ@scaled@Rlen
20517 \pgf@y=.5\pgf@y
20518 \pgf@x=-\ctikzvalof{tripoles/plain amp/width}\pgf@circ@scaled@Rlen
20519 \pgf@x=.5\pgf@x
20520 \pgf@circ@res@up = \pgf@y
20521 \pgf@circ@res@right = -\pgf@x
20522 \pgf@circ@res@left = \pgf@x
20523 \pgfpointlineattime{
20524 \ctikzvalof{tripoles/plain amp/up pos}}{
20525 \pgfpoint{
20526 \ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20527 {\pgf@circ@res@up}}
20528 {\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
20529 }
20530 \anchor{up}{
20531 \up
20532 }
20533 \anchor{down}{
20534 \up
20535 \pgf@y=-\pgf@y
20536 }
20537 \anchor{out}{
20538 \northwest
20539 \pgf@y=0pt
20540 \pgf@x=-\pgf@x
20541 }
20542
20543 \anchor{text}{
20544 \ifpgf@circ@center@text
20545 \pgf@x=\dimexpr -.6\wd\pgfnodeparttextbox\relax
20546 \else
20547 \leftedge
20548 \pgfmathsetlength{\pgf@x}{\pgf@x + \ctikzvalof{left text distance}}
20549 \fi
20550 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax
20551 }
20552 \pgf@circ@draw@component{
20553 \pgf@circ@setcolor
20554
20555 \northwest
20556 \pgf@circ@res@up = \pgf@y
20557 \pgf@circ@res@down = -\pgf@y
20558 \pgf@circ@res@right = -\pgf@x
20559 \pgf@circ@res@left = \pgf@x
20560
20561 \pgfscope
20562 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
20563 \pgftransformxshift{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20564 \pgf@circ@res@step=\pgf@circ@res@right
20565 \advance\pgf@circ@res@step by -\pgf@circ@res@left
20566 \pgf@circ@res@step=\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@step
20567
20568 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@step}{0pt}}
20569 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20570 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down}}
20571 \pgfpathclose
20572 \pgf@circ@draworfill
20573 \endpgfscope
20574 \pgfpathmoveto{\pgfpoint
20575 {\pgf@circ@res@left}
20576 {0pt}}
20577 \pgfpathlineto{\pgfpoint
20578 {\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@left}
20579 {0pt}}
20580
20581 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20582 \pgfpathlineto{\pgfpoint{\ctikzvalof{tripoles/plain amp/port width}\pgf@circ@res@right}{0pt}}
20583
20584 \pgfusepath{draw}
20585 }
20586 }% %>>>
20587
20588 %%%%%%%%%%%%%%%%%%%%%%%%%%%
20589 %% Tubes and magnetron
20590 %%%%%%%%%%%%%%%%%%%%%%%%
20591
20592 % Settings Electronic tubes: diodetube, triode, tetrode and pentode%<<<1
20593 \ctikzset{tubes/width/.initial=1} % relative width
20594 \ctikzset{tubes/height/.initial=1.4} % relative height
20595 \ctikzset{tubes/tube radius/.initial=0.40} % radius of tube circle
20596 \ctikzset{tubes/anode distance/.initial=0.40} % distance from center
20597 \ctikzset{tubes/anode width/.initial=0.40} % width of an anode/plate
20598 \ctikzset{tubes/grid protrusion/.initial=0.25} % distance from center
20599 \ctikzset{tubes/grid dashes/.initial=5} % number of grid dashes
20600 \ctikzset{tubes/grid separation/.initial=0.2} % separation between grids
20601 \ctikzset{tubes/grid shift/.initial=0.0} % y shift grids from center
20602 \ctikzset{tubes/cathode distance/.initial=0.40} % distance from grid
20603 \ctikzset{tubes/cathode width/.initial=0.40} % width of an cathode
20604 \ctikzset{tubes/cathode corners/.initial=0.06} % corners of the cathode wire
20605 \ctikzset{tubes/cathode right extend/.initial=0.075} % extension at the right side
20606 \ctikzset{tubes/filament distance/.initial=0.1} % distance from cathode
20607 \ctikzset{tubes/filament angle/.initial=15} % Angle from centerpoint
20608 % partial borders styles
20609 % this can be "none" or 6 numbers saying the style for each part:
20610 % 0 --- nothing, 1 --- solid, 2 --- dashed
20611 \ctikzset{tubes/partial borders/.initial=none} % Value none for normal borders
20612 \ctikzset{tubes/partial border dash/.initial={{2pt}{2pt}}}
20613
20614 \ctikzset{/tikz/circuitikz/tripoles/magnetron/width/.initial=1}
20615
20616 \newif\ifpgf@circuit@tubes@filament\pgf@circuit@tubes@filamentfalse
20617 \pgfkeys{/tikz/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
20618 \ctikzset{tubes/filament/.add code={}{\pgf@circuit@tubes@filamenttrue}}
20619 \newif\ifpgf@circuit@tubes@nocathode\pgf@circuit@tubes@nocathodefalse
20620 \pgfkeys{/tikz/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
20621 \ctikzset{tubes/nocathode/.add code={}{\pgf@circuit@tubes@nocathodetrue}}
20622 \newif\ifpgf@circuit@tubes@fullcathode\pgf@circuit@tubes@fullcathodefalse
20623 \pgfkeys{/tikz/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}
20624 \ctikzset{tubes/fullcathode/.add code={}{\pgf@circuit@tubes@fullcathodetrue}}%
20625 %>>>
20626
20627 %% Node shapes for tubes & co%<<<
20628
20629 %%%%%%%%%%%%%%%%%%%
20630 %% Magnetron
20631 %%%%%%%%%%%%%%%%%%%
20632
20633 \pgfdeclareshape{magnetron}
20634 {
20635 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}} % class of these components
20636 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20637 \savedanchor\northwest{
20638 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20639 \pgf@y=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
20640 \pgf@y=.5\pgf@y
20641 \pgf@x=-\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
20642 \pgf@x=.5\pgf@x
20643 }
20644 \anchor{center}{
20645 \pgfpointorigin
20646 }
20647 \anchor{anode}{
20648 \northwest
20649 \pgf@x=0pt
20650 \pgf@y=-\pgf@y
20651 }
20652 \anchor{cathode1}{
20653 \northwest
20654 \pgf@circ@res@step=\pgf@y
20655 \pgfmathparse{cos(105)}
20656 \pgf@x=\pgfmathresult\pgf@circ@res@step
20657 \pgfmathparse{sin(105)}
20658 \pgf@y=\pgfmathresult\pgf@circ@res@step
20659 %\pgfpointorigin
20660 %\pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
20661 }
20662 \anchor{cathode2}{
20663 \northwest
20664 \pgf@circ@res@step=\pgf@y
20665 \pgfmathparse{cos(75)}
20666 \pgf@x=\pgfmathresult\pgf@circ@res@step
20667 \pgfmathparse{sin(75)}
20668 \pgf@y=\pgfmathresult\pgf@circ@res@step
20669 %\pgfpointorigin
20670 %\pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@step}}%not working in a scaled tikzpicture
20671 }
20672 \anchor{text}{
20673 \pgfpointorigin
20674 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
20675 \advance \pgf@y by -.5\ht\pgfnodeparttextbox
20676 }
20677 \anchor{left}{%
20678 \northwest
20679 \pgf@y=0pt
20680 }
20681 \anchor{right}{%
20682 \northwest
20683 \pgf@y=0pt
20684 \pgf@x=-\pgf@x
20685 }
20686 \anchor{top}{
20687 \northwest
20688 \pgf@x=0pt
20689 }
20690 \anchor{pathstart}{
20691 \northwest
20692 \pgf@x=0pt
20693 }
20694 \anchor{pathend}{
20695 \northwest
20696 \pgf@x=0pt
20697 \pgf@y=-\pgf@y
20698 }
20699 \anchor{bottom}{
20700 \northwest
20701 \pgf@x=0pt
20702 \pgf@y=-\pgf@y
20703 }
20704 \anchor{center}{
20705 \pgf@y=0pt
20706 \pgf@x=0pt
20707 }
20708 \anchor{east}{
20709 \northwest
20710 \pgf@y=0pt
20711 \pgf@x=-\pgf@x
20712 }
20713 \anchor{west}{
20714 \northwest
20715 \pgf@y=0pt
20716 }
20717 \anchor{south}{
20718 \northwest
20719 \pgf@x=0pt
20720 \pgf@y=-\pgf@y
20721 }
20722 \anchor{north}{
20723 \northwest
20724 \pgf@x=0pt
20725 }
20726 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
20727 \anchor{north east}{ \northwest \pgf@x=-\pgf@x }
20728 \anchor{north west}{ \northwest }
20729 \anchor{south east}{ \northwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y }
20730 \pgf@circ@draw@component{
20731 \pgf@circ@setcolor
20732 \pgf@circ@scaled@Rlen=\scaledRlen
20733 \pgf@circ@res@step=\ctikzvalof{tripoles/magnetron/width}\pgf@circ@scaled@Rlen
20734 \northwest
20735 \pgf@circ@res@up = \pgf@y
20736 \pgf@circ@res@down = -\pgf@y
20737 \pgf@circ@res@right = -\pgf@x
20738 \pgf@circ@res@left = \pgf@x
20739 \pgfmathsetlength{\pgf@circ@res@other}{sin(15)*\pgf@circ@res@up}
20740
20741 \pgfscope
20742 \pgfstartlinewidth=\pgflinewidth
20743 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
20744 %create outer circle
20745 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@right}
20746 \pgf@circ@draworfill
20747 %create chambers
20748 \foreach \angle in {45,135,225,315}{
20749 \pgfpathmoveto{ \pgfpointpolar{\angle}{0.6\pgf@circ@res@right}}
20750 \pgfpathlineto{ \pgfpointpolar{\angle}{\pgf@circ@res@right}}
20751 }
20752 \pgfsetroundcap
20753 \pgfusepath{draw}
20754 \pgfscope
20755 %draw connection from outside
20756 %anode
20757 \pgfsetlinewidth{\pgfstartlinewidth}
20758 \pgfpathmoveto{\pgfpoint{0\pgf@circ@res@left}{\pgf@circ@res@down}}
20759 \pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{.5\pgf@circ@res@down}}
20760 %cathodes
20761 \pgfpathmoveto{\pgfpointpolar{105}{\pgf@circ@res@up}}
20762 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
20763 \pgfpathmoveto{\pgfpointpolar{75}{\pgf@circ@res@up}}
20764 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
20765 \pgfsetbuttcap
20766 \pgfusepath{draw}
20767 \endpgfscope
20768 %create cathode
20769 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{.5\pgf@circ@res@up}}
20770 \pgfpathlineto{\pgfpoint{0}{.15\pgf@circ@res@up}}
20771 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@other}{.5\pgf@circ@res@up}}
20772 \pgfusepath{draw}
20773 %create anode
20774 \pgfpathmoveto{\pgfpoint{0.3\pgf@circ@res@left}{.5\pgf@circ@res@down}}
20775 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@right}{.5\pgf@circ@res@down}}
20776
20777 \pgfsetbuttcap
20778 \pgfusepath{draw}
20779 \endpgfscope
20780 }
20781 }
20782
20783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20784 % Electronic tubes, submitted by J. op den Brouw
20785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20786 %
20787 % draw partial tube outline
20788 %
20789 \def\pgf@circ@tubes@split#1#2#3#4#5#6\relax{%split the six numbers
20790 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}%
20791 }
20792 \def\pgf@circ@tubes@setdash{%
20793 \edef\@@dash{\ctikzvalof{tubes/partial border dash}}%
20794 % \typeout{DASH:\@@dash}%
20795 \expandafter\pgfsetdash\expandafter{\@@dash}{0pt}%
20796 }
20797 % this is the same as the transistor circles' one, but let's keep it separated
20798 \def\pgf@circ@tubes@draw@style#1{%
20799 \ifcase#1
20800 \pgfusepath{discard}% case 0, will discard the path
20801 \or
20802 \pgfsetdash{}{0pt}\pgfusepath{draw}% case 1, solid
20803 \or
20804 \pgf@circ@tubes@setdash\pgfusepath{draw}% case 2, dashed
20805 \else
20806 \pgfutil@packagewarning{circuitikz}{Tube border draw style not known!}%
20807 \pgfusepath{draw}%
20808 \fi
20809 }
20810 \def\pgf@circ@tubes@draw@partial#1{%
20811 \expandafter\pgf@circ@tubes@split#1\relax
20812 % \typeout{PARTIAL: \@@a:\@@b:\@@c:\@@d:\@@e:\@@f}
20813 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
20814 % horizontal tube
20815 \pgfutil@tempdima=\pgf@circ@res@right
20816 \advance\pgfutil@tempdima by -\pgf@circ@res@up
20817 \pgfscope % left side upper arc
20818 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
20819 \pgfpatharc{180}{90}{\pgf@circ@res@up}
20820 \pgf@circ@tubes@draw@style{\@@a}
20821 \endpgfscope
20822 \pgfscope % upper horizontal part
20823 \pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{\pgf@circ@res@up}}
20824 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
20825 \pgf@circ@tubes@draw@style{\@@b}
20826 \endpgfscope
20827 \pgfscope % right side upper arc
20828 \pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
20829 \pgfpatharc{90}{0}{\pgf@circ@res@up}
20830 \pgf@circ@tubes@draw@style{\@@c}
20831 \endpgfscope
20832 \pgfscope % right side lower arc
20833 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
20834 \pgfpatharc{0}{-90}{\pgf@circ@res@up}
20835 \pgf@circ@tubes@draw@style{\@@d}
20836 \endpgfscope
20837 \pgfscope % lower horizontal part
20838 \pgfpathmoveto{\pgfpoint{\pgfutil@tempdima}{-\pgf@circ@res@up}}
20839 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
20840 \pgf@circ@tubes@draw@style{\@@e}
20841 \endpgfscope
20842 \pgfscope % left side lower arc
20843 \pgfpathmoveto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
20844 \pgfpatharc{270}{180}{\pgf@circ@res@up}
20845 \pgf@circ@tubes@draw@style{\@@f}
20846 \endpgfscope
20847 \else
20848 % vertical tube
20849 \pgfutil@tempdima=\pgf@circ@res@up
20850 \advance\pgfutil@tempdima by -\pgf@circ@res@right
20851 \pgfscope % left side upper arc
20852 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20853 \pgfpatharc{90}{0}{\pgf@circ@res@right}
20854 \pgf@circ@tubes@draw@style{\@@a}
20855 \endpgfscope
20856 \pgfscope % right vertical part
20857 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgfutil@tempdima}}
20858 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
20859 \pgf@circ@tubes@draw@style{\@@b}
20860 \endpgfscope
20861 \pgfscope % right side lower arc
20862 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
20863 \pgfpatharc{0}{-90}{\pgf@circ@res@right}
20864 \pgf@circ@tubes@draw@style{\@@c}
20865 \endpgfscope
20866 \pgfscope % right side lower arc
20867 \pgfpathmoveto{\pgfpoint{0pt}{-\pgf@circ@res@up}}
20868 \pgfpatharc{-90}{-180}{\pgf@circ@res@right}
20869 \pgf@circ@tubes@draw@style{\@@d}
20870 \endpgfscope
20871 \pgfscope % left vertical part
20872 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{-\pgfutil@tempdima}}
20873 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
20874 \pgf@circ@tubes@draw@style{\@@e}
20875 \endpgfscope
20876 \pgfscope % left side upper arc
20877 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
20878 \pgfpatharc{180}{90}{\pgf@circ@res@right}
20879 \pgf@circ@tubes@draw@style{\@@f}
20880 \endpgfscope
20881 \fi
20882 }
20883 % Draw tube outline
20884 \def\pgf@circ@tubes@drawtube{%
20885 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
20886 % horizontal tube
20887 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
20888 \pgfutil@tempdima=\pgf@circ@res@right
20889 \advance\pgfutil@tempdima by -\pgf@circ@res@up
20890 \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\pgf@circ@res@up}}
20891 \pgfpatharc{90}{-90}{\pgf@circ@res@up}
20892 \pgfpathlineto{\pgfpoint{-\pgfutil@tempdima}{-\pgf@circ@res@up}}
20893 \pgfpatharc{270}{90}{\pgf@circ@res@up}
20894 \else
20895 % vertical tube
20896 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{0pt}}
20897 \pgfutil@tempdima=\pgf@circ@res@up
20898 \advance\pgfutil@tempdima by -\pgf@circ@res@right
20899 \pgfpathlineto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
20900 \pgfpatharc{180}{0}{\pgf@circ@res@right}
20901 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgfutil@tempdima}}
20902 \pgfpatharc{180}{0}{-\pgf@circ@res@right}
20903 \fi
20904 \pgfpathclose
20905 \edef\@@partial{\ctikzvalof{tubes/partial borders}}
20906 \ifx\@@partial\pgf@nonetext
20907 % Tube fill and draw if it's not partial... for speed
20908 \pgf@circ@draworfill
20909 \else
20910 % otherwise, just fill and do the partial fill
20911 \pgf@circ@maybefill
20912 \pgf@circ@tubes@draw@partial{\@@partial}
20913 %
20914 \fi
20915 }
20916
20917 \long\def\pgfcirctubedrawanodestd{% Standard anode code (one anode)
20918 % Anode (or plate)
20919 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}} % north
20920 \pgfpathlineto{\pgfpoint{0pt}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
20921 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
20922 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/anode width}\pgf@circ@res@right}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
20923 }
20924 \long\def\pgfcirctubedrawcathodestd{% Standard cathode code (one cathode)
20925 % Cathode
20926 \ifpgf@circuit@tubes@nocathode
20927 \pgf@circuit@tubes@nocathodefalse
20928 \else
20929 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
20930 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
20931 \pgfpathlineto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
20932 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
20933 \ifpgf@circuit@tubes@fullcathode
20934 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\pgf@circ@res@up}}
20935 \pgf@circuit@tubes@fullcathodefalse
20936 \else
20937 \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}}
20938 \fi
20939 \fi
20940 }
20941
20942 %% generic macro to create a tube. Most of them will use the standard macro for
20943 %% anode and cathode (see above)
20944 \long\def\pgfcircdeclaretubegeneric#1#2#3#4#5#6{% name, anchors, grid, anode, cathode variable anchors
20945 \pgfdeclareshape{#1}{
20946 \savedmacro{\ctikzclass}{\edef\ctikzclass{tubes}}
20947 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
20948 \savedanchor\northwest{%
20949 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20950 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
20951 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
20952 % x and y should be half the Rlen
20953 \pgf@y=\pgf@circ@res@up
20954 \pgf@y=.5\pgf@y
20955 \pgf@x=-\pgf@circ@res@right
20956 \pgf@x=.5\pgf@x
20957 }
20958 \savedanchor\tubene{%
20959 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20960 \pgf@circ@res@temp=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
20961 \pgf@circ@res@other=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
20962 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@temp
20963 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@other
20964 \pgf@y=\pgf@circ@res@up
20965 \pgf@x=\pgf@circ@res@right
20966 }
20967 \savedanchor\tubesquarene{%
20968 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
20969 \pgf@circ@res@temp=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
20970 \pgf@circ@res@other=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
20971 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@temp
20972 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@other
20973 \ifdim\ctikzvalof{tubes/width}pt>\ctikzvalof{tubes/height}pt\relax
20974 % horizontal
20975 \pgf@y=\pgf@circ@res@up
20976 \pgf@x=\pgf@circ@res@right\advance\pgf@x by -\pgf@circ@res@up
20977 \else
20978 % vertical
20979 \pgf@x=\pgf@circ@res@right
20980 \pgf@y=\pgf@circ@res@up\advance\pgf@y by -\pgf@circ@res@right
20981 \fi
20982 }
20983 \savedmacro{\tubes@filament@angle}{\edef\tubes@filament@angle{\ctikzvalof{tubes/filament angle}}}
20984 \savedmacro{\tubes@filament@distance}{\edef\tubes@filament@distance{\ctikzvalof{tubes/filament distance}}}
20985 \savedmacro{\tubes@tube@radius}{\edef\tubes@tube@radius{\ctikzvalof{tubes/tube radius}}}
20986 \savedmacro{\tubes@cathode@width}{\edef\tubes@cathode@width{\ctikzvalof{tubes/cathode width}}}
20987 \savedmacro{\tubes@cathode@distance}{\edef\tubes@cathode@distance{\ctikzvalof{tubes/cathode distance}}}
20988 \anchor{tube ne}{\tubene}
20989 \anchor{tubesq ne}{\tubesquarene}
20990 % tube shape anchors: geo
20991 \anchor{tube top}{\tubene\pgf@x=0pt\relax}
20992 \anchor{tube bottom}{\tubene\pgf@x=0pt\pgf@y=-\pgf@y}
20993 \anchor{tube right}{\tubene\pgf@y=0pt\relax}
20994 \anchor{tube left}{\tubene\pgf@y=0pt\pgf@x=-\pgf@x}
20995 % tube shape straight part anchors
20996 \anchor{tube top right}{\tubesquarene}
20997 \anchor{tube bottom right}{\tubesquarene\pgf@y=-\pgf@y}
20998 \anchor{tube top left}{\tubesquarene\pgf@x=-\pgf@x}
20999 \anchor{tube bottom left}{\tubesquarene\pgf@y=-\pgf@y\pgf@x=-\pgf@x}
21000 % tube shape centers
21001 \anchor{tube top center}{\tubesquarene\pgf@x=0pt\relax}
21002 \anchor{tube bottom center}{\tubesquarene\pgf@y=-\pgf@y\pgf@x=0pt\relax}
21003 \anchor{tube right center}{\tubesquarene\pgf@y=0pt\relax}
21004 \anchor{tube left center}{\tubesquarene\pgf@x=-\pgf@x\pgf@y=0pt\relax}
21005 % rest of anchors
21006 \anchor{center}{\pgfpointorigin}
21007 % geo anchors based on north-west
21008 \pgfcirc@northwest@symmetric@geoanchors
21009 % text anchor
21010 \anchor{text}{%
21011 \northwest\pgf@x=-\pgf@x
21012 \pgf@y=-.5\ht\pgfnodeparttextbox
21013 }
21014 % specific anchors
21015 \anchor{anode} {%
21016 \northwest
21017 \pgf@x=0pt
21018 }
21019 \anchor{cathode}{%
21020 \northwest
21021 \pgf@y=-\pgf@y
21022 \pgf@x=\tubes@cathode@width\pgf@x
21023 }
21024 \anchor{cathode 1}{%
21025 \northwest
21026 \pgf@y=-\pgf@y
21027 \pgf@x=\tubes@cathode@width\pgf@x
21028 }
21029 \anchor{cathode 2}{%
21030 \northwest
21031 \pgf@y=-\pgf@y
21032 \pgf@x=-\tubes@cathode@width\pgf@x
21033 }
21034 \anchor{filament 1}{%
21035 \northwest
21036 \pgfmathparse{(\tubes@tube@radius*sin(\tubes@filament@angle)}
21037 \pgf@x=\pgfmathresult\pgf@x
21038 \pgf@y=-\pgf@y
21039 }
21040 \anchor{filament 2}{%
21041 \northwest
21042 \pgfmathparse{(\tubes@tube@radius*sin(\tubes@filament@angle)}
21043 \pgf@x=-\pgfmathresult\pgf@x
21044 \pgf@y=-\pgf@y
21045 }
21046 \anchor{filament center}{%
21047 \northwest
21048 \pgf@ya=0.5\pgf@y
21049 \pgf@ya=-\tubes@cathode@distance\pgf@y
21050 \advance\pgf@ya by -\tubes@filament@distance\pgf@y
21051 \pgf@x=0pt\pgf@y=\pgf@ya
21052 }
21053
21054 % Extra anchors
21055 #2%
21056
21057 \pgf@circ@draw@component{
21058 % Line width for tripoles
21059 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
21060 \pgf@circ@scaled@Rlen=\scaledRlen
21061
21062 % Setup to draw tube
21063 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
21064 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
21065 \pgf@circ@res@up=\ctikzvalof{tubes/tube radius}\pgf@circ@res@up
21066 \pgf@circ@res@right=\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
21067
21068 % Tube outline
21069 \pgf@circ@tubes@drawtube
21070
21071 % Setup to draw grid, filament, anode and cathode
21072 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
21073 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
21074 \pgf@circ@res@up=0.5\pgf@circ@res@up
21075 \pgf@circ@res@right=0.5\pgf@circ@res@right
21076
21077 % Grid drawing
21078 #3%
21079
21080 % Filament (is not drawn by default)
21081 \ifpgf@circuit@tubes@filament
21082 \pgf@circ@res@temp=-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up
21083 \advance\pgf@circ@res@temp by -\ctikzvalof{tubes/filament distance}\pgf@circ@res@up
21084 \pgfmathparse{(\ctikzvalof{tubes/tube radius}*sin(\ctikzvalof{tubes/filament angle})}
21085 \pgf@xa=\pgfmathresult\pgf@circ@res@right
21086 \pgfmathparse{\ctikzvalof{tubes/tube radius}+\ctikzvalof{tubes/tube radius}*cos(\ctikzvalof{tubes/filament angle}}
21087 \pgf@ya=\pgfmathresult\pgf@circ@res@up
21088 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
21089 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}
21090 \pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@circ@res@up}}
21091 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@temp}}
21092 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}}
21093 \pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@circ@res@up}}
21094 \pgf@circuit@tubes@filamentfalse
21095 \fi
21096
21097 % Anode (or plate)
21098 #4
21099 % Cathode
21100 #5
21101 % Draw the background
21102 \pgfusepath{draw}
21103 }
21104 #6
21105 }
21106 }
21107
21108 %% The diode (tube), triode, tetrode and pentode only differ in the
21109 %% number of grids. So we construct a generic declare function in
21110 %% which we can put code for the grid anchors and grid drawing code
21111 %% \pgfcircdeclaretube{tube name}{grid anchors}{grid drawing code}
21112 \long\def\pgfcircdeclaretube#1#2#3{% name, anchors, grid
21113 \pgfcircdeclaretubegeneric{#1}{#2}{#3}{\pgfcirctubedrawanodestd}{\pgfcirctubedrawcathodestd}{}
21114 }
21115
21116 \pgfcircdeclaretube{diodetube}{}{} % shape diode already exists
21117
21118 \pgfcircdeclaretube{triode}
21119 {
21120 \anchor{grid} {% should not be used
21121 \northwest
21122 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21123 }
21124 \anchor{control} {%
21125 \northwest
21126 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21127 }
21128 }
21129 {
21130 % Grid protrusion
21131 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
21132 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
21133 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21134 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21135 % Grid dashes: calculations
21136 \pgf@xb=2\pgf@circ@res@right
21137 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
21138 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
21139 \multiply\pgf@circ@count@a by 2\relax
21140 \advance\pgf@circ@count@a by 1\relax
21141 \advance\pgf@circ@res@step by -\pgf@xa
21142 \divide\pgf@circ@res@step by \pgf@circ@count@a
21143 % Grid dashes: draw
21144 \pgf@circ@res@temp=\pgf@xa
21145 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
21146 \loop
21147 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21148 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21149 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21150 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21151 \advance\pgf@circ@count@a by-1
21152 \ifnum\pgf@circ@count@a>0\relax
21153 \repeat
21154 }
21155
21156 \pgfcircdeclaretube{tetrode}
21157 {
21158 \anchor{grid} {% should not be used
21159 \northwest
21160 \pgfutil@tempdima=\pgf@y
21161 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
21162 \pgf@y=0.5\pgf@y
21163 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21164 }
21165 \anchor{control} {%
21166 \northwest
21167 \pgfutil@tempdima=\pgf@y
21168 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
21169 \pgf@y=0.5\pgf@y
21170 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21171 }
21172 \anchor{screen} {%
21173 \northwest
21174 \pgfutil@tempdima=\pgf@y
21175 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
21176 \pgf@y=0.5\pgf@y
21177 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21178 }
21179 }
21180 {
21181 % Grid x/y points
21182 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
21183 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
21184 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
21185 \pgfutil@tempdimb=-\pgfutil@tempdima
21186 \pgfutil@tempdima=0.5\pgfutil@tempdima
21187 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21188 \pgfutil@tempdimb=0.5\pgfutil@tempdimb
21189 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21190 % Grid protrusion
21191 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
21192 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
21193 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
21194 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
21195 % Grid dashes: calculations
21196 \pgf@xb=2\pgf@circ@res@right
21197 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
21198 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
21199 \multiply\pgf@circ@count@a by 2\relax
21200 \advance\pgf@circ@count@a by 1\relax
21201 \advance\pgf@circ@res@step by -\pgf@xa
21202 \divide\pgf@circ@res@step by \pgf@circ@count@a
21203 % Grid dashes: draw
21204 \pgf@circ@res@temp=\pgf@xa
21205 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
21206 \loop
21207 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21208 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
21209 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
21210 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
21211 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
21212 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21213 \advance\pgf@circ@count@a by-1
21214 \ifnum\pgf@circ@count@a>0\relax
21215 \repeat
21216 }
21217
21218 \pgfcircdeclaretube{pentode}
21219 {
21220 \anchor{grid} {% should not be used
21221 \northwest
21222 \pgfutil@tempdima=\pgf@y
21223 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
21224 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21225 }
21226 \anchor{control} {%
21227 \northwest
21228 \pgfutil@tempdima=\pgf@y
21229 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
21230 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21231 }
21232 \anchor{screen} {%
21233 \northwest
21234 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21235 }
21236 \anchor{suppressor} {%
21237 \northwest
21238 \pgfutil@tempdima=\pgf@y
21239 \pgf@y=\ctikzvalof{tubes/grid separation}\pgf@y
21240 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21241 }
21242 }
21243 {
21244 % Grid x/y points
21245 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
21246 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
21247 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
21248 \pgfutil@tempdimb=-\pgfutil@tempdima
21249 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21250 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21251 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21252 % Grid protrusion
21253 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
21254 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
21255 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdima}}
21256 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdima}}
21257 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
21258 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
21259 % Grid dashes: calculations
21260 \pgf@xb=2\pgf@circ@res@right
21261 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
21262 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
21263 \multiply\pgf@circ@count@a by 2\relax
21264 \advance\pgf@circ@count@a by 1\relax
21265 \advance\pgf@circ@res@step by -\pgf@xa
21266 \divide\pgf@circ@res@step by \pgf@circ@count@a
21267 % Grid dashes: draw
21268 \pgf@circ@res@temp=\pgf@xa
21269 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
21270 \loop
21271 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21272 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
21273 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
21274 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
21275 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
21276 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
21277 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
21278 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21279 \advance\pgf@circ@count@a by-1
21280 \ifnum\pgf@circ@count@a>0\relax
21281 \repeat
21282 }
21283
21284 \pgfcircdeclaretube{pentode suppressor to cathode}
21285 {
21286 \anchor{grid} {% should not be used
21287 \northwest
21288 \pgfutil@tempdima=\pgf@y
21289 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
21290 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21291 }
21292 \anchor{control} {%
21293 \northwest
21294 \pgfutil@tempdima=\pgf@y
21295 \pgf@y=-\ctikzvalof{tubes/grid separation}\pgf@y
21296 \advance\pgf@y by \ctikzvalof{tubes/grid shift}\pgfutil@tempdima
21297 }
21298 \anchor{screen} {%
21299 \northwest
21300 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21301 }
21302 }
21303 {
21304 % Grid x/y points
21305 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
21306 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
21307 \pgfutil@tempdima=\ctikzvalof{tubes/grid separation}\pgf@circ@res@up
21308 \pgfutil@tempdimb=-\pgfutil@tempdima
21309 \advance\pgfutil@tempdima by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21310 \advance\pgfutil@tempdimb by \ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21311 \pgf@circ@res@other=\ctikzvalof{tubes/grid shift}\pgf@circ@res@up
21312 % Grid protrusion
21313 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgfutil@tempdimb}}
21314 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgfutil@tempdimb}}
21315 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\pgf@circ@res@other}}
21316 \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@circ@res@other}}
21317 % Grid dashes: calculations
21318 \pgf@xb=2\pgf@circ@res@right
21319 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
21320 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
21321 \multiply\pgf@circ@count@a by 2\relax
21322 \advance\pgf@circ@count@a by 1\relax
21323 \advance\pgf@circ@res@step by -\pgf@xa
21324 \divide\pgf@circ@res@step by \pgf@circ@count@a
21325 % Grid dashes: draw
21326 \pgf@circ@res@temp=\pgf@xa
21327 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
21328 \loop
21329 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21330 \ifnum\pgf@circ@count@a>1\relax
21331 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdimb}}
21332 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdimb}}
21333 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@other}}
21334 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgf@circ@res@other}}
21335 \fi
21336 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima}}
21337 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp+\pgf@circ@res@step}{\pgfutil@tempdima}}
21338 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21339 \advance\pgf@circ@count@a by-1
21340 \ifnum\pgf@circ@count@a>0\relax
21341 \repeat
21342 % Grid: connection from suppressor to cathode
21343 \pgfsetcornersarced{\pgfpoint{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}{\ctikzvalof{tubes/cathode corners}\pgf@circ@res@up}}
21344 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\pgfutil@tempdima-2*\ctikzvalof{tubes/grid separation}\pgf@circ@res@up}}
21345 \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}}
21346
21347 }%
21348 %
21349 % multi-anode tube, added by Romano for version 1.6.8, suggested by @bogger33 on GitHub
21350 % see https://github.com/circuitikz/circuitikz/issues/785
21351 %
21352 \ctikzset{tubes/anodes/.initial=3} % number of anodes. Ignored in most tubes.
21353 \newif\ifpgf@circuit@tubes@anodedot\pgf@circuit@tubes@anodedotfalse
21354 \pgfkeys{/tikz/anodedot/.add code={}{\pgf@circuit@tubes@anodedottrue}}
21355 \ctikzset{tubes/anodedot/.add code={}{\pgf@circuit@tubes@anodedottrue}}
21356 \newif\ifpgf@circuit@tubes@nogrid\pgf@circuit@tubes@nogridfalse
21357 \pgfkeys{/tikz/nogrid/.add code={}{\pgf@circuit@tubes@nogridtrue}}
21358 \ctikzset{tubes/nogrid/.add code={}{\pgf@circuit@tubes@nogridtrue}}
21359 \newif\ifpgf@circuit@tubes@nixieanode\pgf@circuit@tubes@nixieanodefalse
21360 \pgfkeys{/tikz/nixieanode/.add code={}{\pgf@circuit@tubes@nixieanodetrue}}
21361 \ctikzset{tubes/nixieanode/.add code={}{\pgf@circuit@tubes@nixieanodetrue}}
21362 \long\def\pgfcirctubedraw@multi@anode{% Separate to override in matubes
21363 % Anodes (or plates)
21364 % Use saved len/anchors to find the first drawn position.
21365 \pgf@circ@res@temp=\anodelen\divide\pgf@circ@res@temp by 2 % half the anode length
21366 \firstanodepos\pgf@circ@res@other=\pgf@x
21367 \advance\pgf@circ@res@other by \pgf@circ@res@temp
21368 \pgf@circ@count@a=0
21369 \loop
21370 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}} % north
21371 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
21372 \ifpgf@circuit@tubes@anodedot
21373 \pgfpathcircle{\pgfpoint{\pgf@circ@res@other}{\ctikzvalof{tubes/anode distance}\pgf@circ@[email protected]*\circlelen}}{\circlelen}
21374 \else
21375 % this is the horizontal line of the anode
21376 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@other-\pgf@circ@res@temp}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
21377 \pgfpathlineto{\pgfpoint{\pgf@circ@res@other+\pgf@circ@res@temp}{\ctikzvalof{tubes/anode distance}\pgf@circ@res@up}}
21378 \fi
21379 \advance\pgf@circ@res@other by 4\pgf@circ@res@temp
21380 \advance\pgf@circ@count@a by 1
21381 \ifnum\pgf@circ@count@a<\Nanodes\relax
21382 \repeat
21383 }
21384 \long\def\pgfcirctubedraw@cathode@or@nixie{%
21385 \ifpgf@circuit@tubes@nixieanode
21386 \pgfpathmoveto{\pgfpoint{0pt}{-\pgf@circ@res@up}}
21387 \pgfpathlineto{\pgfpoint{0pt}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
21388 \pgfpathmoveto{\pgfpoint{-\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
21389 \pgfpathlineto{\pgfpoint{\ctikzvalof{tubes/cathode width}\pgf@circ@res@right}{-\ctikzvalof{tubes/cathode distance}\pgf@circ@res@up}}
21390 \else
21391 \pgfcirctubedrawcathodestd
21392 \fi
21393 }
21394 \pgfcircdeclaretubegeneric{matube}
21395 {% anchors
21396 \savedmacro{\Nanodes}{\edef\Nanodes{\ctikzvalof{tubes/anodes}}}
21397 \savedanchor\firstanodepos{%
21398 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21399 \pgf@circ@res@up=\ctikzvalof{tubes/height}\pgf@circ@scaled@Rlen
21400 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen
21401 \pgf@circ@res@right=\ctikzvalof{tubes/anode width}\pgf@circ@res@right
21402 % x and y are one half
21403 \pgf@y=\pgf@circ@res@up
21404 \pgf@y=.5\pgf@y
21405 \pgf@x=-\pgf@circ@res@right
21406 \pgf@x=.5\pgf@x
21407 }
21408 \saveddimen\anodelen{%
21409 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21410 \pgf@circ@res@right=\ctikzvalof{tubes/width}\pgf@circ@scaled@Rlen % full width, left to right
21411 % the length of one of the N anodes is the full width divided by 2*N+1
21412 \pgfmathsetlength\pgf@x{\ctikzvalof{tubes/anode width}*\pgf@circ@res@right/(2*\Nanodes-1)}
21413 }
21414 \saveddimen\circlelen{%
21415 \pgf@x=\ctikzvalof{nodes width}\pgf@circ@Rlen
21416 }
21417 \anchor{grid} {% should not be used
21418 \northwest
21419 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21420 }
21421 \anchor{control} {%
21422 \northwest
21423 \pgf@y=\ctikzvalof{tubes/grid shift}\pgf@y
21424 }
21425 \anchor{nixie a}{%
21426 \northwest\pgf@x=0pt\pgf@y=-\pgf@y
21427 }
21428 }
21429 {% grid
21430 \ifpgf@circuit@tubes@nogrid\else
21431 % Grid protrusion
21432 \pgf@xa=-\ctikzvalof{tubes/tube radius}\pgf@circ@res@right
21433 \advance\pgf@xa by -\ctikzvalof{tubes/grid protrusion}\pgf@circ@res@right
21434 \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@right}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21435 \pgfpathlineto{\pgfpoint{\pgf@xa}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21436 % Grid dashes: calculations
21437 \pgf@xb=2\pgf@circ@res@right
21438 \pgf@circ@res@step=\ctikzvalof{tubes/tube radius}\pgf@xb
21439 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes} % dashes*2+1
21440 \multiply\pgf@circ@count@a by 2\relax
21441 \advance\pgf@circ@count@a by 1\relax
21442 \advance\pgf@circ@res@step by -\pgf@xa
21443 \divide\pgf@circ@res@step by \pgf@circ@count@a
21444 % Grid dashes: draw
21445 \pgf@circ@res@temp=\pgf@xa
21446 \pgf@circ@count@a=\ctikzvalof{tubes/grid dashes}
21447 \loop
21448 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21449 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21450 \advance\pgf@circ@res@temp by\pgf@circ@res@step
21451 \pgfpathlineto{\pgfpoint{\pgf@circ@res@temp}{\ctikzvalof{tubes/grid shift}\pgf@circ@res@up}}
21452 \advance\pgf@circ@count@a by-1
21453 \ifnum\pgf@circ@count@a>0\relax
21454 \repeat
21455 \fi
21456 }
21457 {\pgfcirctubedraw@multi@anode}% anodes
21458 {\pgfcirctubedraw@cathode@or@nixie}% cathode
21459 {% extra dynamics anchors
21460 \pgfutil@g@addto@macro\pgf@sh@s@matube{%
21461 % Start with the maximum pin number and go backwards.
21462 \pgf@circ@count@a=\Nanodes\relax
21463 \pgfmathloop%
21464 \ifnum\pgf@circ@count@a>0
21465 \expandafter\xdef\csname pgf@anchor@matube@anode\space\the\pgf@circ@count@a\endcsname{%
21466 \noexpand\pgf@circ@ma@anode@anchor{\the\pgf@circ@count@a}%
21467 }
21468 \expandafter\xdef\csname pgf@anchor@matube@nixie\space k\the\pgf@circ@count@a\endcsname{%
21469 \noexpand\pgf@circ@ma@anode@anchor{\the\pgf@circ@count@a}%
21470 }
21471 \advance\pgf@circ@count@a by -1\relax%
21472 \repeatpgfmathloop%
21473 }%
21474 }
21475 \def\pgf@circ@ma@anode@anchor#1{
21476 \firstanodepos
21477 \pgf@circ@res@temp=\pgf@x
21478 \pgfmathsetlength\pgf@x{\pgf@circ@res@temp + (0.5 + 2*(#1 -1))*\anodelen}
21479 }
21480
21481
21482
21483 %>>>
21484
21485 % vim: set fdm=marker fmr=%<<<,%>>>:
21486 %%%---------- close: tex/pgfcirctripoles
21487 %%%%%%%%%%% Springe nach tex/pgfcircquadpoles
21488 %%%---------- open: tex/pgfcircquadpoles.tex
21489 % Copyright 2018-2026 by Romano Giannetti
21490 % Copyright 2015-2026 by Stefan Lindner
21491 % Copyright 2013-2026 by Stefan Erhardt
21492 % Copyright 2007-2026 by Massimo Redaelli
21493 %
21494 % This file may be distributed and/or modified
21495 %
21496 % 1. under the LaTeX Project Public License and/or
21497 % 2. under the GNU Public License.
21498 %
21499 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
21500
21501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21502 %% Quadripoles
21503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21504
21505
21506 % Setting for Transformers and similar quadpoles%<<<1
21507
21508 \ctikzset{quadpoles/transformer/inner/.initial=0.4}
21509 \ctikzset{quadpoles/transformer/width/.initial=1.5}
21510 \ctikzset{quadpoles/transformer/width1/.initial=.4}
21511 \ctikzset{quadpoles/transformer/height/.initial=1.5}
21512 \ctikzset{quadpoles/transformer/height1/.initial=.8}
21513 \ctikzset{quadpoles/transformer core/inner/.initial=0.4}
21514 \ctikzset{quadpoles/transformer core/width/.initial=1.5}
21515 \ctikzset{quadpoles/transformer core/height/.initial=1.5}
21516 \ctikzset{quadpoles/transformer core/core height/.initial=.5}
21517 \ctikzset{quadpoles/transformer core/core width/.initial=.05}
21518 \ctikzset{transformer core/relative thickness/.initial=1}
21519 \ctikzset{transformer core/color/.initial=default}
21520 \ctikzset{transformer core/dash/.initial=default}
21521 \ctikzset{quadpoles/gyrator/inner/.initial=0.4}
21522 \ctikzset{quadpoles/gyrator/width/.initial=1.5}
21523 \ctikzset{quadpoles/gyrator/height/.initial=1.5}
21524 \ctikzset{quadpoles/fourport/width/.initial=1.3}
21525 \ctikzset{quadpoles/fourport/height/.initial=1.3}
21526 \ctikzset{quadpoles/coupler/width/.initial=1.3}
21527 \ctikzset{quadpoles/coupler/height/.initial=1.3}
21528 \ctikzset{quadpoles/coupler2/width/.initial=1.3}
21529 \ctikzset{quadpoles/coupler2/height/.initial=1.3}
21530 \ctikzset{quadpoles/double bipole/inner/.initial=0.4}
21531 \ctikzset{quadpoles/double bipole/width/.initial=1.5}
21532 \ctikzset{quadpoles/double bipole/width1/.initial=.4}
21533 \ctikzset{quadpoles/double bipole/height/.initial=1.5}
21534 \ctikzset{quadpoles/double bipole/height1/.initial=.8}
21535
21536 \ctikzset{quadpoles style/.is choice}
21537 \ctikzset{quadpoles style/inward/.code={% default value
21538 \ctikzset{quadpoles/transformer/inner=0.4}%
21539 \ctikzset{quadpoles/transformer/width=1.5}%
21540 \ctikzset{quadpoles/transformer core/inner=0.4}%
21541 \ctikzset{quadpoles/transformer core/width=1.5}%
21542 \ctikzset{quadpoles/gyrator/inner=0.4}%
21543 \ctikzset{quadpoles/gyrator/width=1.5}%
21544 \ctikzset{quadpoles/double bipole/inner=0.4}%
21545 \ctikzset{quadpoles/double bipole/width=1.5}%
21546 }%
21547 }
21548 \ctikzset{quadpoles style/inline/.code={% now horizontal baffle
21549 \ctikzset{quadpoles/transformer/inner=1}%
21550 \ctikzset{quadpoles/transformer/width=0.6}%
21551 \ctikzset{quadpoles/transformer core/inner=1}%
21552 \ctikzset{quadpoles/transformer core/width=0.6}%
21553 \ctikzset{quadpoles/gyrator/inner=1} % FIXME
21554 \ctikzset{quadpoles/gyrator/width=0.6}%
21555 \ctikzset{quadpoles/double bipole/inner=1}%
21556 \ctikzset{quadpoles/double bipole/width=0.6}%
21557 }%
21558 }
21559 %%>>>
21560
21561 %% Node shapes for quadpoles (basically transformers)%<<<
21562
21563 \long\def\pgfcircdeclarequadpole#1#2#3{
21564 \pgfdeclareshape{#1}
21565 {
21566 \savedmacro{\ctikzclass}{\edef\ctikzclass{inductors}}
21567 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21568 % shapename
21569 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21570 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
21571 \savedanchor\northwest{%
21572 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21573 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
21574 \pgf@y=.5\pgf@y
21575 \pgf@x=.5\pgf@circ@scaled@Rlen
21576 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
21577 }
21578 %% we define the upper right (positive coord) inner and outer dots (on the side of B1)
21579 \savedanchor{\innerdot}{%
21580 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21581 \pgf@xa=.5\pgf@circ@scaled@Rlen
21582 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
21583 % by default use the cute inductor size
21584 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
21585 % check if it's american
21586 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
21587 \edef\pgf@temp{american}
21588 \ifx\pgf@circ@temp\pgf@temp
21589 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
21590 \fi
21591 % check if it's european
21592 \edef\pgf@temp{european}
21593 \ifx\pgf@circ@temp\pgf@temp
21594 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa-\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
21595 \fi
21596 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
21597 }
21598 \savedanchor{\outerdot}{%
21599 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21600 \pgf@xa=.5\pgf@circ@scaled@Rlen
21601 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
21602 % by default use the cute inductor size
21603 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/cuteinductor/height}*\pgf@circ@scaled@Rlen/2}
21604 % check if it's american
21605 \edef\pgf@circ@temp{\ctikzvalof{inductor}}
21606 \edef\pgf@temp{american}
21607 \ifx\pgf@circ@temp\pgf@temp
21608 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/americaninductor/height}*\pgf@circ@scaled@Rlen/2}
21609 \fi
21610 % check if it's european
21611 \edef\pgf@temp{european}
21612 \ifx\pgf@circ@temp\pgf@temp
21613 \pgfmathsetlength\pgf@x{-\stretto*\pgf@xa+\ctikzvalof{bipoles/fullgeneric/height}*\pgf@circ@scaled@Rlen/2}
21614 \fi
21615 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
21616 }
21617 % geographical
21618 \anchor{center}{\northwest\pgf@x=0pt\pgf@y=0pt}
21619 \pgfcirc@northwest@symmetric@geoanchors
21620 \anchor{base}{\northwest\pgf@x=0pt}
21621 % external wires
21622 \anchor{A2}{\northwest\pgf@y=-\pgf@y}
21623 \anchor{B1}{\northwest\pgf@x=-\pgf@x}
21624 \anchor{A1}{\northwest}
21625 \anchor{B2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
21626 %% dot's anchors
21627 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
21628 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
21629 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21630 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21631 \anchor{inner dot B1}{\innerdot}
21632 \anchor{outer dot B1}{\outerdot}
21633 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
21634 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
21635 % text above
21636 \anchor{text}{
21637 \northwest
21638 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
21639 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
21640 }
21641 #3%
21642 \pgf@circ@draw@component{
21643 \pgf@circ@setcolor
21644
21645 \northwest
21646 \pgf@circ@res@up = \pgf@y
21647 \pgf@circ@res@down = -\pgf@y
21648 \pgf@circ@res@right = -\pgf@x
21649 \pgf@circ@res@left = \pgf@x
21650 #2%
21651 }
21652 }
21653 }
21654
21655
21656 % these are deprecated anchors (really I do not know what they are --- Romano.)
21657 % They are here for compatibility, I suppose. Don't use.
21658 \def\pgf@circ@drawtransformerbasicanchor{
21659 % \ctikzvalof{quadpoles/trans/height}
21660 \anchor{AA2}{
21661 \northwest
21662 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
21663 \pgf@x=.7\pgf@x
21664 \pgf@y=-\pgf@y
21665 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
21666 }
21667 \anchor{BB1}{
21668 \northwest
21669 \pgf@x=-\pgf@x
21670 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
21671 \pgf@x=.7\pgf@x
21672 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
21673 }
21674 \anchor{AA1}{
21675 \northwest
21676 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
21677 \pgf@x=.7\pgf@x
21678 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
21679 }
21680 \anchor{BB2}{
21681 \northwest
21682 \pgf@x=-\pgf@x
21683 \pgf@x=\ctikzvalof{quadpoles/transformer/width1}\pgf@x
21684 \pgf@x=.7\pgf@x
21685 \pgf@y=-\pgf@y
21686 \pgf@y=\ctikzvalof{quadpoles/transformer/height1}\pgf@y
21687 }
21688 }
21689
21690 %% Null styles that can be used to change individually the L1 and L2
21691 %% inductors of the transformer.
21692
21693 \ctikzset{transformer L1/.style={}}
21694 \ctikzset{transformer L2/.style={}}
21695
21696 \def\pgf@circ@drawtransformerbasicbody{
21697 \pgfscope
21698 \pgfslopedattimetrue
21699 \pgfallowupsidedownattimetrue
21700 \pgftransformlineattime{.5}{%
21701 \pgfpoint%
21702 {\stretto\pgf@circ@res@left}%
21703 {\pgf@circ@res@up}%
21704 }{%
21705 \pgfpoint
21706 {\stretto\pgf@circ@res@left}%
21707 {\pgf@circ@res@down}%
21708 }
21709
21710 \pgfkeys{\circuitikzbasekey/.cd, transformer L1}
21711 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21712 \def\pgf@temp{european}%
21713 \ifx\pgf@temp\pgf@circ@temp%
21714 \pgfnode{fullgenericshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
21715 \else%
21716 \def\pgf@temp{cute}
21717 \ifx\pgf@temp\pgf@circ@temp%
21718 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
21719 \else%
21720 \pgfnode{americaninductorshape}{center}{}{\thisshape-L1}{\pgfusepath{stroke}}
21721 \fi%
21722 \fi%
21723
21724
21725 \endpgfscope
21726 \pgfscope
21727 \pgfslopedattimetrue
21728 \pgfallowupsidedownattimetrue
21729 \pgftransformlineattime{.5}{%
21730 \pgfpoint%
21731 {\stretto\pgf@circ@res@right}%
21732 {\pgf@circ@res@down}%
21733 }{%
21734 \pgfpoint
21735 {\stretto\pgf@circ@res@right}%
21736 {\pgf@circ@res@up}%
21737 }
21738
21739 \pgfkeys{\circuitikzbasekey/.cd, transformer L2}
21740 \edef\pgf@circ@temp{\ctikzvalof{inductor}}%
21741 \def\pgf@temp{european}%
21742 \ifx\pgf@temp\pgf@circ@temp%
21743 \pgfnode{fullgenericshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
21744 \else%
21745 \def\pgf@temp{cute}
21746 \ifx\pgf@temp\pgf@circ@temp%
21747 \pgfnode{cuteinductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
21748 \else%
21749 \pgfnode{americaninductorshape}{center}{}{\thisshape-L2}{\pgfusepath{stroke}}
21750 \fi%
21751 \fi%
21752
21753 \endpgfscope
21754
21755 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21756 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
21757 \pgfpathlineto{\pgfpointanchor{\thisshape-L1}{b}}
21758
21759 \pgfpathmoveto{\pgfpointanchor{\thisshape-L1}{a}}
21760 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
21761 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21762
21763 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21764 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
21765 \pgfpathlineto{\pgfpointanchor{\thisshape-L2}{a}}
21766
21767 \pgfpathmoveto{\pgfpointanchor{\thisshape-L2}{b}}
21768 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
21769 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
21770
21771 \pgfusepath{draw}
21772
21773 }
21774
21775
21776 \pgfcircdeclarequadpole{transformer}{
21777 \pgf@circ@drawtransformerbasicbody
21778 }{\pgf@circ@drawtransformerbasicanchor}
21779
21780 \pgfcircdeclarequadpole{transformer core}{
21781
21782 \pgf@circ@drawtransformerbasicbody
21783
21784 % use the chocke line thickness
21785 \pgfsetlinewidth{\ctikzvalof{bipoles/cutechoke/cthick}*\ctikzvalof{transformer core/relative thickness}*\pgflinewidth}
21786 \pgf@circ@subset@color@dash{transformer core}
21787
21788 % Find the distance from center for the lines representing the core
21789 % the 2.5 is for backward compatibility --- the distance was calculated as a fraction
21790 % of the whole component, now as a fraction of the distance between coils, to be
21791 % compatible with the quadpoles "inner" style.
21792 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@right}
21793
21794 \pgfpathmoveto{\pgfpoint%
21795 {\pgf@circ@res@other}%
21796 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
21797 }
21798 \pgfpathlineto{
21799 \pgfpoint%
21800 {\pgf@circ@res@other}%
21801 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
21802 }
21803
21804 %% this should be just -\pgf@circ@res@other, but in case someone define an asymmetric trafo someday...
21805 \pgfmathsetlength{\pgf@circ@res@other}{2.5*\stretto*\ctikzvalof{quadpoles/transformer core/core width}*\pgf@circ@res@left}
21806 \pgfpathmoveto{\pgfpoint%
21807 {\pgf@circ@res@other}%
21808 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@down}%
21809 }
21810 \pgfpathlineto{
21811 \pgfpoint%
21812 {\pgf@circ@res@other}%
21813 {\ctikzvalof{quadpoles/transformer core/core height}\pgf@circ@res@up}%
21814 }
21815
21816 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
21817 \pgfusepath{draw}
21818 }{\pgf@circ@drawtransformerbasicanchor}
21819
21820
21821 \pgfcircdeclarequadpole{gyrator}{
21822
21823 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21824 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
21825 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
21826 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21827
21828 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21829 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
21830 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
21831 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
21832
21833 \pgfusepath{draw}
21834
21835 \pgf@circ@setlinewidth{quadpoles}{\pgflinewidth}
21836 \pgfmathsetlength{\pgf@circ@res@other}{min(.7*\stretto*\pgf@circ@res@up, .8*\pgf@circ@res@right)} % radius
21837 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{-\pgf@circ@res@other}}
21838 \pgfpatharc{-90}{90}{\pgf@circ@res@other}
21839 \pgfpathclose
21840 \pgf@circ@draworfill
21841
21842 \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@other}}
21843 \pgfpatharc{90}{270}{\pgf@circ@res@other}
21844 \pgfpathclose
21845 \pgf@circ@draworfill
21846 }{}
21847 % %>>>
21848
21849 % Node shapes for generic double bipoles %<<<
21850 %
21851 \long\def\pgfcircdeclaredbipole#1#2#3{
21852 \pgfdeclareshape{#1}
21853 {
21854 \savedmacro{\ctikzclass}{\edef\ctikzclass{misc}}
21855 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
21856 % shapename
21857 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
21858 \savedmacro{\stretto}{\def\stretto{\ctikzvalof{quadpoles/#1/inner}}}
21859 \savedanchor\northwest{%
21860 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21861 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
21862 \pgf@y=.5\pgf@y
21863 \pgf@x=.5\pgf@circ@scaled@Rlen
21864 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
21865 }
21866 %% we define the upper right (positive coord) inner and outer dot (near B1)
21867 %% in the generic case, we just place the dot position in a fixed spot
21868 %% we do not know the width of the component there...
21869 \savedanchor{\innerdot}{%
21870 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21871 \pgf@xa=.5\pgf@circ@scaled@Rlen
21872 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
21873 \pgfmathsetlength\pgf@x{-0.5*\stretto*\pgf@xa}
21874 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
21875 }
21876 \savedanchor{\outerdot}{%
21877 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
21878 \pgf@xa=.5\pgf@circ@scaled@Rlen
21879 \pgf@xa=-\ctikzvalof{quadpoles/#1/width}\pgf@xa
21880 \pgfmathsetlength\pgf@x{-1.5*\stretto*\pgf@xa}
21881 \pgfmathsetlength\pgf@y{0.5*\pgf@circ@scaled@Rlen}
21882 }
21883 % geographical
21884 \anchor{center}{\northwest\pgf@x=0pt\pgf@y=0pt}
21885 \pgfcirc@northwest@symmetric@geoanchors
21886 \anchor{base}{\northwest\pgf@x=0pt}
21887 % external wires
21888 \anchor{A2}{\northwest\pgf@y=-\pgf@y}
21889 \anchor{B1}{\northwest\pgf@x=-\pgf@x}
21890 \anchor{A1}{\northwest}
21891 \anchor{B2}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
21892 %% dot's anchors
21893 \anchor{inner dot A1}{\innerdot\pgf@x=-\pgf@x}
21894 \anchor{outer dot A1}{\outerdot\pgf@x=-\pgf@x}
21895 \anchor{inner dot A2}{\innerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21896 \anchor{outer dot A2}{\outerdot\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
21897 \anchor{inner dot B1}{\innerdot}
21898 \anchor{outer dot B1}{\outerdot}
21899 \anchor{inner dot B2}{\innerdot\pgf@y=-\pgf@y}
21900 \anchor{outer dot B2}{\outerdot\pgf@y=-\pgf@y}
21901 % text above
21902 \anchor{text}{
21903 \northwest
21904 \pgf@x=\dimexpr -.5\wd\pgfnodeparttextbox\relax
21905 \advance\pgf@y by .6\ht\pgfnodeparttextbox\relax
21906 }
21907 #3%
21908 \pgf@circ@draw@component{
21909 \pgf@circ@setcolor
21910 \northwest
21911 \pgf@circ@res@up = \pgf@y
21912 \pgf@circ@res@down = -\pgf@y
21913 \pgf@circ@res@right = -\pgf@x
21914 \pgf@circ@res@left = \pgf@x
21915 #2%
21916 }
21917 }
21918 }
21919
21920 \ctikzset{every double bipole L/.style={}}
21921 \ctikzset{every double bipole R/.style={}}
21922 \ctikzset{double bipole L/.initial=genericshape}
21923 \ctikzset{double bipole R/.initial=vsourceAMshape}
21924 \newif\ifpgf@circ@dbipoleL@invert\pgf@circ@dbipoleL@invertfalse
21925 \newif\ifpgf@circ@dbipoleR@invert\pgf@circ@dbipoleR@invertfalse
21926 \ctikzset{double bipole L invert/.is if=pgf@circ@dbipoleL@invert}
21927 \ctikzset{double bipole R invert/.is if=pgf@circ@dbipoleR@invert}
21928
21929 \def\pgf@circ@drawdbipolebasicbody{
21930 \pgfscope
21931 \ifpgf@circ@dbipoleL@invert
21932 \pgf@circ@res@temp=\pgf@circ@res@down
21933 \pgf@circ@res@other=\pgf@circ@res@up
21934 \else
21935 \pgf@circ@res@temp=\pgf@circ@res@up
21936 \pgf@circ@res@other=\pgf@circ@res@down
21937 \fi
21938 \pgfslopedattimetrue
21939 \pgfallowupsidedownattimetrue
21940 \pgftransformlineattime{.5}{%
21941 \pgfpoint%
21942 {\stretto\pgf@circ@res@left}%
21943 {\pgf@circ@res@temp}%
21944 }{%
21945 \pgfpoint
21946 {\stretto\pgf@circ@res@left}%
21947 {\pgf@circ@res@other}%
21948 }
21949 \pgfkeys{\circuitikzbasekey/.cd, every double bipole L}
21950 \edef\pgf@circ@temp{\ctikzvalof{double bipole L}}%
21951 \pgfnode{\pgf@circ@temp}{center}{}{\thisshape-L}{\pgfusepath{stroke}}
21952 \endpgfscope
21953 \pgfscope
21954 \ifpgf@circ@dbipoleR@invert
21955 \pgf@circ@res@temp=\pgf@circ@res@down
21956 \pgf@circ@res@other=\pgf@circ@res@up
21957 \else
21958 \pgf@circ@res@temp=\pgf@circ@res@up
21959 \pgf@circ@res@other=\pgf@circ@res@down
21960 \fi
21961 \pgfslopedattimetrue
21962 \pgfallowupsidedownattimetrue
21963 \pgftransformlineattime{.5}{%
21964 \pgfpoint%
21965 {\stretto\pgf@circ@res@right}%
21966 {\pgf@circ@res@other}%
21967 }{%
21968 \pgfpoint
21969 {\stretto\pgf@circ@res@right}%
21970 {\pgf@circ@res@temp}%
21971 }
21972 %
21973 \pgfkeys{\circuitikzbasekey/.cd, every double bipole R}
21974 \edef\pgf@circ@temp{\ctikzvalof{double bipole R}}%
21975 \pgfnode{\pgf@circ@temp}{center}{}{\thisshape-R}{\pgfusepath{stroke}}
21976 \endpgfscope
21977 %
21978 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
21979 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
21980 \pgfpathlineto{\pgfpointanchor{\thisshape-L}{\ifpgf@circ@dbipoleL@invert a\else b\fi}}
21981 %
21982 \pgfpathmoveto{\pgfpointanchor{\thisshape-L}{\ifpgf@circ@dbipoleL@invert b\else a\fi}}
21983 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
21984 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
21985 %
21986 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
21987 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
21988 \pgfpathlineto{\pgfpointanchor{\thisshape-R}{\ifpgf@circ@dbipoleR@invert b\else a\fi}}
21989 %
21990 \pgfpathmoveto{\pgfpointanchor{\thisshape-R}{\ifpgf@circ@dbipoleR@invert a\else b\fi}}
21991 \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
21992 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
21993 \pgfusepath{draw}
21994 }
21995 \pgfcircdeclaredbipole{double bipole}{
21996 \pgf@circ@drawdbipolebasicbody
21997 }{}
21998
21999
22000 % %>>>
22001
22002 %%%%%%%%%%%%%%%%%%%
22003 %% Block diagrams
22004 %%%%%%%%%%%%%%%%%%%
22005
22006 % Definitions and options for blocks (twoports and so)%<<<1
22007
22008 \ctikzset{bipoles/twoport/width/.initial=.7}
22009 \ctikzset{bipoles/twoport/height/.initial=.7}
22010 \ctikzset{bipoles/twoport/text/.initial=}
22011 \ctikzset{bipoles/twoportsplit/width/.initial=.7}
22012 \ctikzset{bipoles/twoportsplit/height/.initial=.7}
22013 \ctikzset{bipoles/twoport/text in/.initial=}
22014 \ctikzset{bipoles/twoport/text out/.initial=}
22015 \ctikzset{text/.style={t=#1}}
22016 \ctikzset{t/.code={%
22017 \ctikzsetvalof{bipoles/twoport/text}{#1}%
22018 }}
22019 \ctikzset{text in/.style={t1=#1}}
22020 \ctikzset{t1/.code={%
22021 \ctikzsetvalof{bipoles/twoport/text in}{#1}%
22022 }}
22023 \ctikzset{text out/.style={t2=#1}}
22024 \ctikzset{t2/.code={%
22025 \ctikzsetvalof{bipoles/twoport/text out}{#1}%
22026 }}
22027 \ctikzset{bipoles/vco/width/.initial=.7}
22028 \ctikzset{bipoles/bandpass/width/.initial=.7}
22029 \ctikzset{bipoles/bandstop/width/.initial=.7}
22030 \ctikzset{bipoles/highpass/width/.initial=.7}
22031 \ctikzset{bipoles/highpass2/width/.initial=.7}
22032 \ctikzset{bipoles/lowpass/width/.initial=.7}
22033 \ctikzset{bipoles/lowpass2/width/.initial=.7}
22034 \ctikzset{bipoles/allpass/width/.initial=.7}
22035 \ctikzset{bipoles/vallpass/width/.initial=.7}
22036 \ctikzset{bipoles/bgenerator/width/.initial=.7}
22037 \ctikzset{bipoles/qgenerator/width/.initial=.7}
22038 \ctikzset{bipoles/cgenerator/width/.initial=.7}
22039 \ctikzset{bipoles/ngenerator/width/.initial=.7}
22040 \ctikzset{bipoles/adc/width/.initial=.7}
22041 \ctikzset{bipoles/dac/width/.initial=.7}
22042 \ctikzset{bipoles/dsp/width/.initial=.7}
22043 \ctikzset{bipoles/fft/width/.initial=.7}
22044 \ctikzset{bipoles/amp/width/.initial=.7}
22045 \ctikzset{bipoles/iamp/width/.initial=.7}
22046 \ctikzset{bipoles/vamp/width/.initial=.7}
22047 \ctikzset{bipoles/piattenuator/width/.initial=.7}
22048 \ctikzset{bipoles/vpiattenuator/width/.initial=.7}
22049 \ctikzset{bipoles/tattenuator/width/.initial=.7}
22050 \ctikzset{bipoles/vtattenuator/width/.initial=.7}
22051 \ctikzset{bipoles/phaseshifter/width/.initial=.7}
22052 \ctikzset{bipoles/vphaseshifter/width/.initial=.7}
22053 \ctikzset{bipoles/biast/width/.initial=.7}
22054 \ctikzset{bipoles/sinetable/width/.initial=.7}
22055 \ctikzset{bipoles/register/width/.initial=.7}
22056 \ctikzset{bipoles/detector/width/.initial=.7}
22057 \ctikzset{bipoles/saturation/width/.initial=.7}
22058 \ctikzset{bipoles/sigmoid/width/.initial=.7}
22059 \ctikzset{bipoles/allornothing/width/.initial=.7}
22060
22061 \ctikzset{bipoles/camera/height/.initial=1.2}
22062 \ctikzset{bipoles/camera/depth/.initial=.3}
22063 \ctikzset{bipoles/camera/width/.initial=.4}
22064 \ctikzset{bipoles/tvset/width/.initial=0.6}
22065 \ctikzset{bipoles/tvset/height/.initial=.4}
22066 \ctikzset{bipoles/trx/width/.initial=1}
22067 \ctikzset{bipoles/trx/height/.initial=.4}
22068 \ctikzset{bipoles/swr/width/.initial=0.6}
22069 \ctikzset{bipoles/swr/height/.initial=.4}
22070 \ctikzset{bipoles/power/width/.initial=1}
22071 \ctikzset{bipoles/power/height/.initial=.4}
22072
22073 \ctikzset{tripoles/mixer/width/.initial=0.7}
22074 \ctikzset{tripoles/adder/width/.initial=0.7}
22075 \ctikzset{tripoles/circulator/width/.initial=.7}
22076 \ctikzset{tripoles/oscillator/width/.initial=.7}
22077 \ctikzset{bipoles/fiber/width/.initial=.7}
22078
22079 \ctikzset{tripoles/wilkinson/height/.initial=1.3}
22080 \ctikzset{tripoles/wilkinson/width/.initial=1.3}
22081
22082 \ctikzset{tripoles/splitter/height/.initial=1.3}
22083 \ctikzset{tripoles/splitter/width/.initial=1.3}
22084
22085 \ctikzset{tripoles/genericsplitter/height/.initial=1.3}
22086 \ctikzset{tripoles/genericsplitter/width/.initial=1.3}
22087
22088 \ctikzset{tripoles/mzm/height/.initial=1.3}
22089 \ctikzset{tripoles/mzm/width/.initial=1.3}
22090
22091 % Option ">" for twoports
22092 \newif\ifpgf@circuit@inputarrow
22093 \ctikzset{>/.add code={}{\pgf@circuit@inputarrowtrue}}
22094 \ctikzset{inputarrow/.is choice}
22095 \ctikzset{inputarrow/true/.code={\pgf@circuit@inputarrowtrue}}
22096 \ctikzset{inputarrow/false/.code={\pgf@circuit@inputarrowfalse}}
22097
22098 % Option "boxed" for nodes and twoports
22099 \newif\ifpgf@circuit@boxed
22100 \newif\ifpgf@circuit@boxedcircled\pgf@circuit@boxedcircledtrue
22101 \pgfkeys{/tikz/boxed/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
22102 \ctikzset{boxed/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
22103 \pgfkeys{/tikz/box/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
22104 \ctikzset{box/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledtrue}}
22105 % boxed, no circle
22106 \pgfkeys{/tikz/boxed only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
22107 \ctikzset{boxed only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
22108 \pgfkeys{/tikz/box only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
22109 \ctikzset{box only/.add code={}{\pgf@circuit@boxedtrue\pgf@circuit@boxedcircledfalse}}
22110
22111 % Option "dashed" for nodes and twoports
22112 \newif\ifpgf@circuit@dashed
22113 \pgfkeys{/tikz/dashed/.add code={}{\pgf@circuit@dashedtrue}}
22114 \ctikzset{dashed/.add code={}{\pgf@circuit@dashedtrue}}%
22115 % Also draw internal things dashed
22116 \newif\ifpgf@circuit@full@dashed
22117 \ctikzset{inner blocks dashed/.is if=pgf@circuit@full@dashed}%
22118 % Default block dash
22119 \ctikzset{dashed blocks pattern/.initial={{0.1cm}{0.1cm}}}
22120 %
22121 % powerelectronic blocks
22122 \ctikzset{bipoles/sacdc/width/.initial=.7}
22123 \ctikzset{bipoles/sdcac/width/.initial=.7}
22124 \ctikzset{bipoles/sdcdc/width/.initial=.7}
22125 \ctikzset{bipoles/tacdc/width/.initial=.7}
22126 \ctikzset{bipoles/tdcac/width/.initial=.7}
22127 \ctikzset{quadpoles/gridnode/width/.initial=.7} %not sure if quadpole?
22128
22129 %>>>
22130
22131 %% Node shapes definition for path-style block diagrams%<<<
22132
22133 %% Draw the two-port fillable box
22134 \def\pgf@circ@twoportbox{%
22135 \pgfscope
22136 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}%
22137 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}%
22138 \pgf@circ@draworfill
22139 \endpgfscope
22140 }
22141 \def\pgf@circ@inputarrow{%
22142 \ifpgf@circuit@inputarrow
22143 {%
22144 % Remove this: the line will overrun the tip, resulting in bad look. See issue #613, thanks to Laurenz Preindl
22145 % \advance \pgf@circ@res@left by -.5\ctikzvalof{bipoles/thickness}\pgfstartlinewidth
22146 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}%
22147 \pgfnode{inputarrow}{tip}{}{pgf@inputarrow}{\pgfusepath{fill}}%
22148 }%
22149 \fi
22150 }
22151 %%% blocks additional anchors
22152 \ctikzset{block left anchors pos/.initial=0.5}
22153 \ctikzset{block right anchors pos/.initial=0.5}
22154 \ctikzset{block lateral anchors pos/.code={
22155 \ctikzset{block left anchors pos=#1}%
22156 \ctikzset{block right anchors pos=#1}%
22157 }}
22158 \def\pgcirc@twoport@additional@anchors{%
22159 \savedmacro{\blockleftanchorpos}{\edef\blockleftanchorpos{\ctikzvalof{block left anchors pos}}}
22160 \savedmacro{\blockrightanchorpos}{\edef\blockrightanchorpos{\ctikzvalof{block right anchors pos}}}
22161 \anchor{right down}{\northeast\pgf@y=-\blockrightanchorpos\pgf@y}
22162 \anchor{left down}{\northeast\pgf@x=-\pgf@x\pgf@y=-\blockleftanchorpos\pgf@y}
22163 \anchor{left up}{\northeast\pgf@x=-\pgf@x\pgf@y=\blockleftanchorpos\pgf@y}
22164 \anchor{right up}{\northeast\pgf@y=\blockrightanchorpos\pgf@y}
22165 \anchor{up}{\northeast\pgf@x=0pt\relax}
22166 \anchor{down}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt\relax}
22167 }
22168
22169 %%% definition to help define the blocks. Notice that the height, width, etc are different, so we can't
22170 %%% simplify more...
22171 \def\pfgcirc@twoport@get@symbol@rotation{
22172 %%% put the needed rotation in \@@rotation
22173 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
22174 \def\@@rotation{0}
22175 \ifnum \pgfcircmathresult > 45 \ifnum \pgfcircmathresult < 135
22176 \def\@@rotation{270}
22177 \fi\fi
22178 \ifnum \pgfcircmathresult > 134 \ifnum \pgfcircmathresult < 225
22179 \def\@@rotation{180}
22180 \fi\fi
22181 \ifnum \pgfcircmathresult > 224 \ifnum \pgfcircmathresult < 315
22182 \def\@@rotation{90}
22183 \fi\fi
22184 }
22185 %
22186 \def\pfgcirc@twoport@rotate@inner@symbol{%
22187 % rotate inner symbol
22188 \pfgcirc@twoport@get@symbol@rotation
22189 \pgftransformrotate{\@@rotation}
22190 }
22191 % enact dashing if needed
22192 \def\pgfcirc@twoport@maybedash{%
22193 \ifpgf@circuit@dashed
22194 \edef\@@tmp{\ctikzvalof{dashed blocks pattern}}
22195 \expandafter\pgfsetdash\expandafter{\@@tmp}{0cm}
22196 \fi
22197 }
22198 % debug
22199 \def\@@printrot{%
22200 \pgfsetcolor{red}
22201 \pgftext[center,x=0,y=0,]{\tiny\ttfamily\pgf@circ@direction > \@@rotation}
22202 }
22203 %
22204 \def\pgfcirc@twoport@setup#1{%
22205 \pgf@circ@res@step = #1\pgf@circ@scaled@Rlen%6 is the real width parameter
22206 \divide \pgf@circ@res@step by 2
22207 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
22208 \pgfsetarrows{-}
22209 % let set the dash for the next operations
22210 \pgfcirc@twoport@maybedash
22211 }
22212 %
22213 \def\pgfcirc@twoport@draw@sine#1#2{% #1 -> y shift; #2 -> crossed out if != 0
22214 % draw inner sine waves; ...res@step must be defined
22215 \pgfscope
22216 \pgfsetlinewidth{\pgfstartlinewidth}
22217 \pgftransformyshift{#1\pgf@circ@res@step}
22218 \pgfpathmoveto{\pgfpoint{-.5\pgf@circ@res@step}{0\pgf@circ@res@step}}
22219 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
22220 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
22221 \pgfpathsine{\pgfpoint{.25\pgf@circ@res@step}{-.25\pgf@circ@res@step}}
22222 \pgfpathcosine{\pgfpoint{.25\pgf@circ@res@step}{.25\pgf@circ@res@step}}
22223 \ifnum #2=0\else
22224 \pgfpathmoveto{\pgfpoint{0.15\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
22225 \pgfpathlineto{\pgfpoint{-0.15\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}
22226 \fi
22227 \pgfusepath{draw}
22228 \endpgfscope
22229 }
22230 %
22231 \def\pgfcirc@twoport@draw@narrowsine#1{% #1 -> y shift
22232 \pgfscope
22233 \pgfsetlinewidth{\pgfstartlinewidth}
22234 \pgftransformyshift{#1\pgf@circ@res@step}
22235 \pgfpathmoveto{\pgfpoint{.125\pgf@circ@res@step}{0\pgf@circ@res@step}}
22236 \pgfpathsine{\pgfpoint{.125\pgf@circ@res@step}{.125\pgf@circ@res@step}}
22237 \pgfpathcosine{\pgfpoint{.125\pgf@circ@res@step}{-.125\pgf@circ@res@step}}
22238 \pgfpathsine{\pgfpoint{.125\pgf@circ@res@step}{-.125\pgf@circ@res@step}}
22239 \pgfpathcosine{\pgfpoint{.125\pgf@circ@res@step}{.125\pgf@circ@res@step}}
22240 \pgfusepath{draw}
22241 \endpgfscope
22242 }
22243 %
22244 \def\pgfcirc@twoport@draw@splitline{%
22245 \pgfscope
22246 \pgfcirc@twoport@maybedash
22247 \pgfsetlinewidth{\pgfstartlinewidth}
22248 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
22249 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
22250 \pgfusepath{draw}
22251 \endpgfscope
22252 }
22253 %
22254 \long\def\pgfcirc@define@twoports#1#2#3#4#5#6#7{
22255 \pgfcircdeclarebipolescaled{#1}
22256 {
22257 \pgcirc@twoport@additional@anchors
22258 #2
22259 }
22260 {#3}
22261 {#4}
22262 {#5}
22263 {#6}
22264 {
22265 \pgfcirc@twoport@setup{#6}
22266 % draw outer box
22267 \pgf@circ@twoportbox
22268 % draw solid line for inner symbol if no box is drawn and not fully dashed
22269 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
22270 \pgf@circ@inputarrow
22271 \pfgcirc@twoport@rotate@inner@symbol
22272 #7
22273 }
22274 }
22275 %
22276 \long\def\pgfcirc@define@twoports@norotate#1#2#3#4#5#6#7{
22277 \pgfcircdeclarebipolescaled{#1}
22278 {
22279 \pgcirc@twoport@additional@anchors
22280 #2
22281 }
22282 {#3}
22283 {#4}
22284 {#5}
22285 {#6}
22286 {
22287 \pgfcirc@twoport@setup{#6}
22288 % draw outer box
22289 \pgf@circ@twoportbox
22290 % draw solid line for inner symbol if no box is drawn and not fully dashed
22291 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
22292 \pgf@circ@inputarrow
22293 #7
22294 }
22295 }
22296 %% Generic two port box
22297 \pgfcirc@define@twoports{blocks}
22298 {}
22299 {\ctikzvalof{bipoles/twoport/height}}
22300 {twoport}
22301 {\ctikzvalof{bipoles/twoport/height}}
22302 {\ctikzvalof{bipoles/twoport/width}}
22303 {
22304 % draw inner symbol
22305 \pgf@circ@text@strokecolor
22306 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
22307
22308 }
22309 %% twoport split
22310 \pgfcirc@define@twoports{blocks}
22311 {}
22312 {\ctikzvalof{bipoles/twoportsplit/height}}
22313 {twoportsplit}
22314 {\ctikzvalof{bipoles/twoportsplit/height}}
22315 {\ctikzvalof{bipoles/twoportsplit/width}}
22316 {
22317 %get texts
22318 \def\pgfcirc@tin{\ctikzvalof{bipoles/twoport/text in}}
22319 \def\pgfcirc@tout{\ctikzvalof{bipoles/twoport/text out}}
22320 % shuffle text depending on rotation
22321 \pgfcirc@twoport@draw@splitline
22322 %
22323 \pgf@circ@text@strokecolor
22324 \ifnum\@@rotation<145
22325 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\pgfcirc@tin}
22326 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\pgfcirc@tout}
22327 \else
22328 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{\pgfcirc@tout}
22329 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{\pgfcirc@tin}
22330 \fi
22331 }
22332 %% bandpass filter
22333 \pgfcirc@define@twoports{blocks}
22334 {}
22335 {\ctikzvalof{bipoles/bandpass/width}}
22336 {bandpass}
22337 {\ctikzvalof{bipoles/bandpass/width}}
22338 {\ctikzvalof{bipoles/bandpass/width}}
22339 {
22340 \pgfcirc@twoport@draw@sine{0.5}{1}
22341 \pgfcirc@twoport@draw@sine{0.0}{0}
22342 \pgfcirc@twoport@draw@sine{-0.5}{1}
22343 }
22344 %% bandstop filter
22345 \pgfcirc@define@twoports{blocks}
22346 {}
22347 {\ctikzvalof{bipoles/bandstop/width}}
22348 {bandstop}
22349 {\ctikzvalof{bipoles/bandstop/width}}
22350 {\ctikzvalof{bipoles/bandstop/width}}
22351 {
22352 \pgfcirc@twoport@draw@sine{0.5}{0}
22353 \pgfcirc@twoport@draw@sine{0.0}{1}
22354 \pgfcirc@twoport@draw@sine{-0.5}{0}
22355 }
22356 %% highpass filter
22357 \pgfcirc@define@twoports{blocks}
22358 {}
22359 {\ctikzvalof{bipoles/highpass/width}}
22360 {highpass}
22361 {\ctikzvalof{bipoles/highpass/width}}
22362 {\ctikzvalof{bipoles/highpass/width}}
22363 {
22364 \pgfcirc@twoport@draw@sine{0.5}{0}
22365 \pgfcirc@twoport@draw@sine{0.0}{1}
22366 \pgfcirc@twoport@draw@sine{-0.5}{1}
22367 }
22368 %% highpass2 filter ---simplyfied with just two waves
22369 \pgfcirc@define@twoports{blocks}
22370 {}
22371 {\ctikzvalof{bipoles/highpass2/width}}
22372 {highpass2}
22373 {\ctikzvalof{bipoles/highpass2/width}}
22374 {\ctikzvalof{bipoles/highpass2/width}}
22375 {
22376 \pgfcirc@twoport@draw@sine{0.25}{0}
22377 \pgfcirc@twoport@draw@sine{-0.25}{1}
22378 }
22379 %% lowpass filter
22380 \pgfcirc@define@twoports{blocks}
22381 {}
22382 {\ctikzvalof{bipoles/lowpass/width}}
22383 {lowpass}
22384 {\ctikzvalof{bipoles/lowpass/width}}
22385 {\ctikzvalof{bipoles/lowpass/width}}
22386 {
22387 \pgfcirc@twoport@draw@sine{0.5}{1}
22388 \pgfcirc@twoport@draw@sine{0.0}{1}
22389 \pgfcirc@twoport@draw@sine{-0.5}{0}
22390 }
22391 %% lowpass2 filter: simplyfied with just two waves
22392 \pgfcirc@define@twoports{blocks}
22393 {}
22394 {\ctikzvalof{bipoles/lowpass2/width}}
22395 {lowpass2}
22396 {\ctikzvalof{bipoles/lowpass2/width}}
22397 {\ctikzvalof{bipoles/lowpass2/width}}
22398 {
22399 \pgfcirc@twoport@draw@sine{0.25}{1}
22400 \pgfcirc@twoport@draw@sine{-0.25}{0}
22401 }
22402 %% allpass filter
22403 \pgfcirc@define@twoports{blocks}
22404 {}
22405 {\ctikzvalof{bipoles/allpass/width}}
22406 {allpass}
22407 {\ctikzvalof{bipoles/allpass/width}}
22408 {\ctikzvalof{bipoles/allpass/width}}
22409 {
22410 \pgfcirc@twoport@draw@sine{0.5}{0}
22411 \pgfcirc@twoport@draw@sine{0.0}{0}
22412 \pgfcirc@twoport@draw@sine{-0.5}{0}
22413 }
22414 %% variable allpass filter
22415 \pgfcirc@define@twoports{blocks}
22416 {}
22417 {\ctikzvalof{bipoles/vallpass/width}}
22418 {vallpass}
22419 {\ctikzvalof{bipoles/vallpass/width}}
22420 {\ctikzvalof{bipoles/vallpass/width}}
22421 {
22422 \pgfcirc@twoport@draw@sine{0.5}{0}
22423 \pgfcirc@twoport@draw@sine{0.0}{0}
22424 \pgfcirc@twoport@draw@sine{-0.5}{0}
22425 \pgfcirc@set@arrows{tunable}{}{latex}
22426 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22427 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
22428 \pgfusepath{draw}
22429 }
22430 %% Block Generator
22431 \pgfcirc@define@twoports{blocks}
22432 {}
22433 {\ctikzvalof{bipoles/bgenerator/width}}
22434 {bgenerator}
22435 {\ctikzvalof{bipoles/bgenerator/width}}
22436 {\ctikzvalof{bipoles/bgenerator/width}}
22437 {
22438 \pgfcirc@twoport@draw@narrowsine{0.25}
22439 \pgfcirc@twoport@draw@narrowsine{0.0}
22440 \pgfcirc@twoport@draw@narrowsine{-0.25}
22441 \pgftext[x=0.45\pgf@circ@res@left]{\ctikzvalof{bipoles/twoport/text}}
22442 }
22443 %% Crystal Generator
22444 \pgfcirc@define@twoports{blocks}
22445 {}
22446 {\ctikzvalof{bipoles/qgenerator/width}}
22447 {qgenerator}
22448 {\ctikzvalof{bipoles/qgenerator/width}}
22449 {\ctikzvalof{bipoles/qgenerator/width}}
22450 {
22451 \pgfcirc@twoport@draw@narrowsine{0.45}
22452 \pgfcirc@twoport@draw@narrowsine{0.20}
22453 \pgfcirc@twoport@draw@narrowsine{-0.05}
22454 \pgftext[x=0.45\pgf@circ@res@left,y=0.25\pgf@circ@res@up]{\ctikzvalof{bipoles/twoport/text}}
22455 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
22456 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
22457 \pgfusepath{draw}
22458 \pgfpathrectangle{\pgfpoint{-0.7\pgf@circ@res@step}{-0.7\pgf@circ@res@step}}
22459 {\pgfpoint{1.4\pgf@circ@res@step}{0.2\pgf@circ@res@step}}
22460 \pgfusepath{draw}
22461 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.8\pgf@circ@res@step}}
22462 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.8\pgf@circ@res@step}}
22463 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
22464 \pgfpathlineto{\pgfpoint{ 0.7\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
22465 \pgfusepath{draw}
22466 }
22467 %% Clock generator
22468 \pgfcirc@define@twoports{blocks}
22469 {}
22470 {\ctikzvalof{bipoles/cgenerator/width}}
22471 {cgenerator}
22472 {\ctikzvalof{bipoles/cgenerator/width}}
22473 {\ctikzvalof{bipoles/cgenerator/width}}
22474 {
22475 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22476 \pgfpathlineto{\pgfpoint{-0.42\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22477 \pgfpathlineto{\pgfpoint{-0.42\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
22478 \pgfpathlineto{\pgfpoint{-0.14\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
22479 \pgfpathlineto{\pgfpoint{-0.14\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22480 \pgfpathlineto{\pgfpoint{+0.14\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22481 \pgfpathlineto{\pgfpoint{+0.14\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
22482 \pgfpathlineto{\pgfpoint{+0.42\pgf@circ@res@step}{+0.35\pgf@circ@res@step}}
22483 \pgfpathlineto{\pgfpoint{+0.42\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22484 \pgfpathlineto{\pgfpoint{+0.70\pgf@circ@res@step}{-0.35\pgf@circ@res@step}}
22485 \pgfusepath{draw}
22486 }
22487 %% Generic generator
22488 \pgfcirc@define@twoports{blocks}
22489 {}
22490 {\ctikzvalof{bipoles/ngenerator/width}}
22491 {ngenerator}
22492 {\ctikzvalof{bipoles/ngenerator/width}}
22493 {\ctikzvalof{bipoles/ngenerator/width}}
22494 {
22495 \pgfcirc@twoport@draw@sine{0.5}{0}
22496 \pgftext[y=-0.35\pgf@circ@res@up]{\ctikzvalof{bipoles/twoport/text}}
22497 }
22498 %% ADC
22499 \pgfcirc@define@twoports{blocks}
22500 {}
22501 {\ctikzvalof{bipoles/adc/width}}
22502 {adc}
22503 {\ctikzvalof{bipoles/adc/width}}
22504 {\ctikzvalof{bipoles/adc/width}}
22505 {
22506 \pgfcirc@twoport@draw@splitline
22507 %
22508 \pgf@circ@text@strokecolor
22509 \ifnum\@@rotation<145
22510 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{A}
22511 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{D}
22512 \else
22513 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{D}
22514 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{A}
22515 \fi
22516 }
22517
22518 %% DAC
22519 \pgfcirc@define@twoports{blocks}
22520 {}
22521 {\ctikzvalof{bipoles/dac/width}}
22522 {dac}
22523 {\ctikzvalof{bipoles/dac/width}}
22524 {\ctikzvalof{bipoles/dac/width}}
22525 {
22526 \pgfcirc@twoport@draw@splitline
22527 %
22528 \pgf@circ@text@strokecolor
22529 \ifnum\@@rotation<145
22530 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{D}
22531 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{A}
22532 \else
22533 \pgftext[center,x=0.45\pgf@circ@res@left,y=0.45\pgf@circ@res@up]{A}
22534 \pgftext[center,x=0.45\pgf@circ@res@right,y=0.45\pgf@circ@res@down]{D}
22535 \fi
22536 }
22537
22538 %% DSP
22539 \pgfcirc@define@twoports{blocks}
22540 {}
22541 {\ctikzvalof{bipoles/dsp/width}}
22542 {dsp}
22543 {\ctikzvalof{bipoles/dsp/width}}
22544 {\ctikzvalof{bipoles/dsp/width}}
22545 {
22546 \pgf@circ@text@strokecolor
22547 \pgftext[center,x=0,y=0]{\textsf{DSP}}
22548 }
22549 %% FFT
22550 \pgfcirc@define@twoports{blocks}
22551 {}
22552 {\ctikzvalof{bipoles/fft/width}}
22553 {fft}
22554 {\ctikzvalof{bipoles/fft/width}}
22555 {\ctikzvalof{bipoles/fft/width}}
22556 {
22557 \pgf@circ@text@strokecolor
22558 \pgftext[center,x=0,y=0]{\textsf{FFT}}
22559 }
22560 %% pi attenuator
22561 \pgfcirc@define@twoports{blocks}
22562 {}
22563 {\ctikzvalof{bipoles/piattenuator/width}}
22564 {piattenuator}
22565 {\ctikzvalof{bipoles/piattenuator/width}}
22566 {\ctikzvalof{bipoles/piattenuator/width}}
22567 {
22568 % draw inner symbol
22569 \pgfsetlinewidth{\pgfstartlinewidth}
22570 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
22571 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22572 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
22573 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22574 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22575 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22576 \pgfusepath{draw}
22577 }
22578 %% variable pi attenuator
22579 \pgfcirc@define@twoports{blocks}
22580 {}
22581 {\ctikzvalof{bipoles/vpiattenuator/width}}
22582 {vpiattenuator}
22583 {\ctikzvalof{bipoles/vpiattenuator/width}}
22584 {\ctikzvalof{bipoles/vpiattenuator/width}}
22585 {
22586 % draw inner symbol
22587 \pgfsetlinewidth{\pgfstartlinewidth}
22588 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
22589 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22590 \pgfpathmoveto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
22591 \pgfpathlineto{\pgfpoint{0.4\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22592 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22593 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22594 \pgfusepath{draw}
22595 \pgfcirc@set@arrows{tunable}{}{latex}
22596 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22597 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
22598 \pgfusepath{draw}
22599 }
22600 %% T attenuator
22601 \pgfcirc@define@twoports{blocks}
22602 {}
22603 {\ctikzvalof{bipoles/tattenuator/width}}
22604 {tattenuator}
22605 {\ctikzvalof{bipoles/tattenuator/width}}
22606 {\ctikzvalof{bipoles/tattenuator/width}}
22607 {
22608 % draw inner symbol
22609 \pgfsetlinewidth{\pgfstartlinewidth}
22610 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
22611 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
22612 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22613 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22614 \pgfusepath{draw}
22615 }
22616 %% variable T attenuator
22617 \pgfcirc@define@twoports{blocks}
22618 {}
22619 {\ctikzvalof{bipoles/vtattenuator/width}}
22620 {vtattenuator}
22621 {\ctikzvalof{bipoles/vtattenuator/width}}
22622 {\ctikzvalof{bipoles/vtattenuator/width}}
22623 {
22624 % draw inner symbol
22625 \pgfsetlinewidth{\pgfstartlinewidth}
22626 \pgfpathmoveto{\pgfpoint{0pt}{0.4\pgf@circ@res@down}}
22627 \pgfpathlineto{\pgfpoint{0pt}{0.4\pgf@circ@res@up}}
22628 \pgfpathmoveto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
22629 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
22630 \pgfusepath{draw}
22631 \pgfcirc@set@arrows{tunable}{}{latex}
22632 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
22633 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.8\pgf@circ@res@up}}
22634 \pgfusepath{draw}
22635 }
22636 %% phase shifter
22637 \pgfcirc@define@twoports{blocks}
22638 {}
22639 {\ctikzvalof{bipoles/phaseshifter/width}}
22640 {phaseshifter}
22641 {\ctikzvalof{bipoles/phaseshifter/width}}
22642 {\ctikzvalof{bipoles/phaseshifter/width}}
22643 {
22644 % inner symbol
22645 \pgf@circ@text@strokecolor
22646 \pgftext[center,x=0,y=0]{\Large$\varphi$}
22647 }
22648 %% variable phase shifter
22649 \pgfcirc@define@twoports{blocks}
22650 {}
22651 {\ctikzvalof{bipoles/phaseshifter/width}}
22652 {vphaseshifter}
22653 {\ctikzvalof{bipoles/vphaseshifter/width}}
22654 {\ctikzvalof{bipoles/vphaseshifter/width}}
22655 {
22656 \pgfsetlinewidth{\pgfstartlinewidth}
22657 \pgfcirc@set@arrows{tunable}{}{latex}
22658 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0.65\pgf@circ@res@down}}
22659 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.65\pgf@circ@res@up}}
22660 \pgfusepath{draw}
22661 % inner symbol
22662 \pgf@circ@text@strokecolor
22663 \pgftext[center,x=0,y=0]{\Large$\varphi$}
22664 }
22665 %% BIAS-T
22666 \pgfcirc@define@twoports{blocks}
22667 {}
22668 {\ctikzvalof{bipoles/biast/width}}
22669 {biast}
22670 {\ctikzvalof{bipoles/biast/width}}
22671 {\ctikzvalof{bipoles/biast/width}}
22672 {
22673 \pgfpathmoveto{\pgfpoint{-0.80\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Plate 1
22674 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22675 \pgfpathmoveto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Plate 1
22676 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22677 \pgfpathmoveto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22678 \pgfpathlineto{\pgfpoint{-0.50\pgf@circ@res@step}{-0.80\pgf@circ@res@step}}
22679 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Plate 1
22680 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22681 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22682 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.80\pgf@circ@res@step}}
22683 \pgfpathmoveto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Center
22684 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22685 \pgfusepath{draw}
22686 \pgfpathcircle{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}{0.075\pgf@circ@res@step}
22687 \pgfusepath{fill}
22688 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Right
22689 \pgfpathlineto{\pgfpoint{ 0.80\pgf@circ@res@step}{-0.50\pgf@circ@res@step}}
22690 \pgfusepath{draw}
22691 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.50\pgf@circ@res@step}} % Line to Coils
22692 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22693 \pgfusepath{draw}
22694 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.20\pgf@circ@res@step}} % Arc1
22695 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
22696 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-0.02\pgf@circ@res@step}} % Arc2
22697 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
22698 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.16\pgf@circ@res@step}} % Arc3
22699 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
22700 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.36\pgf@circ@res@step}} % Arc4
22701 \pgfpatharc{-90}{90}{0.09\pgf@circ@res@step}
22702 \pgfusepath{draw}
22703 \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.52\pgf@circ@res@step}} % Line to Coils
22704 \pgfpathlineto{\pgfpoint{ 0.00\pgf@circ@res@step}{+0.80\pgf@circ@res@step}}
22705 \pgfusepath{draw}
22706 }
22707 %% Sine table
22708 \pgfcirc@define@twoports{blocks}
22709 {}
22710 {\ctikzvalof{bipoles/sinetable/width}}
22711 {sinetable}
22712 {\ctikzvalof{bipoles/sinetable/width}}
22713 {\ctikzvalof{bipoles/sinetable/width}}
22714 {
22715 \pgfcirc@twoport@draw@sine{0.0}{0}
22716 \pgfcirc@set@arrows{tunable}{}{latex}
22717 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22718 \pgfpathlineto{\pgfpoint{+0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22719 \pgfusepath{draw}
22720 \pgfpathmoveto{\pgfpoint{-0.70\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22721 \pgfpathlineto{\pgfpoint{-0.70\pgf@circ@res@step}{+0.70\pgf@circ@res@step}}
22722 \pgfusepath{draw}
22723 }
22724 %% Register
22725 \pgfcirc@define@twoports{blocks}
22726 {
22727 \savedanchor\northwest{
22728 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
22729 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
22730 \pgf@y=.5\pgf@y
22731 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
22732 \pgf@x=.5\pgf@x
22733 }
22734 \anchor{clk}{\northwest\pgf@y=0.5\pgf@y}
22735 }
22736 {\ctikzvalof{bipoles/register/width}}
22737 {register}
22738 {\ctikzvalof{bipoles/register/width}}
22739 {\ctikzvalof{bipoles/register/width}}
22740 {
22741 \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{+0.70\pgf@circ@res@step}}
22742 \pgfpathlineto{\pgfpoint{-0.60\pgf@circ@res@step}{+0.50\pgf@circ@res@step}}
22743 \pgfpathlineto{\pgfpoint{-1.00\pgf@circ@res@step}{+0.30\pgf@circ@res@step}}
22744 \pgfusepath{draw}
22745 \pgf@circ@text@strokecolor
22746 \pgftext[center,x=0,y=0]{\ctikzvalof{bipoles/twoport/text}}
22747 }
22748 %% detector
22749 \pgfcirc@define@twoports@norotate{blocks}
22750 {}
22751 {\ctikzvalof{bipoles/detector/width}}
22752 {detector}
22753 {\ctikzvalof{bipoles/detector/width}}
22754 {\ctikzvalof{bipoles/detector/width}}
22755 {
22756 % draw inner stuff
22757 \pgfsetlinewidth{0.8\pgfstartlinewidth}
22758 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{0}}
22759 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{0}}
22760 \pgfusepath{draw}
22761 \ifpgf@circuit@fulldiode
22762 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width}}
22763 \pgftransformscale{\pgfmathresult}
22764 \pgfnode{fulldiodeshape}{center}{}{pgf@fulldiode}{\pgfusepath{fill}}
22765 \else
22766 \pgfmathparse{2\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width}}
22767 \pgftransformscale{\pgfmathresult}
22768 \pgfnode{emptydiodeshape}{center}{}{pgf@emptydiode}{\pgfusepath{fill}}
22769 \fi
22770 }
22771 %% saturation block, contributed by P.Sacco <paul.sacco@estaca,eu>
22772 \pgfcirc@define@twoports{blocks}
22773 {}
22774 {\ctikzvalof{bipoles/saturation/width}}
22775 {saturation}
22776 {\ctikzvalof{bipoles/saturation/width}}
22777 {\ctikzvalof{bipoles/saturation/width}}
22778 {
22779 \pgfsetlinewidth{1.2\pgfstartlinewidth}
22780 \pgfpathmoveto{\pgfpointorigin}
22781 \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22782 \pgfpathlineto{\pgfpoint{0.65\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22783 %
22784 \pgfpathmoveto{\pgfpointorigin}
22785 \pgfpathlineto{\pgfpoint{-.4\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22786 \pgfpathlineto{\pgfpoint{-0.65\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22787 \pgfusepath{draw}
22788 }
22789 %% sigmoid
22790 \pgfcirc@define@twoports{blocks}
22791 {}
22792 {\ctikzvalof{bipoles/sigmoid/width}}
22793 {sigmoid}
22794 {\ctikzvalof{bipoles/sigmoid/width}}
22795 {\ctikzvalof{bipoles/sigmoid/width}}
22796 {
22797 \pgfsetlinewidth{1.2\pgfstartlinewidth}
22798 \pgfpathmoveto{\pgfpoint{-.65\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22799 \pgfpathlineto{\pgfpoint{-.45\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22800 \pgfpathparabola{\pgfpointorigin}{\pgfpoint{.45\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22801 %
22802 \pgfpathmoveto{\pgfpoint{.65\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22803 \pgfpathlineto{\pgfpoint{.45\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22804 \pgfpathparabola{\pgfpointorigin}{\pgfpoint{-.45\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22805 \pgfusepath{draw}
22806 }
22807 %% all-or-nothing (comparator) block
22808 \pgfcirc@define@twoports{blocks}
22809 {}
22810 {\ctikzvalof{bipoles/allornothing/width}}
22811 {allornothing}
22812 {\ctikzvalof{bipoles/allornothing/width}}
22813 {\ctikzvalof{bipoles/allornothing/width}}
22814 {
22815 \pgfsetlinewidth{1.2\pgfstartlinewidth}
22816 \pgfpathmoveto{\pgfpoint{-0.55\pgf@circ@res@step}{-.4\pgf@circ@res@step}}
22817 \pgfpathlineto{\pgfpoint{+0pt}{-.4\pgf@circ@res@step}}
22818 \pgfpathlineto{\pgfpoint{+0pt}{.4\pgf@circ@res@step}}
22819 \pgfpathlineto{\pgfpoint{0.55\pgf@circ@res@step}{.4\pgf@circ@res@step}}
22820 \pgfusepath{draw}
22821 }
22822
22823 %% Camera:
22824 \pgfcircdeclarebipolescaled{misc}
22825 {}
22826 {\ctikzvalof{bipoles/camera/depth}}
22827 {camera}
22828 {\ctikzvalof{bipoles/camera/height}}
22829 {\ctikzvalof{bipoles/camera/width}}{
22830 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{.7\pgf@circ@res@up}}
22831 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
22832 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{.7\pgf@circ@res@up}}
22833 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
22834 \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
22835 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{.7\pgf@circ@res@up}}
22836 \pgfpathclose
22837 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
22838 \pgf@circ@draworfill
22839 }
22840
22841 % TV:
22842 \pgfcirc@define@twoports{blocks}
22843 {}
22844 {\ctikzvalof{bipoles/tvset/height}}
22845 {tvset}
22846 {\ctikzvalof{bipoles/tvset/height}}
22847 {\ctikzvalof{bipoles/tvset/width}}
22848 {
22849 \pgfsetlinewidth{2\pgflinewidth} % double in size
22850 % Legs
22851 \pgfpathmoveto{\pgfpoint{+0.60\pgf@circ@res@step}{-1.10\pgf@circ@res@step}}
22852 \pgfpathlineto{\pgfpoint{+0.30\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22853 \pgfusepath{draw}
22854 %
22855 \pgfpathmoveto{\pgfpoint{-0.60\pgf@circ@res@step}{-1.10\pgf@circ@res@step}}
22856 \pgfpathlineto{\pgfpoint{-0.30\pgf@circ@res@step}{-0.70\pgf@circ@res@step}}
22857 \pgfusepath{draw}
22858 }
22859
22860 % Transceiver (TRX)
22861 \pgfcirc@define@twoports{blocks}
22862 {
22863 \anchor{plus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x}
22864 \anchor{minus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
22865 }
22866 {\ctikzvalof{bipoles/trx/height}}
22867 {trx}
22868 {\ctikzvalof{bipoles/trx/height}}
22869 {\ctikzvalof{bipoles/trx/width}}
22870 {
22871 % VFO-Wheel:
22872 \pgfpathcircle{\pgfpoint{0.60\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{0.25\pgf@circ@res@step}
22873 \pgfpathcircle{\pgfpoint{0.68\pgf@circ@res@step}{0.10\pgf@circ@res@step}}{0.06\pgf@circ@res@step}
22874 % Volume and Squelch:
22875 \pgfpathcircle{\pgfpoint{-0.8\pgf@circ@res@step}{+0.15\pgf@circ@res@step}}{0.1\pgf@circ@res@step}
22876 \pgfpathcircle{\pgfpoint{-0.8\pgf@circ@res@step}{-0.15\pgf@circ@res@step}}{0.1\pgf@circ@res@step}
22877 % Display:
22878 \pgfpathrectangle{\pgfpoint{-0.55\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
22879 {\pgfpoint{+0.75\pgf@circ@res@step}{+0.5\pgf@circ@res@step}}%
22880 \pgfusepath{draw}
22881 }
22882 % Standing Wave Ratio (SWR) Meter
22883 \pgfcirc@define@twoports{blocks}
22884 {}
22885 {\ctikzvalof{bipoles/swr/height}}
22886 {swr}
22887 {\ctikzvalof{bipoles/swr/height}}
22888 {\ctikzvalof{bipoles/swr/width}}
22889 {
22890 % Screen:
22891 \pgfscope
22892 \pgfsetstrokecolor{gray}\pgfsetdash{{1.5pt}{1pt}}{0pt}
22893 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
22894 \pgfpatharc{160}{110}{1.1\pgf@circ@res@step}
22895 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@step}{-0.25\pgf@circ@res@step}}
22896 \pgfpatharc{-160}{-110}{-1.1\pgf@circ@res@step}
22897 \pgfusepath{draw}
22898 \endpgfscope
22899 \pgfpathmoveto{\pgfpoint{-0.7\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
22900 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{0.5\pgf@circ@res@step}}
22901 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
22902 \pgfpathlineto{\pgfpoint{0pt}{-0.4\pgf@circ@res@step}}
22903 \pgfpathlineto{\pgfpoint{-0.7\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
22904 \pgfpathclose
22905 \pgfpathmoveto{\pgfpoint{-0.35\pgf@circ@res@step}{-0.3\pgf@circ@res@step}}
22906 \pgfpathlineto{\pgfpoint{0.3\pgf@circ@res@step}{0.3\pgf@circ@res@step}}
22907 \pgfpathmoveto{\pgfpoint{0.35\pgf@circ@res@step}{-0.3\pgf@circ@res@step}}
22908 \pgfpathlineto{\pgfpoint{-0.3\pgf@circ@res@step}{0.3\pgf@circ@res@step}}
22909 \pgfusepath{draw}
22910 }
22911 % Power supply
22912 \pgfcirc@define@twoports{blocks}
22913 {
22914 \anchor{u1}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x}
22915 \anchor{u2}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
22916 \anchor{plus}{\northeast \advance\pgf@y by -0.2\pgf@x \advance\pgf@x by -0.25\pgf@x}
22917 \anchor{minus}{\northeast \advance\pgf@y by -0.2\pgf@x\pgf@y=-\pgf@y \advance\pgf@x by -0.25\pgf@x}
22918 }
22919 {\ctikzvalof{bipoles/power/height}}
22920 {power}
22921 {\ctikzvalof{bipoles/power/height}}
22922 {\ctikzvalof{bipoles/power/width}}
22923 {
22924 % Plus:
22925 \color{red}
22926 \pgfsetstrokecolor{red}
22927 \pgfpathcircle{\pgfpoint{0.75\pgf@circ@res@step}{0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
22928 \pgfusepath{fill}
22929 \pgfpathmoveto{\pgfpoint{0.50\pgf@circ@res@step}{0.20\pgf@circ@res@step}}
22930 \pgfpathlineto{\pgfpoint{0.60\pgf@circ@res@step}{0.20\pgf@circ@res@step}}
22931 \pgfpathmoveto{\pgfpoint{0.55\pgf@circ@res@step}{0.25\pgf@circ@res@step}}
22932 \pgfpathlineto{\pgfpoint{0.55\pgf@circ@res@step}{0.15\pgf@circ@res@step}}
22933 \pgfusepath{stroke}
22934 % Minus:
22935 \color{black}
22936 \pgfsetstrokecolor{black}
22937 \pgfpathcircle{\pgfpoint{0.75\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
22938 \pgfusepath{fill}
22939 \pgfpathmoveto{\pgfpoint{0.50\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22940 \pgfpathlineto{\pgfpoint{0.60\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}
22941 \pgfusepath{stroke}
22942 % Displays:
22943 \pgfpathrectangle{\pgfpoint{-0.5\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.4\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
22944 \pgfpathrectangle{\pgfpoint{-0.0\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.4\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
22945 % Poti:
22946 \pgfpathcircle{\pgfpoint{-0.30\pgf@circ@res@step}{-0.20\pgf@circ@res@step}}{0.075\pgf@circ@res@step}%
22947 \pgfusepath{draw}
22948 % Switch:
22949 \pgfpathrectangle{\pgfpoint{-0.9\pgf@circ@res@step}{0.00\pgf@circ@res@step}}{\pgfpoint{+0.15\pgf@circ@res@step}{+0.25\pgf@circ@res@step}}%
22950 \pgfpathmoveto{\pgfpoint{-0.90\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
22951 \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
22952 \pgfusepath{draw}
22953 }
22954
22955 %% converters help function
22956 %% definition for styling the DC symbols (GitHub issue #680)
22957 \ctikzset{blocks dc in segments/.initial=1}
22958 \ctikzset{blocks dc out segments/.initial=1}
22959 \ctikzset{blocks dc segments/.code={%
22960 \ctikzset{blocks dc in segments=#1}%
22961 \ctikzset{blocks dc out segments=#1}%
22962 }
22963 }
22964 \def\pgf@circ@twoport@converter@dc#1#2{%
22965 \pgfscope
22966 \pgftransformshift{\pgfpoint{#1\pgf@circ@res@step}{#2\pgf@circ@res@step}}
22967 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
22968 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@step}{0.125\pgf@circ@res@step}}
22969 \pgfusepath{draw}
22970 \ifpgf@circuit@full@dashed\else % do not apply the specific dash if fully dashing
22971 \edef\@@up{\ctikzvalof{blocks dc in segments}}
22972 \edef\@@down{\ctikzvalof{blocks dc out segments}}
22973 \ifdim\dimexpr#1\pgf@circ@res@step\relax<0pt
22974 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@step/(4*\@@up-2)}
22975 \else
22976 \pgfmathsetlength{\pgf@circ@res@other}{\pgf@circ@res@step/(4*\@@down-2)}
22977 \fi
22978 \pgfsetdash{{\pgf@circ@res@other}{\pgf@circ@res@other}}{0pt}
22979 \fi
22980 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{-0.125\pgf@circ@res@step}}
22981 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@step}{-0.125\pgf@circ@res@step}}
22982 \pgfusepath{draw}
22983 \endpgfscope
22984 }
22985 \def\pgf@circ@twoport@converter@dc@up{%
22986 \pgf@circ@twoport@converter@dc{-0.5}{0.5}
22987 }
22988 \def\pgf@circ@twoport@converter@dc@down{%
22989 \pgf@circ@twoport@converter@dc{0.5}{-0.5}
22990 }
22991 \def\pgf@circ@twoport@converter@ac#1#2{%
22992 \pgfscope
22993 \pgftransformshift{\pgfpoint{#1\pgf@circ@res@step}{#2\pgf@circ@res@step}}
22994 \pgfpathmoveto{\pgfpoint{-.31\pgf@circ@res@step}{0\pgf@circ@res@step}}
22995 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
22996 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
22997 \pgfpathsine{\pgfpoint{.17\pgf@circ@res@step}{-.17\pgf@circ@res@step}}
22998 \pgfpathcosine{\pgfpoint{.17\pgf@circ@res@step}{.17\pgf@circ@res@step}}
22999 \pgfusepath{draw}
23000 \endpgfscope
23001 }
23002 \def\pgf@circ@twoport@converter@ac@up{%
23003 \pgf@circ@twoport@converter@ac{-0.45}{0.5}
23004 }
23005 \def\pgf@circ@twoport@converter@ac@down{%
23006 \pgf@circ@twoport@converter@ac{0.45}{-0.5}
23007 }
23008 \def\pgf@circ@twoport@converter@tac@up{%
23009 \pgf@circ@twoport@converter@ac{-0.45}{0.65}
23010 \pgf@circ@twoport@converter@ac{-0.45}{0.5}
23011 \pgf@circ@twoport@converter@ac{-0.45}{0.35}
23012 }
23013 \def\pgf@circ@twoport@converter@tac@down{%
23014 \pgf@circ@twoport@converter@ac{0.45}{-0.65}
23015 \pgf@circ@twoport@converter@ac{0.45}{-0.5}
23016 \pgf@circ@twoport@converter@ac{0.45}{-0.35}
23017 }
23018 %% single phase ac/dc converter
23019 \pgfcirc@define@twoports{blocks}
23020 {
23021 % these two are left for backward compatibiliyt
23022 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y}
23023 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y}
23024 % better
23025 \anchor{ac up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
23026 \anchor{ac down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
23027 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
23028 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
23029 }
23030 {\ctikzvalof{bipoles/sacdc/width}}
23031 {sacdc}
23032 {\ctikzvalof{bipoles/sacdc/width}}
23033 {\ctikzvalof{bipoles/sacdc/width}}
23034 {
23035 \pgfcirc@twoport@draw@splitline
23036 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
23037 \pgf@circ@twoport@converter@ac@up
23038 \pgf@circ@twoport@converter@dc@down
23039 \else
23040 \pgf@circ@twoport@converter@dc@up
23041 \pgf@circ@twoport@converter@ac@down
23042 \fi
23043 }
23044 %% dc/dc converter
23045 \pgfcirc@define@twoports{blocks}
23046 {
23047 % these two are left for backward compatibiliyt
23048 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
23049 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
23050 % better
23051 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
23052 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
23053 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
23054 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
23055 }
23056 {\ctikzvalof{bipoles/sdcdc/width}}
23057 {sdcdc}
23058 {\ctikzvalof{bipoles/sdcdc/width}}
23059 {\ctikzvalof{bipoles/sdcdc/width}}
23060 {
23061 \pgfcirc@twoport@draw@splitline
23062 % No need to switch here
23063 \pgf@circ@twoport@converter@dc@up
23064 \pgf@circ@twoport@converter@dc@down
23065 }
23066 %% single phase dc/ac converter
23067 \pgfcirc@define@twoports{blocks}
23068 {
23069 % these two are left for backward compatibiliyt
23070 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
23071 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
23072 % better
23073 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
23074 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
23075 \anchor{ac up out}{\northeast\pgf@y=.4\pgf@y}
23076 \anchor{ac down out}{\northeast\pgf@y=-.4\pgf@y}
23077 }
23078 {\ctikzvalof{bipoles/sdcac/width}}
23079 {sdcac}
23080 {\ctikzvalof{bipoles/sdcac/width}}
23081 {\ctikzvalof{bipoles/sdcac/width}}
23082 {
23083 \pgfcirc@twoport@draw@splitline
23084 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
23085 \pgf@circ@twoport@converter@dc@up
23086 \pgf@circ@twoport@converter@ac@down
23087 \else
23088 \pgf@circ@twoport@converter@ac@up
23089 \pgf@circ@twoport@converter@dc@down
23090 \fi
23091 }
23092 %% single phase ac/ac converter
23093 \pgfcirc@define@twoports{blocks}
23094 {
23095 \anchor{ac up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
23096 \anchor{ac down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
23097 \anchor{ac up out}{\northeast\pgf@y=.4\pgf@y}
23098 \anchor{ac down out}{\northeast\pgf@y=-.4\pgf@y}
23099 }
23100 {\ctikzvalof{bipoles/sdcac/width}}
23101 {sacac}
23102 {\ctikzvalof{bipoles/sdcac/width}}
23103 {\ctikzvalof{bipoles/sdcac/width}}
23104 {
23105 \pgfcirc@twoport@draw@splitline
23106 \pgf@circ@twoport@converter@ac@up
23107 \pgf@circ@twoport@converter@ac@down
23108 }
23109 %% threephase ac/dc converter
23110 \pgfcirc@define@twoports{blocks}
23111 {
23112 % legacy, let for compatibility
23113 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y}
23114 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y}
23115 \anchor{ac1}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
23116 \anchor{ac2}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
23117 \anchor{ac3}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
23118 %better
23119 \anchor{dc up out}{\northeast\pgf@y=.4\pgf@y}
23120 \anchor{dc down out}{\northeast\pgf@y=-.4\pgf@y}
23121 \anchor{ac up in}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
23122 \anchor{ac mid in}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
23123 \anchor{ac down in}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
23124 }
23125 {\ctikzvalof{bipoles/tacdc/width}}
23126 {tacdc}
23127 {\ctikzvalof{bipoles/tacdc/width}}
23128 {\ctikzvalof{bipoles/tacdc/width}}
23129 {
23130 \pgfcirc@twoport@draw@splitline
23131 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
23132 \pgf@circ@twoport@converter@tac@up
23133 \pgf@circ@twoport@converter@dc@down
23134 \else
23135 \pgf@circ@twoport@converter@dc@up
23136 \pgf@circ@twoport@converter@tac@down
23137 \fi
23138 }
23139 %% threephase dc/ac converter
23140 \pgfcirc@define@twoports{blocks}
23141 {
23142 % legacy, let for compatibility
23143 \anchor{dc1}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
23144 \anchor{dc2}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
23145 \anchor{ac1}{\northeast\pgf@y=.6\pgf@y}
23146 \anchor{ac2}{\northeast\pgf@y=0\pgf@y}
23147 \anchor{ac3}{\northeast\pgf@y=-.6\pgf@y}
23148 %better
23149 \anchor{dc up in}{\northeast\pgf@y=.4\pgf@y\pgf@x=-\pgf@x}
23150 \anchor{dc down in}{\northeast\pgf@y=-.4\pgf@y\pgf@x=-\pgf@x}
23151 \anchor{ac up out}{\northeast\pgf@y=.6\pgf@y}
23152 \anchor{ac mid out}{\northeast\pgf@y=0\pgf@y}
23153 \anchor{ac down out}{\northeast\pgf@y=-.6\pgf@y}
23154 }
23155 {\ctikzvalof{bipoles/tdcac/width}}
23156 {tdcac}
23157 {\ctikzvalof{bipoles/tdcac/width}}
23158 {\ctikzvalof{bipoles/tdcac/width}}
23159 {
23160 \pgfcirc@twoport@draw@splitline
23161 \ifnum\@@rotation<145 % swap dc/ac for "backward" and "up" symbol
23162 \pgf@circ@twoport@converter@dc@up
23163 \pgf@circ@twoport@converter@tac@down
23164 \else
23165 \pgf@circ@twoport@converter@tac@up
23166 \pgf@circ@twoport@converter@dc@down
23167 \fi
23168 }
23169 %% threephase ac/ac converter
23170 \pgfcirc@define@twoports{blocks}
23171 {
23172 \anchor{ac up in}{\northeast\pgf@y=.6\pgf@y\pgf@x=-\pgf@x}
23173 \anchor{ac mid in}{\northeast\pgf@y=0\pgf@y\pgf@x=-\pgf@x}
23174 \anchor{ac down in}{\northeast\pgf@y=-.6\pgf@y\pgf@x=-\pgf@x}
23175 \anchor{ac up out}{\northeast\pgf@y=.6\pgf@y}
23176 \anchor{ac mid out}{\northeast\pgf@y=0\pgf@y}
23177 \anchor{ac down out}{\northeast\pgf@y=-.6\pgf@y}
23178 }
23179 {\ctikzvalof{bipoles/tdcac/width}}
23180 {tacac}
23181 {\ctikzvalof{bipoles/tdcac/width}}
23182 {\ctikzvalof{bipoles/tdcac/width}}
23183 {
23184 \pgfcirc@twoport@draw@splitline
23185 \pgf@circ@twoport@converter@tac@down
23186 \pgf@circ@twoport@converter@tac@up
23187 }
23188 %%%% Non-square blocks. We do not use the standard macros
23189 %%%% this one is adapted to do the boxed thing
23190 %
23191 \long\def\pgfcirc@define@twoports@boxed#1#2#3#4#5#6#7{
23192 \pgfcircdeclarebipolescaled{#1}
23193 {
23194 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23195 \pgcirc@twoport@additional@anchors
23196 #2
23197 }
23198 {#3}
23199 {#4}
23200 {#5}
23201 {#6}
23202 {
23203 \pgf@circ@res@step=#6\pgf@circ@scaled@Rlen %6 is the real width parameter
23204 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23205 \pgfsetarrows{-}
23206 \pgfcirc@twoport@maybedash
23207 % draw outer box
23208 \ifpgf@circuit@boxed
23209 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
23210 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
23211 \pgf@circ@draworfill
23212 \fi
23213 \pgf@circ@inputarrow
23214 \ifpgf@circuit@boxed
23215 \pgfsetlinewidth{\pgfstartlinewidth}
23216 % draw solid line for inner symbol if no box is drawn and not fully dashed
23217 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23218 \pgf@circ@res@step=.7\pgf@circ@res@step % scale amp symbol when inside a box
23219 \else
23220 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
23221 \fi
23222 #7
23223 }
23224 }
23225 %% voltage controled oscillator
23226 \pgfcirc@define@twoports@boxed{blocks}
23227 {}
23228 {\ctikzvalof{bipoles/vco/width}}
23229 {vco}
23230 {\ctikzvalof{bipoles/twoport/width}}
23231 {\ctikzvalof{bipoles/vco/width}}
23232 {
23233 % ok, this is a bit of incoherence
23234 \divide \pgf@circ@res@step by 2
23235 % draw circle
23236 \pgfscope
23237 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
23238 \pgfpathcircle{\pgfpoint{0}{0}} {\pgf@circ@res@step}
23239 \pgf@circ@draworfill
23240 \endpgfscope
23241 \pfgcirc@twoport@rotate@inner@symbol
23242 \pgfcirc@twoport@draw@sine{0}{0}
23243 }
23244 %% amplifier, iamplifier, and vamplifier
23245 %% Amplifier %% Beware, not using the generic twoport(s) macros.
23246 \pgfcirc@define@twoports@boxed{blocks}
23247 {
23248 \anchor{up}{%
23249 \northeast\pgf@x=0pt\relax
23250 \ifnum\componentisboxed=0
23251 \pgf@y=0.55\pgf@y
23252 \fi
23253 }
23254 \anchor{down}{%
23255 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
23256 \ifnum\componentisboxed=0
23257 \pgf@y=0.55\pgf@y
23258 \fi
23259 }
23260 }
23261 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23262 {amp}
23263 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23264 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23265 {
23266 % draw triangle
23267 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
23268 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
23269 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
23270 \pgfpathclose
23271 \pgf@circ@draworfill
23272 \pfgcirc@twoport@get@symbol@rotation
23273 % draw inner text
23274 \pgf@circ@text@strokecolor
23275 \ifnum\@@rotation=180
23276 \pgftransformrotate{180}
23277 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23278 \else
23279 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23280 \fi
23281 }
23282 %% Instrumentation amplifier %% Beware, not using the generic twoport(s) macros.
23283 \pgfcirc@define@twoports@boxed{blocks}
23284 {
23285 \anchor{up}{%
23286 \northeast\pgf@x=0pt\relax
23287 \ifnum\componentisboxed=0
23288 \pgf@y=0.75\pgf@y
23289 \fi
23290 }
23291 \anchor{down}{%
23292 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
23293 \ifnum\componentisboxed=0
23294 \pgf@y=0.75\pgf@y
23295 \fi
23296 }
23297 }
23298 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23299 {iamp}
23300 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23301 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23302 {
23303 % draw blunt triangle
23304 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
23305 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0.2\pgf@circ@res@step}}
23306 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
23307 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
23308 \pgfpathclose
23309 \pgf@circ@draworfill
23310 \pfgcirc@twoport@get@symbol@rotation
23311 % draw inner text
23312 \pgf@circ@text@strokecolor
23313 \ifnum\@@rotation=180
23314 \pgftransformrotate{180}
23315 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23316 \else
23317 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23318 \fi
23319 }
23320 %% variable amplifier %% Beware, not using the generic twoport(s) macros.
23321 \pgfcirc@define@twoports@boxed{blocks}
23322 {
23323 \anchor{up}{%
23324 \northeast\pgf@x=0pt\relax
23325 \ifnum\componentisboxed=0
23326 \pgf@y=0.55\pgf@y
23327 \fi
23328 }
23329 \anchor{down}{%
23330 \northeast\pgf@x=0pt\pgf@y=-\pgf@y\relax
23331 \ifnum\componentisboxed=0
23332 \pgf@y=0.55\pgf@y
23333 \fi
23334 }
23335 }
23336 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23337 {vamp}
23338 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23339 {\ifpgf@circuit@boxed\ctikzvalof{bipoles/twoport/width}\else\ctikzvalof{bipoles/amp/width}\fi}
23340 {
23341 % draw triangle
23342 \pgfpathmoveto{\pgfpoint{-0.5\pgf@circ@res@step}{0.55\pgf@circ@res@step}}
23343 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@step}{0}}
23344 \pgfpathlineto{\pgfpoint{-0.5\pgf@circ@res@step}{-0.55\pgf@circ@res@step}}
23345 \pgfpathclose
23346 \pgf@circ@draworfill
23347 \pfgcirc@twoport@get@symbol@rotation
23348 % draw arrow
23349 \pgfsetlinewidth{\pgfstartlinewidth}
23350 \pgfcirc@set@arrows{tunable}{}{latex}
23351 \pgfpathmoveto{\pgfpoint{-0.8\pgf@circ@res@step}{-0.5\pgf@circ@res@step}}
23352 \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@step}{0.6\pgf@circ@res@step}}
23353 \pgfusepath{draw}
23354 % draw inner text
23355 \pgf@circ@text@strokecolor
23356 \ifnum\@@rotation=180
23357 \pgftransformrotate{180}
23358 \pgftext[center,x=0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23359 \else
23360 \pgftext[center,x=-0.12\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
23361 \fi
23362 }
23363
23364 %% optical fiber
23365 \pgfcirc@define@twoports@norotate{blocks}
23366 {}
23367 {\ctikzvalof{bipoles/fiber/width}}
23368 {fiber}
23369 {\ctikzvalof{bipoles/fiber/width}}
23370 {\ctikzvalof{bipoles/fiber/width}}
23371 {
23372 \pgfpathcircle{\pgfpoint{0.2\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
23373 \pgfpathcircle{\pgfpoint{0\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
23374 \pgfpathcircle{\pgfpoint{-0.2\pgf@circ@res@left}{0.4\pgf@circ@res@up}}{0.4\pgf@circ@res@up}
23375 \pgfusepath{draw}
23376 % always use basic line width for this
23377 \pgfsetlinewidth{\pgfstartlinewidth}
23378 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
23379 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
23380 \pgfusepath{draw}
23381 }
23382
23383 \pgfcirc@activate@bipole@simple{l}{fiber}
23384 %
23385 % %>>>
23386
23387 %% Path definitions for Blocks%<<<
23388
23389 \pgfcirc@activate@bipole@simple{l}{twoport}
23390 \pgfcirc@activate@bipole@simple{l}{twoportsplit}
23391 \pgfcirc@activate@bipole@simple{l}{vco}
23392 \pgfcirc@activate@bipole@simple{l}{bandpass}
23393 \pgfcirc@activate@bipole@simple{l}{bandstop}
23394 \pgfcirc@activate@bipole@simple{l}{highpass}
23395 \pgfcirc@activate@bipole@simple{l}{highpass2}
23396 \pgfcirc@activate@bipole@simple{l}{lowpass}
23397 \pgfcirc@activate@bipole@simple{l}{lowpass2}
23398 \pgfcirc@activate@bipole@simple{l}{allpass}
23399 \pgfcirc@activate@bipole@simple{l}{vallpass}
23400 \pgfcirc@activate@bipole@simple{l}{bgenerator}
23401 \pgfcirc@activate@bipole@simple{l}{qgenerator}
23402 \pgfcirc@activate@bipole@simple{l}{cgenerator}
23403 \pgfcirc@activate@bipole@simple{l}{ngenerator}
23404 \pgfcirc@activate@bipole@simple{l}{adc}
23405 \pgfcirc@activate@bipole@simple{l}{dac}
23406 \pgfcirc@activate@bipole@simple{l}{dsp}
23407 \pgfcirc@activate@bipole@simple{l}{fft}
23408 \pgfcirc@activate@bipole@simple{l}{amp}
23409 \pgfcirc@activate@bipole@simple{l}{iamp}
23410 \pgfcirc@activate@bipole@simple{l}{vamp}
23411 \pgfcirc@activate@bipole@simple{l}{piattenuator}
23412 \pgfcirc@activate@bipole@simple{l}{vpiattenuator}
23413 \pgfcirc@activate@bipole@simple{l}{tattenuator}
23414 \pgfcirc@activate@bipole@simple{l}{vtattenuator}
23415 \pgfcirc@activate@bipole@simple{l}{phaseshifter}
23416 \pgfcirc@activate@bipole@simple{l}{vphaseshifter}
23417 \pgfcirc@activate@bipole@simple{l}{biast}
23418 \pgfcirc@activate@bipole@simple{l}{sinetable}
23419 \pgfcirc@activate@bipole@simple{l}{register}
23420 \pgfcirc@activate@bipole@simple{l}{detector}
23421 \pgfcirc@activate@bipole@simple{l}{saturation}
23422 \pgfcirc@activate@bipole@simple{l}{sigmoid}
23423 \pgfcirc@activate@bipole@simple{l}{allornothing}
23424 \pgfcirc@activate@bipole@simple{l}{camera}
23425 \pgfcirc@activate@bipole@simple{l}{tvset}
23426 \pgfcirc@activate@bipole@simple{l}{trx}
23427 \pgfcirc@activate@bipole@simple{l}{swr}
23428 \pgfcirc@activate@bipole@simple{l}{power}
23429 \pgfcirc@activate@bipole@simple{l}{fiber}
23430 \pgfcirc@activate@bipole@simple{l}{sacdc}
23431 \pgfcirc@activate@bipole@simple{l}{sdcac}
23432 \pgfcirc@activate@bipole@simple{l}{sdcdc}
23433 \pgfcirc@activate@bipole@simple{l}{sacac}
23434 \pgfcirc@activate@bipole@simple{l}{tacdc}
23435 \pgfcirc@activate@bipole@simple{l}{tdcac}
23436 \pgfcirc@activate@bipole@simple{l}{tacac}
23437 % %>>>
23438
23439 %% Node shapes for Block elements %<<<
23440 %
23441 % utility macro for the anchors
23442 \def\pgf@circ@circular@rf@anchors#1{%
23443 \savedanchor\northwest{
23444 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23445 \ifpgf@circuit@boxed
23446 \pgf@y=\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
23447 \pgf@y=.5\pgf@y
23448 \pgf@x=-\ctikzvalof{bipoles/twoport/width}\pgf@circ@scaled@Rlen
23449 \pgf@x=.5\pgf@x
23450 \else
23451 \pgf@y=\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
23452 \pgf@y=.5\pgf@y
23453 \pgf@x=-\ctikzvalof{tripoles/#1/width}\pgf@circ@scaled@Rlen
23454 \pgf@x=.5\pgf@x
23455 \fi
23456 }
23457 % border anchors
23458 \anchorborder{
23459 \pgf@circ@res@left=\pgf@x
23460 \pgf@circ@res@up=\pgf@y
23461 \ifnum\componentisboxed=0
23462 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
23463 }{\pgfpoint{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}}
23464 \else
23465 \pgfpointborderrectangle{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}
23466 }{\pgfpoint{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}{\ctikzvalof{tripoles/#1/width}*\scaledRlen/2}}
23467 \fi
23468 }
23469 \pgfcirc@northwest@symmetric@geoanchors
23470 \anchor{geocenter}{\pgfpointorigin}
23471 \anchor{up}{\northwest\pgf@x=0pt}
23472 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23473 % Deprecated number anchors
23474 \anchor{1}{\northwest\pgf@y=0pt}
23475 \anchor{2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
23476 \anchor{3}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23477 \anchor{4}{\northwest\pgf@y=\pgf@y\pgf@x=0pt}
23478 % input output anchors (also quite bad)
23479 \anchor{in 1}{\northwest\pgf@y=0pt}
23480 \anchor{in1}{\northwest\pgf@y=0pt}
23481 \anchor{in}{\northwest\pgf@y=0pt}
23482 \anchor{in 2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
23483 \anchor{in2}{\northwest\pgf@y=-\pgf@y\pgf@x=0pt}
23484 \anchor{out}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23485 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23486 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23487 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23488 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23489 \anchor{text}{\northwest
23490 \advance\pgf@y\dimexpr-.5\dp\pgfnodeparttextbox+.5\ht\pgfnodeparttextbox\relax
23491 \pgf@x=-.5\wd\pgfnodeparttextbox\relax}
23492 }
23493 % draw the body rectangle and circle if and when needed
23494 \def\pgf@circ@circular@rf@box@circle{%
23495 \pgfstartlinewidth=\pgflinewidth
23496 % draw outer box
23497 \ifpgf@circuit@boxed
23498 \pgfnode{blockbox}{center}{}{pgf@box}{\pgfusepath{draw}}
23499 \fi
23500 % draw outer circle
23501 \ifpgf@circuit@boxed
23502 \pgf@circ@res@step=.7\pgf@circ@res@step
23503 % draw solid line for inner symbol if no box is drawn and not fully dashed
23504 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23505 \else
23506 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
23507 \fi
23508 \ifpgf@circuit@boxedcircled
23509 \pgfpathcircle{\pgfpoint{0}{0}} {0.5\pgf@circ@res@step}
23510 \fi
23511 \pgf@circ@draworfill
23512 }
23513 %
23514 \pgfdeclareshape{mixer}
23515 {
23516 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23517 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23518 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23519 % build the anchor set
23520 \anchor{center}{\pgfpointorigin}
23521 \pgf@circ@circular@rf@anchors{mixer}
23522 \pgf@circ@draw@component{
23523 \pgf@circ@setcolor
23524 \pgf@circ@scaled@Rlen=\scaledRlen
23525 \pgf@circ@res@step=\ctikzvalof{tripoles/mixer/width}\pgf@circ@scaled@Rlen
23526 \pgfscope
23527 \pgf@circ@circular@rf@box@circle
23528 % draw inner stuff
23529 % draw solid line for inner symbol if no box is drawn and not fully dashed
23530 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23531 \pgfsetlinewidth{\pgfstartlinewidth}
23532 \pgfpathmoveto{\pgfpointorigin}
23533 \pgfpathmoveto{\pgfpointpolar{135}{0.5\pgf@circ@res@step}}
23534 \pgfpathlineto{\pgfpointpolar{-45}{0.5\pgf@circ@res@step}}
23535 \pgfpathmoveto{\pgfpointorigin}
23536 \pgfpathmoveto{\pgfpointpolar{45}{0.5\pgf@circ@res@step}}
23537 \pgfpathlineto{\pgfpointpolar{-135}{0.5\pgf@circ@res@step}}
23538 \pgfusepath{draw}
23539 \endpgfscope
23540 }
23541 }
23542
23543 \pgfdeclareshape{adder}
23544 {
23545 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23546 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23547 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23548 % build the anchor set
23549 \anchor{center}{\pgfpointorigin}
23550 \pgf@circ@circular@rf@anchors{adder}
23551 \pgf@circ@draw@component{
23552 \pgf@circ@setcolor
23553 \pgf@circ@scaled@Rlen=\scaledRlen
23554 \pgf@circ@res@step=\ctikzvalof{tripoles/adder/width}\pgf@circ@scaled@Rlen
23555 \pgfscope
23556 \pgf@circ@circular@rf@box@circle
23557 % draw inner stuff
23558 % draw solid line for inner symbol if no box is drawn and not fully dashed
23559 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23560 \pgfsetlinewidth{\pgfstartlinewidth}
23561 \pgfpathmoveto{\pgfpointorigin}
23562 \pgfpathmoveto{\pgfpointpolar{0}{0.3\pgf@circ@res@step}}
23563 \pgfpathlineto{\pgfpointpolar{180}{0.3\pgf@circ@res@step}}
23564 \pgfpathmoveto{\pgfpointorigin}
23565 \pgfpathmoveto{\pgfpointpolar{90}{0.3\pgf@circ@res@step}}
23566 \pgfpathlineto{\pgfpointpolar{270}{0.3\pgf@circ@res@step}}
23567 \pgf@circ@setlinewidth{tripoles}{\pgflinewidth}
23568 \pgfusepath{draw}
23569 \endpgfscope
23570 }
23571 }
23572
23573 \pgfdeclareshape{oscillator}
23574 {
23575 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23576 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23577 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23578 % build the anchor set --- the center of an oscillator is on the right
23579 \anchor{center}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23580 \pgf@circ@circular@rf@anchors{oscillator}
23581 % border anchors
23582 \anchor{text}{
23583 \pgf@x=-2\pgf@x
23584 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
23585 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
23586 }
23587 \pgf@circ@draw@component{
23588 \pgf@circ@setcolor
23589 \pgf@circ@scaled@Rlen=\scaledRlen
23590 \pgf@circ@res@step=\ctikzvalof{tripoles/oscillator/width}\pgf@circ@scaled@Rlen{}
23591 \pgfscope
23592 \pgf@circ@circular@rf@box@circle
23593 % draw inner sine waves
23594 % draw solid line for inner symbol if no box is drawn and not fully dashed
23595 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23596 \pgfsetlinewidth{\pgfstartlinewidth}
23597 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
23598 \pgfpathmoveto{\pgfpoint{-0.3\pgf@circ@res@step}{0\pgf@circ@res@step}}
23599 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
23600 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
23601 \pgfpathsine{\pgfpoint{.15\pgf@circ@res@step}{-.15\pgf@circ@res@step}}
23602 \pgfpathcosine{\pgfpoint{.15\pgf@circ@res@step}{.15\pgf@circ@res@step}}
23603 \pgfusepath{draw}
23604 \endpgfscope
23605 }
23606 }
23607
23608 \pgfdeclareshape{circulator}
23609 {
23610 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23611 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23612 \savedmacro{\componentisboxed}{\edef\componentisboxed{\ifpgf@circuit@boxed 1\else 0\fi}}
23613 % build the anchor set
23614 \anchor{center}{\pgfpointorigin}
23615 \pgf@circ@circular@rf@anchors{circulator}
23616 \pgf@circ@draw@component{
23617 \pgf@circ@setcolor
23618 \pgf@circ@scaled@Rlen=\scaledRlen
23619 \pgf@circ@res@step=\ctikzvalof{tripoles/circulator/width}\pgf@circ@scaled@Rlen
23620 \pgfscope
23621 \pgf@circ@circular@rf@box@circle
23622 % inner arrow
23623 % draw solid line for inner symbol if no box is drawn and not fully dashed
23624 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
23625 \pgfsetlinewidth{\pgfstartlinewidth}
23626 \pgfsetarrowsend{latex}
23627 \pgfpathmoveto{\pgfpoint{-0.25\pgf@circ@res@step}{0}}
23628 \pgfpatharc{180}{-90} {0.25\pgf@circ@res@step}
23629 \pgfpathlineto{\pgfpoint{-5pt}{-0.2\pgf@circ@res@step}}
23630 \pgfusepath{draw}
23631 \endpgfscope
23632 }
23633 }
23634
23635 %% gridnode
23636 \pgfdeclareshape{gridnode}
23637 {
23638 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23639 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23640 \savedanchor\northwest{
23641 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23642 \pgf@y=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
23643 \pgf@y=.5\pgf@y
23644 \pgf@x=-\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
23645 \pgf@x=.5\pgf@x
23646 }
23647 \pgfcirc@northwest@symmetric@geoanchors
23648 \anchor{center}{\pgfpointorigin}
23649 \anchor{up}{\northwest\pgf@x=0pt}
23650 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23651 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23652 \anchor{left}{\northwest\pgf@y=0pt}
23653 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23654 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23655 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23656 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23657 \anchor{text}{
23658 \pgf@x=-2\pgf@x
23659 \advance \pgf@x by -.5\wd\pgfnodeparttextbox
23660 \advance \pgf@y by -1.5\ht\pgfnodeparttextbox
23661 }
23662 \pgf@circ@draw@component{
23663 \pgf@circ@setcolor
23664 \pgf@circ@scaled@Rlen=\scaledRlen
23665 \pgf@circ@res@step=\ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
23666 \northwest
23667 \pgf@circ@res@up = \pgf@y
23668 \pgf@circ@res@down = -\pgf@y
23669 \pgf@circ@res@right = -\pgf@x
23670 \pgf@circ@res@left = \pgf@x
23671 \pgf@circ@res@step = \ctikzvalof{quadpoles/gridnode/width}\pgf@circ@scaled@Rlen
23672 \divide \pgf@circ@res@step by 2
23673 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
23674 \pgf@circ@res@other = \pgf@circ@res@left
23675 \advance\pgf@circ@res@other by \pgf@circ@res@step
23676 \pgfcirc@twoport@maybedash
23677 % draw outer box
23678 \pgf@circ@twoportbox
23679 \pgf@circ@inputarrow
23680 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23681 \pgfsetarrows{-} %never draw arrows
23682 \pgfsetlinewidth{0.05mm}
23683 % draw grid
23684 \foreach \line in {-1,-.5,...,1}
23685 {
23686 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
23687 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@up}}
23688 %
23689 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@up}}
23690 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@down}}
23691 }
23692 %prevent from draw the inner cross twice
23693 \foreach \line in {-.5,0,...,.5}
23694 {
23695 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
23696 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\line\pgf@circ@res@up}}
23697 %
23698 \pgfpathmoveto{\pgfpoint{\line\pgf@circ@res@right}{\pgf@circ@res@down}}
23699 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\line\pgf@circ@res@down}}
23700 }
23701 \pgfusepath{draw}
23702 }
23703 }
23704
23705
23706 % Wilkinson divider
23707 \pgfdeclareshape{wilkinson}{
23708 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23709 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23710 \savedanchor\northwest{%
23711 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23712 \pgf@y=\ctikzvalof{tripoles/wilkinson/height}\pgf@circ@scaled@Rlen
23713 \pgf@y=.5\pgf@y
23714 \pgf@x= \pgf@circ@scaled@Rlen
23715 \pgf@x=.5\pgf@x
23716 \pgf@x=-\ctikzvalof{tripoles/wilkinson/width}\pgf@x
23717 }
23718 \pgfcirc@northwest@symmetric@geoanchors
23719 \anchor{up}{\northwest\pgf@x=0pt}
23720 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23721 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23722 \anchor{left}{\northwest\pgf@y=0pt}
23723 \anchor{center}{\pgfpointorigin}
23724 \anchor{in}{\northwest\pgf@y=0pt}
23725 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23726 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23727 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23728 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23729 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23730 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23731 \anchor{text}{
23732 \northwest
23733 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
23734 \pgf@x=-.5\wd\pgfnodeparttextbox
23735 }
23736 \pgf@circ@draw@component{
23737 \pgf@circ@setcolor
23738 \pgf@circ@scaled@Rlen=\scaledRlen
23739 %
23740 \northwest
23741 \pgf@circ@res@up = \pgf@y
23742 \pgf@circ@res@down = -\pgf@y
23743 \pgf@circ@res@right = -\pgf@x
23744 \pgf@circ@res@left = \pgf@x
23745 %
23746 \pgfstartlinewidth=\pgflinewidth
23747 % draw outer box
23748 \pgf@circ@twoportbox
23749 \pgf@circ@inputarrow
23750 % draw inner stuff
23751 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23752 \pgfsetarrows{-} %never draw arrows
23753 \pgfsetlinewidth{\pgfstartlinewidth}
23754 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
23755 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23756 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23757 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23758 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23759 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23760 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23761 \pgfusepath{draw}
23762 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23763 % draw inner resisitor - european or american style is recognised
23764 {
23765 \pgftransformshift{\pgfpoint{0.5\pgf@circ@res@right}{0pt}}
23766 \pgftransformrotate{90}
23767 % calculate size of resistor
23768 \ifpgf@circuit@europeanresistor
23769 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
23770 \pgftransformscale{\pgfmathresult}
23771 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
23772 \else
23773 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
23774 \pgftransformscale{\pgfmathresult}
23775 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
23776 \fi
23777 }
23778 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23779 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
23780 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
23781 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23782 \pgfusepath{draw}
23783 }
23784 }
23785
23786 %% resistive splitter
23787 \pgfdeclareshape{splitter}{
23788 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23789 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23790 \savedanchor\northwest{%
23791 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23792 \pgf@y=\ctikzvalof{tripoles/splitter/height}\pgf@circ@scaled@Rlen
23793 \pgf@y=.5\pgf@y
23794 \pgf@x= \pgf@circ@scaled@Rlen
23795 \pgf@x=.5\pgf@x
23796 \pgf@x=-\ctikzvalof{tripoles/splitter/width}\pgf@x
23797 }
23798 \pgfcirc@northwest@symmetric@geoanchors
23799 \anchor{center}{\pgfpointorigin}
23800 \anchor{up}{\northwest\pgf@x=0pt}
23801 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23802 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23803 \anchor{left}{\northwest\pgf@y=0pt}
23804 \anchor{in}{\northwest\pgf@y=0pt}
23805 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23806 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23807 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23808 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23809 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23810 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23811 \anchor{text}{
23812 \northwest
23813 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
23814 \pgf@x=-.5\wd\pgfnodeparttextbox
23815 }
23816 \pgf@circ@draw@component{
23817 \pgf@circ@setcolor
23818 \pgf@circ@scaled@Rlen=\scaledRlen
23819 %
23820 \northwest
23821 \pgf@circ@res@up = \pgf@y
23822 \pgf@circ@res@down = -\pgf@y
23823 \pgf@circ@res@right = -\pgf@x
23824 \pgf@circ@res@left = \pgf@x
23825 %
23826 \pgfstartlinewidth=\pgflinewidth
23827 % draw outer box
23828 \pgf@circ@twoportbox
23829 \pgf@circ@inputarrow
23830 % draw inner stuff
23831 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23832 \pgfsetarrows{-} %never draw arrows
23833 \pgfsetlinewidth{\pgfstartlinewidth}
23834 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
23835 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23836 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23837 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23838 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23839 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23840 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23841 \pgfusepath{draw}
23842 %
23843 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23844 % draw inner resisitors - european or american style is recognised
23845 \foreach \respt/\resang/\linepta/\lineptb in %
23846 { \pgfpoint{0.5\pgf@circ@res@right}{0pt}/90/%
23847 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down},%
23848 \pgfpoint{0}{0.25\pgf@circ@res@up}/25/%
23849 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
23850 \pgfpoint{0}{0.25\pgf@circ@res@down}/-25/%
23851 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
23852 {
23853 {
23854 \pgftransformshift{\respt}
23855 \pgftransformrotate{\resang}
23856 % calculate size of resistor
23857 \ifpgf@circuit@europeanresistor
23858 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/generic/width} / 2}
23859 \pgftransformscale{\pgfmathresult}
23860 \pgfnode{genericshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
23861 \else
23862 \pgfmathparse{\pgf@circ@res@up / \pgf@circ@scaled@Rlen / \ctikzvalof{bipoles/resistor/width} / 2}
23863 \pgftransformscale{\pgfmathresult}
23864 \pgfnode{resistorshape}{center}{}{wilk@int@R}{\pgfusepath{fill}}
23865 \fi
23866 }
23867 \pgfpathmoveto{\linepta}
23868 \pgfpathlineto{\pgfpointanchor{wilk@int@R}{right}}
23869 \pgfpathmoveto{\pgfpointanchor{wilk@int@R}{left}}
23870 \pgfpathlineto{\lineptb}
23871 \pgfusepath{draw}
23872 }
23873 }
23874 }
23875
23876 %% generic splitter
23877 \pgfdeclareshape{genericsplitter}{
23878 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23879 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23880 \savedanchor\northwest{%
23881 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23882 \pgf@y=\ctikzvalof{tripoles/genericsplitter/height}\pgf@circ@scaled@Rlen
23883 \pgf@y=.5\pgf@y
23884 \pgf@x= \pgf@circ@scaled@Rlen
23885 \pgf@x=.5\pgf@x
23886 \pgf@x=-\ctikzvalof{tripoles/genericsplitter/width}\pgf@x
23887 }
23888 \pgfcirc@northwest@symmetric@geoanchors
23889 \anchor{center}{\pgfpointorigin}
23890 \anchor{up}{\northwest\pgf@x=0pt}
23891 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23892 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23893 \anchor{left}{\northwest\pgf@y=0pt}
23894 \anchor{in}{\northwest\pgf@y=0pt}
23895 \anchor{out1}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23896 \anchor{out2}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23897 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23898 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23899 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23900 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23901 \anchor{text}{
23902 \northwest
23903 \pgf@y=-.5\ht\pgfnodeparttextbox
23904 \pgf@x=-.2\wd\pgfnodeparttextbox
23905 }
23906 \pgf@circ@draw@component{
23907 \pgf@circ@setcolor
23908 \pgf@circ@scaled@Rlen=\scaledRlen
23909 %
23910 \northwest
23911 \pgf@circ@res@up = \pgf@y
23912 \pgf@circ@res@down = -\pgf@y
23913 \pgf@circ@res@right = -\pgf@x
23914 \pgf@circ@res@left = \pgf@x
23915 %
23916 \pgfstartlinewidth=\pgflinewidth
23917 % draw outer box
23918 \pgf@circ@twoportbox
23919 \pgf@circ@inputarrow
23920 % draw inner stuff
23921 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23922 \pgfsetarrows{-} %never draw arrows
23923 \pgfsetlinewidth{\pgfstartlinewidth}
23924 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
23925 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23926 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23927 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
23928 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@left}{0pt}}
23929 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23930 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
23931 \pgfusepath{draw}
23932 %
23933 \pgfsetdash{}{0pt} % always draw solid line for inner symbol
23934 % draw inner resisitors - european or american style is recognised
23935 \foreach \linepta/\lineptb in %
23936 { \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@up}/\pgfpoint{0.5\pgf@circ@res@left}{0},%
23937 \pgfpoint{0.5\pgf@circ@res@right}{0.5\pgf@circ@res@down}/\pgfpoint{0.5\pgf@circ@res@left}{0}}
23938 {
23939 \pgfpathmoveto{\linepta}
23940 \pgfpathlineto{\lineptb}
23941 \pgfusepath{draw}
23942 }
23943 }
23944 }
23945
23946 %% couplers generics
23947 \long\def\pgfcircdeclarefourport#1#2{
23948 \pgfdeclareshape{#1}{
23949 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
23950 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
23951 \savedanchor\northwest{%
23952 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
23953 \pgf@y=\ctikzvalof{quadpoles/#1/height}\pgf@circ@scaled@Rlen
23954 \pgf@y=.5\pgf@y
23955 \pgf@x=.5\pgf@circ@scaled@Rlen
23956 \pgf@x=-\ctikzvalof{quadpoles/#1/width}\pgf@x
23957 }
23958 \pgfcirc@northwest@symmetric@geoanchors
23959 \anchor{center}{\pgfpointorigin}
23960 \anchor{up}{\northwest\pgf@x=0pt}
23961 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
23962 \anchor{right}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
23963 \anchor{left}{\northwest\pgf@y=0pt}
23964 \anchor{port1}{\northwest\pgf@y=-0.5\pgf@y}
23965 \anchor{port2}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23966 \anchor{port3}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23967 \anchor{port4}{\northwest\pgf@y=0.5\pgf@y}
23968 \anchor{left down}{\northwest\pgf@y=-0.5\pgf@y}
23969 \anchor{right down}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23970 \anchor{right up}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23971 \anchor{left up}{\northwest\pgf@y=0.5\pgf@y}
23972 %1,2,3,4 are deprecated
23973 \anchor{1}{\northwest\pgf@y=-0.5\pgf@y}
23974 \anchor{2}{\northwest\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
23975 \anchor{3}{\northwest\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
23976 \anchor{4}{\northwest\pgf@y=0.5\pgf@y}
23977 \anchor{text}{
23978 \northwest
23979 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
23980 \pgf@x=-.5\wd\pgfnodeparttextbox
23981 }
23982 \pgf@circ@draw@component{
23983 \pgf@circ@setcolor
23984 \northwest
23985 \pgf@circ@res@up = \pgf@y
23986 \pgf@circ@res@down = -\pgf@y
23987 \pgf@circ@res@right = -\pgf@x
23988 \pgf@circ@res@left = \pgf@x
23989 \pgf@circ@scaled@Rlen=\scaledRlen
23990 %
23991 \pgfstartlinewidth=\pgflinewidth
23992 % draw outer box
23993 \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
23994 \pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
23995 \pgf@circ@draworfill
23996 % draw inner stuff
23997 #2%
23998 % draw inner text
23999 \pgf@circ@text@strokecolor
24000 \pgftext[center,x=-0.15\pgf@circ@res@step,y=0]{\ctikzvalof{bipoles/twoport/text}}
24001 }
24002 }
24003 }
24004
24005 % four-port
24006 \pgfcircdeclarefourport{fourport}{}
24007
24008 % straight coupler
24009 \pgfcircdeclarefourport{coupler}{
24010 \pgfsetlinewidth{\pgfstartlinewidth}
24011 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
24012 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
24013 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
24014 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
24015 \pgfusepath{draw}
24016
24017 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
24018 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
24019 \pgfsetarrows{latex-latex}
24020 \pgfusepath{draw}
24021 \pgfpathmoveto{\pgfpoint{0.7\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
24022 \pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
24023 \pgfsetarrows{latex-latex}
24024 \pgfusepath{draw}
24025 }
24026
24027 % "bended" coupler
24028 \pgfcircdeclarefourport{coupler2}{
24029 \pgfsetlinewidth{\pgfstartlinewidth}
24030 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@up}}
24031 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@up}}
24032 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
24033 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
24034 \pgfusepath{draw}
24035
24036 \pgfscope
24037 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
24038 \pgfpatharc{0}{90} {0.4\pgf@circ@res@up}
24039 \pgfsetarrowsend{latex}
24040 \pgfusepath{draw}
24041 \endpgfscope
24042 \pgfscope
24043 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@left}{0pt}}
24044 \pgfpatharc{0}{-90} {0.4\pgf@circ@res@up}
24045 \pgfsetarrowsend{latex}
24046 \pgfusepath{draw}
24047 \endpgfscope
24048 \pgfscope
24049 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
24050 \pgfpatharc{180}{90} {0.4\pgf@circ@res@up}
24051 \pgfsetarrowsend{latex}
24052 \pgfusepath{draw}
24053 \endpgfscope
24054 \pgfscope
24055 \pgfpathmoveto{\pgfpoint{0.1\pgf@circ@res@right}{0pt}}
24056 \pgfpatharc{-180}{-90} {0.4\pgf@circ@res@up}
24057 \pgfsetarrowsend{latex}
24058 \pgfusepath{draw}
24059 \endpgfscope
24060 }
24061
24062 % mach zehnder modulator
24063 \pgfdeclareshape{mzm}{
24064 \savedmacro{\ctikzclass}{\edef\ctikzclass{blocks}}
24065 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
24066 \savedanchor\northwest{%
24067 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24068 \pgf@y=\ctikzvalof{tripoles/mzm/height}\pgf@circ@scaled@Rlen
24069 \pgf@y=.5\pgf@y
24070 \pgf@x= \pgf@circ@scaled@Rlen
24071 \pgf@x=.5\pgf@x
24072 \pgf@x=-\ctikzvalof{tripoles/mzm/width}\pgf@x
24073 }
24074 \pgfcirc@northwest@symmetric@geoanchors
24075 \anchor{center}{\pgfpointorigin}
24076 \anchor{in}{ \northwest \pgf@y=0pt }
24077 \anchor{mod}{ \northwest \pgf@x=0pt }
24078 \anchor{out}{ \northwest \pgf@x=-\pgf@x \pgf@y=0pt }
24079 \anchor{text}{
24080 \northwest
24081 \advance \pgf@y by 0.5\ht\pgfnodeparttextbox
24082 \pgf@x=-.5\wd\pgfnodeparttextbox
24083 }
24084 \pgf@circ@draw@component{
24085 \pgf@circ@setcolor
24086 \pgf@circ@scaled@Rlen=\scaledRlen
24087 \northwest
24088 \pgf@circ@res@up = \pgf@y
24089 \pgf@circ@res@down = -\pgf@y
24090 \pgf@circ@res@right = -\pgf@x
24091 \pgf@circ@res@left = \pgf@x
24092 \pgfstartlinewidth=\pgflinewidth
24093 % draw outer box
24094 \pgf@circ@twoportbox
24095 \pgf@circ@inputarrow
24096 % draw inner stuff
24097 \pfgcirc@twoport@rotate@inner@symbol
24098 % draw inner symbol
24099 \ifpgf@circuit@full@dashed\else\pgfsetdash{}{0pt}\fi
24100 \pgfsetarrows{-} %never draw arrows
24101 \pgfsetlinewidth{\pgfstartlinewidth}
24102 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
24103 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
24104 %
24105 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
24106 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
24107 %
24108 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@left}{\pgf@circ@res@zero}}
24109 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
24110 %
24111 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@zero}}
24112 \pgfpathlineto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
24113 %
24114 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
24115 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
24116 %
24117 \pgfpathmoveto{\pgfpoint{0.75\pgf@circ@res@right}{\pgf@circ@res@zero}}
24118 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
24119 %
24120 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@up}}
24121 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@up}}
24122 %
24123 \pgfpathmoveto{\pgfpoint{0.5\pgf@circ@res@right}{0.25\pgf@circ@res@down}}
24124 \pgfpathlineto{\pgfpoint{0.5\pgf@circ@res@left}{0.25\pgf@circ@res@down}}
24125 %
24126 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@zero}{\pgf@circ@res@up}}
24127 \pgfpathlineto{\pgfpoint{\pgf@circ@res@zero}{0.35\pgf@circ@res@up}}
24128 \pgfpathlineto{\pgfpoint{0.25\pgf@circ@res@right}{0.1\pgf@circ@res@up}}
24129 \pgfusepath{draw}
24130 }
24131 }
24132 % %>>>
24133
24134 % vim: set fdm=marker fmr=%<<<,%>>>:
24135 %%%---------- close: tex/pgfcircquadpoles
24136 %%%%%%%%%%% Springe nach tex/pgfcircmultipoles
24137 %%%---------- open: tex/pgfcircmultipoles.tex
24138 % Copyright 2018-2026 by Romano Giannetti
24139 % Copyright 2015-2026 by Stefan Lindner
24140 % Copyright 2013-2026 by Stefan Erhardt
24141 % Copyright 2007-2026 by Massimo Redaelli
24142 %
24143 % This file may be distributed and/or modified
24144 %
24145 % 1. under the LaTeX Project Public License and/or
24146 % 2. under the GNU Public License.
24147 %
24148 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
24149
24150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24151 %% Chips and Rotary Switches
24152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24153
24154 % Definitions for Chips and Rotary switches (multipoles) %<<<1
24155 %
24156 \ctikzset{multipoles/thickness/.initial=2}
24157 \ctikzset{multipoles/font/.initial=\pgf@circ@font@tiny}
24158 \ctikzset{multipoles/draw only pins/.initial={all}}
24159 \ctikzset{multipoles/draw only left pins/.initial={all}}
24160 \ctikzset{multipoles/draw only right pins/.initial={all}}
24161 \ctikzset{multipoles/draw only top pins/.initial={all}}
24162 \ctikzset{multipoles/draw only bottom pins/.initial={all}}
24163 \pgfqkeys{/tikz}{draw only pins/.add code={}{\ctikzset{multipoles/draw only pins={#1}}}}
24164 \pgfqkeys{/tikz}{draw only left pins/.add code={}{\ctikzset{multipoles/draw only left pins={#1}}}}
24165 \pgfqkeys{/tikz}{draw only right pins/.add code={}{\ctikzset{multipoles/draw only right pins={#1}}}}
24166 \pgfqkeys{/tikz}{draw only top pins/.add code={}{\ctikzset{multipoles/draw only top pins={#1}}}}
24167 \pgfqkeys{/tikz}{draw only bottom pins/.add code={}{\ctikzset{multipoles/draw only bottom pins={#1}}}}
24168 % DIP (dual in line package) chips
24169 \ctikzset{multipoles/dipchip/width/.initial=1.2}
24170 \ctikzset{multipoles/dipchip/num pins/.initial=8}
24171 \ctikzset{multipoles/dipchip/pin spacing/.initial=0.4}
24172 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/dipchip/num pins=#1}}}
24173 % QFP (quad flat package) chips
24174 \ctikzset{multipoles/qfpchip/num pins/.initial=8}
24175 \ctikzset{multipoles/qfpchip/pin spacing/.initial=0.4}
24176 \pgfkeys{/tikz/num pins/.add code={}{\ctikzset{multipoles/qfpchip/num pins=#1}}}
24177 % chip numbers
24178 \newif\ifpgf@circuit@chip@shownumbers\pgf@circuit@chip@shownumberstrue
24179 \pgfkeys{/tikz/show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
24180 \ctikzset{show numbers/.add code={}{\pgf@circuit@chip@shownumberstrue}}
24181 \pgfkeys{/tikz/hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
24182 \ctikzset{hide numbers/.add code={}{\pgf@circuit@chip@shownumbersfalse}}
24183 \newif\ifpgf@circuit@chip@straightnumbers\pgf@circuit@chip@straightnumberstrue
24184 \pgfkeys{/tikz/straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
24185 \ctikzset{straight numbers/.add code={}{\pgf@circuit@chip@straightnumberstrue}}
24186 \pgfkeys{/tikz/rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
24187 \ctikzset{rotated numbers/.add code={}{\pgf@circuit@chip@straightnumbersfalse}}
24188 % external chip pins
24189 \ctikzset{multipoles/external pins thickness/.initial=1}
24190 \ctikzset{multipoles/external pins width/.initial=0.2}
24191 \ctikzset{multipoles/external pad fraction/.initial=0}
24192 \pgfkeys{/tikz/external pins width/.add code={}{\ctikzset{multipoles/external pins width=#1}}}
24193 \pgfkeys{/tikz/external pad fraction/.add code={}{\ctikzset{multipoles/external pad fraction=#1}}}
24194 % topmarks
24195 \newif\ifpgf@circuit@chip@topmark\pgf@circuit@chip@topmarktrue
24196 \pgfkeys{/tikz/topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
24197 \ctikzset{topmark/.add code={}{\pgf@circuit@chip@topmarktrue}}
24198 \pgfkeys{/tikz/no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
24199 \ctikzset{no topmark/.add code={}{\pgf@circuit@chip@topmarkfalse}}
24200
24201 % rotary switch by Romano
24202 \ctikzset{multipoles/rotary/thickness/.initial=1}
24203 \ctikzset{multipoles/rotary/shape/.initial=ocirc}
24204 \ctikzset{multipoles/rotary/channels/.initial=5}
24205 \ctikzset{multipoles/rotary/angle/.initial=60}
24206 \ctikzset{multipoles/rotary/wiper/.initial=20}
24207 \ctikzset{multipoles/rotary/arrow/.is choice}
24208 \newif\ifpgf@circ@rotaryarrow\pgf@circ@rotaryarrowfalse
24209 \newif\ifpgf@circ@rotaryarrow@cw\pgf@circ@rotaryarrow@cwfalse
24210 \newif\ifpgf@circ@rotaryarrow@ccw\pgf@circ@rotaryarrow@ccwfalse
24211 \ctikzset{multipoles/rotary/arrow/none/.code={\pgf@circ@rotaryarrowfalse\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwfalse}}
24212 \ctikzset{multipoles/rotary/arrow/both/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwtrue}}
24213 \ctikzset{multipoles/rotary/arrow/cw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwtrue\pgf@circ@rotaryarrow@ccwfalse}}
24214 \ctikzset{multipoles/rotary/arrow/ccw/.code={\pgf@circ@rotaryarrowtrue\pgf@circ@rotaryarrow@cwfalse\pgf@circ@rotaryarrow@ccwtrue}}
24215
24216 \tikzset{%
24217 rotary switch/.style args={#1in#2wiper#3}{%
24218 shape=rotaryswitch,
24219 /tikz/circuitikz/multipoles/rotary/channels=#1,
24220 /tikz/circuitikz/multipoles/rotary/angle=#2,
24221 /tikz/circuitikz/multipoles/rotary/wiper=#3,
24222 },
24223 rotary switch -/.style args={#1in#2wiper#3}{
24224 rotary switch=#1 in #2 wiper #3,
24225 /tikz/circuitikz/multipoles/rotary/arrow=none,
24226 },
24227 rotary switch <-/.style args={#1in#2wiper#3}{
24228 rotary switch=#1 in #2 wiper #3,
24229 /tikz/circuitikz/multipoles/rotary/arrow=ccw,
24230 },
24231 rotary switch ->/.style args={#1in#2wiper#3}{
24232 rotary switch=#1 in #2 wiper #3,
24233 /tikz/circuitikz/multipoles/rotary/arrow=cw,
24234 },
24235 rotary switch <->/.style args={#1in#2wiper#3}{
24236 rotary switch=#1 in #2 wiper #3,
24237 /tikz/circuitikz/multipoles/rotary/arrow=both,
24238 },
24239 % Notice that these should be the same as the initial values of the keys
24240 rotary switch/.default={5 in 60 wiper 20},
24241 rotary switch -/.default={5 in 60 wiper 20},
24242 rotary switch <-/.default={5 in 60 wiper 20},
24243 rotary switch ->/.default={5 in 60 wiper 20},
24244 rotary switch <->/.default={5 in 60 wiper 20},
24245 }
24246 %%>>>
24247
24248 %% Nodes definitions for chips%<<<
24249
24250 %%%%%%%%%
24251 %% Chips
24252 %%%%%%%%%
24253
24254 % let's use the same shifts everywhere, no magic numbers
24255 \def\pgf@circ@dip@pin@shift{0.5}
24256 \def\pgf@circ@qfp@pin@shift{0.25}
24257
24258 % derived from https://tex.stackexchange.com/a/146753/38080
24259 % original author Mark Wibrow
24260 % Thanks also to John Kormylo https://tex.stackexchange.com/a/372996/38080
24261 % a lot of thanks to @marmot for the un-rotation hint
24262 % https://tex.stackexchange.com/a/473571/38080
24263 % modifications for 'draw only pins' by Jonathan P. Spratte
24264
24265 % DIP (dual in line package) chips
24266
24267 % helper macro to set the anchors inside a loop (to expand the current count)
24268 \pgfutil@protected\def\pgf@circ@make@dippin@anchor#1%
24269 {%
24270 \expandafter\gdef\csname pgf@anchor@dipchip@pin #1\endcsname
24271 {%
24272 \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
24273 {\pgf@circ@dippinanchor{#1}{1}}
24274 {\pgf@circ@dippinanchor{#1}{0}}%
24275 }%
24276 \expandafter\gdef\csname pgf@anchor@dipchip@bpin #1\endcsname
24277 {\pgf@circ@dippinanchor{#1}{0}}%
24278 }
24279
24280 \pgfdeclareshape{dipchip}{
24281 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
24282 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
24283 \savedmacro\numpins{%
24284 \pgf@circ@count@a=\ctikzvalof{multipoles/dipchip/num pins}%
24285 \def\numpins{\the\pgf@circ@count@a}
24286 }
24287 \savedmacro\pgf@circ@pins@list
24288 {%
24289 \pgfkeysgetvalue
24290 {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
24291 \expandafter\pgf@circ@set@list
24292 \expandafter\pgf@circ@pins@list
24293 \expandafter{\pgf@circ@temp}%
24294 }%
24295 \savedanchor\centerpoint{%
24296 \pgf@x=-.5\wd\pgfnodeparttextbox%
24297 \pgf@y=-.5\ht\pgfnodeparttextbox%
24298 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
24299 }%
24300 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
24301 \anchor{center}{\origin}
24302 \anchor{text}{\centerpoint}% to adjust text
24303 \saveddimen\height{%
24304 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24305 \pgfmathsetlength\pgf@x{((\numpins)
24306 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
24307 }%
24308 \saveddimen{\chipspacing}{
24309 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24310 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/pin spacing}}}
24311 \saveddimen{\width}{
24312 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24313 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}}
24314 \saveddimen{\extshift}{
24315 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24316 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
24317 % standard anchors
24318 \savedanchor\northwest{%
24319 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24320 \pgfmathsetlength\pgf@y{0.5*((\numpins)
24321 *\ctikzvalof{multipoles/dipchip/pin spacing})*\pgf@circ@scaled@Rlen/2}%
24322 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/dipchip/width}}
24323 }
24324 \anchor{dot}{\northwest
24325 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
24326 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
24327 }
24328 \anchor{nw}{\northwest}
24329 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
24330 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
24331 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
24332 \anchor{north west}{\northwest}
24333 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
24334 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
24335 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
24336 \anchor{n}{\northwest\pgf@x=0pt }
24337 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24338 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24339 \anchor{w}{\northwest\pgf@y=0pt }
24340 \anchor{north}{\northwest\pgf@x=0pt }
24341 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24342 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24343 \anchor{west}{\northwest\pgf@y=0pt }
24344 % start drawing
24345 \pgf@circ@draw@component{%
24346 \northwest
24347 \pgf@circ@res@up = \pgf@y
24348 \pgf@circ@res@down = -\pgf@y
24349 \pgf@circ@res@right = -\pgf@x
24350 \pgf@circ@res@left = \pgf@x
24351 \pgf@circ@scaled@Rlen=\scaledRlen
24352 \pgf@circ@res@step = \ctikzvalof{multipoles/dipchip/pin spacing}\pgf@circ@scaled@Rlen
24353 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
24354 \pgfscope% (for the line width)
24355 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
24356 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
24357 \pgf@circ@draworfill
24358 %% upside mark
24359 \ifpgf@circuit@chip@topmark
24360 \pgfpathmoveto{\pgfpoint{0.2*\pgf@circ@res@left}{\pgf@circ@res@up}}
24361 \pgfpatharc{0}{180}{0.2*\pgf@circ@res@left}
24362 \fi
24363 \pgfusepath{stroke}%
24364 \pgf@circ@setcolor
24365 % Adding the pin number
24366 \ifpgf@circuit@chip@shownumbers
24367 \pgf@circ@count@a=\numpins\relax
24368 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
24369 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
24370 \ifpgf@circuit@chip@straightnumbers
24371 \pgfgettransformentries\a\b\temp\temp\temp\temp
24372 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
24373 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
24374 \else
24375 \pgfmathsetmacro{\rot}{0}
24376 \pgfmathsetmacro{\quadrant}{0}
24377 \fi
24378 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
24379 \pgfscope\pgf@circ@text@strokecolor
24380 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
24381 \pgfmathloop%
24382 \ifnum\pgf@circ@count@a>0
24383 \ifcase\quadrant % rotation 0
24384 % left
24385 \pgf@circ@count@c=\pgf@circ@count@a
24386 \pgftext[left,
24387 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24388 rotate=\rot]{\mytext}
24389 % right
24390 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24391 \pgftext[right,
24392 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24393 rotate=\rot]{\mytext}
24394 \or % rotation -90
24395 % left
24396 \pgf@circ@count@c=\pgf@circ@count@a
24397 \pgftext[top,
24398 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24399 rotate=\rot]{\mytext}
24400 % right
24401 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24402 \pgftext[bottom,
24403 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24404 rotate=\rot]{\mytext}
24405 \or %rotation 180
24406 % left
24407 \pgf@circ@count@c=\pgf@circ@count@a
24408 \pgftext[right,
24409 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24410 rotate=\rot]{\mytext}
24411 % right
24412 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24413 \pgftext[left,
24414 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24415 rotate=\rot]{\mytext}
24416 \or % rotation +90
24417 % left
24418 \pgf@circ@count@c=\pgf@circ@count@a
24419 \pgftext[bottom,
24420 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24421 rotate=\rot]{\mytext}
24422 % right
24423 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24424 \pgftext[top,
24425 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24426 rotate=\rot]{\mytext}
24427 \fi
24428 \advance\pgf@circ@count@a-1\relax%
24429 \repeatpgfmathloop
24430 \endpgfscope % for color of text
24431 \fi
24432 \endpgfscope
24433 % draw external pins or pads
24434 \ifdim\pgf@circ@res@other>0pt
24435 \ifpgfcirc@draw@input@leads
24436 \pgfscope
24437 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
24438 \pgf@circ@count@a=\numpins\relax
24439 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
24440 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
24441 \ifnum\padfrac>0
24442 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
24443 \fi
24444 \pgfmathloop%
24445 \ifnum\pgf@circ@count@a>0
24446 % left side
24447 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
24448 {%
24449 \ifnum\padfrac>0
24450 % pads
24451 \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}}
24452 \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}}
24453 \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}}
24454 \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}}
24455 \else
24456 % pins
24457 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24458 \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}}
24459 \fi
24460 }
24461 {}%
24462 % right side
24463 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins+1-\pgf@circ@count@a}
24464 {%
24465 \ifnum\padfrac>0
24466 % pads
24467 \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}}
24468 \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}}
24469 \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}}
24470 \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}}
24471 \else
24472 % pins
24473 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24474 \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}}
24475 \fi
24476 }
24477 {}%
24478 \advance\pgf@circ@count@a by -1\relax%
24479 \repeatpgfmathloop
24480 \pgfusepath{stroke}
24481 \endpgfscope
24482 \fi
24483 \fi
24484 }%
24485 \pgfutil@g@addto@macro\pgf@sh@s@dipchip{%
24486 \pgf@circ@count@a=\numpins
24487 \pgfmathloop
24488 \ifnum\pgf@circ@count@a>0
24489 % we will create two anchors per pin: the "normal one" like `pin 1` for the
24490 % electrical contact, and the "border one" like `bpin 1` for labels.
24491 % they will coincide if `external pins width` is set to 0.
24492 % see the helper function above the start of the shape definition (by Jonathan P. Spratte)
24493 \expandafter\pgf@circ@make@dippin@anchor\expandafter{\the\pgf@circ@count@a}%
24494 \advance\pgf@circ@count@a by -1\relax
24495 \repeatpgfmathloop
24496 }%
24497 }
24498
24499 % QFP (quad flat package) chips
24500 % helper macro to set the anchors inside a loop (to expand the current count)
24501 \pgfutil@protected\def\pgf@circ@make@qfppin@anchor#1%
24502 {%
24503 \expandafter\gdef\csname pgf@anchor@qfpchip@pin #1\endcsname
24504 {%
24505 \pgf@circ@if@num@in@list\pgf@circ@pins@list{#1}
24506 {\pgf@circ@qfppinanchor{#1}{1}}
24507 {\pgf@circ@qfppinanchor{#1}{0}}%
24508 }%
24509 \expandafter\gdef\csname pgf@anchor@qfpchip@bpin #1\endcsname
24510 {\pgf@circ@qfppinanchor{#1}{0}}%
24511 }
24512
24513 \pgfdeclareshape{qfpchip}{
24514 \savedmacro{\ctikzclass}{\edef\ctikzclass{chips}}
24515 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
24516 \savedmacro\numpins{%
24517 \pgf@circ@count@a=\ctikzvalof{multipoles/qfpchip/num pins}%
24518 \def\numpins{\the\pgf@circ@count@a}
24519 }
24520 \savedmacro\pgf@circ@pins@list
24521 {% some magic here, thanks to Jonathan P. Spratte
24522 \pgfkeysgetvalue
24523 {\circuitikzbasekey/multipoles/draw only pins}\pgf@circ@temp
24524 \expandafter\pgf@circ@set@list
24525 \expandafter\pgf@circ@pins@list
24526 \expandafter{\pgf@circ@temp}%
24527 }%
24528 \savedanchor\centerpoint{%
24529 \pgf@x=-.5\wd\pgfnodeparttextbox%
24530 \pgf@y=-.5\ht\pgfnodeparttextbox%
24531 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
24532 }%
24533 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
24534 \anchor{center}{\origin}
24535 \anchor{text}{\centerpoint}% to adjust text
24536 \saveddimen\height{%
24537 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24538 \pgfmathsetlength\pgf@x{((\numpins+2)
24539 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
24540 }%
24541 \saveddimen\width{%
24542 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24543 \pgfmathsetlength\pgf@x{((\numpins+2)
24544 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
24545 }%
24546 \saveddimen{\chipspacing}{
24547 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24548 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/qfpchip/pin spacing}}}
24549 \saveddimen{\extshift}{
24550 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24551 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
24552 % standard anchors
24553 \savedanchor\northwest{%
24554 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24555 \pgfmathsetlength\pgf@y{0.5*((\numpins+2)
24556 *\ctikzvalof{multipoles/qfpchip/pin spacing})*\pgf@circ@scaled@Rlen/4}%
24557 \pgf@x=-\pgf@y
24558 }
24559 \anchor{dot}{\northwest
24560 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
24561 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
24562 }
24563 \anchor{nw}{\northwest}
24564 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
24565 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
24566 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
24567 \anchor{north west}{\northwest}
24568 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
24569 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
24570 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
24571 \anchor{n}{\northwest\pgf@x=0pt }
24572 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24573 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24574 \anchor{w}{\northwest\pgf@y=0pt }
24575 \anchor{north}{\northwest\pgf@x=0pt }
24576 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
24577 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
24578 \anchor{west}{\northwest\pgf@y=0pt }
24579 % start drawing
24580 \pgf@circ@draw@component{%
24581 \northwest
24582 \pgf@circ@res@up = \pgf@y
24583 \pgf@circ@res@down = -\pgf@y
24584 \pgf@circ@res@right = -\pgf@x
24585 \pgf@circ@res@left = \pgf@x
24586 \pgf@circ@scaled@Rlen=\scaledRlen
24587 \pgf@circ@res@step = \ctikzvalof{multipoles/qfpchip/pin spacing}\pgf@circ@scaled@Rlen
24588 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
24589 \pgfscope% (for the line width)
24590 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
24591 %% upside mark
24592 \ifpgf@circuit@chip@topmark
24593 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2-\pgf@circ@res@step/2}}
24594 \pgfpathlineto{\pgfpoint{-\width/2+\pgf@circ@res@step/2}{\height/2}}
24595 \else
24596 \pgfpathmoveto{\pgfpoint{-\width/2}{\height/2}}
24597 \fi
24598 %% rest of the shape
24599 \pgfpathlineto{\pgfpoint{\width/2}{\height/2}}
24600 \pgfpathlineto{\pgfpoint{\width/2}{-\height/2}}
24601 \pgfpathlineto{\pgfpoint{-\width/2}{-\height/2}}
24602 \pgfpathclose
24603 \pgf@circ@draworfill
24604 % Adding the pin number
24605 \pgf@circ@setcolor
24606 \ifpgf@circuit@chip@shownumbers
24607 \pgf@circ@count@a=\numpins%
24608 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
24609 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
24610 \ifpgf@circuit@chip@straightnumbers
24611 \pgfgettransformentries\a\b\temp\temp\temp\temp
24612 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
24613 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
24614 \else
24615 \pgfmathsetmacro{\rot}{0}
24616 \pgfmathsetmacro{\quadrant}{0}
24617 \fi
24618 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
24619 \def\mytext{\ctikzvalof{multipoles/font}\space\pgf@circ@strut\the\pgf@circ@count@c\space}
24620 \pgfscope\pgf@circ@text@strokecolor
24621 \pgfmathloop%
24622 \ifnum\pgf@circ@count@a>0
24623 \ifcase\quadrant % rotation 0
24624 % left
24625 \pgf@circ@count@c=\pgf@circ@count@a
24626 \pgftext[left,
24627 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24628 rotate=\rot]{\mytext}
24629 % bottom
24630 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
24631 \pgftext[bottom,
24632 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
24633 rotate=\rot]{\mytext}
24634 % right
24635 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24636 \pgftext[right,
24637 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24638 rotate=\rot]{\mytext}
24639 % top
24640 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
24641 \pgftext[top,
24642 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
24643 rotate=\rot]{\mytext}
24644 \or % rotation -90
24645 % left
24646 \pgf@circ@count@c=\pgf@circ@count@a
24647 \pgftext[top,
24648 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24649 rotate=\rot]{\mytext}
24650 % bottom
24651 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
24652 \pgftext[left,
24653 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
24654 rotate=\rot]{\mytext}
24655 % right
24656 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24657 \pgftext[bottom,
24658 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24659 rotate=\rot]{\mytext}
24660 % top
24661 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
24662 \pgftext[right,
24663 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
24664 rotate=\rot]{\mytext}
24665 \or %rotation 180
24666 % left
24667 \pgf@circ@count@c=\pgf@circ@count@a
24668 \pgftext[right,
24669 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24670 rotate=\rot]{\mytext}
24671 % bottom
24672 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
24673 \pgftext[top,
24674 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
24675 rotate=\rot]{\mytext}
24676 % right
24677 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24678 \pgftext[left,
24679 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24680 rotate=\rot]{\mytext}
24681 % top
24682 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
24683 \pgftext[bottom,
24684 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
24685 rotate=\rot]{\mytext}
24686 \or % rotation +90
24687 % left
24688 \pgf@circ@count@c=\pgf@circ@count@a
24689 \pgftext[bottom,
24690 at=\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24691 rotate=\rot]{\mytext}
24692 % bottom
24693 \pgf@circ@count@c=\numexpr\pgf@circ@count@b+\pgf@circ@count@a\relax
24694 \pgftext[right,
24695 at=\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down},
24696 rotate=\rot]{\mytext}
24697 % right
24698 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
24699 \pgftext[top,
24700 at=\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step},
24701 rotate=\rot]{\mytext}
24702 % top
24703 \pgf@circ@count@c=\numexpr3*\pgf@circ@count@b+\pgf@circ@count@a\relax
24704 \pgftext[left,
24705 at=\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up},
24706 rotate=\rot]{\mytext}
24707 \fi
24708 \advance\pgf@circ@count@a-1\relax%
24709 \repeatpgfmathloop
24710 \endpgfscope % for the text labels
24711 \fi
24712 \endpgfscope
24713 \ifdim\pgf@circ@res@other>0pt
24714 \ifpgfcirc@draw@input@leads
24715 \pgfscope
24716 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
24717 \pgf@circ@count@a=\numpins%
24718 \divide\pgf@circ@count@a by 4 \pgf@circ@count@b=\pgf@circ@count@a
24719 \pgfmathloop%
24720 \ifnum\pgf@circ@count@a>0
24721 \edef\padfrac{\ctikzvalof{multipoles/external pad fraction}}
24722 \ifnum\padfrac>0
24723 \pgf@circ@res@temp=\pgf@circ@res@step\divide\pgf@circ@res@temp by \padfrac
24724 % left side pads
24725 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
24726 {%
24727 \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}}
24728 \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}}
24729 \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}}
24730 \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}}
24731 }{}%
24732 % bottom side pads
24733 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
24734 {%
24735 \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}}
24736 \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}}
24737 \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}}
24738 \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}}
24739 }{}%
24740 % right side pads
24741 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
24742 {%
24743 \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}}
24744 \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}}
24745 \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}}
24746 \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}}
24747 }{}%
24748 % top side pads
24749 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
24750 {%
24751 \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}}
24752 \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}}
24753 \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}}
24754 \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}}
24755 }{}%
24756 \else
24757 % left side pins
24758 \pgf@circ@if@num@in@list\pgf@circ@pins@list\pgf@circ@count@a
24759 {%
24760 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24761 \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}}
24762 }{}%
24763 % bottom side pins
24764 \pgf@circ@if@num@in@list\pgf@circ@pins@list{\numpins/4+\pgf@circ@count@a}
24765 {%
24766 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left-(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@down}}
24767 \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}}
24768 }{}%
24769 % right side pins
24770 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+1-\pgf@circ@count@a}
24771 {%
24772 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
24773 \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}}
24774 }{}%
24775 % top side pins
24776 \pgf@circ@if@num@in@list\pgf@circ@pins@list{3*\numpins/4+\pgf@circ@count@a}
24777 {%
24778 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right+(\pgf@circ@qfp@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}{\pgf@circ@res@up}}
24779 \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}}
24780 }{}%
24781 \fi
24782 \advance\pgf@circ@count@a-1\relax%
24783 \repeatpgfmathloop
24784 \pgfusepath{stroke}
24785 \endpgfscope
24786 \fi
24787 \fi
24788 }%
24789 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
24790 % and is executed just before a node is drawn.
24791 \pgfutil@g@addto@macro\pgf@sh@s@qfpchip{%
24792 % Start with the maximum pin number and go backwards.
24793 \pgf@circ@count@a=\numpins%
24794 \pgfmathloop%
24795 \ifnum\pgf@circ@count@a>0
24796 \expandafter\pgf@circ@make@qfppin@anchor\expandafter{\the\pgf@circ@count@a}%
24797 \advance\pgf@circ@count@a-1\relax%
24798 \repeatpgfmathloop%
24799 }%
24800 }
24801
24802 %% anchors for DIP
24803 \def\pgf@circ@dippinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24804 \c@pgf@countc=\numpins\relax
24805 \divide\c@pgf@countc by 2
24806 \ifnum #1 > \the\c@pgf@countc
24807 % right side
24808 \pgfpoint{\width/2+#2*\extshift}{-\height/2+(\pgf@circ@dip@pin@shift-\c@pgf@countc+#1-1)*\chipspacing}
24809 \else
24810 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@dip@pin@shift-#1)*\chipspacing}
24811 \fi
24812 }
24813
24814 %% anchors for QFP
24815 \def\pgf@circ@qfppinanchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
24816 \c@pgf@countc=\numpins\relax
24817 \divide\c@pgf@countc by 4
24818 \ifnum #1 > \the\c@pgf@countc
24819 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 2
24820 \ifnum #1 > \the\c@pgf@countb
24821 \c@pgf@countb=\c@pgf@countc \multiply \c@pgf@countb by 3
24822 \ifnum #1 > \the\c@pgf@countb
24823 % 3*npins/4 < pin, top side
24824 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift+\c@pgf@countb-#1)*\chipspacing}{\height/2+#2*\extshift}%
24825 \else
24826 % 2*npins/4 < pin <= 3*npins/4, right side
24827 \pgfpoint{\width/2+#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}%
24828 \fi
24829 \else
24830 % npins/4 < pin <= 2*npins/4, bottom side
24831 \pgfpoint{\width/2+(\pgf@circ@qfp@pin@shift-\c@pgf@countb+#1-1)*\chipspacing}{-\height/2-#2*\extshift}%
24832 \fi
24833 \else
24834 % <= npins/4, left side
24835 \pgfpoint{-\width/2-#2*\extshift}{\height/2+(\pgf@circ@qfp@pin@shift-#1)*\chipspacing}%
24836 \fi
24837 }% %>>>
24838
24839 %% Nodes definition for rotaryswitch%<<<
24840
24841 %%%%%%%%%%%%%%%%%
24842 %% Rotary Switch
24843 %%%%%%%%%%%%%%%%%
24844
24845 \pgfdeclareshape{rotaryswitch}
24846 {
24847 \savedmacro{\ctikzclass}{\edef\ctikzclass{switches}}
24848 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
24849 \savedanchor\northeast{%
24850 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24851 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
24852 % the magic number is 0.25/cos(35)
24853 % try to recalculate it for the actual switch
24854 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
24855 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
24856 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
24857 \edef\r{\ctikzvalof{nodes width}}
24858 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
24859 \pgfmathsetlength{\pgf@x}{\r*\pgf@circ@scaled@Rlen + \pgf@circ@res@temp}
24860 }
24861 \savedanchor\northwest{%
24862 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24863 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
24864 % the magic number is 0.25/cos(35)
24865 % try to recalculate it for the actual switch
24866 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
24867 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
24868 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
24869 \edef\r{\ctikzvalof{nodes width}}
24870 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
24871 \pgfmathsetlength{\pgf@x}{-\r*\pgf@circ@scaled@Rlen - (\a<90 ? 1 : 1-2*cos(\a))*\pgf@circ@res@temp}
24872 }
24873 \savedanchor\central{%
24874 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24875 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
24876 % the magic number is 0.25/cos(35)
24877 % try to recalculate it for the actual switch
24878 \pgf@circ@res@temp=\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
24879 \pgf@circ@res@temp=.3052\pgf@circ@res@temp
24880 \edef\a{\ctikzvalof{multipoles/rotary/angle}}
24881 \edef\r{\ctikzvalof{nodes width}}
24882 \pgfmathsetlength{\pgf@y}{\r*\pgf@circ@scaled@Rlen +(\a>90 ? 2 : 2*sin(\a))*\pgf@circ@res@temp}
24883 \pgfmathsetlength{\pgf@x}{(\a<90 ? 0 : cos(\a))*\pgf@circ@res@temp}
24884 }
24885 % external square limits
24886 \savedanchor\extnorthwest{%
24887 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24888 \pgf@x=-\ctikzvalof{tripoles/spdt/width}\pgf@circ@scaled@Rlen
24889 % this strange value makes the 2-pole rotary switch equal to the 2 poles cute spdt
24890 \pgf@x=.3052\pgf@x % the magic number is 0.25/cos(35)
24891 \pgf@x=2.5\pgf@x % external square size
24892 \pgf@y=-\pgf@x %square thing when angle=180?
24893 }
24894 \saveddimen{\width}{
24895 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
24896 \pgfmathsetlength\pgf@x{0.3052*\pgf@circ@scaled@Rlen*\ctikzvalof{tripoles/spdt/width}}}
24897 % radius of the connector
24898 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
24899 \saveddimen{\radius}{\pgfmathsetlength\pgf@x{\pgf@circ@Rlen*\ctikzvalof{nodes width}}}
24900 % shapename
24901 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
24902 % shape type
24903 \savedmacro{\cshape}{\def\cshape{\ctikzvalof{multipoles/rotary/shape}}}
24904 \savedmacro{\channels}{\def\channels{\ctikzvalof{multipoles/rotary/channels}}}
24905 \savedmacro{\angle}{\def\angle{\ctikzvalof{multipoles/rotary/angle}}}
24906 \savedmacro{\wiper}{\def\wiper{\ctikzvalof{multipoles/rotary/wiper}}}
24907 \savedmacro{\stepa}{\pgfmathsetmacro{\stepa}{2*\ctikzvalof{multipoles/rotary/angle}/(\ctikzvalof{multipoles/rotary/channels}-1)}}
24908 % mid of the lever, to stack switches
24909 %\anchor{mid}{\midlever}
24910 \anchor{mid}{\northwest
24911 \pgf@circ@res@temp=-\pgf@x
24912 \pgfmathsetlength{\pgf@x}{\pgf@circ@res@temp*(-1+cos(\wiper))}
24913 \pgfmathsetlength{\pgf@y}{\pgf@circ@res@temp*sin(\wiper)}
24914 }
24915 %
24916 % Notice that the "in" anchors must mimic "ext center", otherwise they are
24917 % wrong for angles > 90 degrees!
24918 %
24919 % center anchors
24920 \anchor{cin}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
24921 % horizontal angles
24922 \anchor{in}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius}
24923 \anchor{ain}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width \advance\pgf@x by -\radius}
24924
24925 \anchor{center}{ \central \pgf@y=0pt }
24926 \anchor{east}{ \northeast \pgf@y=0pt }
24927 \anchor{west}{ \northwest \pgf@y=0pt }
24928 \anchor{south}{ \central \pgf@y=-\pgf@y }
24929 \anchor{north}{ \central }
24930 \anchor{south west}{ \northwest \pgf@y=-\pgf@y }
24931 \anchor{north east}{ \northeast }
24932 \anchor{north west}{ \northwest }
24933 \anchor{south east}{ \northeast \pgf@y=-\pgf@y }
24934
24935 \anchor{ext center}{ \pgf@y=0pt \pgf@x=0pt \advance\pgf@x by -\width}
24936 \anchor{ext east}{ \extnorthwest \pgf@y=0pt \pgf@x=-\pgf@x \advance\pgf@x by -\width}
24937 \anchor{ext west}{ \extnorthwest \pgf@y=0pt \advance\pgf@x by -\width}
24938 \anchor{ext south}{ \extnorthwest \pgf@x=0pt \pgf@y=-\pgf@y \advance\pgf@x by -\width}
24939 \anchor{ext north}{ \extnorthwest \pgf@x=0pt \advance\pgf@x by -\width}
24940 \anchor{ext south west}{ \extnorthwest \pgf@y=-\pgf@y \advance\pgf@x by -\width}
24941 \anchor{ext north east}{ \extnorthwest \pgf@x=-\pgf@x \advance\pgf@x by -\width}
24942 \anchor{ext north west}{ \extnorthwest \advance\pgf@x by -\width}
24943 \anchor{ext south east}{ \extnorthwest \pgf@x=-\pgf@x \pgf@y=-\pgf@y \advance\pgf@x by -\width}
24944
24945 \pgf@circ@draw@component{
24946 \pgf@circ@setcolor
24947 \pgf@circ@res@right = \width
24948 \pgf@circ@res@left = -\width
24949
24950 \pgfscope %wiper
24951 % This is the radius of the "ocirc" shape (see pgfcircshapes.tex)
24952 \pgf@circ@res@temp=\radius\relax
24953 \pgf@circ@res@temp=\ctikzvalof{multipoles/rotary/thickness}\pgf@circ@res@temp
24954 \pgfsetlinewidth{2\pgf@circ@res@temp}
24955 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0pt}}
24956 \pgfpathlineto{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\wiper}{2\pgf@circ@res@right}}}
24957 \pgfsetroundcap\pgfusepath{draw}
24958 \endpgfscope
24959
24960 \ifpgf@circ@rotaryarrow
24961 \pgfscope % arrow
24962 \pgfcirc@set@arrows{switch}{\ifpgf@circ@rotaryarrow@ccw latexslim\fi}{\ifpgf@circ@rotaryarrow@cw latexslim\fi}
24963 \pgf@circ@setlinewidth{bipoles}{\pgflinewidth}
24964 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}} % center of cin node
24965 \pgftransformrotate{\wiper}
24966 \pgfpathmoveto{\pgfpointpolar{50}{1.0\pgf@circ@res@right}}
24967 \pgfpatharc{50}{-50}{1.0\pgf@circ@res@right}
24968 \ifpgf@circ@rotaryarrow@ccw
24969 \ifpgf@circ@rotaryarrow@cw
24970 % both here, maintain values
24971 \relax
24972 \else
24973 % only ccw: remove end arrow
24974 \pgfsetarrowsend{}
24975 \fi
24976 \else
24977 \ifpgf@circ@rotaryarrow@cw
24978 % only cw: remove start arrow
24979 \pgfsetarrowsstart{}
24980 \else
24981 % none: shouldn't happen
24982 \relax
24983 \fi
24984 \fi
24985 \pgfusepath{draw}
24986 \endpgfscope
24987 \fi
24988
24989 % \typeout{CHANNELS\space\channels\space ANGLE\space\angle STEPA\space\stepa}
24990 \pgf@circ@count@a=\channels\relax
24991 \pgfmathsetmacro{\currenta}{-\angle}
24992 \pgfmathloop%
24993 \ifnum\pgf@circ@count@a>0
24994 % \typeout{LOOPIN\space\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
24995 \pgfscope
24996 \pgftransformshift{\pgfpointadd{\pgfpoint{\pgf@circ@res@left}{0pt}}{\pgfpointpolar{\currenta}{2\pgf@circ@res@right}}}
24997 \pgfnode{\cshape}{center}{}{\thisshape-out \the\pgf@circ@count@a}{\pgfusepath{stroke}}
24998 \endpgfscope
24999 \pgfmathsetmacro{\currenta}{\currenta+\stepa}
25000 % \typeout{LOOPOUT\space\the\pgf@circ@count@a\space CURRENTA\space\currenta\space RIGHT\space\the\pgf@circ@res@right}
25001 \advance\pgf@circ@count@a by -1\relax%
25002 \repeatpgfmathloop
25003
25004 \pgfscope % input
25005 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
25006 \pgfnode{\cshape}{center}{}{\thisshape-in}{\pgfusepath{stroke}}
25007 \endpgfscope
25008 }
25009 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
25010 % and is executed just before a node is drawn.
25011 \pgfutil@g@addto@macro\pgf@sh@s@rotaryswitch{%
25012 % Start with the maximum pin number and go backwards.
25013 \pgf@circ@count@a=\channels\relax
25014 \pgfmathloop%
25015 \ifnum\pgf@circ@count@a>0
25016 % we will create two anchors per pin: the "normal one" like `pin 1` for the
25017 % electrical contact, and the "border one" like `bpin 1` for labels.
25018 % they will coincide if `external pins width` is set to 0.
25019 \expandafter\xdef\csname pgf@anchor@rotaryswitch@out\space\the\pgf@circ@count@a\endcsname{%
25020 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{1}{0}%
25021 }
25022 \expandafter\xdef\csname pgf@anchor@rotaryswitch@cout\space\the\pgf@circ@count@a\endcsname{%
25023 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{0}%
25024 }
25025 \expandafter\xdef\csname pgf@anchor@rotaryswitch@aout\space\the\pgf@circ@count@a\endcsname{%
25026 \noexpand\pgf@circ@rotaryanchor{\the\pgf@circ@count@a}{0}{1}%
25027 }
25028 \expandafter\xdef\csname pgf@anchor@rotaryswitch@sqout\space\the\pgf@circ@count@a\endcsname{%
25029 \noexpand\pgf@circ@rotarysqanchor{\the\pgf@circ@count@a}%
25030 }
25031 \advance\pgf@circ@count@a by -1\relax%
25032 \repeatpgfmathloop%
25033 }%
25034 }
25035
25036 \def\pgf@circ@rotaryanchor#1#2#3{% #1: numero del pin; #2: 1 - x pos, 0 - center; #3 0: inner, 1 outer
25037 \pgf@circ@res@temp=\width
25038 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
25039 \pgfmathsetlength{\pgf@x}{2*(\pgf@circ@res@temp+#3*\radius/2)*cos(\myangle))+#2*\radius}
25040 \pgfmathsetlength{\pgf@y}{2*(\pgf@circ@res@temp+#3*\radius/2)*sin(\myangle)}
25041 \advance\pgf@x by -\pgf@circ@res@temp
25042 }
25043
25044 \def\pgf@circ@rotarysqanchor#1{% external square anchors
25045 \pgf@circ@res@temp=\width
25046 \pgfmathsetmacro{\myangle}{\angle-(#1-1)*\stepa}
25047 \pgfpointborderrectangle{\pgfpointpolar{\myangle}{1pt}}{\pgfpoint{2.5\pgf@circ@res@temp}{2.5\pgf@circ@res@temp}}
25048 \advance\pgf@x by -\pgf@circ@res@temp
25049 }% %>>>
25050
25051 %%%%%%%%%%%%%%%%%%%%%%%%%%
25052 % Seven segments displays
25053 %%%%%%%%%%%%%%%%%%%%%%%%%%
25054
25055 % Definitions for seven segment displays by RGtti%<<<1
25056
25057 \newif\ifpgf@circ@sevenseg@dot
25058 \newif\ifpgf@circ@sevenseg@box
25059 \def\pgf@circ@sevenseg@dotstate{empty}
25060 \ctikzset{seven seg/.is family}
25061 \ctikzset{seven seg/dot/.is choice}
25062 % none means no dot, not space for it. Empty means no dot, but space
25063 \ctikzset{seven seg/dot/none/.code={\pgf@circ@sevenseg@dotfalse}}
25064 \ctikzset{seven seg/dot/empty/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{empty}}}
25065 \ctikzset{seven seg/dot/off/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{off}}}
25066 \ctikzset{seven seg/dot/on/.code={\pgf@circ@sevenseg@dottrue\def\pgf@circ@sevenseg@dotstate{on}}}
25067 %
25068 \ctikzset{seven seg/width/.initial=0.4}% relative to \pgf@circ@Rlen
25069 \ctikzset{seven seg/thickness/.initial=4pt}% segment thickness
25070 \ctikzset{seven seg/segment sep/.initial=0.2pt}% gap between segments
25071 \ctikzset{seven seg/box sep/.initial=1pt}% external box gap
25072 \ctikzset{seven seg/color on/.initial=red}% color for segment "on"
25073 \ctikzset{seven seg/color off/.initial=gray!20!white} % ...and "off"
25074 \ctikzset{seven seg/box/.is choice}
25075 \ctikzset{seven seg/box/off/.code={\pgf@circ@sevenseg@boxfalse}}
25076 \ctikzset{seven seg/box/on/.code={\pgf@circ@sevenseg@boxtrue}}
25077
25078 \ctikzset{seven seg/bits/.initial=0000000}
25079
25080 \ctikzset{seven seg/value/.code={%
25081 \edef\@@tmp{#1}%
25082 \edef\@@n{0} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111110}\fi
25083 \edef\@@n{1} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110000}\fi
25084 \edef\@@n{2} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1101101}\fi
25085 \edef\@@n{3} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111001}\fi
25086 \edef\@@n{4} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0110011}\fi
25087 \edef\@@n{5} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011011}\fi
25088 \edef\@@n{6} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1011111}\fi
25089 \edef\@@n{7} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110000}\fi
25090 \edef\@@n{8} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111111}\fi
25091 \edef\@@n{9} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1111011}\fi
25092 \edef\@@n{10}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
25093 \edef\@@n{11}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
25094 \edef\@@n{12}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
25095 \edef\@@n{13}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
25096 \edef\@@n{14}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
25097 \edef\@@n{15}\ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
25098 \edef\@@n{A} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
25099 \edef\@@n{B} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
25100 \edef\@@n{C} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
25101 \edef\@@n{D} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
25102 \edef\@@n{E} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
25103 \edef\@@n{F} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
25104 \edef\@@n{a} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1110111}\fi
25105 \edef\@@n{b} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0011111}\fi
25106 \edef\@@n{c} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001110}\fi
25107 \edef\@@n{d} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0111101}\fi
25108 \edef\@@n{e} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1001111}\fi
25109 \edef\@@n{f} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=1000111}\fi
25110 \edef\@@n{-} \ifx\@@tmp\@@n\relax\ctikzset{seven seg/bits=0000001}\fi
25111 }}
25112
25113 \tikzset{%
25114 seven segment val/.style args={#1dot#2box#3}{%
25115 shape=bare7seg,
25116 /tikz/circuitikz/seven seg/value=#1,
25117 /tikz/circuitikz/seven seg/dot=#2,
25118 /tikz/circuitikz/seven seg/box=#3,
25119 },
25120 seven segment bits/.style args={#1dot#2box#3}{%
25121 shape=bare7seg,
25122 /tikz/circuitikz/seven seg/bits=#1,
25123 /tikz/circuitikz/seven seg/dot=#2,
25124 /tikz/circuitikz/seven seg/box=#3,
25125 },
25126 }
25127 %%>>>
25128
25129 %% Nodes definitions for 7-segment display%<<<
25130 \pgfdeclareshape{bare7seg}{
25131 \savedmacro{\ctikzclass}{\edef\ctikzclass{displays}}
25132 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
25133 \savedmacro{\dotstatus}{\edef\dotstatus{\pgf@circ@sevenseg@dotstate}}
25134 \saveddimen{\dotspace}{% the dot is on the right, and occupy the same as the thickness
25135 \ifpgf@circ@sevenseg@dot
25136 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/thickness}}
25137 \else
25138 \pgf@x=0pt
25139 \fi
25140 }
25141 % The object extension is more or less (-width/2,-width) to (width/2,width)
25142 % and adjusted for line thickness (both sides) and eventually the dot
25143 \saveddimen{\width}{
25144 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25145 \pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}}
25146 \saveddimen{\gap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/segment sep}}}
25147 \saveddimen{\boxgap}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{seven seg/box sep}}}
25148 \savedanchor{\southwest}{% both negative
25149 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25150 \pgfmathsetlength{\pgf@x}{-0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
25151 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
25152 \pgfmathsetlength{\pgf@y}{-\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
25153 -0.5*\ctikzvalof{seven seg/thickness}-\ctikzvalof{seven seg/box sep}}
25154 }
25155 \savedanchor{\northeast}{% both positive
25156 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25157 \ifpgf@circ@sevenseg@dot
25158 \pgfmathsetlength{\pgf@circ@res@other}{\ctikzvalof{seven seg/thickness}}
25159 \else
25160 \pgf@circ@res@other=0pt
25161 \fi
25162 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
25163 +0.5*\ctikzvalof{seven seg/thickness}+\pgf@circ@res@other+\ctikzvalof{seven seg/box sep}}
25164 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen
25165 +0.5*\ctikzvalof{seven seg/thickness}+\ctikzvalof{seven seg/box sep}}
25166 }
25167 \savedanchor{\topright}{% anchor without the box sep and the thickness
25168 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25169 \pgfmathsetlength{\pgf@x}{0.5*\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
25170 \pgfmathsetlength{\pgf@y}{\ctikzvalof{seven seg/width}*\pgf@circ@scaled@Rlen}
25171 }
25172 \anchor{center}{\pgfpointorigin}
25173 \anchor{north west}{\southwest\pgf@y=-\pgf@y}
25174 \anchor{north east}{\northeast}
25175 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
25176 \anchor{south west}{\southwest}
25177 \anchor{north}{\northeast\pgf@x=0pt}
25178 \anchor{east}{\northeast\pgf@y=0pt}
25179 \anchor{south}{\southwest\pgf@x=0pt}
25180 \anchor{west}{\southwest\pgf@y=0pt}
25181 \anchor{a}{\topright\pgf@x=0pt}
25182 \anchor{b}{\topright\pgf@y=0.5\pgf@y}
25183 \anchor{c}{\topright\pgf@y=-0.5\pgf@y}
25184 \anchor{d}{\topright\pgf@y=-\pgf@y\pgf@x=0pt}
25185 \anchor{e}{\topright\pgf@x=-\pgf@x\pgf@y=-0.5\pgf@y}
25186 \anchor{f}{\topright\pgf@x=-\pgf@x\pgf@y=0.5\pgf@y}
25187 \anchor{g}{\pgfpointorigin}
25188 \anchor{dot}{\topright\pgf@y=-\pgf@y\advance\pgf@x by \dotspace}
25189 \pgf@circ@draw@component{%
25190 \southwest % I do not want the dot here, it will stick out
25191 \pgf@circ@res@up = -\pgf@y
25192 \pgf@circ@res@down = \pgf@y
25193 \pgf@circ@res@right = \pgf@x
25194 \pgf@circ@res@left = -\pgf@x
25195 \pgfscope
25196 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
25197 \pgf@circ@setcolor
25198 \pgfpathrectanglecorners%
25199 {\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
25200 {\pgfpoint{\pgf@circ@res@left+\dotspace}{\pgf@circ@res@up}}
25201 \ifpgf@circ@sevenseg@box
25202 \pgf@circ@draworfill
25203 \else
25204 \pgf@circ@maybefill
25205 \fi
25206 \endpgfscope
25207 \edef\bits{\ctikzvalof{seven seg/bits}}
25208 \pgfscope
25209 \pfg@circ@sseg@drawbits{\bits}
25210 \endpgfscope
25211 \pgfscope
25212 \ifpgf@circ@sevenseg@dot
25213 \pgf@circ@sseg@drawdots
25214 \fi
25215 \endpgfscope
25216 }
25217 }
25218
25219 \def\pgf@circ@sseg@splitbits#1#2#3#4#5#6#7\relax{%split the seven bits
25220 \edef\@@a{#1}\edef\@@b{#2}\edef\@@c{#3}\edef\@@d{#4}\edef\@@e{#5}\edef\@@f{#6}\edef\@@g{#7}%
25221 }
25222 \def\pgf@circ@sseg@drawone#1#2#3#4#5{% #1 on off the x1, y1, x2 , y2
25223 \ifnum #1 > 0\relax
25224 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
25225 \else
25226 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
25227 \fi
25228 \pgfpathmoveto{\pgfpoint{#2}{#3}}
25229 \pgfpathlineto{\pgfpoint{#4}{#5}}
25230 \pgfusepath{draw}
25231 }
25232 \def\pfg@circ@sseg@drawbits#1{% #1 must be 7 bits
25233 \expandafter\pgf@circ@sseg@splitbits#1\relax% a bit of magic...
25234 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
25235 \pgfsetlinewidth{\ctikzvalof{seven seg/thickness}}
25236 % \pgfsetroundcap
25237 \pgfsetarrowsstart{Triangle Cap[]}
25238 \pgfsetarrowsend{Triangle Cap[]}
25239 % segments
25240 \pgf@circ@sseg@drawone{\@@a}{-\width/2+\gap}{\width}{\width/2-\gap}{\width}
25241 \pgf@circ@sseg@drawone{\@@b}{\width/2}{\width-\gap}{\width/2}{0pt+\gap}
25242 \pgf@circ@sseg@drawone{\@@c}{\width/2}{0pt-\gap}{\width/2}{-\width+\gap}
25243 \pgf@circ@sseg@drawone{\@@d}{\width/2-\gap}{-\width}{-\width/2+\gap}{-\width}
25244 \pgf@circ@sseg@drawone{\@@e}{-\width/2}{-\width+\gap}{-\width/2}{0pt-\gap}
25245 \pgf@circ@sseg@drawone{\@@f}{-\width/2}{0pt+\gap}{-\width/2}{\width-\gap}
25246 \pgf@circ@sseg@drawone{\@@g}{-\width/2+\gap}{0pt}{\width/2-\gap}{0pt}
25247 }
25248 \def\pgf@circ@sseg@drawdots{% dots
25249 \edef\what{empty}
25250 \ifx\what\pgf@circ@sevenseg@dotstate
25251 % do nothing
25252 \else
25253 \pgfmathsetlength{\pgf@circ@res@other}{0.5*\ctikzvalof{seven seg/thickness}}
25254 \edef\what{off}
25255 \ifx\what\pgf@circ@sevenseg@dotstate
25256 % dot off
25257 \pgfsetfillcolor{\ctikzvalof{seven seg/color off}}
25258 \pgfsetcolor{\ctikzvalof{seven seg/color off}}
25259 \else
25260 % dot on
25261 \pgfsetfillcolor{\ctikzvalof{seven seg/color on}}
25262 \pgfsetcolor{\ctikzvalof{seven seg/color on}}
25263 \fi
25264 \pgfpathcircle{\pgfpoint{\width/2+2*\pgf@circ@res@other}{-\width}}{\pgf@circ@res@other}
25265 \pgfusepath{draw,fill}
25266 \fi
25267 }
25268 % %>>>
25269
25270 %%%%%%%%%%%%%%%%%%%%%%%%
25271 %% Flip-flops and muxdemuxes
25272 %%%%%%%%%%%%%%%%%%%%%%%%
25273
25274 % Settings for flip flops and muxdemxes%<<<1
25275
25276 %% flip-flop specific keys (most others are the same as chips)
25277
25278 \ctikzset{multipoles/flipflop/font/.initial=\pgf@circ@font@small}
25279 \ctikzset{multipoles/flipflop/fontud/.initial=\pgf@circ@font@tiny}
25280 \ctikzset{multipoles/flipflop/width/.initial=1.2}
25281 \ctikzset{multipoles/flipflop/pin spacing/.initial=0.6}
25282 \ctikzset{multipoles/flipflop/clock wedge size/.initial=0.2}
25283
25284 %% muxdemuxes internal keys
25285
25286 \ctikzset{multipoles/muxdemux/base len/.initial=0.4}
25287 \ctikzset{multipoles/muxdemux/Lh/.initial=8.0}
25288 \ctikzset{multipoles/muxdemux/Rh/.initial=6.0}
25289 \ctikzset{multipoles/muxdemux/w/.initial=3.0}
25290 \ctikzset{multipoles/muxdemux/inset w/.initial=0.0}
25291 \ctikzset{multipoles/muxdemux/inset Lh/.initial=0.0}
25292 \ctikzset{multipoles/muxdemux/inset Rh/.initial=0.0}
25293 \ctikzset{multipoles/muxdemux/NL/.initial=8}
25294 \ctikzset{multipoles/muxdemux/NR/.initial=1}
25295 \ctikzset{multipoles/muxdemux/NB/.initial=3}
25296 \ctikzset{multipoles/muxdemux/NT/.initial=0}
25297 \ctikzset{multipoles/muxdemux/square pins/.initial=0}%
25298 \ctikzset{multipoles/muxdemux/bgpicture/.code={}}%
25299
25300 % Thanks to @marmot
25301 % this should automatically create a key in this subfamily
25302 \pgfkeys{\circuitikzbasekey/multipoles/muxdemux/label/.is family,
25303 \circuitikzbasekey/multipoles/muxdemux/label,
25304 .unknown/.code = {
25305 \pgfkeyssetvalue{\pgfkeyscurrentpath/\pgfkeyscurrentname}{#1}
25306 }
25307 }
25308 \tikzset{muxdemux def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux}{#1}}
25309 \tikzset{muxdemux label/.code=\pgfqkeys{\circuitikzbasekey/multipoles/muxdemux/label}{#1}}
25310 % external (class-like) muxdemux settings for labels
25311 \ctikzset{muxdemux/inner label font/.initial=\pgf@circ@font@tiny}
25312 \ctikzset{muxdemux/outer label font/.initial=\pgf@circ@font@tiny}
25313 \ctikzset{muxdemux/border label font/.initial=\pgf@circ@font@tiny}
25314 \ctikzset{muxdemux/inner label xsep/.initial=2pt}
25315 \ctikzset{muxdemux/inner label ysep/.initial=2pt}
25316 \ctikzset{muxdemux/outer label xsep/.initial=2pt}
25317 \ctikzset{muxdemux/outer label ysep/.initial=2pt}
25318 \ctikzset{muxdemux/border label xsep/.initial=2pt}
25319 \ctikzset{muxdemux/border label ysep/.initial=2pt}
25320 \ctikzset{muxdemux/inner label sep/.code={%
25321 \ctikzset{muxdemux/inner label xsep=#1}%
25322 \ctikzset{muxdemux/inner label ysep=#1}%
25323 }}
25324 \ctikzset{muxdemux/outer label sep/.code={%
25325 \ctikzset{muxdemux/outer label xsep=#1}%
25326 \ctikzset{muxdemux/outer label ysep=#1}%
25327 }}
25328 \ctikzset{muxdemux/border label sep/.code={%
25329 \ctikzset{muxdemux/border label xsep=#1}%
25330 \ctikzset{muxdemux/border label ysep=#1}%
25331 }}
25332 \ctikzset{muxdemux/clock wedge size/.initial=0.2}
25333 %>>>
25334
25335 %% Node shapes definitions for flip flops%<<<
25336
25337 % Flip flops are a specialized kind of dipchip.
25338 % they have a class by themselves
25339
25340 %% flip flop definitions --- by default empty
25341 %% pin texts
25342 \ctikzset{multipoles/flipflop/t1/.initial={}}
25343 \ctikzset{multipoles/flipflop/t2/.initial={}}
25344 \ctikzset{multipoles/flipflop/t3/.initial={}}
25345 \ctikzset{multipoles/flipflop/t4/.initial={}}
25346 \ctikzset{multipoles/flipflop/t5/.initial={}}
25347 \ctikzset{multipoles/flipflop/t6/.initial={}}
25348 \ctikzset{multipoles/flipflop/tu/.initial={}}
25349 \ctikzset{multipoles/flipflop/td/.initial={}}
25350 % pin clock wedge flags
25351 \ctikzset{multipoles/flipflop/c1/.initial={0}}
25352 \ctikzset{multipoles/flipflop/c2/.initial={0}}
25353 \ctikzset{multipoles/flipflop/c3/.initial={0}}
25354 \ctikzset{multipoles/flipflop/c4/.initial={0}}
25355 \ctikzset{multipoles/flipflop/c5/.initial={0}}
25356 \ctikzset{multipoles/flipflop/c6/.initial={0}}
25357 \ctikzset{multipoles/flipflop/cu/.initial={0}}
25358 \ctikzset{multipoles/flipflop/cd/.initial={0}}
25359 % pin negation circle flags
25360 \ctikzset{multipoles/flipflop/n1/.initial={0}}
25361 \ctikzset{multipoles/flipflop/n2/.initial={0}}
25362 \ctikzset{multipoles/flipflop/n3/.initial={0}}
25363 \ctikzset{multipoles/flipflop/n4/.initial={0}}
25364 \ctikzset{multipoles/flipflop/n5/.initial={0}}
25365 \ctikzset{multipoles/flipflop/n6/.initial={0}}
25366 \ctikzset{multipoles/flipflop/nu/.initial={0}}
25367 \ctikzset{multipoles/flipflop/nd/.initial={0}}
25368
25369
25370 % Thanks to @marmot
25371 \tikzset{flipflop def/.code=\pgfqkeys{\circuitikzbasekey/multipoles/flipflop}{#1}}
25372
25373 % default set of flip flops
25374 \tikzset{
25375 % async
25376 latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, t4=\ctikztextnot{Q}}},
25377 flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, t4=\ctikztextnot{Q}}},
25378 % sync
25379 flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
25380 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, t4=\ctikztextnot{Q}}},
25381 flipflop JK/.style={flipflop, flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
25382 % additional features
25383 add async SR/.style={flipflop def={tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
25384 dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
25385 }
25386
25387 %
25388 % commodity macro to draw the clock wedges. They leave the size of the
25389 % wedge in \pgf@circ@res@temp so that a possible label can be displaced.
25390 %
25391 \def\pgf@circ@do@wedge@left{
25392 \pgf@circ@res@temp=0pt\relax
25393 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
25394 \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}}
25395 \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}}
25396 \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}}
25397 \pgfusepath{stroke}
25398 \pgf@circ@res@temp=\wedge
25399 \fi
25400 }
25401 \def\pgf@circ@do@wedge@right{
25402 \pgf@circ@res@temp=0pt\relax
25403 \ifnum\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}>0
25404 \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}}
25405 \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}}
25406 \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}}
25407 \pgfusepath{stroke}
25408 \pgf@circ@res@temp=-\wedge
25409 \fi
25410 }
25411 \def\pgf@circ@do@wedge@up{
25412 \pgf@circ@res@temp=0pt\relax
25413 \ifnum\ctikzvalof{multipoles/flipflop/cu}>0
25414 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@up}}
25415 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up-\wedge}}
25416 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@up}}
25417 \pgfusepath{stroke}
25418 \pgf@circ@res@temp=-\wedge
25419 \fi
25420 }
25421 \def\pgf@circ@do@wedge@down{
25422 \pgf@circ@res@temp=0pt\relax
25423 \ifnum\ctikzvalof{multipoles/flipflop/cd}>0
25424 \pgfpathmoveto{\pgfpoint{-\wedge}{\pgf@circ@res@down}}
25425 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down+\wedge}}
25426 \pgfpathlineto{\pgfpoint{\wedge}{\pgf@circ@res@down}}
25427 \pgfusepath{stroke}
25428 \pgf@circ@res@temp=\wedge
25429 \fi
25430 }
25431 % generic flip-flop shape
25432 \pgfdeclareshape{flipflop}{
25433 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
25434 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
25435 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
25436 \savedmacro\numpins{\def\numpins{6}}
25437 \savedanchor\centerpoint{%
25438 \pgf@x=-.5\wd\pgfnodeparttextbox%
25439 \pgf@y=-.5\ht\pgfnodeparttextbox%
25440 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
25441 }%
25442 \savedanchor\origin{\pgfpoint{0pt}{0pt}}
25443 \anchor{center}{\origin}
25444 \anchor{text}{\centerpoint}% to adjust text
25445 \saveddimen\height{%
25446 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25447 \pgfmathsetlength\pgf@x{((\numpins)
25448 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
25449 }%
25450 \saveddimen{\chipspacing}{
25451 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25452 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/pin spacing}}}
25453 \saveddimen{\width}{
25454 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25455 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}}
25456 \saveddimen{\extshift}{
25457 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25458 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
25459 % standard anchors
25460 \savedanchor\northwest{%
25461 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25462 \pgfmathsetlength\pgf@y{0.5*((\numpins)
25463 *\ctikzvalof{multipoles/flipflop/pin spacing})*\pgf@circ@scaled@Rlen/2}%
25464 \pgfmathsetlength\pgf@x{-0.5*\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/flipflop/width}}
25465 }
25466 \anchor{dot}{\northwest
25467 \pgfmathsetlength\pgf@x{\pgf@x + 0.3*\chipspacing}
25468 \pgfmathsetlength\pgf@y{\pgf@y - 0.3*\chipspacing}
25469 }
25470 \anchor{nw}{\northwest}
25471 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
25472 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
25473 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
25474 \anchor{north west}{\northwest}
25475 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
25476 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
25477 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
25478 \anchor{n}{\northwest\pgf@x=0pt }
25479 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
25480 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
25481 \anchor{w}{\northwest\pgf@y=0pt }
25482 \anchor{north}{\northwest\pgf@x=0pt }
25483 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
25484 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
25485 \anchor{west}{\northwest\pgf@y=0pt }
25486 % upper and lower pin
25487 \anchor{up}{\northwest\pgf@x=0pt\advance\pgf@y by\extshift }
25488 \anchor{down}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y\advance\pgf@y by-\extshift}
25489 \anchor{bup}{\northwest\pgf@x=0pt }
25490 \anchor{bdown}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
25491 % start drawing
25492 \pgf@circ@draw@component{%
25493 \northwest
25494 \pgf@circ@res@up = \pgf@y
25495 \pgf@circ@res@down = -\pgf@y
25496 \pgf@circ@res@right = -\pgf@x
25497 \pgf@circ@res@left = \pgf@x
25498 \pgf@circ@scaled@Rlen=\scaledRlen
25499 \pgf@circ@res@step = \ctikzvalof{multipoles/flipflop/pin spacing}\pgf@circ@scaled@Rlen
25500 \pgf@circ@res@other = \ctikzvalof{multipoles/external pins width}\pgf@circ@scaled@Rlen
25501 \pgf@circ@setcolor
25502 \pgfscope% (for the line width)
25503 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
25504 \pgfpathrectanglecorners{\pgfpoint{-\width/2}{-\height/2}}{\pgfpoint{\width/2}{\height/2}}%
25505 \pgf@circ@draworfill
25506 \pgfusepath{stroke}%
25507 \endpgfscope
25508 % Adding the pin number
25509 \pgf@circ@count@a=\numpins\relax
25510 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
25511 % thanks to @marmot: https://tex.stackexchange.com/a/473571/38080
25512 \ifpgf@circuit@chip@straightnumbers
25513 \pgfgettransformentries\a\b\temp\temp\temp\temp
25514 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
25515 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
25516 \else
25517 \pgfmathsetmacro{\rot}{0}
25518 \pgfmathsetmacro{\quadrant}{0}
25519 \fi
25520 \def\pgf@circ@strut{\vrule width 0pt height 1em depth 0.4em\relax}
25521 \pgfscope\pgf@circ@text@strokecolor
25522 % text
25523 \def\mytext{\ctikzvalof{multipoles/flipflop/font}\space
25524 \ctikzvalof{multipoles/flipflop/t\the\pgf@circ@count@c}%
25525 \pgf@circ@strut\space}
25526 % \typeout{TEXT\space\mytext}
25527 \pgfmathloop%
25528 \def\wedge{\ctikzvalof{multipoles/flipflop/clock wedge size}\pgf@circ@res@step}
25529 \pgf@circ@res@temp=0pt\relax
25530 \ifnum\pgf@circ@count@a>0
25531 \ifcase\quadrant % rotation 0
25532 % left
25533 \pgf@circ@count@c=\pgf@circ@count@a
25534 \pgf@circ@do@wedge@left
25535 % \typeout{TEXT Left Q1\space\mytext}
25536 \pgftext[left,
25537 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},
25538 rotate=\rot]{\mytext}
25539 % right
25540 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25541 \pgf@circ@do@wedge@right
25542 \pgftext[right,
25543 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},
25544 rotate=\rot]{\mytext}
25545 \or % rotation -90
25546 % left
25547 \pgf@circ@count@c=\pgf@circ@count@a
25548 \pgf@circ@do@wedge@left
25549 \pgftext[top,
25550 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},
25551 rotate=\rot]{\mytext}
25552 % right
25553 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25554 \pgf@circ@do@wedge@right
25555 \pgftext[bottom,
25556 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},
25557 rotate=\rot]{\mytext}
25558 \or %rotation 180
25559 % left
25560 \pgf@circ@count@c=\pgf@circ@count@a
25561 \pgf@circ@do@wedge@left
25562 \pgftext[right,
25563 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},
25564 rotate=\rot]{\mytext}
25565 % right
25566 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25567 \pgf@circ@do@wedge@right
25568 \pgftext[left,
25569 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},
25570 rotate=\rot]{\mytext}
25571 \or % rotation +90
25572 % left
25573 \pgf@circ@count@c=\pgf@circ@count@a
25574 \pgf@circ@do@wedge@left
25575 \pgftext[bottom,
25576 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},
25577 rotate=\rot]{\mytext}
25578 % right
25579 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25580 \pgf@circ@do@wedge@right
25581 \pgftext[top,
25582 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},
25583 rotate=\rot]{\mytext}
25584 \fi
25585 \advance\pgf@circ@count@a-1\relax%
25586 \repeatpgfmathloop
25587 % Now the up and down text
25588 % up
25589 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/tu}\space}
25590 \pgf@circ@do@wedge@up
25591 \ifcase\quadrant % rotation 0
25592 \pgftext[top,
25593 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
25594 rotate=\rot]{\mytext}
25595 \or % rotation -90
25596 \pgftext[right,
25597 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
25598 rotate=\rot]{\mytext}
25599 \or %rotation 180
25600 \pgftext[bottom,
25601 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
25602 rotate=\rot]{\mytext}
25603 \or % rotation +90
25604 \pgftext[left,
25605 at=\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@temp},
25606 rotate=\rot]{\mytext}
25607 \fi
25608 % down
25609 \def\mytext{\ctikzvalof{multipoles/flipflop/fontud}\space\pgf@circ@strut\ctikzvalof{multipoles/flipflop/td}\space}
25610 \pgf@circ@do@wedge@down
25611 \ifcase\quadrant % rotation 0
25612 \pgftext[bottom,
25613 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
25614 rotate=\rot]{\mytext}
25615 \or % rotation -90
25616 \pgftext[left,
25617 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
25618 rotate=\rot]{\mytext}
25619 \or %rotation 180
25620 \pgftext[top,
25621 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
25622 rotate=\rot]{\mytext}
25623 \or % rotation +90
25624 \pgftext[right,
25625 at=\pgfpoint{0pt}{\pgf@circ@res@down+\pgf@circ@res@temp},
25626 rotate=\rot]{\mytext}
25627 \fi
25628 \endpgfscope % for text labels
25629 % external pins
25630 \ifdim\pgf@circ@res@other>0pt
25631 \pgfscope
25632 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
25633 \pgf@circ@count@a=\numpins\relax
25634 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
25635 \pgfmathloop%
25636 \ifnum\pgf@circ@count@a>0
25637 % left side pins
25638 \pgf@circ@count@c=\pgf@circ@count@a
25639 %% we draw the pin only if it's defined either a text, a clock wedge or a not pin
25640 %% Or'ing tests in core TeX is tough
25641 \edef\@@or{0}
25642 % Just expand the key the minimum needed
25643 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
25644 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
25645 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
25646 \ifnum\@@tmp>0\edef\@@or{1}\fi
25647 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
25648 \ifnum\@@tmp>0\edef\@@or{1}\fi
25649 \ifnum\@@or>0
25650 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
25651 \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}}
25652 \pgfusepath{stroke}
25653 \fi
25654 % right side pins
25655 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25656 \edef\@@or{0}
25657 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/t\the\pgf@circ@count@c}}\edef\@@x{x}
25658 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
25659 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/c\the\pgf@circ@count@c}}
25660 \ifnum\@@tmp>0\edef\@@or{1}\fi
25661 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
25662 \ifnum\@@tmp>0\edef\@@or{1}\fi
25663 % \typeout{TEST\space\@@tmp\space\@@x}
25664 \ifnum\@@or>0
25665 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
25666 \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}}
25667 \pgfusepath{stroke}
25668 \fi
25669 \advance\pgf@circ@count@a by -1\relax%
25670 \repeatpgfmathloop
25671 % up side
25672 \edef\@@or{0}
25673 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/tu}}\edef\@@x{x}
25674 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
25675 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cu}}
25676 \ifnum\@@tmp>0\edef\@@or{1}\fi
25677 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
25678 \ifnum\@@tmp>0\edef\@@or{1}\fi
25679 % \typeout{TEST\space\@@tmp\space\@@x}
25680 \ifnum\@@or>0
25681 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
25682 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up+\pgf@circ@res@other}}
25683 \pgfusepath{stroke}
25684 \fi
25685 % down side
25686 \edef\@@or{0}
25687 \edef\@@tmp{x\unexpandedvalueof{/tikz/circuitikz/multipoles/flipflop/td}}\edef\@@x{x}
25688 \ifx\@@tmp\@@x\else\edef\@@or{1}\fi
25689 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/cd}}
25690 \ifnum\@@tmp>0\edef\@@or{1}\fi
25691 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
25692 \ifnum\@@tmp>0\edef\@@or{1}\fi
25693 % \typeout{TEST\space\@@tmp\space\@@x}
25694 \ifnum\@@or>0
25695 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@down}}
25696 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@down-\pgf@circ@res@other}}
25697 \pgfusepath{stroke}
25698 \fi
25699 \endpgfscope
25700 \fi % external pin width >0
25701 %
25702 % draw "inverting" circles on outputs, they must be last
25703 %
25704 \pgfscope
25705 \ifpgf@circuit@ieeelogicport
25706 \def\@@notcirc{notcirc}
25707 \else
25708 \ifpgf@circ@european@port@circle@ieee
25709 \def\@@notcirc{notcirc}
25710 \else
25711 \def\@@notcirc{ocirc}
25712 \fi
25713 \fi
25714 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
25715 \pgf@circ@count@a=\numpins\relax
25716 \divide\pgf@circ@count@a by 2 \pgf@circ@count@b=\pgf@circ@count@a
25717 \pgfmathloop%
25718 \ifnum\pgf@circ@count@a>0
25719 % left side pins
25720 \pgf@circ@count@c=\pgf@circ@count@a
25721 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
25722 \ifnum\@@tmp>0\pgfscope
25723 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
25724 \pgfnode{\@@notcirc}{east}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
25725 \endpgfscope\fi
25726 % right side pins
25727 \pgf@circ@count@c=\numexpr2*\pgf@circ@count@b-\pgf@circ@count@a+1\relax
25728 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/n\the\pgf@circ@count@c}}
25729 \ifnum\@@tmp>0\pgfscope
25730 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(\pgf@circ@dip@pin@shift-\the\pgf@circ@count@a)*\pgf@circ@res@step}}
25731 \pgfnode{\@@notcirc}{west}{}{\thisshape-N\the\pgf@circ@count@c}{\pgfusepath{stroke}}
25732 \endpgfscope\fi
25733 \advance\pgf@circ@count@a by -1\relax%
25734 \repeatpgfmathloop
25735 % up side
25736 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nu}}
25737 \ifnum\@@tmp>0\pgfscope
25738 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
25739 \pgfnode{\@@notcirc}{south}{}{\thisshape-Nu}{\pgfusepath{stroke}}
25740 \endpgfscope\fi
25741 % down side
25742 \edef\@@tmp{\ctikzvalof{multipoles/flipflop/nd}}
25743 \ifnum\@@tmp>0\pgfscope
25744 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@down}}
25745 \pgfnode{\@@notcirc}{north}{}{\thisshape-Nd}{\pgfusepath{stroke}}
25746 \endpgfscope\fi
25747 \endpgfscope
25748 }%
25749 % \pgf@sh@s@<name of the shape here> contains all the code for the shape
25750 % and is executed just before a node is drawn.
25751 \pgfutil@g@addto@macro\pgf@sh@s@flipflop{%
25752 % Start with the maximum pin number and go backwards.
25753 \pgf@circ@count@a=\numpins\relax
25754 \pgfmathloop%
25755 \ifnum\pgf@circ@count@a>0
25756 % we will create two anchors per pin: the "normal one" like `pin 1` for the
25757 % electrical contact, and the "border one" like `bpin 1` for labels.
25758 % they will coincide if `external pins width` is set to 0.
25759 \expandafter\xdef\csname pgf@anchor@flipflop@pin\space\the\pgf@circ@count@a\endcsname{%
25760 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{1}%
25761 }
25762 \expandafter\xdef\csname pgf@anchor@flipflop@bpin\space\the\pgf@circ@count@a\endcsname{%
25763 \noexpand\pgf@circ@dippinanchor{\the\pgf@circ@count@a}{0}%
25764 }
25765 \advance\pgf@circ@count@a by -1\relax%
25766 \repeatpgfmathloop%
25767 }%
25768 }
25769
25770 % clock wedge shape, for using in other shapes like muxdemuxes
25771 \pgfdeclareshape{clockwedge}{
25772 \savedmacro{\ctikzclass}{\edef\ctikzclass{flipflops}}
25773 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
25774 \savedanchor{\northeast}{
25775 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
25776 \pgfmathsetlength{\pgf@circ@res@step}{\ctikzvalof{multipoles/flipflop/clock wedge size}*\ctikzvalof{multipoles/flipflop/pin spacing}*\pgf@circ@scaled@Rlen}
25777 \pgf@y=\pgf@circ@res@step
25778 \pgf@x=\pgf@circ@res@step
25779 }
25780 \anchor{center}{\pgfpointorigin}
25781 \anchor{north west}{\northeast\pgf@x=0pt }
25782 \anchor{north east}{\northeast}
25783 \anchor{south east}{\northeast\pgf@y=-\pgf@y}
25784 \anchor{south west}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt }
25785 \anchor{north}{\northeast\pgf@x=0.5\pgf@x }
25786 \anchor{east}{\northeast\pgf@y=0pt }
25787 \anchor{south}{\northeast\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
25788 \anchor{west}{\pgfpointorigin}
25789 \anchor{nw}{\northeast\pgf@x=0pt }
25790 \anchor{ne}{\northeast}
25791 \anchor{se}{\northeast\pgf@y=-\pgf@y}
25792 \anchor{sw}{\northeast\pgf@y=-\pgf@y\pgf@x=0pt }
25793 \anchor{n}{\northeast\pgf@x=0.5\pgf@x }
25794 \anchor{e}{\northeast\pgf@y=0pt }
25795 \anchor{s}{\northeast\pgf@x=0.5\pgf@x\pgf@y=-\pgf@y}
25796 \anchor{w}{\pgfpointorigin}
25797 \anchor{left}{\pgfpointorigin}
25798 \anchor{right}{\northeast\pgf@y=0pt }
25799 \anchor{text}{\northeast\advance \pgf@x by 2pt
25800 \pgf@y=\dimexpr.5\dp\pgfnodeparttextbox-.5\ht\pgfnodeparttextbox\relax}% to adjust text
25801 \pgf@circ@draw@component{%
25802 \northeast
25803 \pgf@circ@res@up=\pgf@y
25804 \pgf@circ@res@right=\pgf@x
25805 \pgfpathmoveto{\pgfpoint{0pt}{\pgf@circ@res@up}}
25806 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
25807 \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@up}}
25808 \pgfusepath{stroke}
25809 }
25810 }
25811
25812 % %>>>
25813
25814 %% Node shapes for mux-demuxes%<<<
25815
25816 %
25817 % MUX-DEMUXES
25818 %
25819 % predefined muxdemux shapes (see manual)
25820 %
25821 \tikzset{demux/.style={muxdemux, muxdemux def={Lh=4, Rh=8, NL=1, NB=3, NR=8}}}
25822 \tikzset{one bit adder/.style={muxdemux,
25823 muxdemux def={Lh=4, NL=2, Rh=2, NR=1, NB=1, w=1.5,
25824 inset w=0.5, inset Lh=2, inset Rh=1.5}}}
25825 \tikzset{ALU/.style={muxdemux,
25826 muxdemux def={Lh=5, NL=2, Rh=2, NR=1, NB=2, NT=1, w=2,
25827 inset w=1, inset Lh=2, inset Rh=0, square pins=1}}}
25828 %generic mux-demux shape
25829 % helper macros to set the anchors inside a loop (to expand the current count)
25830 % left
25831 \pgfutil@protected\def\pgf@circ@make@muxdemux@L@anchor#1%
25832 {%
25833 \expandafter\gdef\csname pgf@anchor@muxdemux@lpin #1\endcsname
25834 {%
25835 \pgf@circ@if@num@in@list\pgf@circ@Lpins@list{#1}
25836 {\pgf@circ@muxdemux@L@anchor{#1}{1}}
25837 {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
25838 }%
25839 \expandafter\gdef\csname pgf@anchor@muxdemux@blpin #1\endcsname
25840 {\pgf@circ@muxdemux@L@anchor{#1}{0}}%
25841 }
25842 % right
25843 \pgfutil@protected\def\pgf@circ@make@muxdemux@R@anchor#1%
25844 {%
25845 \expandafter\gdef\csname pgf@anchor@muxdemux@rpin #1\endcsname
25846 {%
25847 \pgf@circ@if@num@in@list\pgf@circ@Rpins@list{#1}
25848 {\pgf@circ@muxdemux@R@anchor{#1}{1}}
25849 {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
25850 }%
25851 \expandafter\gdef\csname pgf@anchor@muxdemux@brpin #1\endcsname
25852 {\pgf@circ@muxdemux@R@anchor{#1}{0}}%
25853 }
25854 % bottom
25855 \pgfutil@protected\def\pgf@circ@make@muxdemux@B@anchor#1%
25856 {%
25857 \expandafter\gdef\csname pgf@anchor@muxdemux@bpin #1\endcsname
25858 {%
25859 \pgf@circ@if@num@in@list\pgf@circ@Bpins@list{#1}
25860 {\pgf@circ@muxdemux@B@anchor{#1}{1}}
25861 {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
25862 }%
25863 \expandafter\gdef\csname pgf@anchor@muxdemux@bbpin #1\endcsname
25864 {\pgf@circ@muxdemux@B@anchor{#1}{0}}%
25865 }
25866 % top
25867 \pgfutil@protected\def\pgf@circ@make@muxdemux@T@anchor#1%
25868 {%
25869 \expandafter\gdef\csname pgf@anchor@muxdemux@tpin #1\endcsname
25870 {%
25871 \pgf@circ@if@num@in@list\pgf@circ@Tpins@list{#1}
25872 {\pgf@circ@muxdemux@T@anchor{#1}{1}}
25873 {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
25874 }%
25875 \expandafter\gdef\csname pgf@anchor@muxdemux@btpin #1\endcsname
25876 {\pgf@circ@muxdemux@T@anchor{#1}{0}}%
25877 }
25878 %% put some label somewhere
25879 \def\pgf@circ@muxdemux@label@xy#1#2#3#4#5#6#7{%
25880 % #1: which label: L,R,T,B or the outer ones with U/D/R/L
25881 % #2: rotation
25882 % #3: scale pad x
25883 % #4: scale pad y
25884 % #5: text position
25885 % #6: operation on label text
25886 % #7: type: inner, outer, border
25887 % uses external variables \pgf@circ@count@a unless it's zero, in which case omit it
25888 \ifnum\pgf@circ@count@a=0
25889 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1}
25890 \else
25891 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
25892 \fi
25893 \pgfkeysifdefined{\@@thislabel}{%
25894 \pgfscope
25895 \pgftransformrotate{#2}
25896 \pgfmathsetlength\pgf@circ@res@zero{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label xsep}}
25897 \pgfmathsetlength\pgf@circ@res@other{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label ysep}}
25898 %%% temp is added when we have wedges; it's a bit of a hack but it works if #3,#4 are -1,0,+1
25899 \pgftransformxshift{(#3)*(\pgf@circ@res@zero+\pgf@circ@res@temp)}
25900 \pgftransformyshift{(#4)*(\pgf@circ@res@other+\pgf@circ@res@temp)}
25901 % Ok, now we have the point in the correct position, we add the label
25902 \pgftext[#5]{\pgfkeysvalueof{\circuitikzbasekey/muxdemux/#7 label font}%
25903 \expandafter\csname#6\endcsname{\pgfkeysvalueof{\@@thislabel}}}
25904 \endpgfscope
25905 }{}
25906 }
25907 %% put a clock wedge here
25908 \def\pgf@circ@muxdemux@clockwedge#1#2{%
25909 % #1: which label: cL,cR,cT,cB
25910 % #2: rotation
25911 % uses external variables \pgf@circ@count@a
25912 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
25913 \pgfkeysifdefined{\@@thislabel}{%
25914 \edef\value{\pgfkeysvalueof{\@@thislabel}}
25915 \ifnum\value=0
25916 \pgf@circ@res@temp=0pt
25917 \else\pgfscope
25918 \pgftransformrotate{#2}
25919 \pgfpathmoveto{\pgfpoint{+0pt}{-\clockwedge}}
25920 \pgfpathlineto{\pgfpoint{\clockwedge}{+0pt}}
25921 \pgfpathlineto{\pgfpoint{+0pt}{\clockwedge}}
25922 \pgfusepath{draw}
25923 \endpgfscope
25924 \pgf@circ@res@temp=\clockwedge
25925 \fi
25926 }{}
25927 }
25928 %% put a negation here
25929 \def\pgf@circ@muxdemux@not@ball#1#2{%
25930 % #1: which label: nL,nR,nT,nB
25931 % #2: anchor
25932 % uses external variables \pgf@circ@count@a
25933 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
25934 \pgfkeysifdefined{\@@thislabel}{%
25935 \edef\value{\pgfkeysvalueof{\@@thislabel}}
25936 \ifnum\value=0
25937 \else
25938 \pgfnode{\@@notcirc}{#2}{}{\thisshape-#1\the\pgf@circ@count@a}{\pgfusepath{stroke}}
25939 \fi
25940 }{}
25941 }
25942 %% put a negation wedge here
25943 \def\pgf@circ@muxdemux@not@wedge#1#2#3#4#5{%
25944 % #1: which label: wi/wp with L,R,T,B
25945 % #2: anchor
25946 % #3: xscale
25947 % #4: yscale
25948 % #5: rotation
25949 % uses external variables \pgf@circ@count@a
25950 \edef\@@thislabel{\circuitikzbasekey/multipoles/muxdemux/label/#1\the\pgf@circ@count@a}
25951 \pgfkeysifdefined{\@@thislabel}{%
25952 \edef\value{\pgfkeysvalueof{\@@thislabel}}
25953 \ifnum\value=0
25954 \else\pgfscope
25955 \pgftransformrotate{#5}
25956 \pgftransformxscale{#3}
25957 \pgftransformyscale{#4}
25958 \pgftransformyscale{\value}% to flip
25959 \pgfnode{wedgeinv}{#2}{}{\thisshape-#1\the\pgf@circ@count@a}{\pgfusepath{stroke}}
25960 \endpgfscope\fi
25961 }{}
25962 }
25963 %
25964 \pgfdeclareshape{muxdemux}{
25965 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
25966 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
25967 \savedmacro{\thisshape}{\def\thisshape{\tikz@fig@name}}
25968 % pins on the four sides
25969 \savedmacro\NL{\edef\NL{\ctikzvalof{multipoles/muxdemux/NL}}}
25970 \savedmacro\NR{\edef\NR{\ctikzvalof{multipoles/muxdemux/NR}}}
25971 \savedmacro\NT{\edef\NT{\ctikzvalof{multipoles/muxdemux/NT}}}
25972 \savedmacro\NB{\edef\NB{\ctikzvalof{multipoles/muxdemux/NB}}}
25973 \savedmacro\squarepins{\edef\squarepins{\ctikzvalof{multipoles/muxdemux/square pins}}}
25974 % pin lists
25975 \savedmacro\pgf@circ@Lpins@list
25976 {%
25977 \pgfkeysgetvalue
25978 {\circuitikzbasekey/multipoles/draw only left pins}\pgf@circ@temp
25979 \expandafter\pgf@circ@set@list
25980 \expandafter\pgf@circ@Lpins@list
25981 \expandafter{\pgf@circ@temp}%
25982 }%
25983 \savedmacro\pgf@circ@Rpins@list
25984 {%
25985 \pgfkeysgetvalue
25986 {\circuitikzbasekey/multipoles/draw only right pins}\pgf@circ@temp
25987 \expandafter\pgf@circ@set@list
25988 \expandafter\pgf@circ@Rpins@list
25989 \expandafter{\pgf@circ@temp}%
25990 }%
25991 \savedmacro\pgf@circ@Tpins@list
25992 {%
25993 \pgfkeysgetvalue
25994 {\circuitikzbasekey/multipoles/draw only top pins}\pgf@circ@temp
25995 \expandafter\pgf@circ@set@list
25996 \expandafter\pgf@circ@Tpins@list
25997 \expandafter{\pgf@circ@temp}%
25998 }%
25999 \savedmacro\pgf@circ@Bpins@list
26000 {%
26001 \pgfkeysgetvalue
26002 {\circuitikzbasekey/multipoles/draw only bottom pins}\pgf@circ@temp
26003 \expandafter\pgf@circ@set@list
26004 \expandafter\pgf@circ@Bpins@list
26005 \expandafter{\pgf@circ@temp}%
26006 }%
26007 % topleft and topright sizes
26008 \savedanchor{\topleft}{%
26009 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26010 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Lh}*\pgf@circ@scaled@Rlen/2}
26011 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
26012 }
26013 \savedanchor{\topright}{%
26014 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26015 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/Rh}*\pgf@circ@scaled@Rlen/2}
26016 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
26017 }
26018 \savedanchor{\insetnortheast}{%
26019 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26020 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Lh}*\pgf@circ@scaled@Rlen/2}
26021 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*
26022 (\ctikzvalof{multipoles/muxdemux/w}-2*\ctikzvalof{multipoles/muxdemux/inset w})*\pgf@circ@scaled@Rlen/2}
26023 }
26024 \saveddimen{\insethright}{
26025 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26026 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/inset Rh}*\pgf@circ@scaled@Rlen/2}}
26027 \saveddimen{\extshift}{
26028 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26029 \pgfmathsetlength\pgf@x{\pgf@circ@scaled@Rlen*\ctikzvalof{multipoles/external pins width}}}
26030 \savedanchor{\northwest}{%
26031 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26032 \pgfmathsetlength\pgf@y{\ctikzvalof{multipoles/muxdemux/base len}*max(\ctikzvalof{multipoles/muxdemux/Rh},\ctikzvalof{multipoles/muxdemux/Lh})*\pgf@circ@scaled@Rlen/2}
26033 \pgfmathsetlength\pgf@x{-\ctikzvalof{multipoles/muxdemux/base len}*\ctikzvalof{multipoles/muxdemux/w}*\pgf@circ@scaled@Rlen/2}
26034 }
26035 \anchor{nw}{\northwest}
26036 \anchor{ne}{\northwest\pgf@x=-\pgf@x}
26037 \anchor{se}{\northwest\pgf@x=-\pgf@x\pgf@y=-\pgf@y}
26038 \anchor{sw}{\northwest\pgf@y=-\pgf@y}
26039 \anchor{north west}{\northwest}
26040 \anchor{north east}{\northwest\pgf@x=-\pgf@x}
26041 \anchor{south east}{\northwest\pgf@x=-\pgf@x \pgf@y=-\pgf@y}
26042 \anchor{south west}{\northwest\pgf@y=-\pgf@y}
26043 \anchor{n}{\northwest\pgf@x=0pt }
26044 \anchor{e}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
26045 \anchor{s}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
26046 \anchor{w}{\northwest\pgf@y=0pt }
26047 \anchor{north}{\northwest\pgf@x=0pt }
26048 \anchor{east}{\northwest\pgf@x=-\pgf@x\pgf@y=0pt }
26049 \anchor{south}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
26050 \anchor{west}{\northwest\pgf@y=0pt }
26051 \anchor{center}{\pgfpointorigin}
26052 \anchor{top right}{\topright}
26053 \anchor{bottom right}{\topright\pgf@y=-\pgf@y}
26054 \anchor{right}{\topright\pgf@y=0pt\relax}
26055 \anchor{top left}{\topleft}
26056 \anchor{bottom left}{\topleft\pgf@y=-\pgf@y}
26057 \anchor{left}{\topleft\pgf@y=0pt\relax}
26058 \anchor{top}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
26059 \divide\pgf@y by 2 \pgf@x=0pt\relax}
26060 \anchor{bottom}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
26061 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
26062 \anchor{inset top right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya}
26063 \anchor{inset bottom right}{\pgf@ya=\insethright\insetnortheast\advance\pgf@y by -0.5\pgf@ya\pgf@y=-\pgf@y}
26064 \anchor{inset right}{\insetnortheast\pgf@y=0pt\relax}
26065 \anchor{inset top left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=\pgf@ya}
26066 \anchor{inset bottom left}{\insetnortheast\pgf@ya=\pgf@y\topleft\pgf@y=-\pgf@ya}
26067 \anchor{inset left}{\topleft\pgf@y=0pt\relax}
26068 \anchor{inset bottom}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
26069 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
26070 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{-\pgf@ya+\pgf@yb/2}}
26071 \anchor{inset top}{\topleft\pgf@xa=\pgf@x\pgf@ya=\insethright
26072 \insetnortheast\pgf@xb=\pgf@x\pgf@yb=\pgf@x
26073 \pgfpoint{(\pgf@xa+\pgf@xb)/2}{\pgf@ya-\pgf@yb/2}}
26074 \anchor{inset center}{\topleft\pgf@xa=\pgf@x\insetnortheast
26075 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2 \pgf@y=0pt\relax}
26076 \anchor{narrow center}{\insetnortheast\pgf@xa=\pgf@x\topright
26077 \advance\pgf@x by \pgf@xa \divide\pgf@x by 2\pgf@y=0pt\relax}
26078 \anchor{center up}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
26079 \divide\pgf@y by 2
26080 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
26081 \divide\pgf@y by 2 \pgf@x=0pt\relax}
26082 \anchor{center down}{\topright\pgf@ya=\pgf@y \topleft \advance\pgf@y by \pgf@ya
26083 \divide\pgf@y by 2
26084 \pgf@yb = \insethright \advance\pgf@y by \pgf@yb
26085 \divide\pgf@y by 2 \pgf@y=-\pgf@y \pgf@x=0pt\relax}
26086 \anchor{text}{%
26087 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26088 \pgfmathsetlength\pgf@x{\ctikzvalof{multipoles/muxdemux/base len}*
26089 \ctikzvalof{multipoles/muxdemux/inset w}*\pgf@circ@scaled@Rlen/2}
26090 \advance\pgf@x by -.5\wd\pgfnodeparttextbox%
26091 \pgf@y=-.5\ht\pgfnodeparttextbox%
26092 \advance\pgf@y by+.5\dp\pgfnodeparttextbox%
26093 }%
26094 \pgf@circ@draw@component{%
26095 \topleft
26096 \pgf@circ@res@up = \pgf@y
26097 \pgf@circ@res@down = -\pgf@y
26098 \pgf@circ@res@left = \pgf@x
26099 \topright
26100 \pgf@circ@res@other = \pgf@y
26101 \pgf@circ@res@right = \pgf@x
26102 \insetnortheast
26103 \pgf@circ@res@step = \pgf@x
26104 \pgf@circ@res@temp = \pgf@y
26105 %
26106 % draw the (user-selectable) background
26107 %
26108 \pgfscope
26109 \pgfmathsetmacro{\@@scalex}{\pgf@circ@res@right/1cm}
26110 % It's better not to change the scale in an asymmetric way
26111 % \pgfmathsetmacro{\@@scaley}{\pgf@circ@res@up/1cm}
26112 \pgftransformxscale{\@@scalex}
26113 \pgftransformyscale{\@@scalex}
26114 \pgf@circ@setlinewidth{multipoles}{\pgfstartlinewidth}
26115 \pgfkeys{\circuitikzbasekey/multipoles/muxdemux/bgpicture}
26116 \endpgfscope
26117 %
26118 % external block
26119 %
26120 \pgfscope% (for the line width)
26121 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
26122 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
26123 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@other}}
26124 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{-\pgf@circ@res@other}}
26125 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
26126 % inset, starting down
26127 \ifdim\pgf@circ@res@temp>0pt % inset
26128 % \typeout{INSETw\space\the\pgf@circ@res@right\space x\space\the\pgf@circ@res@step\space y\space\the\pgf@circ@res@temp}
26129 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{-\pgf@circ@res@temp}}
26130 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\insethright}}
26131 \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{\insethright}}
26132 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@temp}}
26133 \fi
26134 \pgfpathclose
26135 \pgf@circ@draworfill
26136 \endpgfscope
26137 % now we have to draw the pins, if needed
26138 \ifdim\extshift>0pt\ifpgfcirc@draw@input@leads\pgfscope % let's avoid too much indent
26139 % Ok, we have to draw the leads (a.k.a. pins)
26140 \pgfsetlinewidth{\ctikzvalof{multipoles/external pins thickness}\pgflinewidth}
26141 % We mimic the anchors here --- probably there is a better way
26142 % left pins
26143 \ifnum\NL>0\relax % not indented, closed on \repeatpgfmathloop
26144 \pgf@circ@count@a=\NL\relax
26145 \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
26146 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26147 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26148 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
26149 % we have to check oddity
26150 \ifodd\NL
26151 \ifnum\NL=1
26152 % only centerpin, step should not be used, but anyway...
26153 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
26154 \else
26155 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
26156 \fi
26157 \else
26158 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
26159 \fi
26160 \else % no inset
26161 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
26162 \fi
26163 \pgfmathloop%
26164 \ifnum\pgf@circ@count@a>0
26165 %%%%% check if we want to draw this pin
26166 \pgf@circ@if@num@in@list\pgf@circ@Lpins@list\pgf@circ@count@a{%
26167 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
26168 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
26169 % for lower pins we have to shift them down
26170 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
26171 \ifodd\NL
26172 % odd number of pins
26173 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
26174 % centerpin!
26175 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0pt}}
26176 \ifnum\squarepins>0
26177 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{0pt}}
26178 \else
26179 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\extshift}{0pt}}
26180 \fi
26181 \else
26182 \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}}
26183 \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}}
26184 \fi
26185 \else
26186 % even numer of pins: just go down
26187 \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}}
26188 \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}}
26189 \fi
26190 \else
26191 % nothing need for #1<=NL/2
26192 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26193 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26194 \fi
26195 \else
26196 % no inset
26197 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26198 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left-\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26199 \fi
26200 %%%%%
26201 }{}% close the pin list check
26202 \advance\pgf@circ@count@a by -1\relax%
26203 \repeatpgfmathloop\fi%
26204 % right pins
26205 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
26206 \pgfmathloop%
26207 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
26208 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
26209 \ifnum\pgf@circ@count@a>0
26210 %%%%% check if we want to draw this pin
26211 \pgf@circ@if@num@in@list\pgf@circ@Rpins@list\pgf@circ@count@a{%
26212 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26213 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right+\extshift}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26214 }{}%
26215 \advance\pgf@circ@count@a by -1\relax%
26216 \repeatpgfmathloop\fi%
26217 % bottom pins
26218 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
26219 \pgfmathloop%
26220 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26221 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26222 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
26223 \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}
26224 \ifnum\pgf@circ@count@a>0
26225 %%%%% check if we want to draw this pin
26226 \pgf@circ@if@num@in@list\pgf@circ@Bpins@list\pgf@circ@count@a{%
26227 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26228 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
26229 \ifnum\squarepins>0
26230 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26231 {-max(\pgf@circ@res@down, \pgf@circ@res@up)-\extshift}}
26232 \else
26233 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26234 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other-\extshift}}
26235 \fi
26236 }{}%
26237 \advance\pgf@circ@count@a by -1\relax%
26238 \repeatpgfmathloop\fi%
26239 % top pins
26240 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
26241 \pgfmathloop%
26242 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26243 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26244 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
26245 \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}
26246 \ifnum\pgf@circ@count@a>0
26247 %%%%% check if we want to draw this pin
26248 \pgf@circ@if@num@in@list\pgf@circ@Tpins@list\pgf@circ@count@a{%
26249 \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26250 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
26251 \ifnum\squarepins>0
26252 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26253 {max(\pgf@circ@res@down, \pgf@circ@res@up)+\extshift}}
26254 \else
26255 \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26256 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other+\extshift}}
26257 \fi
26258 }{}%
26259 \advance\pgf@circ@count@a by -1\relax%
26260 \repeatpgfmathloop\fi%
26261 % end drawing pins; stroke them
26262 \pgfusepath{stroke}
26263 \endpgfscope\fi\fi
26264 %%%% Labels. Added by Romano 14/10/2023.
26265 % manage labels. This is independent from the drawing of pins; redo the loops. Surely
26266 % there is a better way; but it's complex to factor out code. Let's go the KISS way.
26267 \ifpgf@circuit@chip@straightnumbers
26268 \pgfgettransformentries\a\b\temp\temp\temp\temp
26269 \pgfmathsetmacro{\rot}{-atan2(\b,\a)}
26270 \pgfmathtruncatemacro{\quadrant}{mod(4+int(360+(\rot+45)/90),4)}
26271 \else
26272 \pgfmathsetmacro{\rot}{0}
26273 \pgfmathsetmacro{\quadrant}{0}
26274 \fi
26275 % clockwedge size
26276 \pgfmathsetlength{\pgf@circ@res@temp}{\ctikzvalof{muxdemux/clock wedge size}*\ctikzvalof{multipoles/muxdemux/base len}*\scaledRlen}
26277 \edef\clockwedge{\the\pgf@circ@res@temp}
26278 % select which negation ball to use
26279 \ifpgf@circuit@ieeelogicport
26280 \def\@@notcirc{circleinv}
26281 \else
26282 \ifpgf@circ@european@port@circle@ieee
26283 \def\@@notcirc{circleinv}
26284 \else
26285 \def\@@notcirc{ocirc}
26286 \fi
26287 \fi
26288 %% border labels
26289 \pgf@circ@res@temp=0pt
26290 \pgf@circ@count@a=0
26291 % go to north
26292 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26293 \pgfscope
26294 \pgftransformshift{\pgfpoint{0pt}{\pgf@circ@res@up}}
26295 \ifnum\quadrant=2
26296 \pgf@circ@muxdemux@label@xy{N}{180}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26297 \pgf@circ@muxdemux@label@xy{Ni}{180}{0}{1}{bottom}{pgfcirc@nop}{border}%
26298 \else
26299 \pgf@circ@muxdemux@label@xy{N}{0}{0}{1}{bottom}{pgfcirc@nop}{border}%
26300 \pgf@circ@muxdemux@label@xy{Ni}{0}{0}{-1}{top}{pgfcirc@nop}{border}%
26301 \fi
26302 \endpgfscope
26303 % go south!
26304 \pgfscope
26305 \pgftransformshift{\pgfpoint{0pt}{-\pgf@circ@res@up}}
26306 \ifnum\quadrant=2
26307 \pgf@circ@muxdemux@label@xy{S}{180}{0}{1}{bottom}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26308 \pgf@circ@muxdemux@label@xy{Si}{180}{0}{-1}{top}{pgfcirc@nop}{border}%
26309 \else
26310 \pgf@circ@muxdemux@label@xy{S}{0}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26311 \pgf@circ@muxdemux@label@xy{Si}{0}{0}{1}{bottom}{pgfcirc@nop}{border}%
26312 \fi
26313 \endpgfscope
26314 % go west!
26315 \pgfscope
26316 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{0pt}}
26317 \ifnum\quadrant=3
26318 \pgf@circ@muxdemux@label@xy{W}{-90}{0}{-1}{top}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26319 \pgf@circ@muxdemux@label@xy{Wi}{-90}{0}{1}{bottom}{pgfcirc@nop}{border}%
26320 \else
26321 \pgf@circ@muxdemux@label@xy{W}{90}{0}{1}{bottom}{pgfcirc@nop}{border}%
26322 \pgf@circ@muxdemux@label@xy{Wi}{90}{0}{-1}{top}{pgfcirc@nop}{border}%
26323 \fi
26324 \endpgfscope
26325 % go east!
26326 \pgfscope
26327 \pgftransformshift{\pgfpoint{-\pgf@circ@res@left}{0pt}}
26328 \ifnum\quadrant=3
26329 \pgf@circ@muxdemux@label@xy{E}{-90}{0}{1}{bottom}{pgfcirc@nop}{border}% type, rot, pad x, pad y, text pos, op, type
26330 \pgf@circ@muxdemux@label@xy{Ei}{-90}{0}{-1}{top}{pgfcirc@nop}{border}%
26331 \else
26332 \pgf@circ@muxdemux@label@xy{E}{90}{0}{-1}{top}{pgfcirc@nop}{border}%
26333 \pgf@circ@muxdemux@label@xy{Ei}{90}{0}{1}{bottom}{pgfcirc@nop}{border}%
26334 \fi
26335 \endpgfscope
26336 % start exploring all the pins. We repeat the steps to position the coordinate on every pin.
26337 % left pins
26338 \ifnum\NL>0\relax
26339 \pgf@circ@count@a=\NL\relax
26340 \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
26341 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26342 \insetnortheast\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26343 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
26344 % we have to check oddity
26345 \ifodd\NL
26346 \ifnum\NL=1
26347 % only centerpin, step should not be used, but anyway...
26348 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL)}
26349 \else
26350 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/(\NL-1)}
26351 \fi
26352 \else
26353 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@circ@res@up-\pgf@circ@res@down)/\NL}
26354 \fi
26355 \else % no inset
26356 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NL}
26357 \fi
26358 \pgfmathloop%
26359 \ifnum\pgf@circ@count@a>0
26360 \pgfscope
26361 \ifdim\pgf@circ@res@down>0pt % check if we have an inset
26362 \ifnum\pgf@circ@count@a>\pgf@circ@count@b\relax
26363 % for lower pins we have to shift them down
26364 \ifodd\NL
26365 % odd number of pins
26366 \ifnum\pgf@circ@count@a=\numexpr\the\pgf@circ@count@b+1\relax
26367 % centerpin!
26368 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{0pt}}
26369 \else
26370 \pgftransformshift{\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}}
26371 \fi
26372 \else
26373 % even numer of pins: just go down
26374 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step-2*\pgf@circ@res@down}}
26375 \fi
26376 \else
26377 % nothing need for #1<=NL/2
26378 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26379 \fi
26380 \else
26381 % no inset
26382 \pgftransformshift{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26383 \fi
26384 % put the not ball/wedges if needed
26385 \pgf@circ@muxdemux@not@ball{nL}{east}
26386 \pgf@circ@muxdemux@not@wedge{wiL}{east}{1}{1}{0}
26387 \pgf@circ@muxdemux@not@wedge{woL}{west}{-1}{1}{0}
26388 % \fi
26389 \pgf@circ@muxdemux@clockwedge{cL}{0}
26390 %% put the labels
26391 \ifcase\quadrant % rotation 0; left label are at the left
26392 \pgf@circ@muxdemux@label@xy{L}{0}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26393 \pgf@circ@res@temp=0pt
26394 \pgf@circ@muxdemux@label@xy{LU}{0}{-1}{1}{bottom}{llap}{outer}%
26395 \pgf@circ@muxdemux@label@xy{LD}{0}{-1}{-1}{top}{llap}{outer}%
26396 \or %rotation -90; left labels are at the top
26397 \pgf@circ@muxdemux@label@xy{L}{90}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26398 \pgf@circ@res@temp=0pt
26399 \pgf@circ@muxdemux@label@xy{LU}{90}{-1}{1}{bottom}{llap}{outer}%
26400 \pgf@circ@muxdemux@label@xy{LD}{90}{1}{1}{bottom}{rlap}{outer}%
26401 \or %rotation 180; left labels are at the right
26402 \pgf@circ@muxdemux@label@xy{L}{180}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26403 \pgf@circ@res@temp=0pt
26404 \pgf@circ@muxdemux@label@xy{LU}{180}{1}{1}{bottom}{rlap}{outer}%
26405 \pgf@circ@muxdemux@label@xy{LD}{180}{1}{-1}{top}{rlap}{outer}%
26406 \or %rotation +90; left labels are at the bottom
26407 \pgf@circ@muxdemux@label@xy{L}{-90}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26408 \pgf@circ@res@temp=0pt
26409 \pgf@circ@muxdemux@label@xy{LU}{-90}{-1}{-1}{top}{llap}{outer}%
26410 \pgf@circ@muxdemux@label@xy{LD}{-90}{1}{-1}{top}{rlap}{outer}%
26411 \fi
26412 \endpgfscope
26413 \advance\pgf@circ@count@a by -1\relax%
26414 \repeatpgfmathloop
26415 \fi
26416 %% right pins
26417 \ifnum\NR>0\pgf@circ@count@a=\NR\relax
26418 \pgfmathloop%
26419 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@up=\pgf@y
26420 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@up/\NR}
26421 \ifnum\pgf@circ@count@a>0
26422 \pgfscope
26423 \pgftransformshift{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up+(0.5-\pgf@circ@count@a)*\pgf@circ@res@step}}
26424 % put the not ball/wedge if needed
26425 \pgf@circ@muxdemux@not@ball{nR}{west}
26426 \pgf@circ@muxdemux@not@wedge{wiR}{east}{-1}{1}{0}
26427 \pgf@circ@muxdemux@not@wedge{woR}{west}{1}{1}{0}
26428 % put the clock wedge if needed
26429 \pgf@circ@muxdemux@clockwedge{cR}{180}
26430 \ifcase\quadrant % rotation 0; right label are at the right
26431 \pgf@circ@muxdemux@label@xy{R}{0}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26432 \pgf@circ@res@temp=0pt
26433 \pgf@circ@muxdemux@label@xy{RU}{0}{1}{1}{bottom}{rlap}{outer}%
26434 \pgf@circ@muxdemux@label@xy{RD}{0}{1}{-1}{top}{rlap}{outer}%
26435 \or %rotation -90; right labels are at the bottom
26436 \pgf@circ@muxdemux@label@xy{R}{90}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26437 \pgf@circ@res@temp=0pt
26438 \pgf@circ@muxdemux@label@xy{RU}{90}{-1}{-1}{top}{llap}{outer}%
26439 \pgf@circ@muxdemux@label@xy{RD}{90}{1}{-1}{top}{rlap}{outer}%
26440 \or %rotation 180; right labels are at the left
26441 \pgf@circ@muxdemux@label@xy{R}{180}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26442 \pgf@circ@res@temp=0pt
26443 \pgf@circ@muxdemux@label@xy{RU}{180}{-1}{1}{bottom}{llap}{outer}%
26444 \pgf@circ@muxdemux@label@xy{RD}{180}{-1}{-1}{top}{llap}{outer}%
26445 \or %rotation +90; right labels are at the top
26446 \pgf@circ@muxdemux@label@xy{R}{-90}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26447 \pgf@circ@res@temp=0pt
26448 \pgf@circ@muxdemux@label@xy{RU}{-90}{-1}{1}{bottom}{llap}{outer}%
26449 \pgf@circ@muxdemux@label@xy{RD}{-90}{1}{1}{bottom}{rlap}{outer}%
26450 \fi
26451 \endpgfscope
26452 \advance\pgf@circ@count@a by -1\relax%
26453 \repeatpgfmathloop
26454 \fi
26455 %% bottom pins
26456 \ifnum\NB>0\pgf@circ@count@a=\NB\relax %%%
26457 \pgfmathloop%
26458 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26459 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26460 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NB}
26461 \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}
26462 \ifnum\pgf@circ@count@a>0
26463 \pgfscope
26464 \pgftransformshift{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26465 {-\pgf@circ@res@down+(\NB-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
26466 % put the not ball/wedge if needed
26467 \pgf@circ@muxdemux@not@ball{nB}{north}
26468 \pgf@circ@muxdemux@not@wedge{wiB}{east}{1}{1}{90}
26469 \pgf@circ@muxdemux@not@wedge{woB}{west}{-1}{1}{90}
26470 % put the clock wedge if needed
26471 \pgf@circ@muxdemux@clockwedge{cB}{90}
26472 \ifcase\quadrant % rotation 0; bottom label are at the bottom
26473 \pgf@circ@muxdemux@label@xy{B}{0}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26474 \pgf@circ@res@temp=0pt
26475 \pgf@circ@muxdemux@label@xy{BL}{0}{-1}{-1}{top}{llap}{outer}%
26476 \pgf@circ@muxdemux@label@xy{BR}{0}{1}{-1}{top}{rlap}{outer}%
26477 \or %rotation -90; bottom labels are at the left
26478 \pgf@circ@muxdemux@label@xy{B}{90}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26479 \pgf@circ@res@temp=0pt
26480 \pgf@circ@muxdemux@label@xy{BL}{90}{-1}{1}{bottom}{llap}{outer}%
26481 \pgf@circ@muxdemux@label@xy{BR}{90}{-1}{-1}{top}{llap}{outer}%
26482 \or %rotation 180; bottom labels are at the top
26483 \pgf@circ@muxdemux@label@xy{B}{180}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26484 \pgf@circ@res@temp=0pt
26485 \pgf@circ@muxdemux@label@xy{BL}{180}{-1}{1}{bottom}{llap}{outer}%
26486 \pgf@circ@muxdemux@label@xy{BR}{180}{1}{1}{bottom}{rlap}{outer}%
26487 \or %rotation +90; bottom labels are at the right
26488 \pgf@circ@muxdemux@label@xy{B}{-90}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26489 \pgf@circ@res@temp=0pt
26490 \pgf@circ@muxdemux@label@xy{BL}{-90}{1}{1}{bottom}{rlap}{outer}%
26491 \pgf@circ@muxdemux@label@xy{BR}{-90}{1}{-1}{top}{rlap}{outer}%
26492 \fi
26493 \endpgfscope
26494 \advance\pgf@circ@count@a by -1\relax%
26495 \repeatpgfmathloop
26496 \fi
26497 %% top pins
26498 \ifnum\NT>0\pgf@circ@count@a=\NT\relax
26499 \pgfmathloop%
26500 \topleft\pgf@circ@res@left=\pgf@x \pgf@circ@res@up=\pgf@y
26501 \topright\pgf@circ@res@right=\pgf@x \pgf@circ@res@down=\pgf@y
26502 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@circ@res@right/\NT}
26503 \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}
26504 \ifnum\pgf@circ@count@a>0
26505 \pgfscope
26506 \pgftransformshift{\pgfpoint{\pgf@circ@res@left+(\pgf@circ@[email protected])*\pgf@circ@res@step}
26507 {\pgf@circ@res@down-(\NT-\pgf@circ@count@a+0.5)*\pgf@circ@res@other}}
26508 % put the not ball/wedge if needed
26509 \pgf@circ@muxdemux@not@ball{nT}{south}
26510 \pgf@circ@muxdemux@not@wedge{wiT}{east}{1}{-1}{-90}
26511 \pgf@circ@muxdemux@not@wedge{woT}{west}{-1}{-1}{-90}
26512 % put the clock wedge if needed
26513 \pgf@circ@muxdemux@clockwedge{cT}{-90}
26514 \ifcase\quadrant % rotation 0; top label are at the top
26515 \pgf@circ@muxdemux@label@xy{T}{0}{0}{-1}{top}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26516 \pgf@circ@res@temp=0pt
26517 \pgf@circ@muxdemux@label@xy{TL}{0}{-1}{1}{bottom}{llap}{outer}%
26518 \pgf@circ@muxdemux@label@xy{TR}{0}{1}{1}{bottom}{rlap}{outer}%
26519 \or %rotation -90; top labels are at the right
26520 \pgf@circ@muxdemux@label@xy{T}{90}{-1}{0}{right}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26521 \pgf@circ@res@temp=0pt
26522 \pgf@circ@muxdemux@label@xy{TL}{90}{1}{1}{bottom}{rlap}{outer}%
26523 \pgf@circ@muxdemux@label@xy{TR}{90}{1}{-1}{top}{rlap}{outer}%
26524 \or %rotation 180; top labels are at the bottom
26525 \pgf@circ@muxdemux@label@xy{T}{180}{0}{1}{bottom}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26526 \pgf@circ@res@temp=0pt
26527 \pgf@circ@muxdemux@label@xy{TL}{180}{-1}{-1}{top}{llap}{outer}%
26528 \pgf@circ@muxdemux@label@xy{TR}{180}{1}{-1}{top}{rlap}{outer}%
26529 \or %rotation +90; top labels are at the left
26530 \pgf@circ@muxdemux@label@xy{T}{-90}{1}{0}{left}{pgfcirc@nop}{inner}% type, rot, pad x, pad y, text pos, op, type
26531 \pgf@circ@res@temp=0pt
26532 \pgf@circ@muxdemux@label@xy{TL}{-90}{-1}{1}{bottom}{llap}{outer}%
26533 \pgf@circ@muxdemux@label@xy{TR}{-90}{-1}{-1}{top}{llap}{outer}%
26534 \fi
26535 \endpgfscope
26536 \advance\pgf@circ@count@a by -1\relax%
26537 \repeatpgfmathloop
26538 \fi
26539 }
26540 % let's start adding anchors
26541 \pgfutil@g@addto@macro\pgf@sh@s@muxdemux{%
26542 % left side anchors
26543 \pgf@circ@count@a=\NL\relax
26544 % \typeout{STARTGENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
26545 \pgfmathloop%
26546 \ifnum\pgf@circ@count@a>0
26547 % \typeout{GENERATINGLEFT\space\the\pgf@circ@count@a\space FOR\space\thisshape\space\NL}
26548 % we will create two anchors per pin: the "normal one" like `lpin 1` for the
26549 % external leads, and the "border one" like `blpin 1` for internal ones.
26550 % they will coincide if `external pins width` is set to 0.
26551 \expandafter\pgf@circ@make@muxdemux@L@anchor\expandafter{\the\pgf@circ@count@a}%
26552 \advance\pgf@circ@count@a by -1\relax%
26553 \repeatpgfmathloop%
26554 % right anchors
26555 \pgf@circ@count@a=\NR\relax
26556 \pgfmathloop%
26557 \ifnum\pgf@circ@count@a>0
26558 % we will create two anchors per pin: the "normal one" like `rpin 1` for the
26559 % external leads, and the "border one" like `brpin 1` for internal ones.
26560 % they will coincide if `external pins width` is set to 0.
26561 \expandafter\pgf@circ@make@muxdemux@R@anchor\expandafter{\the\pgf@circ@count@a}%
26562 \advance\pgf@circ@count@a by -1\relax%
26563 \repeatpgfmathloop%
26564 % bottom anchors
26565 \pgf@circ@count@a=\NB\relax
26566 \pgfmathloop%
26567 \ifnum\pgf@circ@count@a>0
26568 % we will create two anchors per pin: the "normal one" like `bpin 1` for the
26569 % external leads, and the "border one" like `bbpin 1` for internal ones.
26570 % they will coincide if `external pins width` is set to 0.
26571 \expandafter\pgf@circ@make@muxdemux@B@anchor\expandafter{\the\pgf@circ@count@a}%
26572 \advance\pgf@circ@count@a by -1\relax%
26573 \repeatpgfmathloop%
26574 % top anchors
26575 \pgf@circ@count@a=\NT\relax
26576 \pgfmathloop%
26577 \ifnum\pgf@circ@count@a>0
26578 % we will create two anchors per pin: the "normal one" like `tpin 1` for the
26579 % external leads, and the "border one" like `btpin 1` for internal ones.
26580 % they will coincide if `external pins width` is set to 0.
26581 \expandafter\pgf@circ@make@muxdemux@T@anchor\expandafter{\the\pgf@circ@count@a}%
26582 \advance\pgf@circ@count@a by -1\relax%
26583 \repeatpgfmathloop%
26584 }%
26585 }
26586
26587 %% left anchors for muxdemux
26588
26589 \def\pgf@circ@muxdemux@L@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
26590 \topleft
26591 \pgf@xa=\pgf@x
26592 \pgf@ya=\pgf@y
26593 \insetnortheast
26594 \pgf@xb=\pgf@x
26595 \pgf@yb=\pgf@y
26596 \ifnum#1>\NL
26597 \PackageError{circuitikz}{%
26598 You requested left pin #1 for mux/demux shape \thisshape\space \MessageBreak
26599 which has been defined with \NL\space left pins%
26600 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
26601 \fi
26602 \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
26603 % \typeout{LEFT \the\pgf@xa \space \the\pgf@ya \space \NL}
26604 \ifnum\NL>1
26605 \ifdim\pgf@yb>0pt % check if we have an inset
26606 % we have to check oddity
26607 \ifodd\NL
26608 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/(\NL-1)}
26609 \else
26610 \pgfmathsetlength{\pgf@circ@res@step}{2*(\pgf@ya-\pgf@yb)/\NL}
26611 \fi
26612 \else % no inset
26613 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NL}
26614 \fi
26615 \ifdim\pgf@yb>0pt % check if we have an inset
26616 \ifnum#1>\pgf@circ@count@a\relax
26617 % for lower pins we have to shift them down
26618 % \typeout{DEBUGTEST1\space #1\space entering\space \NL}
26619 \ifodd\NL
26620 % odd number of pins
26621 \ifnum#1=\numexpr\the\pgf@circ@count@a+1\relax
26622 % centerpin!
26623 \ifnum#2=0\relax
26624 \pgfpoint{\pgf@xb}{0pt}
26625 \else
26626 \ifnum\squarepins>0
26627 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
26628 \else
26629 \pgfpoint{\pgf@xb-#2*\extshift}{0pt}
26630 \fi
26631 \fi
26632 \else
26633 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1+1)*\pgf@circ@res@step-2*\pgf@yb}
26634 \fi
26635 \else
26636 % even numer of pins: just go down
26637 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step-2*\pgf@yb}
26638 \fi
26639 \else
26640 % nothing need for #1<=NL/2
26641 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
26642 \fi
26643 \else
26644 % no inset
26645 \pgfpoint{\pgf@xa-#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
26646 \fi
26647 \else
26648 \pgfpoint{\pgf@xa-#2*\extshift}{0pt}
26649 \fi
26650 }
26651
26652 % right anchors
26653 \def\pgf@circ@muxdemux@R@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
26654 \topright
26655 \pgf@xa=\pgf@x
26656 \pgf@ya=\pgf@y
26657 \ifnum#1>\NR
26658 \PackageError{circuitikz}{%
26659 You requested right pin #1 for mux/demux shape \thisshape\space \MessageBreak
26660 which has been defined with \NR\space right pins%
26661 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
26662 \fi
26663 \ifnum\NR>1
26664 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@ya/\NR}
26665 \pgfpoint{\pgf@xa+#2*\extshift}{\pgf@ya+(0.5-#1)*\pgf@circ@res@step}
26666 \else
26667 \pgfpoint{\pgf@xa+#2*\extshift}{0pt}
26668 \fi
26669 }
26670
26671 % bottom anchors
26672 \def\pgf@circ@muxdemux@B@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
26673 \topleft
26674 \pgf@xa=\pgf@x
26675 \pgf@ya=\pgf@y
26676 \topright
26677 \pgf@xb=\pgf@x
26678 \pgf@yb=\pgf@y
26679 \ifnum#1>\NB
26680 \PackageError{circuitikz}{%
26681 You requested bottom pin #1 for mux/demux shape \thisshape\space \MessageBreak
26682 which has been defined with \NB\space bottom pins%
26683 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
26684 \fi
26685 \ifnum\NB>0
26686 % \typeout{DEBUGTESTtopleft\space\the\pgf@ya \space topright\space\the\pgf@yb \space\NB}
26687 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NB}
26688 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
26689 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
26690 \ifnum#2=0\relax
26691 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other}
26692 \else
26693 \ifnum\squarepins>0\relax
26694 \pgfmathsetlength\pgf@y{-max(\pgf@ya,\pgf@yb)-\extshift}
26695 \else
26696 \pgfmathsetlength\pgf@y{-\pgf@yb+(\NB-#1+0.5)*\pgf@circ@res@other-\extshift}
26697 \fi
26698 \fi
26699 \else
26700 % should not happen, give the same as pin 1 anyway
26701 \ifnum#2=0\relax
26702 \pgfpoint{0pt}{-\pgf@yb+(\pgf@yb-\pgf@ya)/2}
26703 \else
26704 \pgfpoint{0pt}{-max(\pgf@ya,\pgf@yb)-\extshift}
26705 \fi
26706 \fi
26707 }
26708
26709 % top anchors
26710 \def\pgf@circ@muxdemux@T@anchor#1#2{% #1: pin number #2: 0 for border pin, 1 for external pin
26711 \topleft
26712 \pgf@xa=\pgf@x
26713 \pgf@ya=\pgf@y
26714 \topright
26715 \pgf@xb=\pgf@x
26716 \pgf@yb=\pgf@y
26717 \ifnum#1>\NT
26718 \PackageError{circuitikz}{%
26719 You requested top pin #1 for mux/demux shape \thisshape\space \MessageBreak
26720 which has been defined with \NT\space top pins%
26721 }{Please check the manual about mux/demux shapes; if you press return I'll try to continue}
26722 \fi
26723 \ifnum\NT>0
26724 \pgfmathsetlength{\pgf@circ@res@step}{2*\pgf@xb/\NT}
26725 \pgfmathsetlength{\pgf@circ@res@other}{(\pgf@yb-\pgf@ya)/(\pgf@xb-\pgf@xa)*\pgf@circ@res@step}
26726 \pgfmathsetlength\pgf@x{\pgf@xa+(#1-0.5)*\pgf@circ@res@step}
26727 \ifnum#2=0\relax
26728 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other}
26729 \else
26730 \ifnum\squarepins>0
26731 \pgfmathsetlength\pgf@y{max(\pgf@ya,\pgf@yb)+\extshift}
26732 \else
26733 \pgfmathsetlength\pgf@y{\pgf@yb-(\NT-#1+0.5)*\pgf@circ@res@other+\extshift}
26734 \fi
26735 \fi
26736 \else
26737 % should not happen, give the same as pin 1 anyway
26738 \ifnum#2=0\relax
26739 \pgfpoint{0pt}{\pgf@yb-(\pgf@yb-\pgf@ya)/2}
26740 \else
26741 \pgfpoint{0pt}{max(\pgf@ya,\pgf@yb)+\extshift}
26742 \fi
26743 \fi
26744 }
26745 % %>>>
26746
26747 %% definitions and shape for wedgeinv and circleinv%<<<
26748
26749 \ctikzset{wedge inversion mark/width/.initial = 0.2}
26750 \ctikzset{wedge inversion mark/height/.initial = 0.1}
26751 \pgfdeclareshape{wedgeinv}{
26752 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
26753 \saveddimen{\scaledRlen}{\pgfmathsetlength{\pgf@x}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}}
26754 \savedanchor\northeast{%
26755 \pgfmathsetlength{\pgf@circ@scaled@Rlen}{\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
26756 \pgf@y=\ctikzvalof{wedge inversion mark/height}\pgf@circ@scaled@Rlen
26757 \pgf@x=\ctikzvalof{wedge inversion mark/width}\pgf@circ@scaled@Rlen
26758 }
26759 \anchor{center}{\pgfpointorigin}
26760 \anchor{top}{\northeast\pgf@x=0pt\relax}
26761 \anchor{apex}{\northeast\pgf@y=0pt\relax}
26762 \anchor{base}{\pgfpointorigin}
26763 \anchor{mid}{\northeast\pgf@x=0.5\pgf@x\pgf@y=0.5\pgf@y}
26764 % not standard geoanchors, south west is the same as 0,0...
26765 \anchor{right}{\northeast\pgf@y=0pt\relax}
26766 \anchor{east}{\northeast\pgf@y=0pt\relax}
26767 \anchor{e}{\northeast\pgf@y=0pt\relax}
26768 \anchor{left}{\pgfpointorigin}
26769 \anchor{west}{\pgfpointorigin}
26770 \anchor{w}{\pgfpointorigin}
26771 \anchor{south}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x}
26772 \anchor{s}{\northeast\pgf@y=0pt\pgf@x=0.5\pgf@x}
26773 \anchor{north}{\northeast\pgf@x=0.5\pgf@x}
26774 \anchor{n}{\northeast\pgf@x=0.5\pgf@x}
26775 \anchor{south west}{\pgfpointorigin}
26776 \anchor{sw}{\pgfpointorigin}
26777 \anchor{north east}{\northeast}
26778 \anchor{ne}{\northeast}
26779 \anchor{north west}{\northeast\pgf@x=0pt\relax}
26780 \anchor{nw}{\northeast\pgf@x=0pt\relax}
26781 \anchor{south east}{\northeast\pgf@y=0pt\relax}
26782 \anchor{se}{\northeast\pgf@y=0pt\relax}
26783 %
26784 \pgf@circ@draw@component{
26785 \northeast\pgf@circ@res@up=\pgf@y\pgf@circ@res@right=\pgf@x
26786 \pgfsetbeveljoin % otherwise it sticks often "inside" the component
26787 \pgfpathmoveto{\pgfpointorigin}
26788 \pgfpathlineto{\pgfpoint{0pt}{\pgf@circ@res@up}}
26789 \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
26790 \pgfpathclose
26791 \pgfusepath{draw}
26792 }
26793 }
26794 % this is *almost* the same as notcirc, but scales with muxdemuxes and
26795 % has the default anchor to the left side
26796 \pgfdeclareshape{circleinv}{
26797 \savedmacro{\ctikzclass}{\edef\ctikzclass{muxdemuxes}}
26798 \savedanchor\northwest{%
26799 \pgf@circ@notradius
26800 \pgf@y=\pgf@circ@res@temp
26801 \pgf@x=-\pgf@y
26802 }
26803 \pgfcirc@northwest@symmetric@geoanchors
26804 %% use the left side as default anchor
26805 \anchor{center}{\northwest\pgf@y=0pt}
26806 \anchor{geocenter}{\pgfpointorigin}
26807 \anchor{base}{\northwest\pgf@y=0pt}
26808 \anchor{apex}{\northwest\pgf@y=0pt\pgf@x=-\pgf@x}
26809 \anchor{mid}{\northwest\pgf@x=0pt}
26810 \anchor{top}{\northwest\pgf@x=0pt}
26811 \anchor{bottom}{\northwest\pgf@x=0pt\pgf@y=-\pgf@y}
26812 \anchorborder{
26813 \pgf@circ@res@left=\pgf@x
26814 \pgf@circ@res@up=\pgf@y
26815 \northwest\pgf@circ@res@temp=\pgf@y
26816 \pgfpointborderellipse{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}%
26817 {\pgfpoint{\pgf@circ@res@temp}{\pgf@circ@res@temp}}
26818 }
26819 \pgf@circ@draw@component{
26820 \pgfscope
26821 \northwest\pgf@circ@res@temp=\pgf@y
26822 \pgf@circ@setcolor
26823 \pgf@circ@setlinewidth{multipoles}{\pgflinewidth}
26824 \pgfpathcircle{\pgfpointorigin}{\pgf@circ@res@temp}
26825 \ifx\tikz@fillcolor\pgfutil@empty
26826 % set the default fill color to white
26827 \pgfsetfillcolor{white}
26828 % ...but override it if the class is defined!
26829 \pgf@circ@setifdefinedfill{draw, fill}{draw, fill}
26830 \else
26831 \pgfsetfillcolor{\tikz@fillcolor}
26832 \fi
26833 \pgfusepath{draw,fill}
26834 \endpgfscope
26835 }
26836 }
26837 %% %>>>
26838
26839 % vim: set fdm=marker fmr=%<<<,%>>>:
26840 %%%---------- close: tex/pgfcircmultipoles
26841
26842 %%%%%%%%%%% Springe nach tex/pgfcirclabel
26843 %%%---------- open: tex/pgfcirclabel.tex
26844 % Copyright 2018-2026 by Romano Giannetti
26845 % Copyright 2015-2026 by Stefan Lindner
26846 % Copyright 2013-2026 by Stefan Erhardt
26847 % Copyright 2007-2026 by Massimo Redaelli
26848 %
26849 % This file may be distributed and/or modified
26850 %
26851 % 1. under the LaTeX Project Public License and/or
26852 % 2. under the GNU Public License.
26853 %
26854 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
26855
26856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26857 %% Bipole label positioning
26858
26859 %% bipole labels and annotation extra style
26860
26861 \ctikzset{bipole label style/.style={}}
26862 \tikzset{bipole label style/.code={
26863 \ctikzset{bipole label style/.style={#1}}
26864 }}
26865 \tikzset{bipole label append style/.code={
26866 \ctikzset{bipole label style/.append style={#1}}
26867 }}
26868 \ctikzset{bipole annotation style/.style={}}
26869 \tikzset{bipole annotation style/.code={
26870 \ctikzset{bipole annotation style/.style={#1}}
26871 }}
26872 \tikzset{bipole annotation append style/.code={
26873 \ctikzset{bipole annotation style/.append style={#1}}
26874 }}
26875
26876 \ctikzset{label distance/.initial={0pt}}
26877 \ctikzset{annotation distance/.initial={0pt}}
26878
26879 %% Options
26880 \ctikzset{label/.style = { l={#1} } }
26881 \ctikzset{l/.code = {
26882 \pgfkeys{/tikz/circuitikz/bipole/label/name={#1}}
26883 \ctikzsetvalof{bipole/label/unit}{}
26884 \ifpgf@circ@siunitx
26885 \pgf@circ@handleSI{#1}
26886 \ifpgf@circ@siunitx@res
26887 \edef\pgf@temp{\pgf@circ@handleSI@val}
26888 \pgfkeyslet{/tikz/circuitikz/bipole/label/name}{\pgf@temp}
26889 \edef\pgf@temp{\pgf@circ@handleSI@unit}
26890 \pgfkeyslet{/tikz/circuitikz/bipole/label/unit}{\pgf@temp}
26891 \else
26892 \fi
26893 \else
26894 \fi
26895 }}
26896
26897 \ctikzset{label above/.code = {
26898 l={#1},
26899 \circuitikzbasekey/bipole/label/position=90 }
26900 }
26901
26902 \ctikzset{l^/.style = {
26903 l={#1},
26904 \circuitikzbasekey/bipole/label/position=90 }
26905 }
26906
26907 \ctikzset{label below/.code = {
26908 l={#1},
26909 \circuitikzbasekey/bipole/label/position=-90 }
26910 }
26911
26912 \ctikzset{l_/.style = {
26913 l={#1},
26914 \circuitikzbasekey/bipole/label/position=-90 }
26915 }
26916
26917 \ctikzset{annotation/.style = { a={#1} } }
26918 \ctikzset{a/.code = {
26919 \pgfkeys{/tikz/circuitikz/bipole/annotation/name={#1}}
26920 \ctikzsetvalof{bipole/annotation/unit}{}
26921 \ifpgf@circ@siunitx
26922 \pgf@circ@handleSI{#1}
26923 \ifpgf@circ@siunitx@res
26924 \edef\pgf@temp{\pgf@circ@handleSI@val}
26925 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/name}{\pgf@temp}
26926 \edef\pgf@temp{\pgf@circ@handleSI@unit}
26927 \pgfkeyslet{/tikz/circuitikz/bipole/annotation/unit}{\pgf@temp}
26928 \else
26929 \fi
26930 \else
26931 \fi
26932 }}
26933
26934 \ctikzset{annotation above/.code = {
26935 a={#1},
26936 \circuitikzbasekey/bipole/annotation/position=90 }
26937 }
26938
26939 \ctikzset{a^/.style = {
26940 a={#1},
26941 \circuitikzbasekey/bipole/annotation/position=90 }
26942 }
26943
26944 \ctikzset{annotation below/.code = {
26945 a={#1},
26946 \circuitikzbasekey/bipole/annotation/position=-90 }
26947 }
26948 \ctikzset{a_/.style = {
26949 a={#1},
26950 \circuitikzbasekey/bipole/annotation/position=-90 }
26951 }
26952
26953 % This is to adjust spacing for the labels so that they are not cramped on components
26954 \def\pgf@circ@ls{.75ex} % labelspace to have just one point to change
26955
26956 \def\pgf@circ@drawlabels#1{
26957 \pgfextra{
26958 % This function will be called with argument #1 equal
26959 % to "label" or "annotation" form pgfcircpath.tex.
26960 % pgf@circ@direction is the direction of the path,
26961 % its value is set in pgfcircpath.tex
26962 \pgfmathsubtract{\pgf@circ@direction}{90}
26963 \pgfmathround{\pgfmathresult} % avoid precision loss errors
26964 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26965
26966 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/position}}
26967 \ifnum \pgf@circ@temp < 0
26968 \pgfmathadd{\pgf@circ@labanc}{180}
26969 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26970 \fi
26971 % \typeout{INI: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
26972 %
26973 % normalize the angle values
26974 %
26975 \pgfmathmod{\pgf@circ@labanc}{360}
26976 \edef\pgf@circ@labanc{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26977 %
26978 \ifpgf@circuit@bipole@inverted
26979 \pgfmathadd{\pgf@circ@temp}{180} %If shape is inverted, use opposite anchor
26980 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26981 \fi
26982 %
26983 \ifnum \ctikzvalof{mirror value} = -1
26984 \pgfmathadd{\pgf@circ@temp}{180} %If shape is mirrored, use opposite anchor
26985 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
26986 \fi
26987 % \typeout{FIN: TEMP\space\pgf@circ@temp\space LABANC\space\pgf@circ@labanc}
26988 }
26989 %Firstly, place a coordinate directly at the edge of the shape
26990 (\ctikzvalof{bipole/name}.\pgf@circ@temp) coordinate (pgfcirc@labelcoor)
26991 %now decide, which labels should be drawn
26992 \pgfextra{
26993 \edef\pgf@temp{\ctikzvalof{label/align}}
26994 \def\pgf@circ@temp{straight}
26995 }
26996 \ifx\pgf@temp\pgf@circ@temp %straight
26997 \pgf@circ@drawreglabels{#1}
26998 \else
26999 \pgfextra{\def\pgf@circ@temp{rotate}}
27000 \ifx\pgf@temp\pgf@circ@temp %rotate
27001 \pgf@circ@drawrotlabels{#1}
27002 \else% smart
27003 \pgf@circ@drawsmartlabels{#1}
27004 \fi
27005 \fi
27006 }
27007
27008
27009 \def\pgf@circ@drawsmartlabels#1{
27010 \pgfextra{
27011 \pgfmathmod{\pgf@circ@direction}{90}
27012 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
27013 }
27014 \ifnum \pgfcircmathresult > 20
27015 \ifnum \pgfcircmathresult < 70
27016 \pgf@circ@drawrotlabels{#1}
27017 \else
27018 \pgf@circ@drawreglabels{#1}
27019 \fi
27020 \else
27021 \pgf@circ@drawreglabels{#1}
27022 \fi
27023 }
27024
27025
27026 \def\pgf@circ@drawrotlabels#1{
27027 \pgfextra{
27028 % scale the distances in function of zoom, so that they are not
27029 % dependent on it but on font size. Thanks to @marmot
27030 % https://tex.stackexchange.com/a/476018/38080
27031 % the coefficient is adjusted so that the distance is more or less
27032 % the same for rotated labels and straight ones (although it will
27033 % depend on the font, so it's not exact).
27034 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
27035 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
27036 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
27037 \pgfmathsetlength\pgf@circ@res@temp{1.5*\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale}
27038 \ifnum \ctikzvalof{bipole/#1/position}>0
27039 %we need some more space for placement below, due to mid-anchor
27040 \else % we do not have <= in \ifnum...
27041 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
27042 \fi
27043 %Calculate rotation of the label from direction and strip decimals
27044 \pgfmathsetmacro{\pgfcirclabrot}{round(\pgf@circ@direction)}
27045 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfcirclabrot\pgf@nil}
27046 % rotate the label at second or third quadrant:
27047 \ifnum \pgfcirclabrot > 90 \ifnum \pgfcirclabrot < 270
27048 \pgfmathsubtract{\pgf@circ@direction}{180}
27049 \edef\pgfcirclabrot{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
27050 %invert the space relationships due to rotated strings
27051 \ifnum \ctikzvalof{bipole/#1/position}>0
27052 \pgf@circ@res@temp=1.5\pgf@circ@res@temp
27053 \fi
27054 \fi\fi
27055 \pgfmathparse{\ctikzvalof{bipole/#1/position}>0?\pgf@circ@direction+90:\pgf@circ@direction-90}%
27056 \edef\pgf@circ@labposangle{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}%
27057 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{\pgfcirclabrot}%
27058 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{mid}%
27059 }
27060 % reset cm is not working correctly here
27061 % relative ++ movement disrupt to[] +()
27062 ($(pgfcirc@labelcoor)+(\pgf@circ@labposangle:\the\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
27063 node[anchor=mid, rotate=\pgfcirclabrot, \circuitikzbasekey/bipole #1 style]
27064 (\ctikzvalof{bipole/name}#1){\pgf@circ@finallabels{#1}}
27065 }
27066
27067 \def\pgf@circ@drawreglabels#1{
27068 %Now calculate all shape positions
27069 %Use mid-anchor at x-axis and base-anchor at y-axis, respectively.
27070 %All points between will be addressed by angled-anchors:
27071 \pgfextra{
27072 % scale ex-distance to make it independent on scale
27073 % thanks @marmot see https://tex.stackexchange.com/a/476018/38080
27074 \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
27075 \pgfmathsetmacro{\myscale}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}% abs should not be needed
27076 % \typeout{ROT\tmpa\space\tmpb\space\tmpc\space\tmpd\space\myscale}
27077 \pgfmathsetlength\pgf@circ@res@temp{\pgf@circ@ls/\myscale+\ctikzvalof{#1 distance}/\myscale}
27078 \pgfmathadd{\pgf@circ@labanc}{90}
27079 \pgfmathround{\pgfmathresult}
27080 \def\pgf@circ@labanctext{\pgf@circ@labanc}
27081 \edef\pgf@circ@temp{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
27082 \pgfmathparse{mod(\pgf@circ@temp,180)>135?mod(\pgf@circ@temp,180)-180:mod(\pgf@circ@temp,180)}
27083 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
27084 }
27085 %Values around 90 are at both y-axis
27086 \ifnum \pgfcircmathresult > 84 \ifnum \pgfcircmathresult< 96
27087 \pgfextra{\edef\pgf@circ@labpos{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}}
27088 \ifnum \pgf@circ@labpos > 180
27089 \ifnum \ctikzvalof{bipole/#1/position} > 0
27090 \pgfextra{\def\pgf@circ@labanctext{mid west}}
27091 \else
27092 \pgfextra{\def\pgf@circ@labanctext{mid east}}
27093 \fi
27094 \else
27095 \ifnum \ctikzvalof{bipole/#1/position} > 0
27096 \pgfextra{\def\pgf@circ@labanctext{mid east}}
27097 \else
27098 \pgfextra{\def\pgf@circ@labanctext{mid west}}
27099 \fi
27100 \fi
27101 \fi\fi
27102 %Values between -5 and 5 are at pos /neg x-axis
27103 \ifnum \pgfcircmathresult <6 \ifnum \pgfcircmathresult > -6
27104 \ifnum \ctikzvalof{bipole/#1/position} < 0
27105 \ifnum \pgf@circ@labanc > 90
27106 % using base coordinate instead of south to naturally align
27107 % symbols with descendants; but this invalidate the effect of
27108 % the inner sep, so recover it by shifting the anchor
27109 % reset cm is not working sometime, use @marmot solution
27110 % see https://tex.stackexchange.com/a/476018/38080
27111 % notice that relative ++ movement disrupt to[] +()
27112 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
27113 \pgfextra{\def\pgf@circ@labanctext{base}}%base
27114 \else
27115 \pgfextra{\def\pgf@circ@labanctext{north}}%north
27116 \fi
27117 \else
27118 \ifnum \pgf@circ@labanc < 90
27119 % shift, as above
27120 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
27121 \pgfextra{\def\pgf@circ@labanctext{base}}%base
27122 \else
27123 \ifnum \pgf@circ@labanc > 180
27124 % this shouldn't happen, but somehow it does (270 degree anchors)
27125 % shift, as above
27126 ($(pgfcirc@labelcoor)+(-\pgf@circ@labanc:\pgf@circ@res@temp)$) coordinate(pgfcirc@labelcoor)
27127 \pgfextra{\def\pgf@circ@labanctext{base}}%base
27128 \else
27129 \pgfextra{\def\pgf@circ@labanctext{north}}%north
27130 \fi
27131 \fi
27132 \fi
27133 \fi\fi
27134 \pgfextra{%
27135 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix#1-direction\endcsname{0}%
27136 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-#1-anchor\endcsname{\pgf@circ@labanctext}%
27137 }
27138 (pgfcirc@labelcoor) node[anchor=\pgf@circ@labanctext,
27139 inner sep=0.5\pgf@circ@res@temp, outer sep=0pt, \circuitikzbasekey/bipole #1 style,
27140 ](\ctikzvalof{bipole/name}#1){\strut\pgf@circ@finallabels{#1}%
27141 }
27142 }
27143
27144 \def\pgf@circ@finallabels#1{%
27145 \edef\pgf@temp{}%
27146 \edef\pgf@circ@temp{\ctikzvalof{bipole/#1/unit}}%
27147 \ifx\pgf@temp\pgf@circ@temp%
27148 \ctikzvalof{bipole/#1/name}%
27149 \else%
27150 $\SI{\ctikzvalof{bipole/#1/name}}{\ctikzvalof{bipole/#1/unit}}$%
27151 \fi%
27152 }
27153
27154
27155 %%%% Stacked labels
27156 %
27157 % stacked labels by Romano Giannetti [email protected]
27158 % heavily based on Claudo Fiandrinos's https://tex.stackexchange.com/a/65792/38080
27159 % \expandafter trick inspired by Matthew Leingang's https://tex.stackexchange.com/a/12272/38080
27160 %
27161 % labels are in a tabular, globally aligned:
27162 % vertically with key l2 valign (default c)
27163 % c: center t: top b: bottom
27164 % horizontally with key l2 align (default l)
27165 % l: left c: centered r: right
27166 % you can switch sides using l2_=... and l2^=...
27167 % syntax is l2_ = line1 and line2 (same for l2^)
27168 %
27169 \ctikzset{%
27170 l2 valign/.store in=\pgfcirc@ltwo@valign, l2 valign=c,
27171 l2 halign/.store in=\pgfcirc@ltwo@halign, l2 halign=l,
27172 }
27173 \ctikzset{l2base/.code n args={2}{
27174 \pgfkeys{/tikz/circuitikz/bipole/label/name=%
27175 \bgroup
27176 \setlength{\tabcolsep}{2pt}%
27177 \def\pgfcirc@ltwo@tabu{\tabular[\pgfcirc@ltwo@valign]}%
27178 \expandafter\pgfcirc@ltwo@tabu\expandafter{\pgfcirc@ltwo@halign}%
27179 #1\\ #2%
27180 \endtabular
27181 \egroup
27182 }%
27183 }}
27184 \ctikzset{l2/.style args={#1and#2}{
27185 l2base={#1}{#2},
27186 \circuitikzbasekey/bipole/label/position=90 }
27187 }
27188 \ctikzset{l2 above/.style args={#1and#2}{
27189 l2base={#1}{#2},
27190 \circuitikzbasekey/bipole/label/position=90 }
27191 }
27192 \ctikzset{l2^/.style args={#1and#2}{
27193 l2base={#1}{#2},
27194 \circuitikzbasekey/bipole/label/position=90 }
27195 }
27196 \ctikzset{l2 below/.style args={#1and#2}{
27197 l2base={#1}{#2},
27198 \circuitikzbasekey/bipole/label/position=-90 }
27199 }
27200 \ctikzset{l2_/.style args={#1and#2}{
27201 l2base={#1}{#2},
27202 \circuitikzbasekey/bipole/label/position=-90 }
27203 }
27204 %
27205 % the same for annotations
27206 %
27207 \ctikzset{%
27208 a2 valign/.store in=\pgfcirc@atwo@valign, a2 valign=c,
27209 a2 halign/.store in=\pgfcirc@atwo@halign, a2 halign=r,
27210 }
27211 \ctikzset{a2base/.code n args={2}{
27212 \pgfkeys{/tikz/circuitikz/bipole/annotation/name=%
27213 \bgroup
27214 \setlength{\tabcolsep}{2pt}%
27215 \def\pgfcirc@atwo@tabu{\tabular[\pgfcirc@atwo@valign]}%
27216 \expandafter\pgfcirc@atwo@tabu\expandafter{\pgfcirc@atwo@halign}%
27217 #1\\ #2%
27218 \endtabular
27219 \egroup
27220 }%
27221 }}
27222 \ctikzset{a2/.style args={#1and#2}{
27223 a2base={#1}{#2},
27224 \circuitikzbasekey/bipole/annotation/position=-90 }
27225 }
27226 \ctikzset{a2 above/.style args={#1and#2}{
27227 a2base={#1}{#2},
27228 \circuitikzbasekey/bipole/annotation/position=-90 }
27229 }
27230 \ctikzset{a2^/.style args={#1and#2}{
27231 a2base={#1}{#2},
27232 \circuitikzbasekey/bipole/annotation/position=-90 }
27233 }
27234 \ctikzset{a2 below/.style args={#1and#2}{
27235 a2base={#1}{#2},
27236 \circuitikzbasekey/bipole/annotation/position=90 }
27237 }
27238 \ctikzset{a2_/.style args={#1and#2}{
27239 a2base={#1}{#2},
27240 \circuitikzbasekey/bipole/annotation/position=90 }
27241 }
27242
27243 %%%---------- close: tex/pgfcirclabel
27244 %%%%%%%%%%% Springe nach tex/pgfcircvoltage
27245 %%%---------- open: tex/pgfcircvoltage.tex
27246 % Copyright 2018-2026 by Romano Giannetti
27247 % Copyright 2015-2026 by Stefan Lindner
27248 % Copyright 2013-2026 by Stefan Erhardt
27249 % Copyright 2007-2026 by Massimo Redaelli
27250 %
27251 % This file may be distributed and/or modified
27252 %
27253 % 1. under the LaTeX Project Public License and/or
27254 % 2. under the GNU Public License.
27255 %
27256 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
27257
27258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27259 %% Voltage management
27260
27261 %% styles%<<<
27262 \ctikzset{bipole voltage style/.style={}}
27263 \tikzset{bipole voltage style/.code={
27264 \ctikzset{bipole voltage style/.style={#1}}
27265 }}
27266 \tikzset{bipole voltage append style/.code={
27267 \ctikzset{bipole voltage style/.append style={#1}}
27268 }}
27269
27270 \ctikzset{v^>/.style = {
27271 v={#1},
27272 \circuitikzbasekey/bipole/voltage/direction = forward,
27273 \circuitikzbasekey/bipole/voltage/position = above
27274 }
27275 }
27276
27277 \ctikzset{v^</.style = {
27278 v={#1},
27279 \circuitikzbasekey/bipole/voltage/direction = backward,
27280 \circuitikzbasekey/bipole/voltage/position = above
27281 }
27282 }
27283
27284 \ctikzset{v_>/.style = {
27285 v={#1},
27286 \circuitikzbasekey/bipole/voltage/direction = forward,
27287 \circuitikzbasekey/bipole/voltage/position = below
27288 }
27289 }
27290
27291 \ctikzset{v_</.style = {
27292 v={#1},
27293 \circuitikzbasekey/bipole/voltage/direction = backward,
27294 \circuitikzbasekey/bipole/voltage/position = below
27295 }
27296 }
27297
27298 \ctikzset{v_/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = below} }
27299 \ctikzset{v^/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/position = above} }
27300 \ctikzset{v>/.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = forward} }
27301 \ctikzset{v</.style = {v={#1}, \circuitikzbasekey/bipole/voltage/direction = backward} }%
27302
27303 \newif\ifpgfcirc@do@v@symbols\pgfcirc@do@v@symbolstrue
27304 \ctikzset{no v symbols/.code={\pgfcirc@do@v@symbolsfalse}}
27305 \ctikzset{v symbols/.code={\pgfcirc@do@v@symbolstrue}}
27306
27307 % Default position varies whether the component is a voltage source
27308 % or not
27309 \ctikzset{v/.code = {
27310 \pgfcirc@has@vtrue
27311 \ifpgf@circuit@bipole@override@source@vif
27312 \pgf@circuit@bipole@isvoltagefalse
27313 \pgf@circuit@bipole@iscurrentfalse
27314 \fi
27315 \ifpgf@circuit@bipole@isvoltage
27316 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=above,
27317 \circuitikzbasekey/bipole/voltage/direction=forward}
27318 \else
27319 \ifpgf@circ@oldvoltagedirection
27320 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27321 \circuitikzbasekey/bipole/voltage/direction=backward}
27322 \else
27323 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27324 \circuitikzbasekey/bipole/voltage/direction=forward}
27325 \fi
27326 \fi
27327 \ifpgf@circ@oldvoltagedirection
27328 \ifpgf@circuit@bipole@iscurrent\ifpgf@circ@fixbatteries
27329 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27330 \circuitikzbasekey/bipole/voltage/direction=forward}
27331 \fi\fi
27332 \else
27333 \ifpgf@circuit@bipole@iscurrent
27334 \ifpgf@circuit@bipole@current@backward
27335 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27336 \circuitikzbasekey/bipole/voltage/direction=forward}
27337 \else
27338 \pgfkeys{\circuitikzbasekey/bipole/voltage/position=below,
27339 \circuitikzbasekey/bipole/voltage/direction=backward}
27340 \fi\fi\fi
27341 \pgfkeys{/tikz/circuitikz/bipole/voltage/label/name={#1}}
27342 \ctikzsetvalof{bipole/voltage/label/unit}{}
27343 \ifpgf@circ@siunitx
27344 \pgf@circ@handleSI{#1}
27345 \ifpgf@circ@siunitx@res
27346 \edef\pgf@temp{\pgf@circ@handleSI@val}
27347 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/name}{\pgf@temp}
27348 \edef\pgf@temp{\pgf@circ@handleSI@unit}
27349 \pgfkeyslet{/tikz/circuitikz/bipole/voltage/label/unit}{\pgf@temp}
27350 \else
27351 \fi
27352 \else
27353 \fi
27354 }
27355 }
27356 % %>>>
27357
27358 % american voltage font selection and symbol definition
27359 % the default font command is {} --- nothing
27360 \def\pgf@circ@avfont{\ctikzvalof{voltage/american font}}
27361 %
27362 % In the mayority of fonts, the size of - is smaller than +, so we have
27363 % unaligned signs when positioned independently.
27364 % See https://github.com/circuitikz/circuitikz/issues/721
27365 % plus and minus symbols (default is $+$ and $\vphantom{+}-$, see pgfcirc.defines.tex)
27366 %
27367 \def\pgf@circ@avplus{\ctikzvalof{voltage/american plus}}
27368 \def\pgf@circ@avminus{\ctikzvalof{voltage/american minus}}
27369
27370 %%
27371 \def\setscaledRlenforclass{%
27372 \csname pgf@sh@ma@\ctikzvalof{bipole/name}\endcsname
27373 \ifdefined\ctikzclass
27374 \edef\pgf@temp{/tikz/circuitikz/\ctikzclass/scale}
27375 \pgfkeysifdefined{\pgf@temp}
27376 {\pgf@circ@scaled@Rlen=\ctikzvalof{\ctikzclass/scale}\pgf@circ@Rlen}
27377 {\pgf@circ@scaled@Rlen=\pgf@circ@Rlen}
27378 \else
27379 \pgf@circ@scaled@Rlen=\pgf@circ@Rlen
27380 \fi
27381 }
27382
27383 %% Output routine for generic bipoles%<<<
27384 % put this to true to see the voltage label coordinate anchors
27385 \newif\ifpgf@circ@debugv\pgf@circ@debugvfalse
27386
27387 \def\pgf@circ@drawvoltagegeneric{
27388 \pgfextra{
27389 % \typeout{KIND:\ctikzvalof{bipole/kind}\space RLEN:\the\pgf@circ@Rlen\space SCALED:\the\pgf@circ@scaled@Rlen}
27390 \ifnum \ctikzvalof{mirror value}=-1
27391 \ifpgf@circuit@bipole@inverted
27392 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
27393 \else
27394 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
27395 \fi
27396 \else
27397 \ifpgf@circuit@bipole@inverted
27398 \def\distfromline{-\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
27399 \else
27400 \def\distfromline{\ctikzvalof{voltage/distance from line}\pgf@circ@scaled@Rlen}
27401 \fi
27402 \fi
27403 \ifpgf@circuit@bipole@voltage@below
27404 \def\pgf@circ@voltage@angle{90}
27405 \else
27406 \def\pgf@circ@voltage@angle{-90}
27407 \fi
27408 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}
27409 \pgfkeysifdefined{\pgf@temp}
27410 { \edef\distancefromnode{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/distance from node}} }
27411 { \edef\distancefromnode{\ctikzvalof{voltage/distance from node}} }
27412 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}
27413 \pgfkeysifdefined{\pgf@temp}
27414 { \edef\bumpb{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump b}} }
27415 { \edef\bumpb{\ctikzvalof{voltage/bump b}} }
27416 \edef\shiftv{\ctikzvalof{voltage/shift}}
27417 % additional per-bipole voltage shift (internal)
27418 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
27419 \pgfkeysifdefined{\pgf@temp}
27420 {
27421 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
27422 }
27423 {
27424 \edef\addvshift{0}
27425 }
27426 \newdimen{\absvshift}
27427 \pgfmathsetlength{\absvshift}{(1+\shiftv+\addvshift)*(\distfromline)}
27428 % reset anchor if american and open
27429 \ifpgf@circuit@europeanvoltage
27430 \else
27431 \ifx\@@kind\@@open
27432 \def\pgf@circ@bipole@voltage@label@anchor{center}
27433 \fi
27434 \fi
27435 \ifpgf@circuit@bipole@voltage@raised
27436 \def\pgf@circ@bipole@voltage@label@anchor{center}
27437 \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
27438 \fi
27439 % apply the same shift to open "straight" voltage as raised
27440 % commented out due to https://github.com/circuitikz/circuitikz/issues/821
27441 % but I'm not sure if it's correct
27442 % \ifpgf@circuit@bipole@voltage@straight
27443 % \ifx\@@kind\@@open
27444 % \def\pgf@circ@bipole@voltage@label@anchor{center}
27445 % \pgfmathsetlength{\absvshift}{\absvshift+sign(\absvshift)*height{"Q"}} % with the current font.
27446 % \fi
27447 % \fi
27448 }
27449 % %\pgf@circ@Rlen/\ctikzvalof{current arrow scale} is equal to the length of the currarrow
27450 %absolute move, minimum space is length of arrowhead
27451 coordinate (pgfcirc@midtmp) at ($(\tikztostart) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorstartnode)$)
27452 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorstartnode)$)
27453 coordinate (pgfcirc@Vfrom@flat) at (pgfcirc@midtmp)
27454 %absolute move, minimum space is length of arrowhead
27455 coordinate (pgfcirc@midtmp) at ($(\tikztotarget) ! \pgf@circ@Rlen/\ctikzvalof{current arrow scale} ! (pgfcirc@anchorendnode)$)
27456 coordinate (pgfcirc@midtmp) at ($(pgfcirc@midtmp) ! \distancefromnode ! (pgfcirc@anchorendnode)$)
27457 coordinate (pgfcirc@Vto@flat) at (pgfcirc@midtmp)
27458 coordinate (pgfcirc@mid) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
27459
27460 \ifpgf@circuit@bipole@voltage@below
27461 % see comments for the "above" part (similar)
27462 \ifpgf@circuit@europeanvoltage
27463 \ifpgf@circuit@bipole@voltage@straight
27464 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
27465 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
27466 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vto@flat)$)
27467 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!90 : (pgfcirc@Vfrom1)$)
27468 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!-90 : (pgfcirc@Vto1)$)
27469 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
27470 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
27471 \else
27472 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
27473 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
27474 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-110)$)
27475 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.-70)$)
27476 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! -\absvshift!90 : (pgfcirc@Vcont2t)$)
27477 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! -\absvshift!-90 : (pgfcirc@Vcont1t)$)
27478 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
27479 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
27480 \fi
27481 \else
27482 % we are in case of american here
27483 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!90 : (pgfcirc@anchorendnode)$)
27484 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!-90 : (pgfcirc@anchorstartnode)$)
27485 coordinate (pgfcirc@bottom) at (\ctikzvalof{bipole/name}.-90)
27486 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@bottom)-(pgfcirc@Vfrom@flat)$)
27487 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@bottom) ! \absvshift!-90 : (pgfcirc@Vdir0)$)
27488 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
27489 \ifpgf@circuit@bipole@voltage@raised
27490 % move the from and to up to the level of Vlab
27491 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
27492 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
27493 \fi
27494 \fi
27495 \else
27496 \ifpgf@circuit@europeanvoltage
27497 \ifpgf@circuit@bipole@voltage@straight
27498 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
27499 % move parallel to the component line at pgfcirc@top distance
27500 coordinate (pgfcirc@Vto1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
27501 coordinate (pgfcirc@Vfrom1) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vto@flat)$)
27502 % add the extra distance
27503 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto1) ! \absvshift!-90 : (pgfcirc@Vfrom1)$)
27504 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom1) ! \absvshift!90 : (pgfcirc@Vto1)$)
27505 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
27506 % direction line to shift the label later
27507 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
27508 \else
27509 % european voltages here
27510 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! -\absvshift!90 : (pgfcirc@anchorendnode)$)
27511 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! -\absvshift!-90 : (pgfcirc@anchorstartnode)$)
27512 % identify the two control points for the "arc" of the voltage
27513 coordinate (pgfcirc@Vcont1t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.110)$)
27514 coordinate (pgfcirc@Vcont2t) at ($(\ctikzvalof{bipole/name}.center) ! \bumpb ! (\ctikzvalof{bipole/name}.70)$)
27515 % and shift them a bit
27516 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(pgfcirc@Vcont1t) ! \absvshift!90 : (pgfcirc@Vcont2t)$)
27517 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(pgfcirc@Vcont2t) ! \absvshift!-90 : (pgfcirc@Vcont1t)$)
27518 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vcont2)!0.5!(\pgfcirc@a@prefix-Vcont1)$)
27519 % direction line to shift the label later
27520 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vcont2)
27521 \fi
27522 \else
27523 % we are in case of american here
27524 coordinate (\pgfcirc@a@prefix-Vto) at ($(pgfcirc@Vto@flat) ! \absvshift!-90 : (pgfcirc@anchorendnode)$)
27525 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(pgfcirc@Vfrom@flat) ! \absvshift!90 : (pgfcirc@anchorstartnode)$)
27526 coordinate (pgfcirc@top) at (\ctikzvalof{bipole/name}.90)
27527 % move parallel to the component line
27528 coordinate (pgfcirc@Vdir0) at ($(pgfcirc@mid)+(pgfcirc@top)-(pgfcirc@Vfrom@flat)$)
27529 % and add the extra distance
27530 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@top) ! \absvshift!90 : (pgfcirc@Vdir0)$)
27531 coordinate (pgfcirc@Vdir) at ($(pgfcirc@mid)+(\pgfcirc@a@prefix-Vlab)-(pgfcirc@Vfrom@flat)$)
27532 \ifpgf@circuit@bipole@voltage@raised
27533 % move the from and to up to the level of Vlab
27534 coordinate (\pgfcirc@a@prefix-Vto) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vto@flat)-(pgfcirc@mid)$)
27535 coordinate (\pgfcirc@a@prefix-Vfrom) at ($(\pgfcirc@a@prefix-Vlab)+(pgfcirc@Vfrom@flat)-(pgfcirc@mid)$)
27536 \fi
27537 \fi
27538 \fi
27539 \ifx\@@kind\@@open
27540 coordinate (\pgfcirc@a@prefix-Vto) at (pgfcirc@Vto@flat)
27541 coordinate (\pgfcirc@a@prefix-Vfrom) at (pgfcirc@Vfrom@flat)
27542 \fi
27543 \ifpgf@circ@debugv
27544 node [ocirc, fill=red] at (pgfcirc@anchorstartnode) {}
27545 node [ocirc, fill=blue] at (pgfcirc@anchorendnode) {}
27546 node [ocirc, fill=green] at (\pgfcirc@a@prefix-Vto) {}
27547 node [ocirc, fill=yellow] at (\pgfcirc@a@prefix-Vfrom) {}
27548 node [odiamondpole, fill=green!50!black] at (pgfcirc@Vto@flat) {}
27549 node [odiamondpole, fill=orange] at (pgfcirc@Vfrom@flat) {}
27550 \ifpgf@circuit@europeanvoltage
27551 \ifpgf@circuit@bipole@voltage@straight
27552 \else
27553 node [osquarepole, fill=red] at (\pgfcirc@a@prefix-Vcont1) {}
27554 node [osquarepole, fill=blue] at (\pgfcirc@a@prefix-Vcont2) {}
27555 \fi
27556 \fi
27557 \fi
27558
27559 %
27560 % Now we draw the voltage things (only if not empty --- in which case we have been
27561 % called just to set the anchors)
27562 %
27563 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
27564 \ifpgfcirc@do@v@symbols
27565 \ifpgf@circuit@europeanvoltage
27566 \ifpgf@circuit@bipole@voltage@straight
27567 \ifpgf@circuit@bipole@voltage@backward
27568 (\pgfcirc@a@prefix-Vto) --(\pgfcirc@a@prefix-Vfrom) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
27569 \else
27570 (\pgfcirc@a@prefix-Vfrom) --(\pgfcirc@a@prefix-Vto) node[currarrow, sloped, allow upside down, pos=1,anchor=tip] {}
27571 \fi
27572 \else
27573 \ifpgf@circuit@bipole@voltage@backward
27574 (\pgfcirc@a@prefix-Vto) .. controls (\pgfcirc@a@prefix-Vcont2) and (\pgfcirc@a@prefix-Vcont1) ..
27575 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
27576 (\pgfcirc@a@prefix-Vfrom)
27577 \else
27578 (\pgfcirc@a@prefix-Vfrom) .. controls (\pgfcirc@a@prefix-Vcont1) and (\pgfcirc@a@prefix-Vcont2) ..
27579 node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {}
27580 (\pgfcirc@a@prefix-Vto)
27581 \fi
27582 \fi
27583 \else % american
27584 \ifpgf@circuit@bipole@voltage@backward
27585 \ifpgf@circ@oldvoltagedirection
27586 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
27587 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
27588 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
27589 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
27590 \else
27591 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
27592 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
27593 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
27594 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
27595 \fi
27596 \else
27597 \ifpgf@circ@oldvoltagedirection
27598 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
27599 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
27600 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
27601 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
27602 \else
27603 (\pgfcirc@a@prefix-Vfrom) node[inner sep=0, node font=\pgf@circ@avfont,
27604 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avplus}
27605 (\pgfcirc@a@prefix-Vto) node[inner sep=0, node font=\pgf@circ@avfont,
27606 anchor=\pgf@circ@bipole@voltage@label@anchor]{\pgf@circ@avminus}
27607 \fi
27608 \fi
27609 \fi
27610 \fi % closing the ...symbol
27611 \fi % Closing the ...ifempty
27612 }
27613 % %>>>
27614
27615 %% Output routine for voltage sources%<<<
27616 % (ugly) workaround for https://github.com/circuitikz/circuitikz/issues/747
27617 \ctikzset{voltage shift sources adjust/.initial=0.5} % coefficient added "by feel". Sorry.
27618 \def\pgf@circ@drawvoltagegenerator{
27619 % the following is affected indirectly by voltage/shift, you can move the arrow with voltage/bump a.
27620 % it's not perfect, but I can't find the way to do it correctly...
27621 \pgfextra{
27622 \edef\shiftv{\ctikzvalof{voltage/shift}}
27623 % distance along the 60-120 axis
27624 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}
27625 \pgfkeysifdefined{\pgf@temp}
27626 {
27627 \edef\bumpa{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/bump a}}
27628 }
27629 {
27630 \edef\bumpa{\ctikzvalof{voltage/bump a}}
27631 }
27632 % additional per-bipole voltage shift (internal)
27633 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}
27634 \pgfkeysifdefined{\pgf@temp}
27635 {
27636 \edef\addvshift{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/additional shift}}
27637 }
27638 {
27639 \edef\addvshift{0}
27640 }
27641 \pgfmathsetmacro{\bumpaplus}{\bumpa + \ctikzvalof{voltage shift sources adjust}*\shiftv}
27642 }
27643 \ifpgf@circuit@bipole@voltage@below
27644 coordinate (pgfcirc@Vfrom0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-120)$)
27645 coordinate (pgfcirc@Vto0) at ($(\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.-60)$)
27646 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! -90: (pgfcirc@Vto0) $)
27647 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! 90: (pgfcirc@Vfrom0) $)
27648 \else
27649 coordinate (pgfcirc@Vfrom0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.120)$)
27650 coordinate (pgfcirc@Vto0) at ($ (\ctikzvalof{bipole/name}.center) ! \bumpaplus ! (\ctikzvalof{bipole/name}.60)$)
27651 coordinate (\pgfcirc@a@prefix-Vfrom) at ($ (pgfcirc@Vfrom0) ! \addvshift! 90: (pgfcirc@Vto0) $)
27652 coordinate (\pgfcirc@a@prefix-Vto) at ($ (pgfcirc@Vto0) ! \addvshift! -90: (pgfcirc@Vfrom0) $)
27653 \fi
27654 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vto)!0.5!(\pgfcirc@a@prefix-Vfrom) $)
27655 coordinate (pgfcirc@Vdir) at (\pgfcirc@a@prefix-Vto)
27656 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
27657 \ifpgfcirc@do@v@symbols
27658 \ifpgf@circuit@europeanvoltage
27659 \ifpgf@circuit@bipole@voltage@backward
27660 (\pgfcirc@a@prefix-Vto) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vfrom)
27661 \else
27662 (\pgfcirc@a@prefix-Vfrom) -- node[currarrow, sloped, allow upside down, pos=1, anchor=tip] {} (\pgfcirc@a@prefix-Vto)
27663 \fi
27664 \else% american voltage
27665 \ifpgf@circuit@bipole@voltageoutsideofsymbol
27666 % if it is a battery, must put + and -
27667
27668 \ifpgf@circ@fixbatteries
27669 \ifpgf@circuit@bipole@voltage@backward
27670 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
27671 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
27672 \else
27673 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
27674 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
27675 \fi
27676 \else
27677 \ifpgf@circuit@bipole@voltage@backward
27678 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
27679 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
27680 \else
27681 (\pgfcirc@a@prefix-Vfrom) node[node font=\pgf@circ@avfont] {\pgf@circ@avplus}
27682 (\pgfcirc@a@prefix-Vto) node[node font=\pgf@circ@avfont] {\pgf@circ@avminus}
27683 \fi
27684 \fi
27685 \fi
27686 \fi
27687 \fi % closes ... ifsymbol
27688 \fi % closes ...ifempty
27689 }
27690 % %>>>
27691
27692 %% Output routine (main entry point) %<<<
27693 %% this is the entry point
27694 %%
27695 %% locally used dimensions
27696 \newdimen{\pgfcirc@labelshift}
27697 \newif\ifpgfcirc@v@curved % helper if --- true only if voltages are curved
27698 \def\pgf@circ@drawvoltage{% node name
27699 \pgfextra{%
27700 % set the helper if...curved
27701 \ifpgf@circuit@europeanvoltage
27702 \ifpgf@circuit@bipole@voltage@straight
27703 \pgfcirc@v@curvedfalse
27704 \else
27705 \pgfcirc@v@curvedtrue
27706 \fi
27707 \else
27708 \pgfcirc@v@curvedfalse
27709 \fi
27710 % \typeout{V routine called with prefix: \pgfcirc@a@prefix}
27711 % Label anchors WARNING: indentation is probably wrong
27712 \edef\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@direction\pgf@nil}
27713 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
27714 \ifpgf@circuit@bipole@voltage@below
27715 \def\pgf@circ@bipole@voltage@label@anchor{north west}
27716 \else
27717 \def\pgf@circ@bipole@voltage@label@anchor{south east}
27718 \fi
27719 \fi\fi
27720 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
27721 \ifpgf@circuit@bipole@voltage@below
27722 \def\pgf@circ@bipole@voltage@label@anchor{west}
27723 \else
27724 \def\pgf@circ@bipole@voltage@label@anchor{east}
27725 \fi
27726 \fi\fi
27727 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
27728 \ifpgf@circuit@bipole@voltage@below
27729 \def\pgf@circ@bipole@voltage@label@anchor{south west}
27730 \else \def\pgf@circ@bipole@voltage@label@anchor{north east}
27731 \fi
27732 \fi\fi
27733 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
27734 \ifpgf@circuit@bipole@voltage@below
27735 \def\pgf@circ@bipole@voltage@label@anchor{south}
27736 \else\def\pgf@circ@bipole@voltage@label@anchor{north}
27737 \fi
27738 \fi\fi
27739 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
27740 \ifpgf@circuit@bipole@voltage@below
27741 \def\pgf@circ@bipole@voltage@label@anchor{south east}
27742 \else\def\pgf@circ@bipole@voltage@label@anchor{north west}
27743 \fi
27744 \fi\fi
27745 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
27746 \ifpgf@circuit@bipole@voltage@below
27747 \def\pgf@circ@bipole@voltage@label@anchor{east}
27748 \else \def\pgf@circ@bipole@voltage@label@anchor{west}
27749 \fi
27750 \fi\fi
27751 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
27752 \ifpgf@circuit@bipole@voltage@below
27753 \def\pgf@circ@bipole@voltage@label@anchor{north east}
27754 \else\def\pgf@circ@bipole@voltage@label@anchor{south west}
27755 \fi
27756 \fi\fi
27757 \ifnum\pgfcircmathresult >-1 \ifnum\pgfcircmathresult <5
27758 \ifpgf@circuit@bipole@voltage@below
27759 \def\pgf@circ@bipole@voltage@label@anchor{north}
27760 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
27761 \fi
27762 \fi\fi
27763 \ifnum\pgfcircmathresult >355 \ifnum\pgfcircmathresult <361
27764 \ifpgf@circuit@bipole@voltage@below
27765 \def\pgf@circ@bipole@voltage@label@anchor{north}
27766 \else\def\pgf@circ@bipole@voltage@label@anchor{south}
27767 \fi
27768 \fi\fi
27769
27770 % export anchor position (if not needed, is always the same macro)
27771 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Vlab-anchor\endcsname{\pgf@circ@bipole@voltage@label@anchor}
27772 % this must be set *before* changing for mirroring and inverting; in that case
27773 % the xscale/yscale parameters take it into account
27774 \ifpgf@circuit@bipole@voltage@below
27775 \def\pgf@circ@bipole@voltage@label@where{-90}
27776 \else
27777 \def\pgf@circ@bipole@voltage@label@where{90}
27778 \fi
27779
27780 % magic to counteract the scale and yscale effects (there should be a better way...)
27781 \ifnum \ctikzvalof{mirror value}=-1
27782 \ifpgf@circuit@bipole@voltage@below
27783 \pgf@circuit@bipole@voltage@belowfalse
27784 \else
27785 \pgf@circuit@bipole@voltage@belowtrue
27786 \fi
27787 \fi
27788
27789 \ifpgf@circuit@bipole@inverted
27790 \ifpgf@circuit@bipole@voltage@below
27791 \pgf@circuit@bipole@voltage@belowfalse
27792 \else
27793 \pgf@circuit@bipole@voltage@belowtrue
27794 \fi
27795 \fi
27796
27797 % take into account scaling
27798 \setscaledRlenforclass
27799 % set the macro for detecting open
27800 \edef\@@kind{\ctikzvalof{bipole/kind}}\edef\@@open{open}
27801 % start voltage label adjustment
27802 \ifpgf@circuit@europeanvoltage
27803 \ifpgf@circuit@bipole@voltage@straight
27804 % check for straight
27805 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}
27806 \pgfkeysifdefined{\pgf@temp}{%
27807 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/straight label distance}}%
27808 % \typeout{ST:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \stdist}
27809 }{\edef\labeldist{\ctikzvalof{voltage/straight label distance}}}
27810 \ifpgf@circ@debugv\edef\whichtypeshift{STR}\fi
27811 % do not labelshift for legacy straight open; 1.4 makes the shift null
27812 \ifx\@@kind\@@open\ifpgf@adjust@open@voltage\else\edef\labeldist{1.4}\fi\fi
27813 \else
27814 % check for european
27815 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}
27816 \pgfkeysifdefined{\pgf@temp}{%
27817 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/european label distance}}%
27818 % \typeout{EU:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \eudist}
27819 }{ \edef\labeldist{\ctikzvalof{voltage/european label distance}}}
27820 \ifpgf@circ@debugv\edef\whichtypeshift{EUR}\fi
27821 \fi
27822 \else
27823 % check for american
27824 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}
27825 \pgfkeysifdefined{\pgf@temp}{%
27826 \ifpgf@circuit@bipole@voltage@raised
27827 % do not apply the shift if we are using raised american style
27828 \edef\labeldist{1.4}% default value
27829 \else
27830 \edef\labeldist{\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/voltage/american label distance}}%
27831 \fi
27832 % \typeout{AL:ADJUSTED\space for\space \ctikzvalof{bipole/kind} \space at \space \aldist}
27833 }{\edef\labeldist{\ctikzvalof{voltage/american label distance}}}
27834 \ifpgf@circ@debugv\edef\whichtypeshift{AME}\fi
27835 \fi
27836 % find the height of the bipole or use a default value
27837 \edef\pgf@temp{/tikz/circuitikz/bipoles/\ctikzvalof{bipole/kind}/height}
27838 \pgfkeysifdefined{\pgf@temp}
27839 {\pgfmathsetmacro{\partheightf}{0.5*\ctikzvalof{bipoles/\ctikzvalof{bipole/kind}/height}}
27840 \edef\partheight{\partheightf\pgf@circ@scaled@Rlen}}
27841 {\edef\partheight{(.5\pgf@circ@scaled@Rlen)}} %fallback to fixed value
27842 \ifpgf@circuit@bipole@isvoltage
27843 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.2)*\partheight}
27844 \else
27845 \pgfmathsetlength{\pgfcirc@labelshift}{(\labeldist-1.4)*\partheight}
27846 \fi
27847 % the value for the european was by default 1.4
27848 \pgfsetcornersarced{\pgfpointorigin}% do not use rounded corners!
27849 % stop the detection of open if I do not want special treatment
27850 \ifpgf@adjust@open@voltage\else\edef\@@open{this-will-nEver-match}\fi
27851 % \typeout{KIND\space\@@kind}
27852 }%end pgfextra
27853
27854 \ifpgf@circuit@bipole@isvoltage
27855 \pgf@circ@drawvoltagegenerator
27856 % add fake cont1 and cont2 anchors for export
27857 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
27858 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
27859 \else
27860 \pgf@circ@drawvoltagegeneric
27861 \fi
27862 % % debugging
27863 % \pgfextra{%
27864 % \typeout{LABEL\space KIND:\@@kind\space EU:\the\pgfcirc@eushift\space AL:\the\pgfcirc@alshift\space
27865 % DIRECTION:\pgf@circ@bipole@voltage@label@where}
27866 % \pgf@circ@debugvtrue}
27867
27868 % move a bit if requested
27869 coordinate (\pgfcirc@a@prefix-Vlab) at ($(\pgfcirc@a@prefix-Vlab) ! \pgfcirc@labelshift ! \pgf@circ@bipole@voltage@label@where :(pgfcirc@Vdir)$)
27870
27871 % check for the case of american AND open
27872 \ifpgf@circuit@europeanvoltage
27873 \else
27874 \ifx\@@kind\@@open
27875 % override pgfcirc@Vlab
27876 coordinate (\pgfcirc@a@prefix-Vlab) at ($(pgfcirc@Vfrom@flat)!0.5!(pgfcirc@Vto@flat)$)
27877 \fi
27878 \fi
27879
27880 \ifpgf@circ@debugv
27881 node [odiamondpole, color=blue] at (\pgfcirc@a@prefix-Vlab) {}
27882 node [odiamondpole, color=red] at (pgfcirc@Vdir) {}
27883 node [overlay, red, font=\tiny, anchor=south east, align=right] at(pgfcirc@Vdir)
27884 {\whichtypeshift:\the\pgfcirc@labelshift\\ DIR:\pgf@circ@bipole@voltage@label@where}
27885 \fi
27886
27887 % put the node only if it's not empty
27888 \pgf@circ@ifkeyempty{bipole/voltage/label/name}\else
27889 node [anchor=\pgf@circ@bipole@voltage@label@anchor, inner sep=2pt,
27890 \circuitikzbasekey/bipole voltage style](\ctikzvalof{bipole/name}voltage)
27891 at (\pgfcirc@a@prefix-Vlab) {\pgf@circ@finallabels{voltage/label}}
27892 \fi
27893
27894 \ifpgfcirc@v@curved\else
27895 % fake Vcont1 and Vcont2 for when they are exported --- in the middle of Vto and Vfrom
27896 coordinate (\pgfcirc@a@prefix-Vcont1) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
27897 coordinate (\pgfcirc@a@prefix-Vcont2) at ($(\pgfcirc@a@prefix-Vfrom) !0.5! (\pgfcirc@a@prefix-Vto)$)
27898 \fi
27899 % revert from and to (and c1 - c2) if needed (simpler than rework the positioning above...)
27900 \ifpgf@circuit@bipole@voltage@backward
27901 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vfrom}{\pgfcirc@a@prefix-Vto}
27902 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Vcont1}{\pgfcirc@a@prefix-Vcont2}
27903 \fi
27904
27905 }%end drawvoltages
27906
27907 % %>>>
27908
27909 %% these should be arguably moved to every component definition...
27910
27911 % special cases for voltage positions%<<<1
27912 % the KIND is the node name without SHAPE
27913 % See the definition above for meaning
27914 % if bipoles/KIND/voltage/straight label distance is not defined, it uses the height
27915 % if bipoles/KIND/voltage/additional shift is not defined, it is 0 (extra distance)
27916 %
27917 \ctikzset{bipoles/generic/voltage/distance from node/.initial=0.4}
27918 \ctikzset{bipoles/generic/voltage/bump b/.initial=2}
27919 %
27920 \ctikzset{bipoles/ageneric/voltage/distance from node/.initial=.4}
27921 \ctikzset{bipoles/ageneric/voltage/bump b/.initial=2}
27922 %
27923 \ctikzset{bipoles/fullgeneric/voltage/distance from node/.initial=.4}
27924 \ctikzset{bipoles/fullgeneric/voltage/bump b/.initial=2}
27925 %
27926 \ctikzset{bipoles/memristor/voltage/distance from node/.initial=.4}
27927 \ctikzset{bipoles/memristor/voltage/bump b/.initial=2}
27928 %
27929 \ctikzset{bipoles/tline/voltage/bump b/.initial=2.4}
27930 %
27931 \ctikzset{bipoles/varistor/voltage/bump b/.initial=2.4}
27932 \ctikzset{bipoles/varistor/voltage/american label distance/.initial=1.8}
27933 %
27934 \ctikzset{bipoles/photoresistor/voltage/bump b/.initial=1.6}
27935 %
27936 \ctikzset{bipoles/thermistor/voltage/bump b/.initial=2.4}
27937 \ctikzset{bipoles/thermistor/voltage/european label distance/.initial=0.8}
27938 \ctikzset{bipoles/thermistorntc/voltage/bump b/.initial=1.6}
27939 \ctikzset{bipoles/thermistorntc/voltage/european label distance/.initial=0.8}
27940 \ctikzset{bipoles/thermistorptc/voltage/bump b/.initial=1.6}
27941 \ctikzset{bipoles/thermistorptc/voltage/european label distance/.initial=0.8}
27942 %
27943 \ctikzset{bipoles/ccapacitor/voltage/bump b/.initial=2.2}
27944 %
27945 \ctikzset{bipoles/emptyzzdiode/voltage/bump b/.initial=2.5}
27946 \ctikzset{bipoles/emptyzzdiode/voltage/european label distance/.initial=1.0}
27947 \ctikzset{bipoles/fullzzdiode/voltage/bump b/.initial=2.5}
27948 \ctikzset{bipoles/fullzzdiode/voltage/european label distance/.initial=1.0}
27949 \ctikzset{bipoles/emptythyristor/voltage/bump b/.initial=2.0}
27950 \ctikzset{bipoles/emptythyristor/voltage/european label distance/.initial=1.2}
27951 \ctikzset{bipoles/fullthyristor/voltage/bump b/.initial=2.0}
27952 \ctikzset{bipoles/fullthyristor/voltage/european label distance/.initial=1.2}
27953 \ctikzset{bipoles/emptytriac/voltage/bump b/.initial=1.8}
27954 \ctikzset{bipoles/emptytriac/voltage/european label distance/.initial=0.8}
27955 \ctikzset{bipoles/fulltriac/voltage/bump b/.initial=1.8}
27956 \ctikzset{bipoles/fulltriac/voltage/european label distance/.initial=0.8}
27957 %
27958 \ctikzset{bipoles/short/voltage/american label distance/.initial=2.8}
27959 \ctikzset{bipoles/open/voltage/distance from node/.initial=0.3}
27960 %
27961 \ctikzset{bipoles/battery/voltage/bump a/.initial=1.4}
27962 \ctikzset{bipoles/vsourceAM/voltage/american label distance/.initial=1.2}
27963 \ctikzset{bipoles/cvsourceAM/voltage/american label distance/.initial=1.2}
27964 %%>>>
27965
27966 % vim: set fdm=marker fmr=%<<<,%>>>:
27967 %%%---------- close: tex/pgfcircvoltage
27968 %%%%%%%%%%% Springe nach tex/pgfcirccurrent
27969 %%%---------- open: tex/pgfcirccurrent.tex
27970 % Copyright 2018-2026 by Romano Giannetti
27971 % Copyright 2015-2026 by Stefan Lindner
27972 % Copyright 2013-2026 by Stefan Erhardt
27973 % Copyright 2007-2026 by Massimo Redaelli
27974 %
27975 % This file may be distributed and/or modified
27976 %
27977 % 1. under the LaTeX Project Public License and/or
27978 % 2. under the GNU Public License.
27979 %
27980 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
27981
27982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27983 %% Current handling
27984
27985 %% styles
27986 \ctikzset{bipole current style/.style={}}
27987 \tikzset{bipole current style/.code={
27988 \ctikzset{bipole current style/.style={#1}}
27989 }}
27990 \tikzset{bipole current append style/.code={
27991 \ctikzset{bipole current style/.append style={#1}}
27992 }}
27993
27994 %% Options
27995 \ctikzset{i^>/.style = {
27996 i={#1},
27997 \circuitikzbasekey/bipole/current/direction = forward,
27998 \circuitikzbasekey/bipole/current/x position = after,
27999 \circuitikzbasekey/bipole/current/y position = above
28000 }
28001 }
28002
28003 \ctikzset{i_>/.style = {
28004 i={#1},
28005 \circuitikzbasekey/bipole/current/direction = forward,
28006 \circuitikzbasekey/bipole/current/x position = after,
28007 \circuitikzbasekey/bipole/current/y position = below
28008 }
28009 }
28010
28011 \ctikzset{i>^/.style = {
28012 i={#1},
28013 \circuitikzbasekey/bipole/current/direction = forward,
28014 \circuitikzbasekey/bipole/current/x position = before,
28015 \circuitikzbasekey/bipole/current/y position = above
28016 }
28017 }
28018
28019 \ctikzset{i>_/.style = {
28020 i={#1},
28021 \circuitikzbasekey/bipole/current/direction = forward,
28022 \circuitikzbasekey/bipole/current/x position = before,
28023 \circuitikzbasekey/bipole/current/y position = below
28024 }
28025 }
28026
28027 \ctikzset{i^</.style = {
28028 i={#1},
28029 \circuitikzbasekey/bipole/current/direction = backward,
28030 \circuitikzbasekey/bipole/current/x position = after,
28031 \circuitikzbasekey/bipole/current/y position = above
28032 }
28033 }
28034
28035 \ctikzset{i_</.style = {
28036 i={#1},
28037 \circuitikzbasekey/bipole/current/direction = backward,
28038 \circuitikzbasekey/bipole/current/x position = after,
28039 \circuitikzbasekey/bipole/current/y position = below
28040 }
28041 }
28042
28043 \ctikzset{i<^/.style = {
28044 i={#1},
28045 \circuitikzbasekey/bipole/current/direction = backward,
28046 \circuitikzbasekey/bipole/current/x position = before,
28047 \circuitikzbasekey/bipole/current/y position = above
28048 }
28049 }
28050
28051 \ctikzset{i<_/.style = {
28052 i={#1},
28053 \circuitikzbasekey/bipole/current/direction = backward,
28054 \circuitikzbasekey/bipole/current/x position = before,
28055 \circuitikzbasekey/bipole/current/y position = below
28056 }
28057 }
28058
28059 \newif\ifpgfcirc@do@i@symbols\pgfcirc@do@i@symbolstrue
28060 \ctikzset{no i symbols/.code={\pgfcirc@do@i@symbolsfalse}}
28061 \ctikzset{i symbols/.code={\pgfcirc@do@i@symbolstrue}}
28062
28063 \ctikzset{i/.code = {
28064 \pgfcirc@has@itrue
28065 \ifpgf@circuit@bipole@override@source@vif
28066 \pgf@circuit@bipole@isvoltagefalse
28067 \pgf@circuit@bipole@iscurrentfalse
28068 \fi
28069 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
28070 \circuitikzbasekey/bipole/current/x position = after,
28071 \circuitikzbasekey/bipole/current/y position = above }
28072 \pgfkeys{/tikz/circuitikz/bipole/current/label/name={#1}}
28073 \ctikzsetvalof{bipole/current/label/unit}{}
28074 \ifpgf@circ@siunitx
28075 \pgf@circ@handleSI{#1}
28076 \ifpgf@circ@siunitx@res
28077 \edef\pgf@temp{\pgf@circ@handleSI@val}
28078 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/name}{\pgf@temp}
28079 \edef\pgf@temp{\pgf@circ@handleSI@unit}
28080 \pgfkeyslet{/tikz/circuitikz/bipole/current/label/unit}{\pgf@temp}
28081 \else
28082 \fi
28083 \else
28084 \fi
28085 %reverse current direction for voltage sources
28086 \ifpgf@circ@oldvoltagedirection\else
28087 \ifpgf@circuit@bipole@isvoltage
28088 \ifpgf@circuit@bipole@voltage@backward
28089 \pgfkeys{\circuitikzbasekey/bipole/current/direction = forward,
28090 \circuitikzbasekey/bipole/current/x position = after,
28091 \circuitikzbasekey/bipole/current/y position = below }
28092 \else
28093 \pgfkeys{\circuitikzbasekey/bipole/current/direction = backward,
28094 \circuitikzbasekey/bipole/current/x position = before,
28095 \circuitikzbasekey/bipole/current/y position = above }
28096 \fi\fi\fi
28097 }
28098 }
28099
28100 \ifpgf@circ@oldvoltagedirection
28101 \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward } }
28102 \else
28103 \ctikzset{i</.style = { i={#1}, \circuitikzbasekey/bipole/current/direction = backward, \circuitikzbasekey/bipole/current/x position = before } }
28104 \fi
28105 \ctikzset{i_/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = below } }
28106 \ctikzset{i>/.style = {i={#1}, \circuitikzbasekey/bipole/current/direction = forward } }
28107 \ctikzset{i^/.style = { i={#1}, \circuitikzbasekey/bipole/current/y position = above } }
28108
28109 %% Output routine
28110 \def\pgf@circ@drawcurrent{
28111 \pgfextra{
28112 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
28113 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
28114
28115 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
28116 \ifpgf@circuit@bipole@current@below
28117 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
28118 \fi
28119 \fi\fi
28120 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
28121 \ifpgf@circuit@bipole@current@below
28122 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
28123 \fi
28124 \fi\fi
28125 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
28126 \ifpgf@circuit@bipole@current@below
28127 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
28128 \fi
28129 \fi\fi
28130 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
28131 \ifpgf@circuit@bipole@current@below
28132 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
28133 \fi
28134 \fi\fi
28135 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
28136 \ifpgf@circuit@bipole@current@below
28137 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
28138 \fi
28139 \fi\fi
28140 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
28141 \ifpgf@circuit@bipole@current@below
28142 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
28143 \fi
28144 \fi\fi
28145 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
28146 \ifpgf@circuit@bipole@current@below
28147 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
28148 \fi
28149 \fi\fi
28150 \ifnum\pgfcircmathresult <5
28151 \ifpgf@circuit@bipole@current@below
28152 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
28153 \fi
28154 \fi
28155 \ifnum\pgfcircmathresult >355
28156 \ifpgf@circuit@bipole@current@below
28157 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
28158 \fi
28159 \fi
28160 % export anchor position (if not needed, is always the same macro)
28161 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Ilab-anchor\endcsname{\pgf@circ@dir}
28162
28163 \ifpgf@circuit@bipole@current@below
28164 \def\pgf@circ@bipole@current@label@where{-90}
28165 \else
28166 \def\pgf@circ@bipole@current@label@where{+90}
28167 \fi
28168 }
28169
28170 %
28171 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
28172 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
28173 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
28174 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
28175 \else% normal bipole or source
28176 \ifpgf@circuit@bipole@current@before
28177 coordinate (\pgfcirc@a@prefix-Ifrom) at (\tikztostart)
28178 coordinate (\pgfcirc@a@prefix-Ito) at (pgfcirc@anchorstartnode)
28179 \else
28180 coordinate (\pgfcirc@a@prefix-Ifrom) at (pgfcirc@anchorendnode)
28181 coordinate (\pgfcirc@a@prefix-Ito) at (\tikztotarget)
28182 \fi
28183 \fi
28184 \ifpgf@circuit@bipole@current@backward
28185 \pgfextra{
28186 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
28187 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
28188 }
28189 \fi
28190 coordinate (\pgfcirc@a@prefix-Ipos) at ($(\pgfcirc@a@prefix-Ifrom)! \ctikzvalof{current/distance} !(\pgfcirc@a@prefix-Ito)$)
28191 % export the current direction
28192 \pgfextra{\expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Iarrow-direction\endcsname{\pgf@circ@rounded@dir}}
28193 % if the current label is not empty (in which case we have already all the anchors)
28194 \pgf@circ@ifkeyempty{bipole/current/label/name}\else
28195 % put the arrow node
28196 % if we do not want the arrow, just put an empty node (needed to maintain the exact same distances)
28197 \ifpgfcirc@do@i@symbols
28198 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
28199 \else
28200 node[currarrow, rotate=\pgf@circ@rounded@dir, anchor=center,
28201 circuitikz/phantom@currarrow](Iarrow) at (\pgfcirc@a@prefix-Ipos) {}
28202 \fi
28203 % put the label
28204 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole current style]
28205 (\ctikzvalof{bipole/name}current)
28206 at (Iarrow.\pgf@circ@bipole@current@label@where){\pgf@circ@finallabels{current/label}}
28207 \fi % end ifempty
28208 \ifpgf@circuit@bipole@current@backward
28209 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ifrom}{\pgfcirc@a@prefix-Ito}
28210 \fi
28211 }
28212
28213 %%%---------- close: tex/pgfcirccurrent
28214 %%%%%%%%%%% Springe nach tex/pgfcircflow
28215 %%%---------- open: tex/pgfcircflow.tex
28216 % Copyright 2018-2026 by Romano Giannetti
28217 % Copyright 2015-2026 by Stefan Lindner
28218 % Copyright 2013-2026 by Stefan Erhardt
28219 % Copyright 2007-2026 by Massimo Redaelli
28220 %
28221 % This file may be distributed and/or modified
28222 %
28223 % 1. under the LaTeX Project Public License and/or
28224 % 2. under the GNU Public License.
28225 %
28226 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
28227
28228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28229 %% flow handling
28230
28231
28232 %% styles
28233 \ctikzset{bipole flow style/.style={}}
28234 \tikzset{bipole flow style/.code={
28235 \ctikzset{bipole flow style/.style={#1}}
28236 }}
28237 \tikzset{bipole flow append style/.code={
28238 \ctikzset{bipole flow style/.append style={#1}}
28239 }}
28240
28241 %% Options
28242 \ctikzset{f^>/.style = {
28243 f={#1},
28244 \circuitikzbasekey/bipole/flow/direction = forward,
28245 \circuitikzbasekey/bipole/flow/x position = after,
28246 \circuitikzbasekey/bipole/flow/y position = above
28247 }
28248 }
28249
28250 \ctikzset{f_>/.style = {
28251 f={#1},
28252 \circuitikzbasekey/bipole/flow/direction = forward,
28253 \circuitikzbasekey/bipole/flow/x position = after,
28254 \circuitikzbasekey/bipole/flow/y position = below
28255 }
28256 }
28257
28258 \ctikzset{f>^/.style = {
28259 f={#1},
28260 \circuitikzbasekey/bipole/flow/direction = forward,
28261 \circuitikzbasekey/bipole/flow/x position = before,
28262 \circuitikzbasekey/bipole/flow/y position = above
28263 }
28264 }
28265
28266 \ctikzset{f>_/.style = {
28267 f={#1},
28268 \circuitikzbasekey/bipole/flow/direction = forward,
28269 \circuitikzbasekey/bipole/flow/x position = before,
28270 \circuitikzbasekey/bipole/flow/y position = below
28271 }
28272 }
28273
28274 \ctikzset{f^</.style = {
28275 f={#1},
28276 \circuitikzbasekey/bipole/flow/direction = backward,
28277 \circuitikzbasekey/bipole/flow/x position = after,
28278 \circuitikzbasekey/bipole/flow/y position = above
28279 }
28280 }
28281
28282 \ctikzset{f_</.style = {
28283 f={#1},
28284 \circuitikzbasekey/bipole/flow/direction = backward,
28285 \circuitikzbasekey/bipole/flow/x position = after,
28286 \circuitikzbasekey/bipole/flow/y position = below
28287 }
28288 }
28289
28290 \ctikzset{f<^/.style = {
28291 f={#1},
28292 \circuitikzbasekey/bipole/flow/direction = backward,
28293 \circuitikzbasekey/bipole/flow/x position = before,
28294 \circuitikzbasekey/bipole/flow/y position = above
28295 }
28296 }
28297
28298 \ctikzset{f<_/.style = {
28299 f={#1},
28300 \circuitikzbasekey/bipole/flow/direction = backward,
28301 \circuitikzbasekey/bipole/flow/x position = before,
28302 \circuitikzbasekey/bipole/flow/y position = below
28303 }
28304 }
28305
28306 \ctikzset{f</.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = backward} }
28307 \ctikzset{f_/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = below } }
28308 \ctikzset{f>/.style = { f={#1}, \circuitikzbasekey/bipole/flow/direction = forward } }
28309 \ctikzset{f^/.style = { f={#1}, \circuitikzbasekey/bipole/flow/y position = above } }
28310
28311 \newif\ifpgfcirc@do@f@symbols\pgfcirc@do@f@symbolstrue
28312 \ctikzset{no f symbols/.code={\pgfcirc@do@f@symbolsfalse}}
28313 \ctikzset{f symbols/.code={\pgfcirc@do@f@symbolstrue}}
28314
28315 \ctikzset{f/.code = {
28316 \pgfcirc@has@ftrue
28317 \ifpgf@circuit@bipole@override@source@vif
28318 \pgf@circuit@bipole@isvoltagefalse
28319 \pgf@circuit@bipole@iscurrentfalse
28320 \fi
28321 \pgfkeys{\circuitikzbasekey/bipole/flow/direction = forward,
28322 \circuitikzbasekey/bipole/flow/x position = after,
28323 \circuitikzbasekey/bipole/flow/y position = above }
28324 \pgfkeys{/tikz/circuitikz/bipole/flow/label/name={#1}}
28325 \ctikzsetvalof{bipole/flow/label/unit}{}
28326 \ifpgf@circ@siunitx
28327 \pgf@circ@handleSI{#1}
28328 \ifpgf@circ@siunitx@res
28329 \edef\pgf@temp{\pgf@circ@handleSI@val}
28330 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/name}{\pgf@temp}
28331 \edef\pgf@temp{\pgf@circ@handleSI@unit}
28332 \pgfkeyslet{/tikz/circuitikz/bipole/flow/label/unit}{\pgf@temp}
28333 \else
28334 \fi
28335 \else
28336 \fi
28337 }
28338 }
28339
28340 %% Output routine
28341
28342 \def\pgf@circ@drawflow{
28343 \pgfextra{
28344 \edef\pgf@circ@rounded@dir{\pgf@circ@direction}
28345 \def\pgfcircmathresult{\expandafter\pgf@circ@stripdecimals\pgf@circ@rounded@dir\pgf@nil}
28346
28347 \ifnum\pgfcircmathresult >4 \ifnum\pgfcircmathresult <86
28348 \ifpgf@circuit@bipole@flow@below
28349 \def\pgf@circ@dir{north west} \else \def\pgf@circ@dir{south east}
28350 \fi
28351 \fi\fi
28352 \ifnum\pgfcircmathresult >85 \ifnum\pgfcircmathresult <95
28353 \ifpgf@circuit@bipole@flow@below
28354 \def\pgf@circ@dir{west} \else \def\pgf@circ@dir{east}
28355 \fi
28356 \fi\fi
28357 \ifnum\pgfcircmathresult >94 \ifnum\pgfcircmathresult <176
28358 \ifpgf@circuit@bipole@flow@below
28359 \def\pgf@circ@dir{south west}\else \def\pgf@circ@dir{north east}
28360 \fi
28361 \fi\fi
28362 \ifnum\pgfcircmathresult >175 \ifnum\pgfcircmathresult <185
28363 \ifpgf@circuit@bipole@flow@below
28364 \def\pgf@circ@dir{south}\else\def\pgf@circ@dir{north}
28365 \fi
28366 \fi\fi
28367 \ifnum\pgfcircmathresult >184 \ifnum\pgfcircmathresult <266
28368 \ifpgf@circuit@bipole@flow@below
28369 \def\pgf@circ@dir{south east}\else\def\pgf@circ@dir{north west}
28370 \fi
28371 \fi\fi
28372 \ifnum\pgfcircmathresult >265 \ifnum\pgfcircmathresult <275
28373 \ifpgf@circuit@bipole@flow@below
28374 \def\pgf@circ@dir{east}\else \def\pgf@circ@dir{west}
28375 \fi
28376 \fi\fi
28377 \ifnum\pgfcircmathresult >274 \ifnum\pgfcircmathresult <356
28378 \ifpgf@circuit@bipole@flow@below
28379 \def\pgf@circ@dir{north east}\else\def\pgf@circ@dir{south west}
28380 \fi
28381 \fi\fi
28382 \ifnum\pgfcircmathresult <5
28383 \ifpgf@circuit@bipole@flow@below
28384 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
28385 \fi
28386 \fi
28387 \ifnum\pgfcircmathresult >355
28388 \ifpgf@circuit@bipole@flow@below
28389 \def\pgf@circ@dir{north}\else\def\pgf@circ@dir{south}
28390 \fi
28391 \fi
28392
28393 \ifpgf@circuit@bipole@flow@below
28394 \def\pgf@circ@bipole@flow@label@where{-90}
28395 \else
28396 \def\pgf@circ@bipole@flow@label@where{+90}
28397 \fi
28398 % export anchor position (if not needed, is always the same macro)
28399 \expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Flab-anchor\endcsname{\pgf@circ@dir}
28400 }
28401
28402 \pgfextra{\def\pgf@temp{short}\edef\pgf@circ@temp{\ctikzvalof{bipole/kind}}}
28403 \ifx\pgf@circ@temp\pgf@temp%draw current at a short at middle of the line
28404 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
28405 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
28406 \else% normal bipole or source
28407 \ifpgf@circuit@bipole@flow@before
28408 coordinate (pgfcirc@Ffrom@flat) at (\tikztostart)
28409 coordinate (pgfcirc@Fto@flat) at (pgfcirc@anchorstartnode)
28410 \else
28411 coordinate (pgfcirc@Ffrom@flat) at (pgfcirc@anchorendnode)
28412 coordinate (pgfcirc@Fto@flat) at (\tikztotarget)
28413 \fi
28414 \fi
28415 \pgfextra{
28416 \newdimen{\absfshift}
28417 \def\flow@offset{\ctikzvalof{flow/offset}\pgf@circ@Rlen}
28418 \absfshift=\flow@offset
28419 \ifpgf@circuit@bipole@flow@backward
28420 \pgfmathsubtract{\pgf@circ@rounded@dir}{180}
28421 \edef\pgf@circ@rounded@dir{\expandafter\pgf@circ@stripdecimals\pgfmathresult\pgf@nil}
28422 \fi
28423 }
28424 \ifpgf@circuit@bipole@flow@below
28425 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !-90: (pgfcirc@Fto@flat)$)
28426 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !90: (pgfcirc@Ffrom@flat)$)
28427 \else
28428 coordinate (pgfcirc@Ffrom@up) at ($(pgfcirc@Ffrom@flat) ! \absfshift !90: (pgfcirc@Fto@flat)$)
28429 coordinate (pgfcirc@Fto@up) at ($(pgfcirc@Fto@flat) ! \absfshift !-90: (pgfcirc@Ffrom@flat)$)
28430 \fi
28431 coordinate (\pgfcirc@a@prefix-Fpos) at ($(pgfcirc@Ffrom@up) ! \ctikzvalof{flow/distance} !(pgfcirc@Fto@up)$)
28432 \pgfextra{
28433 \absfshift=0.25\pgf@circ@Rlen% This is half size of the "flowarrow" shape!
28434 }
28435 coordinate (\pgfcirc@a@prefix-Ffrom) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Ffrom@up)$)
28436 coordinate (\pgfcirc@a@prefix-Fto) at ($(\pgfcirc@a@prefix-Fpos)!\absfshift!(pgfcirc@Fto@up) $)
28437 %
28438 % coordinate (\pgfcirc@a@prefix-Fpos) at
28439 % ([yshift=\flow@offset]$(\pgfcirc@a@prefix-Ffrom)! \ctikzvalof{flow/distance} !(\pgfcirc@a@prefix-Fto)$)
28440 % export the flow direction
28441 \pgfextra{\expandafter\xdef\csname pgfcirc@\pgfcirc@a@prefix-Farrow-direction\endcsname{\pgf@circ@rounded@dir}}
28442 % if the flow label is not empty (in which case we have already all the anchors)
28443 \pgf@circ@ifkeyempty{bipole/flow/label/name}\else
28444 % the flow arrow is really a node "flowarrow", not a real arrow
28445 \ifpgfcirc@do@f@symbols
28446 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
28447 \else
28448 node[flowarrow, rotate=\pgf@circ@rounded@dir, anchor=center,
28449 circuitikz/phantom@flowarrow](Farrowpos) at (\pgfcirc@a@prefix-Fpos) {}
28450 \fi
28451 node[anchor=\pgf@circ@dir, \circuitikzbasekey/bipole flow style]
28452 (\ctikzvalof{bipole/name}flow) at (Farrowpos.\pgf@circ@bipole@flow@label@where) {\pgf@circ@finallabels{flow/label}}
28453 \fi
28454 % adjust from and to before exporting --- it's much more simple like this then rework the algorithm above
28455 \ifpgf@circuit@bipole@flow@backward
28456 \pgfcirc@swap@coordinates{\pgfcirc@a@prefix-Ffrom}{\pgfcirc@a@prefix-Fto}
28457 \fi
28458
28459 }
28460
28461 %%%---------- close: tex/pgfcircflow
28462
28463 \ifpgf@circ@siunitx
28464 \RequirePackage{xstring}[2009/03/13]
28465 %\expandafter\let\csname angstrom\endcsname\relax
28466 \RequirePackage{siunitx}
28467 \fi
28468
28469 %% This should be executed *after* all the options!
28470 %
28471 % Remove the warning; nobody cares.
28472 %
28473 % \AtEndOfPackage{%
28474 % \ifpgf@circ@explicitvdir\else
28475 % \PackageWarningNoLine{circuitikz}{%
28476 % You did not specify one of the voltage directions:\MessageBreak
28477 % \space\space oldvoltagedirection, nooldvoltagedirection, \MessageBreak
28478 % \space\space RPvoltages or EFvoltages \MessageBreak
28479 % Default directions may have changed, \MessageBreak
28480 % please check the manual%
28481 % }
28482 % \fi
28483 % }
28484
28485 \newenvironment{circuitikz}{\begin{tikzpicture}}{\end{tikzpicture}}
28486 %override (unused) circuitikz environment for compability to externalization)
28487 \let\circuitikz\tikzpicture
28488 \let\endcircuitikz\endtikzpicture
28489
28490 \endinput